:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #16140f;
  --muted: #6b665c;
  --line: #e6e2d9;
  --accent: #ff5a1f;
  --accent-ink: #ffffff;
  --accent-soft: #fff0e8;
  --good: #12a150;
  --star: #8a5a00;
  --beginner: #e7f6ec;
  --beginner-ink: #146c3a;
  --intermediate: #e8f0ff;
  --intermediate-ink: #2346a8;
  --advanced: #f6e8ff;
  --advanced-ink: #6b2aa3;
  --shadow: none;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0d0b;
    --surface: #17150f;
    --surface-2: #201d16;
    --ink: #f4f1ea;
    --muted: #a39d90;
    --line: #2c2820;
    --accent: #ff6a33;
    --accent-soft: #2c1a10;
    --star: #c98a00;
    --beginner: #12291b;
    --beginner-ink: #7ddc9f;
    --intermediate: #141f38;
    --intermediate-ink: #9db8ff;
    --advanced: #24163a;
    --advanced-ink: #d2a6ff;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0d0b;
  --surface: #17150f;
  --surface-2: #201d16;
  --ink: #f4f1ea;
  --muted: #a39d90;
  --line: #2c2820;
  --accent: #ff6a33;
  --accent-soft: #2c1a10;
  --star: #c98a00;
  --beginner: #12291b;
  --beginner-ink: #7ddc9f;
  --intermediate: #141f38;
  --intermediate-ink: #9db8ff;
  --advanced: #24163a;
  --advanced-ink: #d2a6ff;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }
a { color: inherit; }

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

