/* ============ Oso Plaza — the landing story (index.html) ============
   Seven moves, read top to bottom as a zine page. This sheet is the page at
   rest: with motion off, or JavaScript off, it is what visitors get. The
   tokens come from styles.css; pinning and scroll-driven states live only
   under html.motion, at the end of this sheet. */

/* The gutter grows on ultrawide screens so every move shares one 1480px measure
   while .stage itself stays full width, ready to be pinned. */
:root { --night: #110F12; --gutter: max(clamp(16px, 3vw, 40px), calc((100vw - 1480px) / 2)); --grain: radial-gradient(rgba(120, 90, 50, 0.06) 0.6px, transparent 0.8px) 0 0 / 3px 3px; }

body { overflow-x: clip; }
h1 i, h2 i { font-weight: 900; }
h2 { letter-spacing: -0.04em; }

.stage { position: relative; padding: 0 var(--gutter); }

/* The top bar and footer share the story's edges, not the 1120px legal column. */
.mast-bar .wrap, .footer .wrap { max-width: none; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---- 1. The headline and the print ---- */
#top .stage {
  display: grid; gap: 28px; align-items: start;
  grid-template-areas: "h1" "print" "cap-a" "cap-b" "android";
  padding-top: clamp(20px, 3vw, 44px); padding-bottom: clamp(56px, 7vw, 96px);
}
/* 5.2em holds "Collect the" on the first line and keeps "rooms" from pulling "you're" up. */
#top h1 { grid-area: h1; font-size: clamp(58px, 18.5vw, 170px); line-height: 0.88; letter-spacing: -0.045em; max-width: 5.2em; }
.print-slot { grid-area: print; position: relative; width: 92%; max-width: 560px; justify-self: center; margin-top: 14px; }
#print {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--ink);
  box-shadow: 10px 12px 0 var(--shadow); transform: rotate(1.6deg); border-radius: 2px;
}
/* A media element, not an <img>: a muted loop may replace #print-a later. */
#print > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
html:not(.motion) #print-b { display: none; }
#print-tape { position: absolute; top: -13px; left: 50%; width: 132px; height: 30px; margin-left: -66px; background: var(--tape); transform: rotate(-3deg); }
.cap { font-size: clamp(22px, 2.3vw, 30px); line-height: 1.2; letter-spacing: -0.01em; max-width: 18em; text-wrap: balance; }
#cap-a { grid-area: cap-a; margin-top: 10px; }
#cap-b { grid-area: cap-b; font-style: italic; font-weight: 400; color: var(--ink-dim); margin-top: -10px; }
.hero-android { grid-area: android; margin-top: 4px; }
.hero-android a { font-family: var(--hand); font-weight: 700; font-size: 24px; color: var(--rust); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
@media (min-width: 900px), (orientation: landscape) and (min-width: 640px) {
  #top .stage {
    grid-template-columns: minmax(0, 1.38fr) minmax(0, 0.82fr); column-gap: clamp(32px, 5vw, 80px);
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas: "h1 print" "cap-a print" "cap-b print" "android print";
  }
  #top h1 { font-size: clamp(72px, 11.6vw, 180px); }
  .print-slot { width: 100%; justify-self: end; margin-top: 10px; }
  #cap-a { margin-top: 34px; }
}

/* ---- 2. Giant type, photos passing ---- */
#pass .stage { padding-top: clamp(24px, 4vw, 64px); padding-bottom: clamp(72px, 9vw, 128px); }
#pass-line { font-size: clamp(72px, 23.5vw, 200px); line-height: 0.9; letter-spacing: -0.05em; margin: 0 0 clamp(36px, 5vw, 76px) -0.03em; }
.passing-row { display: flex; align-items: flex-start; justify-content: center; }
.passing { flex: none; }
.passing.taped::after { top: -10px; width: 46%; height: clamp(18px, 2.2vw, 30px); margin-left: -23%; }
/* On a phone the three prints are a small pile, the middle one laid on top. */
.passing:nth-child(1) { width: 44%; aspect-ratio: 4 / 5; transform: rotate(-2.4deg); }
.passing:nth-child(2) { width: 30%; aspect-ratio: 1; transform: rotate(2.4deg); margin: 22% -7% 0; z-index: 1; }
.passing:nth-child(3) { width: 40%; aspect-ratio: 3 / 4; transform: rotate(-1.2deg); margin-top: 6%; }
@media (min-width: 900px) {
  #pass-line { font-size: clamp(120px, 13.6vw, 210px); white-space: nowrap; }
  .passing-row { justify-content: space-between; padding: 0 4%; }
  .passing:nth-child(1) { width: 24%; margin-top: clamp(16px, 4vw, 56px); }
  .passing:nth-child(2) { width: 17%; margin: clamp(40px, 9vw, 130px) 0 0; }
  .passing:nth-child(3) { width: 27%; margin-top: 0; }
}

