/* CJP — clean academic style
 * Inspired by the minimalist personal-site tradition:
 * Paul Graham's essays, Bret Victor's worrydream.com,
 * and the Swiss-modernist approach to web typography.
 */

:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-light: #666;
  --accent: #2d5a8a;
  --accent-hover: #1e3d5c;
  --border: #e0e0e0;
  --card-bg: #fff;
  --font-body: 'Charter', 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --max-width: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Navigation */
nav {
  font-family: var(--font-sans);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.nav-brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-right: 2rem;
  white-space: nowrap;
}

.nav-brand:hover { color: var(--accent); }

/* Desktop nav */
.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  font-size: 0.9rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* Dropdown for "More" */
.nav-dropdown { position: relative; }
.nav-dropdown .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  list-style: none;
  padding: 0.5rem 0;
  min-width: 140px;
  z-index: 101;
  margin-top: 0.25rem;
}
.nav-dropdown .dropdown-menu li { padding: 0; }
.nav-dropdown .dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-light);
  font-size: 0.85rem;
}
.nav-dropdown .dropdown-menu a:hover {
  background: rgba(45, 90, 138, 0.06);
  color: var(--accent);
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.nav-dropdown-toggle {
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-light);
  padding: 0;
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text);
  padding: 0.25rem;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a,
  .nav-dropdown-toggle {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child a { border-bottom: none; }
  .nav-dropdown .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    display: none;
    padding: 0 0 0 1rem;
  }
  .nav-dropdown.open .dropdown-menu { display: block; }
  .nav-dropdown .dropdown-menu a { border-bottom: none; padding: 0.5rem 0; }
  .nav-search { width: 100%; padding: 0.75rem 0; }
  .nav-search input { width: 100%; }
}

@media (max-width: 600px) {
  .nav-search input { width: 100%; }
  .nav-search input:focus { width: 100%; }
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Hero / Intro */
.hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.hero h1 {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 1rem;
}

.hero .tagline {
  font-size: 1rem;
  color: var(--text-light);
  max-width: 600px;
}

/* Sections */
section {
  margin-bottom: 2.5rem;
}

section h2 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Cards / Links */
.link-card {
  display: block;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: padding-left 0.2s;
}

.link-card:last-child { border-bottom: none; }

.link-card:hover {
  padding-left: 0.5rem;
  color: var(--accent);
}

.link-card .title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.link-card .desc {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* CJP Specifics */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.topic-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.topic-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: var(--accent);
}

.topic-card .icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.topic-card h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.topic-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
}

.topic-card .btn {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: all 0.2s;
}

.topic-card .btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Procedure steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.step {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.step h4 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--accent);
}

.step p {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Syllabus list */
.syllabus-list {
  list-style: none;
}

.syllabus-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}

.syllabus-list li:last-child { border-bottom: none; }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  font-family: var(--font-sans);
  margin-top: 3rem;
}

/* Utilities */
.back-link {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-light);
  text-decoration: none;
  margin-bottom: 1rem;
}

/* ── Breadcrumb ── */
.breadcrumb {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.back-link:hover { color: var(--accent); }

.tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
  background: #f0f0f0;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.note {
  background: #f8f9fa;
  border-left: 3px solid var(--accent);
  padding: 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
  color: var(--text-light);
}

/* Sources & Resources */
.sources {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
}

.sources p { margin-bottom: 0.4rem; }

.sources ul {
  list-style: none;
  padding-left: 0;
}

