/* Layout: fixed header + footer like a viewer's chrome; content is a compact edit-list
   (No. / Client / Title) pinned left, with the hovered clip in a 16:9 box placed
   at a new spot in the open space to its right. */
:root {
  --bg: #f9f9f9;
  --fg: #000000;
  --muted: #5c5c5c;
  --line: #e0e0e0;
  --placeholder: #ececec;
  --dim: 0.4;

  --display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --edge-line: #cfcfcf;
  --hover-line: rgba(0, 0, 0, .55);
  --sheet-ring: #fff; /* inverted by the negative filter, so it shows as black */
  color-scheme: light;
}
/* Dark mode (sun / moon in the footer) */
:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --fg: #f2f2f2;
  --muted: #8c8c8c;
  --line: #262626;
  --placeholder: #1a1a1a;
  --edge-line: #3a3a3a;
  --hover-line: rgba(255, 255, 255, .55);
  --sheet-ring: #000; /* shows as white */
  color-scheme: dark;
}
:root[data-theme="dark"] .wordmark img { filter: invert(1); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; }
img, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }

.label, .row, .toolbar, .site-footer, .nav a, .player-bar, .player-step, dt {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 20;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter-r) 0 var(--gutter-l);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--bg);
}
.wordmark { display: block; line-height: 0; }
.wordmark img { height: clamp(18px, 1.9vw, 26px); width: auto; max-width: none; }
.nav { display: flex; gap: 22px; }
.nav-right { justify-content: flex-end; }
.nav a { color: var(--fg); transition: color .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }

/* ---------- Main ---------- */
main {
  position: relative; z-index: 1;
  padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 28px) var(--gutter-r) 96px var(--gutter-l);
}

.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 44px;
}
.filters, .toggle { display: flex; gap: 18px; flex-wrap: wrap; }
.filters button, .toggle a { color: var(--muted); transition: color .2s; }
.filters button:hover, .toggle a:hover,
.filters button[aria-pressed="true"], .toggle a[aria-current="true"] { color: var(--fg); }
.filters sup { font-size: 9px; margin-left: 2px; vertical-align: super; }

