/* The home page's shared parts (docs/review/new-plan.md): the pin, the story line, the caption swap, and the way the
   page quotes an outlet. No section frame (brief rule 4): no numbers, names, leads or bridges. Each section's own file
   (public/sections/<id>/section.css) styles its scene, and every selector there starts with #<id>.

   The running order is src/home/sections.json: hero (purple), scene (lavender, with the catch-up as its last act on
   ice), mission (deep), join (purple), then the shell's purple footer. Each <section> names its field with a .surface-* class (base.css). */

/* ─── The pin (brief rule 5: the globe, the scene with its catch-up, and the mission) ─────────────────────────
   The hero's pattern: a sticky stage inside a taller track. The stage fills the screen under the top bar and holds
   still while the track scrolls past it for --pin (set it on the track: the scene and its catch-up 300svh, the
   mission 85svh). The track never moves on the page, so its place is read once; progress comes from pin() in site.js (scroll.js
   track() underneath): p 0 as the stage sticks, 1 as it lets go.

     <section class="surface-lavender" id="scene" aria-labelledby="…">
       <div class="pin" style="--pin: 230svh">
         <div class="pin-stage"> …the scene… </div>
       </div>
     </section>

   On phones the join bar covers the stage's last --stage-safe; keep words above it (pad the stage, or place them
   with it). Ancestors of a stage may clip with overflow: clip, never overflow: hidden, which stops sticky.
   Reduced motion: no pin. The track is as tall as its content and the stage is static: draw one finished still per
   beat, stacked (pin() hands onUpdate its `still` value once). */
:root {
  --stage-h: calc(100svh - var(--bar-top));                       /* svh, never dvh: the toolbar never resizes a stage */
  --stage-safe: calc(var(--joinbar-h) + env(safe-area-inset-bottom));
}
@media (min-width: 56.25rem) { :root { --stage-safe: 0px; } }

/* ─── The ring: the opening opens onto the scene's first frame (Victor: "continuity like GLAD and IDE").
   The scene's track starts under the opening's last screen, one stage plus --ring-open early (scene/section.css), and
   paints above it. So its stage sticks, on its first frame, exactly as the lime ring starts to grow, and stays clipped
   to the inside of the ring (hero/section.js writes the circle on the scene's stage) until the ring has passed every
   corner and the opening lets go. Only then does the scene's p start (pin()'s lead), so there is no blank screen and no
   second copy of the frame. --ring-open is that stretch of scroll: the last 28% of the globe's --pin (75svh on phones,
   90svh from 900 px). Both ends read it back from layout. Under reduced motion and on a phone on its side the scene is
   unpinned stills, there is no overlap, and the opening cuts straight to them. */
:root { --ring-open: 21svh; }
@media (min-width: 56.25rem) { :root { --ring-open: 25.2svh; } }
@media (prefers-reduced-motion: no-preference) {
  .pin { position: relative; height: calc(var(--stage-h) + var(--pin, 100svh)); }
  .pin-stage { position: sticky; top: var(--bar-top); height: var(--stage-h); overflow: clip; }
}

/* ─── The story line: one purple line through the scene and its catch-up at one x (--line-x, --line-w in tokens.css).
   On a full-bleed section (position: relative on the section, so it is the containing block) a .story-line runs its
   full height at the shared x. The scene draws its line in SVG (scene/section.js) with lineX() from site.js, so any
   later section that picks the line up meets it at the same px. */
/* Its x is a translate, not a left: Chrome snaps a box's left edge to whole device pixels but draws a translated box
   where it falls, as it draws an SVG line, so an HTML line and an SVG line at the same --line-x meet without a jog. */
.story-line {
  position: absolute; top: 0; bottom: 0; left: 0; translate: calc(var(--line-x) - var(--line-w) / 2) 0; width: var(--line-w);
  background: var(--line); pointer-events: none;
}

/* ─── The caption swap (A1): one caption per beat, stacked in one box sized by the longest, so nothing around it
   moves; the beat's caption is the one with data-on, and the swap is a 0.4 s fade (an exception in brief rule 5).
   The swap is out, then in: the old caption fades over the first half and the new one only starts once it has gone,
   so two captions never print over each other (review, 16 Nov).
     <div class="cap-stack"><p class="cap" data-on>News everywhere. Understanding takes work.</p><p class="cap">…</p></div> */
.cap-stack { display: grid; }
.cap-stack > * { grid-area: 1 / 1; align-self: start; opacity: 0; transition: opacity calc(var(--swap) / 2) ease-in; }
.cap-stack > [data-on] { opacity: 1; transition: opacity calc(var(--swap) / 2) ease-out calc(var(--swap) / 2); }

/* ─── How the page names an outlet's own words: the outlet in bold, its date muted, the headline in the headline face.
   On paper (clippings) or on any surface; the colours follow the surface. */
.byline { font-size: var(--t-tiny); line-height: 1.35; color: var(--muted); }
.byline b { font-weight: 700; color: var(--text); }
.take-hl { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.01em; line-height: 1.18; color: var(--text); }
.paper .byline { color: rgb(20 6 31 / 0.66); }
.paper .byline b, .paper .take-hl { color: var(--ink); }

/* A claim's state, as the pipeline marks it ("Confirmed", 2.2): small text first, a ring before it in the surface's
   accent. No check marks. */
.state { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--t-tiny); font-weight: 700; color: var(--accent); }
.state::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; box-shadow: inset 0 0 0 2px currentColor; }
.state[data-state="confirmed"]::before { background: currentColor; }
