/* ═══════════════════════════════════════════════════════════
   ILLUMINATE AI — DESIGN TOKENS (single source of truth)
   Generated per design-system/MASTER.md (Soft UI Evolution)
   Theme: system preference default, manual toggle persists
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Typography */
  --font-display: 'Lora', Georgia, serif;
  --font-body: 'Raleway', system-ui, -apple-system, sans-serif;

  /* Type scale */
  --text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.25rem; --text-2xl: 1.5rem;
  --text-3xl: 1.875rem; --text-4xl: 2.25rem; --text-5xl: 3rem;

  /* Spacing (4pt) */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem;
  --sp-12: 3rem; --sp-16: 4rem;

  /* Radius */
  --radius-sm: 10px; --radius-md: 14px; --radius-lg: 18px;
  --radius-xl: 24px; --radius-full: 999px;

  /* Motion */
  --transition-fast: .15s ease;
  --transition: .22s cubic-bezier(.4,0,.2,1);
  --transition-slow: .3s cubic-bezier(.4,0,.2,1);

  /* Shadows — Soft UI Evolution */
  --shadow-sm: 0 2px 8px rgba(15,32,27,.08);
  --shadow-md: 0 2px 8px rgba(15,32,27,.08), 0 12px 32px rgba(15,32,27,.10);
  --shadow-lg: 0 6px 16px rgba(15,32,27,.12), 0 20px 48px rgba(15,32,27,.14);
}

/* ── LIGHT (default / system-light) ── */
:root {
  --bg: #F7FAF8;
  --surface: #FFFFFF;
  --surface-2: #EEF4F1;
  --border: #DFE9E4;
  --text: #14201B;
  --text-dim: #52655D;
  --primary: #0F766E;
  --primary-hover: #115E59;
  --on-primary: #FFFFFF;
  --accent: #14B8A6;
  --accent-soft: rgba(20,184,166,.12);
  --danger: #DC2626;
  --focus-ring: #14B8A6;
}

/* ── DARK (system-dark or manual) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1210;
    --surface: #121B17;
    --surface-2: #1A2621;
    --border: rgba(255,255,255,.09);
    --text: #EAF3EF;
    --text-dim: #9DB4AB;
    --primary: #2DD4BF;
    --primary-hover: #5EEAD4;
    --on-primary: #04211B;
    --accent: #5EEAD4;
    --accent-soft: rgba(94,234,212,.12);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
    --shadow-md: 0 2px 8px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.30);
    --shadow-lg: 0 6px 16px rgba(0,0,0,.40), 0 20px 48px rgba(0,0,0,.35);
  }
}
[data-theme="dark"] {
  --bg: #0B1210;
  --surface: #121B17;
  --surface-2: #1A2621;
  --border: rgba(255,255,255,.09);
  --text: #EAF3EF;
  --text-dim: #9DB4AB;
  --primary: #2DD4BF;
  --primary-hover: #5EEAD4;
  --on-primary: #04211B;
  --accent: #5EEAD4;
  --accent-soft: rgba(94,234,212,.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
  --shadow-md: 0 2px 8px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.30);
  --shadow-lg: 0 6px 16px rgba(0,0,0,.40), 0 20px 48px rgba(0,0,0,.35);
}

/* ── Legacy name compatibility ──
   Older pages reference --color-* names; alias them onto canonical tokens. */
:root {
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-secondary: var(--accent);
  --color-accent: var(--accent);
  --color-success: #059669;
  --color-warning: #D97706;
  --color-error: var(--danger);
  --color-info: #0284C7;
  --color-surface: var(--surface);
  --color-border: var(--border);
  --color-text-main: var(--text);
  --color-text-muted: var(--text-dim);
  --color-bg-body: var(--bg);
  /* legacy neutrals */
  --text-main: var(--text);
}
[data-theme="dark"] {
  --color-success: #34D399;
  --color-warning: #FBBF24;
  --color-info: #38BDF8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-success: #34D399;
    --color-warning: #FBBF24;
    --color-info: #38BDF8;
  }
}

/* ── Base element defaults (minimal reset) ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }

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