/* ---- 3. One night, in words ---- */
#words .stage { padding-top: clamp(16px, 3vw, 48px); padding-bottom: clamp(88px, 11vw, 150px); }
#ink { font-size: clamp(32px, 5.4vw, 92px); line-height: 1.04; letter-spacing: -0.03em; max-width: 19ch; margin: 0 auto; }
#ink i { font-weight: 900; font-style: italic; }

/* ---- 4. The ticket gets punched ---- */
#stub .stage { padding-top: clamp(16px, 2vw, 32px); padding-bottom: clamp(88px, 11vw, 150px); }
.stub-title { font-size: clamp(52px, 7.5vw, 124px); line-height: 0.95; margin-bottom: clamp(28px, 4vw, 56px); }
.stub-grid { display: grid; gap: clamp(28px, 4vw, 44px); align-items: center; }
.ticket-slot { width: min(100%, 560px); justify-self: center; margin: 0 auto; }
/* The big stub's marker note sits clear of the punch hole. */
#ticket .note { right: 4.4cqw; top: 22cqw; font-size: 11.4cqw; }
#steps { list-style: none; font-size: clamp(22px, 2.4vw, 34px); line-height: 1.3; letter-spacing: -0.02em; }
#steps li { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
#steps li::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ember); }
.side { font-size: clamp(18px, 1.5vw, 22px); line-height: 1.38; color: var(--ink-dim); max-width: 30ch; }
@media (max-width: 899px) {
  .ticket-slot { order: -1; }
  #steps { display: flex; flex-wrap: wrap; gap: 4px 22px; }
  #steps li { padding: 2px 0; }
}
@media (min-width: 900px) {
  .stub-grid { grid-template-columns: minmax(180px, 1fr) minmax(0, min(50vw, 640px)) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); }
  .ticket-slot { width: 100%; }
  .side { justify-self: end; }
}

/* ---- 5. The lights go down ---- */
#lights { color: var(--paper); background: var(--night); }
#lights .stage {
  display: grid; gap: clamp(36px, 5vw, 80px); align-items: center;
  padding-top: clamp(72px, 10vw, 140px); padding-bottom: clamp(72px, 10vw, 140px); overflow: hidden; overflow: clip;
}
#glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(90% 45% at 50% 68%, rgba(255, 92, 31, 0.24), transparent 70%); }
.lights-words { position: relative; z-index: 1; }
#lights h2 { font-size: clamp(52px, 9.4vw, 170px); line-height: 0.9; letter-spacing: -0.04em; max-width: 7ch; }
#lights p { margin-top: clamp(22px, 2.8vw, 40px); font-size: clamp(18px, 1.7vw, 24px); line-height: 1.35; max-width: 440px; opacity: 0.8; }
#phone {
  position: relative; z-index: 1; width: min(78%, 330px); aspect-ratio: 1206 / 2622; justify-self: center;
  border-radius: 40px; padding: 7px; background: #050506; box-shadow: 12px 14px 0 rgba(0, 0, 0, 0.35); transform: rotate(-2deg);
}
#phone .scr { position: relative; width: 100%; height: 100%; border-radius: 33px; overflow: hidden; background: var(--night); }
#phone .scr img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
html:not(.motion) #phone-day { display: none; }
@media (min-width: 900px) {
  #lights .stage { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
  #glow { background: radial-gradient(55% 60% at 76% 45%, rgba(255, 92, 31, 0.26), transparent 70%); }
  #phone { width: min(30vw, 380px); justify-self: end; border-radius: 48px; padding: 9px; }
  #phone .scr { border-radius: 39px; }
}

