/* =========================================================
   H3AD-LEARN — Master Stylesheet
   Covers: index page + all chapter pages
   Design system: H3AD-SEC v2026
   ========================================================= */

/* ---------------------------------------------------------
   DESIGN TOKENS
   --------------------------------------------------------- */
:root {
  --bg:          #080c14;
  --panel:       #0d1117;
  --panel-alt:   #111827;
  --border:      #1e2d3d;
  --accent:      #00d4ff;
  --secondary:   #58a6ff;
  --amber:       #f59e0b;
  --text:        #e6edf3;
  --muted:       #8b949e;

  --font-sans:   'Exo 2', system-ui, sans-serif;
  --font-mono:   'Share Tech Mono', 'Courier New', monospace;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;

  --transition-fast: 150ms ease;
  --transition-mid:  200ms ease;

  --header-h:    60px;
  --sidebar-w:   260px;

  --shadow-glow-accent: 0 0 20px rgba(0, 212, 255, 0.15);
  --shadow-glow-accent-strong: 0 0 32px rgba(0, 212, 255, 0.25);
}

/* Light mode overrides */
body.light {
  --bg:        #f0f4f8;
  --panel:     #ffffff;
  --panel-alt: #f6f8fa;
  --border:    #d0d7de;
  --text:      #1c2128;
  --muted:     #57606a;
}

/* ---------------------------------------------------------
   RESET & BASE
   --------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Ambient gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0, 212, 255, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(88, 166, 255, 0.03) 0%, transparent 60%);
}

body > * {
  position: relative;
  z-index: 1;
}

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

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  font-family: var(--font-sans);
}

ul, ol {
  list-style: none;
}

/* ---------------------------------------------------------
   UTILITY CLASSES
   --------------------------------------------------------- */
.mono        { font-family: var(--font-mono); }
.accent      { color: var(--accent); }
.muted       { color: var(--muted); }

.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------------------------------------------------------
   SITE HEADER
   --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(8, 12, 20, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.light .site-header {
  background: rgba(240, 244, 248, 0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
}

.site-logo {
  height: 32px;
  width: auto;
}

/* Nav pill */
.nav-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
}

.nav-pill-name {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.nav-pill-sep {
  color: var(--muted);
  font-size: 0.65rem;
}

.nav-pill-tagline {
  color: var(--muted);
  font-size: 0.65rem;
}

/* Header nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-link:hover {
  color: var(--text);
  background: var(--panel-alt);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.06);
}

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

/* Hamburger (mobile) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hamburger-btn span {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition-mid);
}

/* ---------------------------------------------------------
   HERO SECTION
   --------------------------------------------------------- */
.hero {
  padding: 6rem 2rem 4rem;
  text-align: center;
  position: relative;
}

.hero-inner {
  max-width: 800px;
  margin: 0 auto;
}

.hero-eyebrow {
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-sans);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero-title-accent {
  color: var(--accent);
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--muted);
  font-weight: 300;
  max-width: 520px;
  margin: 0 auto 3rem;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.hero-stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.6rem;
}

.hero-stat-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.hero-cta:hover {
  background: rgba(0, 212, 255, 0.1);
  box-shadow: var(--shadow-glow-accent);
  text-decoration: none;
}

.cta-arrow {
  transition: transform var(--transition-mid);
}

.hero-cta:hover .cta-arrow {
  transform: translateY(3px);
}

/* ---------------------------------------------------------
   PROGRESS OVERVIEW
   --------------------------------------------------------- */
.progress-overview {
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.progress-overview-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
  max-width: 700px;
  margin: 0 auto;
}

/* Progress ring */
.progress-circle-wrap {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  height: 120px;
}

.progress-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.progress-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms ease;
}

.progress-circle-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
}

.progress-pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.progress-circle-sub {
  font-size: 0.55rem;
}

/* Progress meta */
.progress-meta {
  flex: 1;
}

