/* ============================================
   Youtube for smart people — Stylesheet
   Light Editorial Design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&family=Karla:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Fira+Code:wght@400;500;600&display=swap');

/* === Custom Properties === */
:root {
  --bg: #F8F7F4;
  --bg-warm: #F2F0EB;
  --surface: #FFFFFF;
  --surface-hover: #FDFCFA;
  --border: #E6E3DC;
  --border-light: #EDEAE4;
  --primary: #DC2626;
  --primary-soft: #FEE2E2;
  --primary-hover: #B91C1C;
  --secondary: #3B6B8A;
  --secondary-soft: #E0EFF8;
  --accent: #16795A;
  --accent-soft: #D1FAE5;
  --text: #1E1E2C;
  --text-secondary: #4A4A5A;
  --muted: #8A8A9A;
  --code-bg: #F5F3EE;

  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Karla', sans-serif;
  --font-mono: 'Fira Code', monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 4px 16px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.1);
  --transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 100px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--primary-soft);
  color: var(--primary);
}

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

a:hover {
  color: var(--primary);
}

img { max-width: 100%; height: auto; }

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 1rem;
  margin-top: 3.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  margin-bottom: 0.75rem;
  margin-top: 2.5rem;
  color: var(--text);
}

h4 {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
  margin-top: 2rem;
  color: var(--text-secondary);
}

p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

strong {
  color: var(--text);
  font-weight: 600;
}

/* === Scroll Progress === */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--primary);
  z-index: 9999;
  transition: width 80ms linear;
}

/* ===================================
   NAVIGATION — Clean Top Bar
   =================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(248, 247, 244, 0.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  padding: 0;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 2rem;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.brand-text {
  display: inline;
}

@media (max-width: 600px) {
  .brand-text { display: none; }
}

.nav-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
}

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

.nav-links a {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-warm);
}

.nav-links a.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0.65rem;
  right: 0.65rem;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-toggle:hover {
  background: var(--bg-warm);
}

@media (max-width: 1100px) {
  .nav-toggle { display: flex; align-items: center; gap: 0.4rem; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    gap: 0.1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
  }
  .nav-links a.active::after { display: none; }
  .nav-links a.active { background: var(--primary-soft); }
}

/* ===================================
   LAYOUT
   =================================== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
}

.content {
  max-width: 780px;
  margin: 0 auto;
}

/* Alternative wrapper classes (used in kapitel 2-10) */
.chapter-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
}

.content-container {
  max-width: 780px;
  margin: 0 auto;
}

/* Zurück-zum-Dashboard Button */
.back-to-dashboard {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
  margin-top: 2rem;
}

.back-to-dashboard a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: var(--transition);
}

.back-to-dashboard a:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Main footer variant */
.main-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3rem;
  background: var(--surface);
}

.main-footer a { color: var(--primary); }

/* Content with sidebar TOC layout */
.content-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  align-items: start;
}

.content-main {
  max-width: 780px;
  min-width: 0;
}

@media (max-width: 1024px) {
  .content-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
  text-align: center;
  padding: clamp(3rem, 8vw, 6rem) clamp(1.5rem, 4vw, 3rem);
  max-width: 900px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.hero h1 .highlight {
  color: var(--primary);
}

.hero .subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

/* === Roadmap Steps === */
.steps {
  display: flex;
  gap: 0;
  margin: 2.5rem auto;
  max-width: 700px;
  position: relative;
}

.steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 40px;
  right: 40px;
  height: 2px;
  background: var(--border);
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.65rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  transition: var(--transition);
}

.step.active .step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.step.done .step-number {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* ===================================
   CARDS
   =================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  opacity: 0.08;
  position: absolute;
  top: 10px;
  right: 18px;
  line-height: 1;
}

.card .card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card h3 {
  font-size: 1.15rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.6;
}

a.card {
  display: block;
  cursor: pointer;
}

a.card:hover {
  color: inherit;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}

.card-link:hover {
  gap: 0.65rem;
}

.card-link::after {
  content: '\2192';
  transition: var(--transition);
}

/* ===================================
   METRIC BANNER
   =================================== */
.metric-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: var(--transition);
}

.metric-card:hover {
  box-shadow: var(--shadow-sm);
}

.metric-card .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.metric-card .value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
}

.metric-card .desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

/* ===================================
   CALCULATOR
   =================================== */
.calculator {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  margin: 2.5rem 0;
  box-shadow: var(--shadow-sm);
}

.calculator h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.calc-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.calc-field select,
.calc-field input[type="number"],
.calc-field input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.calc-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238A8A9A' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}

.calc-field select:focus,
.calc-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.calc-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.calc-result {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.25rem;
  display: none;
}