/* ---- 6. A year of stubs ---- */
#year { background: var(--night); color: var(--paper); }
#year .stage { padding-top: clamp(32px, 5vw, 72px); padding-bottom: clamp(40px, 5vw, 72px); }
.year-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; margin-bottom: clamp(32px, 5vw, 64px); }
#year h2 { font-size: clamp(42px, 6.2vw, 110px); line-height: 0.95; max-width: 8ch; }
#count { font-weight: 900; font-size: clamp(72px, 10vw, 180px); line-height: 0.85; letter-spacing: -0.05em; color: var(--ember); font-variant-numeric: tabular-nums; }
/* Seven stubs: full rows, with the short last row centred rather than leaving a hole. */
#stub-row { --cols: 2; --gap: clamp(14px, 2.4vw, 32px); display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(18px, 3vw, 40px) var(--gap); padding: 8px 0 12px; }
#stub-row .tk { --page: var(--night); flex: none; width: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.45); }
#stub-row .tk:nth-child(odd) { transform: rotate(-1.6deg); }
#stub-row .tk:nth-child(even) { transform: rotate(1.2deg) translateY(10px); }
@media (min-width: 640px) { #stub-row { --cols: 3; } }
@media (min-width: 1100px) { #stub-row { --cols: 4; } }
/* The ticket's small print scales with it, so a small stub holds it at a size that can be
   read, and lets go of what no longer fits beside the number or across the stub. */
#stub-row .tk .tag { font-size: max(8.5px, 2.87cqw); }
#stub-row .tk .meta { font-size: max(9px, 3.07cqw); }
@container (max-width: 260px) {
  #stub-row .tk .nm { bottom: calc(18.85cqw + 3px); }
}
@container (max-width: 210px) {
  #stub-row .tk .tag { display: none; }
}
@container (max-width: 160px) {
  #stub-row .tk .meta { display: none; }
  #stub-row .tk .nm { bottom: 13.5cqw; }
}

/* ---- 7. The sun comes up ---- */
/* At rest the sun has already risen: night from the year above, an ember rim,
   then the cream disc that holds the last word. Everything reads on cream. */
#finale { background: var(--paper); }
#finale .stage {
  --disc: max(220%, 900px); --rim: clamp(22px, 3vw, 44px); --rise: clamp(36px, 5vw, 72px);
  overflow: hidden; overflow: clip; text-align: center; background: var(--night);
  padding-top: calc(var(--rise) + var(--rim) + clamp(44px, 6vw, 88px)); padding-bottom: clamp(64px, 8vw, 104px);
}
#sun-a, #sun-b { position: absolute; left: 50%; width: var(--disc); margin-left: calc(var(--disc) / -2); aspect-ratio: 1; border-radius: 50%; pointer-events: none; }
#sun-a { top: var(--rise); background: var(--ember); }
#sun-b { top: calc(var(--rise) + var(--rim)); background: var(--paper); }
#finale-inner { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; }
.finale-bear { display: block; width: clamp(84px, 11vw, 140px); height: auto; margin: 0 auto 14px; }
#finale h2 { font-size: clamp(60px, 12.5vw, 200px); max-width: 5.6em; margin: 0 auto; line-height: 0.88; letter-spacing: -0.045em; }
.finale-sub { margin: 26px auto 34px; text-wrap: balance; }
.android-form { margin-top: 48px; }
.android-form label { display: block; margin-bottom: 10px; font-family: var(--hand); font-weight: 700; font-size: 24px; color: var(--rust); }
.field { display: flex; gap: 10px; max-width: 440px; margin: 0 auto; }
.field input {
  flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0;
  padding: 12px 4px; color: var(--ink); font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 19px;
}
.field input::placeholder { color: var(--ink-dim); opacity: 0.8; }
.field input:focus { border-bottom-color: var(--ember); }
.field button {
  background: var(--ink); color: var(--paper); border: 0; border-radius: 4px; padding: 12px 18px; cursor: pointer;
  font-family: var(--mono); font-weight: 800; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--ember);
}
.field button:disabled { opacity: 0.6; cursor: default; }
.form-msg { margin-top: 12px; min-height: 1.3em; font-style: italic; font-weight: 400; }
.form-msg.ok { color: var(--ink); }
.form-msg.err { color: var(--rust); }

/* Focus on this page crosses paper, night, ember and photo, and the site's ember ring vanishes on
   ember. So three bands, paper, ink, paper: whatever the control and whatever is behind it, one
   edge has full contrast. It replaces a control's hard shadow while focused. */
body :focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

/* ============ Motion: only under html.motion, which the head script sets ============
   Everything above is the page at rest. Each move below undoes its static layout and
   pins a stage. #top's rules are also its p = 0 state, so the first paint matches what
   landing.js draws when it arrives; html.ready marks that arrival.

   A stage is 100lvh, so a full-bleed photo still reaches the bottom once the iOS toolbar
   collapses, and nothing changes size when it does. --bar-gap is the part of the stage a
   showing toolbar covers: bottom-anchored things add it. Its padding on the stage is how
   the engine reads it in pixels, and centred content clears the toolbar the same way.
   --bar-clear is what the fixed top bar covers (BAR_CLEAR in lib/landing-core.mjs). */
html.motion { scroll-behavior: auto; --bar-gap: 0px; --svh: 1vh; --bar-clear: 64px; }
@supports (height: 100lvh) {
  html.motion { --bar-gap: calc(100lvh - 100svh); --svh: 1svh; }
}

html.motion #top { height: 320vh; }
html.motion #pass { height: 300vh; }
html.motion #words { height: 260vh; }
html.motion #stub { height: 340vh; }
html.motion #lights { height: 340vh; color: var(--ink); background: var(--paper); }
html.motion #year { height: 420vh; }
html.motion #finale { height: 240vh; }
/* A link lands where its scene has something to show, not at p 0 with it still below the
   fold: each margin is the share of the scene's pin (its height less one screen) to go past.
   The stub at .2 has settled; the lights at .15 still have the paper they turn from; the row
   at .0625 has its first ticket whole on a phone; the finale at 1 has the form up. */
