/* ============================================================
   BASE — reset, moving backdrop, ink, chrome, buttons
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: transparent;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, p, figure, blockquote, ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
img, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--red); color: #fff; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

/* ------------------------------------------------------------
   SCROLLBAR — thin, on-brand, instead of the OS default
   ------------------------------------------------------------ */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--ink-faint);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--hot); }
::-webkit-scrollbar-corner { background: transparent; }

/* ------------------------------------------------------------
   INK
   ------------------------------------------------------------ */
.ink { color: var(--ink); }

.hot,
.ink b.hot,
.ink em.hot { color: var(--hot); font-style: normal; }

/* ---- the glow ----
   A soft halo lifts display type off the moving field instead of
   letting it sit flat on it. Only large text gets this; at caption
   size a halo just reads as blur. */
.glow      { text-shadow: 0 0 clamp(10px, 1.4vw, 30px) var(--glow-ink); }
.glow .hot,
.hot.glow  { text-shadow: 0 0 clamp(12px, 1.7vw, 34px) var(--glow-hot); }

/* ------------------------------------------------------------
   BACKDROP — a dark room with a light moving through it
   ------------------------------------------------------------
   Two big diagonal sheens slide across each other while four soft
   blooms drift over them: three cool, one ember-warm so the brand's
   red is in the air rather than only in the accents. Every period is
   a different length (34/41/29/46/53s) so the field never lands back
   on an arrangement you have already seen.

   Only transforms and opacity animate — nothing is scaled, blurred
   or repainted at runtime, so the whole field stays on the
   compositor and costs nothing to keep running.
   ------------------------------------------------------------ */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background-color: var(--pitch);
}

/* Two big diagonal bands sliding across each other on different
   periods and angles. Deliberately not a conic gradient: a conic has
   a singularity at its origin, and a rotating one puts a visible
   pinwheel pinch right in the middle of the page. Deliberately not a
   giant rotating square either — sized to cover the viewport under
   its own travel and no more, because a layer several times the
   screen costs tens of megabytes of texture at 2x density. */
.backdrop__sweep,
.backdrop__sweep::before {
  position: absolute;
  top: -22%;
  left: -22%;
  width: 144%;
  height: 144%;
  will-change: transform;
}

.backdrop__sweep {
  background: var(--sheen-a);
  animation: sweep-a 46s var(--ease-in-out) infinite alternate;
}
.backdrop__sweep::before {
  content: "";
  top: -15%;
  left: -15%;
  width: 130%;
  height: 130%;
  background: var(--sheen-b);
  animation: sweep-b 61s var(--ease-in-out) infinite alternate;
}

@keyframes sweep-a { to { transform: translate3d(15%, 11%, 0); } }
@keyframes sweep-b { to { transform: translate3d(-13%, 14%, 0); } }

/* Pools of light, not a wash. Kept small and low so there is real
   dark between them — a big soft gradient spread over the whole
   viewport never reads as light, it just lifts the level, and that
   is what makes a moving background look like haze.

   Position/size lives on .backdrop__parallax; the blob inside is
   always inset:0 within it. Two separate transform-owning layers —
   js/pointer.js nudges the wrapper toward the cursor, the drift
   animation below keeps moving the blob inside it — so the two
   motions never fight over the same `transform` property. */
.backdrop__parallax {
  position: absolute;
  will-change: transform;
}
.backdrop__parallax--a { width: 58vmax; height: 58vmax; top: -16vmax; left: -12vmax; }
.backdrop__parallax--b { width: 52vmax; height: 52vmax; bottom: -14vmax; right: -10vmax; }
/* the ember — the brand red, tight and low, so it reads as warmth in
   the room rather than a coloured patch on the page */
.backdrop__parallax--c { width: 50vmax; height: 50vmax; top: 26%; left: 38%; }
.backdrop__parallax--d { width: 42vmax; height: 42vmax; top: 4%; right: 8%; }

.backdrop__blob {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  will-change: transform, opacity;
}

