/* ==========================================================================
   DataDesk — editorial data publication
   Light/dark via [data-theme] + prefers-color-scheme. No framework, no build step.
   ========================================================================== */

/* ------------------------------- 1. tokens ------------------------------- */
:root {
  color-scheme: light;

  --ink: #0e1319;
  --ink-2: #2b3641;
  --muted: #5f6b78;
  --faint: #8b97a3;

  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-tint: #eef2f7;
  --line: #e5e9ef;
  --line-strong: #cfd7e1;

  --brand: #1a4fff;
  --brand-ink: #ffffff;
  --brand-soft: #edf2ff;
  --verify: #0a7d5a;
  --verify-soft: #e8f7f0;
  --warn-soft: #fff6e6;
  --warn-ink: #8a5a00;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(14, 19, 25, 0.05), 0 1px 3px rgba(14, 19, 25, 0.04);
  --shadow-2: 0 10px 30px -16px rgba(14, 19, 25, 0.24), 0 2px 8px rgba(14, 19, 25, 0.05);

  --font-sans: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont,
    Inter, Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
  --measure: 68ch;
  --gutter: 24px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9eef4;
  --ink-2: #c3cdd8;
  --muted: #93a0af;
  --faint: #75828f;

  --bg: #0b0f14;
  --bg-soft: #10161d;
  --bg-tint: #161e27;
  --line: #212b36;
  --line-strong: #31404f;

  --brand: #7ba1ff;
  --brand-ink: #08111f;
  --brand-soft: #16213a;
  --verify: #4dd3a4;
  --verify-soft: #0f2a22;
  --warn-soft: #2a2213;
  --warn-ink: #e8bb6a;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 14px 34px -18px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e9eef4;
    --ink-2: #c3cdd8;
    --muted: #93a0af;
    --faint: #75828f;
    --bg: #0b0f14;
    --bg-soft: #10161d;
    --bg-tint: #161e27;
    --line: #212b36;
    --line-strong: #31404f;
    --brand: #7ba1ff;
    --brand-ink: #08111f;
    --brand-soft: #16213a;
    --verify: #4dd3a4;
    --verify-soft: #0f2a22;
    --warn-soft: #2a2213;
    --warn-ink: #e8bb6a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 14px 34px -18px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.4);
  }
}

/* -------------------------------- 2. base -------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.65;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

a {
  color: var(--brand);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: var(--brand);
  color: var(--brand-ink);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--brand-ink);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main {
  display: block;
  padding: 0 0 96px;
}

/* ----------------------------- 3. typography ----------------------------- */
h1,
h2,
h3,
h4 {
  margin: 0 0 0.6em;
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.021em;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.2rem + 2.6vw, 3.05rem);
  letter-spacing: -0.032em;
}

h2 {
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.72rem);
}

h3 {
  font-size: 1.19rem;
}

h4 {
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1.15em;
}

strong {
  font-weight: 650;
  color: var(--ink);
}

small {
  font-size: 0.855rem;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.885em;
}

.eyebrow,
.kicker {
  margin: 0 0 10px;
  font-size: 0.735rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--line-strong);
}

/* ------------------------------- 4. buttons ------------------------------- */
.btn {
  --btn-bg: var(--bg);
  --btn-fg: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--btn-line);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.935rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}

.btn--primary {
  --btn-bg: var(--brand);
  --btn-fg: var(--brand-ink);
  --btn-line: transparent;
  box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--brand) 78%, black);
}

.btn--primary:hover {
  box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--brand) 82%, black);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-line: var(--line-strong);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-tint);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* -------------------------------- 5. header ------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header .bar {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 1.035rem;
  font-weight: 700;
  letter-spacing: -0.028em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-ink);
}

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

.nav a {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 550;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  color: var(--ink);
  background: var(--bg-soft);
  text-decoration: none;
}

.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--bg-tint);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

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

[data-theme="dark"] .theme-toggle .i-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-moon {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-toggle .i-sun {
    display: block;
  }
}

.read-progress {
  height: 2px;
  background: transparent;
}

.read-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transform-origin: 0 50%;
}

