/*
 * JSY Labs design tokens.
 * Every colour, space, type size, radius and motion value lives here.
 * Light and dark values sit side by side via light-dark(); the theme is
 * chosen by color-scheme (OS by default, or [data-theme] from the toggle).
 */

:root {
  color-scheme: light dark;

  /* Brand palette (raw) */
  --jersey-red: #e8112d;
  --jersey-red-deep: #b50d23;
  --jersey-red-bright: #ff4d61;
  --sand-50: #fbf8f2;
  --sand-100: #f4efe6;
  --sand-200: #e8e0d2;
  --granite-400: #8a8f93;
  --granite-600: #565e66;
  --sea-300: #8cbbe0;
  --sea-700: #0b3a5b;
  --sea-900: #0a1520;
  --sea-850: #101f2d;
  --sea-800: #172a3b;
  --white: #ffffff;
  --amber-600: #9a6512;
  --amber-300: #e2b25c;

  /* Semantic colour */
  --color-bg: light-dark(var(--sand-100), var(--sea-900));
  --color-surface: light-dark(var(--sand-50), var(--sea-850));
  --color-surface-sunken: light-dark(var(--sand-200), var(--sea-800));
  --color-text: light-dark(#16212b, #ece6dc);
  --color-text-muted: light-dark(var(--granite-600), #a6afb7);
  --color-border: light-dark(rgb(22 33 43 / 0.16), rgb(236 230 220 / 0.14));
  --color-border-strong: light-dark(rgb(22 33 43 / 0.32), rgb(236 230 220 / 0.3));
  --color-grid-minor: light-dark(rgb(11 58 91 / 0.045), rgb(140 187 224 / 0.04));
  --color-grid-major: light-dark(rgb(11 58 91 / 0.09), rgb(140 187 224 / 0.075));

  --color-accent: var(--jersey-red);
  --color-accent-text: light-dark(var(--jersey-red-deep), var(--jersey-red-bright));
  --color-on-accent: var(--white);
  --color-sea: light-dark(var(--sea-700), var(--sea-300));
  --color-focus: light-dark(var(--sea-700), var(--sea-300));

  --color-status-live: var(--jersey-red);
  --color-status-progress: light-dark(var(--amber-600), var(--amber-300));
  --color-status-archived: var(--granite-400);

  /* Typography */
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-2xl: clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem);
  --text-display: clamp(2.4rem, 1.6rem + 3.6vw, 4.5rem);

  --leading-tight: 1.05;
  --leading-snug: 1.3;
  --leading-body: 1.6;
  --tracking-label: 0.08em;
  --tracking-display: -0.025em;

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

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --measure: 62ch;
  --page-max: 72rem;

  /* Graph paper */
  --grid-minor: 8px;
  --grid-major: 40px;

  /* Radii */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 999px;

  /* Borders, shadow, focus */
  --border-hairline: 1px solid var(--color-border);
  --border-strong: 1px solid var(--color-border-strong);
  --shadow-plate: light-dark(0 1px 0 rgb(22 33 43 / 0.06), 0 1px 0 rgb(0 0 0 / 0.4)),
    light-dark(0 12px 32px -18px rgb(22 33 43 / 0.35), 0 12px 32px -18px rgb(0 0 0 / 0.7));
  --focus-ring: 2px solid var(--color-focus);
  --focus-offset: 3px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --duration-fast: 140ms;
  --duration-base: 240ms;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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