:root, :root[data-theme="light"] {
  --fg: #1a1a1a;
  --bg: #ffffff;
  --muted: #4d4d4d;
  --border: #ddd;
  --accent: #0b5fff;
  --code-bg: #f6f8fa;
  --chip-bg: #eef2ff;
  --sidebar-bg: #fafbfc;
}
:root[data-theme="dark"] {
  --fg: #e6e6e6;
  --bg: #15171a;
  --muted: #b3b3b3;
  --border: #3a3d42;
  --accent: #7fb0ff;
  --code-bg: #1d2024;
  --chip-bg: #22273a;
  --sidebar-bg: #191b1e;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
.shell { display: flex; align-items: flex-start; }
nav.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  width: 280px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.2rem 1rem 2rem;
  font-size: 0.88rem;
}
nav.sidebar .sidebar-title { font-weight: 600; margin-bottom: 0.8rem; }
nav.sidebar .sidebar-title a { color: var(--fg); }
nav.sidebar .sidebar-search { margin-bottom: 1rem; }
nav.sidebar .sidebar-search input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.85rem;
}
nav.sidebar .sidebar-overview { list-style: none; margin: 0 0 1rem; padding: 0; }
nav.sidebar .sidebar-overview li { margin: 0.15rem 0; }
nav.sidebar .sidebar-overview a { color: var(--muted); display: block; padding: 0.1rem 0.3rem; border-radius: 4px; }
nav.sidebar .sidebar-overview a:hover { color: var(--accent); }
nav.sidebar details.toc-module { margin-bottom: 0.2rem; }
nav.sidebar details.toc-module > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.3rem 0.2rem;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
nav.sidebar details.toc-module > summary::-webkit-details-marker { display: none; }
nav.sidebar details.toc-module > summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-top: 0.4em;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
nav.sidebar details.toc-module[open] > summary::before { transform: rotate(90deg); }
nav.sidebar ul.module-lessons { list-style: none; margin: 0.2rem 0 0.4rem; padding-left: 0.9rem; }
nav.sidebar ul.module-lessons li { margin: 0.1rem 0; }
nav.sidebar ul.module-lessons a {
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.12rem 0.3rem;
  border-radius: 4px;
}
nav.sidebar ul.module-lessons a:hover { color: var(--accent); text-decoration: none; }
nav.sidebar ul.module-lessons a.current { color: var(--accent); background: var(--chip-bg); font-weight: 600; }
nav.sidebar ul.module-lessons .lesson-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  margin-top: 0.5em;
}
nav.sidebar li.lesson-hidden, nav.sidebar details.module-hidden { display: none; }
.page { max-width: 70ch; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; flex: 1; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
nav.breadcrumb { font-size: 0.9rem; color: var(--muted); margin-bottom: 0; }
nav.breadcrumb a { color: var(--accent); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--fg);
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle-glyph { font-size: 0.95rem; line-height: 1; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.8rem; margin-top: 0; }
h2 { font-size: 1.3rem; margin-top: 2.2rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
h3 { font-size: 1.05rem; margin-top: 1.6rem; }
p, li { max-width: 70ch; }
.muted { color: var(--muted); font-size: 0.9rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.02em; }
.examples-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.examples-list li { padding: 0.35rem 0; border-bottom: 1px dashed var(--border); font-size: 0.92rem; }
.count-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}
.tech-group { margin: 1rem 0 1.6rem; }
.tech-group h3 { margin-top: 0.6rem; }
.tech-bar-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.3rem 0; }
.tech-bar-label { width: 11rem; flex-shrink: 0; font-size: 0.92rem; }
.tech-bar-label a { color: var(--fg); scroll-margin-top: 1rem; }
.tech-bar-track { flex: 1; background: var(--chip-bg); border-radius: 4px; height: 0.8rem; overflow: hidden; min-width: 3rem; }
.tech-bar-fill { background: var(--accent); height: 100%; border-radius: 4px; display: block; }
.tech-bar-pct { font-size: 0.82rem; color: var(--muted); white-space: nowrap; width: 3rem; text-align: right; }
.toc-modules { list-style: none; padding: 0; }
.toc-modules > li { margin-bottom: 1.2rem; }
.toc-modules h3 { margin: 0 0 0.3rem; }
.toc-modules .intro { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.5rem; }
.toc-modules ul.concepts { list-style: none; padding-left: 1rem; }
.toc-modules ul.concepts li { margin: 0.25rem 0; }
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; }
.code-lang {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: -0.4rem;
}
.mermaid-wrap { margin: 1.2rem 0; }
.mermaid { display: none; }
html.js .mermaid { display: block; }
.mermaid-fallback {
  display: block;
  background: var(--code-bg);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
}
html.js .mermaid-fallback { display: none; }
.sources-list { list-style: none; padding: 0; }
.sources-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.sources-list .domain { color: var(--muted); font-size: 0.8rem; }
.sources-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin: 0.8rem 0 1.2rem;
  background: var(--sidebar-bg);
}
.sources-preview-title { margin: 0 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em; }
.sources-preview .sources-list li:last-child { border-bottom: none; }
.ext-marker { font-size: 0.75em; margin-left: 0.15em; opacity: 0.7; }
a.autolink { text-decoration: underline; text-decoration-style: dotted; text-decoration-thickness: 1px; }
.kind-badge {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  background: var(--chip-bg);
  color: var(--muted);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  margin-right: 0.4rem;
}
.related-list { list-style: none; padding: 0; }
.related-list li { display: inline-block; margin: 0.2rem 0.4rem 0.2rem 0; }
.related-list a {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
}
.prevnext { display: flex; justify-content: space-between; margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.prevnext a { font-size: 0.92rem; }
.tech-tags { margin: 0.6rem 0; }
.tech-tags a, .tech-tags span {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  margin: 0.1rem 0.3rem 0.1rem 0;
  background: var(--chip-bg);
  border-radius: 999px;
  color: var(--fg);
}
footer { margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 1rem; }
@media print {
  nav.sidebar, nav.breadcrumb, footer, .theme-toggle { display: none; }
  a { color: inherit; text-decoration: underline; }
  .page { max-width: none; }
}
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  nav.sidebar {
    position: static;
    height: auto;
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .page { padding: 1rem 0.9rem 3rem; max-width: none; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .tech-bar-label { width: 8rem; }
}
.curriculum-badge {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--chip-bg);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}
.on-this-page {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 1rem 0 1.6rem;
  font-size: 0.9rem;
}
.on-this-page .otp-title { font-weight: 600; margin: 0 0 0.3rem; }
.on-this-page ul { list-style: none; padding-left: 0.2rem; margin: 0; }
.on-this-page li { margin: 0.2rem 0; }
.concept-marker-line { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 1rem; }
.source-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--chip-bg);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
}
.evidence-line { color: var(--muted); font-size: 0.88rem; margin: 0.3rem 0; }
.missing-line { color: var(--muted); font-size: 0.88rem; margin: 0.3rem 0; font-style: italic; }
.your-path { border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.2rem; margin: 1rem 0 2rem; }
.your-path ul { list-style: none; padding-left: 0; margin: 0.4rem 0; }
.your-path li { padding: 0.25rem 0; }
.your-path details { margin-top: 0.8rem; }
.your-path summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.your-path-module { margin: 1rem 0; }
.your-path-module h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.your-path-module:first-of-type { margin-top: 0.4rem; }
.path-number { color: var(--muted); font-size: 0.85rem; margin-right: 0.5rem; font-variant-numeric: tabular-nums; }
.path-wrench { font-size: 0.85rem; opacity: 0.8; margin-left: 0.3rem; }
.practice-path-lead { color: var(--muted); font-size: 0.92rem; margin: 0.2rem 0 1rem; }
.practice-steps { list-style: none; padding: 0; margin: 0.6rem 0 1.2rem; }
.practice-steps li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0 0 0.8rem;
}
.practice-steps li:last-child { margin-bottom: 0; }
.practice-step-title { margin: 0 0 0.4rem; font-weight: 600; }
.practice-step-title .path-number { font-weight: 400; }
.practice-step-why { margin: 0 0 0.5rem; }
.practice-step-source { font-size: 0.85rem; color: var(--muted); margin: 0.3rem 0; }
.practice-step-done { color: var(--muted); font-size: 0.85rem; font-style: italic; margin: 0.3rem 0 0; }
.practice-link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  margin: 0 0 1.4rem;
  text-decoration: none;
}
.practice-link-button:hover { border-color: var(--accent); text-decoration: none; }
.practice-link-button-end { margin: 2rem 0 0; }
nav.sidebar ul.module-lessons .lesson-practice-link {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.05rem 0.3rem 0.1rem 1.1rem;
  text-decoration: none;
}
nav.sidebar ul.module-lessons .lesson-practice-link:hover { color: var(--accent); text-decoration: none; }
nav.sidebar ul.module-lessons .lesson-practice-link.current { color: var(--accent); font-weight: 600; }
.practice-lead { color: var(--muted); font-size: 0.92rem; margin: 0.2rem 0 1.4rem; }
.practice-section-title { margin-top: 2.2rem; }
.practice-back-link { margin-top: 2rem; }

