/* ============================================================
   Pinavia v4 — The Decision
   Locked token set (nexus design system). Do not invent hexes.
   ============================================================ */

:root {
  --bg: #080D18;
  --surface: #0B1220;
  --panel: #101827;
  --hairline: #263249;
  --text: #F7FAFF;
  --muted: #A8B3C7;
  --mint: #64D8C4;
  --amber: #F3C969;
  --rose: #F08AA0;
  --sky: #8FC5FF;
  --violet: #7A3FF2;
  --lime: #86BC25;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r-interactive: 8px;
  --r-container: 12px;

  --fs-12: 12px; --fs-14: 14px; --fs-16: 16px; --fs-20: 20px;
  --fs-24: 24px; --fs-32: 32px; --fs-40: 40px;
  --fs-display: clamp(56px, 7.5vw, 112px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: var(--fs-16);
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(100, 216, 196, 0.25); color: var(--text); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- loading state ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 700ms var(--ease);
}
#loader .wordmark {
  font-size: var(--fs-20);
  letter-spacing: 0.42em;
  font-weight: 600;
  color: var(--text);
  animation: loader-pulse 2.2s var(--ease) infinite;
}
@keyframes loader-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
#loader.done { opacity: 0; pointer-events: none; }

/* ---------- scroll track ---------- */
#scroll-track { width: 1px; }

/* ---------- fixed stage ---------- */
#stage {
  position: fixed; inset: 0;
  overflow: hidden;
}
#webgl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* atmosphere fallback layers (procedural, replaces A1/A2 when Higgsfield unavailable) */
.atmo {
  position: absolute; inset: -10%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms var(--ease);
}
.atmo.a1 {
  background:
    radial-gradient(120% 90% at 22% 12%, rgba(63, 82, 112, 0.16) 0%, rgba(8, 13, 24, 0) 55%),
    radial-gradient(90% 70% at 70% 80%, rgba(30, 41, 61, 0.10) 0%, rgba(8, 13, 24, 0) 60%),
    var(--bg);
}
.atmo.a2 {
  background:
    radial-gradient(130% 100% at 50% 50%, rgba(8, 13, 24, 0) 30%, rgba(37, 52, 77, 0.14) 100%),
    radial-gradient(100% 80% at 18% 10%, rgba(56, 76, 108, 0.12) 0%, rgba(8, 13, 24, 0) 55%),
    var(--bg);
}
.grain {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  z-index: 3;
}

/* cinematic vignette above the canvas, below the copy */
#stage::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(120% 90% at 50% 42%, rgba(4, 7, 14, 0) 52%, rgba(4, 7, 14, 0.55) 100%);
}

/* ---------- scroll progress line ---------- */
#progress-line {
  position: fixed; top: 0; right: 0; z-index: 60;
  width: 2px; height: 100vh;
  background: rgba(38, 50, 73, 0.5);
}
#progress-line .fill {
  display: block; width: 100%; height: 0%;
  background: var(--mint);
  opacity: 0.8;
}

/* ---------- header ---------- */
#site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: rgba(8, 13, 24, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(38, 50, 73, 0.6);
  transform: translateY(0);
  transition: background 200ms var(--ease);
}
#site-header.visible { transform: translateY(0); }
#site-header .wordmark {
  font-size: var(--fs-14); font-weight: 600; letter-spacing: 0.34em;
  text-decoration: none;
}
.cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px;
  background: var(--lime); color: #0A1204;
  font-size: var(--fs-14); font-weight: 600; letter-spacing: 0.01em;
  border: none; border-radius: var(--r-interactive);
  text-decoration: none; cursor: pointer;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(134, 188, 37, 0.25); }
.cta:active { transform: translateY(0); }
#site-header .cta { min-height: 40px; padding: 8px 16px; font-size: var(--fs-12); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 8px 16px;
  font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: var(--r-interactive);
  text-decoration: none;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* ---------- copy sections (fixed overlays, opacity driven by JS) ---------- */
.section {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 24px;
  opacity: 0; visibility: hidden;
  pointer-events: none;
}
.section.on { visibility: visible; }
.section.on .interactive, .section.on a, .section.on button { pointer-events: auto; }

.section .inner { max-width: 880px; margin: 0 auto; }

