/* Shared semantic tokens. New components should use these, not literal colors.
   Loaded last, so the existing black/cyan design and layout remain the base. */
:root {
  color-scheme: light;
  --ink: #1e293b;
  --muted: #526277;
  --line: #e2e8f0;
  --white: #ffffff;
  --paper: #f5f8fa;
  --soft: #eaf5f8;
  --cyan: #076f89;
  --accent: #0891b2;
  --accent-bright: #22d3ee;
  --tint: #eef8fb;
  --body-copy: #334155;
  --control-border: #8798aa;
  --control-bg: #ffffff;
  --button-bg: #087e9b;
  --button-ink: #ffffff;
  --button-hover: #066b84;
  --header-bg: #ffffff;
  --hero-bg: #f5f8fa;
  --card-bg: #ffffff;
  --callout-bg: #eef8fb;
  --table-head: #edf4f7;
  --table-stripe: #f8fafc;
  --link-line: #82bac8;
  --shadow: 0 12px 32px #1e293b0a;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9f1f8;
  --muted: #a7b8c9;
  --line: #273746;
  --white: #080e14;
  --paper: #101a24;
  --soft: #142a35;
  --cyan: #00e5ff;
  --accent: #00e5ff;
  --accent-bright: #22d3ee;
  --tint: #11252d;
  --body-copy: #bdcedd;
  --control-border: #526779;
  --control-bg: #080f17;
  --button-bg: #00e5ff;
  --button-ink: #031217;
  --button-hover: #8cf4ff;
  --header-bg: #080e14;
  --hero-bg: #0c1824;
  --card-bg: #0f1a24;
  --callout-bg: #10232c;
  --table-head: #10232e;
  --table-stripe: #0e1923;
  --link-line: #3c8d9c;
  --shadow: 0 12px 32px #00000026;
}
body { background: var(--white); color: var(--ink); }
/* Do not animate foreground colors across an immediate background/theme change. */
a { transition: border-color .15s; }
::selection { background: var(--accent-bright); color: #1e293b; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible {
  outline-color: var(--cyan); outline-offset: 4px;
}
.header { background: var(--header-bg); backdrop-filter: none; }
.navwrap { flex-wrap: nowrap; gap: 18px; }
.header nav { margin-left: auto; gap: 20px; }
.header nav a { color: var(--body-copy); }
.header nav a:hover, .header nav a[aria-current="page"] { color: var(--cyan); }
.theme-toggle { display: inline-flex; flex: 0 0 44px; align-items: center; justify-content: center; width:44px; height:44px; padding:10px; border:1px solid var(--line); border-radius:8px; background:var(--white); color:var(--ink); }
.theme-toggle:hover { background:var(--soft); border-color:var(--cyan); }
.theme-toggle svg { flex-shrink:0; }
.theme-sun, [data-theme="dark"] .theme-moon { display:none; }
[data-theme="dark"] .theme-sun { display:block; }
.skip { background:var(--button-bg); color:var(--button-ink); }
.hero { background:var(--hero-bg); }
.hero-copy > .eyebrow, .hero-badge, .hero-description,
.hero-visual figcaption, .hero-visual figcaption a { color:var(--muted); }
.hero-badge:before { display:none; }
.hero-visual { background:var(--card-bg); border-color:var(--line); box-shadow:var(--shadow); }
.hero-visual figcaption a { text-decoration-color:var(--link-line); }
.hero-copy > .eyebrow, .hero-visual figcaption { font-size:.75rem; }
.hero-description { font-size:1rem; }
.button { background:var(--button-bg); border-color:var(--button-bg); color:var(--button-ink); box-shadow:none; }
.button:hover { background:var(--button-hover); border-color:var(--button-hover); color:var(--button-ink); }
.button-secondary, .hero .button-secondary { background:var(--white); color:var(--ink); border-color:var(--control-border); }
.button-secondary:hover { background:var(--soft); border-color:var(--cyan); color:var(--cyan); }
.button-index { border-color:currentColor; }
.guide-section, footer { background:var(--paper); }
.topic-list > a { background:var(--card-bg); }
.topic-list > a:hover, .home-main .learning-path a:hover { border-color:var(--cyan); }
.about-copy p { color:var(--body-copy); }
.quiet-link a, .quiet-link[href] { text-decoration-color:var(--link-line); }
.article-section p, .article-section li, td, .rule-lane p, .round-flow p,
.directory-article p, .try-next p { color:var(--body-copy); }
.article-section a, .source a, .roadmap a:not(.learning-path a), .policy-page a, .legal a {
  color:var(--cyan); text-decoration-color:var(--link-line);
}
.takeaway, .completion, .lesson-check, .try-next { background:var(--callout-bg); border-left-color:var(--accent); }
.takeaway p { color:var(--ink); }
.try-next { border-color:var(--line); border-left-color:var(--accent); }
thead th { background:var(--table-head); color:var(--ink); }
caption { background:var(--paper); color:var(--ink); }
tbody tr:nth-child(even) { background:var(--table-stripe); }
.source, .affiliate-panel { background:var(--paper); }
.source summary { color:var(--ink); }
.rule-lane, .round-flow li { background:var(--card-bg); }
.ad-disclosure strong { border-color:var(--control-border); }
.calculator { background:var(--callout-bg); border-color:var(--control-border); }
.calculator label, .calculator-result { color:var(--body-copy); }
.calculator .small-note { color:var(--muted); font-size:.875rem; }
input, select, textarea { font:inherit; font-size:1rem; color:var(--ink); background:var(--control-bg); border:1px solid var(--control-border); border-radius:6px; max-width:100%; }
input::placeholder, textarea::placeholder { color:var(--muted); opacity:1; }
.practice-flow li, .map-check > div { background:var(--callout-bg); border-color:var(--line); }
.list-nav a { color:var(--body-copy); background:var(--white); }
.article-search { border-color:var(--line); }
.search-control button { background:var(--soft); color:var(--ink); border-color:var(--control-border); }
.directory-article p { font-size:1rem; }
.topic-en, .topic-count, .row-link-label, .home-main .path-copy > span { font-size:.875rem; }
@media(max-width:1050px) and (min-width:901px) { .header nav { gap:12px; } .header nav a { font-size:.8125rem; } }
@media(max-width:900px) {
  .navwrap { flex-wrap:wrap; gap:10px; }
  .logo { margin-right:auto; }
  .js .menu { margin-left:auto; min-height:44px; color:var(--ink); background:var(--white); border-color:var(--control-border); }
  .js .header nav { background:var(--header-bg); margin-left:0; }
  .header nav { order:3; }
  .theme-toggle { order:2; }
  .hero-copy > .eyebrow, .hero-visual figcaption { font-size:.75rem; }
}
@media(max-width:600px) {
  .navwrap { column-gap:8px; }
  .directory-article p, .hero-description { font-size:1rem; }
  .home-main .path-copy > span, .row-link-label { font-size:.875rem; }
  .theme-toggle { border-radius:6px; }
}
