/* Design tokens. Every value used in base.css comes from here. */
:root {
  /* spacing, 4px base */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --space-6: 32px; --space-7: 48px; --space-8: 64px; --space-9: 96px; --space-10: 128px;

  /* type scale */
  --text-xs: 12px; --text-sm: 14px; --text-md: 16px; --text-lg: 18px;
  --text-xl: 24px; --text-2xl: 32px; --text-3xl: 48px;
  --lh-body: 1.5; --lh-heading: 1.15;
  --track-heading: -0.02em; --track-tight: -0.01em; --track-eyebrow: 0.06em;
  --weight-regular: 400; --weight-strong: 600;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 65ch;

  /* shape */
  --radius-sm: 6px; --radius-md: 10px;

  /* layout */
  --container: 1120px; --gutter: 24px; --page-pad: 24px;
  --section-gap: var(--space-9);
  --control-h: 40px; --icon-sm: 16px; --icon-md: 20px;
  --switch-w: 48px; --switch-h: 24px; --switch-thumb: 16px;
  --qr-size: 224px; --bar-h: 80px; --header-h: 64px;

  /* motion */
  --dur: 150ms; --dur-slow: 200ms; --ease: ease-out;
  --z-header: 20; --z-bar: 30;

  /* neutral scale, cool tint (light) */
  --gray-50: #f7f8fa;  --gray-100: #f0f2f5; --gray-200: #e3e6ec; --gray-300: #cfd4dd; --gray-400: #b4bbc8;
  --gray-500: #6f7889; --gray-600: #565e6f; --gray-700: #404757; --gray-800: #272d3a; --gray-900: #161a23;

  /* accent: cyan */
  --warm: #d97706; --accent: #0e7490; --accent-hover: #0b5f77; --accent-active: #094e62;
  --accent-fg: #ffffff; --accent-subtle: #e3f5f9; --accent-text: #0b5f77;
  --accent-ring: rgba(14, 116, 144, 0.35);

  /* semantic */
  --success-text: #116a3a; --success-bg: #e6f5ec;
  --warning-text: #8a5300; --warning-bg: #fdf1dc;
  --error-text: #b4232f;   --error-bg: #fdeaec;

  /* surfaces and text (semantic aliases) */
  --bg: var(--gray-50); --surface: #ffffff; --surface-2: var(--gray-100);
  --border: var(--gray-200); --border-strong: var(--gray-300); --border-control: var(--gray-500);
  --text: var(--gray-900); --text-2: var(--gray-600);
  --qr-bg: #ffffff;

  /* elevation: two levels */
  --shadow-1: 0 1px 2px rgba(22, 26, 35, 0.06);
  --shadow-2: 0 -4px 16px rgba(22, 26, 35, 0.08);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --warm: #f59e0b;
  --gray-50: #0b0d10;  --gray-100: #11141a; --gray-200: #181c23; --gray-300: #232832; --gray-400: #333a47;
  --gray-500: #7a8394; --gray-600: #a2aaba; --gray-700: #c3c9d5; --gray-800: #e0e4eb; --gray-900: #f1f3f7;

  --accent: #22d3ee; --accent-hover: #5ce1f3; --accent-active: #8aeaf7;
  --accent-fg: #0b0d10; --accent-subtle: #0c2a33; --accent-text: #67e0f2;
  --accent-ring: rgba(34, 211, 238, 0.45);

  --success-text: #5fd391; --success-bg: #0f2a1b;
  --warning-text: #f0b44c; --warning-bg: #2c2210;
  --error-text: #ff8a93;   --error-bg: #321519;

  --surface: var(--gray-100); --surface-2: var(--gray-200);
  --border: var(--gray-300); --border-strong: var(--gray-400); --border-control: var(--gray-500);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 -4px 16px rgba(0, 0, 0, 0.4);

  color-scheme: dark;
}

/* Breakpoints are literal because CSS variables cannot be used in media queries: 640 (phone), 1024 (desktop). */
@media (max-width: 1023px), (pointer: coarse) {
  :root { --control-h: 44px; --header-h: 64px; }
}
@media (max-width: 1023px) {
  :root { --section-gap: var(--space-8); }
}
@media (max-width: 640px) {
  :root {
    --gutter: var(--space-4); --page-pad: var(--space-4);
    --text-3xl: 32px; --text-2xl: 24px;
  }
}