/* The 3D scene is supporting evidence, never a reason to make the copy hard to read. */
.copy-panel,
.hero-panel {
  position: relative;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid rgba(143, 197, 255, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(11, 18, 32, 0.90), rgba(8, 13, 24, 0.68));
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.hero-panel {
  max-width: 920px !important;
  border-color: rgba(100, 216, 196, 0.26);
  background:
    linear-gradient(110deg, rgba(11, 18, 32, 0.96), rgba(11, 18, 32, 0.76)),
    radial-gradient(circle at 78% 22%, rgba(100, 216, 196, 0.15), transparent 46%);
}
.hero-section .headline-display { max-width: 14ch; margin-inline: auto; }
.copy-panel .support,
.hero-panel .support { color: #D5DDEC; }

.eyebrow {
  font-size: var(--fs-12); font-weight: 600;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}

h1, h2 { letter-spacing: -0.02em; font-weight: 600; }

.headline-display {
  font-size: var(--fs-display);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.headline-lg { font-size: clamp(32px, 4.4vw, 56px); line-height: 1.08; }
.headline-md { font-size: var(--fs-32); line-height: 1.15; }

.support {
  font-size: var(--fs-20);
  color: var(--muted);
  max-width: 62ch;
  margin: 24px auto 0;
}
.support strong { color: var(--text); font-weight: 600; }

.proof-strip {
  margin-top: 32px;
  font-size: var(--fs-12);
  letter-spacing: 0.06em;
  color: var(--muted);
}
.trial-note {
  margin-top: 12px;
  font-size: var(--fs-12);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.cta-row {
  display: flex; gap: 24px; align-items: center; justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}
.secondary-link {
  font-size: var(--fs-14); color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding: 10px 2px;
  min-height: 44px; display: inline-flex; align-items: center;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}
.secondary-link:hover { color: var(--text); border-color: var(--muted); }

/* scroll cue */
.scroll-cue {
  position: absolute; bottom: 32px; left: 50%;
  width: 1px; height: 48px;
  background: linear-gradient(to bottom, rgba(168, 179, 199, 0) 0%, rgba(168, 179, 199, 0.7) 100%);
  overflow: hidden;
}
.scroll-cue::after {
  content: ""; position: absolute; left: 0; top: -40%;
  width: 100%; height: 40%;
  background: var(--text);
  animation: cue-drop 2.1s var(--ease) infinite;
}
@keyframes cue-drop { 0% { top: -40%; } 70%, 100% { top: 110%; } }

/* section-level positioning variants */
.section .low { margin-top: auto; margin-bottom: 12vh; }
.section.align-left { align-items: flex-start; text-align: left; }
.section.align-left .inner { margin: 0 0 0 clamp(24px, 8vw, 128px); }

/* ---------- claims (exploded view captions) ---------- */
#claims-captions { justify-content: flex-end; }
.claim-caption {
  position: absolute; left: 50%; bottom: 10vh;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
  max-width: 560px;
  text-align: center;
  padding: 0 24px;
}
.claim-caption.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.claim-caption .k {
  font-size: var(--fs-12); letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 8px;
}
.claim-caption .t { font-size: var(--fs-24); font-weight: 600; letter-spacing: -0.01em; }

/* ---------- 3D-anchored DOM labels ---------- */
.tag3d {
  position: absolute; z-index: 25;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 400ms var(--ease);
  white-space: nowrap;
}
.tag3d.on { opacity: 1; }

.part-label {
  font-size: var(--fs-12);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-interactive);
  background: rgba(11, 18, 32, 0.8);
  backdrop-filter: blur(6px);
}
.part-label.hot { color: var(--text); border-color: var(--muted); }

/* telemetry panel (DOM overlay, never texture text) */
#telemetry {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--sky);
  background: rgba(11, 18, 32, 0.88);
  border: 1px solid rgba(143, 197, 255, 0.35);
  border-radius: var(--r-interactive);
  padding: 12px 16px;
  box-shadow: 0 0 32px rgba(143, 197, 255, 0.12), inset 0 0 24px rgba(143, 197, 255, 0.05);
  text-align: left;
  line-height: 1.7;
  pointer-events: none;
}
#telemetry .row { display: flex; gap: 16px; justify-content: space-between; }
#telemetry .lbl { color: rgba(143, 197, 255, 0.55); letter-spacing: 0.1em; }
#telemetry .val { color: var(--sky); }
#telemetry .bar {
  display: inline-block; width: 72px; height: 4px;
  background: rgba(143, 197, 255, 0.15); border-radius: 2px;
  vertical-align: middle; overflow: hidden;
}
#telemetry .bar i {
  display: block; height: 100%; width: 86%;
  background: var(--sky); border-radius: 2px;
  animation: bar-breathe 5s var(--ease) infinite;
}
@keyframes bar-breathe { 0%,100% { width: 84%; } 50% { width: 90%; } }
#telemetry .redact {
  display: inline-block; width: 84px; height: 10px;
  background: repeating-linear-gradient(90deg, rgba(143,197,255,0.5) 0 6px, rgba(143,197,255,0.15) 6px 8px);
  border-radius: 2px; vertical-align: middle;
}
#telemetry-caption {
  margin-top: 10px;
  font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 12px; color: var(--muted);
  letter-spacing: 0.02em;
  max-width: 320px; white-space: normal; text-align: left;
}

