@font-face {
  font-family: "Geist";
  src: url("./fonts/Geist-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F3F3F1;
  --floor: #E9E9E6;
  --ink: #0D0D0E;
  --ink-2: #55554F;
  --accent: #00D27A;
  --gutter: 24px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t: 300ms;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-snap-type: y mandatory; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 1rem; line-height: 1.55; font-weight: 400; color: var(--ink); background: var(--bg); overflow-x: clip; }

#gl { position: fixed; left: 0; top: 0; width: 100%; height: 100lvh; display: block; pointer-events: none; opacity: 0; transition: opacity var(--t) var(--ease-out); }
html.gl.ready #gl { opacity: 1; }
#probe { position: fixed; left: 0; top: 0; width: 1px; height: 100svh; visibility: hidden; pointer-events: none; }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: var(--gutter); top: 8px; z-index: 20; padding: 8px 16px; background: var(--ink); color: var(--bg); border-radius: 999px; font-size: 0.875rem; font-weight: 500; text-decoration: none; transform: translateY(-64px); transition: transform 150ms var(--ease-out); }
.skip:focus-visible { transform: none; outline: 2px solid var(--ink); outline-offset: 2px; }

.top { position: fixed; left: 0; right: 0; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: max(16px, env(safe-area-inset-top)) var(--gutter) 0; pointer-events: none; }
.brand { pointer-events: auto; font-weight: 600; font-size: 0.875rem; letter-spacing: 0.22em; color: var(--ink); text-decoration: none; padding: 12px 0; display: inline-block; min-height: 44px; box-sizing: border-box; }
.brand:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* scroll geometry: three snap stops, 150svh apart */
.snap { height: 150svh; position: relative; scroll-snap-align: none; }
.snap::before { content: ""; position: absolute; left: 0; top: 0; height: 100svh; width: 1px; scroll-snap-align: start; scroll-snap-stop: always; }
#s3 { height: 100svh; }

/* the stage hit zone: vertical pans scroll the page, horizontal drags orbit */
#hit { position: fixed; z-index: 2; left: 0; top: 0; width: 0; height: 0; touch-action: pan-y; cursor: grab; border-radius: 8px; -webkit-tap-highlight-color: transparent; }
#hit:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
html:not(.gl) #hit, html:not(.gl) #tick { display: none; }

#tick { position: fixed; z-index: 3; width: 24px; height: 24px; margin: 0; pointer-events: none; opacity: 0; transform: scale(0.8); transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out); }
#tick path { stroke: var(--accent); stroke-dasharray: 1; stroke-dashoffset: 1; }
#tick.on { opacity: 1; transform: none; }
#tick.on path { stroke-dashoffset: 0; transition: stroke-dashoffset 300ms var(--ease-out) 100ms; }

/* copy */
.copy { position: fixed; z-index: 4; left: var(--gutter); right: var(--gutter); bottom: calc(64px + var(--safe-b)); max-width: 440px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity var(--t) var(--ease-out), transform var(--t) var(--ease-out); }
.copy.on { opacity: 1; transform: none; pointer-events: auto; }
.copy h1, .copy h2 { margin: 0 0 12px; font-weight: 600; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
.copy p { margin: 0; max-width: 34ch; font-size: 1rem; line-height: 1.55; color: var(--ink-2); }
.fig { display: none; }

.cta { margin-top: 24px; appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 500; font-size: 1rem; line-height: 1.2; padding: 16px 32px; min-height: 48px; border-radius: 999px; background: var(--ink); color: var(--bg); transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out); }
.cta:hover { background: var(--accent); color: var(--ink); }
.cta:focus-visible { background: var(--accent); color: var(--ink); outline: 2px solid var(--ink); outline-offset: 3px; }

.chapters { position: fixed; z-index: 5; right: 4px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; }
.chapters button { appearance: none; border: 0; background: none; width: 44px; height: 44px; padding: 0; cursor: pointer; display: grid; place-items: center; }
.chapters i { display: block; width: 2px; height: 32px; background: var(--ink); opacity: 0.45; transform: scaleY(0.5); transition: transform var(--t) var(--ease-out), opacity var(--t) var(--ease-out); }
.chapters button[aria-current="true"] i { transform: none; opacity: 1; }
.chapters button:hover i { opacity: 0.9; }
.chapters button:focus-visible { outline: 2px solid var(--ink); outline-offset: -6px; border-radius: 8px; }

.credit { position: fixed; z-index: 5; left: var(--gutter); bottom: calc(16px + var(--safe-b)); font-size: 0.75rem; line-height: 1.4; color: var(--ink-2); pointer-events: none; }

/* landscape: copy bottom left, CTA stays with its copy */
html:not(.is-portrait) .copy { bottom: calc(72px + var(--safe-b)); max-width: 480px; left: max(var(--gutter), 5vw); }
html:not(.is-portrait) .credit { left: max(var(--gutter), 5vw); }
html:not(.is-portrait) .top { padding-left: max(var(--gutter), 5vw); padding-right: max(var(--gutter), 5vw); }
html:not(.is-portrait) .chapters { right: max(8px, calc(5vw - 22px)); }

/* phones in portrait: tighter type, copy under the stage */
html.is-portrait .copy { bottom: calc(56px + var(--safe-b)); }
html.is-portrait .copy h1, html.is-portrait .copy h2 { font-size: 2rem; }
html.is-portrait .cta { width: 100%; max-width: 320px; }
@media (min-width: 600px) { html.is-portrait .copy { max-width: 560px; left: 48px; } html.is-portrait .copy h1, html.is-portrait .copy h2 { font-size: 3rem; } html.is-portrait .copy p { font-size: 1.125rem; max-width: 36ch; } html.is-portrait .credit { left: 48px; } html.is-portrait .top { padding-left: 48px; } }
html.is-portrait .chapters { right: 0; }

/* no WebGL2: the document version, every word and a CSS figure per chapter */
html.no-gl { scroll-snap-type: none; }
html.no-gl .snap { display: none; }
html.no-gl .chapters, html.no-gl .brand { display: none; }
html.no-gl .top { position: static; padding-bottom: 8px; }
html.no-gl .top .brand { display: inline-block; pointer-events: auto; }
html.no-gl .copy { position: static; opacity: 1; transform: none; pointer-events: auto; max-width: none; padding: 48px var(--gutter); min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; border-top: 1px solid rgba(13, 13, 14, 0.12); }
html.no-gl .copy:first-of-type { border-top: 0; }
html.no-gl .credit { position: static; padding: 24px var(--gutter) calc(24px + var(--safe-b)); }
html.no-gl .fig { display: block; margin-bottom: 32px; }
html.no-gl .brand { display: none; }
.fig-word { font-weight: 600; font-size: clamp(3.5rem, 18vw, 9rem); line-height: 1; letter-spacing: 0.04em; transform: skewX(-9deg); transform-origin: left bottom; }
.fig-mm { font-weight: 600; font-size: clamp(3.5rem, 18vw, 9rem); line-height: 1; letter-spacing: -0.02em; color: transparent; text-shadow: 0.16em 0.1em 0 rgba(13, 13, 14, 0.9); }
.fig-puck { width: clamp(144px, 40vw, 280px); aspect-ratio: 1; border-radius: 50%; border: 0.12em solid var(--ink); position: relative; font-size: clamp(144px, 40vw, 280px); display: none; }
html.no-gl .fig-puck { display: block; }
.fig-puck::before { content: ""; position: absolute; inset: 22%; border-radius: 50%; border: 0.05em solid var(--ink); }
.fig-puck i { position: absolute; left: 50%; top: 50%; width: 0.12em; height: 0.12em; margin: -0.06em 0 0 -0.06em; border-radius: 50%; background: var(--ink); }

/* reduced motion: nothing moves on its own, state changes are instant */
@media (prefers-reduced-motion: reduce) {
  .copy, #gl, .cta, .skip, .chapters i, #tick, #tick path { transition: none !important; }
  .copy { transform: none; }
}
