/*
  Design tokens — the single palette/scale definition for the whole site.
  Everything else (base, layout, components, sections) only ever reads
  these custom properties; it never hardcodes a color, radius or shadow.
  Swap a value here and it updates everywhere.
*/

:root {
  /* ---- Color primitives ---- */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #0a0f1c;

  --white: #ffffff;
  --success-500: #16a34a;

  /* ---- Semantic tokens (light theme, default) ---- */
  --color-bg: #fafafa;
  --color-bg-elevated: var(--white);
  --color-bg-subtle: var(--slate-50);
  --color-border: var(--slate-200);
  --color-border-strong: var(--slate-300);

  --color-text: var(--slate-900);
  --color-text-muted: var(--slate-600);
  --color-text-subtle: var(--slate-500);
  --color-text-on-accent: var(--white);

  --color-accent: var(--blue-600);
  --color-accent-strong: var(--blue-700);
  --color-accent-soft: var(--blue-50);
  --color-accent-soft-border: var(--blue-100);

  --color-focus-ring: var(--blue-500);
  --color-overlay: rgb(15 23 42 / 6%);

  /* ---- Typography ----
     System-first stack: reads like Inter (Inter was designed to match
     system UI metrics) with zero font-download cost — no @font-face,
     no render-blocking request, best possible CLS/Lighthouse score. */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.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;
  --text-6xl: 3.75rem;

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.6;

  /* ---- Spacing scale ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ---- Radius ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* ---- Shadow (soft, low-opacity — no heavy drop shadows) ---- */
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 4%);
  --shadow-md: 0 4px 16px -4px rgb(15 23 42 / 8%), 0 2px 6px -2px rgb(15 23 42 / 6%);
  --shadow-lg: 0 16px 40px -12px rgb(15 23 42 / 14%), 0 4px 12px -4px rgb(15 23 42 / 8%);

  /* ---- Motion ---- */
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Layout ---- */
  --container-max: 1200px;
  --header-height: 72px;
}

/* ---- Dark theme overrides ----
   Applied via [data-theme="dark"] on <html> (set by assets/js/theme.js).
   Same token names, different values — nothing downstream needs to know
   which theme is active. */
:root[data-theme="dark"] {
  --color-bg: var(--slate-950);
  --color-bg-elevated: #111827;
  --color-bg-subtle: #0f172a;
  --color-border: #1f2937;
  --color-border-strong: #2d3b4e;

  --color-text: var(--slate-50);
  --color-text-muted: var(--slate-300);
  --color-text-subtle: var(--slate-400);
  --color-text-on-accent: var(--white);

  --color-accent: var(--blue-400);
  --color-accent-strong: var(--blue-500);
  --color-accent-soft: rgb(59 130 246 / 12%);
  --color-accent-soft-border: rgb(59 130 246 / 24%);

  --color-overlay: rgb(0 0 0 / 30%);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 20%);
  --shadow-md: 0 4px 16px -4px rgb(0 0 0 / 32%), 0 2px 6px -2px rgb(0 0 0 / 24%);
  --shadow-lg: 0 16px 40px -12px rgb(0 0 0 / 45%), 0 4px 12px -4px rgb(0 0 0 / 30%);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-base: 1ms;
    --transition-fast: 1ms;
  }
}
