/* Shared styles for learn-tailscale.
   Deep navy + teal + amber. Calm, technical, friendly. Used by every page.
   localStorage namespace for this course: ts_ */

:root {
  --bg: #070b14;
  --bg-surface: #111726;
  --bg-elevated: #1a2236;
  --bg-code: #050810;
  --border: #232c44;
  --border-strong: #36405e;
  --text: #e6ecf5;
  --text-muted: #8d97b4;
  --text-faint: #5d667f;

  --accent: #5eead4;       /* teal */
  --accent-soft: rgba(94, 234, 212, 0.14);
  --accent-deep: #14b8a6;
  --warm: #fbbf24;         /* amber */
  --warm-soft: rgba(251, 191, 36, 0.12);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);
  --indigo: #818cf8;
  --indigo-soft: rgba(129, 140, 248, 0.14);

  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;

  --radius: 12px;
  --radius-sm: 6px;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 15% 0%, rgba(94, 234, 212, 0.05), transparent 50%),
    radial-gradient(circle at 85% 100%, rgba(251, 191, 36, 0.03), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(94, 234, 212, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 234, 212, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* === Site nav === */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  background: rgba(7, 11, 20, 0.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-nav .logo {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; color: var(--text); text-decoration: none;
}
.site-nav .logo .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.site-nav .crumbs { color: var(--text-muted); }
.site-nav .crumbs a { color: var(--text-muted); text-decoration: none; }
.site-nav .crumbs a:hover { color: var(--accent); }
.site-nav .crumbs .sep { color: var(--text-faint); margin: 0 0.4rem; }
.site-nav .crumbs .here { color: var(--text); }
.site-nav .spacer { flex: 1; }
.site-nav a { color: var(--text-muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  position: relative;
  z-index: 1;
}

/* === Hero === */
.hero { padding: 2.5rem 0 1.5rem; }
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.hero h1 .accent { color: var(--accent); }
.hero h1 .warm { color: var(--warm); }
.hero .tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 64ch;
  margin: 0 0 1.6rem;
}
.hero .promise {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.35rem 0.7rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* === Section labels === */
.section-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin: 2rem 0 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-label::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--border-strong);
}
.section-label .count {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.5rem;
  border-radius: 100px;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* === Lesson layout === */
.lesson-bar-wrap {
  position: sticky;
  top: 51px;
  z-index: 49;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.lesson-bar {
  max-width: 1240px; margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.lesson-bar .meta {
  display: flex; gap: 1rem; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--text-muted);
}
.lesson-bar .meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.lesson-bar .spacer { flex: 1; }

.toggle {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.2rem;
  font-size: 0.78rem;
}
.toggle button {
  background: none; border: none; cursor: pointer;
  padding: 0.35rem 0.85rem;
  color: var(--text-muted);
  border-radius: 100px;
  font-family: inherit;
}
.toggle button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.lesson {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2rem;
}
.lesson.single { grid-template-columns: minmax(0, 720px); margin: 0 auto; }
@media (max-width: 940px) {
  .lesson { grid-template-columns: 1fr; }
}

.narrative h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  margin: 0.5rem 0 0.5rem;
  letter-spacing: -0.01em;
}
.narrative h1 .accent { color: var(--accent); }
.narrative h1 .warm { color: var(--warm); }
.narrative .deck { color: var(--text-muted); font-size: 1.05rem; margin: 0 0 2rem; max-width: 60ch; }
.narrative .section { margin-bottom: 3rem; }
.narrative h2 {
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
  letter-spacing: -0.005em;
}
.narrative h2 .num {
  display: inline-block;
  width: 1.7rem; height: 1.7rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.7rem;
  margin-right: 0.55rem;
  vertical-align: 0.1rem;
}
.narrative h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--accent);
}
.narrative p { margin: 0 0 1rem; max-width: 64ch; }
.narrative ul, .narrative ol { padding-left: 1.4rem; margin: 0 0 1rem; max-width: 64ch; }
.narrative li { margin: 0.35rem 0; }
.narrative code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-code);
  color: var(--accent);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.narrative pre {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-code);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  line-height: 1.55;
  max-width: 64ch;
}
.narrative pre code { background: none; color: var(--text); padding: 0; }
.narrative pre .cmt { color: var(--text-faint); }
.narrative pre .kw { color: var(--accent); }
.narrative pre .str { color: var(--warm); }
.narrative p.callout {
  background: var(--warm-soft);
  border-left: 3px solid var(--warm);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.95rem;
}
.narrative p.aha {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.narrative p.warn {
  background: var(--rose-soft);
  border-left: 3px solid var(--rose);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.narrative .deep-only {
  border-left: 2px dashed var(--border-strong);
  padding-left: 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 1rem 0;
}
.narrative.quick .deep-only { display: none; }

/* Glossary chips */
.glossary {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: help;
  position: relative;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.glossary:hover .pop, .glossary:focus .pop { display: block; }
.glossary .pop {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  width: 280px;
  z-index: 10;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
  text-decoration: none;
  text-align: left;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.glossary .pop strong { color: var(--accent); }
.glossary .pop::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-strong);
}

/* Break point */
.breakpoint {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 64ch;
}
.breakpoint .ico { font-size: 1.4rem; }
.breakpoint strong { color: var(--text); }

/* Diagram pane */
.diagram-pane {
  position: sticky;
  top: 120px;
  height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (max-width: 940px) {
  .diagram-pane { position: relative; top: 0; height: auto; }
}
.scene {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  min-height: 460px;
}
.scene .label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}
.scene .title { font-weight: 600; margin: 0 0 1rem; font-size: 1.05rem; }
.scene svg { flex: 1; width: 100%; height: 100%; min-height: 320px; }
.scene-caption {
  margin-top: 0.85rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}
.scene-nav {
  display: flex; gap: 0.3rem; flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
}
.scene-nav button {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-nav button:hover { color: var(--text); }
.scene-nav button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* SVG element styles (used across diagrams) */
.svg-bg { fill: var(--bg-code); }
.label-bg { fill: var(--bg-code); }
.annot { fill: var(--text); font-size: 9px; font-family: var(--font-mono); }
.annot-warm { fill: var(--warm); font-size: 9px; font-family: var(--font-mono); font-weight: 700; }
.annot-accent { fill: var(--accent); font-size: 9px; font-family: var(--font-mono); font-weight: 700; }
.annot-rose { fill: var(--rose); font-size: 9px; font-family: var(--font-mono); font-weight: 700; }
.house { fill: var(--bg-elevated); stroke: var(--border-strong); stroke-width: 1.5; rx: 8; }
.house-label { fill: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.device { fill: var(--bg-surface); stroke: var(--border-strong); stroke-width: 1.5; rx: 6; }
.device-icon { font-size: 18px; }
.device-label { fill: var(--text); font-size: 10px; font-family: var(--font-mono); }
.device-ip { fill: var(--text-faint); font-size: 9px; font-family: var(--font-mono); }
.router { fill: var(--warm-soft); stroke: var(--warm); stroke-width: 2; rx: 6; }
.router-label { fill: var(--warm); font-size: 10px; font-family: var(--font-mono); font-weight: 700; }
.cloud-text { fill: var(--text-faint); font-size: 11px; font-family: var(--font-mono); }
.line { stroke: var(--border-strong); stroke-width: 1.5; fill: none; }
.line-active { stroke: var(--accent); stroke-width: 2; fill: none; stroke-dasharray: 4 4; animation: dash 0.8s linear infinite; }
.line-blocked { stroke: var(--rose); stroke-width: 2; fill: none; stroke-dasharray: 4 4; }
@keyframes dash { to { stroke-dashoffset: -16; } }
.x-block { fill: var(--rose); font-size: 22px; font-weight: 700; font-family: var(--font-mono); }

/* === Knowledge check === */
.check {
  max-width: 1240px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
}
.check-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warm);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}
.check-card .head {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.check-card .head .ico { font-size: 1.3rem; }
.check-card .head .label {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--warm);
}
.check-card h3 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.check-card .blurb { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.25rem; }
.q { margin-bottom: 1.5rem; }
.q:last-child { margin-bottom: 0; }
.q .stem { font-weight: 600; margin-bottom: 0.7rem; }
.q .stem .num { color: var(--text-faint); font-family: var(--font-mono); margin-right: 0.4rem; }
.q .opts { display: flex; flex-direction: column; gap: 0.4rem; }
.q .opt {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  font-size: 0.92rem;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: all 120ms ease;
  display: flex; align-items: flex-start; gap: 0.6rem;
}
.q .opt:hover:not([disabled]) { border-color: var(--border-strong); transform: translateX(2px); }
.q .opt .marker {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}
.q .opt.correct { background: var(--accent-soft); border-color: var(--accent); }
.q .opt.correct .marker { border-color: var(--accent); color: var(--accent); }
.q .opt.wrong { background: var(--rose-soft); border-color: var(--rose); }
.q .opt.wrong .marker { border-color: var(--rose); color: var(--rose); }
.q .opt[disabled] { cursor: default; opacity: 0.7; }
.q .opt.correct[disabled], .q .opt.wrong[disabled] { opacity: 1; }
.q .feedback {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.5;
}
.q .feedback.show { display: block; }
.q .feedback.ok { background: var(--accent-soft); border-left: 3px solid var(--accent); color: var(--text); }
.q .feedback.no { background: var(--rose-soft); border-left: 3px solid var(--rose); color: var(--text); }
.q .feedback strong { color: var(--accent); }
.q .feedback.no strong { color: var(--rose); }
.check-summary {
  display: none;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  text-align: center;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.check-summary.show { display: block; }
.check-summary .score { font-size: 1.5rem; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }

/* === Lesson footer prev/next === */
.lesson-footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  gap: 1rem;
}
.lesson-footer a {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: all 180ms ease;
}
.lesson-footer a.disabled { pointer-events: none; opacity: 0.4; }
.lesson-footer a:hover:not(.disabled) { border-color: var(--accent); transform: translateY(-1px); }
.lesson-footer .dir { font-size: 0.74rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; }
.lesson-footer .lt { font-weight: 600; margin-top: 0.25rem; }
.lesson-footer .next { text-align: right; }

/* === Track banner & course progress strip (module pages) === */
.track-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.95rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.track-banner.quickstart { border-left-color: var(--warm); }
.track-banner .track-name {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.track-banner.quickstart .track-name { background: var(--warm-soft); color: var(--warm); }
.track-banner .switch {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: inherit;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
}
.track-banner .switch:hover { color: var(--accent); border-color: var(--accent); }

.course-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.45rem;
  margin: 1rem 0 1.5rem;
}
.course-strip .stage {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  text-decoration: none;
  color: var(--text);
  transition: all 150ms ease;
}
.course-strip .stage:hover { border-color: var(--border-strong); }
.course-strip .stage.current {
  border-color: var(--warm);
  background: linear-gradient(180deg, var(--warm-soft), var(--bg-surface));
}
.course-strip .stage.done { border-color: var(--accent); }
.course-strip .stage .stage-head {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.course-strip .stage.done .stage-head { color: var(--accent); }
.course-strip .stage.current .stage-head { color: var(--warm); }
.course-strip .stage .stage-title {
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 0.3rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-strip .stage .stage-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 100px;
  overflow: hidden;
}
.course-strip .stage .stage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  width: 0;
  transition: width 400ms ease;
}

/* === Quickstart filter on lesson lists === */
.lesson-list[data-track="quickstart"] a[data-quickstart="no"] {
  opacity: 0.42;
  border-style: dashed;
  position: relative;
}
.lesson-list[data-track="quickstart"] a[data-quickstart="no"]:hover {
  opacity: 0.75;
}
.lesson-list[data-track="quickstart"] a[data-quickstart="no"] .meta::after {
  content: " · skip on Quickstart";
  color: var(--text-faint);
}

/* === Next-module / next-step card (proper button styling) === */
.next-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: all 200ms ease;
  margin-top: 1.5rem;
}
.next-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.3);
}
.next-card .nc-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}
.next-card .nc-body { flex: 1; min-width: 0; }
.next-card .nc-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 0.2rem;
}
.next-card .nc-title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.next-card .nc-meta { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }
.next-card .nc-arrow {
  flex: 0 0 auto;
  font-size: 1.4rem;
  color: var(--accent);
  transition: transform 200ms ease;
}
.next-card:hover .nc-arrow { transform: translateX(4px); }

