/* ---------------------------------------------------------------------
   Design tokens
   Grounded in the subject: a reference tool for WCAG conformance testing.
   Blue is the single functional accent (links, active nav, focus).
   Green/amber/red are reserved ONLY for conformance-level and pass/fail
   signaling — never used decoratively.
------------------------------------------------------------------------ */

:root {
  /* Surfaces */
  --bg: #ffffff;
  --bg-raised: #f7f8f9;
  --bg-sidebar: #fafbfc;
  --border: #e1e4e8;
  --border-strong: #c9ced4;
  --control-border: #6b7280;

  /* Text */
  --text: #1b1f23;
  --text-muted: #4b5560;
  --text-faint: #5f6872;

  /* Accent */
  --accent: #0756d6;
  --accent-strong: #0645ad;
  --accent-tint: #eaf1ff;

  /* Semantic (conformance levels / status only) */
  --level-a: #236b3f;
  --level-aa: #8a4f00;
  --level-aaa: #6f20b5;
  --pass: #176b2d;
  --fail: #b4232d;

  /* Type */
  --font-ui: -apple-system, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Scale */
  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;
  --step-4: 2.25rem;

  /* Layout */
  --sidebar-w: 280px;
  --toc-w: 240px;
  --content-max: 44rem;
  --header-h: 56px;
  --radius: 5px;

  --shadow-sm: 0 1px 2px rgba(27, 31, 35, 0.08);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1115;
  --bg-raised: #161a20;
  --bg-sidebar: #12151a;
  --border: #262b33;
  --border-strong: #343b46;
  --control-border: #9aa4b2;

  --text: #e6e8eb;
  --text-muted: #b8c0ca;
  --text-faint: #aab3bf;

  --accent: #8ab8ff;
  --accent-strong: #a9caff;
  --accent-tint: #14213d;

  --level-a: #70d48f;
  --level-aa: #efb35d;
  --level-aaa: #d79af7;
  --pass: #56d364;
  --fail: #ff7b72;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* All interactive controls have a visible border with sufficient contrast
   against both light and dark surfaces. */
button,
input,
select,
textarea {
  border: 1px solid var(--control-border);
}

/* Respect reduced motion globally */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Visible, high-contrast focus ring everywhere — non-negotiable for this subject */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

a {
  color: var(--accent);
  text-decoration-thickness: from-font;
}

a:hover {
  color: var(--accent-strong);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  z-index: 1000;
  transition: top 0.15s ease;
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
}
