:root {
  --bg: #f5f0e5;
  --surface: #fffdf8;
  --surface-2: #efe8d8;
  --ink: #1d2721;
  --muted: #5b6560;
  --line: #ddd3bf;
  --accent: #1d5a3e;
  --accent-soft: #dcebe1;
  --accent-ink: #ffffff;
  --brass: #9a6a12;
  --brass-soft: #f4e6c7;
  --warn: #9b3b26;
  --warn-soft: #f6e1d9;
  --shadow: 0 1px 2px rgba(30, 30, 20, .06), 0 6px 20px rgba(30, 30, 20, .06);
  --grid: rgba(29, 90, 62, .07);
  --rail: #cdbf9f;
  --radius: 14px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --surface: #181e1b; --surface-2: #202824; --ink: #ebe6da; --muted: #a3aaa4;
    --line: #2d3732; --accent: #6cc196; --accent-soft: #1f3a2d; --accent-ink: #0d1a13;
    --brass: #e0ad4c; --brass-soft: #3a2f19; --warn: #ec9a83; --warn-soft: #3d241d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25);
    --grid: rgba(108, 193, 150, .06); --rail: #3a463f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --surface: #181e1b; --surface-2: #202824; --ink: #ebe6da; --muted: #a3aaa4;
  --line: #2d3732; --accent: #6cc196; --accent-soft: #1f3a2d; --accent-ink: #0d1a13;
  --brass: #e0ad4c; --brass-soft: #3a2f19; --warn: #ec9a83; --warn-soft: #3d241d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25);
  --grid: rgba(108, 193, 150, .06); --rail: #3a463f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--font-body); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; font-family: var(--font-body); font-weight: 650; letter-spacing: 0; }
p { margin: 0 0 1em; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 650; font-size: 1.2rem; }
.brand img { width: auto; height: 52px; }
.hero-logo { margin: 0; display: grid; place-items: center; }
.hero-logo img { width: 100%; max-width: 520px; height: auto; filter: drop-shadow(0 18px 30px rgba(15, 45, 30, .22)); }
@media (max-width: 980px) {
  .hero-logo { order: -1; }
  .hero-logo img { max-width: 320px; }
}
.blueprint-inline { margin: 8px 0 12px; max-width: 620px; }
.blueprint-inline svg { transform: none; }
.wordmark { letter-spacing: -.02em; }
.wordmark em, .hero h1 em { font-style: italic; color: var(--accent); font-weight: 600; }
.footer-brand { display: inline-block; margin-bottom: 14px; }
.footer-brand img { width: 143px; height: auto; }
.top-nav { display: flex; gap: 4px; margin-left: auto; }
.top-nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: .92rem; font-weight: 500; }
.top-nav a:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--ink); width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
@media (max-width: 760px) { .top-nav { display: none; } .icon-btn { margin-left: auto; } }

/* Hero */
.hero {
  padding: 56px 0 40px; position: relative;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 220px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.hero > .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.blueprint { margin: 0; }
.blueprint svg { width: 100%; height: auto; display: block; border-radius: var(--radius); box-shadow: 0 24px 60px -20px rgba(15, 45, 30, .45), 0 0 0 1px rgba(0,0,0,.05); transform: rotate(1.2deg); }
.blueprint figcaption { font: 500 .78rem/1.4 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); margin-top: 14px; text-align: center; }
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .blueprint svg { transform: none; }
}
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 650; color: var(--brass); margin-bottom: 12px; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); max-width: 16ch; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 600; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); }
.stats { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 40px; }
.stat b { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.stat span { color: var(--muted); font-size: .9rem; }

/* Route map */
.route { margin: 24px 0 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px 22px; box-shadow: var(--shadow); }
.route h2 { font-size: 1.4rem; margin-bottom: 4px; }
.route-line { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(8, 1fr); position: relative; }
.route-line::before {
  content: ""; position: absolute; left: 6%; right: 6%; top: 8px; height: 14px; opacity: .45;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 3px / 100% 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 9px / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 11px);
}
.route-line li { position: relative; text-align: center; padding: 0 4px; }
.route-line a { text-decoration: none; color: var(--ink); display: block; }
.route-line .dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 10px; background: var(--surface); border: 4px solid var(--accent); display: grid; place-items: center; font-size: .78rem; font-weight: 700; position: relative; }
.route-line li.done .dot { background: var(--accent); color: var(--accent-ink); }
.route-line .label { font-size: .86rem; font-weight: 600; line-height: 1.3; display: block; }
.route-line .sub { font-size: .76rem; color: var(--muted); }
@media (max-width: 860px) {
  .route-line { grid-template-columns: 1fr; gap: 14px; }
  .route-line::before {
    left: 8px; right: auto; top: 6px; bottom: 6px; width: 14px; height: auto;
    background:
      linear-gradient(var(--ink), var(--ink)) 3px 0 / 2px 100% no-repeat,
      linear-gradient(var(--ink), var(--ink)) 9px 0 / 2px 100% no-repeat,
      repeating-linear-gradient(180deg, var(--ink) 0 3px, transparent 3px 11px);
  }
  .route-line li { text-align: left; }
  .route-line a { display: flex; align-items: center; gap: 12px; }
  .route-line .dot { margin: 0; flex: none; }
}