/* Site pages (landing, learning center, families, keys, search): the mock's rules, scoped to body.site so they never
   touch the lesson shell. The build appends this file to the shipped course.css and writes ONE stylesheet, /_assets/site.css. */
body.site main { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
body.site h1 { margin: 0 0 0.4rem; }
body.site h3 { margin: 0 0 0.3rem; }
body.site header.top { background: var(--sidebar-bg); border-bottom: 1px solid var(--border); }
.top-inner { max-width: 1040px; margin: 0 auto; padding: 0.8rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 600; color: var(--fg); }
.brand span { color: var(--muted); font-weight: 400; }
.top-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
nav.site a { margin-right: 1rem; color: var(--muted); font-size: 0.92rem; }
nav.site a.current { color: var(--accent); }
nav.site a:last-child { margin-right: 0; }
body.site nav.breadcrumb { margin-bottom: 1rem; }
.search { margin: 1.2rem 0 0.4rem; display: flex; gap: 0.5rem; max-width: 70ch; }
.search input { flex: 1; min-width: 0; padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font-size: 1rem; }
.search button { padding: 0.55rem 1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--chip-bg); color: var(--fg); font-size: 0.95rem; cursor: pointer; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 0; list-style: none; padding: 0; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.1rem; background: var(--bg); }
.card p { margin: 0.3rem 0 0.6rem; font-size: 0.92rem; color: var(--muted); }
.card.module { border-color: var(--accent); background: var(--chip-bg); grid-column: 1 / -1; }
.card.module p { color: var(--fg); }
.card.planned { background: var(--sidebar-bg); }
.card.planned h3 { color: var(--muted); }
.chips { list-style: none; padding: 0; margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chips li { font-size: 0.8rem; background: var(--chip-bg); border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.6rem; color: var(--muted); }
.card.module .chips li { background: var(--bg); }
.roles { list-style: none; padding: 0; margin: 0; }
.roles > li { border-top: 1px solid var(--border); padding: 1rem 0 1.1rem; }
.roles > li:last-child { border-bottom: 1px solid var(--border); }
.role-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.role-head .pathway { font-size: 0.9rem; white-space: nowrap; }
.areas { margin: 0.4rem 0 0; padding-left: 1.2rem; font-size: 0.95rem; columns: 2; column-gap: 2rem; }
.areas li { break-inside: avoid; margin: 0.1rem 0; }
.status { font-size: 0.78rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted); }
.attribution { color: var(--muted); font-size: 0.9rem; margin: 0.2rem 0 1rem; }
.key-line { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 1rem; }
.planned-list { list-style: none; padding: 0; }
.planned-list li { padding: 0.35rem 0; border-bottom: 1px dashed var(--border); font-size: 0.95rem; }
.planned-list code { color: var(--muted); font-size: 0.8rem; margin-left: 0.4rem; }
.depth-chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 0.4rem; margin-left: 0.4rem; }
.step-why { color: var(--muted); font-size: 0.9rem; margin: 0.1rem 0 0.7rem 2rem; }
.banner { border: 1px solid var(--accent); background: var(--chip-bg); border-radius: 8px; padding: 0.6rem 1rem; margin: 0 0 1rem; }
footer p { max-width: none; }
body.site footer { border-top: 1px solid var(--border); margin: 2rem 0 0; }
.foot-inner { max-width: 1040px; margin: 0 auto; padding: 1rem 1.5rem 2rem; }
#search { max-width: 70ch; margin-top: 1rem; }
/* One search box: the site's form feeds Pagefind's UI (search.js), so the UI's own input, clear button, icon and count line stay hidden. */
#search .pagefind-ui__search-input, #search .pagefind-ui__search-clear, #search .pagefind-ui__message { display: none; }
#search .pagefind-ui__form::before { display: none; }
#result-count { font-size: 0.9rem; color: var(--muted); }
@media (max-width: 640px) {
  .top-inner, body.site main, .foot-inner { padding-left: 1rem; padding-right: 1rem; }
  nav.site a { margin-right: 0.9rem; }
  .areas { columns: 1; }
  body.site h1 { font-size: 1.5rem; }
  .step-why { margin-left: 0; }
}
.path-list { list-style: none; padding-left: 0; }
/* narrow screens: a wide diagram or code line scrolls inside its block, never the page */
.shell, .page, main { min-width: 0; max-width: 100%; }
.page { width: 100%; }
pre { max-width: 100%; overflow-x: auto; }
.mermaid-wrap { max-width: 100%; overflow-x: auto; }
.mermaid svg { max-width: 100%; height: auto; }
table { display: block; overflow-x: auto; }
