/* STATE 3 = state 2 + this file + polish.js. Everything here comes from charles-polish:
   the details table, states, motion (curves, durations, reduced motion) and the two set pieces
   that give the flow a beginning (five lights) and an end (inside the helmet). */
html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
@media (prefers-reduced-motion:no-preference){html{scroll-behavior:smooth}}
::selection{background:var(--accent);color:var(--on-accent)}
.sec{scroll-margin-top:24px}
.sec h2,.next .race{text-wrap:balance}
.about p,.shop p{text-wrap:pretty}

/* hit areas, hover, press, focus */
.nav-links a{display:inline-flex;align-items:center;min-height:44px;padding:0 4px;margin:0 -4px;transition:color .15s ease}
.mark{min-height:44px}
.btn{transition:background-color .15s ease,transform .12s ease}
.btn:active{transform:scale(.96)}
@media (hover:none){.btn:hover{background:var(--accent)}.nav-links a:hover{color:var(--text-2)}}
a:focus-visible{outline:2px solid var(--text);outline-offset:3px;border-radius:4px}
.shop a{transition:text-decoration-color .15s ease}
.shop a:hover{text-decoration-color:var(--text)}

/* the five lights: a loader that is worth watching, and shows how far along it is */
.lights{position:fixed;inset:0;z-index:20;background:var(--deep);display:none;place-items:center}
html.pre .lights{display:grid}
.gantry{display:flex;gap:clamp(8px,1.6vw,20px);padding:clamp(8px,1.4vw,16px);background:#05070b;border-radius:8px;box-shadow:0 0 0 1px var(--hair)}
.pod{width:clamp(40px,7vw,84px);padding:clamp(6px,1vw,12px);display:grid;gap:clamp(6px,1vw,12px);background:#0d1118;border-radius:6px}
.pod i{aspect-ratio:1;border-radius:50%;background:#1a1114;box-shadow:inset 0 0 0 1px rgba(228,236,249,.06)}
.pod.on i{background:radial-gradient(circle at 42% 38%,#ff6a58 0,var(--lamp) 55%,#a3130c 100%);box-shadow:0 0 clamp(10px,2vw,26px) rgba(227,38,27,.55)}
.lights.out{opacity:0;transition:opacity .28s cubic-bezier(.32,.72,0,1);pointer-events:none}
.lights .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
/* the name is what the lights were holding back */
html.pre .name{opacity:0;transform:translateY(12%)}
html.go .name{opacity:1;transform:none;transition:opacity .5s cubic-bezier(.32,.72,0,1),transform .5s cubic-bezier(.32,.72,0,1)}

/* the ending: you ride into the visor and the page ends inside the helmet */
.finale{position:relative;height:320vh;margin-top:96px;background:var(--page)}
.stage{position:sticky;top:0;height:100vh;height:100svh;overflow:hidden;background:var(--page)}
.stage svg{position:absolute;inset:0;width:100%;height:100%}
.stage .label{position:absolute;left:var(--pad);top:var(--pad);font-size:32px;line-height:1.15;font-weight:500;letter-spacing:-.01em;opacity:calc(1 - var(--p,0) * 5)}
.end{position:absolute;left:0;right:0;top:62%;padding:0 var(--pad);text-align:center;opacity:0;transform:translateY(12px);transition:opacity .2s ease,transform .2s ease;pointer-events:none}
.finale.arrived .end{opacity:1;transform:none;pointer-events:auto;transition:opacity .45s cubic-bezier(.32,.72,0,1) .18s,transform .45s cubic-bezier(.32,.72,0,1) .18s}
.end .race{font-size:56px;line-height:1.05;font-weight:500;font-stretch:75%;letter-spacing:-.022em;text-wrap:balance}
.end .when{margin-top:12px;color:var(--text-2);font-size:20px;line-height:30px}
.end .btn{margin-top:28px;height:48px;padding:0 20px}
.stage .legal{position:absolute;left:var(--pad);right:var(--pad);bottom:16px;display:flex;justify-content:space-between;gap:16px;color:var(--muted);font-size:13px;line-height:20px;opacity:0;transition:opacity .3s ease}
.finale.arrived .legal{opacity:1}
.fl{fill:var(--lamp);transition:fill .08s linear}
.finale.arrived .fl{fill:#1a1114}
.fglow{opacity:.5;transition:opacity .08s linear}
.finale.arrived .fglow{opacity:0}
@media (max-width:760px){
  .finale{margin-top:64px}
  .stage .label{font-size:28px}
  .end{top:calc(50% + 21vw + 24px)}
  .end .race{font-size:36px}
  .end .when{font-size:17px;line-height:26px}
  .stage .legal{flex-direction:column;gap:0;bottom:12px}
}
@media (prefers-reduced-motion:reduce){
  .finale{height:auto}
  .stage{position:relative}
  .end,.finale.arrived .end,.stage .legal{transition:none}
  html.pre .name{opacity:1;transform:none}
}
