/* =========================================================
   Root To First Job — theme tokens
   ========================================================= */
:root {
  --bg: #0a0e14;
  --bg-alt: #0f1520;
  --surface: #131a26;
  --surface-hover: #182234;
  --border: #223049;
  --text: #e6edf5;
  --text-dim: #93a4bd;
  --text-faint: #78889f;
  --accent: #00d9ff;
  --accent-2: #00ff9d;
  --accent-3: #ff5d8f;
  --accent-neon: #00d9ff;
  --accent-2-neon: #00ff9d;
  --warn: #ffb454;
  --focus: #00d9ff;
  --radius: 10px;
  --radius-lg: 16px;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow-glow: 0 0 0 1px rgba(0, 217, 255, 0.15), 0 8px 30px rgba(0, 217, 255, 0.08);
  --header-h: 64px;
}

[data-theme="light"] {
  --bg: #f5f7fa;
  /* Accent text on light backgrounds: the neon values fail WCAG AA badly
     (#00d9ff = 1.58:1, #00ff9d = 1.24:1). Darkened here for text/borders;
     --accent-neon / --accent-2-neon keep the originals for fills on dark ink. */
  --accent: #007a91;
  --accent-2: #00795c;
  --accent-3: #c2185b;
  --accent-neon: #00d9ff;
  --accent-2-neon: #00ff9d;
  --text-faint: #626f88;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-hover: #eef2f8;
  --border: #dbe2ec;
  --text: #101826;
  --text-dim: #4b5872;
  --shadow-glow: 0 0 0 1px rgba(0, 140, 168, 0.12), 0 8px 30px rgba(0, 140, 168, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); overflow-x: hidden; overflow-x: clip; }

body {
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
}

body.no-scroll { overflow: hidden; }

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

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #001018;
  padding: 10px 16px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* =========================================================
   Scroll progress bar
   ========================================================= */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 1100;
  transition: width 0.1s linear;
}

/* =========================================================
   Header / Nav
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
/* The blur lives on a pseudo-element rather than directly on .site-header:
   backdrop-filter/filter on an element becomes the containing block for its
   position:fixed descendants, which broke the mobile nav's viewport-relative
   positioning when it was applied to the header itself. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(10px);
}
[data-theme="light"] .site-header::before { background: rgba(255, 255, 255, 0.85); }

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px;
  color: var(--accent);
}
.logo .accent { color: var(--accent-2); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

.hamburger { display: none; }

/* Mobile nav */
@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: var(--bg);
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 4px;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }
  .nav-links.open { transform: translateX(0); }
  .nav-links a { padding: 14px 16px; font-size: 1rem; border-bottom: 1px solid var(--border); border-radius: 0; }
  .hamburger {
    display: inline-flex;
  }
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  padding: 72px 0 64px;
  overflow: hidden;
  background:
    radial-gradient(650px 320px at 15% -10%, rgba(0, 217, 255, 0.14), transparent 60%),
    radial-gradient(600px 300px at 90% 0%, rgba(0, 255, 157, 0.10), transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-2);
  background: rgba(0, 255, 157, 0.08);
  border: 1px solid rgba(0, 255, 157, 0.25);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  white-space: nowrap;
}
[data-theme="light"] .hero-eyebrow {
  background: rgba(0, 121, 92, 0.08);
  border-color: rgba(0, 121, 92, 0.3);
}
.hero-eyebrow .dot {
  width: 6px; height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.hero h1 {
  font-size: clamp(2rem, 3.9vw, 3.15rem);
  line-height: 1.1;
  margin: 0 0 18px;
  max-width: 22ch;
  letter-spacing: -0.02em;
}
.hero h1 .gradient {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  max-width: 46ch;
  color: var(--text-dim);
  font-size: 1.05rem;
  margin: 0 0 28px;
}

.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }

.hero-byline {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-faint);
  max-width: 46ch;
  margin: 0 0 30px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}