/* ---------- List ---------- */
.view-work .toolbar, .list { max-width: 600px; }
.row {
  display: grid;
  grid-template-columns: 30px 150px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 8px 0 7px;
  border-bottom: 1px solid var(--line);
  transition: border-color .35s var(--ease);
}
.row-head { color: var(--muted); padding-top: 0; }
.row-item { transition: opacity .3s var(--ease), border-color .3s var(--ease); }
.row-item .no { color: var(--muted); font-variant-numeric: tabular-nums; transition: color .25s; }
.row-item .title {
  font-family: var(--body); font-size: 15.5px; font-weight: 500;
  text-transform: none; letter-spacing: -0.01em; line-height: 1.25;
  transition: transform .4s var(--ease);
}
.row-item .client { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item > span { min-width: 0; }
.row-item.is-active .title { transform: translateX(6px); }

/* Dim the rest of the list while one row is hovered */
.list.is-hovering .row-item { opacity: var(--dim); }
.list.is-hovering .row-item.is-active { opacity: 1; border-color: var(--hover-line); }
.list.is-hovering .row-item.is-active .no { color: var(--fg); }
.list.is-hovering .row-head { opacity: var(--dim); }

/* Rows rise in on first load */
.row-item { animation: rise .7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 35ms + 80ms); }
.tile { animation: rise .8s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 50ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.view { animation: fade .35s var(--ease); }

/* Home: blank page, lava lamp dead center of the screen */
.view-home { position: fixed; inset: 0; z-index: 0; display: grid; place-items: center; pointer-events: none; }
.view-home[hidden] { display: none; }
.lava-link { display: block; pointer-events: auto; line-height: 0; }
.lava { display: block; width: auto; height: clamp(170px, 30vh, 260px); overflow: visible; }
.lava path, #lava-blobs { fill: var(--fg); }
.lava .lava-line { fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-linejoin: round; }

/* Arrow cursor everywhere, links included (17×26px with a thin outline, hotspot = tip). White in dark mode.
   The old eyeball cursor files are still in assets/ (cursor-eye-28/56.png). */
html, html * {
  cursor: url("assets/cursor-arrow-black-1x.png") 2 2, auto;
  cursor: -webkit-image-set(url("assets/cursor-arrow-black-1x.png") 1x, url("assets/cursor-arrow-black-2x.png") 2x) 2 2, auto;
  cursor: image-set(url("assets/cursor-arrow-black-1x.png") 1x, url("assets/cursor-arrow-black-2x.png") 2x) 2 2, auto;
}
:root[data-theme="dark"], :root[data-theme="dark"] * {
  cursor: url("assets/cursor-arrow-white-1x.png") 2 2, auto;
  cursor: -webkit-image-set(url("assets/cursor-arrow-white-1x.png") 1x, url("assets/cursor-arrow-white-2x.png") 2x) 2 2, auto;
  cursor: image-set(url("assets/cursor-arrow-white-1x.png") 1x, url("assets/cursor-arrow-white-2x.png") 2x) 2 2, auto;
}

/* ---------- Floating preview ---------- */
.float {
  position: fixed; left: 0; top: 0; z-index: 5;
  width: 480px; /* set per hover by main.js */
  pointer-events: none;
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s var(--ease), transform .4s var(--ease);
}
.float.is-on { opacity: 1; transform: none; }
.float-media { position: relative; aspect-ratio: 16 / 9; background: var(--placeholder); overflow: hidden; }
.float-media > video { width: 100%; height: 100%; object-fit: cover; max-width: none; }
.float-cap {
  margin: 8px 0 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font: 400 11px/1.3 var(--mono); letter-spacing: .02em; text-transform: uppercase;
  color: var(--muted);
}
.float-cap b { color: var(--fg); font-weight: 400; }

/* Pinned: the box freezes, becomes clickable, and offers Play / Close */
.float.is-pinned { pointer-events: auto; transition: opacity .25s var(--ease), left .5s var(--ease), top .5s var(--ease), width .5s var(--ease); }
.float-play, .float-close { opacity: 0; transition: opacity .2s; }
.float.is-pinned .float-close { opacity: 1; }
.float.is-pinned:not(.is-playing) .float-play { opacity: 1; }
.float-close { color: var(--muted); pointer-events: none; }
.float.is-pinned .float-close { pointer-events: auto; }
.float-close:hover { color: var(--fg); }
.float-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: #000; background: #f9f9f9; padding: 8px 12px 7px;
  pointer-events: none;
}
.float.is-pinned:not(.is-playing) .float-media:hover .float-play { background: #000; color: #f9f9f9; }
.float.is-playing .float-media > video { visibility: hidden; }
.float .vp { position: absolute; inset: 0; }
/* Liquid warp canvas over the frozen frame */
.float .warp { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .15s; pointer-events: none; }
.float.is-pinned:not(.is-playing) .warp.is-ready { opacity: 1; }
.list.is-pinned .row-item:not(.is-active):hover { opacity: .7; }
@media (max-width: 900px) { .float { display: none; } }

/* ---------- Custom video player ---------- */
.vp { position: relative; width: 100%; height: 100%; background: #000; color: #f9f9f9; overflow: hidden; }
.vp video { width: 100%; height: 100%; object-fit: contain; max-width: none; display: block; }
.vp-big {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: #000; background: #f9f9f9; padding: 8px 12px 7px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.vp.is-paused .vp-big { opacity: 1; pointer-events: auto; }
.vp-big:hover { background: #000; color: #f9f9f9; }
.vp-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 26px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6));
  font: 400 11px/1 var(--mono); letter-spacing: .03em; text-transform: uppercase;
  transition: opacity .3s;
}
.vp.is-idle .vp-bar { opacity: 0; }
.vp.is-idle { cursor: none; }
.vp-btn { color: rgba(249, 249, 249, .8); white-space: nowrap; }
.vp-btn:hover { color: #f9f9f9; }
.vp-play { min-width: 4.5ch; text-align: left; }
.vp-time { font-variant-numeric: tabular-nums; white-space: nowrap; color: rgba(249, 249, 249, .8); }
.vp-scrub { position: relative; flex: 1; height: 14px; display: flex; align-items: center; touch-action: none; }
.vp-scrub::before, .vp-buf, .vp-prog {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; top: 6px;
  transform-origin: left center;
}
.vp-scrub::before { background: rgba(249, 249, 249, .25); }
.vp-buf { background: rgba(249, 249, 249, .4); transform: scaleX(0); }
.vp-prog { background: #f9f9f9; transform: scaleX(0); }
.vp-scrub:hover::before, .vp-scrub:hover .vp-buf, .vp-scrub:hover .vp-prog,
.vp.is-scrubbing .vp-scrub::before, .vp.is-scrubbing .vp-buf, .vp.is-scrubbing .vp-prog { height: 4px; top: 5px; }
.vp-note {
  position: absolute; left: 12px; top: 10px;
  font: 400 10px/1.3 var(--mono); letter-spacing: .03em; text-transform: uppercase;
  color: rgba(249, 249, 249, .85); background: rgba(0, 0, 0, .45); padding: 4px 6px 3px;
}
.vp:fullscreen .vp-bar { padding: 40px 24px 20px; font-size: 12px; }
@media (max-width: 640px) { .vp-fs { display: none; } .vp-bar { gap: 10px; } }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px 16px;
}
.tile { display: grid; gap: 10px; }
.tile-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--placeholder); }
.tile-media video, .tile-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
/* liquid warp over the hovered clip (one canvas, moved from tile to tile) */
.tile-media .warp { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; visibility: hidden; }
.tile:hover .tile-media .warp.is-ready { visibility: visible; }
.tile-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; }
.tile-meta .client, .tile-meta .type { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; text-transform: uppercase; }
.tile-meta .type { color: var(--muted); text-align: right; }
.tile-meta .title { grid-column: 1 / -1; font-weight: 500; font-size: 17px; letter-spacing: -0.01em; line-height: 1.25; }

