/* ==========================================================================
   活得更好 · Live Better — design system
   Warm paper light theme / deep ink dark theme
   ========================================================================== */

:root {
  --bg: #faf6ef;
  --bg-soft: #f3ebdd;
  --surface: #ffffff;
  --surface-2: #f6f0e5;
  --ink: #241f18;
  --ink-2: #4a4238;
  --muted: #6e6557;
  --line: #e7dccb;
  --line-strong: #d6c7b0;
  --accent: #bd5734;
  --accent-ink: #8f3d20;
  --accent-soft: #f7e2d7;
  --sage: #5f8468;
  --sage-soft: #e3eee5;
  --gold: #c9922f;
  --gold-soft: #f8eed6;
  --shadow-sm: 0 1px 2px rgba(66, 48, 24, 0.06);
  --shadow-md: 0 2px 4px rgba(66, 48, 24, 0.05), 0 14px 34px -16px rgba(66, 48, 24, 0.22);
  --shadow-lg: 0 30px 70px -40px rgba(66, 48, 24, 0.45);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #14120e;
  --bg-soft: #1b1813;
  --surface: #1e1b16;
  --surface-2: #262219;
  --ink: #f4ecdf;
  --ink-2: #d6cbb9;
  --muted: #a29786;
  --line: #322c23;
  --line-strong: #443b2e;
  --accent: #e88a62;
  --accent-ink: #f2a583;
  --accent-soft: #33231b;
  --sage: #8fb497;
  --sage-soft: #1f2b22;
  --gold: #e0b45f;
  --gold-soft: #2c2517;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.35), 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -40px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 500px at 12% -8%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(900px 480px at 92% 4%, color-mix(in srgb, var(--sage) 10%, transparent), transparent 72%);
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

::selection {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

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

/* ------------------------------- layout --------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

main {
  position: relative;
  z-index: 1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  z-index: 200;
}

.skip-link:focus {
  left: 0;
}

/* ------------------------------- topbar --------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, background 0.25s;
}

.topbar.is-stuck {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.topbar__inner {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--gold) 70%, var(--accent)));
  color: #fff8ee;
  box-shadow: var(--shadow-sm);
}

.brand__mark svg {
  width: 18px;
  height: 18px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__name {
  font-size: 16px;
}

.brand__sub {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav a.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--ink-2);
  transition: transform 0.18s, background 0.2s, border-color 0.2s, color 0.2s;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  color: var(--ink);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.lang-switch button {
  border: 0;
  background: transparent;
  padding: 5px 9px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--ink);
}

[data-theme="dark"] .icon-sun,
[data-theme="light"] .icon-moon {
  display: none;
}

.menu-btn {
  display: none;
}

/* ------------------------------- hero ----------------------------------- */

.hero {
  padding: 68px 0 56px;
  position: relative;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
}

.eyebrow__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

h1,
.hero h1 {
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin: 22px 0 0;
  font-weight: 800;
}

.hero h1 .hl {
  position: relative;
  white-space: nowrap;
  z-index: 0;
  isolation: isolate;
}

.hero h1 .hl::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0.08em;
  height: 0.32em;
  background: color-mix(in srgb, var(--gold) 45%, transparent);
  border-radius: 4px;
  z-index: -1;
}

.lede {
  font-size: 18px;
  line-height: 1.72;
  color: var(--ink-2);
  margin: 20px 0 0;
  max-width: 34em;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 650;
  border: 1px solid transparent;
  background: var(--ink);
  color: var(--bg);
  transition: transform 0.18s, box-shadow 0.2s, background 0.2s;
  box-shadow: var(--shadow-md);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.btn--ghost:hover {
  border-color: var(--line-strong);
}

.hero__art {
  position: relative;
}

.hero__art svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hero__note {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  font-size: 13.5px;
  color: var(--muted);
}

.hero__note span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hero__note svg {
  width: 15px;
  height: 15px;
  color: var(--sage);
}

/* ------------------------------- sections -------------------------------- */

.section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}

.section--flush {
  border-top: 0;
}

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
  flex-wrap: wrap;
}