@supports (animation-timeline: scroll()) {
  .read-progress span {
    width: 100%;
    scale: 0 1;
    animation: grow-progress linear;
    animation-timeline: scroll(root block);
  }
}

@keyframes grow-progress {
  to {
    scale: 1 1;
  }
}

/* --------------------------------- 6. hero -------------------------------- */
.hero {
  padding: 76px 0 44px;
  border-bottom: 1px solid var(--line);
}

.hero-title {
  max-width: 16ch;
  margin-bottom: 18px;
  font-size: clamp(2.3rem, 1.3rem + 4vw, 4rem);
  line-height: 1.03;
  letter-spacing: -0.038em;
}

.hero-title .dim {
  color: var(--faint);
}

.hero-lede {
  max-width: 62ch;
  margin-bottom: 26px;
  color: var(--ink-2);
  font-size: 1.075rem;
  line-height: 1.62;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* -------------------------------- 7. stats -------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 34px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.stats > div {
  padding: 16px 18px;
  background: var(--bg);
}

.stats dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.stats dd {
  margin: 4px 0 0;
  font-size: 1.5rem;
  font-weight: 680;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stats dd.stat-date {
  font-size: 1.06rem;
  font-weight: 600;
  padding-top: 6px;
}

/* ------------------------------ 8. section ------------------------------- */
.section {
  padding: 52px 0 8px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0;
}

.section-head a {
  font-size: 0.9rem;
  font-weight: 600;
}

/* -------------------------------- 9. cards ------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

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

.card-link {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 20px;
  color: inherit;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: none;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-top time {
  font-size: 0.775rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.34;
  letter-spacing: -0.018em;
}

.card-desc {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.925rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.775rem;
  font-variant-numeric: tabular-nums;
}

.card-arrow {
  margin-left: auto;
  color: var(--brand);
  font-size: 1rem;
  transition: transform 0.16s ease;
}

.card:hover .card-arrow {
  transform: translateX(3px);
}

/* --------------------------- 10. machine entries -------------------------- */
.machine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.machine-grid a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--ink);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.machine-grid a:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

.machine-grid code {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand);
}

.machine-grid span {
  color: var(--muted);
  font-size: 0.855rem;
  line-height: 1.5;
}

/* -------------------------------- 11. article ---------------------------- */
.post {
  padding-top: 40px;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--faint);
}

.crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.crumbs li + li::before {
  content: "/";
  color: var(--line-strong);
}

.crumbs a {
  color: var(--muted);
}

.post-head {
  max-width: 74ch;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.post-sub {
  max-width: 66ch;
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 1.06rem;
  line-height: 1.6;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.855rem;
}

.post-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-strong);
}

.post-meta strong {
  font-weight: 600;
  color: var(--ink-2);
}

.post-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  padding-top: 30px;
}

.post-body {
  min-width: 0;
}

.post-rail {
  display: none;
}

@media (min-width: 1040px) {
  .post-grid {
    grid-template-columns: minmax(0, 1fr) 232px;
    gap: 56px;
  }
  .post-rail {
    display: block;
  }
}

/* ------------------------------ 12. answer card --------------------------- */
.answer-card {
  position: relative;
  max-width: 70ch;
  margin-bottom: 34px;
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--brand-soft), var(--bg) 62%);
}

.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.answer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--verify-soft);
  color: var(--verify);
  font-size: 0.715rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.answer-date {
  color: var(--faint);
  font-size: 0.755rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.answer-text {
  margin: 0;
  color: var(--ink);
  font-size: 1.105rem;
  line-height: 1.6;
  font-weight: 500;
}

.key-facts {
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px dashed var(--line-strong);
  list-style: none;
}

.key-facts li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  color: var(--ink-2);
  font-size: 0.945rem;
  line-height: 1.55;
}

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

.key-facts li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--brand);
}

