/* =========================================================================
   Portfolio — single stylesheet
   1. Tokens        2. Reset        3. Typography    4. Layout
   5. Header/Nav    6. Hero         7. Filters       8. Project grid
   9. Sections     10. Project page 11. Footer      12. Utilities
   ========================================================================= */

/* 1. Tokens ------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --bg:          #0b0b0d;
  --bg-elev:     #131316;
  --bg-sunken:   #08080a;
  --line:        rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text:        #ededf0;
  --text-dim:    #a1a1aa;
  --text-faint:  #6e6e78;
  --accent:      #8ab4ff;
  --accent-dim:  rgba(138, 180, 255, 0.14);
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 32px rgba(0,0,0,.35);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas,
               "Liberation Mono", monospace;

  --max:      1200px;
  --measure:  68ch;
  --gutter:   clamp(1.25rem, 4vw, 3rem);

  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg:          #fbfbfa;
  --bg-elev:     #ffffff;
  --bg-sunken:   #f2f2f0;
  --line:        rgba(0, 0, 0, 0.11);
  --line-strong: rgba(0, 0, 0, 0.26);
  --text:        #16161a;
  --text-dim:    #55555f;
  --text-faint:  #8a8a95;
  --accent:      #2f5fd0;
  --accent-dim:  rgba(47, 95, 208, 0.10);
  --shadow:      0 1px 2px rgba(0,0,0,.06), 0 10px 30px rgba(0,0,0,.07);
}

/* 2. Reset -------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video, svg { display: block; max-width: 100%; height: auto; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 3. Typography --------------------------------------------------------- */

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 560;
  letter-spacing: -0.021em;
  line-height: 1.15;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 5.2vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; color: var(--text); }

/* Small uppercase technical label used for section eyebrows and metadata */
.label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.lead {
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  line-height: 1.6;
  color: var(--text-dim);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.1em 0.36em;
}

/* 4. Layout ------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(4rem, 9vw, 7.5rem); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.4rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* 5. Header / nav ------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand__mark {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
}

.nav a {
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: color 0.18s var(--ease);
}

.nav a:hover { color: var(--text); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text-dim);
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.theme-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun  { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* 6. Hero --------------------------------------------------------------- */

.hero {
  padding-block: clamp(4.5rem, 12vw, 9rem) clamp(3rem, 7vw, 5rem);
  border-bottom: 1px solid var(--line);
}

.hero__inner {
  display: grid;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

@media (min-width: 900px) {
  .hero__inner { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
}

.hero__eyebrow { margin-bottom: 1.6rem; }

.hero h1 { max-width: 18ch; }

.hero__text {
  max-width: 56ch;
  margin-top: 1.7rem;
}

/* Portrait. The PNG arrives already masked to a circle on a transparent
   background, so it gets no frame of its own: a square box with object-fit
   cover just trims the empty side margins and the circle sits on the page
   background, which keeps it correct in both themes. */
.hero__photo { justify-self: center; }

.hero__photo img {
  width: clamp(170px, 42vw, 340px);
  aspect-ratio: 1;
  object-fit: cover;
}

/* Stacked: the portrait reads better above the name than buried below it */
@media (max-width: 899px) {
  .hero__photo { order: -1; justify-self: start; }
  .hero__photo img { width: clamp(140px, 32vw, 200px); }
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  margin-top: 2.4rem;
}

.hero__meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hero__meta-item span:last-child { font-size: 0.92rem; }

/* 7. Filters ------------------------------------------------------------ */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.75rem;
}

.filter {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.42rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
              background-color 0.18s var(--ease);
  white-space: nowrap;
}

.filter:hover { color: var(--text); border-color: var(--line-strong); }

.filter[aria-pressed="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-dim);
}

.filter__count {
  margin-left: 0.45rem;
  color: var(--text-faint);
  font-size: 0.68rem;
}

/* 8. Project grid ------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  gap: clamp(1.75rem, 3.5vw, 3rem);
}

/* Featured entries span the full row so the GIF reads at full width */
.card--featured { grid-column: 1 / -1; }

.card {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.card[hidden] { display: none; }

.card__media {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-sunken);
  aspect-ratio: 16 / 9;
  transition: border-color 0.25s var(--ease), transform 0.35s var(--ease),
              box-shadow 0.35s var(--ease);
}

/* Featured cards are wider, not shorter: screen recordings are 16:9, and a
   21:9 crop would slice the top and bottom off an editor capture */
.card--featured .card__media { aspect-ratio: 16 / 9; }

.card__media img,
.card__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.card:hover .card__media {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card:hover .card__media img,
.card:hover .card__media video { transform: scale(1.02); }

/* Placeholder shown until a real poster/GIF exists */
.card__media--empty {
  display: grid;
  place-items: center;
  background-color: var(--bg-sunken);
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent 0 11px,
      var(--line) 11px 12px
    );
}

.card__media--empty span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.5rem 1rem;
}

