/* ============================================================
   Atomic Agents — Explainer Pages
   Apple-quality stylesheet (light + dark mode)
   ============================================================ */

:root {
  /* Light mode (default) */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-subtle: #86868b;
  --accent: #0071e3;
  --accent-soft: #e8f1fc;
  --accent-hover: #0077ed;
  --border: #e8e8ed;
  --border-strong: #d2d2d7;
  --success: #34c759;
  --success-soft: #e6f7eb;
  --warning: #ff9500;
  --warning-soft: #fff3e0;
  --danger: #ff3b30;
  --danger-soft: #ffe5e3;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

html.dark {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #f5f5f7;
  --text-muted: #aeaeb2;
  --text-subtle: #8e8e93;
  --accent: #2997ff;
  --accent-soft: #1c2e44;
  --accent-hover: #5cb2ff;
  --border: #3a3a3c;
  --border-strong: #48484a;
  --success: #30d158;
  --success-soft: #1a3a25;
  --warning: #ff9f0a;
  --warning-soft: #3a2a10;
  --danger: #ff453a;
  --danger-soft: #3a1c1a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  html:not(.light) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --text: #f5f5f7;
    --text-muted: #aeaeb2;
    --text-subtle: #8e8e93;
    --accent: #2997ff;
    --accent-soft: #1c2e44;
    --accent-hover: #5cb2ff;
    --border: #3a3a3c;
    --border-strong: #48484a;
    --success: #30d158;
    --success-soft: #1a3a25;
    --warning: #ff9f0a;
    --warning-soft: #3a2a10;
    --danger: #ff453a;
    --danger-soft: #3a1c1a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

/* ============================================================
   Base typography + layout
   ============================================================ */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 {
  margin: 0 0 0.4em;
  letter-spacing: -0.022em;
  font-weight: 600;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  letter-spacing: -0.03em;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  margin-top: 2.5em;
  margin-bottom: 0.6em;
}

h3 {
  font-size: 1.35rem;
  margin-top: 1.8em;
  margin-bottom: 0.4em;
}

h4 {
  font-size: 1.05rem;
  margin-top: 1.2em;
  font-weight: 600;
  color: var(--text-muted);
}

p {
  margin: 0 0 1em;
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

code, kbd, pre {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono",
               "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

code {
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--text);
  border: 1px solid var(--border);
}

pre {
  background: var(--surface-2);
  padding: 1.25em 1.5em;
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid var(--border);
  font-size: 0.88em;
  line-height: 1.55;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em 0;
}

ul, ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

li {
  margin-bottom: 0.4em;
}

strong {
  font-weight: 600;
  color: var(--text);
}

em {
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   Layout containers
   ============================================================ */

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  padding: 4rem 0 6rem;
}

/* ============================================================
   Navigation bar
   ============================================================ */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

html.dark .topnav {
  background: rgba(0, 0, 0, 0.72);
}

@media (prefers-color-scheme: dark) {
  html:not(.light) .topnav {
    background: rgba(0, 0, 0, 0.72);
  }
}

.topnav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topnav-brand {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.topnav-brand:hover {
  color: var(--text);
  text-decoration: none;
}

.topnav-brand-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: 1px;
}

.topnav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.topnav-link {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.topnav-link:hover {
  color: var(--text);
  text-decoration: none;
}

.topnav-link.active {
  color: var(--text);
  font-weight: 500;
}

.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--border);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
html.dark .theme-toggle .icon-moon { display: block; }
html.dark .theme-toggle .icon-sun { display: none; }

@media (prefers-color-scheme: dark) {
  html:not(.light) .theme-toggle .icon-moon { display: block; }
  html:not(.light) .theme-toggle .icon-sun { display: none; }
}

/* ============================================================
   Hero section
   ============================================================ */

.hero {
  text-align: center;
  padding: 5rem 0 3rem;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero-lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 2rem;
  line-height: 1.5;
}

/* ============================================================
   Article body (concept pages)
   ============================================================ */

article p {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
}

article p.lead {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

article ul li, article ol li {
  font-size: 1.02rem;
  line-height: 1.55;
}

/* ============================================================
   Card grid (index page)
   ============================================================ */

.card-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin: 3rem 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: block;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text);
}

.card-number {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0.2rem 0 0.6rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ============================================================
   Callout boxes (note, warning, key idea)
   ============================================================ */

.callout {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
  border: 1px solid var(--border);
  background: var(--surface);
}

.callout-title {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.callout-title::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.callout-note {
  background: var(--accent-soft);
  border-color: rgba(0, 113, 227, 0.18);
}
.callout-note .callout-title { color: var(--accent); }
.callout-note .callout-title::before { background: var(--accent); }

.callout-key {
  background: var(--success-soft);
  border-color: rgba(52, 199, 89, 0.18);
}
.callout-key .callout-title { color: var(--success); }
.callout-key .callout-title::before { background: var(--success); }

.callout-warning {
  background: var(--warning-soft);
  border-color: rgba(255, 149, 0, 0.18);
}
.callout-warning .callout-title { color: var(--warning); }
.callout-warning .callout-title::before { background: var(--warning); }

.callout p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Diagram containers
   ============================================================ */

.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2.5rem 0;
  text-align: center;
  overflow-x: auto;
}

.diagram .mermaid {
  display: inline-block;
  margin: 0 auto;
  min-width: 320px;
}

.diagram-caption {
  font-size: 0.88rem;
  color: var(--text-subtle);
  margin-top: 1rem;
  font-style: italic;
}

/* ============================================================
   Two-column compare layout
   ============================================================ */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 2rem 0;
}

@media (max-width: 640px) {
  .compare {
    grid-template-columns: 1fr;
  }
}

.compare-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.compare-pane h4 {
  margin-top: 0;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.compare-pane.compare-old { border-left: 3px solid var(--danger); }
.compare-pane.compare-new { border-left: 3px solid var(--success); }

.compare-pane p {
  font-size: 0.92rem;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================
   Definition list (for glossary-style content)
   ============================================================ */

.deflist {
  margin: 2rem 0;
  display: grid;
  gap: 0.25rem;
}

.deflist dt {
  font-weight: 600;
  color: var(--text);
  margin-top: 1.25rem;
  font-size: 1rem;
}

.deflist dt:first-child {
  margin-top: 0;
}

.deflist dd {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

/* ============================================================
   File tree visualization
   ============================================================ */

.filetree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  margin: 1.75rem 0;
  overflow-x: auto;
}

.filetree .ft-line {
  display: block;
  white-space: pre;
}

.filetree .ft-name {
  color: var(--text);
}

.filetree .ft-dir {
  color: var(--accent);
  font-weight: 600;
}

.filetree .ft-desc {
  color: var(--text-subtle);
  font-style: normal;
  margin-left: 1rem;
  font-size: 0.88em;
}

/* ============================================================
   Footer navigation between pages
   ============================================================ */

.pagenav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 4rem 0 1rem;
}

@media (max-width: 540px) {
  .pagenav {
    grid-template-columns: 1fr;
  }
}

.pagenav-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  display: block;
}

.pagenav-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
}

.pagenav-link.next {
  text-align: right;
}

.pagenav-eyebrow {
  font-size: 0.8rem;
  color: var(--text-subtle);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.pagenav-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

/* ============================================================
   Footer
   ============================================================ */

footer {
  border-top: 1px solid var(--border);
  margin-top: 5rem;
  padding: 2.5rem 0 3rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-subtle);
}

footer p {
  margin: 0.3rem 0;
  color: var(--text-subtle);
  font-size: 0.88rem;
}

/* ============================================================
   Mermaid theming tweaks
   ============================================================ */

.mermaid svg {
  max-width: 100%;
  height: auto !important;
}

/* ============================================================
   Small bits + responsive
   ============================================================ */

.intro-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

/* 3-stat variant: 3-across at desktop, stacks below 720px */
.intro-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .intro-row-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .intro-row {
    grid-template-columns: 1fr;
  }
}