.hero-byline strong { color: var(--text-dim); font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(90deg, var(--accent-neon), var(--accent-2-neon));
  color: #001018;
  box-shadow: 0 6px 24px rgba(0, 217, 255, 0.25);
}
.btn-primary:hover { box-shadow: 0 10px 28px rgba(0, 217, 255, 0.35); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 32px;
}
.hero-stat .num {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.hero-stat .num .accent { color: var(--accent-2); }
.hero-stat .label {
  font-size: 0.78rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-stat[hidden] { display: none; }

/* ---- Hero visual: CSS-only terminal (no image = no LCP cost) ---- */
.hero-visual { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.term {
  background: #070b11;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), var(--shadow-glow);
}
[data-theme="light"] .term {
  background: #0d131d;
  box-shadow: 0 18px 45px rgba(16, 24, 38, 0.18), 0 0 0 1px rgba(16, 24, 38, 0.08);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: #0e141d;
  border-bottom: 1px solid #1b2534;
}
.term-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.term-dot.r { background: #ff5f57; }
.term-dot.y { background: #febc2e; }
.term-dot.g { background: #28c840; }
.term-title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #7c8ca6;
}
.term-body {
  padding: 16px 18px 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.75;
  color: #cbd8e8;
}
.term-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-line.sp { margin-top: 10px; }
.term-line .p { color: var(--accent-neon); font-weight: 700; }
.term-line .c { color: #e6edf5; }
.term-line.o { color: #9fb0c7; }
.term-line.dim { color: #6f8098; }
.term-line.ok { color: var(--accent-2-neon); }
.term-line .caret {
  display: inline-block;
  width: 8px; height: 1em;
  background: var(--accent-2-neon);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-proof {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.hero-proof li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.hero-proof .tick {
  color: var(--accent-2);
  font-weight: 700;
  flex: none;
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero h1 { max-width: 100%; }
  .hero p.lead, .hero-byline { max-width: 100%; }
}

@media (max-width: 640px) {
  .hero { padding: 36px 0 44px; }
  .hero-eyebrow {
    white-space: normal;
    font-size: 0.72rem;
    margin-bottom: 16px;
  }
  .hero h1 { font-size: clamp(1.85rem, 8vw, 2.3rem); margin-bottom: 14px; }
  .hero p.lead { font-size: 1rem; margin-bottom: 22px; }
  .hero-ctas { gap: 10px; margin-bottom: 20px; }
  .hero-ctas .btn { width: 100%; justify-content: center; }
  /* byline and stats sit below the fold on phones - order them after the CTA
     but keep the CTA itself within the first viewport */
  .hero-byline { margin-bottom: 24px; }
  .hero-stats { gap: 12px 24px; }
  .hero-stat .num { font-size: 1.35rem; }
  .term-body { font-size: 0.7rem; padding: 13px 14px 15px; }
}

/* =========================================================
   Section chrome
   ========================================================= */
.path-overview {
  padding: 64px 0 24px;
}
.section-heading {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
}
.section-heading .kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: block;
}
.section-heading h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin: 0 0 12px; }
.section-heading p { color: var(--text-dim); margin: 0; }

.path-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.path-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.path-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-glow); }
.path-card .emoji { font-size: 1.6rem; margin-bottom: 10px; display: block; }
.path-card h3 { font-size: 1rem; margin: 0 0 6px; }
.path-card .count { font-size: 0.82rem; color: var(--text-faint); font-family: var(--font-mono); }

/* =========================================================
   Course sections (the 5 pillars)
   ========================================================= */
.course-section {
  padding: 72px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.course-section:nth-of-type(odd) { background: var(--bg-alt); }

.course-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.course-section-head .heading-block { max-width: 640px; }
.course-section-num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
  display: block;
  margin-bottom: 8px;
}
.course-section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.course-section-head p { color: var(--text-dim); margin: 0; }

.progress-ring-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.progress-ring-wrap svg { width: 30px; height: 30px; }
.progress-ring-bg { stroke: var(--border); }
.progress-ring-fill {
  stroke: var(--accent-2);
  transition: stroke-dashoffset 0.4s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Module list */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s ease;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.module-item:hover { border-color: var(--accent); }
.module-item.is-open { border-color: var(--accent); box-shadow: var(--shadow-glow); }

.module-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
}

.module-check {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.module-check svg {
  width: 15px; height: 15px;
  opacity: 0;
  transition: opacity 0.1s ease;
  color: #001018;
}
.module-check:hover { border-color: var(--accent-2); }
.module-check.checked {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.module-check.checked svg { opacity: 1; }

.module-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  flex-shrink: 0;
  width: 3.2ch;
}

.module-emoji { font-size: 1.2rem; flex-shrink: 0; }

.module-title-wrap { flex: 1; min-width: 0; }
.module-title { font-weight: 600; font-size: 0.98rem; }
.module-item.is-checked .module-title { color: var(--text-faint); text-decoration: line-through; text-decoration-color: var(--border); }

.module-status {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--warn);
  background: rgba(255, 180, 84, 0.1);
  border: 1px solid rgba(255, 180, 84, 0.3);
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chevron {
  flex-shrink: 0;
  width: 18px; height: 18px;
  color: var(--text-faint);
  transition: transform 0.2s ease;
}
.module-item.is-open .chevron { transform: rotate(180deg); color: var(--accent); }

.module-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}
.module-item.is-open .module-panel { grid-template-rows: 1fr; }
.module-panel-inner { overflow: hidden; }
.module-panel-content {
  padding: 0 20px 22px 62px;
  color: var(--text-dim);
  font-size: 0.92rem;
  border-top: 1px dashed var(--border);
  margin-top: 0;
  padding-top: 16px;
}
.placeholder-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-faint);
  font-style: italic;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
  background: var(--bg-alt);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-note { color: var(--text-faint); font-size: 0.85rem; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--text-dim); font-size: 0.85rem; }

/* =========================================================
   Utility / reveal animation
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   Back to top
   ========================================================= */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }
.back-to-top svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Status badges
   ========================================================= */
.module-status.status-available {
  color: var(--accent-2);
  background: rgba(0, 255, 157, 0.1);
  border-color: rgba(0, 255, 157, 0.3);
}

/* =========================================================
   Breadcrumb
   ========================================================= */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 28px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-faint); }
.breadcrumb .current { color: var(--accent-2); }

/* =========================================================
   Module detail header
   ========================================================= */
.module-hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(600px 280px at 10% -20%, rgba(0, 217, 255, 0.12), transparent 60%);
}
.module-hero .badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface);
}
.pill.pill-accent { color: var(--accent); border-color: rgba(0, 217, 255, 0.35); background: rgba(0, 217, 255, 0.08); }
.pill.pill-available { color: var(--accent-2); border-color: rgba(0, 255, 157, 0.35); background: rgba(0, 255, 157, 0.08); }