html.motion #stub, html.motion #how { scroll-margin-top: -48vh; }
html.motion #lights, html.motion #screens { scroll-margin-top: -36vh; }
html.motion #year, html.motion #crossed { scroll-margin-top: -20vh; }
html.motion #finale { scroll-margin-top: -140vh; }
/* Tabbing back up into the finale, the browser's scroll stops a control under the fixed bar;
   tabbing down, its ring and the toolbar need the same room at the bottom. */
html.motion #finale :is(a, input, button) { scroll-margin-top: calc(var(--bar-clear) + 12px); scroll-margin-bottom: calc(var(--bar-gap) + 12px); }
/* And the form's message shows under the box, so it counts too. */
html.motion #finale :is(input, button) { scroll-margin-bottom: calc(var(--bar-gap) + 44px); }
/* WebKit applies an empty inline's margin twice, so the old names are blocks with no height. */
html.motion #how, html.motion #screens, html.motion #crossed { display: block; height: 0; }
/* Clip wherever it is known; hidden is for Safari before 16. A hidden box can still be scrolled by
   the browser's text search, scrollIntoView or focus, which slides the row out of its stage and
   leaves it blank. */
html.motion #top .stage, html.motion #pass .stage, html.motion #words .stage, html.motion #stub .stage, html.motion #lights .stage, html.motion #year .stage {
  position: sticky; top: 0; height: 100vh; height: 100lvh; overflow: hidden; overflow: clip; padding: 0 0 var(--bar-gap);
}
/* Until the engine's first frame, plain paper instead of a scene in the wrong state. #top
   stays: it is the first paint and never waits. */
html.motion:not(.ready) main > section:not(#top) > .stage { visibility: hidden; }
/* Unless the visitor came by a link to somewhere else: then the first paint isn't the headline. */
html.motion.arriving:not(.ready) #top > .stage { visibility: hidden; }

/* Under motion the engine alone decides when photos load (nearScene: two screens ahead, and the
   hero's second photo after the page's load). The browser's own lazy loading would fetch that one
   and move 2's during the first screen, on a connection still waiting for the hero. A photo in
   waiting is not drawn, its print or ticket keeps its size and ground, and setting loading to
   eager is what lets it through. */
html.motion main img[loading="lazy"] { display: none; }

/* ---- The top bar ---- */
/* It stays over every scene and turns to paper over the dark ones, flipping at once (see
   paintBar in landing.js). Only its links take pointers, so its empty width can't eat a tap.
   The wordmark and the links each sit on a printed label of the bar's own ground, square-cut and
   solid, as the Download button does: it melts into a matching scene and holds its words over
   whatever else passes. Paper labels carry the page's grain over the first moves, and drop it from
   the lights on (on-flat), where the paper behind them is flat, so neither shows a rectangle. Both are 48px tall, and the negative margins keep them out of the bar's layout. */
html.motion .mast-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none; }
html.motion .mast-bar a { pointer-events: auto; }
html.motion .mast-bar.on-paper { background: var(--paper); }
html.motion .mast { padding: 7px 11px 7px 7px; margin: -7px -11px -7px -7px; background: var(--paper) var(--grain); }
html.motion .mast-bar.on-flat .mast { background: var(--paper); }
html.motion .mast-bar.on-dark .mast { background: var(--night); }
html.motion .mast-bar.on-dark .mast, html.motion .mast-bar.on-dark .mast-links a { color: var(--paper); }
html.motion .mast-bar.on-dark .mast-links .mast-cta { background: var(--paper); color: var(--ink) !important; }
html.motion .mast-bar.on-dark .mast [fill="#0A0A0C"] { fill: var(--paper); }
html.motion .mast-bar.on-dark .mast [stroke="#EFE7D8"] { stroke: var(--ink); }
/* On its label a hovered link stays in its own colour and takes an ember underline. */
html.motion .mast-links a:not(.mast-cta):hover { color: var(--ink); text-decoration: underline 2px var(--ember); text-underline-offset: 4px; }
html.motion .mast-bar.on-dark .mast-links a:not(.mast-cta):hover { color: var(--paper); }
/* The links show from 721 wide (styles.css). Their label holds the button as well, one piece. */
@media (min-width: 721px) {
  html.motion .mast-links { height: 48px; padding: 0 7px 0 14px; margin: -6px -7px -6px 0; background: var(--paper) var(--grain); }
  html.motion .mast-bar.on-flat .mast-links { background: var(--paper); }
  html.motion .mast-bar.on-dark .mast-links { background: var(--night); }
}

/* ---- 1. The print grows ---- */
html.motion #top .stage {
  display: block; --h1-top: clamp(76px, 12vh, 120px); --h1-size: min(clamp(58px, 18.5vw, 130px), 13 * var(--svh));
}
html.motion #top h1, html.motion .hero-android, html.motion .cap { position: absolute; margin: 0; }
html.motion #top h1 { z-index: 1; top: var(--h1-top); left: var(--gutter); font-size: var(--h1-size); }
/* Three lines at line-height 0.88, then room for the y's tail at any size. */
html.motion .hero-android { z-index: 1; top: calc(var(--h1-top) + 2.84 * var(--h1-size) + 4px); left: var(--gutter); }
/* Tabbing to the link while the print covers it brings it up on its own paper. */
html.motion .hero-android:focus-within { z-index: 5; background: var(--paper); }
/* The slot is full bleed and only the clipped print takes pointers, so the link stays
   clickable beside it and can't be clicked through it. */