.answer-foot {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

/* -------------------------------- 13. prose ------------------------------- */
.prose {
  font-size: 1.005rem;
  line-height: 1.72;
  color: var(--ink-2);
}

/* 阅读行宽：正文段落收窄，表格/代码/计算器占满整列（数据站常见排版） */
.prose > * {
  max-width: 70ch;
}

.prose > .table-wrap,
.prose > pre,
.prose > .calc {
  max-width: none;
}

.prose > h2 {
  margin: 2.4em 0 0.65em;
  padding-top: 0.2em;
  color: var(--ink);
}

.prose > h3 {
  margin: 1.9em 0 0.55em;
  color: var(--ink);
}

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

.prose p,
.prose li {
  color: var(--ink-2);
}

.prose ul,
.prose ol {
  margin: 0 0 1.2em;
  padding-left: 1.35em;
}

.prose li {
  margin-bottom: 0.42em;
}

.prose li::marker {
  color: var(--faint);
}

.prose a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--brand) 34%, transparent);
  text-decoration-thickness: 1.5px;
  transition: text-decoration-color 0.16s ease, background 0.16s ease;
}

.prose a:hover {
  text-decoration-color: var(--brand);
  background: var(--brand-soft);
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-style: normal;
}

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

.prose code {
  padding: 0.14em 0.4em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 0.86em;
  white-space: nowrap;
}

.prose pre {
  margin: 1.6em 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  white-space: pre;
}

