/* ===== Design tokens — v2 elegant =====
   Editorial-atmospheric. One paper, one ink, one accent.
   No mid-render improvisation — every color in the artifact references a token.
*/
:root {
  /* Paper — warm off-black, single source of paper */
  --paper:    oklch(0.135 0.012 60);   /* base */
  --paper-2:  oklch(0.165 0.012 60);   /* raised */
  --paper-3:  oklch(0.205 0.014 62);   /* raised + 1 */
  --paper-4:  oklch(0.265 0.014 62);   /* hairline panels */

  /* Backwards-compat aliases (legacy code still references these) */
  --bg-0: var(--paper);
  --bg-1: var(--paper-2);
  --bg-2: var(--paper-3);
  --bg-3: var(--paper-4);
  --panel: color-mix(in oklab, var(--paper-2) 70%, transparent);
  --panel-stroke: oklch(0.32 0.012 62 / 0.32);
  --panel-stroke-strong: oklch(0.42 0.012 62 / 0.55);

  /* Ink — single warm bone scale */
  --ink:      oklch(0.94 0.012 78);    /* bone primary */
  --ink-2:    oklch(0.84 0.012 78);    /* paragraph */
  --ink-mute: oklch(0.62 0.014 78);    /* labels */
  --ink-dim:  oklch(0.42 0.014 78);    /* very secondary */
  --ink-faint:oklch(0.28 0.014 78);    /* rules */

  /* THE accent — warm champagne. One hue, one chroma, one role: emphasis. */
  --accent:    oklch(0.84 0.11 78);
  --accent-2:  oklch(0.74 0.10 78);
  --accent-dim:oklch(0.52 0.08 78);
  --accent-tint: color-mix(in oklab, var(--accent) 8%, transparent);
  --accent-glow: color-mix(in oklab, var(--accent) 28%, transparent);

  /* Critical — used only for genuine "this is dangerous" UI (trifecta lethal state) */
  --crit:     oklch(0.66 0.18 22);

  /* Legacy aliases mapped onto a disciplined family.
     Subtle differentiation for UX-required distinct items (trifecta tokens,
     force-graph node types) — all share low chroma so the palette reads as one. */
  --mint:    var(--accent);                /* primary accent */
  --mint-dim:var(--accent-dim);
  --amber:   var(--accent);                /* same as accent */
  --amber-dim:var(--accent-dim);
  --violet:  oklch(0.72 0.04 280);         /* muted mauve */
  --blue:    oklch(0.72 0.04 230);         /* muted slate-blue */
  --magenta: var(--crit);                  /* genuine "danger" only */
  --magenta-dim: var(--crit);

  /* Type */
  --ff-display: "Instrument Serif", ui-serif, Georgia, serif;
  --ff-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radii — restrained */
  --r-1: 2px;
  --r-2: 6px;
  --r-3: 10px;

  /* Motion */
  --easing: cubic-bezier(0.2, 0.7, 0.2, 1);
  --easing-slow: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.6;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
body { min-height: 100vh; }

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--ink) 20%, transparent);
  transition: border-color .25s var(--easing), color .25s var(--easing);
}
a:hover { color: var(--accent); border-bottom-color: var(--accent); }

button { font-family: inherit; }
::selection { background: color-mix(in oklab, var(--accent) 30%, transparent); color: var(--ink); }

/* Background canvas (Three.js) — sits behind everything */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none !important;
  opacity: 1;
}

/* Grain + scanlines retired. We trust the typography. */
#grain, #scanlines, #boot { display: none !important; }

/* Utilities */
.mono { font-family: var(--ff-mono); }
.serif { font-family: var(--ff-display); }
.italic { font-style: italic; }
.muted { color: var(--ink-mute); }
.dim { color: var(--ink-dim); }

/* Quiet label — used surgically, not as wallpaper */
.label {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 400;
}

.kbd {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border: 1px solid var(--panel-stroke-strong);
  border-radius: 3px;
  background: var(--paper-2);
  color: var(--ink-2);
}

/* Pulse dot — used sparingly, single color */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.dot.amber, .dot.magenta { background: var(--accent); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Print-style first-letter polish on long-form copy blocks */
.lift-cap::first-letter {
  font-family: var(--ff-display);
  font-style: italic;
  font-size: 1.25em;
  color: var(--accent);
}