main, .topbar, .footer { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.muted { color: var(--muted); }
.rm-hero p.muted a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.topbar nav { display: flex; align-items: center; gap: 10px; }
.star-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.star-btn svg { width: 15px; height: 15px; fill: #ffb000; }
.theme-toggle {
  width: 36px; height: 36px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 16px; line-height: 1;
}
.theme-toggle::before { content: "☾"; }
:root[data-theme="dark"] .theme-toggle::before { content: "☀"; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle::before { content: "☀"; } }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; align-items: center; padding: 64px 0 48px; }
h1 { font-size: clamp(32px, 4.6vw, 50px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 18px; font-weight: 700; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 28px; max-width: 560px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.resume { display: flex; flex-direction: column; gap: 2px; max-width: 560px; margin: 0 0 24px; padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.resume[hidden] { display: none; }
.resume:hover { border-color: var(--ink); border-left-color: var(--accent); }
.resume-kicker { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.resume-title { font-size: 18px; }
.resume-title::after { content: " →"; color: var(--accent); }
.resume-meta { font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; padding: 11px 18px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 600; font-size: 15px;
}
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn:hover { border-color: var(--ink); }
.facts { margin: 22px 0 0; font-size: 14px; }
.peek {
  display: block; padding: 6px 18px 10px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.peek:hover { border-color: var(--ink); }
.peek-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.peek-head strong { font-size: 15px; }
.peek ol { list-style: none; margin: 0; padding: 0; }
.peek li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.peek li:last-child { border-bottom: 0; }
.peek img { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; flex: none; background: var(--surface-2); }
.peek-title { flex: 1; font-weight: 600; font-size: 15px; line-height: 1.3; }
.peek-dur { font-size: 13px; white-space: nowrap; }

/* Sections */
.section { padding: 40px 0; }
.section h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.section-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.search input {
  width: min(360px, 100%); padding: 11px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
}
.search { flex: 1 1 260px; display: flex; justify-content: flex-end; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] .muted { color: inherit; opacity: .75; }
.recent { margin: -6px 0 20px; font-size: 14px; }
.recent a { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.recent a:hover { text-decoration-thickness: 2px; }

/* Roadmap cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.card[hidden], .empty[hidden] { display: none; }
.card:hover { border-color: var(--ink); }
.mosaic { position: relative; display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; aspect-ratio: 16 / 7; background: var(--line); }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.mosaic img:first-child { grid-row: span 2; }
.num {
  position: absolute; left: 12px; top: 12px; padding: 2px 10px; border-radius: 8px;
  background: rgba(14, 13, 11, .78); color: #fff; font-weight: 800; font-size: 14px;
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 10px 0 4px; font-size: 20px; letter-spacing: -.015em; }
.card p { margin: 0 0 14px; color: var(--muted); font-size: 15px; flex: 1; }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; }
.pill { padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.level-beginner { background: var(--beginner); color: var(--beginner-ink); }
.level-intermediate { background: var(--intermediate); color: var(--intermediate-ink); }
.level-advanced { background: var(--advanced); color: var(--advanced-ink); }
.pill.new { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.pill.new[hidden] { display: none; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--good); border-radius: inherit; transition: width .3s ease; }
.progress.big { height: 10px; }
.progress-label { font-size: 13px; margin-top: 6px; min-height: 1.2em; }

/* Paths */
.paths { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 16px; }
.path { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.path h3 { margin: 0 0 10px; font-size: 16px; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.chain a { padding: 4px 10px; border-radius: 8px; background: var(--surface-2); text-decoration: none; font-weight: 500; }
.chain a:hover { color: var(--accent); }
.arrow { color: var(--muted); }
.chain .hop { display: inline-flex; align-items: center; gap: 6px; }

/* Repos */
.repos { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 16px; }
.repo {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.repo:hover { border-color: var(--accent); }
.repo-name { font-weight: 700; font-size: 15px; word-break: break-word; }
.repo-desc { color: var(--muted); font-size: 14px; flex: 1; }
.repo-stars { font-weight: 700; font-size: 14px; color: var(--star); }

.soon ul { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 16px 0 0; list-style: none; }
.soon li { padding: 8px 14px; border-radius: 999px; border: 1px dashed var(--line); color: var(--muted); font-weight: 500; }

/* Roadmap page */
.rm-hero { padding: 28px 0 24px; max-width: 820px; }
.back { display: inline-block; margin-bottom: 18px; text-decoration: none; font-weight: 500; }
.rm-hero h1 { margin-top: 14px; font-size: clamp(34px, 5vw, 54px); }
.rm-progress { margin-top: 24px; max-width: 520px; }
.rm-progress-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 14px; font-weight: 600; }
.reset { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; }

.continue { display: inline-block; margin-top: 12px; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #1a1208; font-size: 14px; font-weight: 600; text-decoration: none; }
.continue[hidden] { display: none; }
.continue:hover { filter: brightness(1.08); }
.step { scroll-margin-top: 80px; }
.steps { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 16px; counter-reset: step; }
.step {
  display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 22px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .2s ease, opacity .2s ease;
}
.step.is-done { border-color: var(--good); }
.step.is-done .thumb img { filter: grayscale(.6); opacity: .7; }
.thumb { position: relative; display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); align-self: start; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.thumb:hover img { transform: scale(1.04); }
.play {
  position: absolute; inset: 0; margin: auto; width: 56px; height: 40px; border-radius: 12px;
  background: rgba(14, 13, 11, .75); transition: background .2s ease;
}
.play::after {
  content: ""; position: absolute; left: 23px; top: 12px;
  border-left: 14px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent;
}
.thumb:hover .play { background: #ff0033; }
.dur {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 6px;
  background: rgba(14, 13, 11, .85); color: #fff; font-size: 12px; font-weight: 700;
}
.step-top { display: flex; justify-content: space-between; align-items: center; }
.step-num { font-size: 13px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.done { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 600; user-select: none; }
.done input { width: 20px; height: 20px; accent-color: var(--good); cursor: pointer; }
.step h3 { margin: 4px 0 6px; font-size: 21px; letter-spacing: -.015em; line-height: 1.25; }
.why { margin: 0 0 12px; }
.vtitle { font-weight: 600; font-size: 14px; text-decoration: none; display: inline-block; }
.vtitle:hover { color: var(--accent); text-decoration: underline; }
.channel { margin: 2px 0 12px; font-size: 14px; }
.repo-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 7px 12px; border-radius: 10px; background: var(--surface-2);
  text-decoration: none; font-size: 14px; font-weight: 600; word-break: break-all;
}
.repo-chip svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.repo-chip span { color: var(--star); white-space: nowrap; }
.repo-chip:hover { outline: 1px solid var(--accent); }

.build { margin: 40px 0 0; padding: 24px; border-radius: var(--radius); background: var(--accent-soft); }
.build h2 { margin: 0; font-size: 24px; }
.build ul { margin: 14px 0 0; padding-left: 20px; }
.build li { margin: 8px 0; }
.next {
  display: flex; flex-direction: column; gap: 2px; margin: 24px 0 0; padding: 20px 24px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-decoration: none;
}
.next strong { font-size: 20px; }
.next-wrap { margin: 24px 0 0; }
.next-wrap > p { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.next-wrap .next { margin: 8px 0 0; }
.next:hover { border-color: var(--accent); }
.more { margin: 40px 0 0; }
.more h2 { margin: 0 0 12px; font-size: 18px; }
.more-links { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.more-links a { padding: 6px 12px; border-radius: 8px; background: var(--surface-2); text-decoration: none; font-weight: 500; }
.more-links a:hover { color: var(--accent); }

/* FAQ */
.faq details { max-width: 760px; border-bottom: 1px solid var(--line); }
.faq summary { padding: 16px 0; font-weight: 600; cursor: pointer; }
.faq summary:hover { color: var(--accent); }
.faq details p { margin: 0 0 16px; color: var(--muted); }

.notfound { padding: 80px 20px; text-align: center; }

.footer { padding: 48px 20px 40px; margin-top: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer p { margin: 4px 0; }

@media (max-width: 720px) {
  .step { grid-template-columns: 1fr; gap: 14px; }
  .star-btn { padding: 8px 12px; }
  .search { justify-content: stretch; }
  .search input { width: 100%; }
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 32px; }
  .peek li { flex-wrap: wrap; row-gap: 0; }
  .peek-title { flex: 1 1 calc(100% - 120px); }
  .peek-dur { flex-basis: 100%; margin-left: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
