/* 3. And it keeps you coming back: four stations on a sideways track (collections, the weekly
   streak, the league, the daily drop). A port of the film's scene 4.

   Copy is fluid CSS. Each graphic is drawn in the film's pixels inside a zero-size anchor
   (.gfx) and scaled as a whole by --k; loop.js sets --k, --gx, --gy from the stage size, and
   per station --d (its distance from the centre of the screen, in screens) for the parallax, on
   the headline, the paragraph and the graphic themselves (--d is not inherited, see base.css).
   Those three only ever slide, so each has its own compositor layer: sliding them moves the
   layer instead of repainting the 4-screen-wide track around them every frame. */
.s-loop .stage { background: var(--navy); color: #fff; }
.s-loop {
  /* the copy column, and a headline size at which its longest line ("your streak.") fits it */
  --cw: 42vw;
  --hl: min(calc(var(--cw) / 5.45), 14.5vh);
}

/* ---------- the deep layer: big faint hexagons, drifting far slower than the track ---------- */
.loop-deep { position: absolute; left: 0; top: -12%; width: 150%; height: 124%; pointer-events: none; will-change: transform; }
.loop-deep svg { position: absolute; height: auto; aspect-ratio: 1; }
.loop-deep polygon { fill: none; stroke: rgba(255, 255, 255, 0.055); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

/* ---------- eyebrow, with the four station hexagons ---------- */
.loop-eb { position: absolute; z-index: 3; left: var(--gut); top: calc(var(--nav-h) + clamp(18px, 5vh, 70px)); display: flex; align-items: center; gap: 0.9em; font-size: clamp(12px, 1.15vw, 22px); color: rgba(255, 255, 255, 0.85); white-space: nowrap; }
.loop-steps { display: flex; gap: 0.42em; }
.loop-steps .st { position: relative; width: 1.5em; height: 1.5em; }
.loop-steps .st svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform 0.6s var(--glide); }
.loop-steps .st .w, .loop-steps .st .y { transform: scale(0); }
.loop-steps .st.done .w { transform: scale(1); }
.loop-steps .st.on .y { transform: scale(1); transition-timing-function: cubic-bezier(0.34, 1.8, 0.64, 1); }

/* ---------- the track ---------- */
.track { position: absolute; left: 0; top: 0; width: 400%; height: 100%; display: flex; transform: translate3d(calc(var(--p, 0) * -25%), 0, 0); will-change: transform; }
.stn { position: relative; flex: 0 0 25%; height: 100%; }
.stn-copy { position: absolute; z-index: 2; left: var(--gut); top: calc(50% + var(--nav-h) * 0.35); width: var(--cw); transform: translateY(-50%); }
.stn .hl { font-size: var(--hl); translate: calc(var(--d, 0) * -3vw) 0; will-change: transform; }
.stn .sub { margin-top: clamp(14px, 0.22em + 2.2vh, 40px); max-width: 19em; font-size: clamp(17px, 1.9vw, 36px); color: rgba(255, 255, 255, 0.84); translate: calc(var(--d, 0) * 7vw) 0; will-change: transform; }

/* the graphic: anchor → parallax → scale; everything inside is in film pixels */
.gfx { position: absolute; left: var(--gx, 70%); top: var(--gy, 52%); width: 0; height: 0; translate: calc(var(--d, 0) * 15vw + var(--mx, 0px)) calc(var(--my, 0px) + var(--in, 0) * 16vh); will-change: transform; }
.gfx-k { position: absolute; left: 0; top: 0; width: 0; height: 0; transform: scale(var(--k, 0.6)); }
.gfx-k > * { position: absolute; }
.gfx .glow { left: -520px; top: -520px; width: 1040px; height: 1040px; border-radius: 50%; background: radial-gradient(closest-side, rgba(45, 156, 235, 0.16), rgba(45, 156, 235, 0.05) 55%, rgba(45, 156, 235, 0)); pointer-events: none; }
.gfx .pill { left: 0; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28); }

/* collections */
.gfx .seg-at { left: -210px; top: -250px; width: 420px; height: 420px; }
.gfx .seg-at > div { width: 420px; height: 420px; }
/* will-change: the shadow is drawn by the compositor, so filling a slice re-rasters the hexagon
   but not its 50 px blur */
.gfx .seghex { filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.3)); will-change: filter; }

/* streak */
.bigno { display: flex; align-items: center; gap: 22px; white-space: nowrap; }
.bigno b { display: inline-block; font-weight: 900; font-size: 230px; letter-spacing: -0.05em; line-height: 1; color: var(--sun); }
.bigno span { font-weight: 800; font-size: 44px; line-height: 1.05; letter-spacing: -0.02em; }
.week { display: flex; gap: 14px; }
.week .dy { position: relative; width: 84px; height: 84px; }
.week .dy > * { position: absolute; inset: 0; }
.week .dy b { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 26px; color: rgba(255, 255, 255, 0.6); }
.week .dy .ck { display: flex; align-items: center; justify-content: center; }

/* league */
.lrow { left: -340px; width: 680px; height: 96px; border-radius: 26px; background: rgba(255, 255, 255, 0.08); display: flex; align-items: center; gap: 18px; padding: 0 28px 0 24px; font-weight: 800; font-size: 30px; white-space: nowrap; }
.lrow .rk { width: 30px; font-weight: 900; color: rgba(255, 255, 255, 0.55); }
.lrow .xp { margin-left: auto; font-weight: 700; font-size: 26px; color: rgba(255, 255, 255, 0.75); }
.lrow.you { background: var(--sun); color: var(--ink); z-index: 2; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3); }
.lrow.you .rk, .lrow.you .xp { color: var(--ink); }
.lrow .av { position: relative; width: 56px; height: 56px; }
.lrow .av b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: #fff; }

/* daily drop */
.dpin { position: absolute; width: 0; height: 0; }
.dpin svg { position: absolute; left: -32px; top: -32px; }

/* ---------- narrow screens: copy on top, the graphic below it ---------- */
@media (max-width: 899px) {
  .s-loop { --cw: calc(100vw - 2 * var(--gut)); --hl: min(calc(var(--cw) / 5.45), 8.2vh); }
  .loop-eb { top: calc(var(--nav-h) + 14px); gap: 0.75em; font-size: clamp(10.5px, 3vw, 12px); letter-spacing: 0.12em; }
  .stn-copy { top: calc(var(--nav-h) + 54px); transform: none; }
  .stn .sub { margin-top: 12px; font-size: clamp(15px, 4.1vw, 19px); }
}
@media (max-width: 899px) and (max-height: 700px) {
  .stn .sub { font-size: 15px; }
}
