/* ============================================================================
   Design tokens — single source of truth
   ----------------------------------------------------------------------------
   Day 1 of the design-system sprint. Loaded BEFORE css/index.css.
   Values mirror existing literals in index.css — no visual change on Day 1.
   ============================================================================ */

:root {
  /* ── Surfaces ─────────────────────────────────────────────────────────── */
  --bg-body: #0a0f1a;
  --bg-sidebar: #0c1222;
  --bg-topbar: #0c1222;
  --bg-card: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  --bg-card-solid: #1e293b;
  --bg-card-deep: #0f172a;
  --bg-hover: #1e293b;
  --bg-inset: rgba(15, 23, 42, 0.5);
  --bg-row-hover: rgba(30, 41, 59, 0.7);

  /* ── Borders ──────────────────────────────────────────────────────────── */
  --border-primary: rgba(51, 65, 85, 0.6);
  --border-subtle: rgba(51, 65, 85, 0.35);
  --border-muted: rgba(51, 65, 85, 0.4);
  --border-strong: rgba(51, 65, 85, 0.9);
  --border-hover: rgba(59, 130, 246, 0.3);
  --border-solid: #334155;
  --border-solid-strong: #475569;

  /* ── Text ─────────────────────────────────────────────────────────────── */
  --text-primary: #f3f4f6;
  --text-body: #e2e8f0;
  --text-soft: #cbd5e1;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --text-faint: #64748b;
  --text-slate: #94a3b8;
  --text-bright: #f8fafc;

  /* ── Accents (base + 200/400 tints commonly used) ─────────────────────── */
  --accent-blue: #3b82f6;
  --accent-blue-strong: #2563eb;
  --accent-blue-light: #60a5fa;
  --accent-blue-lighter: #93c5fd;

  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
  --accent-emerald-lighter: #6ee7b7;
  --accent-emerald-pale: #86efac;

  --accent-red: #ef4444;
  --accent-red-light: #f87171;
  --accent-red-lighter: #fca5a5;

  --accent-amber: #f59e0b;
  --accent-amber-light: #fbbf24;
  --accent-amber-lighter: #fcd34d;

  --accent-violet: #8b5cf6;
  --accent-violet-light: #c4b5fd;

  /* ── Sentiment / status backgrounds (tinted) ──────────────────────────── */
  --tint-blue: rgba(59, 130, 246, 0.15);
  --tint-blue-strong: rgba(59, 130, 246, 0.25);
  --tint-emerald: rgba(16, 185, 129, 0.12);
  --tint-emerald-strong: rgba(16, 185, 129, 0.3);
  --tint-red: rgba(239, 68, 68, 0.12);
  --tint-red-strong: rgba(239, 68, 68, 0.3);
  --tint-amber: rgba(245, 158, 11, 0.12);
  --tint-muted: rgba(156, 163, 175, 0.12);

  /* ── Glow / shadow ────────────────────────────────────────────────────── */
  --glow-blue: rgba(59, 130, 246, 0.08);
  --glow-blue-strong: rgba(59, 130, 246, 0.2);
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 8px 25px rgba(0, 0, 0, 0.4);
  --shadow-glow-card: 0 0 20px var(--glow-blue), 0 8px 25px rgba(0, 0, 0, 0.4);
  --shadow-subtle: 0 2px 6px rgba(0, 0, 0, 0.2);

  /* ── Gradients ────────────────────────────────────────────────────────── */
  --hero-gradient: radial-gradient(ellipse at top, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  --sidebar-active-gradient: linear-gradient(135deg, #1e3a5f, #172554);
  --sub-card-gradient: linear-gradient(145deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.5) 100%);

  /* ── Radius scale ─────────────────────────────────────────────────────── */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 1rem;           /* 16px */
  --radius-2xl: 1.25rem;       /* 20px */
  --radius-pill: 9999px;

  /* ── Spacing scale (aligned with Tailwind) ────────────────────────────── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  /* ── Typography ───────────────────────────────────────────────────────── */
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --fs-2xs: 9px;
  --fs-xs: 10px;
  --fs-sm: 11px;
  --fs-base: 12px;
  --fs-md: 13px;
  --fs-lg: 14px;
  --fs-xl: 1.15rem;            /* ~18px */

  /* ── Motion ───────────────────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 0.15s;
  --dur-base: 0.25s;
  --dur-slow: 0.4s;

  /* ── Layout ───────────────────────────────────────────────────────────── */
  --sidebar-width: 230px;
  --topbar-height: 60px;
}

/* ============================================================================
   Light theme overrides — warm paper palette
   Activated by `body.light-theme` (or `.light-pre` during flash prevention).
   ============================================================================ */

body.light-theme {
  --bg-body: #faf6f1;
  --bg-sidebar: #fdfaf6;
  --bg-topbar: #fdfaf6;
  --bg-card: linear-gradient(145deg, #fdfaf6, #f5efe7);
  --bg-card-solid: #fdfaf6;
  --bg-card-deep: #f5efe7;
  --bg-hover: #f5efe7;
  --bg-inset: rgba(245, 239, 231, 0.7);
  --bg-row-hover: rgba(232, 224, 212, 0.5);

  --border-primary: #e8e0d4;
  --border-subtle: rgba(232, 224, 212, 0.6);
  --border-muted: rgba(232, 224, 212, 0.7);
  --border-strong: #d4c9bb;
  --border-hover: rgba(139, 105, 20, 0.3);
  --border-solid: #e8e0d4;
  --border-solid-strong: #d4c9bb;

  --text-primary: #2c2418;
  --text-body: #2c2418;
  --text-secondary: #3d3426;
  --text-muted: #6b5a45;
  --text-dim: #8b7355;
  --text-faint: #8b6914;
  --text-slate: #6b5a45;
  --text-bright: #0f172a;

  /* Accents shift slightly warmer on light for contrast */
  --accent-blue: #2563eb;
  --accent-blue-strong: #1d4ed8;
  --accent-blue-light: #3b82f6;
  --accent-blue-lighter: #60a5fa;

  --tint-blue: rgba(37, 99, 235, 0.1);
  --tint-blue-strong: rgba(37, 99, 235, 0.18);
  --tint-emerald: rgba(5, 150, 105, 0.1);
  --tint-emerald-strong: rgba(5, 150, 105, 0.22);
  --tint-red: rgba(220, 38, 38, 0.1);
  --tint-red-strong: rgba(220, 38, 38, 0.22);
  --tint-amber: rgba(180, 83, 9, 0.1);
  --tint-muted: rgba(107, 90, 69, 0.1);

  --glow-blue: rgba(37, 99, 235, 0.06);
  --glow-blue-strong: rgba(37, 99, 235, 0.15);
  --shadow-card: 0 4px 12px rgba(44, 36, 24, 0.06);
  --shadow-card-hover: 0 8px 25px rgba(44, 36, 24, 0.1);
  --shadow-glow-card: 0 0 20px var(--glow-blue), 0 8px 25px rgba(44, 36, 24, 0.1);
  --shadow-subtle: 0 2px 6px rgba(44, 36, 24, 0.05);

  --hero-gradient: radial-gradient(ellipse at top, rgba(37, 99, 235, 0.04) 0%, transparent 50%);
  --sidebar-active-gradient: linear-gradient(135deg, #e8dcc4, #d4c9bb);
  --sub-card-gradient: linear-gradient(145deg, rgba(253, 250, 246, 0.8) 0%, rgba(245, 239, 231, 0.6) 100%);
}

/* Flash-prevention class (set in <head> before body renders) */
html.light-pre body {
  background: #faf6f1;
}
