@font-face {
  font-family: "Mona Sans";
  src: url("/fonts/MonaSans.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Departure Mono";
  src: url("/fonts/DepartureMono.woff2") format("woff2");
  font-display: swap;
}

@property --stage-accent { syntax: "<color>"; inherits: true; initial-value: #8b7bff; }

:root {
  --bg: #07080c;
  --border: #1d212c;
  --text: #eef0f5;
  --muted: #8f98ab;
  --dim: #5c6477;
  --accent: #8b7bff;
  --sans: "Mona Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* A pixel mono, set at 11px multiples so it stays crisp. */
  --mono: "Departure Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
  transition: --stage-accent 1.2s ease;
}

* { box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) {
  .aurora { animation: none; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }

/* No backdrop-filter anywhere over the canvas: it re-blurs the animating
   field every frame and was the main cause of dropped frames. */
/* Depth, back to front: aurora + ghost title, particles (which go soft
   behind the text, in the shader), overlay lines, then the content. */
.backdrop, #stage, #fx { position: fixed; inset: 0 auto auto 0; width: 100vw; height: 100vh; height: 100lvh; pointer-events: none; }
.backdrop { z-index: 0; overflow: hidden; }
#stage { z-index: 1; }
#fx { z-index: 3; }
.no-gl #stage, .no-gl #fx { display: none; }

.aurora {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--stage-accent), transparent);
  opacity: 0.16;
  will-change: transform;
}
.a1 { left: 40vw; top: -20vmax; translate: calc(var(--mx, 0) * -50px) calc(var(--my, 0) * -40px); animation: drift1 26s ease-in-out infinite alternate; }
.a2 { left: 62vw; top: 30vh; opacity: 0.12; translate: calc(var(--mx, 0) * -90px) calc(var(--my, 0) * -60px); animation: drift2 32s ease-in-out infinite alternate; }
.a3 { left: -20vmax; top: 50vh; opacity: 0.07; translate: calc(var(--mx, 0) * -30px) calc(var(--my, 0) * -20px); animation: drift1 40s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(-8vw, 10vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(6vw, -12vh) scale(0.9); } }

/* The ghost title is drawn already blurred into a canvas (stage.js) and
   only moved here, so it costs nothing per frame. */
.ghost {
  position: absolute;
  right: -4vw;
  top: 50%;
  opacity: 0.16;
  will-change: transform, opacity;
  transition: opacity 0.3s;
}
.ghost.swap { opacity: 0; }


.no-gl body { background: radial-gradient(60% 50% at 75% 40%, rgb(139 123 255 / 0.14), transparent 70%) fixed, var(--bg); }

/* Top bar */
.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px clamp(20px, 4vw, 48px);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  background: linear-gradient(var(--bg), rgb(7 8 12 / 0));
}
.top .mark { color: var(--text); font-weight: 600; text-decoration: none; }
.hud { color: var(--muted); font-variant-numeric: tabular-nums; }
.sound {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.03);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.sound:hover { color: var(--text); border-color: #2c3240; }
.sound i { width: 14px; height: 10px; display: inline-block;
  background: linear-gradient(currentColor, currentColor) 0 100% / 2px 40% no-repeat,
              linear-gradient(currentColor, currentColor) 4px 100% / 2px 100% no-repeat,
              linear-gradient(currentColor, currentColor) 8px 100% / 2px 60% no-repeat,
              linear-gradient(currentColor, currentColor) 12px 100% / 2px 30% no-repeat; }
.sound[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }
.sound[aria-pressed="true"] i { animation: eq 0.9s ease-in-out infinite alternate; }
@keyframes eq { to { background-size: 2px 90%, 2px 30%, 2px 100%, 2px 70%; } }

/* Chapter index */
.index {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 10;
}
.index ol { list-style: none; margin: 0; padding: 6px; display: flex; gap: 4px; border: 1px solid var(--border); border-radius: 999px; background: rgb(10 11 16 / 0.86); }
.index a {
  font-stretch: 90%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.index a span { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.index a:hover { color: var(--text); }
.index li.on a { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* Chapters */
main { position: relative; z-index: 4; }
.chapter {
  position: relative;
  min-height: 190vh;
  padding: 0 clamp(20px, 5vw, 72px);
}
.panel {
  position: sticky;
  top: 0;
  min-height: 100vh;
  max-width: min(560px, 44vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 96px 0 64px;
}
/* Each chapter fades and focuses in as it arrives; its parts move at
   different speeds (--l is progress through the chapter, set by stage.js). */
.js .panel { opacity: var(--vis, 1); }
.js .panel > * { transform: translate(calc(var(--mx, 0) * var(--px, 0px)), calc((0.4 - var(--l, 0.4)) * var(--py, 0px))); }
.js .panel .count { --py: 260px; --px: -6px; }
.js .panel h2 { --py: 170px; --px: -14px; }
.js .panel .meta { --py: 120px; --px: -8px; }
.js .panel .blurb { --py: 90px; --px: -5px; }
.js .panel .stats { --py: 60px; --px: -3px; }
.js .panel .tags, .js .panel .links { --py: 40px; }
.js .intro .panel > * { transform: translate(calc(var(--mx, 0) * var(--px, 0px)), calc(var(--l, 0) * var(--py, 0px) * -1)); }
.js .intro h1 { --py: 260px; --px: -16px; }
.js .intro .links { --py: 140px; }
.js .intro .latest { --py: 90px; }

.intro { min-height: 150vh; }
.intro .panel { max-width: min(760px, 62vw); justify-content: flex-end; padding-bottom: clamp(56px, 10vh, 112px); }
.intro.solo { min-height: 100vh; }
.intro h1 + .links { margin-top: 44px; }

h1 {
  margin: 0 0 0 -0.04em;
  font-size: clamp(3.5rem, 11vw, 10.5rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 0.86;
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #fff 30%, #b7bdd0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* One word per line, always: the letters change width, and if the name were
   allowed to wrap it would flip between one and two lines and jump. */
.kinetic .word { display: block; white-space: nowrap; }
.kinetic .ch { font-variation-settings: "wdth" 100, "wght" 800; }

.headline {
  margin: 28px 0 10px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 550;
  letter-spacing: -0.02em;
  line-height: 1.2;
  max-width: 24ch;
}
.tagline { margin: 0; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.125rem); max-width: 52ch; }
.hint {
  position: absolute;
  top: calc(100vh - 100px);
  right: clamp(20px, 5vw, 72px);
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--dim);
}

.count { margin: 0 0 18px; font-family: var(--mono); font-size: 22px; line-height: 1; color: var(--accent); }
/* Chapter titles unfold: narrow and light as they arrive, wide and heavy
   once the chapter is in view. */
h2 {
  margin: 0;
  font-size: clamp(2.5rem, 5.2vw, 5rem);
  font-weight: calc(380 + var(--vis, 1) * 480);
  font-stretch: calc(75% + var(--vis, 1) * 50%);
  line-height: 0.95;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
h2 a { text-decoration: none; }
h2 a:hover { color: var(--accent); }
.outro h2 { font-size: clamp(2.25rem, 5vw, 4.25rem); }
.solo h1 { font-stretch: 125%; }

.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 0; font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.lang { display: inline-flex; align-items: center; gap: 6px; }
.lang i { width: 8px; height: 8px; border-radius: 50%; }
.blurb { margin: 20px 0 0; color: #b4bccb; font-size: 1.075rem; font-stretch: 96%; max-width: 50ch; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 24px 0 0; background: var(--border); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.stats div { background: rgb(14 16 22 / 0.82); padding: 14px 16px; }
.stats dt { font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 850; font-stretch: 125%; letter-spacing: -0.02em; line-height: 1.1; color: var(--accent); }
.stats dd { margin: 4px 0 0; color: var(--muted); font-size: 0.75rem; line-height: 1.35; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 0; padding: 0; }
.tags li {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  color: color-mix(in srgb, var(--accent) 80%, #fff);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}

.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgb(18 20 27 / 0.8);
  font-size: 0.925rem;
  font-weight: 620;
  font-stretch: 112%;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, font-stretch 0.25s;
}
.btn:hover { font-stretch: 125%; }
.btn:hover { background: rgb(255 255 255 / 0.08); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.btn.primary { background: #fff; color: var(--bg); border-color: #fff; }
.btn.primary:hover { background: #dfe2ea; }

.latest { display: flex; align-items: center; gap: 10px; margin: 32px 0 0; font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.latest i { width: 8px; height: 8px; border-radius: 50%; }
.latest a { color: var(--text); }

footer.site {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding: 40px clamp(20px, 5vw, 72px) 56px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.85rem;
  color: var(--dim);
}
footer.site p { margin: 0; max-width: 64ch; }

@media (max-width: 820px) {
  .index, .hud, .hint { display: none; }
  .ghost { top: 30%; right: auto; left: 50%; }
  .js .panel > * { --px: 0px !important; }
  .top { grid-template-columns: 1fr auto; }
  .chapter { min-height: 170vh; }
  .panel, .intro .panel { max-width: none; justify-content: flex-end; padding: 52vh 0 40px; }
  .panel > * { position: relative; }
  .stats { grid-template-columns: 1fr; }
  .stats div { display: flex; align-items: baseline; gap: 12px; }
}
