/* ============================================================
   base.css — reset, design tokens, typography, global chrome
   Palette CSS vars are set at runtime from src/config/palettes.js.
   Values below are the "Reactor" defaults so the page is styled
   before JS runs.
   ============================================================ */

:root {
  --bg:       #0B0A1F;
  --bg-soft:  #14122e;
  --text:     #ECEAFF;
  --muted:    #8E8AB8;
  --accent:   #19E3FF;
  --accent-2: #FF2E9A;
  --accent-3: #FFC53D;
  --line:     rgba(255, 255, 255, 0.12);

  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  --maxw: 1180px;
  --pad: clamp(1.25rem, 4vw, 4rem);
  --radius: 14px;

  color-scheme: dark;
}

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

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.7s ease, color 0.7s ease;
}

img, svg, canvas { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--bg); }

/* --- The three.js stage sits behind everything --- */
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  touch-action: pan-y;
}

main, .footer { position: relative; z-index: 1; }

/* Hide hero pieces until the intro reveals them; JS removes .is-loading.
   The <noscript> block in index.html restores them when JS is unavailable. */
.is-loading .hero__inner > * { opacity: 0; }

/* --- Discharge flash --- */
.flash {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* --- WebGL fallback notice --- */
.webgl-fallback {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 6;
  padding: 0.75rem var(--pad);
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: center;
}

/* --- Skip link --- */
.skip-link {
  position: fixed;
  top: -120%;
  left: 1rem;
  z-index: 50;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.skip-link:focus { top: 1rem; }

/* --- Brand mark (top-left) --- */
.brand {
  position: fixed;
  top: clamp(1rem, 2.5vw, 1.75rem);
  left: var(--pad);
  z-index: 20;
}
.brand__mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.brand__bolt {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 8px var(--accent));
}
.brand__name { font-size: 1.15rem; }

/* --- Shared typographic helpers --- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Focus visibility (quality floor) --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