.intro-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.intro-stat-num {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  margin: 0 0 0.2rem;
  line-height: 1;
}

.intro-stat-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.pill {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 100px;
  font-size: 0.78em;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  letter-spacing: 0.01em;
}

.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(0, 113, 227, 0.18);
}

.pill-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(52, 199, 89, 0.18);
}

/* ============================================================
   Long-scroll explainer layout (single-page index)
   ============================================================ */

/* Hero — added twin-CTA row + note */
.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 1.75rem 0 0.5rem;
  justify-content: center;
}

.cta {
  display: inline-block;
  padding: 0.75rem 1.6rem;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  border: 1px solid transparent;
}

.cta-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-sm);
}

.cta-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: white;
}

.cta-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.cta-secondary:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}

.hero-note {
  margin: 1.5rem auto 0;
  max-width: 640px;
  font-size: 0.87rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
}

/* Wider container specifically for the long-scroll explainer body.
   Hero stays in .container (760px); explainer-layout breaks out to 1200px
   so content has actual breathing room next to the TOC.
   Math at 1200px container: 1200 - 48px padding - 240px TOC - 64px gap
   = ~848px content column. Comfortable reading + visible TOC. */
.container-explainer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Two-column layout: content (DOM-first → LEFT) + sticky TOC sidebar (DOM-second → RIGHT) */
.explainer-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin: 3rem 0;
  position: relative;
}