/* Variant: warm (capstone / project gallery) */
.next-card.warm { border-left-color: var(--warm); }
.next-card.warm .nc-icon { background: var(--warm-soft); color: var(--warm); }
.next-card.warm .nc-arrow { color: var(--warm); }

/* === Module index page === */
.module-hero { padding: 2rem 0 1rem; }
.module-hero .crumb { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.4rem; }
.module-hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); margin: 0 0 0.5rem; }
.module-hero .deck { color: var(--text-muted); max-width: 70ch; }
.module-progress {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
}
.module-progress .bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.module-progress .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  transition: width 400ms ease;
  width: 0;
}
.module-progress .meta { font-size: 0.85rem; color: var(--text-muted); }

.lesson-list { display: flex; flex-direction: column; gap: 0.6rem; }
.lesson-list a {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: all 150ms ease;
}
.lesson-list a:hover { border-color: var(--accent); transform: translateX(3px); }
.lesson-list .num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lesson-list a.done .num { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.lesson-list a.done .num::after { content: "✓"; font-size: 0.95rem; }
.lesson-list a.done .num span { display: none; }
.lesson-list a.current .num { background: var(--warm); border-color: var(--warm); color: var(--bg); }
.lesson-list .title { flex: 1; font-weight: 600; }
.lesson-list .meta { color: var(--text-faint); font-size: 0.82rem; font-family: var(--font-mono); }
.lesson-list a.optional { border-style: dashed; }
.lesson-list a.optional .title::after { content: " · optional"; color: var(--text-faint); font-weight: 400; font-size: 0.85em; }

/* === Project page === */
.project-page .header-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin: 1rem 0 1.5rem;
}
.project-page .header-bar .crumb { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.4rem; }
.project-page .header-bar h1 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin: 0 0 0.5rem; }
.project-page .header-bar .deck { color: var(--text-muted); font-size: 1.02rem; max-width: 70ch; margin: 0 0 1rem; }
.project-page .header-bar .badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  border-radius: 100px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.tag[data-cat="tier"][data-val="Core"] { background: var(--warm-soft); color: var(--warm); border-color: rgba(251, 191, 36, 0.3); }
.tag[data-cat="tier"][data-val="Featured"] { background: var(--accent-soft); color: var(--accent); border-color: rgba(94, 234, 212, 0.3); }
.tag[data-cat="tier"][data-val="Gallery"] { background: var(--indigo-soft); color: var(--indigo); border-color: rgba(129, 140, 248, 0.3); }
.tag[data-cat="diff"][data-val="Beginner"] { color: var(--ok); border-color: rgba(74, 222, 128, 0.3); }
.tag[data-cat="diff"][data-val="Intermediate"] { color: var(--warm); }
.tag[data-cat="diff"][data-val="Advanced"] { color: var(--rose); border-color: rgba(251, 113, 133, 0.3); }

