/*
 * Tract design tokens (UI spec v4, "Visual tokens"; canvas "Tract tokens").
 *
 * One set of token names for both themes. The web app follows the system setting; the desktop app
 * defaults to dark. Every text pair passes 4.5:1 and borders and focus rings pass 3:1 on the page
 * background. The colour values match shared/tract-design/tokens.css (contract tract-tokens 1.1.0), which the web and
 * desktop apps share; test/web-tokens-shared-parity.test.js fails when they drift. Spacing, radius and type stay as spec v4.
 *
 * Override for tests and screenshots only: set data-theme="light" or data-theme="dark" on <html>.
 */

:root {
  color-scheme: light dark;

  /* Light: the colour values of shared/tract-design/tokens.css (the operator's palette). */
  --color-bg: #f6f8fc;
  --color-surface: #eef0f5;
  --color-surface-raised: #ffffff;
  --color-overlay: #ffffff;
  --color-text: #0b1220;
  --color-text-secondary: #4a5569;
  --color-border: #7e889c;
  --color-divider: #e1e4e9;
  --color-primary: #1f57e6;
  --color-primary-fill: #2459e8;
  --color-on-primary: #ffffff;
  --color-on-primary-fill: #ffffff;
  --color-focus: #1f57e6;
  --color-success: #13703a;
  --color-warning: #8a5300;
  --color-danger: #b52c25;
  --color-info: #1f57e6;
  --color-glow: rgba(36, 89, 232, 0.18);

  --shadow-overlay: 0 4px 16px rgba(20, 23, 28, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #05070d;
    --color-surface: #0e1015;
    --color-surface-raised: #0b101b;
    --color-overlay: #0f1522;
    --color-text: #edf1f8;
    --color-text-secondary: #9aa6bc;
    --color-border: #56627a;
    --color-divider: #191b20;
    --color-primary: #7aa5ff;
    --color-primary-fill: #2f6bf5;
    --color-on-primary: #05070d;
    --color-on-primary-fill: #ffffff;
    --color-focus: #7aa5ff;
    --color-success: #4ade9a;
    --color-warning: #f2b44c;
    --color-danger: #ff8a80;
    --color-info: #7aa5ff;
    --color-glow: rgba(59, 123, 255, 0.35);

    /* Dark uses a raised surface and a divider border instead of a shadow. */
    --shadow-overlay: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #05070d;
  --color-surface: #0e1015;
  --color-surface-raised: #0b101b;
  --color-overlay: #0f1522;
  --color-text: #edf1f8;
  --color-text-secondary: #9aa6bc;
  --color-border: #56627a;
  --color-divider: #191b20;
  --color-primary: #7aa5ff;
  --color-primary-fill: #2f6bf5;
  --color-on-primary: #05070d;
  --color-on-primary-fill: #ffffff;
  --color-focus: #7aa5ff;
  --color-success: #4ade9a;
  --color-warning: #f2b44c;
  --color-danger: #ff8a80;
  --color-info: #7aa5ff;
  --color-glow: rgba(59, 123, 255, 0.35);
  --shadow-overlay: none;
}

:root {
  /* Type. Inter for interface text, JetBrains Mono for IDs, keys, logs and the CLI. Weights 400 and 600 only. */
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-caption: 12px;   /* line height 16 */
  --text-small: 13px;     /* line height 20: small text and tables */
  --text-body: 14px;      /* line height 20: default, compact product */
  --text-body-large: 16px; /* line height 24: large body and mobile inputs (prevents zoom) */
  --text-section: 18px;   /* line height 24 */
  --text-page: 22px;      /* line height 28 */
  --text-onboarding: 28px; /* line height 36 */

  --weight-regular: 400;
  --weight-semibold: 600;

  /* Spacing, 4 px base. */
  --space-2: 2px;
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;

  /* Radius. */
  --radius-input: 8px;
  --radius-button: 10px;
  --radius-card: 16px;
  --radius-pill: 999px;

  /* Rows and targets. */
  --row-compact: 36px;
  --row-default: 44px;
  --row-touch: 52px;
  --target-min: 24px;
  --target-touch: 44px;

  /* Focus: 2 px ring, 2 px offset. */
  --focus-width: 2px;
  --focus-offset: 2px;

  /* Motion. Reduced motion is handled in components, not here. */
  --motion-fast: 120ms;
  --motion-medium: 180ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}