.backdrop__blob--a { background: var(--bloom-a); animation: drift-a 34s var(--ease-in-out) infinite alternate; }
.backdrop__blob--b { background: var(--bloom-b); animation: drift-b 41s var(--ease-in-out) infinite alternate; }
.backdrop__blob--c { background: var(--bloom-c); animation: drift-c 53s var(--ease-in-out) infinite alternate; }
.backdrop__blob--d { background: var(--bloom-d); animation: drift-d 46s var(--ease-in-out) infinite alternate; }

/* the vignette bites early — most of the frame stays at the base */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--vignette);
}

@keyframes drift-a { from { opacity: 0.8; } to { transform: translate3d(13vmax, 9vmax, 0);   opacity: 1;    } }
@keyframes drift-b { from { opacity: 1;   } to { transform: translate3d(-15vmax, -9vmax, 0); opacity: 0.6;  } }
@keyframes drift-c { from { opacity: 0.55;} to { transform: translate3d(-12vmax, 13vmax, 0); opacity: 1;    } }
@keyframes drift-d { from { opacity: 1;   } to { transform: translate3d(9vmax, -11vmax, 0);  opacity: 0.68; } }

@media (prefers-reduced-motion: reduce) {
  .backdrop__blob,
  .backdrop__sweep,
  .backdrop__sweep::before { animation: none; }
}

/* ------------------------------------------------------------
   GRAIN — 16mm dust over everything
   ------------------------------------------------------------ */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 90;
  pointer-events: none;
  opacity: var(--grain-alpha);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
  animation: grain-shift 700ms steps(1) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(-2%, 1%, 0); }
  50%  { transform: translate3d(1%, -2%, 0); }
  75%  { transform: translate3d(-1%, -1%, 0); }
  100% { transform: translate3d(2%, 1%, 0); }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

/* ------------------------------------------------------------
   VIEWFINDER CHROME
   ------------------------------------------------------------ */
.viewfinder {
  position: fixed;
  inset: clamp(0.8rem, 1.6vw, 1.6rem);
  z-index: 60;
  pointer-events: none;
}
.viewfinder__bracket {
  position: absolute;
  width: 26px; height: 26px;
  border: 1.5px solid var(--line);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease) 900ms;
}
body.is-live .viewfinder__bracket { opacity: 1; }
.viewfinder__bracket--tl { top: 0;    left: 0;  border-right: 0; border-bottom: 0; }
.viewfinder__bracket--tr { top: 0;    right: 0; border-left: 0;  border-bottom: 0; }
.viewfinder__bracket--bl { bottom: 0; left: 0;  border-right: 0; border-top: 0; }
.viewfinder__bracket--br { bottom: 0; right: 0; border-left: 0;  border-top: 0; }

/* ---- recording dot ----
   Only on while the header is: this is recording the intro, not the
   whole page. js/main.js toggles .is-header from an IntersectionObserver
   on #top, in both directions — scroll back up and it comes back. One
   transition serves both the first reveal and every later show/hide,
   so leaving and returning to the header feels the same as arriving. */
.rec {
  position: fixed;
  top: clamp(1.5rem, 2.6vw, 2.5rem);
  right: clamp(1.5rem, 2.6vw, 2.5rem);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 480ms var(--ease), transform 480ms var(--ease);
}
body.is-live .rec.is-header { opacity: 1; transform: none; }

.rec__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--hot);
  animation: rec-pulse 1.9s var(--ease-in-out) infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1;    box-shadow: 0 0 0 0 rgba(255,59,47,0.55), 0 0 16px 3px rgba(255,59,47,0.75); }
  55%      { opacity: 0.30; box-shadow: 0 0 0 8px rgba(255,59,47,0),  0 0 20px 4px rgba(255,59,47,0.25); }
}
@media (prefers-reduced-motion: reduce) { .rec__dot { animation: none; } }

.rec__label,
.rec__time {
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-mid);
  text-transform: uppercase;
  color: var(--hot);
}
.rec__time { color: var(--ink-faint); font-variant-numeric: tabular-nums; }

@media (max-width: 560px) { .rec__time { display: none; } }

/* ------------------------------------------------------------
   HUD — sound and theme, the two things you can change
   ------------------------------------------------------------
   Bottom-left, diagonally opposite the REC readout. Not top-left:
   that is where every section heading starts, and a fixed control
   parked there rides over each one as you scroll past.
   ------------------------------------------------------------ */
