
/* Project pages (/work/<slug>/), in the homepage's look: loads after home.css and uses its
   tokens (--color-bg, --color-text, --color-text-muted, --color-border, --color-bg-subtle), its Type styles and its parts (.label,
   buttons). After shahvirsarkary.com (a quiet facts row, chapters with a small label) and
   svsd.school (serif numbers in outlined ovals, a closing "Start your next chapter").
   Content sits in the site's 1280px column (--content; the grey sections run full width),
   sections are split by a hairline, and body copy is Type/body/s (14/20). */

/* Hero: label, title and intro centred, the results, then the image and the facts */
.case-hero { padding: 176px var(--edge); }
.case-hero__text { display: grid; justify-items: center; gap: var(--space-6); text-align: center; }
.case-title {
  max-width: 1040px;
  font: var(--type-display-xl); letter-spacing: var(--type-display-xl-tracking);
  text-wrap: balance;
}
.case-intro { max-width: 520px; font: var(--type-body-m); color: var(--color-text-muted); text-wrap: pretty; }
.case-hero .frame { margin-top: var(--space-24); }
/* The hero fades up as one, like the homepage intro */
.case-hero__text, .case-hero .case-stats, .case-hero .frame { opacity: 0; translate: 0 16px; }
.is-ready .case-hero__text { opacity: 1; translate: 0; transition: opacity var(--duration-xl) .1s var(--ease), translate var(--duration-xl) .1s var(--ease); }
.is-ready .case-hero .case-stats { opacity: 1; translate: 0; transition: opacity var(--duration-xl) .2s var(--ease), translate var(--duration-xl) .2s var(--ease); }
.is-ready .case-hero .frame { opacity: 1; translate: 0; transition: opacity 1s .25s var(--ease), translate 1s .25s var(--ease); }
:root:not(.js) :is(.case-hero__text, .case-hero .case-stats, .case-hero .frame) { opacity: 1; translate: 0; } /* no script to fade them in */

/* The facts: one quiet row, a mono label over each value (like the work meta) */
.case-facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-6) var(--space-8); margin-top: var(--space-10); padding-top: var(--space-6); border-top: 1px solid var(--color-border); }
.case-facts div { display: grid; gap: var(--space-1); align-content: start; }
.case-facts dt { font: var(--type-label); letter-spacing: var(--type-label-tracking); color: var(--color-text-muted); }
.case-facts dd { font-weight: 500; }
.case-facts a { text-decoration: none; }
/* The company link borrows the career rows' link look, but not their stretch over the
   whole row: here there's no row to stop it, so it would cover the page */
.case-facts .career-co::after { content: none; }

/* Results: big serif numbers over what they count, three across (they count up, project.js) */
.case-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-14); margin-top: var(--space-24); }
@media (min-width: 768px) { .case-stats:has(> li:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } } /* two results split the width */
/* centred under the intro, each under a hairline like the homepage's testimonials */
.case-stats li { display: grid; justify-items: center; gap: var(--space-3); align-content: start; padding-top: var(--space-8); border-top: 1px solid var(--color-border); text-align: center; }
.case-stat__num { font: var(--type-display-s); letter-spacing: var(--type-display-s-tracking); font-variant-numeric: tabular-nums; }
.case-stat__label { max-width: 280px; font: var(--type-body-m); color: var(--color-text-muted); text-wrap: balance; }

/* Image frames: the work tiles' corners on the page's grey, which is the grey the artwork
   is drawn on, so each picture sits in it seamlessly. Shown whole at every size; art with
   its own phone version swaps to it under 768px. No border: the grey (or the art's own
   colour) already stands apart from the page. */
.frame { position: relative; overflow: hidden; border-radius: var(--radius-l); background: var(--color-bg-subtle); }
.frame img { width: 100%; }
.frame .image-phone { display: none; }

