/* ============================================================
   SUNDER · art direction
   Derived, not preset: cold graphite (where Oryzo is warm),
   bone type-white (printed, not emitted), one signal accent
   with an alibi — the red of laser markers and CAD control points.
   ============================================================ */
:root {
  --void:   oklch(15% 0.008 260);   /* graphite: cold hue tint, never pure grey */
  --void-2: oklch(11% 0.008 255);   /* deeper layer for 2D chapter cards */
  --bone:   oklch(94% 0.01 90);     /* type-white warmed toward paper */
  --signal: oklch(58% 0.24 30);     /* laser/CAD marker red-orange. punctuation only */
  --radius: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--void); color-scheme: dark; scrollbar-width: none; }
html::-webkit-scrollbar { width: 0; height: 0; }

body {
  font-family: 'Space Grotesk', Archivo, system-ui, sans-serif;
  color: var(--bone);
  background: var(--void);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== TWO-SCALE TYPOGRAPHY =====
   Display grotesque for statement, monospace owning the whole
   utility layer so labels read as instrument printouts. */
.display {
  font-size: clamp(40px, 5.4vw, 92px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.display-mid {
  font-size: clamp(32px, 4vw, 64px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* giant text that slides BEHIND the object */
.giant {
  font-size: clamp(90px, 16vw, 260px);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: -0.04em;
  color: var(--bone);
  opacity: 0.13;
  white-space: nowrap;
}

.annotation, .kicker, .pill, .spec-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;   /* mono runs wide — cut caps tracking */
  text-transform: uppercase;
}

.annotation { opacity: 0.55; line-height: 1.7; }
.kicker { color: var(--signal); margin-bottom: 18px; }

.body-copy {
  font-size: 15px;
  line-height: 1.55;
  max-width: 34ch;
  opacity: 0.62;
  margin-top: 20px;
}

/* ===== LAYER STACK =====
   behind-text (1) < canvas (2) < blueprint (3) < front-text (4)
   < 2D chapters (5) < UI (10). Everything fixed, everything
   driven by one master scroll progress. */
.layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.layer-behind { z-index: 1; }
#stage { position: fixed; inset: 0; z-index: 2; display: block; width: 100%; height: 100%; }
.blueprint { z-index: 3; color: var(--bone); opacity: 0; }
.layer-front { z-index: 4; }
.chapter-2d { z-index: 5; opacity: 0; }

/* beats are opacity/transform-driven from the chapter map */
.beat { position: absolute; opacity: 0; }

.layer-behind .beat {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ===== HERO COPY ===== */
.hero-copy {
  left: 5vw;
  top: 50%;
  transform: translateY(-50%);
  max-width: 42ch;
}

.kicker-beat {
  left: 5vw;
  bottom: 16vh;
  max-width: 38ch;
}

/* ===== FINALE =====
   Headline top, CTA bottom, object resting in the gap between them.
   Centring the copy put it straight through the earcups. */
#layer-finale { z-index: 6; }
.finale-copy {
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding: 13vh 5vw 15vh;
}
.finale-cta { display: grid; gap: 18px; justify-items: center; }

/* ===== NAV ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 5vw;
  mix-blend-mode: difference;
}

.wordmark {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--bone);
  text-decoration: none;
}

.nav-statement {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  opacity: 0.5;
}

/* ===== PILL BUTTONS ===== */
.pill {
  background: var(--bone);
  color: var(--void);
  border: none;
  cursor: pointer;
  padding: 13px 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  will-change: transform;
}
.pill .dot { color: var(--signal); font-weight: 700; }

/* ===== EDGE TAB ===== */
.edge-tab {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 10;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: right center;
  padding-right: 22px;
  opacity: 0.35;
  white-space: nowrap;
}

/* ===== REGISTRATION MARKS ===== */
.registration {
  position: fixed;
  z-index: 9;
  font-size: 11px;
  opacity: 0.35;
  color: var(--bone);
  pointer-events: none;
  font-family: 'IBM Plex Mono', monospace;
}
.registration.tl { top: 20px; left: 22px; }
.registration.tr { top: 20px; right: 22px; }
.registration.bl { bottom: 20px; left: 22px; }
.registration.br { bottom: 20px; right: 22px; }

/* ===== VU LEVEL METER (scroll progress as an instrument) ===== */
.vu-meter {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
}
.vu-label, .vu-readout { opacity: 0.45; }
.vu-readout { width: 9ch; text-align: left; white-space: nowrap; }
.vu-segments { display: flex; gap: 3px; align-items: flex-end; height: 14px; }
.vu-seg {
  width: 3px;
  background: var(--bone);
  opacity: 0.18;
  border-radius: 1px;
  transition: opacity 0.18s linear, background-color 0.18s linear;
}
.vu-seg.lit { opacity: 0.85; }
.vu-seg.peak { background: var(--signal); opacity: 1; }

/* ===== CHAPTER READOUT ===== */
.chapter-readout {
  position: fixed;
  left: 5vw; bottom: 30px;
  z-index: 10;
  opacity: 0.4;
}

/* ===== 2D CHAPTER · CAROUSEL ===== */
#chapter-carousel { display: flex; flex-direction: column; justify-content: center; }
.carousel-head {
  position: absolute;
  top: 14vh; left: 5vw; right: 5vw;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.carousel-head .kicker { margin-bottom: 0; }

.carousel-track {
  display: flex;
  gap: 3vw;
  padding: 0 5vw;
  will-change: transform;
  pointer-events: auto;
  cursor: grab;
}
.carousel-track.dragging { cursor: grabbing; }

.card {
  position: relative;
  flex: 0 0 30vw;
  min-width: 340px;
  background: var(--void-2);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  will-change: transform;
  transform-style: preserve-3d;
}

/* ghost index numeral bleeding off the card corner — depth for free */
.ghost-index {
  position: absolute;
  right: -14px; bottom: -46px;
  font-size: 180px;
  font-weight: 500;
  line-height: 1;
  color: var(--bone);
  opacity: 0.05;
  pointer-events: none;
}

.card-media {
  height: 40vh;
  border-radius: 12px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255,255,255,0.14), transparent 60%),
    var(--sw, #3A3D42);
  position: relative;
  overflow: hidden;
}
/* a drawn tick rule across the swatch — instrument, not decoration */
.card-media::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 26px;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.3) 0 1px, transparent 1px 14px);
}

.card-foot h3 { font-size: 26px; font-weight: 400; margin-bottom: 6px; letter-spacing: -0.01em; }
.drag-hint { position: absolute; bottom: 12vh; left: 5vw; }

/* ===== 2D CHAPTER · SPECS ===== */
#chapter-specs { padding: 0 5vw; display: flex; flex-direction: column; justify-content: center; }
.specs-head { margin-bottom: 6vh; }
.specs-table { border-top: 1px solid rgba(255,255,255,0.1); }

.spec-row {
  display: grid;
  grid-template-columns: 16ch 1fr 22ch;
  gap: 24px;
  align-items: baseline;
  padding: 2.4vh 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  will-change: transform;
}
.spec-label { opacity: 0.45; }
.spec-value { font-size: clamp(22px, 2.4vw, 40px); font-weight: 400; letter-spacing: -0.02em; }
.spec-note { text-align: right; }

/* ===== SPLIT TEXT MASK ===== */
.split-line { overflow: hidden; }

/* ===== SCROLL LENGTH + FOOTER ===== */
#page { position: relative; z-index: 0; pointer-events: none; }
.spacer { width: 100%; }

.footer {
  position: relative;
  z-index: 7;
  background: var(--void);
  padding: 10vh 5vw 6vh;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,0.08);
}
/* the credit and legal links in the footer: the page sets no global anchor style */
.footer a { color: var(--bone); text-decoration: none; border-bottom: 1px solid var(--signal); }
.footer a:hover { color: var(--signal); }

/* ===== CAROUSEL · center-focus bench ===== */
.carousel-track { position: relative; }
/* focus dims the off-centre cards; scale/lift come from GSAP */
.card { opacity: calc(0.42 + var(--focus, 1) * 0.58); transition: box-shadow 0.3s; }
.card.selected { box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--signal) 55%, transparent); }