.steps { counter-reset: step; }
.step {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  position: relative;
}
.step h3 {
  display: flex; align-items: center; gap: 0.7rem;
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}
.step h3::before {
  counter-increment: step;
  content: counter(step);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.step .est {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.step ol, .step ul { padding-left: 1.4rem; }
.step pre, .step code { font-family: var(--font-mono); }
.step pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.step code { background: var(--bg-code); color: var(--accent); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.88em; }
.step pre code { background: none; color: var(--text); padding: 0; }

/* OS picker tabs */
.os-tabs {
  display: flex;
  gap: 0.3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem;
  margin: 0.5rem 0 1rem;
  flex-wrap: wrap;
}
.os-tabs button {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-family: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 120ms ease;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.os-tabs button:hover { color: var(--text); }
.os-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.os-panel { display: none; }
.os-panel.active { display: block; }

/* === Project architecture diagrams (inline SVG inside project pages) === */
.project-diagram {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0 1.25rem;
  max-width: 760px;
}
.project-diagram svg { width: 100%; height: auto; display: block; }
.project-diagram .pd-rect {
  fill: var(--bg-elevated);
  stroke: var(--border-strong);
  stroke-width: 1.5;
  rx: 8;
}
.project-diagram .pd-node.accent .pd-rect {
  fill: var(--accent-soft);
  stroke: var(--accent);
}
.project-diagram .pd-node.soft .pd-rect {
  fill: var(--bg-surface);
  stroke: var(--border);
}
.project-diagram .pd-node.optional .pd-rect {
  fill: var(--warm-soft);
  stroke: var(--warm);
  stroke-dasharray: 5 3;
}
.project-diagram .pd-node.faint .pd-rect {
  fill: var(--bg-surface);
  stroke: var(--text-faint);
  stroke-dasharray: 2 4;
}
.project-diagram .pd-title {
  fill: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}
.project-diagram .pd-sub {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
}
.project-diagram .pd-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}
.project-diagram .pd-gutter {
  fill: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.project-diagram .pd-line {
  stroke: var(--text-muted);
  stroke-width: 1.5;
  fill: none;
  opacity: 0.6;
}
.project-diagram .pd-line.dashed { stroke-dasharray: 4 3; }
.project-diagram .pd-line.accent { stroke: var(--accent); opacity: 0.8; }

/* === Comparison tables === */
.compare-table {
  width: 100%;
  max-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1rem 0 1.5rem;
  overflow: hidden;
  font-size: 0.9rem;
}
.compare-table th, .compare-table td {
  padding: 0.75rem 0.95rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.compare-table thead th {
  background: var(--bg-elevated);
  font-weight: 700;
  color: var(--text);
  font-size: 0.85rem;
}
.compare-table thead th:first-child { color: var(--text-faint); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.74rem; }
.compare-table tbody th {
  font-weight: 500;
  color: var(--text-faint);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-elevated);
  width: 140px;
}
.compare-table tbody tr:last-child th, .compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table tbody td { color: var(--text); line-height: 1.5; }
.compare-table tbody td.recommend { background: var(--accent-soft); color: var(--text); }
.compare-table tbody td code { font-family: var(--font-mono); font-size: 0.85em; padding: 0.1rem 0.35rem; background: var(--bg-code); border-radius: 3px; color: var(--accent); }

/* === Context cards (Who this helps / What you get / Prerequisites) === */
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 0.5rem;
}
.context-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem 1rem;
}
.context-card .cc-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  font-weight: 700;
  margin: 0 0 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.context-card .cc-icon {
  font-size: 0.9rem;
  line-height: 1;
}
.context-card ul {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text);
}
.context-card ul li { margin-bottom: 0.4rem; }
.context-card ul li:last-child { margin-bottom: 0; }
.context-card a { color: var(--accent); }
.context-card code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.05rem 0.3rem;
  background: var(--bg-code);
  border-radius: 3px;
  color: var(--accent);
}
.context-card strong { color: var(--text); font-weight: 600; }