.section__head h2 {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0;
  font-weight: 750;
}

.section__head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 40em;
}

.section__link {
  font-size: 14px;
  color: var(--accent-ink);
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.section__link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}

.section__link:hover svg {
  transform: translateX(3px);
}

/* ------------------------------ stat strip ------------------------------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 46px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
}

.stat__value {
  font-size: 26px;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.stat__label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ----------------------------- chapter grid ------------------------------ */

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 4px 4px 14px;
  max-width: 340px;
  box-shadow: var(--shadow-sm);
}

.search-row svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.search-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 9px 0;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
}

.search-row input::placeholder {
  color: var(--muted);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.chapter-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s, box-shadow 0.24s, border-color 0.24s;
  overflow: hidden;
}

.chapter-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}

.chapter-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.chapter-card:hover::after {
  transform: scaleX(1);
}

.chapter-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chapter-card__num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.chapter-card__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--accent);
}

.chapter-card__icon svg {
  width: 19px;
  height: 19px;
}

.chapter-card h3 {
  margin: 0;
  font-size: 18.5px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.chapter-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.62;
  color: var(--muted);
}

.chapter-card__meta {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}

.chip svg {
  width: 12px;
  height: 12px;
}

/* ------------------------------ leverage list ---------------------------- */

.leverage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 40px;
  align-items: start;
}

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.ledger li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.ledger__idx {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  padding-top: 4px;
  font-weight: 700;
}

.ledger strong {
  display: block;
  font-size: 16px;
  font-weight: 660;
  line-height: 1.45;
}

.ledger span {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.leverage__aside {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 96px;
}

.leverage__aside h3 {
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.leverage__aside p {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
}

.mini-ring {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
}

.mini-ring small {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.mini-bars {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.mini-bar__head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 5px;
}

.mini-bar__head b {
  font-weight: 650;
  color: var(--muted);
  font-size: 12.5px;
}

.mini-bar__track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.mini-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  transform-origin: left;
  animation: grow 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }
}

/* -------------------------------- quote ---------------------------------- */

.quote-band {
  padding: 72px 0;
  border-top: 1px solid var(--line);
}

.quote-band blockquote {
  margin: 0 auto;
  max-width: 760px;
  text-align: center;
}

.quote-band p {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.5;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 18px;
  text-wrap: balance;
}

.quote-band cite {
  font-style: normal;
  font-size: 13.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* -------------------------------- footer --------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 40px;
  margin-top: 0;
}

.footer__grid {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.footer p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.8;
  max-width: 46em;
}

.footer__links {
  display: flex;
  gap: 18px;
  font-size: 13.5px;
  flex-wrap: wrap;
}

.footer__links a {
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
}

.footer__links a:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
}

.footer__note {
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--muted);
  opacity: 0.85;
}

/* ================================ READER ================================= */

.reader-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  z-index: 100;
  transition: width 0.1s linear;
}

.reader {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 208px;
  gap: 52px;
  align-items: start;
  padding: 40px 0 90px;
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
}

.side-group {
  margin-bottom: 22px;
}

.side-group__title {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
  padding-left: 12px;
}

.side-link {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  border-left: 2px solid transparent;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.side-link:hover {
  background: var(--surface);
  color: var(--ink);
}

.side-link.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  border-left-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.side-link__num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  padding-top: 2px;
  flex-shrink: 0;
}

.side-link.is-active .side-link__num {
  color: var(--accent);
}

