/* Design tokens. This is the only stylesheet allowed to contain raw color values;
   everything else uses the semantic tokens below.

   Theme switching: :root is light. prefers-color-scheme: dark applies unless the page is
   forced light, and <html data-theme="dark"> (set server-side from the `theme` cookie)
   forces dark. The dark values appear twice on purpose: CSS can't share one block between
   a media query and an attribute selector. */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/inter-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/inter-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin-700-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Light theme */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #475569;
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-fg: #FFFFFF;
  --accent-soft: #EEF2FF;
  --accent-soft-fg: #3730A3;
  --good-bg: #DCFCE7;
  --good-fg: #166534;
  --warn-bg: #FEF3C7;
  --warn-fg: #92400E;
  --bad-bg: #FEE2E2;
  --bad-fg: #991B1B;
  --neutral-bg: #F1F5F9;
  --neutral-fg: #334155;
  --focus: #4F46E5;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.1);

  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Type */
  --font: Inter, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-2xs: 12px;
  --text-xs: 13px;
  --text-sm: 14px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 24px;
  --text-2xl: 28px;
  --text-stat: 26px;
  --leading: 1.6;
  --leading-tight: 1.25;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Control sizes */
  --control-sm: 30px;
  --control: 40px; /* buttons, text inputs and selects share this height */
  --tap-target: 44px;

  /* App shell */
  --content-max: 1040px;
  --bar-height: 64px;
  --bar-height-sm: 56px;
  --logo-mark: 32px;
  --avatar: 26px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1120;
    --surface: #111827;
    --surface-2: #1E293B;
    --border: #263244;
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --accent: #818CF8;
    --accent-hover: #A5B4FC;
    --accent-fg: #0B1120;
    --accent-soft: #1E1B4B;
    --accent-soft-fg: #C7D2FE;
    --good-bg: #052E16;
    --good-fg: #86EFAC;
    --warn-bg: #422006;
    --warn-fg: #FCD34D;
    --bad-bg: #450A0A;
    --bad-fg: #FCA5A5;
    --neutral-bg: #1E293B;
    --neutral-fg: #CBD5E1;
    --focus: #818CF8;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1120;
  --surface: #111827;
  --surface-2: #1E293B;
  --border: #263244;
  --text: #E2E8F0;
  --text-muted: #94A3B8;
  --accent: #818CF8;
  --accent-hover: #A5B4FC;
  --accent-fg: #0B1120;
  --accent-soft: #1E1B4B;
  --accent-soft-fg: #C7D2FE;
  --good-bg: #052E16;
  --good-fg: #86EFAC;
  --warn-bg: #422006;
  --warn-fg: #FCD34D;
  --bad-bg: #450A0A;
  --bad-fg: #FCA5A5;
  --neutral-bg: #1E293B;
  --neutral-fg: #CBD5E1;
  --focus: #818CF8;
  --shadow: none;
}