.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-sel { color: var(--signal); opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
.card.selected .card-sel { opacity: 1; }

.card-metric { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.metric-bar { flex: 1; height: 3px; background: rgba(255,255,255,0.12); border-radius: 2px; position: relative; overflow: hidden; }
.metric-bar::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: calc(var(--m, 0) * 100%); background: var(--bone); border-radius: 2px;
}
.metric-num { opacity: 0.7; }

/* pointer-tracked specular sheen on each swatch */
.sheen {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,0.4), transparent 46%);
  mix-blend-mode: screen; transition: opacity 0.35s;
}
.card-media.lit .sheen { opacity: 1; }

/* clickable finish rail */
.carousel-rail {
  position: absolute; bottom: 19vh; left: 5vw; right: 5vw;
  display: flex; justify-content: center; gap: 22px; pointer-events: none;
}
.rail-node {
  background: none; border: none; padding: 4px; cursor: pointer; pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 8px; opacity: 0.45;
  transition: opacity 0.3s; font: inherit;
}
.rail-node:hover { opacity: 0.8; }
.rail-node.on { opacity: 1; }
.rail-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bone); opacity: 0.5; transition: all 0.3s; }
.rail-node.on .rail-dot { background: var(--signal); opacity: 1; box-shadow: 0 0 0 4px color-mix(in oklch, var(--signal) 22%, transparent); }
.rail-name { opacity: 0; transition: opacity 0.3s; }
.rail-node.on .rail-name, .rail-node:hover .rail-name { opacity: 0.7; }