/* Hero motion: each hero plays once as it comes into view (project.js adds .is-playing for one
   run), then rests on the picture underneath. The layer is the art's own shape, centred, so it
   lines up with the trimmed phone crop too. Positions are in the art's 1200 × 560 units. */
@property --split { syntax: '<percentage>'; inherits: true; initial-value: 41.667%; }
.hero-motion { position: absolute; top: 0; left: 50%; height: 100%; aspect-ratio: 1200 / 560; translate: -50% 0; visibility: hidden; pointer-events: none; }
.hero-motion.is-playing { visibility: visible; animation: hero-run var(--run) linear; }
.frame .hero-motion img { position: absolute; inset: 0; width: 100%; height: 100%; }
@keyframes hero-run { to { opacity: 1; } } /* only times the run; project.js waits for its end */

/* Debug: the divider slides left (all in debug mode), right (all normal), then home. Its layers
   have no tags, and it's held over the picture from the start (.is-held), so the Normal and
   Debug mode tags only fade in once it's done (.is-leaving) */
.hero-split { --run: 6s; }
.hero-split:is(.is-held, .is-playing, .is-leaving) { visibility: visible; }
.hero-split.is-held:not(.is-playing) { animation: hero-fade .4s var(--ease) both; } /* a replay fades the tags out first */
.hero-split.is-leaving { animation: hero-fade .9s var(--ease) reverse both; }
@keyframes hero-fade { from { opacity: 0; } to { opacity: 1; } }
.hero-split__debug { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--split)); }
.hero-split__line { position: absolute; inset-block: 0; left: var(--split); width: calc(100% / 600); translate: -50% 0; background: #0d97ec; }
.hero-split.is-playing { animation: hero-run var(--run) linear, hero-split var(--run) linear; }
@keyframes hero-split {
  0% { --split: 41.667%; animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  26%, 32% { --split: 8%; animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  64%, 70% { --split: 92%; animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  100% { --split: 41.667%; }
}

/* Plusnet: each phone's page scrolls and comes straight back, under its status bar, inside the
   screen's own rounded shape (Figma "Paste design here 1"): the middle one down to the latest
   update, the left one up to it, the right one down to the time and Continue, a beat apart */
.hero-scroll { --run: 6.4s; }
.hero-scroll__screen { position: absolute; left: calc(100% * var(--x) / 1200); top: calc(100% * 80 / 560); width: calc(100% * 271 / 1200); height: calc(100% * 480 / 560); overflow: visible; }
.hero-scroll__screen--middle { --to: -326px; }
.hero-scroll__screen--left { --to: 233px; }
.hero-scroll__screen--right { --to: -227px; }
.hero-scroll.is-playing .hero-scroll__page { animation: hero-scroll 6s both; }
.hero-scroll.is-playing .hero-scroll__screen--left .hero-scroll__page { animation-delay: .2s; }
.hero-scroll.is-playing .hero-scroll__screen--right .hero-scroll__page { animation-delay: .4s; }
@keyframes hero-scroll {
  0%, 8% { translate: 0 0; animation-timing-function: cubic-bezier(.45, 0, .25, 1); }
  42%, 52% { translate: 0 var(--to); animation-timing-function: cubic-bezier(.45, 0, .25, 1); }
  90%, 100% { translate: 0 0; }
}

/* Multi-brand: "Loop Design" fades as EE and Plusnet step out from behind BT, which stays
   just as it is in the lockup; then a dashed selection is dragged out from the top left round
   all three (Figma "Brands (BT · EE · Plusnet)", without its fill), each brand colouring in
   behind its edge as it passes; the box lets go, and it all folds back into the lockup.
   The box is in pieces that slide rather than stretch, so the dashes keep their size: its
   right side and corners move across (.mb-x), its bottom side and corners move down (.mb-y),
   and the top and left sides are uncovered as they go (the two clip paths) */
.hero-brands { --run: 5s; --mb-bg: var(--color-bg-subtle); --mb-ink: #3768c7; --mb-on: #fff; --mb-out: cubic-bezier(.3, 1.45, .6, 1); --mb-in: cubic-bezier(.55, 0, .45, 1); --mb-flick: cubic-bezier(.15, .7, .3, 1); --mb-settle: cubic-bezier(.4, 0, .4, 1); }
[data-theme="dark"] .hero-brands { --mb-ink: #fff; --mb-on: var(--color-bg-subtle); }
.hero-brands__art { position: absolute; left: calc(100% * 450 / 1200); top: calc(100% * 21 / 560); width: calc(100% * 300 / 1200); aspect-ratio: 300 / 124; overflow: visible; }
.hero-brands__cover { fill: var(--mb-bg); }
.hero-brands__cover--word { opacity: 0; }
.hero-brands__box, .hero-brands__tint { opacity: 0; } /* the tint: each brand in its colour, showing only inside the box, so the colour sweeps across behind it */
.hero-brands__tint use { fill: #fff; }
.hero-brands__tint .hero-brands__tint-bt { fill: #5514b4; } /* BT keeps its ring: only its colour changes. Inside the box the
   picture’s BT is covered first, and EE and Plusnet’s discs are a hair bigger (r 37, not 36), so no edge shows round them */
.hero-brands__pick-line { fill: none; stroke: #3768c7; stroke-width: 2.33; stroke-dasharray: 3.087 5.4171; }
.hero-brands .mb-fill { fill: var(--mb-ink); }
.hero-brands .mb-mark { fill: var(--mb-on); }
.hero-brands__logo--ee, .hero-brands__logo--plusnet { transform: translate(-76px, 0) scale(.6667); opacity: 0; }
.hero-brands.is-playing :is(.hero-brands__cover--word, .hero-brands__box, .hero-brands__tint, .mb-x, .mb-y, .hero-brands__logo) { animation-duration: var(--run); animation-fill-mode: both; }
.hero-brands.is-playing .hero-brands__cover--word { animation-name: mb-word; }
.hero-brands.is-playing :is(.hero-brands__box, .hero-brands__tint) { animation-name: mb-box; }
.hero-brands.is-playing .mb-x { animation-name: mb-x; }
.hero-brands.is-playing .mb-y { animation-name: mb-y; }
.hero-brands.is-playing .mb-x.mb-y { animation-name: mb-x, mb-y; } /* across on translate, down on transform, so they add up */
.hero-brands.is-playing .hero-brands__logo--ee { animation-name: mb-ee; }
.hero-brands.is-playing .hero-brands__logo--plusnet { animation-name: mb-plusnet; }
@keyframes mb-word { 0% { opacity: 0; } 8%, 86% { opacity: 1; } 96%, 100% { opacity: 0; } }
/* They spring out, a beat apart, and tuck back in */
@keyframes mb-ee {
  0%, 6% { transform: translate(-76px, 0) scale(.6667); opacity: 0; animation-timing-function: var(--mb-out); }
  10% { opacity: 1; animation-timing-function: var(--mb-out); }
  20%, 78% { transform: translate(-1.33px, 0) scale(.6667); opacity: 1; animation-timing-function: var(--mb-in); }
  88% { opacity: 1; }
  90%, 100% { transform: translate(-76px, 0) scale(.6667); opacity: 0; }
}
@keyframes mb-plusnet {
  0%, 9% { transform: translate(-76px, 0) scale(.6667); opacity: 0; animation-timing-function: var(--mb-out); }
  13% { opacity: 1; animation-timing-function: var(--mb-out); }
  25%, 76% { transform: translate(73.33px, 0) scale(.6667); opacity: 1; animation-timing-function: var(--mb-in); }
  87% { opacity: 1; }
  89%, 100% { transform: translate(-76px, 0) scale(.6667); opacity: 0; }
}
/* The drag, like a hand: a quick flick that runs a little past and settles back, the down
   movement a touch ahead of the across, so the corner travels on a slight curve */
@keyframes mb-box { 0%, 27% { opacity: 0; } 28%, 68% { opacity: 1; } 74%, 100% { opacity: 0; } }
@keyframes mb-x {
  0%, 28% { translate: 0 0; animation-timing-function: var(--mb-flick); }
  45% { translate: 248.12px 0; animation-timing-function: var(--mb-settle); }
  54%, 100% { translate: 240.89px 0; }
}
@keyframes mb-y {
  0%, 28% { transform: translate(0, 0); animation-timing-function: var(--mb-flick); }
  41% { transform: translate(0, 57.47px); animation-timing-function: var(--mb-settle); }
  51%, 100% { transform: translate(0, 54.22px); }
}

/* Chapters: a small label, a serif title and the story beside it, then the pictures */
.chapter { display: grid; gap: var(--space-24); padding: var(--space-44) var(--edge); border-top: 1px solid var(--color-border); }
.chapter-head {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: var(--space-20); row-gap: var(--space-6);
  align-items: start;
}
.chapter-head__title { display: grid; gap: var(--space-6); }
.chapter-title { max-width: 520px; font: var(--type-display-s); letter-spacing: var(--type-display-s-tracking); text-wrap: balance; }
.chapter-body { display: grid; gap: var(--space-5); max-width: 560px; padding-top: 44px; font: var(--type-body-m); color: var(--color-text-muted); text-wrap: pretty; }
.chapter-body a { color: var(--color-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
/* A link in the copy keeps its underline, and highlights like every other link: an ink fill
   sweeps across from the left and the words turn to the page colour, line by line */
.chapter-body a {
  background: linear-gradient(var(--color-text), var(--color-text)) left / 0 100% no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size var(--duration-m) var(--ease), color var(--duration-s) var(--ease);
}
.chapter-body a:focus-visible { background-size: 100% 100%; color: var(--color-bg); }
@media (hover: hover) { .chapter-body a:hover { background-size: 100% 100%; color: var(--color-bg); } }
@media (prefers-reduced-motion: reduce) { .chapter-body a { transition: none; } }
/* Context: the story on the left, the picture beside it */
.chapter-head--fig { align-items: center; }
.chapter-head--fig .chapter-body { padding-top: var(--space-2); }
/* The brief: the question, big and centred, like the homepage statement */
.chapter--brief .chapter-head { grid-template-columns: 1fr; justify-items: center; text-align: center; }
.chapter--brief .chapter-head__title { justify-items: center; }
.chapter--brief .chapter-title { max-width: 900px; font: var(--type-display-m); letter-spacing: var(--type-display-m-tracking); }
.chapter--brief .chapter-body { max-width: 480px; padding-top: var(--space-2); }

/* Columns, kept apart by space */
.cols { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: var(--space-16) var(--space-20); }
.cols--3 { --cols: 3; }
.col { display: grid; gap: var(--space-3); align-content: start; }
.col h3:not(.label) { font: var(--type-heading-pull); letter-spacing: var(--type-heading-pull-tracking); }
.col p { font: var(--type-body-m); color: var(--color-text-muted); }
.col > .label { margin-bottom: var(--space-2); }
/* Lists: each line led by a muted arrow */
.ticks { display: grid; gap: var(--space-3); }
.ticks li { display: flex; gap: var(--space-3); font: var(--type-body-m); }
.ticks li::before { content: "→"; color: var(--color-text-muted); }
/* svsd.school's numbers: a serif figure in an outlined oval */
.step-num {
  justify-self: start; display: inline-grid; place-items: center;
  min-width: 64px; height: 40px; padding: 0 18px; margin-bottom: var(--space-5);
  border: 1px solid var(--color-text); border-radius: var(--radius-full);
  font: var(--type-heading-pull); letter-spacing: var(--type-heading-pull-tracking);
}

/* Key decision as a diff, like the homepage hero's "- users + people": a mono "- Option A"
   or "+ Option B · chosen" line (Type/label/meta) over each title. The option left out is
   muted and struck through on a card in the page colour; the one picked is an ink card with
   inverse text, so both flip with the theme. */
.cols:has(> .option) { gap: var(--space-8); } /* the cards sit as close as the side-by-side pictures (.fig-row) */
.option { gap: var(--space-4); padding: var(--space-10); border-radius: var(--radius-l); }
.option--del { background: var(--color-bg); color: var(--color-text-muted); }
.option--del .diff__mark, .option--del .diff__text, .option--del p { color: var(--color-text-muted); } /* muted, not faded */
.option--add { background: var(--color-text); color: var(--color-bg); }
.option--add :is(p, .diff__text, .diff__mark) { color: var(--color-bg); }
.diff { display: block; }
.diff__mark { display: block; margin-bottom: var(--space-3); font: var(--type-label-meta); letter-spacing: var(--type-label-meta-tracking); color: var(--color-text-muted); }
.option--del .diff__text {
  /* The strike draws across once it's typed (project.js); simply struck without motion */
  background: linear-gradient(currentColor, currentColor) left 0 top 55% / var(--strike, 100%) 1px no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; /* struck line by line, only under the words */
  transition: background-size var(--duration-l) var(--ease);
}

/* Figures: a small muted caption under each picture (Type/body/xs); a label can
   sit above a group, like Before and After */
.fig { display: grid; gap: var(--space-4); align-content: start; }
.fig figcaption { max-width: 520px; font: var(--type-body-s); color: var(--color-text-muted); }
.figs { display: grid; gap: var(--space-20); }
.fig-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); }
.fig-group { display: grid; gap: var(--space-5); }

/* Testimonial: the quote big in the serif, centred, the name in the receipts' caption style */
.case-quote { display: grid; justify-items: center; gap: var(--space-10); padding: var(--space-44) var(--edge); text-align: center; }
.case-quote blockquote { max-width: 920px; font: var(--type-display-s); letter-spacing: var(--type-display-s-tracking); text-wrap: balance; }
.case-quote figure { display: grid; justify-items: center; gap: var(--space-10); }
.case-quote figcaption { font: var(--type-body-m); color: var(--color-text-muted); } /* the role, as on the homepage */
.case-quote .who { font-weight: 500; }

/* The page's drawing signs off the contact section, under the buttons */
.case-art { display: flex; justify-content: center; width: 100%; margin-top: var(--space-24); }
.case-art:has(.panic) { margin-top: var(--space-16); } /* Plusnet: his burst of lines already makes room above */

/* Key decision and the quote sit on the media grey (--color-bg-subtle), full width, with the
   page's own text colours */
.tinted { background: var(--color-bg-subtle); border-top: 0; }
.tinted + .chapter { border-top: 0; }
/* The receipts-style hairline over each column of a list */
.cols:not(.cols--3) > .col:not(.option) { padding-top: var(--space-6); border-top: 1px solid var(--color-border); }

.case-cta { display: flex; flex-direction: column; align-items: center; gap: var(--space-5); padding: var(--space-44) var(--edge) var(--space-30); text-align: center; }
.case-cta__title { max-width: 760px; font: var(--type-display-l); letter-spacing: var(--type-display-l-tracking); text-wrap: balance; } /* Type/display/l */
.case-cta__sub { color: var(--color-text-muted); }
.case-cta .contact-buttons { margin-top: var(--space-3); }

/* ---------- On scroll (project.js), in the 404's terminal voice ----------
   Section labels type in with a caret, the Key decision diff types its two lines and then
   strikes the option left out, the results count up, and the pictures fade up. Each holds
   its room from the start, so nothing moves. Reduce motion or paused: all simply there. */
.diff__mark.is-typing .key:not(.is-typed) { visibility: hidden; }
.diff__mark .caret::after { top: -11px; height: 13px; }
.js-reveal .chapter .frame { opacity: 0; translate: 0 24px; transition: opacity var(--duration-xl) var(--ease), translate var(--duration-xl) var(--ease); }
.js-reveal .chapter .frame.is-in { opacity: 1; translate: 0; }

/* ---------- Closing drawings (moved from the old project pages, in the muted grey) ---------- */
/* Plusnet: the headless man from the old testimonial card, half as tall again as the queue (238).
   He hops on the spot twice, arms flapping from the elbows, the "!" jolting with each hop (and
   once more in the breather) and the burst of lines flashing over his head. */
.panic { width: 106.2px; max-width: 100%; height: auto; aspect-ratio: 290.2 / 650.5; overflow: visible; }
.panic__line { fill: var(--color-text-muted); }
.panic__shade { fill: var(--color-illustration-shade); }
.panic g { transform-box: view-box; }
.panic__hop { transform-origin: 200px 659px; }
.panic__arm--1 { transform-origin: 100px 292px; } /* elbows */
.panic__arm--2 { transform-origin: 305px 272px; }
.panic__bang { transform-origin: 100px 228px; } /* under the dot */
.panic__burst { transform-origin: 200px 250px; } /* his head */
@media (prefers-reduced-motion: no-preference) {
  .panic__hop { animation: panic-hop 4s ease-in-out infinite; }
  .panic__arm--1 { animation: panic-flap 4s ease-in-out infinite; }
  .panic__arm--2 { animation: panic-flap 4s ease-in-out -.12s infinite reverse; }
  .panic__bang { animation: panic-bang 4s ease-out infinite; }
  .panic__burst { animation: panic-burst 4s ease-in-out infinite; }
  .panic__tick { animation: panic-tick 4s ease-in-out infinite; }
  .panic:not(.is-playing) * { animation-play-state: paused; }
}
:root[data-motion="paused"] .panic * { animation: none !important; }
/* Up, tap, up, tap, and down again */
@keyframes panic-hop { 0%, 50%, 100% { translate: 0 0; scale: 1 1; } 6% { translate: 0 0; scale: 1.02 .97; } 14% { translate: 0 -18px; scale: .99 1.02; } 24% { translate: 0 0; scale: 1.02 .97; } 34% { translate: 0 -14px; scale: .99 1.02; } 44% { translate: 0 0; scale: 1 1; } }
@keyframes panic-flap { 0%, 50%, 100% { rotate: 0deg; } 14% { rotate: -6deg; } 24% { rotate: 4deg; } 34% { rotate: -5deg; } 44% { rotate: 2deg; } }
/* A sharp kick up with each hop, a judder as it lands, and one more on its own */
@keyframes panic-bang {
  0%, 10%, 22%, 30%, 42%, 70%, 82%, 100% { translate: 0 0; scale: 1; rotate: 0deg; }
  13% { translate: 0 -14px; scale: 1.18; rotate: -12deg; }
  16% { translate: 0 0; scale: 1; rotate: 7deg; }
  19% { rotate: -4deg; }
  33% { translate: 0 -12px; scale: 1.14; rotate: -10deg; }
  36% { translate: 0 0; scale: 1; rotate: 6deg; }
  39% { rotate: -3deg; }
  73% { translate: 0 -8px; scale: 1.1; rotate: 9deg; }
  76% { translate: 0 0; scale: 1; rotate: -5deg; }
  79% { rotate: 2deg; }
}
@keyframes panic-burst { 0%, 50%, 100% { opacity: 1; scale: 1; } 8%, 28% { opacity: .3; scale: .94; } 16%, 36% { opacity: 1; scale: 1.05; } }
@keyframes panic-tick { 0%, 50%, 100% { translate: 0 0; } 14%, 34% { translate: -3px -4px; } 24%, 44% { translate: 0 0; } }

/* The closing drawings are kept small, about the 404 spectators' size (160 wide; the queue's row 500, and the crowd's row as tall as it) */
.queue-wrap { width: min(500px, 100%); }
.queue { display: block; width: 100%; height: auto; overflow: visible; }
.queue__line { fill: var(--color-text-muted); }
.queue__shade { fill: var(--color-illustration-shade); }
.queue :is(.queue__person, .queue__eyes, .queue__brows) { transform-box: view-box; }
@media (prefers-reduced-motion: no-preference) {
  .queue__person { --idle-loop: var(--idle) ease-in-out var(--delay, 0s) infinite; animation: var(--idle-loop); }
  .queue__eyes { animation: queue-blink var(--blink) ease-in-out var(--delay, 0s) infinite; }
  .queue__brows { animation: queue-brows var(--brows) ease-in-out var(--delay, 0s) infinite; }
  .queue__person:nth-of-type(1) { --idle: person-breathe 3.3s; --delay: -1.4s; --blink: 5.1s; --brows: 6.2s; }
  .queue__person:nth-of-type(2) { --idle: person-lean 6.4s; --delay: -2.6s; --blink: 3.9s; --brows: 8.3s; }
  .queue__person:nth-of-type(3) { --idle: person-sway 5.4s; --delay: -.8s; }
  .queue__person:nth-of-type(4) { --idle: person-bob 2.8s; --delay: -1.9s; --blink: 4.7s; --brows: 5.6s; }
  .queue__person:nth-of-type(5) { --idle: person-breathe 3.9s; --delay: -3.1s; --blink: 5.6s; --brows: 7.9s; }
  .queue__person:nth-of-type(6) { --idle: person-sway 6s; --delay: -2.2s; --blink: 4.4s; --brows: 6.8s; }
  @media (hover: hover) { .queue__person:hover { animation: var(--idle-loop), person-jump .6s ease-out; } }
}
:root[data-motion="paused"] .queue * { animation: none !important; }
@keyframes queue-blink { 0%, 92%, 100% { scale: 1 1; } 95% { scale: 1 .1; } }
@keyframes queue-brows { 0%, 50%, 78%, 100% { translate: 0 0; } 56%, 70% { translate: 0 -2.5px; } }

.crowd { width: 509px; max-width: 100%; height: auto; aspect-ratio: 1225 / 382; overflow: visible; }
.crowd__line { fill: var(--color-text-muted); }
.crowd__shade { fill: var(--color-illustration-shade); }
.crowd__lids { opacity: 0; }
.crowd__lids ellipse { fill: var(--color-bg); }
.crowd__lids path { fill: none; stroke: var(--color-text-muted); stroke-width: 4; stroke-linecap: round; }
.crowd__person { transform-box: view-box; transform-origin: var(--feet); --blink: 4.4s; --blink-lag: 0s; }
.crowd__brows { transform-box: view-box; }
/* Moves like the queue: each its own idle, blink and brows (only torch and yoyo have brows),
   and a jump on hover. The rocket is a prop, so it has no idle and stays put. */
.crowd__person--torch { --idle: person-sway 4.6s; --delay: -.6s; --blink: 4.1s; --blink-lag: -1.2s; --brows: 7.4s; }
.crowd__person--yoyo { --idle: person-breathe 3.3s; --delay: -1.4s; --blink: 4.6s; --blink-lag: -4s; --brows: 6.2s; }
.crowd__person--box { --idle: person-lean 6.4s; --delay: -2.6s; --blink: 5.3s; --blink-lag: -3.4s; }
.crowd__person--argyle { --idle: person-sway 5.4s; --delay: -.8s; --blink: 5s; --blink-lag: -.9s; }
.crowd__person--handstand { --idle: person-breathe 3.9s; --delay: -3.1s; --blink: 4.9s; --blink-lag: -2.6s; }
.crowd__person--flute { --idle: person-bob 2.8s; --delay: -1.9s; --blink: 6.1s; --blink-lag: -4.7s; }
.crowd__person--sweep { --idle: person-sway 6s; --delay: -2.2s; --blink: 4.3s; --blink-lag: -3s; }
@media (prefers-reduced-motion: no-preference) {
  .crowd__person:not(.crowd__person--rocket) { --idle-loop: var(--idle) ease-in-out var(--delay, 0s) infinite; animation: var(--idle-loop); }
  .crowd__brows { animation: crowd-brows var(--brows) ease-in-out var(--delay, 0s) infinite; }
  .crowd__lids { animation: crowd-blink var(--blink) step-end var(--blink-lag) infinite; }
  @media (hover: hover) { .crowd__person:not(.crowd__person--rocket):hover { animation: var(--idle-loop), person-jump .6s ease-out; } }
  .crowd:not(.is-playing) * { animation-play-state: paused; }
}
:root[data-motion="paused"] .crowd * { animation: none !important; }
/* The queue's lift, in the crowd's units (it's drawn at a smaller scale) */
@keyframes crowd-brows { 0%, 50%, 78%, 100% { translate: 0 0; } 56%, 70% { translate: 0 -3.5px; } }
@keyframes crowd-blink { 0% { opacity: 0; } 94% { opacity: 1; } 97% { opacity: 0; } }

/* M: two facts columns fewer, the head stacks */
@media (max-width: 1023px) {
  .case-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chapter-head { grid-template-columns: 1fr; }
  .cols--3 { --cols: 1; }
  .cols--3 { gap: var(--space-14); }
  .chapter-body { padding-top: 0; }
}

/* Mobile (XS + S, under 768px) */
@media (max-width: 767px) {
  main { overflow-x: clip; } /* the queue runs off both edges */
  /* Text runs the full width (home.css turns off the even-line wrapping) */
  .case-title, .case-intro, .case-stat__label, .chapter-title, .chapter-body,
  .chapter--brief .chapter-title, .chapter--brief .chapter-body,
  .fig figcaption, .case-quote blockquote, .case-cta__title { max-width: none; }
  .case-hero { padding-block: var(--space-30); }
  .case-hero .frame { margin-top: var(--space-12); }
  .frame { border-radius: var(--radius-m); }
  .frame .image-wide { display: none; }
  .frame .image-phone { display: block; }
  [data-theme="dark"] .frame .image-phone.on-light, :root:not([data-theme="dark"]) .frame .image-phone.on-dark { display: none; }
  /* Wide art with no phone version (Plusnet's hero): the middle of it, trimmed at the sides */
  .frame--crop { aspect-ratio: 680 / 560; }
  .frame--crop img { height: 100%; object-fit: cover; }
  /* Multi-brand's phone art is 680 × 560, with the lockup larger and lower */
  .hero-brands { aspect-ratio: 680 / 560; }
  .hero-brands__art { left: calc(100% * 152.5 / 680); top: calc(100% * 54 / 560); width: calc(100% * 375 / 680); }
  .case-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-stats { grid-template-columns: 1fr; gap: var(--space-10); margin-top: var(--space-14); }
  .chapter { gap: var(--space-16); padding: var(--space-30) var(--gutter); }
  .cols, .fig-row { grid-template-columns: 1fr; }
  .cols { gap: var(--space-12); }
  .option { padding: var(--space-8) var(--space-6); }
  .figs { gap: var(--space-14); }
  .case-quote { padding: var(--space-30) var(--gutter); }
  .case-cta { padding: var(--space-30) var(--gutter) var(--space-24); }
}

@media (prefers-reduced-motion: reduce) {
  .case-hero__text, .case-hero .case-stats, .case-hero .frame, .js-reveal .chapter .frame { opacity: 1; translate: 0; }
}
:root[data-motion="paused"] .js-reveal .chapter .frame { opacity: 1; translate: 0; transition: none; }