.card__body { display: flex; flex-direction: column; gap: 0.55rem; }

.card__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card__title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.card__title .arrow {
  color: var(--text-faint);
  transition: transform 0.25s var(--ease), color 0.25s var(--ease);
  font-size: 0.95rem;
}

.card:hover .card__title .arrow {
  transform: translateX(4px);
  color: var(--accent);
}

.card__desc {
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 62ch;
}

/* Tags ------------------------------------------------------------------ */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.22rem 0.5rem;
}

/* "+N more tags" on a card. Dimmer than a real tag: it is a count, not a claim */
.tag--more {
  color: var(--text-faint);
  border-style: dashed;
}

.empty-state {
  padding: 4rem 0;
  text-align: center;
  color: var(--text-dim);
}

/* 9. Sections: about / contact ------------------------------------------ */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
}

@media (min-width: 860px) {
  .split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

.prose { max-width: var(--measure); }

.stack-list { display: grid; gap: 1.5rem; }

.stack-list dt { margin-bottom: 0.3rem; }

.stack-list dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-dim);
}

.link-list { display: grid; gap: 0; }

.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  transition: color 0.18s var(--ease), padding-left 0.22s var(--ease);
}

.link-list a:first-child { border-top: 1px solid var(--line); }
.link-list a:hover { color: var(--text); padding-left: 0.4rem; }
.link-list a .arrow { color: var(--text-faint); }
.link-list a:hover .arrow { color: var(--accent); }

/* 10. Project detail page ----------------------------------------------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  transition: color 0.18s var(--ease);
}

.back:hover { color: var(--text); }

.project-header { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(2rem, 4vw, 3rem); }
.project-header h1 { margin-block: 1.5rem 0; max-width: 20ch; }
.project-header .lead { max-width: var(--measure); margin-top: 1.25rem; }

/* Fact table: role / year / team / platform / links */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.75rem 2rem;
  margin-top: 2.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.facts dt { margin-bottom: 0.35rem; }
.facts dd { margin: 0; font-size: 0.94rem; }
.facts dd a { border-bottom: 1px solid var(--line-strong); }
.facts dd a:hover { color: var(--accent); border-color: var(--accent); }

.project-hero {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-sunken);
  aspect-ratio: 16 / 9;
}

.project-hero img,
.project-hero video { width: 100%; height: 100%; object-fit: cover; }

/* Embedded YouTube / Vimeo player */
.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Click-to-play facade. The real iframe is only inserted once the visitor asks
   for it: it saves ~1 MB of player JavaScript per embed on first load, sets no
   YouTube cookies until then, and shows a working thumbnail even where the
   embed itself would be refused. */
.embed__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
}

.embed__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease), opacity 0.3s var(--ease);
}

.embed__play:hover .embed__thumb { transform: scale(1.02); opacity: 0.85; }

.embed__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 48px;
  border-radius: 12px;
  background: rgba(18, 18, 22, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  padding-left: 3px;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.embed__play:hover .embed__icon {
  background: rgba(200, 30, 40, 0.92);
  transform: scale(1.06);
}

.embed__note {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(8, 8, 10, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 100px;
  padding: 0.28rem 0.6rem;
}

/* Article body */
.article {
  max-width: var(--measure);
  margin-inline: auto;
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.article > * + * { margin-top: 1.15em; }

.article h2 {
  margin-top: 3.25em;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 1.6rem;
}

.article h3 { margin-top: 2.5em; }
.article h2 + p, .article h3 + p { margin-top: 1em; }
.article p, .article li { color: var(--text-dim); }
.article strong { color: var(--text); }

.article ul, .article ol { margin-top: 1em; padding-left: 0; }

.article li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.6rem;
}

.article ul > li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.75em;
  width: 5px;
  height: 1px;
  background: var(--text-faint);
}

.article ol { counter-reset: n; }
.article ol > li { counter-increment: n; }

.article ol > li::before {
  content: counter(n) ".";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--text-faint);
}