.article {
  min-width: 0;
  max-width: 760px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.breadcrumb a:hover {
  color: var(--accent-ink);
}

.breadcrumb svg {
  width: 13px;
  height: 13px;
  opacity: 0.6;
}

.chapter-head {
  position: relative;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.chapter-head__num {
  position: absolute;
  right: 0;
  top: -22px;
  font-size: 96px;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--ink);
  opacity: 0.055;
  line-height: 1;
  pointer-events: none;
  font-family: var(--font-mono);
}

.chapter-head h1 {
  font-size: clamp(30px, 4.2vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.035em;
  margin: 16px 0 0;
  font-weight: 800;
  position: relative;
}

.chapter-head .lede {
  font-size: 17.5px;
  margin-top: 16px;
}

.chapter-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.chapter-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chapter-meta svg {
  width: 14px;
  height: 14px;
}

.takeaway {
  margin: 0 0 34px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--sage) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--sage) 26%, var(--line));
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.takeaway svg {
  width: 20px;
  height: 20px;
  color: var(--sage);
  margin-top: 3px;
}

.takeaway p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink);
  font-weight: 550;
}

/* ------------------------------ prose blocks ----------------------------- */

.prose h2 {
  font-size: clamp(22px, 2.6vw, 27px);
  line-height: 1.35;
  letter-spacing: -0.025em;
  margin: 52px 0 16px;
  font-weight: 750;
  scroll-margin-top: 96px;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  font-size: 18.5px;
  margin: 32px 0 10px;
  letter-spacing: -0.01em;
}

.prose p {
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: 16.5px;
  line-height: 1.82;
}

.prose strong {
  color: var(--ink);
  font-weight: 680;
}

.prose a {
  color: var(--accent-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Only plain lists get prose bullets. Component lists (.checklist, .flow, ...)
   keep their own layout — their ::before markers are absolutely positioned,
   so letting these rules through would collapse them into a single grid column. */
.prose > ul:not(.checklist),
.prose > ol:not(.flow) {
  margin: 0 0 22px;
  padding-left: 0;
  list-style: none;
}

.prose > ol:not(.flow) {
  counter-reset: step;
}

.prose > ul:not(.checklist) > li,
.prose > ol:not(.flow) > li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.78;
}

.prose > ul:not(.checklist) > li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
}

.prose > ol:not(.flow) > li {
  counter-increment: step;
  padding-left: 34px;
}

.prose > ol:not(.flow) > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.prose > ul:not(.checklist) > li strong,
.prose > ol:not(.flow) > li strong {
  color: var(--ink);
}

/* tip / action box */

.tipbox {
  margin: 30px 0;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  padding: 22px 24px;
}

.tipbox__head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 12px;
}

.tipbox__head svg {
  width: 16px;
  height: 16px;
}

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

.tipbox li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--ink-2);
}

.tipbox li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.68em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

.tipbox li:last-child {
  margin-bottom: 0;
}

.tipbox h3 {
  font-size: 17px;
  margin: 0 0 10px;
}

.tipbox ul {
  margin-bottom: 0;
}

.tipbox li:last-child {
  margin-bottom: 0;
}

/* myth box */

.mythbox {
  margin: 30px 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 22px 24px;
}

.mythbox__head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}

.mythbox__head svg {
  width: 16px;
  height: 16px;
}

.myth-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 12px 0;
  border-top: 1px dashed var(--line);
}

.myth-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.myth-item__bad {
  font-size: 14.5px;
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent);
}

.myth-item__good {
  font-size: 15.5px;
  color: var(--ink);
  line-height: 1.7;
}

.myth-item__good::before {
  content: "→ ";
  color: var(--sage);
  font-weight: 700;
}

/* quote */

.pull-quote {
  margin: 34px 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent);
}

.pull-quote p {
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink);
  font-weight: 550;
  margin: 0;
  letter-spacing: -0.01em;
}

.pull-quote cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
}

/* stat cards inside article */

.statcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 26px 0 30px;
}

.statcard {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.statcard__v {
  font-size: 27px;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--accent-ink);
}