/* ===== 2D CHAPTER · ACOUSTICS ===== */
#chapter-acoustics { display: flex; flex-direction: column; justify-content: center; padding: 13vh 5vw 11vh; gap: 4vh; }
.acoustics-head { max-width: 56ch; }
.acoustics-head .display-mid { margin: 12px 0 14px; }

.fr-plot { position: relative; width: 100%; height: 44vh; pointer-events: none; }
#fr-svg { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--bone); overflow: visible; }
#fr-grid line { stroke-width: 1; }
.fr-curve { stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#fr-curve-l { filter: drop-shadow(0 0 6px color-mix(in oklch, var(--bone) 30%, transparent)); }
#fr-curve-r { filter: drop-shadow(0 0 7px color-mix(in oklch, var(--signal) 45%, transparent)); opacity: 0.92; }

.fr-labels { position: absolute; left: 0; right: 0; bottom: -24px; height: 18px; }
.fr-labels span { position: absolute; transform: translateX(-50%); opacity: 0.5; }

.fr-readout {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 18px; align-items: baseline;
  padding: 10px 16px; border-radius: 10px;
  background: color-mix(in oklch, var(--void) 62%, transparent);
  backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.08);
}
.fr-readout .ro-f { font-family: 'IBM Plex Mono', monospace; font-size: 20px; letter-spacing: 0.02em; }
.fr-readout .ro-ch { font-family: 'IBM Plex Mono', monospace; font-size: 12px; opacity: 0.8; }
.fr-readout .ro-ch i { opacity: 0.5; font-style: normal; margin-right: 3px; }
.fr-readout .ro-ch.sig { color: var(--signal); opacity: 1; }
.fr-readout .ro-d { font-family: 'IBM Plex Mono', monospace; font-size: 11px; opacity: 0.5; }

/* ===== 2D CHAPTER · SOUNDSTAGE ===== */
#chapter-field { display: flex; align-items: center; justify-content: center; gap: 3.5vw; padding: 13vh 5vw; }
.field-head { flex: 0 0 30ch; max-width: 30ch; }
.field-head .display-mid { margin: 12px 0 14px; }

.stage-field {
  position: relative; flex: 0 0 auto;
  width: min(44vw, 52vh); height: min(44vw, 52vh);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 16px;
  background: radial-gradient(120% 120% at 50% 30%, rgba(255,255,255,0.05), transparent 60%), var(--void-2);
  overflow: hidden; pointer-events: auto; cursor: crosshair; touch-action: none;
}
.field-grid {
  position: absolute; inset: 0; opacity: 0.5;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 11%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 11%);
}
.field-axis { position: absolute; background: rgba(255,255,255,0.16); }
.field-axis-v { left: 50%; top: 0; bottom: 0; width: 1px; }
.field-axis-h { top: 50%; left: 0; right: 0; height: 1px; }
.field-ear {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; opacity: 0.5; letter-spacing: 0.1em;
}
.field-ear-l { left: 12px; }
.field-ear-r { right: 12px; }
.field-source { position: absolute; left: 50%; top: 42%; width: 30px; height: 30px; transform: translate(-50%, -50%); cursor: grab; }
.stage-field:active .field-source, .field-source:active { cursor: grabbing; }
.src-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--signal); box-shadow: 0 0 18px color-mix(in oklch, var(--signal) 60%, transparent);
}
.src-ring::after {
  content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--signal);
}
.src-label { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); white-space: nowrap; opacity: 0.6; }
.field-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); transition: opacity 0.5s; }