/* === Variation cards (variations-stack as the wrapper) === */
.variations-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}
.variation-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: var(--radius);
  padding: 1.1rem 1.35rem 1.15rem;
}
.variation-card.accent { border-left-color: var(--accent); }
.variation-card.warm { border-left-color: var(--warm); }
.variation-card .vc-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.variation-card .vc-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.7rem;
  color: var(--text);
  line-height: 1.3;
}
.variation-card p { margin: 0.55rem 0; }
.variation-card p:first-of-type { margin-top: 0; }
.variation-card p:last-child { margin-bottom: 0; }
.variation-card pre { margin: 0.6rem 0; }
.variation-card ul, .variation-card ol { margin: 0.5rem 0; padding-left: 1.2rem; }
.variation-card ul li, .variation-card ol li { margin-bottom: 0.3rem; }

/* === Reference card grid (Verify / Common issues / Caveats) === */
.reference-section { margin: 2rem 0 0; }
.reference-section .rs-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin: 0 0 0.85rem;
  font-weight: 600;
}
.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 0 0 0.5rem;
}
.reference-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.05rem;
  display: flex;
  flex-direction: column;
}
.reference-card.verify { border-left-color: var(--accent); }
.reference-card.issues { border-left-color: var(--warm); }
.reference-card.caveats { border-left-color: var(--text-faint); }
.reference-card .rc-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin: 0 0 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.reference-card.verify .rc-title { color: var(--accent); }
.reference-card.issues .rc-title { color: var(--warm); }
.reference-card .rc-icon {
  font-size: 0.95rem;
  line-height: 1;
}
.reference-card ul {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}
.reference-card ul li { margin-bottom: 0.55rem; }
.reference-card ul li:last-child { margin-bottom: 0; }
.reference-card code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.05rem 0.3rem;
  background: var(--bg-code);
  border-radius: 3px;
  color: var(--accent);
}
.reference-card strong { color: var(--text); font-weight: 600; }