.calc-result.visible {
  display: block;
  animation: fadeIn 350ms ease;
}

.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.calc-result-row:last-child {
  border-bottom: none;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  padding-top: 0.75rem;
}

.calc-result-row .label {
  color: var(--muted);
}

/* ===================================
   TABLE OF CONTENTS — Sidebar
   =================================== */
.toc-sidebar {
  position: sticky;
  top: 84px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.82rem;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-sidebar h4 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.toc-sidebar ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc-sidebar li {
  counter-increment: toc;
  margin-bottom: 0.15rem;
}

.toc-sidebar a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 400;
  transition: var(--transition);
  line-height: 1.4;
}

.toc-sidebar a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.5;
  flex-shrink: 0;
  font-weight: 500;
}

.toc-sidebar a:hover {
  background: var(--bg-warm);
  color: var(--text);
}

.toc-sidebar a.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.toc-sidebar a.active::before {
  color: var(--primary);
  opacity: 1;
}

/* Inline TOC fallback (for old pages / mobile) */
.toc {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
}

.toc h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text);
}

.toc ol {
  margin: 0;
  padding-left: 1.5rem;
  counter-reset: toc-inline;
}

.toc ol li {
  margin-bottom: 0.4rem;
  counter-increment: toc-inline;
}

.toc a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
}

.toc a:hover {
  color: var(--primary);
}

@media (max-width: 1024px) {
  .toc-sidebar { display: none; }
}

/* ===================================
   TABLES
   =================================== */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead {
  background: var(--bg);
}

th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

tbody tr:hover {
  background: var(--bg);
}