.module-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 14px;
  max-width: 24ch;
  letter-spacing: -0.02em;
}
.module-hero-prompt {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-faint);
  margin: 0 0 18px;
}
.module-hero-prompt .prompt { color: var(--accent); }
.module-hero-prompt .file { color: var(--accent-2); }

.module-hero .dek {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 68ch;
  margin: 0 0 28px;
}
.module-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.mark-complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s ease;
}
.mark-complete-btn svg { width: 16px; height: 16px; }
.mark-complete-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.mark-complete-btn.is-complete {
  background: rgba(0, 255, 157, 0.1);
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* =========================================================
   Module body layout (content + TOC)
   ========================================================= */
.module-body {
  padding: 48px 0 96px;
}
.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 56px;
  align-items: start;
}
@media (max-width: 960px) {
  .module-grid { grid-template-columns: 1fr; }
}

.module-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
@media (max-width: 960px) {
  .module-toc { position: static; max-height: none; order: -1; }
}
.module-toc h2 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.toc-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
}
.toc-toggle .chevron { width: 18px; height: 18px; color: var(--text-faint); transition: transform 0.15s ease; }
.module-toc.is-open .toc-toggle .chevron,
.page-quicknav.is-open .toc-toggle .chevron { transform: rotate(180deg); }
@media (max-width: 960px) {
  .toc-toggle { display: flex; }
  .module-toc .toc-groups { display: none; margin-top: 14px; }
  .module-toc.is-open .toc-groups { display: block; }
}

/* =========================================================
   Homepage "On this page" quick-nav (mobile/tablet only)
   ========================================================= */