html.motion .print-slot { position: absolute; inset: 0; z-index: 2; width: auto; max-width: none; margin: 0; justify-self: auto; pointer-events: none; }
html.motion #print {
  position: absolute; inset: 0; aspect-ratio: auto; box-shadow: none; border-radius: 0; pointer-events: auto;
  transform: rotate(-1.2deg) scale(1.03); clip-path: inset(calc(56 * var(--svh)) 9vw calc(4 * var(--svh) + var(--bar-gap)) 9vw round 6px);
}
html.motion #print::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(10, 10, 12, 0.72)); }
html.motion #print-a { transform: scale(1.3); }
html.motion #print-b { opacity: 0; transform: scale(1.14); }
/* The print's top centre (--dx, --dy from the stage's centre) carried through its rest
   tilt and scale: 1.02977 is 1.03 cos 1.2deg, 0.02157 is 1.03 sin 1.2deg. Same sum as
   heroState's tape, so the engine's arrival doesn't move it. */
html.motion #print-tape {
  --dx: 0px; --dy: calc(56 * var(--svh) - 50vh);
  top: 0; left: 0; z-index: 3; width: 150px; margin-left: -75px;
  transform: translate(calc(50vw + 1.02977 * var(--dx) + 0.02157 * var(--dy)), calc(50vh - 0.02157 * var(--dx) + 1.02977 * var(--dy) - 14px)) rotate(-3deg);
}
html.motion .cap {
  z-index: 4; left: var(--gutter); bottom: calc(clamp(58px, 8vh, 72px) + var(--bar-gap)); max-width: min(520px, calc(100% - 2 * var(--gutter)));
  padding-left: 16px; border-left: 2px solid var(--paper); color: var(--paper);
  font-size: clamp(20px, 2.3vw, 30px); opacity: 0;
}
html.motion #cap-b { font-style: normal; font-weight: 300; color: var(--paper); }
html.motion #top.scene-live #print { will-change: clip-path, transform; }
html.motion #top.scene-live #print > * { will-change: transform; }
html.motion #top.scene-live #print-tape, html.motion #top.scene-live .cap { will-change: transform, opacity; }
/* Wide (WIDE_QUERY in lib/landing-core.mjs; a test holds every copy of it to the same words). The
   headline leaves room under it for the Android link, 2.84 lines and the link's 46px, however short
   the screen. The print, as heroState has it: inside the 1480px measure, its tape clear of the bar. */
@media (min-width: 900px), (orientation: landscape) and (min-width: 400px) {
  html.motion #top .stage {
    --h1-size: min(11.6vw, 24 * var(--svh), 180px, (100 * var(--svh) - var(--h1-top) - 46px) / 2.84);
    --print-top: max(20 * var(--svh), var(--bar-clear) + 24px); --print-right: max(4vw, (100vw - 1480px) / 2); --print-width: min(34vw, 560px);
  }
  html.motion #print { clip-path: inset(var(--print-top) var(--print-right) calc(8 * var(--svh) + var(--bar-gap)) calc(100vw - var(--print-right) - var(--print-width)) round 6px); }
  html.motion #print-tape { --dx: calc(50vw - var(--print-right) - var(--print-width) / 2); --dy: calc(var(--print-top) - 50vh); }
}

/* ---- 2. Giant type, photos passing ---- */
html.motion #pass-line {
  position: absolute; top: 50%; left: 0; margin: -0.55em 0 0; white-space: nowrap;
  font-size: clamp(120px, 27vw, 460px); line-height: 1; letter-spacing: -0.05em; transform: translateX(6vw);
}
html.motion .passing-row { display: block; position: absolute; inset: 0; padding: 0; }
html.motion .passing { position: absolute; top: 0; margin: 0; z-index: auto; box-shadow: 6px 8px 0 var(--shadow); transform: translateY(120vh); }
html.motion .passing:nth-child(1) { left: 7%; width: clamp(150px, 21vw, 340px); aspect-ratio: 4 / 5; }
html.motion .passing:nth-child(2) { left: 40%; width: clamp(130px, 16vw, 260px); aspect-ratio: 1; }
html.motion .passing:nth-child(3) { left: 69%; width: clamp(160px, 25vw, 410px); aspect-ratio: 3 / 4; }
html.motion .passing.taped::after { top: -10px; left: 22%; width: 42%; height: 20px; margin-left: 0; transform: rotate(-4deg); }
html.motion #pass.scene-live #pass-line, html.motion #pass.scene-live .passing { will-change: transform; }