.sources li {
  padding: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.sources a {
  color: var(--accent);
  text-decoration: none;
}

.sources a:hover { text-decoration: underline; }

.resources {
  margin-top: 1rem;
}

.resources p {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.resources ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0.8rem;
}

.resources li {
  padding: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.resources a {
  color: var(--accent);
  text-decoration: none;
}

.resources a:hover { text-decoration: underline; }

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-text {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
  margin-top: 0.4rem;
  text-align: right;
}

/* Circular progress indicator */
.progress-circle {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 40px;
  height: 40px;
}

.progress-circle svg {
  overflow: visible;
}

.progress-pie-fill {
  transition: fill 0.3s ease;
}

/* ── Resource Cards ── */
.resource-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.resource-card h3 {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.resource-meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.resource-topics {
  list-style: none;
  padding-left: 0;
  margin: 0.75rem 0;
}

.resource-topics li {
  padding: 0.2rem 0;
  font-size: 0.95rem;
  color: var(--text);
  padding-left: 1.2rem;
  position: relative;
}

.resource-topics li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.resource-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.resource-tag {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(45, 90, 138, 0.08);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.resource-note {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.75rem;
  font-style: italic;
}

.resource-list {
  display: grid;
  gap: 1rem;
}

.resource-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.resource-item h4 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.resource-item p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0;
}

.resource-item a {
  color: var(--accent);
  text-decoration: none;
}

.resource-item a:hover {
  text-decoration: underline;
}

/* ── Search ── */
.nav-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-search input {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  width: 160px;
  transition: width 0.2s, border-color 0.2s;
}

.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
  width: 200px;
}

.nav-search button {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.nav-search button:hover {
  background: var(--accent-hover);
}

@media (max-width: 600px) {
  .nav-search input { width: 120px; }
  .nav-search input:focus { width: 140px; }
}

/* ── Table of Contents ── */
.toc {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.toc h2 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

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

.toc-list li {
  padding: 0.3rem 0;
  font-size: 0.95rem;
}

.toc-list > li > a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.toc-list ul {
  list-style: none;
  padding-left: 1.2rem;
  margin: 0.2rem 0;
}

.toc-list ul li {
  font-size: 0.88rem;
  padding: 0.15rem 0;
}

.toc-list ul li a {
  color: var(--text-light);
  text-decoration: none;
}

.toc-list ul li a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.toc-list a:hover {
  text-decoration: underline;
}

/* ── Data Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  margin: 1rem 0;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover {
  color: var(--accent);
}

.data-table th.sort-asc::after { content: " ▲"; }
.data-table th.sort-desc::after { content: " ▼"; }

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table td {
  color: var(--text);
}

.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-family: var(--font-sans);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card .stat-change {
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.stat-change.up { color: #e74c3c; }
.stat-change.down { color: #27ae60; }

/* ── Chart Containers ── */
.chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  position: relative;
  min-height: 280px;
}

.chart-container h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.chart-canvas {
  max-height: 400px;
  width: 100%;
}

@media (max-width: 640px) {
  .chart-container {
    padding: 1rem;
  }
  .chart-canvas {
    max-height: 300px;
  }
}

/* ── Search / Filter ── */
.table-filter {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  max-width: 400px;
  margin-bottom: 1rem;
}

.table-filter:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Tabs ── */
.tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn:hover { color: var(--accent); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section Heading Indicators ── */
.section-heading {
  position: relative;
  padding-left: 1rem;
  border-left: 4px solid var(--accent);
  margin-bottom: 1rem;
}

.section-heading h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 50%;
  margin-right: 0.75rem;
  vertical-align: middle;
}

/* ── Sticky Section Nav (TOC sidebar) ── */
.chapter-nav {
  position: sticky;
  top: 5rem;
  align-self: start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}

.chapter-nav h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.chapter-nav ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.chapter-nav li {
  padding: 0.3rem 0;
}

.chapter-nav a {
  color: var(--text-light);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
  transition: all 0.2s;
}

.chapter-nav a:hover,
.chapter-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.chapter-nav .nav-h3 {
  padding-left: 1rem;
  font-size: 0.8rem;
}

/* ── Two-column chapter layout ── */
.chapter-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 2rem;
  align-items: start;
}

.chapter-main {
  order: 1;
  min-width: 0;
  overflow: hidden;
}

.chapter-nav {
  order: 2;
}

@media (max-width: 900px) {
  .chapter-layout {
    grid-template-columns: 1fr;
  }
  .chapter-nav {
    position: relative;
    top: 0;
    max-height: none;
    order: -1;
  }
  .chapter-main {
    order: 1;
  }
}

/* ── Inter-chapter Navigation ── */
.chapter-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 2rem 0;
  font-family: var(--font-sans);
}

.chapter-pager a {
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.chapter-pager a:hover {
  background: rgba(45, 90, 138, 0.08);
}

.chapter-pager .prev::before {
  content: "←";
}

.chapter-pager .next::after {
  content: "→";
}

.chapter-pager .disabled {
  color: var(--text-light);
  opacity: 0.5;
  pointer-events: none;
}

/* ── Data Table Improvements ── */
.data-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.data-table thead th {
  background: var(--card-bg);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--border);
}

.data-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.data-table-wrapper .data-table {
  margin: 0;
  min-width: 600px;
}

/* ── Anchor Link on Headings ── */
.heading-anchor {
  opacity: 0;
  margin-left: 0.5rem;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.8em;
  transition: opacity 0.2s;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}

/* ── Pull Quote / Highlight Box ── */
.pull-quote {
  background: var(--card-bg);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text);
  border-radius: 0 8px 8px 0;
}

