:root {
  /* Typography scale — modular, 1.25 ratio */
  --font-body: 'Source Serif 4', 'Georgia', serif;
  --font-heading: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --font-size-xs: 0.8rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-md: 1.125rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 1.875rem;
  --font-size-3xl: 2.25rem;
  --line-height-tight: 1.25;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing — 4px base */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --content-width: 42rem;
  --page-width: 72rem;
  --sidebar-width: 16rem;
  --border-radius-sm: 4px;
  --border-radius-md: 6px;
  --border-radius-lg: 8px;

  /* Colors — light theme */
  --color-bg: #fafaf8;
  --color-bg-alt: #f2f1ed;
  --color-bg-card: #ffffff;
  --color-bg-code: #f5f4f0;
  --color-border: #d8d6cf;
  --color-border-light: #e8e6e0;

  --color-text: #2c2c2c;
  --color-text-secondary: #5c5c5c;
  --color-text-tertiary: #8a8a8a;
  --color-text-inverse: #fafaf8;

  --color-primary: #2a5a3c;
  --color-primary-hover: #1e4a2f;
  --color-primary-light: #e8f0eb;
  --color-primary-text: #ffffff;

  --color-accent: #6b4c8a;
  --color-accent-light: #f0eaf5;

  --color-success: #2a7a3c;
  --color-success-light: #e6f5ea;
  --color-warning: #8a6b1a;
  --color-warning-light: #fdf5e0;
  --color-error: #9a2a2a;
  --color-error-light: #fde8e8;
  --color-info: #2a5a8a;
  --color-info-light: #e8f0f8;

  /* Level colors — Foundation / Standard / Challenge */
  --color-foundation: #3a7ca5;
  --color-foundation-light: #e8f2f8;
  --color-standard: #2a5a3c;
  --color-standard-light: #e8f0eb;
  --color-challenge: #8a5a2a;
  --color-challenge-light: #f8f0e8;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a1e;
    --color-bg-alt: #222226;
    --color-bg-card: #2a2a2e;
    --color-bg-code: #252528;
    --color-border: #3a3a3e;
    --color-border-light: #32323a;

    --color-text: #e4e4e0;
    --color-text-secondary: #a8a8a4;
    --color-text-tertiary: #707070;
    --color-text-inverse: #1a1a1e;

    --color-primary: #5aaa6c;
    --color-primary-hover: #6aba7c;
    --color-primary-light: #1e2e22;
    --color-primary-text: #1a1a1e;

    --color-accent: #a07cc0;
    --color-accent-light: #2a2238;

    --color-success: #5aaa6c;
    --color-success-light: #1e2e22;
    --color-warning: #c0a040;
    --color-warning-light: #2e2a1a;
    --color-error: #c05050;
    --color-error-light: #2e1a1a;
    --color-info: #5a9ac0;
    --color-info-light: #1a2a38;

    --color-foundation: #5aaac8;
    --color-foundation-light: #1a2a38;
    --color-standard: #5aaa6c;
    --color-standard-light: #1e2e22;
    --color-challenge: #c09050;
    --color-challenge-light: #2e2a1a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.15);
  }
}