/* ---- 3. Words ink in ---- */
html.motion #words .stage { display: flex; align-items: center; padding: 0 clamp(16px, 8vw, 140px) var(--bar-gap); }
html.motion #ink, html.motion #ink-words {
  font-size: clamp(34px, 5.6vw, 96px); line-height: 1.06; letter-spacing: -0.03em; max-width: 16em; margin: 0 auto;
}
html.motion #ink.sr { margin: 0; }
html.motion #ink-words i { font-weight: 900; font-style: italic; }
html.motion #ink-words .w { opacity: 0.13; }

/* ---- 4. The ticket gets punched ---- */
/* The ticket is sized by whichever runs out first, width or the height left under the bar
   and above the toolbar. 1.17 is width per height: 244/200, less a little for its tilt. */
html.motion #stub .stage {
  display: grid; align-content: center; padding: var(--bar-clear) var(--gutter) var(--bar-gap);
  --ticket-fit: calc((100 * var(--svh) - var(--bar-clear) - 16px) * 1.17);
}
html.motion .stub-title { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Portrait: list, ticket, words. The list is a fixed two by two, so the lit line going
   bold moves nothing else. */
html.motion .stub-grid { grid-template-columns: minmax(0, 1fr); gap: clamp(10px, calc(2.6 * var(--svh)), 22px); }
html.motion #stub .ticket-slot {
  order: 0; width: min(100%, max(150px, calc(var(--ticket-fit) - 210px))); margin: 0; justify-self: center; transform: none; perspective: 1400px;
}
html.motion #stub .tk-shadow { display: none; }
html.motion #ticket { box-shadow: 6px 8px 0 var(--shadow); }
html.motion #steps {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 0 12px;
  font-size: clamp(16px, 4.4vw, 24px); line-height: 1.25;
}
html.motion #steps li { gap: 9px; padding: 2px 0; white-space: nowrap; opacity: 0.42; transition: opacity 0.25s; }
html.motion #steps li::before { width: 8px; height: 8px; opacity: 0; transition: opacity 0.2s; }
html.motion #steps li.on { opacity: 1; font-weight: 900; font-style: italic; }
html.motion #steps li.on::before { opacity: 1; }
html.motion .side { max-width: none; font-size: clamp(15px, 4.2vw, 20px); line-height: 1.32; }
/* Room for the "!" and the marker line, which the reveal's clip would otherwise reach. The
   halo keeps ember readable on the photo's bright haze, and arrives with the writing. */
html.motion #ticket .note {
  padding: 0.1em 0.25em 0.15em; margin: -0.1em -0.25em;
  text-shadow: 0 0 0.08em rgba(10, 10, 12, 0.75), 0 0.02em 0.22em rgba(10, 10, 12, 0.7), 0 0 0.6em rgba(10, 10, 12, 0.45);
}
html.motion #stub.scene-live #ticket { will-change: transform; }
html.motion #stub.scene-live #ticket .serial { will-change: transform, opacity; }
html.motion #stub.scene-live #ticket .hole { will-change: transform; }
html.motion #stub.scene-live #ticket .note { will-change: clip-path; }
/* Wide but not wide enough for three columns: the words stacked beside a bigger ticket. */
@media (min-width: 900px), (orientation: landscape) and (min-width: 400px) {
  html.motion .stub-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, min(62vw, 100vw - 220px, var(--ticket-fit)));
    grid-template-areas: "steps ticket" "side ticket";
    gap: clamp(8px, calc(3 * var(--svh)), 28px) clamp(20px, 4vw, 56px);
  }
  html.motion #steps {
    display: block; grid-area: steps; align-self: end;
    font-size: min(clamp(18px, 2.6vw, 36px), calc(5.6 * var(--svh)));
  }
  html.motion #stub .ticket-slot { grid-area: ticket; width: 100%; align-self: center; }
  html.motion .side {
    grid-area: side; align-self: start; justify-self: start; max-width: 30ch;
    font-size: min(clamp(15px, 1.5vw, 22px), calc(4.6 * var(--svh)));
  }
}
@media (min-width: 1200px) {
  html.motion .stub-grid {
    grid-template-columns: minmax(212px, 1fr) minmax(0, min(58vw, 760px, var(--ticket-fit))) minmax(212px, 1fr);
    grid-template-areas: "steps ticket side"; gap: clamp(16px, 3vw, 44px);
  }
  html.motion #steps { font-size: min(clamp(20px, 1.75vw, 30px), calc(5.6 * var(--svh))); }
  html.motion #steps, html.motion .side { align-self: center; }
  html.motion .side { justify-self: end; }
}

/* ---- 5. The lights go down ---- */
/* The stage carries the change from paper to night, so its first state matches the
   section's. The phone drifts from +10 to -4 --drift: it clears the bar at the top of its
   drift and the screen's edge by the time the page starts to turn. --drift is a vh, down to half
   of one as the visible height gets short, where the phone needs the room more. */
