/* Case-study system. Every page in cases/<slug>/ links this file and ../case.js.
   Layout mirrors the 1280px Figma case frames; components below are the shared vocabulary. */
@font-face { font-family: "Apfel Grotezk"; src: url(../fonts/ApfelGrotezk-Regular.otf); font-weight: 400; font-display: swap; }
@font-face { font-family: "Apfel Grotezk"; src: url(../fonts/ApfelGrotezk-Mittel.otf); font-weight: 500; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url(../fonts/BerkeleyMono-Regular.otf); font-weight: 400; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url(../fonts/BerkeleyMono-Bold.otf); font-weight: 700; font-display: swap; }

@view-transition { navigation: auto; }

:root {
  --ink: #000; --bg: #fff; --muted: #6c6c6c; --line: rgba(0,0,0,.12);
  --accent: #000;          /* case colour: meta labels, button */
  --hot: #ff0025;          /* site-wide interaction colour (hover, focus, progress) */
  --pad: clamp(16px, 2.6vw, 56px); --max: clamp(1280px, 86vw, 1800px);
  --up: 1;               /* how much fixed-size visuals grow on big screens */
  --ease: cubic-bezier(.2,.7,.2,1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-family: "Apfel Grotezk", system-ui, sans-serif; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--hot); outline-offset: 3px; }