.hud {
  position: fixed;
  bottom: clamp(1.4rem, 2.4vw, 2.3rem);
  left: clamp(1.5rem, 2.6vw, 2.5rem);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.6rem);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 700ms var(--ease) 500ms, transform 700ms var(--ease) 500ms;
}
body.is-live .hud { opacity: 1; transform: none; }

.sfx, .theme {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.1rem;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-mid);
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color var(--t-fast) var(--ease);
}
.sfx:hover, .sfx:focus-visible,
.theme:hover, .theme:focus-visible { color: var(--ink); }

/* ---- light / dark ---- */
.theme__orb {
  position: relative;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  overflow: hidden;
}
.theme__orb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  clip-path: inset(0 0 0 50%);
  transition: clip-path var(--t-mid) var(--ease);
}
:root[data-theme="light"] .theme__orb::after { clip-path: inset(0 50% 0 0); }

.sfx__bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}
.sfx__bars i {
  width: 2px;
  height: 3px;
  background: currentColor;
  border-radius: 1px;
  transition: height var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.sfx[aria-pressed="true"] { color: var(--ink-soft); }
.sfx[aria-pressed="true"] .sfx__bars i { background: var(--hot); }
.sfx[aria-pressed="true"] .sfx__bars i:nth-child(1) { height: 5px;  animation: sfx-bar 1.1s var(--ease-in-out) infinite alternate; }
.sfx[aria-pressed="true"] .sfx__bars i:nth-child(2) { height: 11px; animation: sfx-bar 0.8s var(--ease-in-out) infinite alternate 140ms; }
.sfx[aria-pressed="true"] .sfx__bars i:nth-child(3) { height: 7px;  animation: sfx-bar 0.95s var(--ease-in-out) infinite alternate 280ms; }
@keyframes sfx-bar { from { height: 3px; } to { height: 11px; } }
@media (prefers-reduced-motion: reduce) { .sfx__bars i { animation: none !important; } }

/* muted: bars flat, struck through */
.sfx[aria-pressed="false"] .sfx__bars { position: relative; }
.sfx[aria-pressed="false"] .sfx__bars::after {
  content: "";
  position: absolute;
  left: -2px; right: -2px;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  transform: rotate(-32deg);
}

@media (max-width: 560px) { .sfx__label, .theme__label { display: none; } }

/* ------------------------------------------------------------
   SECTION RAIL — a chapter list, not a row of hints
   ------------------------------------------------------------
   Every name is on screen all the time; nothing has to be hovered to
   find out what it points at. A spine runs down the numbers with a
   marker that slides to whichever chapter you're actually in —
   js/main.js drives it with one custom property, --rail-i, set to
   the active row's index; the marker's position is pure CSS from
   there, so scrolling never recomputes a pixel offset in JS.
   ------------------------------------------------------------ */
.rail {
  --rail-row: 2.55rem;   /* fixed row height: what makes the marker math exact */
  --rail-i: 0;           /* which row is current, written by main.js */

  position: fixed;
  top: 50%;
  right: clamp(0.9rem, 1.8vw, 1.9rem);
  transform: translateY(-50%);
  z-index: 65;
  display: flex;
  align-items: center;

  padding: 0.6rem 1.1rem 0.6rem 0.9rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.55);

  opacity: 0;
  transition: opacity var(--t-slow) var(--ease), border-color var(--t-mid) var(--ease),
              background var(--t-mid) var(--ease);
}
body.is-live .rail { opacity: 1; }
.rail:hover, .rail:focus-within {
  border-color: var(--line);
  background: var(--glass-lit);
}
@media (max-width: 1039px), (max-height: 620px) { .rail { display: none; } }