html.motion #lights .stage {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0;
  padding: calc(var(--bar-clear) + 4px) var(--gutter) var(--bar-gap); background: var(--paper);
}
html.motion #glow { opacity: 0; }
html.motion #lights h2 { max-width: none; font-size: min(clamp(44px, 13vw, 76px), calc(9 * var(--svh))); }
html.motion #lights p { margin-top: clamp(6px, calc(1.4 * var(--svh)), 14px); max-width: 30em; font-size: clamp(15px, calc(2.1 * var(--svh)), 18px); }
html.motion #phone {
  --r: clamp(20px, calc(3.8 * var(--svh)), 34px); --pad: clamp(5px, calc(0.8 * var(--svh)), 8px);
  --drift: min(1vh, max(0.5vh, (100 * var(--svh) - 400px) / 40));
  align-self: center; justify-self: center; width: auto; height: calc(100% - 12 * var(--drift) - 16px); margin: 0 0 calc(4 * var(--drift));
  padding: var(--pad); border-radius: var(--r); box-shadow: 12px 14px 0 rgba(10, 10, 12, 0.2); transform: translateY(calc(10 * var(--drift))) rotate(3deg);
}
html.motion #phone .scr { border-radius: calc(var(--r) - var(--pad)); background: var(--paper); }
html.motion #phone-night { clip-path: inset(0 0 100% 0); }
html.motion #lights.scene-live #phone { will-change: transform; }
html.motion #lights.scene-live #phone-night { will-change: clip-path; }
html.motion #lights.scene-live #glow { will-change: opacity; }
@media (min-width: 900px), (orientation: landscape) and (min-width: 400px) {
  html.motion #lights .stage { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); gap: clamp(20px, 5vw, 90px); }
  html.motion #glow { background: radial-gradient(55% 60% at 76% 45%, rgba(255, 92, 31, 0.26), transparent 70%); }
  html.motion .lights-words { align-self: center; }
  html.motion #lights h2 { max-width: 7ch; font-size: min(9.4vw, 170px, calc(19 * var(--svh))); }
  html.motion #lights p { margin-top: clamp(10px, calc(3 * var(--svh)), 28px); max-width: 440px; font-size: clamp(15px, min(1.7vw, calc(3.4 * var(--svh))), 24px); }
  html.motion #phone {
    --r: clamp(22px, calc(5 * var(--svh)), 44px); --pad: clamp(5px, var(--svh), 9px);
    height: min(100% - 12 * var(--drift) - 16px, 760px); justify-self: end;
  }
}
/* A small landscape phone's bar is only the logo and the button: the phone can stand between them
   at full height, and the words keep clear of the logo. */
@media (orientation: landscape) and (min-width: 400px) and (max-width: 720px) and (max-height: 560px) {
  html.motion #lights .stage { padding-top: 8px; padding-right: calc(var(--gutter) + 112px); }
  html.motion .lights-words { padding-top: calc(var(--bar-clear) - 8px); }
}

/* ---- 6. The stubs run past ---- */
/* The ticket's size is whichever runs out first, the width or the height left under the bar
   and the head and above the toolbar. 1.22 is its width per height. */
html.motion #year .stage {
  display: flex; flex-direction: column; justify-content: center; padding: var(--bar-clear) 0 var(--bar-gap); background: var(--night);
  --head: min(clamp(40px, 11vw, 110px), calc(8.5 * var(--svh)));
  --card: min(78vw, 500px, calc((100 * var(--svh) - var(--bar-clear) - 2.2 * var(--head) - 56px) * 1.22));
}
html.motion .year-head { flex: none; flex-wrap: nowrap; padding: 0 var(--gutter); margin-bottom: clamp(8px, calc(3 * var(--svh)), 36px); }
html.motion #year h2 { font-size: var(--head); }
html.motion #count { font-size: min(clamp(60px, 20vw, 180px), calc(18 * var(--svh))); }
html.motion #stub-row {
  flex: none; flex-wrap: nowrap; justify-content: flex-start; align-self: flex-start; width: max-content;
  gap: clamp(20px, 3vw, 48px); padding: 8px var(--gutter) 34px; transform: translateX(50vw);
}
html.motion #stub-row .tk { width: var(--card); }
html.motion #stub-row .tk:nth-child(even) { transform: rotate(1.2deg) translateY(22px); }
html.motion #year.scene-live #stub-row { will-change: transform; }
@media (min-width: 900px), (orientation: landscape) and (min-width: 400px) {
  html.motion #year .stage {
    --head: min(clamp(40px, 6.2vw, 110px), calc(11 * var(--svh)));
    --card: min(clamp(270px, 31vw, 500px), calc((100 * var(--svh) - var(--bar-clear) - 2.2 * var(--head) - 56px) * 1.22));
  }
  html.motion #count { font-size: min(clamp(60px, 10vw, 180px), calc(22 * var(--svh))); }
}
/* A landscape phone keeps its height for the tickets: the heading on one line. */
@media (orientation: landscape) and (min-width: 400px) and (max-height: 560px) {
  html.motion #year .stage {
    --head: min(6.2vw, calc(14 * var(--svh)));
    --card: min(clamp(270px, 31vw, 500px), calc((100 * var(--svh) - var(--bar-clear) - 1.1 * var(--head) - 60px) * 1.22));
  }
  html.motion #year h2 { max-width: none; white-space: nowrap; }
  html.motion .year-head { align-items: center; }
  html.motion #stub-row { padding-bottom: 26px; }
  html.motion #stub-row .tk:nth-child(even) { transform: rotate(1.2deg) translateY(14px); }
}

