/* Samuel Beer — monospace editorial layout.
   Everything is Martian Mono, uppercase, small and widely tracked; the only
   large type is the display headings, which bleed to the page edges. */

/* ---------- reset ---------- */
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- tokens ---------- */
:root {
  --paper: #ffffff;
  --ink: #000000;
  --soft: #8a8a8a;
  --rule: #e2e2e2;
  --plate: #f2f2f0;
  --inv-ink: #ffffff;

  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ui: 10.5px;            /* the small uppercase text, everywhere */
  --track: 0.04em;
  --gut: max(14px, env(safe-area-inset-left, 0px));
  --gut-r: max(14px, env(safe-area-inset-right, 0px));
  --bar: 58px;             /* header height */
}
@media (min-width: 900px) {
  :root { --ui: 11px; --gut: max(20px, env(safe-area-inset-left, 0px)); --gut-r: max(20px, env(safe-area-inset-right, 0px)); }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000; --ink: #f2f2f2; --soft: #777772;
    --rule: #242424; --plate: #0f0f0f; --inv-ink: #000000;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #000000; --ink: #f2f2f2; --soft: #777772;
  --rule: #242424; --plate: #0f0f0f; --inv-ink: #000000;
  color-scheme: dark;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--ui);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: var(--track);
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Prose keeps its case — only the interface is uppercase. */
.sentence { text-transform: none; }

:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }

.skip {
  position: fixed; left: -9999px; top: 0; z-index: 60;
  background: var(--ink); color: var(--paper); padding: 10px 14px;
}
.skip:focus { left: 0; }

