/* ==========================================================================
   Scenario-System Design (SSD) — Design System
   Vanilla CSS3 · Custom Properties · Light/Dark Themes · Responsive
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", SFMono-Regular, Consolas, monospace;

  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-soft: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --accent-border: rgba(79, 70, 229, 0.35);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.06);
  --header-bg: rgba(248, 250, 252, 0.85);

  --grid-line: rgba(15, 23, 42, 0.03);
  --glow-1: #6366f1;
  --glow-2: #38bdf8;
  --glow-opacity: 0.12;

  --code-bg: #0b1120;
  --code-border: #1e293b;
  --code-text: #e2e8f0;

  --header-h: 64px;
  --measure: 760px;
  --radius: 12px;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #090d16;
  --bg-elevated: #0f172a;
  --bg-soft: #101827;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.1);
  --accent-border: rgba(129, 140, 248, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 24px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(9, 13, 22, 0.82);

  --grid-line: rgba(129, 140, 248, 0.05);
  --glow-1: #4f46e5;
  --glow-2: #7c3aed;
  --glow-opacity: 0.18;

  color-scheme: dark;
}

/* No-JS fallback: follow system preference when the attribute is absent */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #090d16;
    --bg-elevated: #0f172a;
    --bg-soft: #101827;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --accent: #818cf8;
    --accent-soft: rgba(129, 140, 248, 0.1);
    --accent-border: rgba(129, 140, 248, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 24px rgba(0, 0, 0, 0.45);
    --header-bg: rgba(9, 13, 22, 0.82);
    --grid-line: rgba(129, 140, 248, 0.05);
    --glow-1: #4f46e5;
    --glow-2: #7c3aed;
    --glow-opacity: 0.18;
    color-scheme: dark;
  }
}

/* ---------- Base / Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Background Art — pure CSS, zero external assets
   body::before  · Architectural grid with radial vignette mask
   body::after   · Ambient top-hero glow
   Sits behind all content; hidden entirely in print.
   ========================================================================== */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Architectural grid, masked so it fades out below the hero/TOC region */
body::before {
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 10%, black 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 10%, black 40%, transparent 100%);
}

/* Ambient indigo glow centred at the top of the viewport */
body::after {
  width: 800px;
  height: 500px;
  inset: 0 auto auto 50%;
  margin-left: -400px;
  background: radial-gradient(circle, var(--glow-1) 0%, var(--glow-2) 60%, transparent 100%);
  filter: blur(120px);
  opacity: var(--glow-opacity);
  will-change: transform;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.6rem; margin: 0 0 1rem; }