.prose img {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.prose hr {
  margin: 2.6em 0;
}

/* tables */
.table-wrap {
  margin: 1.6em 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  background: var(--bg);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
}

.table-wrap th,
.table-wrap td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.table-wrap th {
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 0.755rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.table-wrap tbody tr:hover td {
  background: color-mix(in srgb, var(--bg-soft) 60%, transparent);
}

.table-wrap td {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* 内联计算器 / 表单 */
.calc {
  margin: 1.8em 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.calc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calc label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}

.calc input,
.calc select {
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.calc input:focus,
.calc select:focus {
  border-color: var(--brand);
  outline: none;
}

.calc output,
.calc .result {
  display: block;
  margin-top: 6px;
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* label 直接包 input 的写法：字段竖排、结果独占一行 */
.calc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px 20px;
  align-items: start;
}

.calc label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.755rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.calc label input,
.calc label select {
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0;
}

.calc-out {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.calc-out strong {
  margin-left: 6px;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------- 14. toc -------------------------------- */
.toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  font-size: 0.855rem;
}

.toc-title {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: block;
  padding: 5px 0 5px 12px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  line-height: 1.45;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-list a:hover {
  color: var(--ink);
  text-decoration: none;
}

.toc-list a.is-active {
  color: var(--brand);
  border-left-color: var(--brand);
  font-weight: 600;
}

.toc-l3 a {
  padding-left: 24px;
  font-size: 0.82rem;
}

.toc-top {
  display: inline-block;
  margin-top: 14px;
  color: var(--faint);
  font-size: 0.8rem;
}

.toc-inline {
  margin: 0 0 26px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 0.9rem;
}

.toc-inline summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
}

.toc-inline .toc-list {
  margin-top: 10px;
}

@media (min-width: 1040px) {
  .toc-inline {
    display: none;
  }
}

/* --------------------------------- 15. faq -------------------------------- */
.faq,
.sources,
.related,
.cite,
.author {
  max-width: 70ch;
  margin-top: 48px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.faq h2,
.sources h2,
.related h2 {
  font-size: 1.2rem;
  margin-bottom: 18px;
}

.faq-list {
  display: grid;
  gap: 8px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: border-color 0.16s ease;
}

.faq-item[open] {
  border-color: var(--line-strong);
  background: var(--bg-soft);
}

.faq-item summary {
  position: relative;
  padding: 13px 42px 13px 16px;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.965rem;
  font-weight: 600;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-a {
  padding: 0 16px 14px;
}

.faq-a p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.94rem;
  line-height: 1.65;
}

/* ------------------------------- 16. sources ------------------------------ */
.src-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: src;
  display: grid;
  gap: 10px;
}

.src-list li {
  position: relative;
  padding: 12px 16px 12px 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 0.9rem;
  line-height: 1.5;
  counter-increment: src;
}

.src-list li::before {
  content: counter(src);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.src-list a {
  font-weight: 600;
  word-break: break-word;
}

.src-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.83rem;
}

/* -------------------------------- 17. cite -------------------------------- */
.cite {
  padding: 18px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.cite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.cite-head .eyebrow {
  margin: 0;
}

.cite-body {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.845rem;
  line-height: 1.6;
  word-break: break-word;
}

.copy-btn {
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.copy-btn:hover {
  color: var(--brand);
  border-color: var(--brand);
}

/* -------------------------------- 18. author ------------------------------ */
.author {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.author-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 1.1rem;
  font-weight: 700;
}

.author-body {
  min-width: 0;
}

.author-body .eyebrow {
  margin-bottom: 4px;
}

.author-name {
  margin: 0 0 6px;
  color: var(--ink);
  font-weight: 650;
}

.author-name span {
  color: var(--muted);
  font-weight: 400;
}

.author-bio {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* -------------------------------- 19. related ----------------------------- */
.related-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--line);
}

.related-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  background: var(--bg);
  font-size: 0.935rem;
}

.related-list time {
  color: var(--faint);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ------------------------------- 20. ad slot ------------------------------ */
.ad-slot {
  position: relative;
  margin: 34px 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  min-height: 100px;
  text-align: center;
}

.ad-slot::before {
  content: "Advertisement";
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ------------------------------ 21. sample banner ------------------------- */
.sample-banner {
  display: block;
  margin: 0 0 26px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--warn-ink) 26%, transparent);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: 0.865rem;
  line-height: 1.6;
}

.sample-banner code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--warn-ink) 12%, transparent);
  font-size: 0.85em;
}

.sample-banner strong {
  color: inherit;
}

/* ----------------------------- 22. facts index ---------------------------- */
.page-head {
  padding: 56px 0 30px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin-bottom: 14px;
}

.page-head p {
  max-width: 68ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 1.04rem;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.facts-table code {
  white-space: nowrap;
}

.facts-table th:last-child,
.facts-table td:last-child {
  white-space: nowrap;
  width: 1%;
}

.section-lede {
  max-width: 66ch;
  margin: 0 0 20px;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.62;
}

.foot-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ------------------------------- 23. footer ------------------------------- */
.site-footer {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 46px 0 28px;
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr));
  gap: 34px;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand--foot {
  font-size: 0.98rem;
}

.foot-tagline {
  max-width: 34ch;
  margin: 12px 0 10px;
  color: var(--muted);
  font-size: 0.885rem;
  line-height: 1.6;
}

.foot-mail {
  margin: 0;
  font-size: 0.86rem;
}

.foot-col h2 {
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

.foot-col li {
  margin-bottom: 7px;
}

.foot-col a {
  color: var(--ink-2);
  font-size: 0.875rem;
}

.foot-col a:hover {
  color: var(--brand);
}

.foot-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 34px;
  width: 100%;
  max-width: var(--maxw);
  margin: 34px auto 0;
  padding: 18px var(--gutter) 0;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.79rem;
}

.foot-base p {
  margin: 0;
}

.foot-base p:last-child {
  max-width: 60ch;
}

/* ------------------------------ 24. responsive ---------------------------- */
@media (max-width: 860px) {
  .foot-grid {
    grid-template-columns: 1fr 1fr;
    gap: 26px;
  }
  .foot-about {
    grid-column: 1 / -1;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .hero {
    padding: 54px 0 34px;
  }
}

@media (max-width: 620px) {
  :root {
    --gutter: 18px;
  }
  body {
    font-size: 16px;
  }
  .site-header .bar {
    gap: 10px;
  }
  .nav {
    gap: 0;
  }
  .nav a {
    padding: 6px 8px;
    font-size: 0.845rem;
  }
  .brand-name {
    display: none;
  }
  .hero-title {
    max-width: none;
  }
  .answer-card {
    padding: 18px 16px 14px;
  }
  .answer-text {
    font-size: 1.03rem;
  }
  .post-meta {
    gap: 6px 12px;
    font-size: 0.8rem;
  }
  .related-list li {
    flex-direction: column;
    gap: 2px;
  }
  .card-foot span:nth-child(2) {
    display: none;
  }
}

/* ------------------------------ 25. motion/print -------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card:hover {
    transform: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .ad-slot,
  .cite,
  .toc,
  .toc-inline,
  .related {
    display: none !important;
  }
  body {
    font-size: 11pt;
    color: #000;
  }
  .post-grid {
    grid-template-columns: 1fr;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }
}
