:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f8;
  --text: #1a1a1a;
  --text-muted: #5c5c66;
  --border: #e6e6ea;
  --accent: #2563eb;
  --accent-soft: #eef2ff;
  --code-bg: #0f1117;
  --code-text: #e8e8ec;
  --card: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  --max: 1080px;
  --radius: 14px;
}

html[data-theme="dark"] {
  --bg: #0d0e12;
  --bg-alt: #14161c;
  --text: #ececed;
  --text-muted: #9a9aa6;
  --border: #24262e;
  --accent: #6b8cff;
  --accent-soft: #1a1f33;
  --code-bg: #04060b;
  --code-text: #e8e8ec;
  --card: #14161c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

code, pre { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---------- Theme image swap ---------- */
.theme-img.dark { display: none; }
html[data-theme="dark"] .theme-img.light { display: none; }
html[data-theme="dark"] .theme-img.dark { display: block; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1.4rem; }
.nav-links a { color: var(--text-muted); font-size: 0.92rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-gh {
  border: 1px solid var(--border);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 32px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero-inner { max-width: 46rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.6rem;
}
.hero h1 {
  font-size: 4.2rem;
  line-height: 1;
  margin: 0 0 1rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.hero h1 .accent { color: var(--accent); }
.tagline { font-size: 1.4rem; font-weight: 500; margin: 0 0 1rem; letter-spacing: -0.01em; }
.tagline em { font-style: italic; color: var(--accent); }
.lede { color: var(--text-muted); font-size: 1.02rem; margin: 0 auto 1.8rem; max-width: 36rem; }
.hero-buttons { display: flex; gap: 0.8rem; margin-bottom: 1.4rem; justify-content: center; }
.hero-meta { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-ghost { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }

.hero-figure { margin: 2.8rem 0 0; width: 100%; }
.hero-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  padding: 1rem;
}
figcaption {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.7rem;
}

/* ---------- Sections ---------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
  border-top: 1px solid var(--border);
}
.section h2 {
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.6rem;
}
.section-lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 44rem;
  margin: 0 0 2rem;
}
.note {
  margin-top: 2rem;
  padding: 1rem 1.2rem;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text-muted);
}
.note strong { color: var(--text); }

/* ---------- Cards ---------- */
.cards-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.info-card h3 { margin: 0 0 0.6rem; font-size: 1.15rem; }
.info-card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Modules ---------- */
.module {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 2.2rem 0;
  border-bottom: 1px solid var(--border);
}
.module:last-of-type { border-bottom: none; }
.module-reverse .module-text { order: 2; }
.module-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}
.module-text h3 {
  font-size: 1.7rem;
  margin: 0.2rem 0 0.2rem;
  letter-spacing: -0.02em;
}
.module-sub { font-weight: 600; color: var(--text); margin: 0 0 0.7rem; font-size: 0.98rem; }
.module-text p { color: var(--text-muted); margin: 0 0 1.1rem; }
.module-links { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: "JetBrains Mono", monospace;
}
.pill:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.pill-alt { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.module-figure { margin: 0; }
.module-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
}

/* Two-figure stacked layout */
.module-figures {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.module-figures figure {
  margin: 0;
}
.module-figures figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
}
.module-figures figcaption {
  margin-top: 0.35rem;
}

/* ---------- Code ---------- */
.code-block {
  background: var(--code-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #9a9aa6;
  font-size: 0.78rem;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.code-block pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
}
.code-block code { color: var(--code-text); font-size: 0.88rem; line-height: 1.7; }
.copy-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #cfcfd6;
  border: none;
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.16); }

/* ---------- Roadmap ---------- */
.roadmap {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}
.roadmap li {
  position: relative;
  padding: 1rem 1.2rem 1rem 2.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: 0.95rem;
}
.roadmap li strong { color: var(--text); }
.roadmap li::before {
  content: "→";
  position: absolute;
  left: 1.1rem;
  top: 1rem;
  color: var(--accent);
  font-weight: 700;
}

.start-grid { margin-top: 1.5rem; }
.info-card .mini {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0 0 0.9rem;
  overflow-x: auto;
}
.info-card .mini code { color: var(--code-text); font-size: 0.82rem; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-brand { font-weight: 700; font-size: 1.1rem; margin: 0 0 0.2rem; }
.footer-brand span { color: var(--accent); }
.footer-muted { color: var(--text-muted); font-size: 0.88rem; margin: 0; }
.footer-links { display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: center; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.footer-links a:hover { color: var(--text); text-decoration: none; }
.footer-credit {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 3rem;
    gap: 2rem;
  }
  .hero h1 { font-size: 3.2rem; }
  .module { grid-template-columns: 1fr; gap: 1.4rem; }
  .module-reverse .module-text { order: 0; }
  .cards-2 { grid-template-columns: 1fr; }
  .nav-links { gap: 0.9rem; }
  .nav-links a:not(.nav-gh) { display: none; }
}