.progress-meta-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.progress-meta-sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.progress-chapters-summary {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.pcs-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.pcs-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pcs-dot--complete { background: var(--accent); }
.pcs-dot--reading  { background: var(--amber); }
.pcs-dot--unread   { background: var(--border); }

.reset-progress-btn {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--border);
  background: transparent;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.reset-progress-btn:hover {
  color: var(--amber);
  border-color: var(--amber);
}

/* ---------------------------------------------------------
   SECTION HEADERS (shared)
   --------------------------------------------------------- */
.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header .section-label {
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------------------------------------------------------
   MODULES SECTION
   --------------------------------------------------------- */
.modules-section {
  padding: 5rem 2rem;
}

/* Modules grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

/* Module card */
.module-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition:
    border-color var(--transition-mid),
    box-shadow var(--transition-mid),
    transform var(--transition-mid);
  outline: none;
}

.module-card:hover,
.module-card:focus-visible {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: var(--shadow-glow-accent);
  transform: translateY(-2px);
}

.module-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Card top row */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.module-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.module-card:hover .module-number {
  opacity: 1;
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Difficulty badges */
.difficulty-badge {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  text-transform: uppercase;
  white-space: nowrap;
  font-weight: 600;
}

.difficulty-badge--beginner {
  color: var(--secondary);
  border-color: rgba(88, 166, 255, 0.4);
  background: rgba(88, 166, 255, 0.08);
}

.difficulty-badge--intermediate {
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.difficulty-badge--advanced {
  color: var(--accent);
  border-color: rgba(0, 212, 255, 0.4);
  background: rgba(0, 212, 255, 0.08);
}

/* Time badge */
.time-badge {
  font-size: 0.62rem;
  color: var(--muted);
  padding: 0.2rem 0.5rem;
  background: var(--panel-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Card title */
.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* Card description */
.card-desc {
  font-size: 0.845rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

/* Card tags */
.card-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Card footer */
.card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.card-progress {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
}

.progress-indicator {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.pi--unread   { color: var(--muted); }
.pi--reading  { color: var(--amber); }
.pi--complete { color: var(--accent); }

.progress-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  width: 100%;
}

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

.card-arrow {
  font-size: 1rem;
  color: var(--muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
}

.module-card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ---------------------------------------------------------
   LEARNING PATH SECTION
   --------------------------------------------------------- */
.learning-path-section {
  padding: 5rem 2rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.learning-path {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

/* Horizontal connecting track */
.path-track {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: linear-gradient(to right, var(--accent), var(--secondary));
  opacity: 0.25;
  border-radius: 1px;
  z-index: 0;
}

.path-nodes {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.path-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.path-node-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--panel);
  transition: border-color var(--transition-mid), box-shadow var(--transition-mid), background var(--transition-mid);
  flex-shrink: 0;
  position: relative;
}

.path-node-dot::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition-mid);
}

.path-node-dot--final {
  border-color: var(--accent);
}

.path-node-dot--final::after {
  background: var(--accent);
}

.path-node.is-complete .path-node-dot {
  border-color: var(--accent);
}

.path-node.is-complete .path-node-dot::after {
  background: var(--accent);
}

.path-node.is-reading .path-node-dot {
  border-color: var(--amber);
}

.path-node.is-reading .path-node-dot::after {
  background: var(--amber);
}

.path-node:hover .path-node-dot {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.path-node-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

.path-node-num {
  font-size: 0.65rem;
  color: var(--muted);
}

.path-node-title {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.path-node-badge {
  font-size: 0.5rem;
  padding: 0.1rem 0.35rem;
}

/* ---------------------------------------------------------
   RESOURCES SECTION
   --------------------------------------------------------- */
.resources-section {
  padding: 5rem 2rem;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.resource-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  position: relative;
  transition: border-color var(--transition-mid), box-shadow var(--transition-mid), transform var(--transition-mid);
}

.resource-card:hover {
  border-color: rgba(0, 212, 255, 0.35);
  box-shadow: var(--shadow-glow-accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.resource-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--accent);
}

.resource-card-icon svg {
  width: 18px;
  height: 18px;
}

.resource-card-body {
  flex: 1;
  min-width: 0;
}

.resource-card-name {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.resource-card-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.resource-card-arrow {
  font-size: 0.875rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.resource-card:hover .resource-card-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* ---------------------------------------------------------
   SITE FOOTER
   --------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  background: var(--panel);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-logo {
  height: 28px;
  width: auto;
  opacity: 0.7;
}

.footer-tagline {
  font-size: 0.78rem;
}

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

.footer-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.footer-copy {
  font-size: 0.72rem;
}

/* ---------------------------------------------------------
   CHAPTER PAGE LAYOUT
   --------------------------------------------------------- */

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(to right, var(--accent), var(--secondary));
  z-index: 99;
  transition: width 100ms linear;
  border-radius: 0 2px 2px 0;
}

/* Two-column layout */
.chapter-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  align-items: flex-start;
}

/* TOC sidebar */
.toc-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 2rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  background: var(--panel);
}

.toc-sidebar::-webkit-scrollbar {
  width: 4px;
}

.toc-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.toc-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.toc-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 1rem;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.toc-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  line-height: 1.4;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  display: block;
}

.toc-link:hover {
  color: var(--text);
  background: var(--panel-alt);
  text-decoration: none;
}

.toc-link.toc-link--active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(0, 212, 255, 0.06);
}

.toc-sidebar-back {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.toc-back-link {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color var(--transition-fast);
}

.toc-back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Sidebar overlay (mobile) */
.toc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 89;
  backdrop-filter: blur(2px);
}

.toc-overlay.is-open {
  display: block;
}

/* Main chapter body */
.chapter-body {
  flex: 1;
  min-width: 0;
  padding: 3rem 3.5rem;
  max-width: 820px;
}

/* Chapter header */
.chapter-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.chapter-meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.chapter-module-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
}

.chapter-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.chapter-intro {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 600px;
}

.chapter-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Content sections */
.content-section {
  margin-bottom: 3rem;
}

.content-section h2 {
  font-size: 1.3rem;
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.content-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.content-section p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 1rem;
}

.content-section ul,
.content-section ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.content-section ul {
  list-style: none;
}

.content-section ul li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.content-section ul li::before {
  content: '—';
  position: absolute;
  left: -0.25rem;
  color: var(--accent);
  font-size: 0.8rem;
}

.content-section ol {
  list-style: decimal;
}

.content-section ol li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 0.4rem;
  padding-left: 0.25rem;
}

.content-section ol li::marker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* Callouts */
.callout-info,
.callout-tip,
.callout-warning,
.callout-example {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.callout-info {
  border-left: 3px solid var(--accent);
  background: rgba(0, 212, 255, 0.05);
}

.callout-tip {
  border-left: 3px solid var(--secondary);
  background: rgba(88, 166, 255, 0.05);
}

.callout-warning {
  border-left: 3px solid var(--amber);
  background: rgba(245, 158, 11, 0.05);
}

.callout-example {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.callout-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.5rem;
}

.callout-info .callout-label     { color: var(--accent); }
.callout-tip .callout-label      { color: var(--secondary); }
.callout-warning .callout-label  { color: var(--amber); }
.callout-example .callout-label  { color: var(--muted); }

.callout-info p,
.callout-tip p,
.callout-warning p,
.callout-example p {
  font-size: 0.875rem;
  margin-bottom: 0;
  line-height: 1.65;
}

/* Code blocks */
.code-block {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1.25rem 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}

.code-block pre {
  margin: 0;
  overflow-x: auto;
}

.code-block pre code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre;
  display: block;
}

.lang-label {
  position: absolute;
  top: 0.5rem;
  left: 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  min-width: 44px;
  text-align: center;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}

/* inline code */
.content-section code:not(.code-block code) {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  color: var(--accent);
}

/* Knowledge check */
.knowledge-check {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin: 2.5rem 0;
}

.kc-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kc-title::before {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
  opacity: 0.5;
}

.kc-question {
  margin-bottom: 1.75rem;
}

.kc-question:last-child {
  margin-bottom: 0;
}

.kc-question-text {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.875rem;
  line-height: 1.5;
}

.kc-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kc-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: left;
  color: var(--text);
  transition: border-color var(--transition-fast), background var(--transition-fast);
  min-height: 44px;
  width: 100%;
}

.kc-option:hover:not(.kc-option--revealed) {
  border-color: rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.04);
}

.kc-option--correct {
  border-color: rgba(0, 212, 255, 0.5);
  background: rgba(0, 212, 255, 0.08);
  color: var(--accent);
}

.kc-option--incorrect {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.06);
  color: var(--amber);
}

