/* ===== CSS Custom Properties ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --bg-subtle: #eef0f5;
  --bg-header: #1a1a2e;
  --bg-nav: #16213e;
  --text: #1c2333;
  --text-muted: #6b7280;
  --text-header: #e2e8f0;
  --border: #dde1e8;
  --border-subtle: #eef0f5;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --control-bg: #f0f2f5;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.13);
  --highlight: #fef9c3;
  --radius-sm: 3px;
  --radius: 6px;
  --radius-lg: 10px;
  --transition: 0.15s ease;

  /* Status colors */
  --status-full: #16a34a;
  --status-full-bg: #f0fdf4;
  --status-partial: #d97706;
  --status-partial-bg: #fffbeb;
  --status-none: #dc2626;
  --status-none-bg: #fef2f2;
  --status-extension: #2563eb;
  --status-extension-bg: #eff6ff;
  --status-workaround: #7c3aed;
  --status-workaround-bg: #f5f3ff;

  /* Reserved words */
  --reserved: #dc2626;
  --reserved-bg: #fef2f2;
  --non-reserved: #6b7280;
  --non-reserved-bg: #f9fafb;

  --sticky-bg: var(--bg);
  --sticky-bg-alt: var(--bg-alt);
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-alt: #16213e;
  --bg-subtle: #1e2540;
  --bg-header: #0f0f1a;
  --bg-nav: #0f0f1a;
  --text: #e2e8f0;
  --text-muted: #9ca3af;
  --text-header: #e2e8f0;
  --border: #2a2a4a;
  --border-subtle: #222240;
  --link: #60a5fa;
  --link-hover: #93c5fd;
  --control-bg: #16213e;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
  --highlight: #3d3200;

  --status-full: #4ade80;
  --status-full-bg: #052e16;
  --status-partial: #fbbf24;
  --status-partial-bg: #1c1200;
  --status-none: #f87171;
  --status-none-bg: #1f0000;
  --status-extension: #60a5fa;
  --status-extension-bg: #0c1a3a;
  --status-workaround: #a78bfa;
  --status-workaround-bg: #1e0a3c;

  --reserved: #f87171;
  --reserved-bg: #1f0000;
  --non-reserved: #6b7280;
  --non-reserved-bg: #1a1a2e;

  --sticky-bg: var(--bg);
  --sticky-bg-alt: var(--bg-alt);
}

/* Auto dark mode when no explicit theme set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a2e;
    --bg-alt: #16213e;
    --bg-subtle: #1e2540;
    --bg-header: #0f0f1a;
    --bg-nav: #0f0f1a;
    --text: #e2e8f0;
    --text-muted: #9ca3af;
    --text-header: #e2e8f0;
    --border: #2a2a4a;
    --border-subtle: #222240;
    --link: #60a5fa;
    --link-hover: #93c5fd;
    --control-bg: #16213e;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
    --highlight: #3d3200;

    --status-full: #4ade80;
    --status-full-bg: #052e16;
    --status-partial: #fbbf24;
    --status-partial-bg: #1c1200;
    --status-none: #f87171;
    --status-none-bg: #1f0000;
    --status-extension: #60a5fa;
    --status-extension-bg: #0c1a3a;
    --status-workaround: #a78bfa;
    --status-workaround-bg: #1e0a3c;

    --reserved: #f87171;
    --reserved-bg: #1f0000;
    --non-reserved: #6b7280;
    --non-reserved-bg: #1a1a2e;

    --sticky-bg: var(--bg);
    --sticky-bg-alt: var(--bg-alt);
  }
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Focus Styles ===== */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* ===== Base Typography ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9375rem;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

code, pre, .mono {
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.65;
}

code {
  font-size: 0.875em;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h4 {
  font-size: 0.9375rem;
  font-weight: 600;
}
