/* The scene: noise to understanding, then the catch-up, as one story on one pinned stage (docs/review/new-plan.md 2.2,
   2.3, A1; Victor: "one continuous scene that evolves as you scroll … then hand the story into the catch-up").
   Victor's captions swap in one box (.cap-stack). Three layers, back to front:
     .sc-ice    the ice that washes in behind the catch-up (one flat layer's opacity: lavender to ice)
     .sc-fixed  the line's end (the confirmed fact, then the catch-up's end), its dashed run and "Confirmed"; it never moves
     .sc-world  everything else: the art (one SVG) and its words, moved only by the camera (one transform)
   section.js places every word once per resize, then changes only opacity, transforms and stroke offsets with scroll.
   Under reduced motion there is no pin: section.js stacks five stills: three beats, the hand-over and the catch-up.

   Phones: the caption across the top, the scene under it, words starting right of the story line (--line-x). From
   900 px: the caption in the left column, the scene right of the line (40% across the content).

   Selectors start with #scene, or with #scene-ff: the copy of the first frame that firstFrame() paints elsewhere (the
   opening's ring, NOTES.md). */

:is(#scene, #scene-ff) {
  position: relative; overflow: clip;
  --sc-date: clamp(0.9375rem, 0.85rem + 0.35vw, 1.125rem);   /* 15 on phones, 18 at 1440 */
  --sc-frag: clamp(1.1875rem, 0.95rem + 1.1vw, 2rem);        /* 19 → 31: a mark's words, and the developments */
  --sc-cu: 1;                                                /* section.js shrinks the developments to fit a short phone */
  --sc-x: calc(var(--line-x) + var(--line-w) / 2 + 1.125rem);   /* where words start, right of the line */
}
@media (min-width: 56.25rem) { :is(#scene, #scene-ff) { --sc-x: calc(var(--line-x) + var(--line-w) / 2 + 2.25rem); } }

/* Each stage (and each reduced-motion still) is one screen under the bar. The pin (page.css) makes it sticky, which
   also positions it; only the reduced-motion stills need position: relative. */
#scene .sc-stage { height: var(--stage-h); overflow: clip; }
/* Under reduced motion base.css gives every property a 1 ms transition, so a style change reads back its old value in
   the same task: the stills' layout, which sets --sc-cu and measures at once, would measure the old size and stack the
   developments over each other. Nothing in the stills transitions, so nothing here does. */
@media (prefers-reduced-motion: reduce) {
  #scene .sc-stage { position: relative; }
  #scene .sc-stage * { transition-property: none; }
}
/* The first frame painted elsewhere (firstFrame()): it fills its host. */
#scene-ff { position: absolute; inset: 0; }
#scene-ff .sc-stage { position: absolute; inset: 0; height: 100%; overflow: clip; }

/* The ring (page.css): pinned, the scene starts one stage plus --ring-open up, under the opening's last screen, and
   paints above it (below the bars). Its head is transparent (the field starts where the opening ends) and click-
   through, so the opening's words and button stay usable under it. Its stage is hidden until the opening's lime ring
   opens it (hero/section.js sets the circle; the script clears it from the moment the opening lets go). The track is
   --ring-open longer: the stage holds its first frame through the ring (pin()'s lead, section.js). The field is on the
   stage too, so the clipped circle is lavender. The stills (reduced motion, a phone on its side) keep none of this. */
@media (prefers-reduced-motion: no-preference) and (min-height: 31.2501rem), (prefers-reduced-motion: no-preference) and (orientation: portrait) {
  #scene {
    --ring-in: calc(var(--stage-h) + var(--ring-open));
    margin-top: calc(-1 * var(--ring-in)); z-index: 3; pointer-events: none;
    background: linear-gradient(var(--bg), var(--bg)) 0 var(--ring-in) / 100% 100% no-repeat;
  }
  #scene .sc-track { height: calc(var(--stage-h) + var(--ring-open) + var(--pin)); }
  #scene .sc-stage { background-color: var(--bg); clip-path: circle(0 at 50% 0); }
  #scene .sc-anchor { top: calc(var(--ring-open) + var(--pin) * 0.62); }
}

/* #catchup: the catch-up's stretch of the track, so /#catchup lands on "Your news, since you last looked" (section.js
   sets the exact top and height; this is the no-script place). */
#scene .sc-anchor {
  position: absolute; left: 0; width: 1px; pointer-events: none; visibility: hidden;
  top: calc(var(--pin) * 0.62); height: calc(var(--pin) * 0.38 + var(--stage-h));
}