.page-quicknav { display: none; }
@media (max-width: 860px) {
  .page-quicknav {
    display: block;
    max-width: 1120px;
    margin: 16px auto 0;
    padding: 0 24px;
  }
  .page-quicknav .toc-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    color: var(--text);
  }
  .page-quicknav.is-open .toc-toggle { border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom-color: transparent; }
  .quicknav-panel {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 8px;
  }
  .page-quicknav.is-open .quicknav-panel { display: block; }
  .quicknav-panel ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .quicknav-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 0.92rem;
  }
  .quicknav-panel a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
}
.toc-group + .toc-group { margin-top: 18px; }
.toc-group-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin: 0 0 6px;
  padding: 0 8px;
}
.module-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  counter-reset: toc;
}
.module-toc li { counter-increment: toc; }
.module-toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.35;
  transition: background 0.12s ease, color 0.12s ease;
}
.module-toc a::before {
  content: counter(toc) ". ";
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.module-toc a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.module-toc a.is-active { color: var(--accent); background: rgba(0, 217, 255, 0.08); }

/* =========================================================
   Prose (long-form lesson content)
   ========================================================= */
.prose { min-width: 0; }
.prose > section {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  margin: 0 0 20px;
  scroll-margin-top: calc(var(--header-h) + 16px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.prose > section:hover { border-color: rgba(0, 217, 255, 0.35); }
.prose > section#intro {
  background: linear-gradient(155deg, rgba(0, 217, 255, 0.08), transparent 60%), var(--surface);
  border-color: rgba(0, 217, 255, 0.3);
}
.prose > section > * { position: relative; z-index: 1; }
.prose > section[data-num]::after {
  content: attr(data-num);
  position: absolute;
  top: -0.15em;
  right: 20px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 5rem;
  line-height: 1;
  color: var(--border);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
[data-theme="light"] .prose > section[data-num]::after { opacity: 0.7; }

.prose h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  margin: 0 0 18px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 0;
}
.sec-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  margin-right: 12px;
  border-radius: 8px;
  background: rgba(0, 217, 255, 0.1);
  border: 1px solid rgba(0, 217, 255, 0.3);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.sec-icon {
  font-size: 1.3rem;
  margin-right: 12px;
  flex-shrink: 0;
}
.sec-no.sec-no-lab {
  background: rgba(0, 255, 157, 0.1);
  border-color: rgba(0, 255, 157, 0.35);
  color: var(--accent-2);
  min-width: auto;
  padding: 0 12px;
}
.prose h3 {
  font-size: 1.12rem;
  margin: 32px 0 12px;
  color: var(--text);
}
.prose h4 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  margin: 24px 0 10px;
}
.prose p {
  color: var(--text-dim);
  margin: 0 0 16px;
  max-width: 74ch;
}
.prose p strong { color: var(--text); }
.prose ul, .prose ol {
  color: var(--text-dim);
  margin: 0 0 16px;
  padding-left: 22px;
  max-width: 74ch;
}
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--accent); }
.prose a { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }
.prose blockquote {
  margin: 0 0 16px;
  padding: 4px 18px;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
  font-style: italic;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--accent-2);
}

.prose pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0 0 18px;
  overflow-x: auto;
  max-width: 74ch;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre;
}

/* Inline diagrams */
.diagram-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 4px 0 20px;
}
.diagram-card svg {
  width: 100%;
  height: auto;
  display: block;
}
.diagram-caption {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 10px 0 0;
}

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.9rem; min-width: 480px; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; color: var(--text-dim); white-space: nowrap; }
.prose th:not(:last-child), .prose td:not(:last-child) { border-right: 1px solid var(--border); }
.prose thead th { color: var(--text); background: var(--surface-hover); font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.prose tbody tr:last-child td { border-bottom: none; }

/* Career-progression flow chain */
.flow-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 4px 0 20px;
}
.flow-chain .step {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.flow-chain .arrow {
  color: var(--accent);
  padding: 0 8px;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.flow-chain.flow-vertical { flex-direction: column; align-items: flex-start; }
.flow-chain.flow-vertical .arrow { padding: 2px 0; }
.flow-chain.flow-detailed .step {
  white-space: normal;
  text-align: left;
  border-radius: var(--radius);
  max-width: 480px;
  padding: 12px 16px;
}
.flow-chain .step strong { color: var(--accent-2); font-family: var(--font-sans); }
.flow-chain .step .step-desc {
  display: block;
  margin-top: 4px;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

/* Callout / exercise box */
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin: 0 0 20px;
}
.callout.callout-exercise { border-left-color: var(--accent-2); }
.callout .callout-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-2);
  margin-bottom: 10px;
}
.callout p:last-child, .callout ul:last-child, .callout ol:last-child { margin-bottom: 0; }
.callout .field-line {
  border-bottom: 1px dashed var(--border);
  min-height: 1.6em;
  margin: 4px 0 16px;
}

