/*
  Design tokens -- CLAUDE.md §5.3. Values are fixed there (contrast-checked);
  this file only translates that table into CSS custom properties. Don't
  hand-edit a color here without updating the contrast numbers in §5.3 too.
*/

:root {
  /* Color -- light (default) */
  --bg: #FFFFFF;
  --surface: #F5F7FA;
  --text: #1A1A1A;
  --text-muted: #4A4F57;
  --brand: #1F3A5F;
  --brand-tint: #E8EEF6;
  --border: #D9DEE5;

  /* Status badges -- light */
  --status-verified-text: #1E6B3A;
  --status-verified-bg: #E8F3EC;
  --status-sim-text: #5B3E99;
  --status-sim-bg: #F0EBFA;
  --status-progress-text: #8A5A00;
  --status-progress-bg: #FDF3E1;
  /* Client work / Personal project badges use --brand-tint directly for the
     fill; text uses --brand-on-tint, which equals --brand in light mode but
     gets a lighter override in dark (plain --brand only hits 7.04:1 on
     --brand-tint there -- still AA, but §5.3 documents 9.41:1 via this
     specific color, so match it rather than leave the gap). */
  --brand-on-tint: #1F3A5F;

  /* Type -- self-hosted IBM Plex Sans/Mono (CLAUDE.md §2), weights 400/600 only (§5.3) */
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-display: clamp(2rem, 5vw, 2.75rem);
  --lh-display: 1.15;
  --fs-h1: 2rem;
  --lh-h1: 1.2;
  --fs-h2: 1.5rem;
  --lh-h2: 1.3;
  --fs-h3: 1.2rem;
  --lh-h3: 1.35;
  --fs-body: 1.0625rem; /* 17px */
  --lh-body: 1.6;
  --fs-small: 0.875rem;
  --lh-small: 1.5;
  --fs-mono: 0.9375rem;
  --lh-mono: 1.5;

  --fw-regular: 400;
  --fw-semibold: 600;

  --measure: 68ch;

  /* Spacing scale -- use only these */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radius / shadow */
  --radius: 8px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(26, 26, 26, 0.06), 0 2px 8px rgba(26, 26, 26, 0.05);

  /* Feature bands -- full-bleed dark sections (hero, case-study header).
     These are the one place the site inverts: light text on deep navy.
     Ratios measured against --band-bg, recorded in CLAUDE.md §5.3. */
  --band-bg: #14273F;
  --band-text: #F2F5F9;     /* 13.80:1 on --band-bg */
  --band-muted: #C3CEDC;    /*  9.47:1 */
  --band-accent: #9CC0EA;   /*  8.01:1 */
  --band-line: rgba(255, 255, 255, 0.14);  /* decorative only */
  --band-dot: rgba(255, 255, 255, 0.07);   /* decorative only */

  /* Depth -- used by tiles that overlap a band, and cards floating on one */
  --shadow-raised: 0 10px 30px rgba(20, 39, 63, 0.10);
  --shadow-float: 0 18px 40px rgba(0, 0, 0, 0.28);

  /* Layout */
  --container-max: 1100px;
  --wide: var(--container-max); /* the one "wide" width; prose stays at --measure */
  --gutter: 16px;

  /* Motion */
  --transition-fast: 150ms ease;
}

@media (min-width: 768px) {
  :root {
    --gutter: 24px;
  }
}

/* Dark theme: system preference, unless an explicit choice overrides it */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1720;
    --surface: #16212E;
    --text: #E6EAF0;
    --text-muted: #A9B4C2;
    --brand: #8FB3E0;
    --brand-tint: #18263A;
    --border: #2A3646;

    --status-verified-text: #8FD1A5;
    --status-verified-bg: #14281C;
    --status-sim-text: #C7B5F2;
    --status-sim-bg: #231B38;
    --status-progress-text: #F2C46B;
    --status-progress-bg: #2E2410;
    --brand-on-tint: #B9CDE8;

    --band-bg: #16212E;   /* text ratios rise here: 14.87 / 10.21 / 8.63:1 */
    --band-line: #2A3646;

    --shadow-card: none; /* §5.3: soft shadow is light-mode only; borders do the work in dark */
    --shadow-raised: none;
  }
}

/* Explicit theme toggle wins over system preference in both directions */
:root[data-theme="dark"] {
  --bg: #0F1720;
  --surface: #16212E;
  --text: #E6EAF0;
  --text-muted: #A9B4C2;
  --brand: #8FB3E0;
  --brand-tint: #18263A;
  --border: #2A3646;

  --status-verified-text: #8FD1A5;
  --status-verified-bg: #14281C;
  --status-sim-text: #C7B5F2;
  --status-sim-bg: #231B38;
  --status-progress-text: #F2C46B;
  --status-progress-bg: #2E2410;
  --brand-on-tint: #B9CDE8;

  --band-bg: #16212E;
  --band-line: #2A3646;

  --shadow-card: none;
  --shadow-raised: none;
}

:root[data-theme="light"] {
  /* Re-asserts the light values from :root above, so an explicit light
     choice wins even when the OS is set to dark (§5.8). */
  --bg: #FFFFFF;
  --surface: #F5F7FA;
  --text: #1A1A1A;
  --text-muted: #4A4F57;
  --brand: #1F3A5F;
  --brand-tint: #E8EEF6;
  --border: #D9DEE5;

  --status-verified-text: #1E6B3A;
  --status-verified-bg: #E8F3EC;
  --status-sim-text: #5B3E99;
  --status-sim-bg: #F0EBFA;
  --status-progress-text: #8A5A00;
  --status-progress-bg: #FDF3E1;
  --brand-on-tint: #1F3A5F;

  --band-bg: #14273F;
  --band-line: rgba(255, 255, 255, 0.14);

  --shadow-card: 0 1px 2px rgba(26, 26, 26, 0.06), 0 2px 8px rgba(26, 26, 26, 0.05);
  --shadow-raised: 0 10px 30px rgba(20, 39, 63, 0.10);
}

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