/* gate consequence line labels */
.gate-label {
  font-size: var(--fs-12);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--amber);
  text-shadow: 0 0 16px rgba(243, 201, 105, 0.35);
}

/* seal engraving */
#seal-engraving {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--mint);
  text-align: center;
  line-height: 1.9;
  text-shadow: 0 0 20px rgba(100, 216, 196, 0.35);
}

/* ---------- stat callouts (section 7) ---------- */
.stat-row {
  display: flex; gap: clamp(24px, 6vw, 64px);
  justify-content: center; flex-wrap: wrap;
  margin-top: 32px;
}
.stat { text-align: center; }
.stat .num {
  display: block;
  font-size: var(--fs-40); font-weight: 600; letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat .lab {
  display: block;
  font-size: var(--fs-12); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-top: 4px;
}

/* ---------- pull quote / audience ---------- */
blockquote.pull {
  font-size: clamp(28px, 3.6vw, 48px);
  line-height: 1.18; letter-spacing: -0.02em; font-weight: 600;
  max-width: 22ch; margin: 0 auto;
}
blockquote.pull::before { content: "\201C"; color: var(--muted); }
blockquote.pull::after { content: "\201D"; color: var(--muted); }
.attribution {
  margin-top: 24px;
  font-size: var(--fs-14); color: var(--muted); letter-spacing: 0.04em;
}

.audience-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  max-width: 1040px; margin: 64px auto 0;
  text-align: left;
}
.aud-note {
  margin-top: 32px;
  font-size: var(--fs-14);
  color: var(--muted);
  letter-spacing: 0.02em;
}
.audience {
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
  opacity: 0; transform: translateY(14px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}
.audience.on { opacity: 1; transform: none; }
.audience h3 { font-size: var(--fs-20); font-weight: 600; letter-spacing: -0.01em; margin-bottom: 8px; }
.audience p { font-size: var(--fs-14); color: var(--muted); }

/* ---------- closer / footer ---------- */
#closer .end-wordmark {
  font-size: var(--fs-24); font-weight: 600; letter-spacing: 0.42em;
  margin-top: 48px;
}
footer.site-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid rgba(38, 50, 73, 0.6);
  font-size: var(--fs-12); color: var(--muted);
}
footer.site-footer a { color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
footer.site-footer a:hover { color: var(--text); }
footer.site-footer .fm { letter-spacing: 0.3em; font-weight: 600; color: var(--text); }

/* ---------- WebGL fallback: clean text document ---------- */
#fallback { display: none; }
body.no-webgl #stage, body.no-webgl #progress-line,
body.no-webgl .section, body.no-webgl #scroll-track { display: none !important; }
body.no-webgl #fallback {
  display: block;
  max-width: 720px; margin: 0 auto; padding: 96px 24px;
}
body.no-webgl #site-header { transform: translateY(0); }
#fallback h1 { font-size: var(--fs-40); letter-spacing: -0.02em; margin-bottom: 16px; }
#fallback h2 { font-size: var(--fs-24); margin: 48px 0 12px; letter-spacing: -0.01em; }
#fallback p { color: var(--muted); margin-bottom: 16px; max-width: 65ch; }
#fallback .cta { margin-top: 24px; }

/* ---------- mobile ---------- */
@media (max-width: 1023px) {
  .audience-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .support { font-size: var(--fs-16); }
  .audience-grid { grid-template-columns: 1fr; gap: 24px; margin-top: 40px; }
  .claim-caption { bottom: 7vh; }
  .claim-caption .t { font-size: var(--fs-20); }
  #telemetry { padding: 10px 12px; }
  #telemetry-caption { max-width: 240px; }
  .stat .num { font-size: var(--fs-32); }
  footer.site-footer { justify-content: center; text-align: center; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-cue::after, #telemetry .bar i, #loader .wordmark { animation: none; }
  .section, .claim-caption, .audience, .tag3d { transition-duration: 300ms; }
  * { scroll-behavior: auto !important; }
}