/* ---------- Print ---------- */
.view-print .toolbar { margin-bottom: 28px; }
.print-step { display: flex; gap: 18px; align-items: baseline; }
.print-count { font-variant-numeric: tabular-nums; min-width: 9ch; }
.print-step button { color: var(--muted); transition: color .2s; }
.print-step button:hover { color: var(--fg); }
/* Frame: the photo fits between the toolbar and the footer */
.frame {
  --frame-h: max(260px, calc(100svh - var(--header-h) - env(safe-area-inset-top, 0px) - 230px));
  margin: 0; display: grid; place-items: center; height: var(--frame-h);
}
.frame[hidden] { display: none; }
.frame img { max-width: 100%; max-height: var(--frame-h); width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
/* Contact sheet: rows of frames on white, like a scanned sheet, with the film's edge print
   (frame number, 7A arrow, edge number, stock) under each row.
   --pitch = one perforation (8 per frame); everything scales from it. */
.sheet { max-width: 820px; margin: 0 auto; } /* small, centred, lots of air either side */
.sheet[hidden] { display: none; }
.sheet-strips { display: grid; gap: calc(var(--pitch) * .7); justify-items: start; }
.strip {
  display: grid; grid-template-columns: repeat(var(--n), calc(var(--pitch) * 8));
}
.film-frame { position: relative; display: block; padding: 0 calc(var(--pitch) * .45); color: var(--fg); }
/* shown as black-and-white negatives (the single-photo view stays positive) */
.film-frame img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: #131313; filter: grayscale(1) invert(1); }
/* edge print under each frame */
.edge {
  position: relative; display: block; height: calc(var(--pitch) * 2.4); margin: 0 calc(var(--pitch) * -.45);
  font-family: var(--body); font-weight: 600; line-height: 1; letter-spacing: .01em; text-transform: uppercase;
  /* the thin film-edge line between the two rows of numbers */
  background: linear-gradient(var(--edge-line), var(--edge-line)) 0 calc(var(--pitch) * 1.36) / 100% 1px no-repeat;
}
.edge > span { position: absolute; white-space: nowrap; }
.edge .no { left: calc(var(--pitch) * .6); top: calc(var(--pitch) * .65); font-size: clamp(11px, calc(var(--pitch) * .6), 18px); }
.edge .half { left: 46%; top: calc(var(--pitch) * .58); font-size: clamp(7px, calc(var(--pitch) * .3), 10px); }
.edge .half::after { /* the little arrow under "7A" */
  content: ""; display: block; height: 4px; margin-top: 2px; width: 2.6em;
  background: linear-gradient(currentColor, currentColor) 0 50% / calc(100% - 3px) 1px no-repeat;
  clip-path: polygon(0 40%, 85% 40%, 85% 0, 100% 50%, 85% 100%, 85% 60%, 0 60%);
}
.edge .sub, .edge .stock { top: calc(var(--pitch) * 1.5); font-size: clamp(7px, calc(var(--pitch) * .36), 12px); }
.edge .sub { left: calc(var(--pitch) * .75); }
.edge .stock { left: calc(var(--pitch) * 2.4); }
/* thin box just outside the frame you were last looking at, or the one under the mouse */
.film-frame img { outline: 1px solid transparent; outline-offset: 3px; }
/* white here because the negative filter inverts the outline too, so it shows up black */
.film-frame.is-current img { outline-color: var(--sheet-ring); }
@media (hover: hover) { .film-frame:hover img { outline-color: var(--sheet-ring); } }
.sheet-label { display: flex; gap: 18px; margin: clamp(28px, 4vw, 56px) 0 0; font: 400 11px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sheet-label span:last-child { margin-left: auto; }

/* ---------- Info ---------- */
/* Flight: CCS ——✈ LAX across the top */
.flight {
  display: flex; align-items: center; gap: .22em;
  font: 700 clamp(32px, 6.4vw, 96px)/.9 var(--body); letter-spacing: -0.02em;
  padding-top: 2vh; margin-bottom: clamp(48px, 8vh, 96px);
}
.flight-track { position: relative; flex: 1; height: .5em; }
.flight-line {
  position: absolute; left: 0; top: 50%; height: 1px; margin-top: -.5px; background: var(--fg);
  width: calc(100% - .2em);
}
.flight-plane {
  position: absolute; top: 50%; left: calc(100% - .4em); width: .4em; height: .41em; margin-top: -.205em;
  background: var(--fg);
  -webkit-mask: url("assets/plane.png") center / contain no-repeat; mask: url("assets/plane.png") center / contain no-repeat;
}
.flight.is-flying .flight-line { animation: fly-line 2.6s cubic-bezier(.45, 0, .25, 1) .25s backwards; }
.flight.is-flying .flight-plane { animation: fly-plane 2.6s cubic-bezier(.45, 0, .25, 1) .25s backwards; }
@keyframes fly-line { from { width: 0; } }
@keyframes fly-plane { from { left: 0; } }
@media (prefers-reduced-motion: reduce) { .flight.is-flying .flight-line, .flight.is-flying .flight-plane { animation: none; } }

/* Bio on the left, an index of rows on the right */
.info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.info-bio { display: grid; gap: 1em; max-width: 44ch; margin-top: -.37em; } /* same size as the rows on the right; pulled up so the first line's capitals sit on the top rule */
.info-bio p { margin: 0; text-wrap: pretty; }
.info-rows { margin: 0; border-bottom: 1px solid var(--line); }
.info-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); column-gap: 16px; row-gap: 2px; padding: 12px 0 11px; border-top: 1px solid var(--line); align-items: baseline; }
.info-row dt { grid-column: 1; grid-row: 1 / span 4; color: var(--muted); }
.info-row dd { grid-column: 2; }
dd { margin: 0; overflow-wrap: anywhere; }
dd .k { display: inline-block; min-width: 64px; font: 12px var(--mono); letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
dd a { border-bottom: 1px solid var(--line); transition: border-color .2s; }
dd a:hover { border-color: var(--fg); }
.clients { line-height: 1.6; }
@media (max-width: 900px) {
  .info { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .info-row { grid-template-columns: 1fr; }
  .info-row dt { grid-row: auto; margin-bottom: 4px; }
  .info-row dd { grid-column: 1; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: fixed; inset: auto 0 0; z-index: 20;
  padding: 12px var(--gutter-r) calc(14px + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  display: flex; justify-content: space-between; align-items: end;
  color: var(--fg);
  background: var(--bg);
  pointer-events: none;
}
.tc { font-variant-numeric: tabular-nums; display: flex; gap: 10px; }
.tc-label { color: var(--fg); min-width: 2ch; }
.tc.is-clip #tc { color: var(--fg); }
.theme { display: flex; gap: 12px; align-items: center; pointer-events: auto; }
.theme button { display: block; width: 14px; height: 14px; color: var(--fg); transition: color .2s; }
.theme button:hover, .theme button[aria-pressed="true"] { color: var(--fg); }
.theme svg { display: block; width: 100%; height: 100%; overflow: visible; }
.theme circle, .theme path { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.theme button[aria-pressed="true"] :is(circle, path) { fill: currentColor; }


/* ---------- Player ---------- */
.player {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: grid; grid-template-rows: auto 1fr;
  padding: env(safe-area-inset-top, 0px) var(--gutter-r) env(safe-area-inset-bottom, 0px) var(--gutter-l);
  animation: fade .3s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.player-bar {
  height: var(--header-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
}
.player-index { color: var(--muted); font-variant-numeric: tabular-nums; }
.player-title {
  margin: 0; font: 500 15px/1.3 var(--body); text-transform: none; letter-spacing: 0;
  text-align: center;
}
.player-title span { color: var(--muted); font-weight: 400; }
.player-close { justify-self: end; color: var(--muted); }
.player-close:hover, .player-step:hover { color: var(--fg); }
.player-stage {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center;
  padding-bottom: 40px; min-height: 0;
}
.player-step { color: var(--muted); height: 100%; }
.player-step:first-child { text-align: left; }
.player-step:last-child { text-align: right; }
.player-frame {
  width: 100%; max-height: 100%;
  aspect-ratio: 16 / 9; max-width: calc((100vh - var(--header-h) - 60px) * 16 / 9);
  justify-self: center; background: #000;
}
.player-frame { position: relative; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  :root { --header-h: 56px; --gutter-l: max(16px, env(safe-area-inset-left, 0px)); --gutter-r: max(16px, env(safe-area-inset-right, 0px)); }
  /* Wordmark left, all links right */
  .site-header { grid-template-columns: auto 1fr auto; gap: 14px; }
  .wordmark { grid-column: 1; grid-row: 1; font-size: 22px; }
  .nav-left { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .nav-right { grid-column: 3; grid-row: 1; }
  .nav { gap: 14px; }
  .row-item.is-active .title { transform: none; }
  .row { grid-template-columns: 28px minmax(0, 1fr); row-gap: 2px; padding: 10px 0 9px; }
  .row-head span:nth-child(3) { display: none; }
  .row-item .client { grid-column: 2; grid-row: 1; }
  .row-item .title { grid-column: 2; grid-row: 2; font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .frame { height: auto; --frame-h: 70svh; }
  .player-stage { grid-template-columns: 1fr; grid-template-rows: auto auto; gap: 20px; align-content: center; }
  .player-frame { grid-column: 1; grid-row: 1; }
  .player-step { height: auto; grid-row: 2; }
  .player-step:first-child { grid-column: 1; justify-self: start; }
  .player-step:last-child { grid-column: 1; justify-self: end; }
  .player-bar { grid-template-columns: auto 1fr auto; }
  .player-title { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