::selection { background: var(--hot); color: #fff; }

.page { max-width: var(--max); margin: 0 auto; }
.mono { font-family: "Berkeley Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0; }
/* Running text is set in the grotesk; mono + caps stay for short labels only */
:is(.lead, .quote, .section > p, .desc, .steps p).mono { font-family: "Apfel Grotezk", system-ui, sans-serif; text-transform: none; letter-spacing: -0.01em; }
p { text-wrap: pretty; } h2, h3, .next strong { text-wrap: balance; }
.in { padding: 0 var(--pad); }

/* ── Sticky top bar with reading progress ─────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 2.2vw, 48px); font-size: clamp(13px, .8vw, 16px); letter-spacing: -0.04em;
  background: var(--bg); }
.topbar .title { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s var(--ease); }
.topbar.scrolled .title { opacity: 1; transform: none; }
.topbar .progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--hot); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.link { position: relative; display: inline-flex; gap: 6px; transition: color .2s; }
.link:hover { color: var(--hot); }
.link .ar { display: inline-block; transition: transform .25s var(--ease); }
.link:hover .ar { transform: translateX(-4px); }

/* ── Intro block ──────────────────────────────────────────────────── */
.meta { display: flex; flex-wrap: wrap; gap: 24px clamp(48px, 6vw, 120px); margin-top: 45px; font-size: clamp(14px, .9vw, 17px); line-height: 1; }
.meta dt { color: var(--accent); font-size: clamp(13px, .8vw, 16px); }
.meta dd { margin-top: 12px; }

.hero { position: relative; margin-top: 32px; aspect-ratio: 1205 / 340; overflow: hidden; background: #111; }
.hero > :first-child { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 1.6s var(--ease); }
.is-loaded .hero > :first-child { transform: none; }

.btn { display: inline-flex; align-items: center; gap: 10px; margin-top: 32px; padding: 10px 4px 10px 10px; background: var(--accent); color: #fff;
  font-size: 14px; line-height: 20px; transition: background .2s; }
.btn:hover { background: var(--hot); }
.btn img, .btn svg { transition: transform .25s var(--ease); }
.btn:hover img, .btn:hover svg { transform: translate(2px, -2px); }

h1 { margin-top: 32px; font-weight: 500; font-size: clamp(40px, 5vw, 104px); line-height: 1.125; letter-spacing: -0.04em; text-wrap: balance; }
.lead { margin-top: 28px; max-width: 34em; font-size: clamp(18px, 1.3vw, 26px); line-height: 1.4; }

.quote { max-width: 28em; margin: 140px auto 0; padding: 0 16px; text-align: center; font-size: clamp(22px, 1.7vw, 36px); line-height: 1.35; letter-spacing: -0.02em; }
.quote b { font-weight: 500; }

/* Stats row: <div class="stats"><div><span class="mono">Label</span><strong>66%</strong><p class="mono">…</p></div>…</div> */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 48px; }
.stats > div { border: .5px solid currentColor; padding: 24px; display: flex; flex-direction: column; gap: 12px; min-height: 160px; }
.stats span { font-size: clamp(12px, .75vw, 15px); opacity: .6; }
.stats strong { font-weight: 500; font-size: clamp(40px, 3.2vw, 72px); line-height: 1; letter-spacing: -0.03em; margin-top: auto; }
.stats p { font-size: clamp(12px, .75vw, 15px); line-height: 1.5; }

/* ── Sections ─────────────────────────────────────────────────────── */
.section { margin-top: 140px; }
.section h2 { font-weight: 500; font-size: clamp(32px, 3.2vw, 72px); line-height: 1.1; letter-spacing: -0.03em; }
.section > .mono { margin-top: 16px; max-width: 38em; font-size: clamp(16px, 1.05vw, 20px); line-height: 1.5; color: var(--muted); }
.section + * { margin-top: 40px; }
.band { padding: 80px 0; margin-top: 80px; }
.band.dark { --ink: #fff; --line: rgba(255,255,255,.18); --muted: #9a9a9a; background: #131313; color: #fff; }
.band.tint { background: none; }
.band > .section:first-child { margin-top: 0; }

/* Sub-heading row above a visual group: <h3 class="sub-h mono"><span>Label</span><span>// descriptor</span></h3> */
.sub-h { margin: 96px var(--pad) 0; display: flex; justify-content: space-between; align-items: baseline; gap: 24px; border-top: .5px solid var(--line); padding-top: 16px; font-size: clamp(13px, .8vw, 16px); font-weight: 400; }
.sub-h span:last-child { color: var(--muted); text-align: right; }
.band > .sub-h:first-child { margin-top: 0; }

/* Figures. Images are 2x exports with 1x width/height attributes. Click to zoom. */
.fig.narrow { max-width: calc(var(--w, 970px) * var(--up)); margin-left: auto; margin-right: auto; padding: 0 var(--pad); }
.fig { margin: 40px var(--pad) 0; }
.fig.full { margin-left: 0; margin-right: 0; }
.fig img { width: 100%; }
.fig figcaption, .gallery figcaption, .grid figcaption { margin-top: 12px; font-size: clamp(13px, .8vw, 15px); color: var(--muted); }
[data-zoom] { cursor: zoom-in; }
:is(.shadow, .shadow figure) img { box-shadow: 0 4px 34px rgba(0,0,0,.07); }
:is(.rounded, .rounded figure) img { border-radius: 18px; }

/* Grid of equal items (phones, cards): <div class="grid" style="--cols:4">…</div> */
.grid { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 24px; margin: 40px var(--pad) 0; align-items: start; }
.grid > * { min-width: 0; }

/* Horizontal gallery: <section class="gallery"><div class="track"><figure>…</figure>…</div></section>
   case.js adds prev/next buttons and an "01 / 04" counter, plus mouse drag. */
.gallery { margin-top: 40px; position: relative; }
.gallery .track { display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--pad);
  padding: 0 var(--pad) 8px; scrollbar-width: none; overscroll-behavior-x: contain; }
.gallery .track::-webkit-scrollbar { display: none; }
.gallery .track.dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.gallery .track.dragging img { pointer-events: none; }
.gallery figure { flex: none; scroll-snap-align: start; width: calc(var(--w, 900px) * var(--up)); max-width: 82vw; }
.gallery figure img { width: 100%; }
.gallery .ctrl { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 16px var(--pad) 0; font-size: 12px; }
.gallery .count { margin-right: 8px; font-variant-numeric: tabular-nums; }
.gallery .ctrl button { width: 40px; height: 40px; border: .5px solid currentColor; display: grid; place-items: center; transition: background .2s, color .2s, border-color .2s, opacity .2s; }
.gallery .ctrl button:hover:not(:disabled) { background: var(--hot); border-color: var(--hot); color: #fff; }
.gallery .ctrl button:disabled { opacity: .25; cursor: default; }

/* ── Next case ────────────────────────────────────────────────────── */
.next { display: block; margin-top: 160px; padding: 56px var(--pad) 64px; border-top: .5px solid var(--line); }
.next .mono { display: block; font-size: clamp(13px, .8vw, 16px); color: var(--muted); }
.next .sub { margin-top: 16px; }
.next strong { display: flex; align-items: center; gap: 24px; margin-top: 16px; font-weight: 500; font-size: clamp(40px, 9vw, 120px); line-height: 1; letter-spacing: -0.04em; text-transform: uppercase; overflow-wrap: anywhere; flex-wrap: wrap; transition: color .25s; }
.next strong i { font-style: normal; display: inline-block; transition: transform .35s var(--ease); }
.next:hover strong { color: var(--hot); }
.next:hover strong i { transform: translateX(16px); }
.foot { display: flex; justify-content: space-between; padding: 14px clamp(16px, 2.2vw, 48px) 32px; font-size: clamp(13px, .8vw, 16px); letter-spacing: 0; }

/* ── Scroll reveal (only when JS is on) ───────────────────────────── */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ── Lightbox ─────────────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; border: 0; padding: 0; background: rgba(12,12,12,.94); color: #fff; }
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr; animation: lb-in .25s var(--ease); }
.lightbox .lb-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 32px; font-size: 13px; }
.lightbox .lb-stage { display: grid; place-items: center; padding: 0 72px 32px; min-height: 0; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .lb-stage img { cursor: zoom-in; }
.lightbox .lb-stage.is-zoomed { display: block; overflow: auto; padding: 0; cursor: grab; scrollbar-width: none; }
.lightbox .lb-stage.is-zoomed img { max-width: none; max-height: none; margin: 0 auto; cursor: zoom-out; }
.lightbox .lb-stage.is-zoomed:active img { cursor: grabbing; }
.lightbox .lb-nav { position: absolute; top: 50%; width: 48px; height: 48px; border: .5px solid rgba(255,255,255,.4); display: grid; place-items: center; transition: background .2s; }
.lightbox .lb-nav:hover { background: var(--hot); border-color: var(--hot); }
.lightbox .lb-prev { left: 16px; } .lightbox .lb-next { right: 16px; }
.lightbox button:hover { color: var(--hot); }
.lightbox .lb-nav:hover { color: #fff; }
@keyframes lb-in { from { opacity: 0; } }

@media (max-width: 900px) {
  :root { --pad: 16px; }
  .topbar, .foot { padding-left: 16px; padding-right: 16px; }
  .topbar .title { display: none; }
  .meta { gap: 20px 40px; }
  .quote { margin-top: 88px; font-size: 17px; line-height: 26px; }
  .section { margin-top: 88px; }
  .section h2 { font-size: 32px; }
  .band { padding: 56px 0; }
  .grid { grid-template-columns: repeat(min(var(--cols, 3), 4), 1fr); gap: 12px; }
  .grid[style*="--cols:6"] { grid-template-columns: repeat(3, 1fr); }
  .gallery figure { max-width: 86vw; }
  .gallery .track { gap: 12px; }
  .next { margin-top: 96px; }
  .lightbox .lb-stage { padding: 0 8px 24px; }
  .lightbox .lb-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}

/* ── Screen switcher: <div class="flow" aria-label="…"><figure><img data-zoom><figcaption>Label</figcaption></figure>…</div>
   case.js builds the numbered state list from figcaptions, crossfades screens and auto-advances while in view.
   Without JS the figures simply stack. Stage colour per case via --stage. */
:root { --stage: #f6f6f6; }   /* matches the grey the Figma exports are baked on */
.band.dark { --stage: #1e1e1e; }
.flow { margin: 40px var(--pad) 0; }
.js .flow { display: grid; grid-template-columns: clamp(200px, 16vw, 320px) minmax(0, 1fr); gap: 32px; align-items: start; }
.js .flow.top { grid-template-columns: minmax(0, 1fr); gap: 16px; }
.flow-nav { display: flex; flex-direction: column; position: sticky; top: 72px; font-size: clamp(12px, .75vw, 15px); }
.flow.top .flow-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 0 24px; }
.flow-nav button { position: relative; display: flex; gap: 12px; padding: 14px 0; text-align: left; border-top: .5px solid var(--line); color: var(--muted); transition: color .2s; }
.flow.top .flow-nav button { border-top: 0; padding: 8px 0 12px; }
.flow-nav button b { font-weight: 400; font-variant-numeric: tabular-nums; }
.flow-nav button:hover, .flow-nav button[aria-selected=true] { color: var(--ink); }
.flow-nav button::after { content: ""; position: absolute; left: 0; top: -1px; height: 1px; width: 100%; background: var(--hot); transform-origin: 0 50%; transform: scaleX(0); }
.flow.top .flow-nav button::after { top: auto; bottom: 0; }
.flow-nav button[aria-selected=true]::after { transform: scaleX(1); }
.flow.playing .flow-nav button[aria-selected=true]::after { animation: flow-p var(--dur, 5s) linear both; }
.flow.paused .flow-nav button[aria-selected=true]::after { animation-play-state: paused; }
@keyframes flow-p { from { transform: scaleX(0); } }
.flow-stage { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; background: var(--stage); padding: clamp(8px, 2vw, 24px); border-radius: 4px; overflow: hidden; }
.flow-stage figure { grid-area: 1 / 1; width: 100%; display: grid; justify-items: center; transition: opacity .5s var(--ease), transform .6s var(--ease), visibility 0s .5s; }
.flow-stage figure[hidden] { display: grid; opacity: 0; visibility: hidden; transform: translateY(12px) scale(.985); }
.flow-stage figure:not([hidden]) { transition-delay: 0s; }
.flow-stage img:not([src]) { display: none; }
.flow-stage img { max-width: 100%; width: calc(var(--w) * var(--up)); }   /* --w = 1x width, set by case.js from the width attribute */
.lift :is(.flow-stage, .phone-row) img, .phone-row.lift img { border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 48px -12px rgba(0,0,0,.22); }
.flow-stage figcaption { display: none; }
.flow:not(.js *) figure + figure { margin-top: 24px; }

/* ── Phone row: every screen of a mobile flow visible at once, numbered. <div class="phone-row"><figure>…</figure>…</div> */
.phone-row { counter-reset: ph; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 20px;
  margin: 40px var(--pad) 0; padding: clamp(20px, 4vw, 48px); background: var(--stage); border-radius: 4px; overflow-x: auto; scrollbar-width: none; }
.phone-row::-webkit-scrollbar { display: none; }
.phone-row figure { counter-increment: ph; min-width: 0; }
.phone-row img { width: 100%; transition: transform .4s var(--ease); }
.phone-row figure:hover img { transform: translateY(-6px); }
.phone-row figcaption { margin-top: 6px; padding: 0 6px; font-size: clamp(11px, .7vw, 14px); line-height: 1.4; color: var(--muted); }
.phone-row figcaption::before { content: counter(ph, decimal-leading-zero) "   "; color: var(--ink); white-space: pre; }
.js .phone-row.reveal figure { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .phone-row.reveal.is-in figure { opacity: 1; transform: none; }
.js .phone-row.reveal.is-in figure:nth-child(2) { transition-delay: .07s; } .js .phone-row.reveal.is-in figure:nth-child(3) { transition-delay: .14s; }
.js .phone-row.reveal.is-in figure:nth-child(4) { transition-delay: .21s; } .js .phone-row.reveal.is-in figure:nth-child(5) { transition-delay: .28s; }
.js .phone-row.reveal.is-in figure:nth-child(n+6) { transition-delay: .35s; }
.js .phone-row.reveal { opacity: 1; transform: none; }

/* ── Long page in a window: scrolls through on hover. <figure class="longshot" style="--h:640px"><div class="win"><img data-zoom></div><figcaption>…</figcaption></figure> */
.longshot { margin: 40px var(--pad) 0; padding: clamp(16px, 4vw, 56px); background: var(--stage); border-radius: 4px; }
.longshot .win { max-width: calc(var(--w, 1050px) * var(--up)); margin: 0 auto; height: var(--h, 640px); overflow: hidden; border-radius: 8px; box-shadow: 0 18px 48px -12px rgba(0,0,0,.22); }
.longshot img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transition: object-position var(--t, 7s) cubic-bezier(.45,0,.55,1); }
.longshot .win:hover img { object-position: 50% 100%; }
.longshot figcaption { max-width: calc(var(--w, 1050px) * var(--up)); margin: 14px auto 0; font-size: clamp(12px, .75vw, 15px); color: var(--muted); }

@media (max-width: 900px) {
  .js .flow { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .flow-nav { position: relative; top: 0; flex-direction: row; overflow-x: auto; gap: 20px; scrollbar-width: none; }
  .flow-nav button { flex: none; border-top: 0; padding: 8px 0 12px; }
  .flow-nav button::after { top: auto; bottom: 0; }
  .phone-row { grid-auto-columns: 150px; gap: 12px; }
  .longshot .win { height: min(var(--h, 640px), 70vh); }
}
.lift .flow-stage { padding: clamp(16px, 4vw, 56px); }

/* ── Sticky section tabs for long cases: <nav class="tabs mono"><a href="#id">Label</a>…</nav>; case.js marks the one in view */
.tabs { position: sticky; top: 46px; z-index: 15; display: flex; gap: 28px; margin-top: 96px; padding: 14px var(--pad); overflow-x: auto; scrollbar-width: none;
  font-size: clamp(12px, .75vw, 15px); background: var(--bg); border-bottom: .5px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; color: var(--muted); transition: color .2s; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current=true] { color: var(--accent); }
[id] { scroll-margin-top: 110px; }

/* ── Masonry wall of mixed-format visuals: <div class="wall" style="--cols:4"><figure><img data-zoom></figure>…</div> */
.wall { columns: var(--cols, 4) 140px; column-gap: 16px; margin: 40px var(--pad) 0; }
.wall figure { break-inside: avoid; margin-bottom: 16px; }
.wall figure[hidden] { display: none; }
.wall img { width: 100%; border-radius: 6px; transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
.wall figure:hover img { transform: translateY(-4px); box-shadow: 0 18px 40px -18px rgba(0,0,0,.6); }
.wall.square { columns: auto; display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 16px; }
.wall.square figure { margin: 0; }
.js .wall.reveal.is-in figure { animation: wall-in .6s var(--ease) both; }
@keyframes wall-in { from { opacity: 0; transform: translateY(18px); } }

/* ── Filter chips for a wall: <div class="chips mono" data-for="wallId"><button data-f="all" aria-pressed="true">All</button><button data-f="x">X</button></div> */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px var(--pad) 0; font-size: clamp(12px, .75vw, 15px); }
.chips button { padding: 9px 14px; border: .5px solid var(--line); border-radius: 99px; color: var(--muted); transition: color .2s, background .2s, border-color .2s; }
.chips button:hover { color: var(--ink); border-color: var(--ink); }
.chips button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.chips sup { margin-left: 4px; font-size: 11px; opacity: .7; }

/* ── Endless strip: <div class="marquee" style="--t:60s"><div class="mq">figures…</div></div>; case.js clones the row once */
.marquee { margin-top: 40px; overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.marquee .mq { display: flex; gap: 16px; width: max-content; animation: mq var(--t, 60s) linear infinite; }
.marquee:hover .mq { animation-play-state: paused; }
.marquee figure { flex: none; width: calc(var(--w, 300px) * var(--up)); }
.marquee img { width: 100%; border-radius: 6px; }
@keyframes mq { to { transform: translateX(calc(-50% - 8px)); } }

/* ── Site pages inside a switcher: each figure holds a .win that scrolls through the page on hover */
.flow.pages .flow-stage figure { width: 100%; }
.flow.pages .win { --wh: min(72vh, 660px); width: 100%; height: var(--wh); overflow: hidden; border-radius: 8px; box-shadow: 0 18px 48px -12px rgba(0,0,0,.4); }
.flow.pages .pg { position: relative; min-height: 100%; transition: transform var(--t, 9s) cubic-bezier(.45,0,.55,1); }
.flow.pages .win:hover .pg { transform: translateY(calc(var(--wh) - 100%)); }
.flow.pages .pg img { display: block; width: 100%; height: auto; min-height: var(--wh); object-fit: cover; }
.flow.pages .pg video { position: absolute; left: 0; width: 100%; object-fit: cover; pointer-events: none; }
.longshot.phone .win { --w: 375px; border-radius: 28px; }

@media (max-width: 900px) {
  .tabs { margin-top: 64px; gap: 20px; }
  .wall { column-gap: 10px; } .wall figure { margin-bottom: 10px; }
  .wall.square { grid-template-columns: repeat(min(var(--cols, 4), 2), 1fr); gap: 10px; }
  .marquee figure { width: calc(var(--w, 300px) * .7); }
}
@media (prefers-reduced-motion: reduce) { .marquee { overflow-x: auto; } }

@media (min-width: 1600px) { :root { --up: 1.2; } }
@media (min-width: 1900px) { :root { --up: 1.35; } }
@media (min-width: 2300px) { :root { --up: 1.6; } }

/* ── Full-bleed on wide screens: strips, galleries, bands and tabs run to the viewport edge
   instead of stopping at the 1280 column; their content stays aligned with the column. */
:root { --gut: max(0px, (100vw - var(--max)) / 2); }
.page .gallery, .page .band, .page > .tabs, .marquee {
  margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.band .marquee, .band .gallery { margin-left: calc(-1 * var(--gut)); margin-right: calc(-1 * var(--gut)); }
.gallery .track { padding-left: calc(var(--pad) + var(--gut)); padding-right: calc(var(--pad) + var(--gut)); scroll-padding: 0 calc(var(--pad) + var(--gut)); }
.gallery .ctrl { padding-right: calc(var(--pad) + var(--gut)); }
.page .band { padding-left: var(--gut); padding-right: var(--gut); }
.page > .tabs { padding-left: calc(var(--pad) + var(--gut)); padding-right: calc(var(--pad) + var(--gut)); }

/* Video in figures and phone rows (autoplay loops, muted) */
.phone-row video, .fig video, .grid video { display: block; width: 100%; height: auto; }
.phone-row video { border-radius: 18px; }

/* Phones carry their own frame and shadow: no stage panel behind them */
.phone-row { background: none; padding: 8px 0 32px; margin-left: var(--pad); margin-right: var(--pad); }
.phone-row img, .phone-row video { filter: drop-shadow(0 14px 28px rgba(0,0,0,.14)); }
.phone-row.lift img { box-shadow: none; }

/* No stage panels: a screenshot is already its own surface */
.flow-stage { background: none; padding: 0; border-radius: 0; overflow: visible; }
.flow-stage img { border-radius: 6px; }
.longshot { background: none; padding: 0; }

/* Next case: the next cover slides in on hover, the same tile as on the main page */
.next { position: relative; overflow: hidden; }
.next > :not(.next-cover) { position: relative; z-index: 1; }
.next-cover { position: absolute; left: 0; top: 0; z-index: 0; height: min(78%, 340px); aspect-ratio: 2 / 3; display: grid; place-items: center; overflow: hidden; isolation: isolate; pointer-events: none;
  opacity: 0; transform: translate(calc(var(--mx, 70vw) - 50%), calc(var(--my, 50%) - 50%)) rotate(6deg) scale(.85); transition: opacity .35s var(--ease), transform .6s var(--ease); }
.next-cover .cv { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: bottom; }
.next-cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--tint, transparent); mix-blend-mode: var(--blend, normal); }
.next-cover span { display: none; }
.next-cover span img { max-height: 40px; width: auto; }
.next:is(:hover, :focus-visible) .next-cover { opacity: 1; transform: translate(calc(var(--mx, 70vw) - 50%), calc(var(--my, 50%) - 50%)) rotate(-3deg); }
@media (hover: none), (max-width: 900px) { .next-cover { display: none; } }
.next-cover img[src$="billy-cube.png"] { max-height: 84px; filter: drop-shadow(0 0 28px rgba(255,186,90,.75)); }

/* ── Phones and touch ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topbar .link, .foot .link { padding: 12px 0; margin: -12px 0; } .tabs { padding-top: 4px; padding-bottom: 4px; } .tabs a { padding: 12px 0; } .flow-nav button { padding: 12px 0; } .flow.top .flow-nav { flex-wrap: nowrap; } .flow-nav { margin-right: calc(var(--pad) * -1); padding-right: var(--pad); }
  .flow-stage, .lift .flow-stage { padding: 8px; } .pe-open { padding: 12px 0; }
}
@media (max-width: 560px) {
  .grid, .grid[style*="--cols:6"] { grid-template-columns: repeat(min(var(--cols, 3), 2), 1fr); }
  h1 br { display: none; } .next strong { font-size: clamp(30px, 9vw, 40px); gap: 12px; flex-wrap: nowrap; }
  .flow.lift { margin-left: 0; margin-right: 0; } .flow.lift .flow-nav { padding-left: var(--pad); margin-right: 0; }
}
@media (hover: none) { .longshot .win { height: auto; max-height: min(var(--h, 640px), 70vh); overflow-y: auto; } .longshot .win img { height: auto; object-fit: initial; } .longshot figcaption.hint { display: none; } }

/* Phone flows: the screen stands right next to its list, both centred on each other */
@media (min-width: 901px) {
  .js .flow.portrait:not(.top) { grid-template-columns: clamp(220px, 18vw, 320px) minmax(0, max-content); justify-content: start; align-items: center; column-gap: clamp(40px, 6vw, 120px); }
  .flow.portrait .flow-stage { justify-items: start; }
  .flow.portrait:not(.top) .flow-nav { position: static; }
}
