/* ============ Reset & tokens ============ */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #faf7f1;
  --surface: #ffffff;
  --ink: #242833;
  --muted: #6b7079;
  --line: #e7e1d7;
  --brand: #d97457;
  --shadow: 0 10px 30px rgba(52, 44, 33, .06);
  --radius: 18px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
svg { width: 100%; height: 100%; display: block; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  height: 72px; padding: 0 clamp(20px, 5vw, 72px);
  background: rgba(250, 247, 241, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; padding: 7px;
  background: var(--ink); color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: .01em; }
.brand-text small { font-size: 9px; letter-spacing: .18em; color: var(--muted); }
.topnav { display: flex; gap: 30px; margin-left: auto; }
.topnav a { font-size: 13px; color: var(--muted); transition: color .2s; }
.topnav a:hover { color: var(--brand); }
.topbar-meta { display: flex; gap: 8px; }
.pill { font-size: 11px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.pill.outline { border: 1px solid var(--line); color: var(--muted); }
.pill.solid { background: var(--ink); color: #fff; }

/* ============ Hero ============ */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 40px;
  padding: 92px clamp(20px, 5vw, 72px) 0;
  max-width: 1400px; margin: 0 auto;
}
.eyebrow { font-size: 11px; letter-spacing: .22em; color: var(--brand); font-weight: 700; margin: 0 0 18px; }
.hero h1 { font-size: clamp(38px, 5.2vw, 68px); line-height: 1.12; margin: 0 0 22px; letter-spacing: -.02em; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero-desc { max-width: 520px; color: var(--muted); font-size: 15px; margin: 0 0 28px; }
.hero-actions { display: flex; gap: 12px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; transition: transform .2s, background .2s; }
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.ghost { border: 1px solid var(--line); background: var(--surface); }
.hero-art { display: grid; place-items: center; min-height: 300px; }
.chart-card {
  position: relative; width: 100%; max-width: 420px; aspect-ratio: 1.25;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 36px 30px 26px;
  display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden;
}
.chart-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 85% 12%, rgba(217,116,87,.10), transparent 55%);
}
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 55%; position: relative; }
.chart-bars i { flex: 1; height: var(--h); background: linear-gradient(180deg, var(--brand), #e8a98f); border-radius: 5px 5px 0 0; opacity: .85; }
.chart-line { position: absolute; left: 30px; right: 30px; top: 44px; height: 80px; color: #4f7c8a; }
.chart-caption { position: absolute; top: 18px; left: 30px; font-size: 10px; letter-spacing: .16em; color: var(--muted); }
.hero-stats {
  grid-column: 1 / -1;
  display: flex; gap: 0; margin-top: 36px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.hero-stats div { flex: 1; padding: 22px 0; display: flex; align-items: baseline; gap: 10px; }
.hero-stats div + div { border-left: 1px solid var(--line); padding-left: 28px; }
.hero-stats strong { font-size: 26px; letter-spacing: -.02em; }
.hero-stats span { font-size: 12px; color: var(--muted); }

/* ============ Layout ============ */
.layout {
  max-width: 1400px; margin: 0 auto;
  padding: 70px clamp(20px, 5vw, 72px) 90px;
  display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 56px;
  align-items: start;
}
.sidebar { position: sticky; top: 96px; }
.sidebar-title { font-size: 10px; letter-spacing: .2em; color: var(--muted); margin: 0 0 18px; font-weight: 700; }
.chapter-nav { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.chapter-nav a { display: flex; gap: 12px; align-items: center; padding: 9px 0 9px 18px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13px; color: var(--muted); transition: .2s; }
.chapter-nav a span { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .6; }
.chapter-nav a:hover, .chapter-nav a.active { color: var(--ink); border-left-color: var(--brand); font-weight: 600; }
.sidebar-note { margin-top: 26px; padding: 14px; background: #f1ece3; border-radius: 12px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.sidebar-note .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-right: 6px; }

.chapter-list { display: flex; flex-direction: column; gap: 22px; }
.chapter {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px 34px 24px;
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.chapter::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--brand)); }
.chapter:hover { transform: translateY(-3px); box-shadow: 0 16px 38px rgba(52, 44, 33, .10); }
.chapter-head { display: flex; align-items: flex-start; gap: 18px; }
.chapter-no { font-size: 40px; line-height: 1; font-weight: 800; letter-spacing: -.04em; color: var(--accent, var(--brand)); font-variant-numeric: tabular-nums; }
.chapter-heading { flex: 1; }
.chapter-kicker { margin: 2px 0 6px; font-size: 10px; letter-spacing: .16em; color: var(--muted); font-weight: 700; }
.chapter-heading h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.chapter-icon { width: 40px; height: 40px; padding: 8px; border-radius: 11px; color: var(--accent, var(--brand)); background: color-mix(in srgb, var(--accent, var(--brand)) 12%, transparent); flex-shrink: 0; }
.chapter-desc { margin: 16px 0 20px; font-size: 13px; color: var(--muted); max-width: 680px; }

/* sub-links */
.sublinks { display: flex; flex-wrap: wrap; gap: 9px; }
.sublinks a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px; font-size: 12px;
  background: color-mix(in srgb, var(--accent, var(--brand)) 8%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent, var(--brand)) 22%, #fff);
  color: var(--ink); transition: .2s;
}
.sublinks a span { font-size: 11px; color: var(--accent, var(--brand)); transition: transform .2s; }
.sublinks a:hover { background: var(--accent, var(--brand)); border-color: var(--accent, var(--brand)); color: #fff; transform: translateY(-2px); }
.sublinks a:hover span { color: #fff; transform: translate(2px, -2px); }
.chapter-foot { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted); }
.status.ok { color: var(--accent, var(--brand)); font-weight: 600; }

/* intro chapter */
.chapter.intro { background: #f3eee5; }
.chapter.intro .chapter-desc { margin-bottom: 0; }

/* guide */
.guide { margin-top: 18px; padding: 32px 34px; border: 1px dashed #d5cbbc; border-radius: var(--radius); }
.guide h2 { font-size: 18px; margin: 0 0 22px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.guide-grid strong { display: block; font-size: 22px; color: var(--brand); margin-bottom: 6px; }
.guide-grid p { margin: 0; font-size: 12px; color: var(--muted); }
.guide-grid code { background: #f1ece3; padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* footer */
.footer { display: flex; justify-content: space-between; padding: 24px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .topnav { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 60px; }
  .hero-art { min-height: 240px; order: -1; }
  .chart-card { max-width: 360px; }
  .layout { grid-template-columns: 1fr; gap: 32px; }
  .sidebar { position: static; }
  .chapter-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 16px; border-left: 0; }
  .chapter-nav a { border-left: 0; padding-left: 12px; }
  .guide-grid { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 600px) {
  .topbar-meta .pill.outline { display: none; }
  .hero h1 { font-size: 36px; }
  .hero-stats div { flex-direction: column; gap: 2px; }
  .hero-stats div + div { padding-left: 14px; }
  .chapter { padding: 24px 20px 20px; }
  .chapter-no { font-size: 32px; }
  .chapter-icon { display: none; }
  .chapter-nav { grid-template-columns: 1fr; }
}