.pull-quote .attribution {
  display: block;
  font-size: 0.85rem;
  font-style: normal;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* ── Chapter Intro Card ── */
.chapter-intro {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2rem 1.5rem;
  margin-bottom: 2rem;
}

.chapter-intro .hero {
  margin-bottom: 0;
}

.chapter-intro .hero h1 {
  margin-bottom: 0.5rem;
}

.chapter-intro .subtitle {
  margin-bottom: 1rem;
}

.chapter-intro .tagline {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.chapter-intro .report-meta {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.chapter-intro .stat-grid {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.chapter-separator {
  border: none;
  border-top: 2px solid var(--accent);
  margin: 2rem 0;
  width: 60px;
}


/* ── Map CTA Button (Module Pages) ── */
.map-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.map-cta:hover {
  background: var(--accent-hover);
}

.map-cta svg {
  flex-shrink: 0;
}

.map-cta-section {
  text-align: center;
}

/* ── Map Container ── */
.map-container {
  margin: 1.5rem 0;
}

.map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.map-node {
  cursor: pointer;
}

.map-node:hover rect,
.map-node:hover circle {
  filter: brightness(1.05);
}

.map-link {
  stroke-width: 1.5;
}

.map-link.dashed {
  stroke-dasharray: 6, 4;
}

.map-link.strong {
  stroke-width: 2.5;
}

.map-label {
  font-family: var(--font-sans);
  font-weight: 500;
  pointer-events: none;
}

/* ── Map Legend ── */
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.legend-note {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-left: auto;
}

/* ── Reading Paths ── */
.reading-path {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.reading-path:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.reading-path h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.reading-path > p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.path-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  line-height: 2.2;
}

.path-node {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.path-node:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.path-arrow {
  font-family: var(--font-sans);
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 0 0.2rem;
  user-select: none;
}

.path-note {
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

/* Category colors for path nodes */
.category-making { background: #ede9fe; color: #5b21b6; }
.category-foundation { background: #fef3c7; color: #92400e; }
.category-rights { background: #dbeafe; color: #1e40af; }
.category-dpsp { background: #fce7f3; color: #9d174d; }
.category-governance { background: #d1fae5; color: #166534; }
.category-local { background: #e0e7ff; color: #3730a3; }

.category-classical { background: #ede9fe; color: #5b21b6; }
.category-enlightenment { background: #e0f2fe; color: #0369a1; }
.category-ideology { background: #fef3c7; color: #92400e; }
.category-indian { background: #fee2e2; color: #991b1b; }
.category-system { background: #dcfce7; color: #166534; }

.category-micro { background: #e0f2fe; color: #0369a1; }
.category-macro { background: #fef3c7; color: #92400e; }
.category-indianecon { background: #dcfce7; color: #166534; }

.category-governance-ca { background: #ede9fe; color: #5b21b6; }
.category-global { background: #e0f2fe; color: #0369a1; }
.category-socioecon { background: #fef3c7; color: #92400e; }
.category-tech { background: #dcfce7; color: #166534; }

.category-leader { background: #fee2e2; color: #991b1b; }
.category-reformer { background: #fef3c7; color: #92400e; }
.category-western { background: #e0f2fe; color: #0369a1; }
.category-revolutionary { background: #dcfce7; color: #166534; }

/* History module categories */
.category-ancient { background: #dcfce7; color: #166534; }
.category-medieval { background: #fef3c7; color: #92400e; }
.category-modern { background: #fee2e2; color: #991b1b; }
.category-post1947 { background: #e0f2fe; color: #0369a1; }

/* Language Switcher */
/* Language Switcher */
.language-switcher { position: relative; display: inline-flex; align-items: center; order: 99; }
.lang-toggle { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 0.85rem; color: inherit; display: flex; align-items: center; gap: 4px; }
.lang-toggle:hover { background: rgba(255,255,255,0.2); }
.current-lang { font-weight: 600; }
.lang-arrow { font-size: 0.7rem; opacity: 0.7; }
.lang-menu { display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; background: var(--card-bg, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); list-style: none; padding: 4px 0; min-width: 160px; z-index: 1000; }
.lang-menu.open { display: block; }
.lang-menu li a { display: block; padding: 8px 12px; text-decoration: none; color: var(--text, #1a202c); font-size: 0.9rem; transition: background 0.2s; }
.lang-menu li a:hover { background: var(--bg, #f7fafc); }
.lang-menu li a.active { font-weight: 600; color: var(--primary, #2b6cb0); }
@media (max-width: 768px) {
  .nav-container { display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; }
  .nav-brand { flex-shrink: 0; }
  .language-switcher { order: 2; margin-left: auto; margin-right: 0.5rem; }
  .nav-toggle { order: 3; flex-shrink: 0; }
  .nav-links { order: 4; width: 100%; }
  .lang-menu { right: 0; left: auto; }
}