.rail__list {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---- the spine + the marker that travels along it ---- */
.rail__spine {
  position: absolute;
  top: calc(var(--rail-row) / 2);
  bottom: calc(var(--rail-row) / 2);
  left: 1.55rem;
  width: 1px;
  background: var(--line-soft);
}
.rail__marker {
  position: absolute;
  left: calc(1.55rem - 2px);
  top: 0;
  width: 5px;
  height: 5px;
  margin-top: calc(var(--rail-row) / 2 - 2px);
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 0 3px rgba(255, 59, 47, 0.16), 0 0 12px 1px rgba(255, 59, 47, 0.75);
  transform: translateY(calc(var(--rail-i) * var(--rail-row)));
  transition: transform 420ms var(--ease);
}
@media (prefers-reduced-motion: reduce) { .rail__marker { transition: none; } }

/* ---- one row ---- */
.rail__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  height: var(--rail-row);
  padding-inline: 0.15rem;
  border-radius: 999px;
}
.rail__n {
  width: 1.5em;
  flex: none;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  transition: color var(--t-fast) var(--ease);
}
.rail__name {
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink-soft);
  transition: color var(--t-fast) var(--ease), letter-spacing var(--t-fast) var(--ease);
}

.rail__link:hover,
.rail__link:focus-visible { background: var(--line-soft); }
.rail__link:hover .rail__n,
.rail__link:focus-visible .rail__n { color: var(--ink-soft); }
.rail__link:hover .rail__name,
.rail__link:focus-visible .rail__name { color: var(--ink); letter-spacing: 0.17em; }

/* the current chapter: full brightness, a little heat, a glow that
   matches the marker sitting beside it */
.rail__link.is-here .rail__n { color: var(--hot); }
.rail__link.is-here .rail__name {
  color: var(--ink);
  text-shadow: 0 0 16px var(--glow-hot);
}


/* ------------------------------------------------------------
   LAYOUT
   ------------------------------------------------------------ */
main { position: relative; }

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: var(--bay);
}
.section--work { padding-top: clamp(3rem, 2rem + 4vw, 6rem); }
/* The wheel is tall; it needs the vertical room the padding would eat. */
.section--stills { padding-block: clamp(3.5rem, 2rem + 5vw, 7rem); }
/* Reading sections carry their own air inside the copy — the section
   padding on top of it would just push the heading off on its own. */
.section--read, .section--pricing { padding-block: clamp(4rem, 2.5rem + 6vw, 8.5rem); }
.section--read .head, .section--pricing .head { margin-bottom: clamp(1.6rem, 1rem + 2vw, 3rem); }

/* ---- section heads ---- */
.head { margin-bottom: clamp(2.5rem, 1.6rem + 3.4vw, 4.5rem); }

/* Staggered entrance, one beat apart. */
.head__index { --rise-delay: 0ms; }
.head__title { --rise-delay: 90ms; }
.head__note  { --rise-delay: 180ms; }

.head__index {
  display: block;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-wide);
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}
.head__index::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: clamp(28px, 5vw, 64px);
  height: 1px;
  margin-left: 0.9rem;
  background: currentColor;
  opacity: 0.7;
}

.head__title {
  font-family: var(--display);
  font-size: var(--step-3);
  line-height: 0.88;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.head__note {
  margin-top: 1.1rem;
  max-width: 42em;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.head__note kbd {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.1em 0.42em;
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* ------------------------------------------------------------
   REVEAL — applied directly to the blended element
   ------------------------------------------------------------ */
.ff-motion [data-rise] {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition:
    opacity var(--t-slow) var(--ease) var(--rise-delay, 0ms),
    transform var(--t-slow) var(--ease) var(--rise-delay, 0ms);
}
.ff-motion [data-rise].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .ff-motion [data-rise] { opacity: 1; transform: none; transition: none; }
}

/* ------------------------------------------------------------
   BUTTONS — glass pill, red on hover: border, label and glow all
   arrive together.
   ------------------------------------------------------------ */
.btn {
  --btn-line: var(--line);
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.82em 1.5em;
  border: 1px solid var(--btn-line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-mid);
  text-transform: uppercase;
  white-space: nowrap;
  transition:
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    letter-spacing var(--t-fast) var(--ease);
}

.btn:hover,
.btn:focus-visible {
  --btn-line: var(--hot);
  color: var(--hot);
  background: rgba(255, 59, 47, 0.10);
  box-shadow: 0 0 0 1px rgba(255, 59, 47, 0.35), 0 0 28px 2px rgba(255, 59, 47, 0.45);
  letter-spacing: 0.19em;
}
.btn:active { box-shadow: 0 0 0 1px rgba(255,59,47,0.55), 0 0 16px 1px rgba(255,59,47,0.65); }