tbody tr:last-child td {
  border-bottom: none;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover { color: var(--text); }
th.sortable::after { content: ' \2195'; font-size: 0.65rem; opacity: 0.5; }

/* ===================================
   CODE BLOCKS
   =================================== */
.code-block {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin: 1.5rem 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.code-copy {
  padding: 0.2rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: var(--transition);
}

.code-copy:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.code-body {
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre;
  background: var(--code-bg);
}

.code-body .keyword { color: #8B5CF6; }
.code-body .string { color: #16795A; }
.code-body .comment { color: #9CA3AF; font-style: italic; }
.code-body .function { color: #3B6B8A; }
.code-body .number { color: #D97706; }
.code-body .operator { color: #06B6D4; }
.code-body .variable { color: #DC2626; }

code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--primary);
  border: 1px solid var(--border-light);
}

/* ===================================
   INFO BOXES
   =================================== */
.info-box {
  border-radius: var(--radius);
  padding: 1.15rem 1.4rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
  background: var(--surface);
}

.info-box.tip {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.info-box.warning {
  border-color: #D97706;
  background: #FEF3C7;
}

.info-box.danger {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.info-box.info {
  border-color: var(--secondary);
  background: var(--secondary-soft);
}

.info-box.mrbeast {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.info-box-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-box p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.info-box p:last-child {
  margin-bottom: 0;
}

/* ===================================
   BLOCKQUOTE
   =================================== */
blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}

blockquote cite {
  display: block;
  margin-top: 0.6rem;
  font-style: normal;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.8rem;
}

/* ===================================
   LISTS
   =================================== */
.content ul, .content ol,
.content-main ul, .content-main ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-secondary);
}

.content li, .content-main li {
  margin-bottom: 0.45rem;
  padding-left: 0.35rem;
}

.content li::marker, .content-main li::marker {
  color: var(--primary);
}

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

.check-list li {
  padding-left: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.check-list li::before {
  content: '\2713';
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.15rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 0.7rem;
}

/* ===================================
   CHAPTER HEADER
   =================================== */
.chapter-header {
  padding: clamp(3rem, 6vw, 5rem) clamp(1.5rem, 4vw, 3rem) 2rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.chapter-badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
}

.chapter-header .subtitle {
  color: var(--muted);
  font-size: 1rem;
  max-width: 600px;
  margin: 0.5rem auto 0;
  line-height: 1.6;
}

/* ===================================
   CHAPTER NAVIGATION
   =================================== */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem 0;
  padding-top: 2rem;
  border-top: 1.5px solid var(--border);
}

.chapter-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
  max-width: 48%;
}

.chapter-nav a:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.chapter-nav .prev { margin-right: auto; }
.chapter-nav .next { margin-left: auto; text-align: right; }

.chapter-nav .nav-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.chapter-nav .nav-title {
  font-weight: 600;
  font-size: 0.9rem;
}

/* ===================================
   COMPARISON
   =================================== */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.comparison-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}

.comparison-card:hover { box-shadow: var(--shadow-sm); }

.comparison-card .tool-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.comparison-card .tool-price {
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

/* ===================================
   ACCORDION
   =================================== */
.accordion {
  margin: 1.5rem 0;
}

.accordion-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: var(--surface);
}

.accordion-header {
  padding: 0.9rem 1.15rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  color: var(--text);
}

.accordion-header:hover {
  background: var(--bg);
}

.accordion-header::after {
  content: '+';
  font-size: 1.15rem;
  color: var(--muted);
  transition: var(--transition);
  font-weight: 400;
}

.accordion-item.open .accordion-header::after {
  transform: rotate(45deg);
  color: var(--primary);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 350ms ease;
}

.accordion-item.open .accordion-content {
  max-height: 3000px;
}

.accordion-body {
  padding: 0 1.15rem 1.15rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===================================
   TIMELINE
   =================================== */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 2rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.3rem;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border: 3px solid var(--bg);
  border-radius: 50%;
}

.timeline-item h4 {
  margin-top: 0;
  color: var(--primary);
}

/* ===================================
   BADGES
   =================================== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-secondary { background: var(--secondary-soft); color: var(--secondary); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--accent-soft); color: var(--accent); }
.badge-warning { background: #FEF3C7; color: #D97706; }

/* ===================================
   SECTION DIVIDER
   =================================== */
.section-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 3rem 0;
}

/* ===================================
   FOOTER
   =================================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3rem;
  background: var(--surface);
}

.footer a {
  color: var(--primary);
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 400ms ease forwards; }
.slide-up { opacity: 0; animation: slideUp 500ms ease forwards; }

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .metric-banner { grid-template-columns: repeat(2, 1fr); }
  .calc-grid { grid-template-columns: 1fr; }
  .chapter-nav { flex-direction: column; }
  .chapter-nav a { max-width: 100%; }
  .comparison-grid { grid-template-columns: 1fr; }
  .steps { flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
  .steps::before { display: none; }
}

@media (max-width: 480px) {
  .metric-banner { grid-template-columns: 1fr; }
}

/* ===================================
   PRINT
   =================================== */
@media print {
  .nav, .scroll-progress, .chapter-nav, .calc-btn, .toc-sidebar { display: none; }
  body { background: white; }
  .card, .calculator, .info-box { break-inside: avoid; }
}

/* ===================================
   COMPATIBILITY — Custom Classes
   from auto-generated chapters
   =================================== */

/* Chapter header variants */
.chapter-header-content {
  max-width: 700px;
  margin: 0 auto;
}

.chapter-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

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

.chapter-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

/* Section headers */
.section-header {
  margin-top: 3rem;
}

.section-icon {
  display: none; /* hide missing icons gracefully */
}

.section-intro,
.lead-text {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* TOC variants from agents */
.toc-section {
  margin: 2rem 0;
}

.toc-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.toc-header h2 {
  font-size: 1rem;
  margin: 0;
  border: none;
  padding: 0;
}

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

.toc-list li {
  margin-bottom: 0.35rem;
}

.toc-list a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
  transition: var(--transition);
}

.toc-list a:hover {
  color: var(--primary);
}

/* Tip/Warning/Success boxes (alternative classes) */
.tip-box,
.success-box {
  background: var(--accent-soft);
  border: 1px solid rgba(22, 121, 90, 0.2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.15rem 1.4rem;
  margin: 1.5rem 0;
}

.warning-box {
  background: #FEF3C7;
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-left: 4px solid #D97706;
  border-radius: var(--radius);
  padding: 1.15rem 1.4rem;
  margin: 1.5rem 0;
}

.tip-box-header,
.warning-box-header,
.success-box-header {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Input groups (calculator variants) */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-group select,
.input-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

/* Result boxes (calculator variants) */
.result-header {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.result-placeholder {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.result-milestones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.milestone {
  text-align: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.milestone-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.milestone-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.result-disclaimer {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 1rem;
  font-style: italic;
}

/* Copy button variant */
.copy-btn {
  padding: 0.2rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: var(--transition);
}

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

/* Pros/Cons lists */
.pros li::marker { color: var(--accent); }
.cons li::marker { color: var(--primary); }

/* Tool names in comparisons */
.tool-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.tool-price {
  color: var(--primary);
  font-weight: 700;
}

.total-cell {
  font-weight: 700;
  color: var(--primary);
}

/* Footer variants */
.site-footer,
.main-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3rem;
  background: var(--surface);
}

.site-footer a,
.main-footer a {
  color: var(--primary);
}

.footer-container {
  max-width: 780px;
  margin: 0 auto;
}

.footer-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.footer-description {
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.footer-column {
  text-align: center;
}

.footer-text {
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-bottom {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Hide data-lucide icons gracefully (Lucide not loaded) */
[data-lucide] {
  display: none;
}