.kc-option--revealed {
  cursor: default;
}

.kc-answer {
  display: none;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.625rem;
  padding: 0.625rem 0.875rem;
  border-left: 2px solid var(--accent);
  background: rgba(0, 212, 255, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.5;
}

.kc-answer.is-visible {
  display: block;
}

/* Chapter summary */
.chapter-summary {
  border-left: 3px solid var(--accent);
  background: rgba(0, 212, 255, 0.04);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 2.5rem 0;
}

.chapter-summary-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 0.875rem;
  display: block;
}

.chapter-summary ul {
  list-style: none;
  padding: 0;
}

.chapter-summary ul li {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text);
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.375rem;
}

.chapter-summary ul li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

/* Chapter nav (prev / next) */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.chapter-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--text);
  transition: border-color var(--transition-mid), box-shadow var(--transition-mid);
  max-width: 260px;
}

.chapter-nav-btn:hover {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: var(--shadow-glow-accent);
  text-decoration: none;
  color: var(--text);
}

.chapter-nav-btn--next {
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
}

.chapter-nav-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.chapter-nav-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
}

/* ---------------------------------------------------------
   REDUCED MOTION
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .progress-ring-fill {
    transition: none !important;
  }
}

/* ---------------------------------------------------------
   RESPONSIVE — 1200px
   --------------------------------------------------------- */
