/*
 * Design tokens for / (landing) and /app (web app).
 * Owner: GIT-7 spec §10 (knowledge/decisions/shared-artifacts.md). This file is a verbatim
 * transcription of that section; change values there first, never here alone.
 * Breakpoints (§10.6) are constants, not properties: md 768px, lg 1024px, xl 1280px (min-width).
 * Checked by scripts/checks/tokens.py and scripts/checks/contrast.py.
 */

:root {
  color-scheme: light dark;

  /* §10.2 colours, light */
  --color-bg: #ffffff;
  --color-bg-subtle: #f6f8fa;
  --color-bg-inset: #eef1f4;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-border: #d0d7de;
  --color-border-strong: #818b98;
  --color-fg: #1f2328;
  --color-fg-muted: #57606a;
  --color-accent: #5b3cc4;
  --color-accent-hover: #4a2fa8;
  --color-accent-subtle: #f1edfc;
  --color-on-accent: #ffffff;
  --focus-ring-color: #5b3cc4;
  --color-match: #fff3b0;
  --color-match-fg: #1f2328;
  --color-match-border: #8a6500;
  --color-match-line-bg: #fff8db;
  --color-success: #1a7f37;
  --color-success-bg: #dafbe1;
  --color-danger: #cf222e;
  --color-danger-bg: #ffebe9;
  --color-warning: #9a6700;
  --color-warning-bg: #fff8c5;
  --color-info-bg: #f1edfc;
  --color-overlay: rgb(13 17 23 / 0.5);

  /* §10.3 focus */
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --focus-ring: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--focus-ring-color);

  /* §10.4 typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --text-xs: 0.75rem;     --text-xs-lh: 1rem;
  --text-sm: 0.875rem;    --text-sm-lh: 1.25rem;
  --text-base: 1rem;      --text-base-lh: 1.5rem;
  --text-code: 0.8125rem; --text-code-lh: 1.25rem;
  --text-lg: 1.125rem;    --text-lg-lh: 1.75rem;
  --text-xl: 1.25rem;     --text-xl-lh: 1.75rem;
  --text-2xl: 1.5rem;     --text-2xl-lh: 2rem;
  --text-3xl: 1.875rem;   --text-3xl-lh: 2.375rem;
  --text-4xl: 2.5rem;     --text-4xl-lh: 3rem;
  --text-5xl: 3.25rem;    --text-5xl-lh: 3.75rem;

  /* §10.5 spacing */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 6rem;

  /* §10.5 radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* §10.5 elevation */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-md: 0 8px 24px rgb(0 0 0 / 0.12);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.18);

  /* §10.5 sizes and layout */
  --control-h-sm: 2rem;
  --control-h-md: 2.75rem;
  --control-h-lg: 3rem;
  --container-max: 70rem;
  --content-max: 80rem;
  --sidebar-w: 15rem;
  --header-h: 4rem;

  /* §10.5 motion */
  --duration-fast: 150ms;
  --duration-base: 200ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1);

  /* §10.5 z-index */
  --z-header: 10;
  --z-dropdown: 20;
  --z-overlay: 40;
  --z-dialog: 50;
  --z-toast: 60;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0d1117;
    --color-bg-subtle: #161b22;
    --color-bg-inset: #010409;
    --color-surface: #161b22;
    --color-surface-raised: #1c2128;
    --color-border: #30363d;
    --color-border-strong: #6e7681;
    --color-fg: #e6edf3;
    --color-fg-muted: #9198a1;
    --color-accent: #a78bfa;
    --color-accent-hover: #c4b5fd;
    --color-accent-subtle: #2a2145;
    --color-on-accent: #0d1117;
    --focus-ring-color: #a78bfa;
    --color-match: #5c4a00;
    --color-match-fg: #fff6d6;
    --color-match-border: #e0b000;
    --color-match-line-bg: #1f1a0b;
    --color-success: #3fb950;
    --color-success-bg: #122117;
    --color-danger: #f85149;
    --color-danger-bg: #2d1214;
    --color-warning: #d29922;
    --color-warning-bg: #2b2111;
    --color-info-bg: #2a2145;
    --color-overlay: rgb(1 4 9 / 0.7);
    --shadow-md: 0 8px 24px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.6);
  }
}

:root[data-theme="dark"] {
  --color-bg: #0d1117;
  --color-bg-subtle: #161b22;
  --color-bg-inset: #010409;
  --color-surface: #161b22;
  --color-surface-raised: #1c2128;
  --color-border: #30363d;
  --color-border-strong: #6e7681;
  --color-fg: #e6edf3;
  --color-fg-muted: #9198a1;
  --color-accent: #a78bfa;
  --color-accent-hover: #c4b5fd;
  --color-accent-subtle: #2a2145;
  --color-on-accent: #0d1117;
  --focus-ring-color: #a78bfa;
  --color-match: #5c4a00;
  --color-match-fg: #fff6d6;
  --color-match-border: #e0b000;
  --color-match-line-bg: #1f1a0b;
  --color-success: #3fb950;
  --color-success-bg: #122117;
  --color-danger: #f85149;
  --color-danger-bg: #2d1214;
  --color-warning: #d29922;
  --color-warning-bg: #2b2111;
  --color-info-bg: #2a2145;
  --color-overlay: rgb(1 4 9 / 0.7);
  --shadow-md: 0 8px 24px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.6);
}

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

/* §10.3 shared focus rule */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