.article a:not(.back) {
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.article a:not(.back):hover { color: var(--accent); border-color: var(--accent); }

/* Wide elements break out of the reading measure */
.bleed {
  width: min(100vw - 2 * var(--gutter), var(--max));
  margin-inline: calc(50% - min(50vw - var(--gutter), var(--max) / 2));
}

figure { margin: 2.75rem 0; }

figure img,
figure video,
figure .ph {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
}

/* Inline placeholder for figures whose asset does not exist yet */
.ph {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  background-image: repeating-linear-gradient(
    -45deg, transparent 0 11px, var(--line) 11px 12px
  );
}

figcaption {
  margin-top: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--text-faint);
}

pre {
  margin: 2rem 0;
  padding: 1.15rem 1.35rem;
  overflow-x: auto;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-dim);
}

pre code { background: none; border: 0; padding: 0; font-size: inherit; }

blockquote {
  margin: 2rem 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--accent);
  color: var(--text-dim);
  font-style: italic;
}

/* Key/value table for perf numbers, build stats, etc. */
.table-wrap { overflow-x: auto; margin: 2rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 1rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

td { color: var(--text-dim); }

/* Prev / next project navigation */
.project-nav {
  display: grid;
  background: var(--bg);
  border-block: 1px solid var(--line);
}

/* Two columns only when both links exist, otherwise the lone link would sit
   in half the bar with an empty cell beside it */
@media (min-width: 720px) {
  .project-nav:not(.is-single) { grid-template-columns: 1fr 1fr; }
  .project-nav:not(.is-single) a.is-prev { border-right: 1px solid var(--line); }
}

.project-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 2rem var(--gutter);
  transition: background-color 0.2s var(--ease);
}

.project-nav a + a { border-top: 1px solid var(--line); }

@media (min-width: 720px) {
  .project-nav:not(.is-single) a + a { border-top: 0; }
}

.project-nav a:hover { background: var(--bg-elev); }
.project-nav a.is-next { text-align: right; align-items: flex-end; }
.project-nav strong { font-weight: 560; }

/* 10b. Media gallery + lightbox ----------------------------------------- */

.gallery-section {
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

/* An item can ask for double width when the image deserves it */
.gallery__item--wide { grid-column: span 2; }

@media (max-width: 700px) {
  .gallery__item--wide { grid-column: auto; }
}

.gallery__btn {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  border-radius: var(--r-md);
}

.gallery__frame {
  /* Must be block: it is a <span> so that it can live inside the <button>,
     and aspect-ratio does nothing on an inline box */
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.25s var(--ease), transform 0.3s var(--ease),
              box-shadow 0.3s var(--ease);
}

.gallery__frame img,
.gallery__frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease);
}

.gallery__btn:hover .gallery__frame {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.gallery__btn:hover .gallery__frame img { transform: scale(1.03); }

/* Badge marking video items and the zoom affordance */
.gallery__kind {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(8, 8, 10, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 100px;
  padding: 0.25rem 0.55rem;
}

.gallery__caption {
  margin-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--text-faint);
}

/* Lightbox. Deliberately dark in both themes, like every image viewer. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 1rem;
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1rem, 4vw, 3.5rem) clamp(1.5rem, 3vw, 2.5rem);
  background: rgba(6, 6, 8, 0.94);
  backdrop-filter: blur(10px);
}

.lightbox[hidden] { display: none; }

.lightbox__stage {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
}

.lightbox__stage img,
.lightbox__stage video {
  max-width: 100%;
  /* Not max-height:100% — the stage is centred, so it is content-sized and a
     percentage would resolve against nothing. Cap against the viewport. */
  max-height: 78vh;
  width: auto;
  object-fit: contain;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  max-width: 90ch;
  text-align: center;
}

.lightbox__caption {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.62);
}

.lightbox__count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

.lightbox button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.lightbox button:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.lightbox__close { position: absolute; top: 1rem; right: 1rem; }

.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__prev { left: clamp(0.5rem, 2vw, 1.5rem); }
.lightbox__next { right: clamp(0.5rem, 2vw, 1.5rem); }

body.is-locked { overflow: hidden; }

/* 11. Footer ------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }

/* 12. Utilities --------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0.5rem;
  transform: translate(-50%, -150%);
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 0.88rem;
}

.skip-link:focus { transform: translate(-50%, 0); }

/* Entrance animation, opt-in via JS so no-JS users always see content */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.is-in { opacity: 1; transform: none; }