/* A phone on its side: no pin (beat 2's column needs more height than the stage has there), but five stills, as under
   reduced motion (section.js), each a 36rem frame: the layout a 568 px tall phone gets, which holds every word. */
@media (max-height: 31.25rem) and (orientation: landscape) {
  #scene .pin { height: auto; }
  #scene .pin-stage { position: relative; top: auto; }
  #scene .sc-stage { height: max(var(--stage-h), 36rem); }
}
/* Reduced motion: the opening's still cuts straight to the first still, with no lavender lead-in (an empty band).
   The opening keeps its globe's headline off the scene's screen instead (hero/section.css). */
/* The stills: the catch-up's still is on ice, after the soft band where ice takes over from lavender (brief rule 1's
   exception), so the scene's last lavender still and the catch-up's words sit a band apart. */
#scene .sc-band { display: block; height: 7.5rem; background: linear-gradient(var(--lavender), var(--ice)); }

/* ─── The ice wash ─────────────────────────────────────────────────────────────────────────────────────────── */
:is(#scene, #scene-ff) .sc-ice { position: absolute; inset: 0; z-index: 0; background: var(--ice); opacity: 0; pointer-events: none; }

/* ─── Captions ─────────────────────────────────────────────────────────────────────────────────────────────── */
:is(#scene, #scene-ff) .sc-caps {
  position: absolute; z-index: 4; top: clamp(0.75rem, 2.2svh, 1.25rem);
  left: var(--sc-x); right: max(var(--gutter), env(safe-area-inset-right));
}
/* The catch-up: Victor's heading stays through the whole act, and its two lines ("While you were away", then "You're
   caught up") swap under it in a stack of their own. On ice: navy, the ice's text colour (11:1). */
:is(#scene, #scene-ff) .sc-caps .sc-cu { color: var(--navy); }
:is(#scene, #scene-ff) .sc-sub { margin-top: 0.4rem; }
:is(#scene, #scene-ff) .sc-subcap {
  font-family: var(--font-caption); font-weight: 600; font-size: clamp(1.0625rem, 0.9rem + 0.75vw, 1.625rem);
  line-height: 1.2; letter-spacing: -0.005em; color: var(--navy);
}
@media (min-width: 56.25rem) {
  :is(#scene, #scene-ff) .sc-caps {
    top: 50%; left: var(--wrap-x); right: auto; transform: translateY(-50%);
    width: calc(var(--line-x) - var(--line-w) / 2 - var(--wrap-x) - 4rem);
  }
  :is(#scene, #scene-ff) .sc-caps .cap { max-width: 11em; }
  /* Each caption centred in the box, which is as tall as the catch-up's heading and its line. */
  :is(#scene, #scene-ff) .sc-caps > * { align-self: center; }
  :is(#scene, #scene-ff) .sc-sub { margin-top: 0.75rem; }
}

/* ─── The layers ───────────────────────────────────────────────────────────────────────────────────────────── */
/* Only the world is its own compositor layer (the camera moves it). Giving the ice and the fixed layer layers of
   their own measured slower (more full-screen layers to composite at 3x on a phone), so they paint with the stage. */
:is(#scene, #scene-ff) .sc-fixed { position: absolute; inset: 0; z-index: 1; }
:is(#scene, #scene-ff) .sc-world { position: absolute; inset: 0; z-index: 2; will-change: transform; }
:is(#scene, #scene-ff) .sc-art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
:is(#scene, #scene-ff) .sc-words { position: absolute; inset: 0; }
:is(#scene, #scene-ff) .sc-w { position: absolute; left: 0; top: 0; opacity: 0; visibility: hidden; color: var(--text); }
:is(#scene, #scene-ff) .sc-probe {
  position: absolute; top: 0; left: var(--wrap-x); width: var(--wrap-w); height: var(--stage-safe);
  visibility: hidden; pointer-events: none;
}

/* The art's inks (SVG). News paper: off-white with a flat cut-paper shadow, Ink type and rules. Posts are blush notes
   (a torn edge, a folded corner, a deep pin); AI slips are ice strips with a sparkle cut clean through them (even-odd,
   so the field and the slip's own shadow show in the hole). Both have a deep edge (A5: these pale colours are too
   close to lavender to stand alone) and no ruled lines. The line is the story line's purple; the branches and the new
   developments are lime with a deep edge (lime on lavender is 1.28:1). */
:is(#scene, #scene-ff) .sc-art .pc { stroke: var(--deep); stroke-width: var(--edge); stroke-linejoin: round; }
:is(#scene, #scene-ff) .sc-art .news .pc { fill: var(--paper); stroke: none; }
:is(#scene, #scene-ff) .sc-art .post .pc { fill: var(--blush); }
:is(#scene, #scene-ff) .sc-art .slip .pc { fill: var(--ice); }
:is(#scene, #scene-ff) .sc-art .sh { fill: rgb(50 9 101 / 0.22); }
:is(#scene, #scene-ff) .sc-art .rule { fill: rgb(20 6 31 / 0.16); }
:is(#scene, #scene-ff) .sc-art .news .rule-k { fill: rgb(20 6 31 / 0.72); }
:is(#scene, #scene-ff) .sc-art .slip .pc, :is(#scene, #scene-ff) .sc-art .slip .sh { fill-rule: evenodd; }
/* A post's folded corner: the flap, blush with a deep edge, over a faint crease shadow. */
:is(#scene, #scene-ff) .sc-art .post .rule { fill: var(--blush); stroke: var(--deep); stroke-width: var(--edge); stroke-linejoin: round; }
:is(#scene, #scene-ff) .sc-art .disc { fill: var(--deep); }
:is(#scene, #scene-ff) .sc-art .mast { font-family: var(--font-body); font-weight: 700; font-size: 13px; fill: var(--ink); }
:is(#scene, #scene-ff) .sc-art .cord { fill: none; stroke: var(--line); stroke-linecap: round; stroke-linejoin: round; }
:is(#scene, #scene-ff) .sc-art .ln { fill: none; stroke: var(--line); }
:is(#scene, #scene-ff) .sc-art .pt { fill: var(--line); }
:is(#scene, #scene-ff) .sc-art .end { fill: none; stroke: var(--line); }
:is(#scene, #scene-ff) .sc-art .str { fill: none; stroke: var(--deep); stroke-width: 1.5px; stroke-linecap: round; }
:is(#scene, #scene-ff) .sc-art .br-edge { fill: none; stroke: var(--lime-edge); stroke-linecap: round; }
:is(#scene, #scene-ff) .sc-art .br { fill: none; stroke: var(--lime); stroke-linecap: round; }
:is(#scene, #scene-ff) .sc-art .node { fill: var(--lime); stroke: var(--lime-edge); stroke-width: var(--edge); }
:is(#scene, #scene-ff) .sc-art .mk-fill { fill: var(--lime); }
:is(#scene, #scene-ff) .sc-art .mk-edge { fill: none; stroke: var(--lime-edge); stroke-width: 2.25px; }
:is(#scene, #scene-ff) .sc-art .rib { fill: var(--deep); }
:is(#scene, #scene-ff) .sc-art .rib-sh { fill: rgb(50 9 101 / 0.22); }

/* ─── Beat 1: the labels on the three piles, and the three readable clippings ───────────────────────────────── */
:is(#scene, #scene-ff) .sc-l { display: flex; flex-direction: column; gap: 0.125rem; white-space: nowrap; }
:is(#scene, #scene-ff) .sc-l .small { font-size: var(--t-small); line-height: 1.3; color: var(--text); }
/* "Illustrative example", once, where the story first appears. */
:is(#scene, #scene-ff) .sc-l .illustrative { line-height: 1.3; }
/* A clipping: plain paper and one outlet's words. The words go before the clipping ever moves (brief rule 8), and the
   next clipping is laid over it only once they have gone, so no card is ever drawn over words and no clipping turns
   into ruled lines. section.js sets its size and its transform (origin top left). */
:is(#scene, #scene-ff) .sc-card {
  display: grid; padding: 0.75rem 0.875rem 0.875rem; border-radius: 3px; transform-origin: 0 0;
  box-shadow: 2px 3px 0 rgb(50 9 101 / 0.22);
}
:is(#scene, #scene-ff) .sc-face { display: flex; flex-direction: column; gap: 0.3rem; }
:is(#scene, #scene-ff) .sc-face .take-hl { font-size: 1.0625rem; }
:is(#scene, #scene-ff) .sc-face .byline { font-size: var(--t-tiny); }

/* ─── Beat 2: the story line's words ─────────────────────────────────────────────────────────────────────────── */
:is(#scene, #scene-ff) .sc-title {
  font-family: var(--font-head); font-weight: 700; font-size: clamp(1.1875rem, 1rem + 1.1vw, 2.125rem); line-height: 1.18;
  letter-spacing: -0.012em; color: var(--head); text-wrap: balance;
}
:is(#scene, #scene-ff) .sc-bars { display: flex; flex-direction: column; gap: 0.375rem; }
/* A fact: its label over its bar, the value at the bar's end (labels such as "Average fare now" are too long to sit
   beside a bar on a phone). */
:is(#scene, #scene-ff) .sc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l l" "b v"; align-items: center; column-gap: 0.625rem; row-gap: 0.125rem; }
:is(#scene, #scene-ff) .sc-bl { grid-area: l; font-size: var(--t-label); font-weight: 600; line-height: 1.3; color: var(--label); white-space: nowrap; }
:is(#scene, #scene-ff) .sc-bar { grid-area: b; }
:is(#scene, #scene-ff) .sc-bv { grid-area: v; }
:is(#scene, #scene-ff) .sc-bv { font-family: var(--font-head); font-weight: 700; font-size: 1.0625rem; line-height: 1.2; color: var(--head); font-variant-numeric: tabular-nums lining-nums; }
:is(#scene, #scene-ff) .sc-bar { display: block; height: 0.875rem; }
:is(#scene, #scene-ff) .sc-bar i { display: block; height: 100%; width: calc(var(--w) * 100%); background: var(--deep); transform-origin: 0 50%; transform: scaleX(0); }
:is(#scene, #scene-ff) .sc-row[data-now] .sc-bar i { background: var(--flick); }
:is(#scene, #scene-ff) .sc-bfoot { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.625rem; margin-top: 0.125rem; }
:is(#scene, #scene-ff) .sc-bfoot b { font-family: var(--font-head); font-weight: 700; font-size: 1.0625rem; color: var(--accent); }
/* A mark on the line: its date, then its words (Fliq's fragment, or a development). */
:is(#scene, #scene-ff) .sc-md { width: fit-content; font-family: var(--font-body); font-weight: 600; font-size: var(--sc-date); line-height: 1.3; color: var(--muted); white-space: nowrap; }
:is(#scene, #scene-ff) .sc-mt { margin-top: 0.2rem; font-family: var(--font-head); font-weight: 700; font-size: var(--sc-frag); line-height: 1.18; letter-spacing: -0.012em; color: var(--head); text-wrap: pretty; }
/* "Confirmed": a small deep tag tied to the end's ring by a string (section.js draws the string). The hole is the
   field's own lavender, which is what lies behind it whenever the tag shows. */
:is(#scene, #scene-ff) .sc-conf {
  padding: 0.125rem 0.5rem 0.125rem 1.125rem; border-radius: 2px 4px 4px 2px; background: var(--deep); color: var(--white);
  font-family: var(--font-body); font-weight: 700; font-size: var(--t-tiny); line-height: 1.35; white-space: nowrap;
  clip-path: polygon(0.4rem 0, 100% 0, 100% 100%, 0.4rem 100%, 0 50%);
}
:is(#scene, #scene-ff) .sc-conf::before {
  content: ""; position: absolute; left: 0.45rem; top: 50%; width: 0.3125rem; height: 0.3125rem; margin-top: -0.15625rem;
  border-radius: 50%; background: var(--lavender);
}

/* ─── Beat 3: the three places, each with its tag; Belén's spots behind the draft flag ─────────────────────────── */
:is(#scene, #scene-ff) .sc-branch {
  font-family: var(--font-head); font-weight: 700; font-size: clamp(1.125rem, 1rem + 1.2vw, 2rem); line-height: 1.15;
  letter-spacing: -0.012em; color: var(--head); white-space: nowrap;
}
:is(#scene, #scene-ff) .sc-tag { font-size: var(--t-small); font-weight: 500; line-height: 1.3; color: var(--text); max-width: 16em; }
:is(#scene, #scene-ff) .sc-spot {
  display: grid; place-items: center; padding: 0.5rem; text-align: center; border-radius: 14px;
  border: 1.5px dashed var(--deep); font-size: var(--t-tiny); line-height: 1.3; font-weight: 500; color: var(--muted);
}

/* ─── The catch-up: "You left here" at 6 Nov, and the three developments (navy on ice) ──────────────────────── */
:is(#scene, #scene-ff) .sc-left { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.6rem; }
:is(#scene, #scene-ff) .sc-left-l {
  font-family: var(--font-caption); font-weight: 600; font-size: var(--sc-frag); line-height: 1.18;
  letter-spacing: -0.01em; color: var(--navy);
}
:is(#scene, #scene-ff) .sc-left .illustrative { color: rgb(17 37 106 / 0.78); }
:is(#scene, #scene-ff) .sc-dev .sc-md { color: rgb(17 37 106 / 0.78); }
:is(#scene, #scene-ff) .sc-dev .sc-mt { color: var(--navy); font-size: calc(var(--sc-frag) * var(--sc-cu)); }

@media (min-width: 56.25rem) {
  :is(#scene, #scene-ff) .sc-l .label { font-size: 1.0625rem; }
  :is(#scene, #scene-ff) .sc-card { padding: 1.125rem 1.375rem 1.375rem; }
  :is(#scene, #scene-ff) .sc-face { gap: 0.5rem; }
  :is(#scene, #scene-ff) .sc-face .take-hl { font-size: 1.625rem; }
  :is(#scene, #scene-ff) .sc-face .byline { font-size: var(--t-small); }
  :is(#scene, #scene-ff) .sc-bars { gap: 0.5rem; }
  :is(#scene, #scene-ff) .sc-row { column-gap: 0.875rem; }
  :is(#scene, #scene-ff) .sc-bl { font-size: 1.0625rem; }
  :is(#scene, #scene-ff) .sc-bv, :is(#scene, #scene-ff) .sc-bfoot b { font-size: 1.375rem; }
  :is(#scene, #scene-ff) .sc-bar { height: 1.125rem; }
  :is(#scene, #scene-ff) .sc-tag { font-size: 1.0625rem; }
}

/* Paper grain over the pinned stage (18 Nov): the stage paints its own lavender and the ice wash on top of the
   section, so the grain sits above them as a light overlay, under nothing that moves, and is ignored by the pointer. */
:is(#scene, #scene-ff) .sc-stage::after {
  content: ""; position: absolute; inset: 0; z-index: 40; pointer-events: none;
  background-image: var(--grain); background-size: var(--grain-size) var(--grain-size); opacity: 0.4;
}
