:root {
  --ink: #050505;
  --paper: #fff;
  --muted: #606060;
  --top: 60px;
  --footer: calc(72px + env(safe-area-inset-bottom));
  --gutter: 24px;
  --gap: 32px;
  --columns: 3;
  --slot-w: calc((100vw - 2 * var(--gutter) - (var(--columns) - 1) * var(--gap)) / var(--columns));
  --base-media-w: min(calc(var(--slot-w) * .75), 480px);
  --media-h: min(calc(var(--base-media-w) * 1660 / 1242), calc(100svh - var(--top) - var(--footer) - 56px));
  --media-w: calc(var(--media-h) * 1242 / 1660);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font: 16px Arial, Helvetica, sans-serif; }
a { color: inherit; text-decoration: none; }
button { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .28; }
a:focus, button:focus, .project:focus { outline: none; }
.stage:focus, .overview-scroll:focus { outline: none; }
a:focus-visible, button:focus-visible, .project:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 4px; }
.site { height: 100vh; height: 100svh; display: grid; grid-template-rows: var(--top) minmax(0, 1fr) var(--footer); }
.topbar, .overview-header { display: flex; align-items: center; justify-content: space-between; padding: 8px var(--gutter); font-size: 18px; line-height: 1; font-weight: 700; position: relative; z-index: 5; }
.brand { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 56px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; transition: color 160ms ease; }
.nav a:last-child { min-width: 52px; justify-content: flex-end; }
.nav a:hover { color: var(--muted); }
.menu-toggle { display: none; min-height: 44px; padding: 0; font-weight: 700; }
.stage { min-height: 0; width: 100%; display: flex; align-items: center; padding-block: 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; touch-action: pan-x; }
.stage::-webkit-scrollbar { display: none; }
.track { display: flex; align-items: center; gap: var(--gap); padding-inline: var(--gutter); width: max-content; }
.project { flex: 0 0 var(--slot-w); width: var(--slot-w); display: grid; grid-template-rows: var(--media-h) 22px; gap: 10px; align-content: center; scroll-snap-align: center; cursor: pointer; }
.media { width: var(--media-w); height: var(--media-h); position: relative; justify-self: center; overflow: hidden; background: var(--paper); }
.project-poster, .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; display: block; }
.project-poster { pointer-events: none; }
.media video { z-index: 1; opacity: 0; background: var(--paper); }
.project.is-ready .media video { opacity: 1; transition: opacity 120ms linear; }
.caption { width: var(--media-w); justify-self: center; text-align: center; font-size: 13px; line-height: 22px; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 160ms ease; }
.project.is-selected .caption { color: var(--ink); }
/* Approved 08D footer: a 92 x 22 capsule, with a 44px control area. */
.gallery-controls { display: flex; align-items: center; justify-content: center; gap: 0; padding: 0 16px env(safe-area-inset-bottom); }
.gallery-controls button { height: 44px; min-width: 44px; padding: 0; border-radius: 0; color: var(--muted); font-size: 13px; line-height: 20px; white-space: nowrap; transition: color 140ms ease; }
.gallery-controls button:hover:not(:disabled), .gallery-controls button:active:not(:disabled) { color: #222; background: none; }
.work-position { width: 92px; height: 44px; position: relative; display: grid; place-items: center; flex: none; margin-right: 16px; color: var(--muted); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.position-text { line-height: 20px; pointer-events: none; }
.position-capsule { position: absolute; top: 11px; left: 0; width: 92px; height: 22px; fill: none; pointer-events: none; overflow: visible; }
.position-rail { stroke: #e0e0e0; stroke-width: .7; transition: stroke 140ms ease; }
.position-outline { stroke: #222; stroke-width: 1.05; stroke-linecap: round; stroke-dasharray: calc(var(--progress, .052632) * 100) 100; transition: stroke-dasharray 180ms ease-out; }
.position-selector { appearance: none; -webkit-appearance: none; position: absolute; inset: 0; width: 100%; height: 44px; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.position-selector::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; }
.position-selector::-moz-range-thumb { width: 16px; height: 16px; border: 0; }
.position-selector:focus { outline: none; }
.work-position:hover { color: #222; }
.work-position:hover .position-rail { stroke: #ccc; }
.work-position:has(.position-selector:focus-visible)::after { content: ''; position: absolute; inset: 8px -3px; border: 1px solid #777; border-radius: 14px; pointer-events: none; }
.gallery-controls .playback-toggle { width: 52px; flex: none; margin-right: 10px; }
.gallery-controls .overview-toggle { width: 72px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.overview { position: fixed; inset: 0; width: 100%; max-width: none; height: 100vh; height: 100svh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--paper); color: var(--ink); overflow: hidden; }
.overview::backdrop { background: var(--paper); }
.overview[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); animation: overview-in 220ms ease both; }
.overview-header .overview-close { min-height: 44px; min-width: 44px; padding: 0; font-size: 18px; font-weight: 700; }
.overview-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 0 var(--gutter); padding: 26px 0 30px; }
.overview-heading h2 { margin: 0; font-size: 24px; font-weight: 400; line-height: 1.2; letter-spacing: -.02em; }
.overview-heading p { margin: 0; font-size: 13px; color: var(--muted); }
.overview-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--gutter) calc(48px + env(safe-area-inset-bottom)); }
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 42px 28px; max-width: 1600px; margin: 0 auto; }
.overview-item { display: grid; grid-template-rows: auto 22px; gap: 12px; padding: 0; text-align: center; min-width: 0; }
.overview-thumb { width: 86%; justify-self: center; aspect-ratio: 1242 / 1660; position: relative; overflow: hidden; }
.overview-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.overview-label { font-size: 13px; line-height: 22px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overview-item[aria-current="true"] .overview-label { color: var(--ink); }
.overview-item:hover .overview-label { color: var(--ink); }
@keyframes overview-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1100px) {
  :root { --columns: 2; --gutter: 20px; --gap: 28px; }
  .nav { gap: 36px; }
  .overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) and (orientation: portrait), (max-width: 600px) {
  :root { --columns: 1; --gutter: 0px; --base-media-w: min(82vw, 560px); }
  .stage { scroll-snap-type: x mandatory; }
  .topbar, .overview-header { padding-inline: 20px; }
  .overview-heading { margin-inline: 20px; }
  .overview-scroll { padding-inline: 20px; }
}
@media (max-width: 600px) {
  :root { --top: calc(56px + env(safe-area-inset-top)); --footer: calc(68px + env(safe-area-inset-bottom)); --gap: 24px; }
  .topbar, .overview-header { font-size: 17px; padding: calc(6px + env(safe-area-inset-top)) 16px 6px; }
  .menu-toggle { display: block; }
  .nav { position: absolute; top: calc(var(--top) - 4px); right: 8px; z-index: 10; flex-direction: column; align-items: flex-end; gap: 0; background: var(--paper); padding: 0 8px 8px 16px; visibility: hidden; opacity: 0; transform: translateY(-5px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease, visibility 180ms; }
  .topbar.menu-open .nav { visibility: visible; opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav a { padding: 0 0 0 8px; font-size: 15px; }
  .gallery-controls { gap: 0; }
  .overview-header .overview-close { font-size: 17px; }
  .overview-heading { margin-inline: 16px; padding: 20px 0 24px; }
  .overview-heading h2 { font-size: 22px; }
  .overview-scroll { padding-inline: 16px; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 14px; }
  .overview-thumb { width: 92%; }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --top: 48px; --footer: calc(56px + env(safe-area-inset-bottom)); --columns: 2; --gap: 24px; --gutter: 20px; --base-media-w: min(calc(var(--slot-w) * .75), 480px); --media-h: min(calc(var(--base-media-w) * 1660 / 1242), calc(100svh - var(--top) - var(--footer) - 48px)); }
  .topbar, .overview-header { padding-block: 2px; }
  .stage { padding-block: 8px; }
  .overview-heading { padding: 10px 0 18px; }
}
@media (max-width: 340px) { .gallery-controls { padding-inline: 14px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Collection header: one clear row on desktop, two deliberate rows on phone. */
.overview .overview-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 24px;
  min-height: 60px;
  padding: 8px 24px;
}
.overview-header .brand { justify-self: start; }
.overview .overview-heading {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  justify-self: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}
.overview-heading h2 { font-size: 20px; line-height: 24px; letter-spacing: -.01em; }
.overview-heading p { font-size: 13px; line-height: 20px; font-weight: 400; }
.overview-header .overview-close { justify-self: end; }
.overview-header .overview-close:focus-visible { outline-offset: -2px; }
.overview-scroll { padding-top: 12px; }
@media (max-width: 1100px) {
  .overview .overview-header { padding-inline: 20px; }
}
@media (max-width: 600px) {
  .overview .overview-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    min-height: 0;
    padding: calc(6px + env(safe-area-inset-top)) 16px 12px;
  }
  .overview .overview-heading {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: space-between;
  }
  .overview-header .overview-close { grid-column: 2; grid-row: 1; }
  .overview-heading h2 { font-size: 18px; line-height: 22px; letter-spacing: 0; }
  .overview-heading p { font-size: 12px; line-height: 18px; }
  .overview-scroll { padding-top: 0; }
}
@media (max-height: 500px) and (orientation: landscape) and (min-width: 601px) {
  .overview .overview-header {
    min-height: calc(48px + env(safe-area-inset-top));
    padding-top: calc(2px + env(safe-area-inset-top));
    padding-bottom: 2px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    gap: 16px;
  }
  .overview-heading h2 { font-size: 18px; line-height: 22px; }
  .overview-scroll { padding-top: 8px; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 600px) {
  .overview .overview-header {
    padding-top: calc(2px + env(safe-area-inset-top));
    padding-bottom: 8px;
    row-gap: 2px;
  }
}
