:root {
  --bg: #000;
  --ink: #8e8e8b;   /* text: solid mid-gray, about 55% of white */
  --dim: #5a5a57;
  --line: #1c1c1c;
  --chip: #121212;
  --chip-hi: #1d1d1d;
  --head: rgba(0, 0, 0, 0.92);
  --surface: #0b0b0b;
  --panel: #070707;
  --tile: #0a0a0a;
  --track: #3a3a3a;
  --prose: #8e8e8b;
  --font: Jost, Futura, "Century Gothic", "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: clamp(12px, 1.6vw, 24px);
  --gap: 6px;
  --bar: 52px;
  --tools: 48px;
  --top: calc(var(--bar) + var(--tools) + env(safe-area-inset-top, 0px));
  --n: 3;
  --on-image: #bfbfbd;   /* show names on the frames: solid ~75% white, not see-through */
  color-scheme: dark;
}
/* white background, from the toggle next to the size slider */
:root[data-bg="white"] {
  --on-image: #fff;     /* show names: full white on the white site; 75% gray on black */
  --bg: #fff;
  --ink: #141414;
  --dim: #8c8c88;
  --line: #e7e7e4;
  --chip: #f1f1ef;
  --chip-hi: #e6e6e3;
  --head: rgba(255, 255, 255, 0.92);
  --surface: #fff;
  --panel: #fff;
  --tile: #f0f0ee;
  --track: #c9c9c6;
  --prose: #3a3a38;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-padding-top: calc(var(--top) + var(--gap)); }
/* pinch changes the grid size, so the browser shouldn't zoom the page */
html, body { touch-action: pan-x pan-y; }
.lb { touch-action: none; }
body {
  transition: background-color .35s, color .35s;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 11px/1.4 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.dim { color: var(--dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  background: var(--head);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding-top: env(safe-area-inset-top, 0px);
}
.bar, .tools {
  display: grid; align-items: center;
  padding: 0 var(--pad);
}
.bar {
  height: var(--bar);
  grid-template-columns: 1fr auto;   /* name left, nav right */
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 14px; white-space: nowrap; }
/* the show picker is retired: Index does that job */
.set { display: none !important; }
.set {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.1em;
  padding: 8px 10px; margin: 0 -10px;
}
.set span { text-wrap: balance; text-align: center; }
.set svg { flex: none; color: var(--dim); transition: transform .3s var(--ease); }
.set[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav { justify-self: end; display: flex; gap: 22px; }
.nav button, .brand { transition: color .2s; }
.nav button:hover, .brand:hover .dim { color: var(--dim); }

.tools {
  height: var(--tools);
  grid-template-columns: 1fr auto;
}
.count { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count #count { color: var(--ink); }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); margin-right: 18px;
}
.back:hover { color: var(--dim); }
.back[hidden] { display: none; }
.now { color: var(--ink); }                       /* the show you're in, next to the back link */
.now:not(:empty)::after { content: "—"; margin: 0 10px; color: var(--dim); }
.tools-r { display: flex; align-items: center; gap: 6px; }

.size {
  display: flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 12px;
  background: var(--chip); border-radius: 3px;
}
.dot { display: block; border-radius: 50%; background: var(--dim); }
.dot.sm { width: 3px; height: 3px; }
.dot.lg { width: 6px; height: 6px; }
#size {
  -webkit-appearance: none; appearance: none;
  width: 96px; height: 20px; margin: 0; background: transparent; cursor: pointer;
}
#size::-webkit-slider-runnable-track { height: 1px; background: var(--track); }
#size::-moz-range-track { height: 1px; background: var(--track); }
#size::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; margin-top: -6px;
  border-radius: 50%; background: var(--ink); border: 0;
}
#size::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--ink); border: 0; }
.bg-toggle {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--chip); border-radius: 3px; color: var(--ink);
}
.bg-toggle:hover { background: var(--chip-hi); }
.bg-toggle svg { display: block; }
.grid-label {
  min-width: 52px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--chip); border-radius: 3px; color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- Show picker ---------- */
.menu {
  position: fixed; z-index: 11;
  top: calc(var(--bar) + env(safe-area-inset-top, 0px) + 6px); left: 50%;
  transform: translateX(-50%);
  width: min(380px, calc(100vw - 24px));
  max-height: calc(100svh - var(--bar) - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  padding: 6px;
  overscroll-behavior: contain;
}
.menu button {
  display: grid; grid-template-columns: 1fr auto; gap: 16px;
  width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 2px;
}
.menu button:hover, .menu button[aria-selected="true"] { background: var(--chip-hi); }
.menu .n { color: var(--dim); font-variant-numeric: tabular-nums; }
.menu .credit { display: block; color: var(--dim); font-size: 10px; margin-top: 2px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* frozen copy of the grid that zooms and fades out when the size changes */
.ghost { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.ghost .cell { content-visibility: visible; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  /* rows take their height from the 16:9 tiles */
  grid-auto-rows: auto;
  gap: var(--gap);
  /* rows never stretch: the gap is the only space between frames */
  align-content: start;
  padding: calc(var(--top) + var(--gap)) var(--gap) var(--gap);
}
.cell {
  transform-origin: 0 0;
  aspect-ratio: 16 / 9;   /* every frame tile is 16:9, desktop and phone */
  position: relative; overflow: hidden;
  background: var(--tile);
  cursor: zoom-in;
  scroll-snap-align: start;
  content-visibility: auto;
  contain-intrinsic-size: auto 300px;
}
.cell img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0; transition: opacity .5s var(--ease), transform .9s var(--ease);
}
.cell img.in { opacity: 1; }
.cell:hover img { transform: scale(1.015); }
/* one at a time: each cell takes the frame's own shape, so the whole frame shows
   with no letterbox bars, just the same gap as every other size */
.grid.n1 { grid-auto-rows: auto; }
.n1 .cell {
  transform-origin: 0 0;
  aspect-ratio: var(--ar, 2);
  /* full width, unless that would be taller than the screen */
  width: min(100%, calc((100svh - var(--top) - var(--gap) * 2) * var(--ar, 2)));
  justify-self: center;
}
.n1 .cell:hover img { transform: none; }

/* main page: one frame per show, its name on the frame */
/* show name dead center on the frame; wraps instead of cutting off */
.title {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 8%;
  text-align: center; text-wrap: balance;
  overflow-wrap: break-word; hyphens: none;
  color: var(--on-image); font-size: max(6px, 3.95cqi);   /* always ~4% of the frame's width (15px on a phone at 1x1) */
  /* the original soft shadow, sized in em so it scales with the name */
  text-shadow: 0 0 1.2em rgba(0,0,0,.6), 0 0.1em 0.3em rgba(0,0,0,.5); font-weight: 500; letter-spacing: 0.14em; line-height: 1.3;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
  transition: background .4s var(--ease), opacity .35s var(--ease);
}
.cover:hover .title { background: rgba(0, 0, 0, 0.32); }
/* names stay hidden until you point at a frame (mouse/trackpad) or tap it once (touch) */
.cover .title { opacity: 0; }
.cover.armed .title, .cover:focus-visible .title { opacity: 1; background: rgba(0, 0, 0, 0.32); }
@media (hover: hover) and (pointer: fine) {
  .cover:hover .title { opacity: 1; }
}
.cover { cursor: pointer; container-type: inline-size; }
/* no scroll snapping: it nudged the page after a size change and shifted the rows */

.cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; gap: 12px;
  padding: 22px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  font-size: 10px; color: var(--ink);
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
.cap .dim { color: #6c6c69; }
.cell:hover .cap, .cell:focus-visible .cap { opacity: 1; }
.n1 .cap { background: none; padding: 14px var(--pad); }
.play {
  position: absolute; right: 10px; top: 10px;
  padding: 4px 7px; border-radius: 2px;
  background: rgba(0,0,0,.6); font-size: 9px;
}

/* tall or narrow screens: keep frames widescreen instead of filling the height */
@media (max-width: 640px) {
  :root { --bar: 48px; --tools: 46px; --gap: 3px; }
  .brand .dim, .grid-label { display: none; }
  /* phones: name left, Index / About / Contact right; the show picker lives in Index */
  .bar { grid-template-columns: auto 1fr; }
  .nav { gap: 13px; }
  .count { white-space: normal; line-height: 1.3; display: flex; align-items: center; gap: 0.4em; min-width: 0; padding-right: 10px; }
  .back .lbl { display: none; }
  .back { margin-right: 4px; }
  .count .now { display: block; }
  .now:not(:empty)::after { content: none; }
  #size { width: 64px; }
  .size { gap: 8px; padding: 0 10px; }
  .back { margin-right: 12px; }
  .cap { display: none; }
  .panel { padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .panel-close { top: 16px; right: 16px; }
  .press-list .t { font-size: 13px; }
  .title { letter-spacing: 0.1em; padding: 6px; }
}

/* ---------- Panels ---------- */
/* Side drawer: opens under the header, a whole number of columns wide, and pushes
   the grid left by the same amount so the remaining columns stay on screen. */
:root { --drawer: 460px; --slide: .9s; }
.grid { transition: transform var(--slide) var(--ease); }
body.drawer .grid { transform: translateX(calc(-1 * var(--push, var(--drawer)))); cursor: e-resize; }
body.drawer .cell { cursor: inherit; }
.panel {
  position: fixed; z-index: 9; top: var(--top); right: 0; bottom: 0;
  width: var(--drawer);
  background: var(--panel); border-left: 1px solid var(--line);
  padding: var(--pad) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(100%); transition: transform var(--slide) var(--ease);
}
.panel.open { transform: none; }
.panel > * { max-width: 560px; }
.nav button.on { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.panel h2 { font-size: 11px; font-weight: 500; letter-spacing: .1em; line-height: 1.4; margin: 0 0 28px; padding-right: 64px; color: var(--dim); }  /* same line as Close */
.panel-close { position: absolute; top: var(--pad); right: var(--pad); line-height: 1.4; }
.panel-close:hover { color: var(--dim); }
.headshot { width: 100%; height: auto; display: block; margin-bottom: 24px; }
.prose, .contact { text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.65; color: var(--prose); }
.prose p, .contact p { margin: 0 0 1em; }
.contact .label { text-transform: uppercase; letter-spacing: .08em; font-size: 10px; color: var(--dim); margin-top: 1.8em; }
.contact .label:first-child { margin-top: 0; }
.contact a:hover, .links a:hover { color: var(--dim); }
.links { list-style: none; padding: 0; margin: 24px 0 0; display: flex; gap: 22px; }
/* press */
.press-list { list-style: none; margin: 0; padding: 0; }
.press-list a {
  display: grid; grid-template-columns: 1fr auto; column-gap: 16px; row-gap: 5px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.press-list li:first-child a { border-top: 1px solid var(--line); }
.press-list .o { color: var(--dim); font-size: 10px; }
.press-list .y { color: var(--dim); font-size: 10px; font-variant-numeric: tabular-nums; }
.press-list .t {
  grid-column: 1 / -1;
  text-transform: none; letter-spacing: 0.01em; font-size: 14px; line-height: 1.35;
  text-wrap: pretty;
}
.press-list a:hover .t { color: var(--dim); }

/* index */
.index-list { list-style: none; margin: 0; padding: 0; }
.index-list a {
  display: grid; grid-template-columns: 1fr auto; column-gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.index-list li:first-child a { border-top: 1px solid var(--line); }
.index-list .t { font-size: 12px; letter-spacing: .1em; }
.index-list .c { grid-column: 1; color: var(--dim); font-size: 10px; margin-top: 3px; }
.index-list .c:empty { display: none; }
.index-list .n { grid-column: 2; grid-row: 1; color: var(--dim); font-variant-numeric: tabular-nums; }
.index-list a:hover .t { color: var(--dim); }

/* ---------- Viewer ---------- */
.lb {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: grid; place-items: center;
}
.lb[hidden] { display: none; }
.lb-stage {
  position: absolute; inset: 56px clamp(12px, 6vw, 96px) 64px;
  display: grid; place-items: center;
}
.lb-stage img, .lb-stage iframe {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto; display: block;
}
.lb-stage iframe { width: 100%; aspect-ratio: 16/9; height: auto; border: 0; }
.lb-stage .frame { cursor: e-resize; -webkit-tap-highlight-color: transparent; user-select: none; }
.lb-stage .frame.to-prev { cursor: w-resize; }
.lb-meta {
  position: absolute; left: var(--pad); right: var(--pad); bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: space-between; gap: 16px;
}
.lb-close { position: absolute; top: calc(18px + env(safe-area-inset-top, 0px)); right: var(--pad); }
.lb-close:hover, .lb-nav:hover { color: var(--dim); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 120px; display: grid; place-items: center;
}
.lb-nav.prev { left: 0; }
.lb-nav.next { right: 0; }
@media (hover: none) { .lb-nav { display: none; } }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0s !important; }
}

/* ---------- Two-row header (overrides the earlier header rules) ----------
   row 1: name (13px) left, links right.
   row 2: "< Show" and the show / frame count (smaller, 10.5px) left, a smaller size slider centred. */
:root { --bar: 54px; --tools: 40px; }
.bar {
  grid-template-columns: minmax(0, 1fr) auto;
  font-size: 14.5px; letter-spacing: 0.1em;      /* larger type, same 54px row */
  border-bottom: 0;
}
.bar .nav { justify-self: end; gap: 26px; }
.tools {
  display: grid; height: var(--tools);
  grid-template-columns: minmax(0, 1fr) auto;    /* count left, slider + background far right */
  font-size: 10.5px;
  border-bottom: 1px solid var(--line);
}
.count { display: flex; align-items: center; gap: 14px; min-width: 0; white-space: normal; overflow: visible; }
.count .back { margin: 0; gap: 7px; min-width: 0; }
.back .now { display: inline; white-space: normal; line-height: 1.25; text-wrap: balance; text-align: left; color: var(--ink); }
.back .now::after, .now:not(:empty)::after { content: none; }
.tally { white-space: nowrap; }
.tally #count { color: var(--ink); }
.tools .tools-r { justify-self: end; gap: 5px; }
.grid-label { display: none; }
/* a smaller slider */
.size { height: 24px; padding: 0 9px; gap: 7px; }
#size { width: 76px; height: 16px; }
#size::-webkit-slider-thumb { width: 10px; height: 10px; margin-top: -4.5px; }
#size::-moz-range-thumb { width: 10px; height: 10px; }
.dot.lg { width: 5px; height: 5px; }
.bg-toggle { width: 24px; height: 24px; }

@media (max-width: 1180px) { .brand .dim { display: none; } }

/* phones held upright */
@media (max-width: 640px) {
  :root { --bar: 48px; --tools: 42px; }
  .bar { font-size: 11.5px; }
  .bar .nav { gap: 13px; }
  .tools { grid-template-columns: minmax(0, 1fr) auto; font-size: 10px; }
  .tools .tools-r { justify-self: end; }
}

/* inside a show every still keeps its own shape (uncropped); 16:9 tiles are for the main page.
   In a row that mixes shapes, wider frames sit centred. */
.grid.show-view { align-items: center; }
.grid.show-view .cell { aspect-ratio: var(--ar, 1.78); }

/* the smallest phones (320px wide): name and links still on one line without touching */
@media (max-width: 370px) {
  .bar { font-size: 9.5px; letter-spacing: 0.06em; }
  .bar .nav { gap: 9px; }
}

/* tighter header: row 2 (count + slider) sits just under the name and links */
:root { --bar: 40px; --tools: 32px; }
.bar { align-items: end; padding-bottom: 1px; }
.tools { align-items: center; }
@media (max-width: 640px) {
  :root { --bar: 38px; --tools: 34px; }
}

/* on the white site the names are full white, so they don't need the soft shadow */
:root[data-bg="white"] .title { text-shadow: none; }

/* smaller row 2: show / frame count and the slider */
.tools { font-size: 9px; }
.size { height: 20px; padding: 0 8px; gap: 6px; }
#size { width: 62px; height: 14px; }
#size::-webkit-slider-thumb { width: 8px; height: 8px; margin-top: -3.5px; }
#size::-moz-range-thumb { width: 8px; height: 8px; }
.dot.sm { width: 2px; height: 2px; }
.dot.lg { width: 4px; height: 4px; }
.bg-toggle { width: 20px; height: 20px; }
.bg-toggle svg { width: 10px; height: 10px; }
@media (max-width: 640px) { .tools { font-size: 8.5px; } }

/* your name twice the size of the links (29px vs 14.5px); links and "Cinematographer" unchanged.
   Name, tagline and links share one baseline. */
:root { --bar: 50px; }
.bar { align-items: last baseline; }
.brand { align-items: baseline; }
.brand > span:first-child { font-size: 2em; line-height: 1; letter-spacing: 0.06em; }
@media (max-width: 1180px) { .brand > span:first-child { font-size: 1.7em; } }
/* phones: as large as fits beside the links */
@media (max-width: 640px) {
  :root { --bar: 42px; }
  .brand > span:first-child { font-size: 1.12em; letter-spacing: 0.05em; }
}
@media (max-width: 370px) { .brand > span:first-child { font-size: 1.2em; } }

/* name and "Cinematographer" in Urbanist Light, matching the old site; links stay in Jost */
.brand { font-family: Urbanist, "Helvetica Neue", Arial, sans-serif; font-weight: 300; }
.brand > span:first-child { letter-spacing: 0.02em; }
.brand .dim { letter-spacing: 0.04em; }

/* main page, first slider position: cinematic strips, one per row, edge to edge */
.grid.banner { padding-left: 0; padding-right: 0; }
.grid.banner .cell { aspect-ratio: 5.7 / 1; }
.grid.banner .title { font-size: clamp(10px, 1.05vw, 17px); }
/* cover tiles and strips crop at each show's "focus" (content/projects.json): 0 top, 1 bottom */
.cover img { object-position: 50% calc(var(--fy, 0.5) * 100%); }

/* name sits close to the left edge, like the old site (12px in); row 2 lines up under it */
@media (min-width: 641px) {
  .bar, .tools { padding-left: max(12px, env(safe-area-inset-left, 0px)); }
}

/* Index / Press / About / Contact: Urbanist Light, normal capitalisation (not all caps) */
.nav button {
  font-family: Urbanist, "Helvetica Neue", Arial, sans-serif;
  font-weight: 300; text-transform: none; letter-spacing: 0.02em;
}

/* ---------- header scrolls away; equal white above the name and below the header ---------- */
:root {
  --space: 26px;                     /* white above the name = white between the header and the pictures */
  --top: calc(var(--space) + var(--bar) + var(--tools) + env(safe-area-inset-top, 0px));
}
.top {
  position: absolute;                /* scrolls with the page instead of staying pinned */
  background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none;
  padding-top: calc(var(--space) + env(safe-area-inset-top, 0px));
}
.tools { border-bottom: 0; }
.grid { padding-top: calc(var(--top) + var(--space)); }
html { scroll-padding-top: var(--gap); }
.panel { top: var(--ptop, var(--top)); }
@media (max-width: 640px) { :root { --space: 14px; } }

/* show pages: the stills sit in a centred block with white either side */
@media (min-width: 641px) {
  .grid.show-view { padding-left: 15vw; padding-right: 15vw; }
}
/* match the white under the header to the white above the name (measured: 45px desktop, 41px phone) */
.grid { padding-top: calc(var(--top) + var(--space) + 13px); }
@media (max-width: 640px) { .grid { padding-top: calc(var(--top) + var(--space) + 20px); } }

/* main page tiles get the same white either side as show pages (cinematic strips stay edge to edge) */
@media (min-width: 641px) {
  .grid:not(.banner) { padding-left: 15vw; padding-right: 15vw; }
}

/* tighter, still equal: white above the name = white between the header and the pictures */
:root { --space: 4px; --bar: 40px; }
.grid { padding-top: calc(var(--top) + var(--below, 0px)); }
@media (max-width: 640px) { :root { --space: 2px; --bar: 30px; } }
:root { --below: 10px; }
@media (min-width: 641px) { :root { --space: 7px; } }

.ghost-frame { position: fixed; inset: 0; z-index: 5; pointer-events: none; }

/* a little more white above the name (the gap under the header stays the same) */
@media (min-width: 641px) { :root { --space: 15px; } }
@media (max-width: 640px) { :root { --space: 8px; } }

/* drawers: no heading or Close (the underlined link shows where you are; click the pictures,
   press Esc or swipe to close). Content starts level with the first row of pictures. */
.panel h2, .panel-close {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.panel { padding-top: 10px; }
.panel .press-list li:first-child a, .panel .index-list li:first-child a { border-top: 0; padding-top: 0; }
.panel .contact .label:first-child { margin-top: 0; }