h3 { font-size: 1.175rem; margin: 0 0 0.5rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover { text-decoration: underline; }

strong { font-weight: 650; }

::selection {
  background: var(--accent);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
}

.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  color: var(--accent);
  display: inline-flex;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.brand-slogan {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  color: var(--text);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.icon-link:hover {
  background: var(--accent-soft);
  border-color: var(--border);
  text-decoration: none;
}

.icon-link:active { transform: translateY(1px); }

.icon-link-label { display: none; }

@media (min-width: 768px) {
  .icon-link-label { display: inline; }
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.theme-toggle:hover { background: var(--accent-soft); }
.theme-toggle:active { transform: scale(0.94); }

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Mobile TOC toggle */
.toc-toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.toc-toggle:hover { background: var(--accent-soft); }
.toc-toggle:active { transform: scale(0.97); }

/* ---------- Page Layout ---------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

main {
  min-width: 0;
}

article {
  max-width: var(--measure);
}

section {
  scroll-margin-top: calc(var(--header-h) + 24px);
  padding-bottom: 1.5rem;
}

section + section,
.hero + section {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  padding-top: 2.5rem;
}

/* ---------- TOC ---------- */
.toc-wrap {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  max-height: calc(100vh - var(--header-h) - 4rem);
  overflow-y: auto;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.toc-list li a {
  display: block;
  padding: 0.4rem 0 0.4rem 1rem;
  margin-left: -2px;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-list li a:hover {
  color: var(--text);
  text-decoration: none;
}

.toc-list li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- Hero ---------- */
.hero {
  padding-bottom: 0.5rem;
}

.hero-acronym {
  color: var(--accent);
  font-weight: 600;
}

.hero-slogan {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.badge-label {
  padding: 0.25rem 0.6rem;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
}

.badge-value {
  padding: 0.25rem 0.7rem;
  color: var(--text);
  font-weight: 500;
}

a.badge-value:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Anchor links on headings ---------- */
.anchor-link {
  margin-left: 0.4rem;
  color: var(--text-muted);
  opacity: 0;
  font-weight: 400;
  transition: opacity 0.15s ease;
}

h2:hover .anchor-link,
.anchor-link:focus-visible {
  opacity: 1;
}

/* ---------- Prose lists ---------- */
article > section > ul:not([class]),
article > section ol:not([class]) {
  padding-left: 1.4rem;
  margin-bottom: 1.25rem;
}

article li { margin-bottom: 0.4rem; }

/* ---------- Callouts ---------- */
.callout {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.value-callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.value-callout p { margin: 0; }

.axiom-callout {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.axiom-callout p {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
}

/* ---------- Contrast cards (Waste Pendulum) ---------- */
.contrast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.contrast-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}

.contrast-card h3 { font-size: 1.05rem; }

.trap-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: -0.25rem 0 0.6rem;
}

.trap-under { border-top: 3px solid #dc2626; }
.trap-over { border-top: 3px solid #d97706; }

html[data-theme="dark"] .trap-under { border-top-color: #f87171; }
html[data-theme="dark"] .trap-over { border-top-color: #fbbf24; }

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.tag-tomorrow {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.tag-today {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

html[data-theme="dark"] .tag-today { color: #34d399; }

/* ---------- Axiom grid ---------- */
.axiom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.axiom-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}

.axiom-item h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.05rem;
}

.axiom-item p:last-child { margin-bottom: 0; }

/* ---------- Phases ---------- */
.phases {
  list-style: none;
  counter-reset: phase;
  margin: 1.75rem 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

.phase-card {
  counter-increment: phase;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.phase-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

.phase-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.phase-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.phase-card h3 { margin-bottom: 0.75rem; }

.phase-card ul {
  margin: 0;
  padding-left: 1.25rem;
}

.phase-card li { margin-bottom: 0.5rem; }
.phase-card li:last-child { margin-bottom: 0; }

/* ---------- Guardrails ---------- */
.guardrails {
  list-style: none;
  margin: 1.75rem 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.guardrail-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.25rem;
  box-shadow: var(--shadow);
}

.guardrail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  margin-bottom: 0.85rem;
}

.guardrail-card h3 { font-size: 1.05rem; }
.guardrail-card p { margin: 0; font-size: 0.95rem; color: var(--text-muted); }

/* ---------- Code Panels ---------- */
.panel {
  margin: 1.5rem 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem 0.55rem 1.1rem;
  border-bottom: 1px solid var(--code-border);
  background: rgba(255, 255, 255, 0.03);
}

.panel-lang {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.copy-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.copy-btn:hover {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #475569;
}

.copy-btn:active { transform: scale(0.96); }

.copy-btn.copied {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

.panel-body {
  margin: 0;
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--code-text);
  tab-size: 2;
}

.panel-body:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Markdown token styling inside code panels */
.tok-h { color: #a78bfa; font-weight: 600; }
.tok-b { color: #818cf8; }
.tok-k { color: #e2e8f0; }
.tok-p { color: #7dd3fc; font-style: italic; }

code.inline-code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.12em 0.4em;
  color: var(--text);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.footer-links a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .page {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 1.5rem;
  }

  .toc-toggle { display: inline-flex; }

  .toc-wrap {
    position: static;
    max-height: 0;
    overflow: hidden;
    margin-bottom: 0;
    transition: max-height 0.3s ease, margin-bottom 0.3s ease;
  }

  .toc-wrap.open {
    max-height: 480px;
    margin-bottom: 2rem;
  }

  .toc {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 767px) {
  body { font-size: 1rem; }

  .brand-slogan { display: none; }

  .contrast-grid,
  .axiom-grid {
    grid-template-columns: 1fr;
  }

  .guardrails {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .axiom-callout p { font-size: 1.1rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Walkthrough: The Three Paths ---------- */
.paths {
  list-style: none;
  margin: 1.75rem 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.path-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
}

.path-card-a { border-top: 3px solid #dc2626; }
.path-card-b { border-top: 3px solid #d97706; }
.path-card-c { border-top: 3px solid #059669; }

html[data-theme="dark"] .path-card-a { border-top-color: #f87171; }
html[data-theme="dark"] .path-card-b { border-top-color: #fbbf24; }
html[data-theme="dark"] .path-card-c { border-top-color: #34d399; }

.path-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.path-header h3 { margin: 0; }

.path-tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.path-tag-bad {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.35);
}

.path-tag-warn {
  color: #b45309;
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.path-tag-good {
  color: #059669;
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.35);
}

html[data-theme="dark"] .path-tag-bad { color: #f87171; }
html[data-theme="dark"] .path-tag-warn { color: #fbbf24; }
html[data-theme="dark"] .path-tag-good { color: #34d399; }

.path-steps {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}

.path-steps li { margin-bottom: 0.5rem; }

.path-failure { color: var(--text-muted); margin-bottom: 0; }

.path-success { margin-top: 1rem; }

.path-card .panel { margin: 1rem 0 0; }

/* ---------- Code token colors (Java) ---------- */
.tok-cm { color: #64748b; font-style: italic; }
.tok-kw { color: #c084fc; }
.tok-ty { color: #7dd3fc; }
.tok-st { color: #86efac; }

/* ---------- FAQ ---------- */
.faq-list {
  display: grid;
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.faq-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s ease;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary:hover { color: var(--accent); }

.faq-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-chevron { transform: rotate(180deg); }

.faq-answer {
  padding: 0 1.25rem 1.15rem;
  color: var(--text-muted);
}

.faq-answer p { margin: 0; }

/* ---------- Badge preview ---------- */
.badge-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.75rem 1rem;
  margin: 1.5rem 0;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.badge-preview svg {
  max-width: 100%;
  height: auto;
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .toc-wrap,
  .toc-toggle,
  .panel-header,
  .copy-btn,
  .footer-links,
  .anchor-link,
  .skip-link,
  .faq-chevron {
    display: none !important;
  }

  /* Strip background art for clean pure-white paper/PDF output */
  body::before,
  body::after {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11.5pt;
    line-height: 1.5;
  }

  .page {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 100%;
    padding: 0;
  }

  h1, h2, h3, h4, p, li, strong, em {
    color: #000000 !important;
  }

  a {
    color: #000000 !important;
    text-decoration: underline;
  }

  section + section,
  .hero + section { border-top-color: #cccccc; }

  .callout,
  .axiom-callout,
  .contrast-card,
  .phase-card,
  .guardrail-card,
  .axiom-item,
  .path-card,
  .faq-item,
  .badge-preview {
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .panel {
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .panel-body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
    white-space: pre-wrap !important;
    word-break: break-word;
  }

  .tok-h, .tok-b, .tok-k, .tok-p,
  .tok-cm, .tok-kw, .tok-ty, .tok-st {
    color: #000000 !important;
    font-style: normal;
    font-weight: inherit;
  }

  .badge,
  .tag,
  .path-tag {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #999999 !important;
  }

  .site-footer {
    background: #ffffff !important;
    border-top-color: #999999;
  }

  .footer-note { color: #000000 !important; }
}