/* Layout */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; padding: 40px 16px 80px; }
.toc { position: sticky; top: 84px; align-self: start; font-size: .92rem; }
.toc h3 { font-family: var(--font-body); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.toc ol { list-style: none; margin: 0 0 20px; padding: 0; }
.toc li a { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.toc li a:hover { background: var(--surface-2); }
.toc li a.active { background: var(--accent-soft); font-weight: 600; }
.toc .n { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; font-size: .7rem; font-weight: 700; flex: none; }
.toc li.done .n { background: var(--accent); color: var(--accent-ink); }
.progress { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
@media (max-width: 980px) { .layout { grid-template-columns: minmax(0, 1fr); gap: 0; } .toc { display: none; } }

/* Chapters */
.chapter { padding: 8px 0 64px; margin-bottom: 56px; position: relative; }
/* section divider drawn as a length of track: two rails over sleepers */
.chapter::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px;
  background:
    linear-gradient(var(--rail), var(--rail)) 0 3px / 100% 2px no-repeat,
    linear-gradient(var(--rail), var(--rail)) 0 9px / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--rail) 0 3px, transparent 3px 13px);
  opacity: .8;
  -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
#about.chapter::after { display: none; }
.chapter-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: .9rem; }
.stop { background: var(--accent); color: var(--accent-ink); font: 600 .74rem/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px; border-radius: 6px; }
.chapter .lead { font-size: 1.12rem; max-width: 70ch; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin: 28px 0; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.panel ol, .panel ul { margin: 0; padding-left: 1.2em; }
.panel li { margin-bottom: .55em; }
.panel li::marker { color: var(--accent); font-weight: 700; }
.panel h4 { margin-bottom: .7em; }
.panel.warn { background: var(--warn-soft); border-color: transparent; }
.panel.warn h4 { color: var(--warn); }
.panel.tip { background: var(--brass-soft); border-color: transparent; }
.stack { display: grid; gap: 16px; align-content: start; }
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.chapter-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.done-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Video picks */
.section-label { display: flex; align-items: baseline; gap: 12px; margin: 36px 0 14px; }
.section-label h3 { margin: 0; }
.picks { display: grid; gap: 20px; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .vcard { grid-template-columns: 1fr; } }
.player { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.player button { all: unset; cursor: pointer; position: absolute; inset: 0; display: block; }
.player img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s, opacity .3s; }
.player button:hover img { transform: scale(1.03); opacity: .9; }
.player .play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.7); display: grid; place-items: center; color: #fff; }
.player button:focus-visible .play { outline: 3px solid #fff; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .channel-tile { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; background: linear-gradient(135deg, #1d5a3e, #0f2f21); padding: 20px; text-decoration: none; font-family: var(--font-display); font-size: 1.3rem; }
.vbody { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.vbody h4 { font-size: 1.05rem; line-height: 1.35; margin: 0; }
.vbody .by { color: var(--muted); font-size: .9rem; margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px; border-radius: 999px; align-self: flex-start; }
.badge.our-pick { background: var(--accent); color: var(--accent-ink); }
.badge.good-alternative { background: var(--accent-soft); color: var(--accent); }
.badge.deep-dive { background: var(--brass-soft); color: var(--brass); }
.badge.quick-answer, .badge.inspiration-only { background: var(--surface-2); color: var(--ink); }
.badge.pending { background: var(--surface-2); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .76rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.why { font-size: .93rem; margin: 0; }
.why b { color: var(--ink); }
.caution { font-size: .86rem; color: var(--warn); margin: 0; }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 14px; font-size: .74rem; color: var(--muted); margin-top: 4px; }
.score .meter { height: 5px; border-radius: 9px; background: var(--surface-2); margin-top: 3px; overflow: hidden; }
.score .meter i { display: block; height: 100%; background: var(--accent); }
.vfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.overall { font-family: var(--font-display); font-size: 1.5rem; font-weight: 650; line-height: 1; }
.overall small { font-family: var(--font-body); font-size: .75rem; color: var(--muted); font-weight: 500; margin-left: 4px; }
.watch-toggle { font: inherit; font-size: .82rem; font-weight: 600; background: none; border: 1px solid var(--line); color: var(--ink); padding: 6px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.watch-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.yt-link { font-size: .82rem; font-weight: 600; }

/* Compact cards */
.more { margin-top: 20px; }
.more summary { cursor: pointer; font-weight: 650; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "+"; font-size: 1.3rem; color: var(--muted); }
.more[open] summary::after { content: "–"; }
.more .note { font-size: .88rem; color: var(--muted); margin: 14px 2px; }
.subgroup h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.mini .vbody { padding: 12px 14px 14px; gap: 6px; flex: 1; }
.mini h4 { font-size: .92rem; font-family: var(--font-body); font-weight: 600; }
.mini .by { font-size: .82rem; }
.mini .vfoot { padding-top: 4px; }
.mini.watched .player img { opacity: .55; }

/* Library */
.library { padding: 64px 0; border-top: 1px solid var(--line); background: var(--surface-2); }
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; margin: 20px 0 8px; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } .filters .search { grid-column: 1 / -1; } }
.filters input, .filters select { font: inherit; font-size: .92rem; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.filter-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 20px; font-size: .9rem; color: var(--muted); }
.filter-row label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--ink); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* Glossary & about */
.glossary { columns: 2 320px; column-gap: 40px; }
.glossary div { break-inside: avoid; margin-bottom: 16px; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.about { padding: 64px 0; }
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .88rem; }
