/* Reading-focused refinements. Keep P/D colors consistent across the lessons. */
body {
  font-size: 16px;
  background: #f8fafc;
}

.sidebar {
  background: #fff;
  overflow-y: auto;
}
.brand-sub { color: #475569; }
.main-nav a { font-size: 14px; line-height: 1.6; }
.main-nav a.active { color: #1e40af; background: #e8efff; }
.nav-num, .nav-group-label, .sidebar-bottom-note { color: #475569; }
.search-trigger { color: #334155; background: #f1f5f9; border-color: #cbd5e1; }
.topbar { background: rgba(255,255,255,.97); border-color: #d9e1eb; }
.breadcrumb { color: #475569; font-size: 12px; min-width: 0; }
.breadcrumb strong { color: #172b4d; font-weight: 650; }
.source-link { font-size: 12px; color: #1d4ed8; white-space: nowrap; }

h1 { color: #172b4d; }
h1 span { color: #1d4ed8; }
h2 { color: #172b4d; font-size: 28px; font-weight: 700; }
h3 { color: #172b4d; font-size: 18px; font-weight: 650; }
.eyebrow, .section-kicker { color: #1d4ed8; font-weight: 650; }
.hero-lead { color: #334155; font-size: 16px; line-height: 1.9; }
.hero-meta { font-size: 12px; color: #475569; flex-wrap: wrap; white-space: normal; }
.hero-visual { background: #fff; border-color: #cbd5e1; box-shadow: 0 8px 24px #172b4d08; }
.visual-title { color: #172b4d; }
.visual-legend { color: #334155; }
.visual-caption { color: #475569; font-size: 11px; }
.hero-visual .visual-legend { font-size: 12px; flex-wrap: wrap; }
.learning-path { border-color: #d9e1eb; }
.learning-path a > span { color: #172b4d; }
.learning-path small { color: #475569; }

.lesson p, .lesson .section-intro,
.lesson .mechanism-block p, .mechanism-facts li,
.unverified-panel li {
  font-size: 15px;
  line-height: 1.95;
  color: #2d3b4f;
}
.lesson .section-intro { color: #334155; }
.lesson strong, .lesson h3 { color: #172b4d; }
.lesson code, .source-code { color: #1e3a5f; }
.lesson .source-scope,
.lesson .source-caption,
.lesson .technical-note {
  color: #475569 !important;
  font-size: 13px !important;
  line-height: 1.9 !important;
}
.inline-source { color: #1d4ed8; font-size: 13px; font-weight: 500; }
.inline-source:hover { text-decoration: underline; text-underline-offset: 3px; }
.source-code { font-size: 13px; line-height: 1.85; border-color: #d9e1eb; background: #f1f5f9; }
.evidence-key { color: #475569; padding-top: 12px; padding-bottom: 16px; }
.evidence-key small { font-size: 12px; }
.evidence-tag { font-size: 11px; font-weight: 600; }
.evidence-tag.confirmed { color: #1d4ed8; background: #eaf0ff; }
.evidence-tag.derived { color: #0f766e; background: #e7f5f1; }
.evidence-tag.pending { color: #92400e; background: #fff3de; }
.parameter-card, .simulator, .pd-player, .comparison-table { border-color: #ccd7e5; }
.callout { background: #edf3ff; border-color: #c6d6f3; }
.callout strong { color: #1e40af; }
.mechanism-block { background: #fff; border-color: #d3dce8; }
.unverified-panel { background: #fff9ef; border-color: #e5cfaa; }
.correction-callout { border-color: #e5cfaa; }

table { font-size: 14px; line-height: 1.8; }
th { color: #172b4d; font-size: 13px; background: #edf2f8; }
td { color: #334155; font-size: 14px; }
.glossary dt { color: #172b4d; font-size: 14px; }
.glossary dd { color: #334155; font-size: 14px; line-height: 1.9; }
.diagram-figure figcaption { color: #475569; font-size: 12px; }
.diagram-figure figcaption span,
.diagram-figure figcaption em { color: #1d4ed8; font-size: 11px; }

.sim-toolbar, .pd-player-top { background: #f1f5fb; }
.sim-title { color: #172b4d; font-size: 14px; }
.sim-select, .pd-scenario-select { color: #334155; font-size: 12px; }
.sim-select select, .pd-scenario-select select { color: #172b4d; font-size: 12px; }
.sim-stats span { color: #475569; font-size: 12px; line-height: 1.6; }
.sim-stats b { font-weight: 600; }
.sim-stats b small { color: #475569; font-size: 11px; }
.chart-heading, .chart-legend { color: #334155; font-size: 12px; }
.budget-axis, .lesson .scale-note { color: #475569; font-size: 11px; }
.budget-segment.remainder { background: #1d4ed8; }
.detail-row { font-size: 12px; line-height: 1.8; }
.detail-row strong, .detail-row code { font-size: 12px; }
.detail-row .remain-note { font-size: 11px; }
.step-insight { background: #edf5ff; }
.step-insight p { color: #334155; font-size: 14px; }
.sim-controls { flex-wrap: wrap; }
.timeline-control { min-width: 120px; }
.sim-jumps { flex-wrap: wrap; gap: 8px; }
.sim-jumps button, .icon-button, .play-button, .reset-button { font-size: 12px; }
.play-button { background: #1d4ed8; }
.model-note { border-color: #ccd7e5; }
.model-note summary { color: #334155; font-size: 13px; }
.formula-strip > span { color: #334155; font-size: 13px; }
.formula-strip strong { color: #1e40af; }

.pd-event-heading { min-height: 0; }
.pd-event-heading h3 { color: #172b4d; font-size: 17px; }
.pd-event-heading p { color: #334155; font-size: 14px; }
.lesson .pd-scope, .lesson .pd-model-footnote { color: #475569; font-size: 13px; }
.lesson .pd-contrast { color: #78350f; font-size: 13px; }
.pd-diagram-legend { color: #334155; font-size: 12px; gap: 12px; }
.lesson .pd-route-line p { color: #334155; font-size: 12px; }
.pd-route-line { flex-wrap: wrap; }
.pd-route-line > span { color: #475569; font-size: 11px; }
.pd-node-title > b { background: #1d4ed8; }
.pd-d-node .pd-node-title > b { background: #0f766e; }
.pd-node-title > strong { color: #172b4d; font-size: 14px; }
.pd-node-title > span { color: #475569; font-size: 11px; line-height: 1.7; }
.pd-resource-label { color: #334155; font-size: 12px; flex-wrap: wrap; }
.pd-resource-label > span { color: #475569; font-size: 11px; }
.pd-resource-label > b { color: #334155; font-size: 12px; }
.pd-request { align-items: flex-start; }
.pd-request b { color: #1e40af; font-size: 12px; }
.pd-request small, .pd-empty { color: #475569; font-size: 12px; line-height: 1.8; }
.pd-request.hold small { color: #92400e; }
.pd-request.ready small { color: #0f766e; }
.pd-run > span { color: #1e40af; font-size: 12px; }
.pd-d-node .pd-run > span { color: #0f766e; }
.pd-run .pd-run-idle { color: #475569; font-size: 12px; }
.pd-link-column > strong { color: #92400e; font-size: 12px; }
.pd-link-column > span, .pd-link-column > small { color: #78350f; font-size: 11px; }
.pd-wire-arrows > span { color: #92400e; font-size: 11px; }
.pd-audit { gap: 16px; }
.pd-audit span { color: #475569; font-size: 12px; line-height: 1.7; }
.pd-audit strong { color: #172b4d; font-size: 13px; }

.page-toc > span, .page-toc > a { color: #475569; font-size: 12px; }
.page-toc > a.active { color: #1d4ed8; font-weight: 600; }
.source-list strong { color: #1e40af; font-size: 13px; }
.source-list small { color: #475569; font-size: 12px; }
.download-source strong { color: #1e40af; font-size: 14px; }
.download-source small { color: #475569; font-size: 12px; }
footer p, footer > span { color: #475569; font-size: 12px; }

@media (max-width: 900px) {
  .pd-schematic { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
  .pd-link-column {
    grid-column: 1 / -1; grid-row: 2;
    display: grid; grid-template-columns: 48px minmax(0,1fr) 110px;
    gap: 8px 12px; padding: 12px;
    background: #fff7e9; border-radius: 6px;
  }
  .pd-wire-arrows { grid-column: 1; grid-row: 1 / 3; }
  .pd-link-column > strong { grid-column: 2; grid-row: 1; text-align: left; }
  .pd-wire-track { grid-column: 2; grid-row: 2; }
  .pd-link-column > span { grid-column: 3; grid-row: 1; }
  .pd-link-column > small { grid-column: 3; grid-row: 2; }
  .pd-audit { grid-template-columns: 1fr 1fr; }
  .pd-node-title > span { padding-left: 0; margin-top: 0; }
  .pd-resource-label > span { max-width: none; text-align: left; }
}

@media (max-width: 560px) {
  h2 { font-size: 25px; }
  h3 { font-size: 17px; }
  .breadcrumb { font-size: 11px; gap: 6px; }
  .breadcrumb strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .source-link { font-size: 11px; }
  .hero-lead { font-size: 15px; }
  .hero-meta { font-size: 11px; gap: 8px; }
  .hero-visual .visual-legend { font-size: 11px; gap: 12px; }
  .hero-visual .visual-top .tiny-label { font-size: 10px; }
  .lesson p, .lesson .section-intro,
  .lesson .mechanism-block p, .mechanism-facts li,
  .unverified-panel li { font-size: 15px; }
  .sim-title { font-size: 12px; }
  .sim-toolbar { flex-wrap: wrap; gap: 10px; }
  .sim-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 12px; }
  .sim-stats > div:nth-child(2) { border-right: 0; }
  .sim-stats span { font-size: 12px; margin-bottom: 6px; }
  .sim-stats b { font-size: 25px; }
  .sim-stats b small { display: inline; font-size: 11px; }
  .chart-heading { flex-wrap: wrap; gap: 8px; font-size: 12px; }
  .chart-heading strong { font-size: 12px; }
  .chart-legend { font-size: 11px; }
  .detail-row { font-size: 12px; }
  .detail-row strong, .detail-row code { font-size: 12px; }
  .detail-row .remain-note { font-size: 11px; }
  .step-insight p { font-size: 14px; }
  .pd-event-heading h3 { font-size: 16px; }
  .pd-event-heading p { font-size: 14px; }
  .pd-schematic { padding: 13px; gap: 10px; }
  .pd-node-title > strong { font-size: 13px; }
  .pd-node-title > span { font-size: 11px; }
  .pd-resource-section { padding: 12px 9px; }
  .pd-resource-label { font-size: 12px; }
  .pd-resource-label > span { font-size: 11px; }
  .pd-request { gap: 5px; padding: 6px; flex-wrap: wrap; }
  .pd-request b, .pd-request small { font-size: 12px; }
  .pd-run { gap: 6px; padding: 0 8px; }
  .pd-run > span, .pd-d-node .pd-run > span { font-size: 11px; }
  .pd-link-column { grid-template-columns: 36px minmax(0,1fr) 90px; gap: 8px; }
  .pd-link-column > strong { font-size: 12px; }
  .pd-link-column > span, .pd-link-column > small { font-size: 11px; }
  .pd-empty { font-size: 12px; }
}

.technical-figure.responsive-figure img {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 900px) {
  .technical-figure.responsive-figure img { max-width: 560px; margin-inline: auto; }
}

@media print {
  body { background: #fff; }
  .lesson p, .lesson .section-intro { color: #172b4d; }
}