.field-meters { flex: 0 0 auto; display: flex; gap: 20px; align-items: stretch; height: min(44vw, 52vh); }
.ch-meter { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ch-bar {
  position: relative; width: 12px; flex: 1;
  background: rgba(255,255,255,0.07); border-radius: 6px; overflow: hidden;
  display: flex; align-items: flex-end;
}
.ch-bar span {
  display: block; width: 100%; height: 100%;
  background: var(--bone); border-radius: 6px;
  transform-origin: bottom; transform: scaleY(0);
}
.ch-meter.bleed .ch-bar span { background: var(--signal); }
.ch-db { width: 7ch; text-align: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  #chapter-field { flex-direction: column; gap: 4vh; }
  .field-head { flex-basis: auto; }
  .stage-field { width: min(78vw, 40vh); height: min(78vw, 40vh); }
  .field-meters { height: min(78vw, 40vh); gap: 14px; }
  .fr-readout { position: static; margin-top: 12px; align-self: flex-start; }
  .carousel-rail { gap: 12px; bottom: 16vh; }
  .rail-name { display: none; }
}
@media (max-width: 860px) {
  .nav-statement, .edge-tab { display: none; }
  .card { flex: 0 0 78vw; min-width: 0; }
  .spec-row { grid-template-columns: 12ch 1fr; }
  .spec-note { display: none; }
  .vu-segments { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .spec-row, .pill { will-change: auto; }
}

/* ---------------- legal pages (privacy, terms) ----------------
   Plain documents on the same graphite: an index down the left, the text
   on the right. No three.js, no scroll rig — they always render. */

.legal-main { padding: 0 clamp(22px, 4vw, 54px); max-width: 1440px; margin: 0 auto; }
.legal-head { padding: 18vh 0 0; display: grid; gap: 20px; max-width: 62ch; }
.legal-head .display { font-size: clamp(44px, 8vw, 118px); }
.legal-lede { font-size: clamp(15px, 1.5vw, 20px); line-height: 1.55; opacity: 0.82; max-width: 52ch; }

.legal-grid {
  display: grid; grid-template-columns: minmax(170px, 1fr) minmax(0, 2.7fr);
  gap: 40px clamp(28px, 6vw, 110px); align-items: start;
  padding: 10vh 0 12vh;
}
.legal-index { position: sticky; top: 40px; }
.legal-index ol { list-style: none; display: grid; gap: 10px; counter-reset: part; }
.legal-index li { counter-increment: part; }
.legal-index a { color: var(--bone); opacity: 0.6; text-decoration: none; }
.legal-index a::before { content: counter(part, decimal-leading-zero) "  "; color: var(--signal); opacity: 1; white-space: pre; }
.legal-index a:hover { opacity: 1; }

.legal-body { display: grid; gap: 56px; }
.legal-part { border-top: 1px solid oklch(60% 0.01 260 / 0.22); padding-top: 18px; display: grid; gap: 14px; scroll-margin-top: 40px; }
.legal-part h2 { font-size: clamp(24px, 3vw, 40px); font-weight: 400; line-height: 1.12; letter-spacing: -0.02em; }
.legal-part p, .legal-part li { font-size: 16px; line-height: 1.65; opacity: 0.8; max-width: 64ch; }
.legal-part a { color: var(--bone); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--signal); }
.legal-list { list-style: disc; padding-left: 1.2em; display: grid; gap: 8px; }
.legal-list li::marker { color: var(--signal); }

.legal-table { overflow-x: auto; }
.legal-table table { border-collapse: collapse; width: 100%; font-size: 15px; }
.legal-table th {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  text-align: left; font-size: 11px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; opacity: 0.5;
  padding: 0 16px 10px 0; border-bottom: 1px solid oklch(60% 0.01 260 / 0.22);
}
.legal-table td { vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 1px solid oklch(60% 0.01 260 / 0.12); opacity: 0.8; }
.legal-table td:first-child { opacity: 1; white-space: nowrap; }

.legal-foot {
  border-top: 1px solid oklch(60% 0.01 260 / 0.22);
  padding: 26px clamp(22px, 4vw, 54px) 44px;
  display: flex; flex-wrap: wrap; gap: 10px 32px; justify-content: space-between;
}
.legal-foot a { color: var(--bone); text-decoration: none; border-bottom: 1px solid var(--signal); }
.legal-foot a:hover { color: var(--signal); }

@media (max-width: 860px) {
  .legal-grid { grid-template-columns: 1fr; }
  .legal-index { position: static; }
}