/* Knowledge check */
.kc-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.kc-progress .bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.kc-progress .bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}
.knowledge-check {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.knowledge-check li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  color: var(--text);
  margin: 0;
  transition: border-color 0.15s ease;
}
.knowledge-check li::marker { content: none; }
.knowledge-check button.kc-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.knowledge-check li.is-done { border-color: rgba(0, 255, 157, 0.35); }
.knowledge-check li.is-done .kc-text { color: var(--text-faint); text-decoration: line-through; text-decoration-color: var(--border); }
.knowledge-check .qnum {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  transition: all 0.15s ease;
}
.knowledge-check li.is-done .qnum {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #001018;
}
.kc-text { padding-top: 2px; }

/* Predict-first prompt (packet-capture labs) */
.predict-box {
  background: rgba(0, 217, 255, 0.05);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 4px 0 18px;
}
.predict-box .predict-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}
.predict-box p:last-child { margin-bottom: 0; }

/* Reveal disclosure (expected results, model answers) */
.reveal-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 18px;
  overflow: hidden;
}
.reveal-box summary {
  cursor: pointer;
  padding: 12px 16px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.reveal-box summary::-webkit-details-marker { display: none; }
.reveal-box summary::before {
  content: "\25B8";
  display: inline-block;
  transition: transform 0.15s ease;
}
.reveal-box[open] summary::before { transform: rotate(90deg); }
.reveal-box .reveal-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.reveal-box .reveal-body > *:first-child { margin-top: 14px; }
.reveal-box .reveal-body > *:last-child { margin-bottom: 0; }

/* Compact term list (DNS record types etc.) */
.term-list { margin: 0 0 18px; }
.term-list div.term-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.term-list div.term-row:first-child { border-top: none; }
.term-list dt {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.88rem;
}
.term-list dd { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
@media (max-width: 560px) {
  .term-list div.term-row { grid-template-columns: 1fr; gap: 2px; }
}

/* Term list used as a plain bullet list (single block of text per row, no dt/dd) */
.term-list li.term-row {
  display: list-item;
  list-style: none;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
}
.term-list li.term-row:first-child { border-top: none; }
.term-list li.term-row strong { color: var(--text); font-family: var(--font-mono); font-weight: 700; }

/* Term-chip cloud (Key Terms lists) */
.term-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.term-chips li {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
}

/* Lesson path grid (multi-page modules, e.g. Module 9) */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 4px 0 8px;
}
@media (max-width: 640px) { .lesson-grid { grid-template-columns: 1fr; } }
.lesson-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.lesson-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.lesson-card.is-complete { border-color: rgba(0, 255, 157, 0.35); }
.lesson-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lesson-num {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0, 217, 255, 0.1);
  border: 1px solid rgba(0, 217, 255, 0.35);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.15s ease;
}
.lesson-card.is-complete .lesson-num { background: var(--accent-2); border-color: var(--accent-2); color: #001018; }
.lesson-card-title { font-weight: 700; font-size: 1rem; color: var(--text); }
.lesson-card-desc { color: var(--text-dim); font-size: 0.88rem; margin: 0 0 12px; }
.lesson-card-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.lesson-card-meta .done-tag { color: var(--accent-2); display: none; }
.lesson-card.is-complete .lesson-card-meta .done-tag { display: inline; }

/* Animated diagram "packet/token" motion (frozen by prefers-reduced-motion rule above) */
.diagram-pulse {
  offset-distance: 0%;
  animation: diagram-travel 3.2s linear infinite;
}
@keyframes diagram-travel {
  to { offset-distance: 100%; }
}

/* Module footer nav */
.module-footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
@media (max-width: 640px) { .module-footer-nav { grid-template-columns: 1fr; } }
.module-footer-nav a, .module-footer-nav .disabled {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
}
.module-footer-nav a:hover { border-color: var(--accent); text-decoration: none; }
.module-footer-nav .disabled { opacity: 0.5; cursor: not-allowed; }
.module-footer-nav .dir { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 4px; }
.module-footer-nav .to-next { text-align: right; }