@media (min-width: 1024px) {
  .explainer-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 4rem;
  }
}

.explainer {
  min-width: 0; /* prevent grid blowout */
  /* Grid column sizing handles content width — see .explainer-layout below */
}

/* Sticky TOC */
.toc {
  display: none;
}

@media (min-width: 1024px) {
  .toc {
    display: block;
    position: sticky;
    top: 5rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding: 1.25rem 0 1.25rem 1.5rem;
    border-left: 1px solid var(--border);
    font-size: 0.86rem;
  }
}

.toc-label {
  margin: 0 0 0.85rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.toc-list li {
  counter-increment: toc-counter;
  margin: 0;
  padding: 0;
}

.toc-list a {
  display: block;
  padding: 0.5rem 0;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 0.85rem;
  margin-left: -2px;
  line-height: 1.4;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-list a:before {
  content: counter(toc-counter) ". ";
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.toc-list a:hover {
  color: var(--text);
}

.toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* Section spacing for long-scroll */
.section {
  margin: 4rem 0 5rem;
  scroll-margin-top: 5rem;
}

.section:first-of-type {
  margin-top: 2rem;
}

.section-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

.section h2 {
  margin: 0 0 1.25rem;
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.section h3 {
  margin: 2.5rem 0 1rem;
  font-size: 1.45rem;
  letter-spacing: -0.015em;
}

.section-lede {
  font-size: 1.18rem;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 2rem;
}

.section-lede strong {
  font-weight: 600;
}

/* Figure container — title above, caption below */
.figure {
  margin: 2.25rem 0;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.figure-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin: 0 0 1rem;
}

.figure-caption {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  font-style: italic;
}

/* File-tree visual (used in Section 1) */
.filetree {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
  overflow-x: auto;
  margin: 0;
}

.filetree code {
  background: none;
  padding: 0;
  font-family: inherit;
  color: inherit;
  white-space: pre;
}

/* Collapsible deep-dive sections */
.deep-dive {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.deep-dive summary {
  padding: 0.95rem 1.25rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.15s ease;
  user-select: none;
}

.deep-dive summary::-webkit-details-marker {
  display: none;
}

.deep-dive summary::before {
  content: '▸';
  display: inline-block;
  color: var(--text-subtle);
  transition: transform 0.18s ease;
  font-size: 0.85em;
  flex-shrink: 0;
}

.deep-dive[open] summary::before {
  transform: rotate(90deg);
}

.deep-dive summary:hover {
  background: var(--surface-2);
}

.deep-dive > *:not(summary) {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.deep-dive > *:not(summary):first-of-type {
  padding-top: 0.5rem;
}

.deep-dive > *:not(summary):last-child {
  padding-bottom: 1.25rem;
}

.deep-dive p,
.deep-dive ul,
.deep-dive ol,
.deep-dive dl,
.deep-dive pre {
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Spec list (Section 6) */
.spec-list {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
}

.spec-list li {
  margin: 0.65rem 0;
  font-size: 0.97rem;
  line-height: 1.55;
}

.spec-list strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Footer CTA row */
.footer-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  margin: 0 0 2rem;
}

.footer-cta {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: 100px;
  font-size: 0.92rem;
  text-decoration: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  transition: background 0.15s ease, transform 0.15s ease;
}

.footer-cta:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
  color: var(--text);
}

/* ============================================================
   Print-friendly
   ============================================================ */

@media print {
  .topnav, .theme-toggle, .pagenav, .toc, .hero-cta-row { display: none; }
  body { background: white; color: black; }
  .diagram, .callout, .filetree, .figure, .deep-dive { break-inside: avoid; }
  .deep-dive[open] > * { display: block !important; }
  .deep-dive > *:not(summary) { display: block !important; }
}
