/* ─────────────────────────────────────────────────────────────
   KU BLITZ PLAN — base tokens, theme, typography
   Display: Bricolage Grotesque · Body: Instrument Sans · Data: JetBrains Mono
   ───────────────────────────────────────────────────────────── */
:root {
  --font-display: "Bricolage Grotesque", "Inter Tight", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, monospace;

  /* palette — dark is the "real" default */
  --navy-950: #050a18;
  --navy-900: #0a1430;
  --navy-800: #122050;
  --navy-700: #1b2f6e;
  --cobalt: #3b6bff;
  --cobalt-soft: #7a9bff;
  --falcon: #f2c14e;     /* gold highlight */
  --coral: #ff5d6c;
  --mint: #43e0b0;

  --bg: var(--navy-950);
  --bg-elev: rgba(255,255,255,0.045);
  --bg-elev-2: rgba(255,255,255,0.08);
  --line: rgba(255,255,255,0.10);
  --line-strong: rgba(255,255,255,0.22);
  --text: #eef1fb;
  --text-2: #aab3d1;
  --text-3: #6e789c;
  --accent: var(--cobalt);
  --accent-ink: #ffffff;
  --glow: 0 0 0 1px rgba(123,155,255,0.25), 0 20px 60px -20px rgba(59,107,255,0.55);
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 80px -30px rgba(0,0,0,0.8);

  --radius-s: 8px;
  --radius: 16px;
  --radius-l: 28px;
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --dur: 480ms;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f5fb;
  --bg-elev: rgba(10,20,48,0.04);
  --bg-elev-2: rgba(10,20,48,0.07);
  --line: rgba(10,20,48,0.10);
  --line-strong: rgba(10,20,48,0.22);
  --text: #0a1430;
  --text-2: #3d4a73;
  --text-3: #7a84a6;
  --accent: #2a55e6;
  --glow: 0 0 0 1px rgba(42,85,230,0.18), 0 20px 60px -24px rgba(42,85,230,0.45);
  --shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 30px 80px -40px rgba(10,20,48,0.35);
  color-scheme: light;
}

*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .6s var(--ease-out), color .6s var(--ease-out);
  overflow-x: hidden;
}
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; margin: 0; line-height: 1.05; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
code, .mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }

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

.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.eyebrow { font-size: 14px; color: var(--text-2); }

/* ── Top bar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 94%, transparent);
}
.brand { display: inline-flex; align-items: center; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.nav { display: flex; gap: 6px; align-items: center; }
.nav a, .nav button { padding: 8px 12px; border-radius: 999px; color: var(--text-2); font-size: 14px; transition: background .25s, color .25s; }
.nav a:hover, .nav button:hover { background: var(--bg-elev-2); color: var(--text); }

/* ── Theme switch (labels are intentionally inverted) ───── */
.theme-switch {
  display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-elev);
}
.theme-switch button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; color: var(--text-2); transition: all .35s var(--ease-out);
}
.theme-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: 0 6px 18px -8px rgba(0,0,0,.6); }
.theme-switch svg { width: 14px; height: 14px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: 15px; border: 1px solid var(--line-strong);
  background: var(--bg-elev); color: var(--text);
  transition: transform .35s var(--ease-spring), background .3s, border-color .3s, box-shadow .3s;
}
.btn:hover { transform: translateY(-2px); background: var(--bg-elev-2); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; }
.btn.sm { padding: 8px 14px; font-size: 13px; }

/* ── Footer ─────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); padding: 40px 0 60px; color: var(--text-3); font-size: 13px; }
.footer .cols { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 32px; }
.footer h4 { font-size: 14px; font-family: var(--font-body); color: var(--text); margin-bottom: 12px; font-weight: 600; letter-spacing: 0; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer a:hover { color: var(--text); }
.footer .fine { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); line-height: 1.6; max-width: 72ch; }
@media (max-width: 800px) { .footer .cols { grid-template-columns: 1fr 1fr; } }

/* ── Toasts ─────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 900; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 260px; max-width: 360px; padding: 12px 16px; border-radius: 14px;
  background: color-mix(in oklab, var(--bg) 60%, #000 10%); border: 1px solid var(--line-strong);
  backdrop-filter: blur(12px); box-shadow: var(--shadow); font-size: 14px;
  animation: toast-in .5s var(--ease-spring);
}
.toast b { color: var(--mint); }
.toast.warn b { color: var(--falcon); }
.toast.bad b { color: var(--coral); }
@keyframes toast-in { from { transform: translateY(20px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Optional retro CRT treatment (html[data-crt="1"]) ──
   Subtle scanlines, a soft vignette, a faint colour fringe on display type, and a slow phosphor flicker. */
html[data-crt="1"] body::before {
  content: ""; position: fixed; inset: 0; z-index: 3000; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; opacity: .9; animation: crt-flicker 4s steps(1) infinite;
}
html[data-crt="1"][data-theme="light"] body::before { background: repeating-linear-gradient(0deg, rgba(10,20,48,.12) 0 1px, transparent 1px 3px); }
html[data-crt="1"] body::after {
  content: ""; position: fixed; inset: 0; z-index: 3001; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.42) 100%);
}
html[data-crt="1"][data-theme="light"] body::after { background: radial-gradient(ellipse at center, transparent 60%, rgba(10,20,48,.22) 100%); }
html[data-crt="1"] h1, html[data-crt="1"] h2, html[data-crt="1"] .brand { text-shadow: 1px 0 rgba(255,60,120,.28), -1px 0 rgba(60,220,255,.28); }
html[data-crt="1"] .btn.primary, html[data-crt="1"] .major:hover, html[data-crt="1"] .rail { box-shadow: var(--glow), 0 0 32px -6px hsl(var(--h, 225) 90% 60% / .35); }
html[data-crt="1"] .eyebrow, html[data-crt="1"] .mono, html[data-crt="1"] code { text-shadow: 0 0 6px currentColor; }
@keyframes crt-flicker { 0%, 92%, 100% { opacity: .9 } 93% { opacity: .75 } 95% { opacity: .95 } 97% { opacity: .8 } }

/* ── Motion preference ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
