/* Graphite — Eliot's base design system. Tokens only; components live in components.css.
 *
 * Two tiers:
 *   1. Scales (--gray-1..12, --cobalt-1..12, status hues): raw values, one per step, never used in product code.
 *   2. Roles (--color-*): what product code uses. Each role is defined once for light, again for dark.
 *
 * Neutral steps follow Radix: 1-2 page, 3-5 component rest/hover/active, 6-8 borders, 9-10 solid, 11 muted text,
 * 12 text. Status colors are separate from the accent, so red or amber always means state, never brand.
 *
 * Theme: light by default; dark follows the OS unless data-theme="light" is set; data-theme="dark" forces dark.
 */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

:root {
  /* ---- Scales: light ---- */
  --gray-1: #fbfcfe; --gray-2: #f5f8fb; --gray-3: #edf0f5; --gray-4: #e6eaef; --gray-5: #dee3e9; --gray-6: #d6dbe2;
  --gray-7: #cacfd7; --gray-8: #b4b9c1; --gray-9: #878d94; --gray-10: #7b8187; --gray-11: #5f646a; --gray-12: #1d1f23;
  --cobalt-1: #fcfcfe; --cobalt-2: #f4f8fe; --cobalt-3: #e7effe; --cobalt-4: #d7e5ff; --cobalt-5: #c6dafe; --cobalt-6: #b0ccff;
  --cobalt-7: #93b9fe; --cobalt-8: #719ff4; --cobalt-9: #2763d7; --cobalt-10: #1a54c8; --cobalt-11: #335fb4; --cobalt-12: #0f285a;
  --green-9: #1d7d3e; --amber-9: #d98b09; --amber-11: #8a5600; --red-9: #c9302d; --teal-9: #067f94;

  /* ---- Roles: light ---- */
  --color-bg: #ffffff;                 /* page */
  --color-bg-subtle: var(--gray-2);    /* sidebars, table headers, wells */
  --color-surface: #ffffff;            /* cards, inputs */
  --color-surface-hover: var(--gray-3);
  --color-surface-active: var(--gray-4);
  --color-border: var(--gray-6);       /* hairlines, dividers */
  --color-border-strong: var(--gray-8);/* input borders, focus-adjacent */
  --color-text: var(--gray-12);
  --color-text-muted: var(--gray-11);  /* secondary text: still readable at 13px */
  --color-text-subtle: var(--gray-9);  /* placeholders, disabled only */
  --color-accent: var(--cobalt-9);     /* primary buttons, links, focus */
  --color-accent-hover: var(--cobalt-10);
  --color-accent-text: var(--cobalt-11); /* accent-colored text on bg */
  --color-accent-subtle: var(--cobalt-3);/* selected row, accent badge */
  --color-on-accent: #ffffff;
  --color-focus: var(--cobalt-8);
  --color-success: var(--green-9);  --color-success-subtle: #e6f4ea;
  --color-warning: var(--amber-11); --color-warning-subtle: #fdf1dc; --color-warning-solid: var(--amber-9);
  --color-danger: var(--red-9);     --color-danger-subtle: #fbe9e8;
  --color-info: var(--teal-9);      --color-info-subtle: #e2f3f6;
  --shadow-overlay: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px rgb(16 24 40 / 12%);

  /* ---- Type ---- */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --text-xs: 12px;   --leading-xs: 16px;
  --text-sm: 13px;   --leading-sm: 20px;   /* tables, dense lists */
  --text-base: 14px; --leading-base: 20px; /* UI default */
  --text-md: 16px;   --leading-md: 24px;   /* reading text */
  --text-lg: 20px;   --leading-lg: 28px;
  --text-xl: 24px;   --leading-xl: 32px;
  --text-2xl: 32px;  --leading-2xl: 40px;
  --text-3xl: 44px;  --leading-3xl: 48px;
  --font-weight-regular: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700;
  --tracking-tight: -0.02em; --tracking-normal: 0; --tracking-caps: 0.06em;

  /* ---- Space, size, shape ---- */
  --spacing-0-5: 2px; --spacing-1: 4px; --spacing-2: 8px; --spacing-3: 12px; --spacing-4: 16px; --spacing-5: 20px;
  --spacing-6: 24px; --spacing-8: 32px; --spacing-12: 48px; --spacing-16: 64px;
  --size-control-sm: 28px; --size-control: 32px; --size-control-lg: 40px; /* also table row heights */
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-full: 9999px;
  --container-prose: 680px; --container-page: 1200px;
  --duration-fast: 120ms; --duration-normal: 200ms; --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: light;
}

/* ---- Roles: dark (OS dark, unless light is forced) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --gray-1: #0d0e10; --gray-2: #131416; --gray-3: #1a1c1f; --gray-4: #202326; --gray-5: #26292e; --gray-6: #2d3136;
    --gray-7: #383d43; --gray-8: #4c5157; --gray-9: #646970; --gray-10: #71767d; --gray-11: #b0b5bb; --gray-12: #ebeff4;
    --cobalt-1: #0e1116; --cobalt-2: #11161f; --cobalt-3: #162137; --cobalt-4: #18294a; --cobalt-5: #1b315b; --cobalt-6: #213c70;
    --cobalt-7: #2b4c8a; --cobalt-8: #3962ae; --cobalt-9: #3c72da; --cobalt-10: #477ee8; --cobalt-11: #a5c5ff; --cobalt-12: #e7effe;
    --green-9: #4cb86a; --amber-9: #f4a437; --amber-11: #f4a437; --red-9: #ec5c52; --teal-9: #3db6cf;
    --color-bg: var(--gray-1); --color-bg-subtle: var(--gray-2); --color-surface: var(--gray-2);
    --color-success-subtle: #12261a; --color-warning-subtle: #2b1f0b; --color-danger-subtle: #2e1413; --color-info-subtle: #0c2429;
    --shadow-overlay: 0 0 0 1px var(--gray-6), 0 8px 24px rgb(0 0 0 / 45%);
    color-scheme: dark;
  }
}

/* ---- Roles: dark (forced) — same values as above, so the toggle wins both ways ---- */
:root[data-theme="dark"] {
  --gray-1: #0d0e10; --gray-2: #131416; --gray-3: #1a1c1f; --gray-4: #202326; --gray-5: #26292e; --gray-6: #2d3136;
  --gray-7: #383d43; --gray-8: #4c5157; --gray-9: #646970; --gray-10: #71767d; --gray-11: #b0b5bb; --gray-12: #ebeff4;
  --cobalt-1: #0e1116; --cobalt-2: #11161f; --cobalt-3: #162137; --cobalt-4: #18294a; --cobalt-5: #1b315b; --cobalt-6: #213c70;
  --cobalt-7: #2b4c8a; --cobalt-8: #3962ae; --cobalt-9: #3c72da; --cobalt-10: #477ee8; --cobalt-11: #a5c5ff; --cobalt-12: #e7effe;
  --green-9: #4cb86a; --amber-9: #f4a437; --amber-11: #f4a437; --red-9: #ec5c52; --teal-9: #3db6cf;
  --color-bg: var(--gray-1); --color-bg-subtle: var(--gray-2); --color-surface: var(--gray-2);
  --color-success-subtle: #12261a; --color-warning-subtle: #2b1f0b; --color-danger-subtle: #2e1413; --color-info-subtle: #0c2429;
  --shadow-overlay: 0 0 0 1px var(--gray-6), 0 8px 24px rgb(0 0 0 / 45%);
  color-scheme: dark;
}