/* === Sizing chart (horizontal bars) === */
.sizing-chart {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 760px;
  margin: 1rem 0 1.5rem;
}
.sizing-chart .sc-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.85rem;
}
.sizing-chart .sc-row {
  display: grid;
  grid-template-columns: minmax(0, 160px) 1fr 64px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
}
.sizing-chart .sc-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sizing-chart .sc-bar-track {
  height: 18px;
  background: var(--bg-elevated);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.sizing-chart .sc-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--warm));
}
.sizing-chart .sc-bar-fill.heavy { background: linear-gradient(90deg, var(--warm), var(--rose)); }
.sizing-chart .sc-size {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: right;
}
.sizing-chart .sc-axis {
  position: relative;
  height: 22px;
  margin: 0.85rem 0 0.4rem 168px;
  margin-right: 72px;
  border-top: 1px dashed var(--border-strong);
}
.sizing-chart .sc-axis .sc-tick {
  position: absolute;
  top: -4px;
  width: 1px;
  height: 8px;
  background: var(--border-strong);
}
.sizing-chart .sc-axis .sc-tick-label {
  position: absolute;
  top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Tag chip mini (for inline) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.18rem 0.55rem;
  border-radius: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.chip.ok { color: var(--ok); border-color: rgba(74,222,128,0.3); }
.chip.warm { color: var(--warm); border-color: rgba(251,191,36,0.3); }
.chip.accent { color: var(--accent); border-color: rgba(94,234,212,0.3); }
