/* ==========================================================================
   Design tokens — see docs/design-system.md
   Palette is defined per theme on [data-site-theme]; brand constants stay fixed.
   ========================================================================== */

:root {
  /* Brand constants — identical across themes so the brand stays recognisable */
  --brand-teal: #2dd4bf;
  --brand-violet: #8b5cf6;

  /* Type scale (base 16px) */
  --fs-display: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  --fs-h1: clamp(2rem, 3vw + 1rem, 3rem);
  --fs-h2: clamp(1.5rem, 2vw + 0.75rem, 2.25rem);
  --fs-h3: 1.25rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.75rem;
  --lh-tight: 1.1;
  --lh-body: 1.6;

  /* Font stacks — system fonts only: no external CDN, keeps CSP strict */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo,
    Consolas, monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-instant: 120ms;
  --dur-fast: 250ms;
  --dur-base: 400ms;
  --dur-slow: 600ms;
  --dur-max: 800ms;

  /* Layout */
  --container: 1200px;
  --header-h: 64px;
}

/* --------------------------------------------------------------------------
   Theme: dark (default)
   -------------------------------------------------------------------------- */
:root,
[data-site-theme="dark"] {
  --bg-base: #0b0f14;
  --bg-surface: #121821;
  --bg-surface-2: #1a222e;
  --text-primary: #f3f5f7;
  --text-secondary: #a8b3c2;
  --border-subtle: #263142;
  --accent-primary: #2dd4bf;
  --accent-secondary: #8b5cf6;
  --accent-on: #04201c;
  --focus-ring: #5eead4;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.09);
  --grid-line: rgba(255, 255, 255, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.36);
  --shadow-glow: 0 0 48px rgba(45, 212, 191, 0.18);
  --hero-fallback: radial-gradient(
      ellipse 80% 60% at 20% 10%,
      rgba(45, 212, 191, 0.22),
      transparent 60%
    ),
    radial-gradient(ellipse 70% 60% at 85% 30%, rgba(139, 92, 246, 0.22), transparent 62%),
    #0b0f14;
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Theme: light
   Accents are darkened so text on accent backgrounds still clears 4.5:1.
   -------------------------------------------------------------------------- */
[data-site-theme="light"] {
  --bg-base: #f7f5f2;
  --bg-surface: #ffffff;
  --bg-surface-2: #efede8;
  --text-primary: #14181d;
  --text-secondary: #4b5563;
  --border-subtle: #ddd8d0;
  --accent-primary: #0d7c72;
  --accent-secondary: #6d28d9;
  --accent-on: #ffffff;
  --focus-ring: #0d7c72;
  --glass-bg: rgba(20, 24, 29, 0.035);
  --glass-border: rgba(20, 24, 29, 0.1);
  --grid-line: rgba(20, 24, 29, 0.05);
  --shadow-md: 0 8px 24px rgba(20, 24, 29, 0.1);
  --shadow-glow: 0 0 48px rgba(13, 124, 114, 0.12);
  --hero-fallback: radial-gradient(
      ellipse 80% 60% at 20% 10%,
      rgba(45, 212, 191, 0.28),
      transparent 60%
    ),
    radial-gradient(ellipse 70% 60% at 85% 30%, rgba(139, 92, 246, 0.2), transparent 62%),
    #f7f5f2;
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   Theme: blueprint — single-accent drafting aesthetic
   -------------------------------------------------------------------------- */
[data-site-theme="blueprint"] {
  --bg-base: #0a1628;
  --bg-surface: #0f1f38;
  --bg-surface-2: #14294a;
  --text-primary: #dbe9f5;
  --text-secondary: #8fa7c0;
  --border-subtle: #2a4766;
  --accent-primary: #5ec9e8;
  --accent-secondary: #5ec9e8;
  --accent-on: #06131f;
  --focus-ring: #5ec9e8;
  --glass-bg: rgba(94, 201, 232, 0.05);
  --glass-border: rgba(94, 201, 232, 0.18);
  --grid-line: rgba(94, 201, 232, 0.1);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 48px rgba(94, 201, 232, 0.16);
  --hero-fallback: radial-gradient(
      ellipse 80% 60% at 20% 10%,
      rgba(94, 201, 232, 0.2),
      transparent 60%
    ),
    #0a1628;
  color-scheme: dark;
}

/* Blueprint gets a drafting grid behind everything and a mono voice */
[data-site-theme="blueprint"] body {
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
}
[data-site-theme="blueprint"] h1,
[data-site-theme="blueprint"] h2,
[data-site-theme="blueprint"] .chip,
[data-site-theme="blueprint"] .btn {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