/* ---- 7. The sun comes up ---- */
/* Night, then the two discs from under the stage's bottom, as in the demo. landing.js works
   out where they stop from where the words came to rest (sunRest). The stage may outgrow the
   screen when it is short: it holds at its top for the pin, then scrolls on to the rest. */
html.motion #finale .stage {
  position: sticky; top: 0; min-height: 100vh; min-height: 100lvh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--bar-clear) + 8px) var(--gutter) calc(var(--bar-gap) + 8px); background: var(--night);
  --disc-a: max(150vmax, 1200px); --disc-b: max(112vmax, 900px);
  --say: min(clamp(52px, 23vw, 150px), calc(10.5 * var(--svh)));
}
html.motion #sun-a, html.motion #sun-b { top: auto; bottom: 0; transform: translateY(100%); }
html.motion #sun-a { width: var(--disc-a); margin-left: calc(var(--disc-a) / -2); }
html.motion #sun-b { width: var(--disc-b); margin-left: calc(var(--disc-b) / -2); }
html.motion #finale-inner { width: 100%; color: var(--paper); transform: translateY(50px); }
html.motion .finale-bear { width: min(clamp(56px, 18vw, 96px), calc(11 * var(--svh))); margin-bottom: clamp(4px, var(--svh), 14px); }
html.motion .finale-bear [fill="#0A0A0C"] { fill: currentColor; }
html.motion .finale-bear [stroke="#EFE7D8"] { stroke: currentColor; }
html.motion #finale h2 { font-size: var(--say); }
html.motion .finale-sub { margin: clamp(8px, calc(2 * var(--svh)), 26px) auto clamp(10px, calc(2.4 * var(--svh)), 34px); color: inherit; opacity: 0; font-size: clamp(15px, calc(2.5 * var(--svh)), 23px); line-height: 1.35; }
html.motion #finale .badge { padding: clamp(7px, calc(1.4 * var(--svh)), 12px) 22px; }
html.motion .android-form { width: min(100%, 460px); margin: clamp(10px, calc(3 * var(--svh)), 48px) auto 0; opacity: 0; }
html.motion .android-form.away { pointer-events: none; }
/* Tabbing here while the sun is down: the form shows at once, on its own paper. */
html.motion .android-form:focus-within {
  opacity: 1 !important; pointer-events: auto; position: relative; z-index: 2; background: var(--paper); box-shadow: 0 0 0 10px var(--paper);
}
html.motion .android-form label { margin-bottom: clamp(2px, var(--svh), 10px); font-size: clamp(18px, calc(3 * var(--svh)), 24px); line-height: 1.15; }
html.motion .field input { padding-block: clamp(6px, calc(1.3 * var(--svh)), 12px); }
html.motion .form-msg { margin-top: clamp(4px, var(--svh), 12px); line-height: 1.3; }
html.motion #finale.scene-live #sun-a, html.motion #finale.scene-live #sun-b { will-change: transform; }
html.motion #finale.scene-live #finale-inner { will-change: transform; }
html.motion #finale.scene-live .android-form { will-change: opacity; }
@media (min-width: 900px), (orientation: landscape) and (min-width: 400px) {
  html.motion #finale .stage { --say: min(12.5vw, 200px, calc(19 * var(--svh))); padding-top: var(--bar-clear); }
  html.motion .finale-bear { width: min(clamp(56px, 11vw, 140px), calc(12 * var(--svh))); }
}
@media (max-height: 560px) {
  /* Focus early in the rise, on a short screen: the words come up now, or the last controls sit
     under the fold of a stage the browser can't scroll while it is pinned. */
  html.motion #finale-inner:focus-within { transform: none !important; }
}
/* A landscape phone has no height for one column: the words beside the things to tap. */
@media (orientation: landscape) and (min-width: 400px) and (max-height: 560px) {
  html.motion #finale .stage { --say: min(9vw, calc(16 * var(--svh))); }
  html.motion #finale-inner {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(16px, 4vw, 48px); align-items: center;
  }
  html.motion .finale-bear, html.motion #finale h2, html.motion .finale-sub { grid-column: 1; }
  html.motion .finale-bear { width: calc(15 * var(--svh)); }
  html.motion #finale .badge { grid-column: 2; grid-row: 1; justify-self: center; align-self: end; }
  html.motion .android-form { grid-column: 2; grid-row: 2 / span 2; align-self: start; }
}