.statcard__k {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* figure + chart */

.figure {
  margin: 34px 0;
  padding: 22px 22px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.figure__title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 4px;
}

.figure__sub {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 14px;
}

.figure svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.figure__cap {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.chart text {
  font-family: var(--font);
  fill: var(--muted);
  font-size: 11px;
}

/* SVG charts scale with the container, so on a phone the axis labels would
   drop to about 5px. Below the breakpoint, keep a readable minimum width and
   let the reader pan instead. */
@media (max-width: 720px) {
  .chart:not(.donut) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .chart:not(.donut) svg {
    min-width: 520px;
  }
}

.chart .label {
  fill: var(--ink-2);
  font-size: 11.5px;
}

.chart .value {
  fill: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
}

.chart .axis {
  stroke: var(--line);
  stroke-width: 1;
}

.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.8;
}

/* table */

.table-wrap {
  margin: 26px 0 30px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  min-width: 460px;
}

.prose th,
.prose td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.65;
}

.prose th {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
  white-space: nowrap;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose td:first-child {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

/* checklist */

.checklist {
  margin: 26px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.checklist li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 0;
  padding: 11px 14px;
  position: static;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.65;
  align-items: start;
  padding-left: 14px;
}

.checklist li::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  margin-top: 4px;
  display: block;
  position: static;
  background: transparent;
}

/* -------------------------------- toc rail ------------------------------- */

.toc-rail {
  position: sticky;
  top: 92px;
  font-size: 13px;
  padding-top: 6px;
}

.toc-rail__title {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}

.toc-rail a {
  display: block;
  padding: 6px 0 6px 12px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
  transition: color 0.18s, border-color 0.18s;
}

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

.toc-rail a.is-active {
  color: var(--accent-ink);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* -------------------------------- pager ---------------------------------- */

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 56px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.pager a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.pager a:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.pager__dir {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 7px;
}

.pager__dir svg {
  width: 13px;
  height: 13px;
}

.pager__title {
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.45;
  color: var(--ink);
}

.pager a.is-next {
  text-align: right;
}

.pager a.is-next .pager__dir {
  justify-content: flex-end;
}

.pager__spacer {
  display: block;
}

/* ------------------------------ mobile drawer ---------------------------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
}

.drawer.is-open {
  display: block;
}

.drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(24, 18, 10, 0.45);
  backdrop-filter: blur(2px);
  animation: fade 0.2s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.drawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(86vw, 330px);
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 18px 16px 40px;
  overflow-y: auto;
  animation: slide 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slide {
  from {
    transform: translateX(-100%);
  }
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ------------------------------- reveal ---------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ------------------------------ chart extras ----------------------------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend__item i,
.donut__legend i,
.rings__legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.donut {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}

.donut svg {
  width: 178px;
  max-width: 46%;
  flex-shrink: 0;
  margin: 0 auto;
}

.donut__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 190px;
  display: grid;
  gap: 9px;
  font-size: 13.5px;
}

.donut__legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  margin: 0;
  color: var(--ink-2);
}

.donut__legend li::before {
  display: none;
}

.donut__legend span {
  flex: 1;
  min-width: 0;
}

.donut__legend b {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.barchart {
  display: grid;
  gap: 15px;
  margin-top: 6px;
}

.barchart__row {
  display: grid;
  grid-template-columns: minmax(96px, 1.05fr) minmax(0, 2fr) 52px;
  gap: 12px;
  align-items: center;
}

.barchart__label {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.45;
}

.barchart__label span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.barchart__track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.barchart__fill {
  height: 100%;
  border-radius: 999px;
  opacity: 0.85;
}

.barchart__val {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.matrix {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.matrix__y {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.matrix__x {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.matrix__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  grid-template-areas: "q0 q1" "q2 q3";
}

.matrix__cell {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 15px;
  background: var(--surface-2);
}

.matrix__cell.is-good {
  background: color-mix(in srgb, var(--sage) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--sage) 32%, var(--line));
}

.matrix__cell.is-bad {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

.matrix__cell.is-warn {
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--gold) 30%, var(--line));
}

.matrix__t {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

.matrix__d {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.rings {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}

.rings__art {
  position: relative;
  width: 210px;
  height: 210px;
  flex-shrink: 0;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.rings__circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: currentColor;
  opacity: var(--op, 0.9);
}

.rings__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 210px;
  display: grid;
  gap: 14px;
}

.rings__legend li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  padding: 0;
  margin: 0;
  align-items: start;
}

.rings__legend li::before {
  display: none;
}

.rings__legend i {
  margin-top: 7px;
}

.rings__t {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}

.rings__d {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.flow {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 0;
  counter-reset: none;
}

.flow__step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  padding: 0 0 18px;
  margin: 0;
  position: relative;
}

.flow__step::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.flow__step:last-child::before {
  display: none;
}

.flow__num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  position: relative;
  z-index: 1;
}

.flow__t {
  margin: 3px 0 3px;
  font-size: 15px;
  font-weight: 680;
  color: var(--ink);
  line-height: 1.45;
}

.flow__d {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

.empty {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
}

[data-theme="dark"] .hero__art svg {
  filter: brightness(0.82) saturate(0.9);
}

@media (max-width: 720px) {
  .barchart__row {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 4px 10px;
  }

  .barchart__label {
    grid-column: 1;
  }

  .barchart__track {
    grid-column: 1;
    order: 3;
  }

  .barchart__val {
    grid-column: 2;
    grid-row: 1;
  }

  .rings,
  .donut {
    gap: 18px;
  }

  .rings__art {
    width: 160px;
    height: 160px;
  }
}

/* -------------------------------- sources -------------------------------- */

.refwrap {
  max-width: 840px;
  padding-top: 54px;
  padding-bottom: 90px;
}

.refwrap h1 {
  font-size: clamp(30px, 4.2vw, 44px);
  line-height: 1.2;
  letter-spacing: -0.035em;
  margin: 18px 0 0;
  font-weight: 800;
}

.refwrap .lede {
  margin-top: 16px;
}

.refgroup h2 {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 48px 0 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

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

.refs li {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 5px;
}

.refs li:last-child {
  border-bottom: 0;
}

.refs__title {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.5;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.refs__title a {
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
}

.refs__title a:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
}

.refs__note {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
  max-width: 46em;
}

.refs__kind {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
  white-space: nowrap;
}

.callout {
  margin: 40px 0 0;
  padding: 20px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sage);
  background: var(--surface);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.callout p {
  margin: 0 0 10px;
}

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

/* ------------------------------ responsive ------------------------------- */

@media (max-width: 1180px) {
  .reader {
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 40px;
  }

  .toc-rail {
    display: none;
  }

  .chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .hero {
    padding: 44px 0 40px;
  }

  .hero__grid {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .hero__art {
    order: -1;
  }

  .hero__art svg {
    max-height: 300px;
    object-fit: cover;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leverage {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .leverage__aside {
    position: static;
  }

  .nav {
    display: none;
  }

  .menu-btn {
    display: grid;
  }

  .reader {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 24px;
  }

  .sidebar {
    display: none;
  }

  .article {
    max-width: none;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .wrap {
    padding: 0 18px;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 46px 0;
  }

  .hero__note {
    gap: 8px 18px;
  }

  .btn {
    padding: 12px 18px;
    font-size: 14.5px;
  }

  .cta-row .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .chapter-head__num {
    font-size: 68px;
    top: -10px;
  }

  .prose h2 {
    margin-top: 40px;
  }

  .figure {
    padding: 16px 14px 12px;
    margin-left: -4px;
    margin-right: -4px;
  }

  .tipbox,
  .mythbox {
    padding: 18px 18px;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager a.is-next {
    text-align: left;
  }

  .pager a.is-next .pager__dir {
    justify-content: flex-start;
  }

  .stat-strip {
    gap: 10px;
  }

  .stat {
    padding: 14px;
  }

  .stat__value {
    font-size: 22px;
  }

  .footer__grid {
    flex-direction: column;
    gap: 22px;
  }
}

@media (max-width: 420px) {
  .brand__sub {
    display: none;
  }

  .tools {
    gap: 6px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .lang-switch button {
    padding: 5px 7px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc-rail,
  .pager,
  .reader-progress,
  .footer {
    display: none !important;
  }

  .reader {
    display: block;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  .prose h2 {
    page-break-after: avoid;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