/* ---------- header: four columns of small type ---------- */
.masthead {
  position: fixed;
  top: env(safe-area-inset-top, 0px); left: 0; right: 0;
  z-index: 40;
  padding: 14px var(--gut-r) 14px var(--gut);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
  mix-blend-mode: difference;
  color: #fff;                      /* difference blend flips this per backdrop */
  pointer-events: none;
}
.masthead a, .masthead button { pointer-events: auto; }
.masthead .col { display: grid; gap: 2px; min-width: 0; }
.masthead .col:last-child { text-align: right; justify-items: end; }
.masthead .mark { font-weight: 600; letter-spacing: 0.06em; }
.masthead .muted { color: #9a9a9a; }
.masthead a:hover { opacity: 0.6; }
.navline { display: flex; flex-wrap: wrap; gap: 0; }
.navline a { position: relative; }
.navline a[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; }
.navline .sep { color: #9a9a9a; padding: 0 1px; }
.clock { font-variant-numeric: tabular-nums; }

/* Pages that are not the film-screen hero get a solid bar instead of blend.
   The landing page earns one too, but only once the film has scrolled away:
   over the film the header blends, over the page it sits on paper. */
body.has-bar .masthead,
body.past-hero .masthead {
  mix-blend-mode: normal;
  color: var(--ink);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
body.has-bar .masthead .muted,
body.past-hero .masthead .muted { color: var(--soft); }
body.has-bar main { padding-top: var(--bar); }
.masthead { transition: background 0.2s, color 0.2s, border-color 0.2s; }

/* Nothing should pass under the bar mid-heading. */
body.past-hero .display-row:first-of-type { scroll-margin-top: var(--bar); }

@media (max-width: 860px) {
  .masthead { grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .masthead .col:nth-child(3) { display: none; }
  :root { --bar: 76px; }
}

/* ---------- the landing film ---------- */
.screenfull {
  position: relative;
  height: 100svh;
  min-height: 420px;
  width: 100%;
  overflow: hidden;
  background: #000;
}
.screenfull video, .screenfull img.plate {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.screenfull::after {           /* keeps the corner type legible on bright frames */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.34), rgba(0,0,0,0.05) 28%, rgba(0,0,0,0.05) 68%, rgba(0,0,0,0.38));
  pointer-events: none;
}
.screenfull .corners {
  position: absolute; inset: auto 0 0 0;
  z-index: 2;
  padding: 0 var(--gut-r) 46px var(--gut);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 14px;
  color: #fff;
}
.screenfull .corners .mid { text-align: center; }
.screenfull .corners .end { text-align: right; }
.screenfull a.corners-link { color: #fff; }
.screenfull a.corners-link:hover { opacity: 0.7; }
.scrollcue {
  position: absolute; left: 0; right: 0; bottom: 18px;
  text-align: center; color: #fff; z-index: 2;
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ---------- display headings ---------- */
.display {
  margin: 0;
  font-family: var(--mono);
  font-weight: 300;
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-transform: uppercase;
  white-space: nowrap;
  /* Martian Mono advances 0.645em per character at this tracking, so a word of
     --len characters fits the line at this size. --reserve leaves room for the
     number sitting at the right-hand end of the row. */
  font-size: clamp(32px, 15.2vw, 232px);
  font-size: min(
    clamp(32px, 15.2vw, 232px),
    calc((100vw - var(--gut) - var(--gut-r) - var(--reserve, 0px) - 6px) / 0.645 / var(--len, 8))
  );
}
.display.wrap { white-space: normal; text-wrap: balance; }
.display-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(26px, 4vw, 54px) var(--gut-r) clamp(12px, 1.6vw, 20px) var(--gut);
  border-bottom: 1px solid var(--rule);
}
.display-row .count { font-size: clamp(22px, 5vw, 56px); font-weight: 300; letter-spacing: -0.04em; color: var(--soft); }

.band {
  padding: clamp(22px, 3.4vw, 40px) var(--gut-r) clamp(22px, 3.4vw, 40px) var(--gut);
  border-bottom: 1px solid var(--rule);
}
.band:last-child { border-bottom: 0; }
.label { color: var(--soft); margin: 0 0 14px; }

/* ---------- the numbered film list ---------- */
.worklist { display: grid; }
.workrow {
  display: grid;
  grid-template-columns: 44px minmax(0, 1.5fr) minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 13px var(--gut-r) 13px var(--gut);
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: background 0.18s, color 0.18s;
}
.workrow:first-child { border-top: 1px solid var(--rule); }
.workrow .idx { color: var(--soft); font-variant-numeric: tabular-nums; }
.workrow .ttl { font-weight: 500; letter-spacing: 0.01em; min-width: 0; }
.workrow .cat, .workrow .yr { color: var(--soft); min-width: 0; }
.workrow .yr { font-variant-numeric: tabular-nums; }
.workrow:hover { background: var(--ink); color: var(--paper); }
.workrow:hover .idx, .workrow:hover .cat, .workrow:hover .yr { color: var(--paper); }

/* ---------- showcase: the picture grid on the front page ----------
   A six-column bed. The lead films take three columns each (two across),
   everything after takes two (three across). */
.showcase {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--rule);
  border-block: 1px solid var(--rule);
}
.showcase .tile { grid-column: span 3; }        /* two across */
.showcase .tile.lead { grid-column: span 6; }   /* the opening film, full width */
.showcase .tile.lead .shot { aspect-ratio: 21 / 9; }
@media (max-width: 680px) {
  .showcase .tile, .showcase .tile.lead { grid-column: span 6; }
  .showcase .tile.lead .shot { aspect-ratio: 16 / 9; }
}

/* the index number sits over the top-left corner of the frame */
.tile .num {
  position: absolute; top: 10px; left: 12px; z-index: 2;
  color: #fff; mix-blend-mode: difference;
  font-variant-numeric: tabular-nums;
}

/* a self-hosted film previews itself under the cursor */
.tile .shot video.prev {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.5s;
}
.tile .shot video.prev.on { opacity: 1; }

/* ---------- tiles (films index, photography index) ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1px;
  background: var(--rule);
  border-block: 1px solid var(--rule);
}
.tile { background: var(--paper); display: grid; gap: 0; }
.tile .shot {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--plate);
}
.tile .shot img, .tile .shot video {
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity 0.3s, transform 0.5s ease;
}
.tile:hover .shot img { opacity: 0.85; transform: scale(1.015); }
.tile .cap {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 12px 13px;
}
.tile .cap .t { font-weight: 500; }
.tile .cap .c { color: var(--soft); text-align: right; }

/* ---------- photography strip ---------- */
.strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1px;
  background: var(--rule);
  border-block: 1px solid var(--rule);
}
.strip .tile .shot { aspect-ratio: 3 / 2; }

/* ---------- the film player ---------- */
.player {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
/* A film's shape is set inline from data.json. A film must fit the screen
   without being letterboxed into it: max-height caps how tall it gets, and the
   matching max-width stops a tall film stretching across the page with black
   either side. Both are set inline per film; these are the 16/9 defaults. */
.player {
  max-height: calc(100svh - var(--bar) - 8px);
  max-width: calc((100svh - var(--bar) - 8px) * 16 / 9);
  margin-inline: auto;
}
.player.tall { aspect-ratio: auto; height: calc(100svh - var(--bar)); }
.player video, .player iframe, .player img.plate {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.player video { object-fit: contain; background: #000; }
.player img.plate { object-fit: cover; }

.player .bigplay {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center;
  color: #fff;
  letter-spacing: 0.22em;
  background: rgba(0,0,0,0.12);
  transition: background 0.25s;
}
.player .bigplay:hover { background: rgba(0,0,0,0.3); }
.player.playing .bigplay { opacity: 0; pointer-events: none; }

/* a corner tag marking a clip as an excerpt, not the whole film */
.player .flag {
  position: absolute; top: 12px; left: 14px; z-index: 4;
  color: #fff; mix-blend-mode: difference;
  letter-spacing: 0.1em;
}

.player .controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  opacity: 0;
  transition: opacity 0.25s;
}
.player:hover .controls,
.player.paused .controls,
.player.touched .controls { opacity: 1; }
.player .time { font-variant-numeric: tabular-nums; }
.player .scrub {
  position: relative;
  height: 14px;
  display: flex; align-items: center;
  cursor: pointer;
}
.player .scrub .track { position: relative; height: 1px; width: 100%; background: rgba(255,255,255,0.4); }
.player .scrub .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: #fff; }
.player .scrub:hover .track { height: 3px; }
.player .tools { display: flex; gap: 14px; align-items: center; }
.player .tools button { color: #fff; letter-spacing: 0.08em; }
.player .tools button:hover { opacity: 0.65; }

/* ---------- project page furniture ---------- */
.head {
  display: grid;
  gap: 10px;
  padding: clamp(22px, 3vw, 38px) var(--gut-r) clamp(18px, 2.4vw, 28px) var(--gut);
}
.metarow {
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  color: var(--soft);
  padding: 12px var(--gut-r) 12px var(--gut);
  border-block: 1px solid var(--rule);
}
.metarow b { font-weight: 400; color: var(--ink); }
.prose {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
  line-height: 1.75;
  max-width: 62ch;
  color: var(--ink);
}
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.out {
  display: inline-block;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}
.out:hover { opacity: 0.6; }

.pager {
  display: flex; justify-content: space-between; gap: 16px;
  padding: clamp(24px, 3.4vw, 40px) var(--gut-r) clamp(24px, 3.4vw, 40px) var(--gut);
  border-top: 1px solid var(--rule);
}
.pager .nx { text-align: right; }
.pager .nx b, .pager .pv b { display: block; font-weight: 500; margin-top: 4px; }
.pager .lbl { color: var(--soft); }

/* ---------- index block (services / focus / capabilities) ---------- */
.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: clamp(22px, 3vw, 44px);
}
.cols ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.cols li { color: var(--ink); }
.cols h3 { margin: 0 0 12px; font-size: inherit; font-weight: 400; color: var(--soft); }
.portrait {
  display: block;
  width: min(100%, 300px);
  aspect-ratio: 4 / 5;
  height: auto;
  object-fit: cover;
  object-position: 50% 30%;
}

/* ---------- photography gallery ---------- */
.gallery { display: grid; gap: 1px; background: var(--rule); }
.gallery .gframe { margin: 0; background: var(--paper); display: grid; justify-items: center; }
.gallery .gframe img { width: 100%; height: auto; }

.gallery.is-slideshow { position: relative; gap: 0; background: var(--paper); min-height: 300px; }
.gallery.is-slideshow .gframe { display: none; background: none; }
.gallery.is-slideshow .gframe.is-current { display: grid; }
.gallery.is-slideshow .gframe img {
  width: auto; max-width: 100%;
  max-height: min(72svh, 840px); height: auto; object-fit: contain;
}
.gallery.is-sheet {
  grid-template-columns: repeat(auto-fill, minmax(min(50%, 140px), 1fr));
  background: var(--rule);
}
.gallery.is-sheet .gframe { aspect-ratio: 3 / 2; overflow: hidden; cursor: pointer; display: block; }
.gallery.is-sheet .gframe img { width: 100%; height: 100%; object-fit: cover; max-height: none; transition: opacity 0.2s; }
.gallery.is-sheet .gframe:hover img { opacity: 0.7; }
.gallery.is-sheet .gframe.is-current img { opacity: 0.35; }

.stage-nav {
  position: absolute; top: 0; bottom: 0;
  width: clamp(48px, 8vw, 110px);
  z-index: 2; color: var(--soft); font-size: 18px;
}
.stage-nav:hover { color: var(--ink); }
.stage-nav[disabled] { opacity: 0.2; cursor: default; }
.stage-nav.prev { left: 0; }
.stage-nav.next { right: 0; }
.stage-bar {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  flex-wrap: wrap;
  padding: 14px var(--gut-r) 14px var(--gut);
  color: var(--soft);
  border-top: 1px solid var(--rule);
}
.counter { font-variant-numeric: tabular-nums; }
.sheet-toggle { color: var(--soft); border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.sheet-toggle:hover { color: var(--ink); border-bottom-color: currentColor; }

/* ---------- short-form grid (scrubmarine) ---------- */
.clips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1px;
  background: var(--rule);
  border-block: 1px solid var(--rule);
}
.clip { background: var(--paper); display: grid; }
.clip video { width: 100%; height: auto; background: #000; }
.clip .cap { display: flex; justify-content: space-between; padding: 10px 12px 13px; color: var(--soft); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule); }
.foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: clamp(20px, 3vw, 40px);
  padding: clamp(26px, 3.4vw, 44px) var(--gut-r) clamp(18px, 2vw, 26px) var(--gut);
}
.foot-grid h3 { margin: 0 0 12px; font-size: inherit; font-weight: 400; color: var(--soft); }
.foot-grid ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.foot-grid a:hover { opacity: 0.6; }
/* .foot-grid ul sets display:grid and outranks a bare .client-logos rule,
   which is what stacked these into a column. Match it and win. */
.foot-grid ul.client-logos {
  list-style: none; margin: 0; padding: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(18px, 3vw, 38px);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.foot-grid ul.client-logos::-webkit-scrollbar { display: none; }
.foot-grid ul.client-logos li { flex: 0 0 auto; }
.client-logos img {
  height: var(--h, 24px); width: auto; max-width: 130px;
  filter: grayscale(1) contrast(1.05);
  opacity: 0.4;
  transition: opacity 0.22s;
}
.client-logos li:hover img { opacity: 0.85; }
a.out.big {
  font-size: clamp(15px, 2.2vw, 22px);
  letter-spacing: -0.03em;
}

.client-logos .wordmark {
  font-size: 13px; letter-spacing: -0.02em; text-transform: uppercase;
  color: var(--ink); opacity: 0.4; white-space: nowrap;
  transition: opacity 0.22s;
}
.client-logos li:hover .wordmark { opacity: 0.85; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .client-logos img { filter: grayscale(1) contrast(1.05) invert(1); opacity: 0.5; }
}
:root[data-theme="dark"] .client-logos img { filter: grayscale(1) contrast(1.05) invert(1); opacity: 0.5; }

.colophon {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px;
  padding: 14px var(--gut-r) 18px var(--gut);
  border-top: 1px solid var(--rule);
  color: var(--soft);
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .scrollcue { animation: none; opacity: 0.8; }
}

@media (max-width: 680px) {
  .workrow { grid-template-columns: 30px minmax(0, 1fr) auto; row-gap: 2px; }
  .workrow .cat { grid-column: 2 / 3; }
  .display { letter-spacing: -0.04em; }
}