@media (max-width: 1200px) {
  .resources-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------------------------------------------------------
   RESPONSIVE — 1024px
   --------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 220px;
  }

  .chapter-body {
    padding: 2rem 2rem;
  }

  .path-nodes {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }

  .path-track {
    display: none;
  }
}

/* ---------------------------------------------------------
   RESPONSIVE — 768px
   --------------------------------------------------------- */
@media (max-width: 768px) {
  .header-nav {
    display: none;
  }

  .hamburger-btn {
    display: flex;
  }

  /* Sidebar becomes overlay on mobile */
  .toc-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    transform: translateX(-100%);
    transition: transform var(--transition-mid);
    z-index: 90;
    width: 280px;
  }

  .toc-sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-glow-accent-strong);
  }

  .chapter-body {
    padding: 1.5rem 1.25rem;
  }

  .chapter-layout {
    flex-direction: column;
  }

  .progress-overview-inner {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .progress-chapters-summary {
    justify-content: center;
  }

  .hero-stats {
    gap: 1.25rem;
  }

  .hero-stat-value {
    font-size: 2rem;
  }

  .resources-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
  }

  .footer-brand {
    flex-direction: column;
    align-items: center;
  }
}

/* ---------------------------------------------------------
   RESPONSIVE — 640px
   --------------------------------------------------------- */
@media (max-width: 640px) {
  .modules-grid {
    grid-template-columns: 1fr;
  }

  .nav-pill-tagline {
    display: none;
  }

  .hero {
    padding: 4rem 1.5rem 3rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .hero-stat-divider {
    display: none;
  }

  .path-nodes {
    grid-template-columns: repeat(2, 1fr);
  }

  .chapter-nav {
    flex-direction: column;
  }

  .chapter-nav-btn {
    max-width: 100%;
    align-items: flex-start;
    text-align: left;
  }

  .chapter-nav-btn--next {
    align-items: flex-start;
    text-align: left;
  }
}

/* ---------------------------------------------------------
   SCROLLBAR (global, thin)
   --------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
