:root {
  --paper: #f3efe4;
  --paper-deep: #e7dfcf;
  --ink: #172126;
  --ink-soft: #405055;
  --deep: #172b35;
  --blue: #3d717c;
  --blue-soft: #c6d8d8;
  --rust: #a84636;
  --rust-dark: #7f332a;
  --mustard: #d1a02d;
  --line: rgba(23, 33, 38, 0.19);
  --shadow: 0 18px 40px rgba(23, 33, 38, 0.11);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(rgba(23, 33, 38, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 33, 38, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: var(--sans);
  line-height: 1.58;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.34;
  background: radial-gradient(circle at 15% 5%, rgba(208, 160, 45, 0.2), transparent 28rem), radial-gradient(circle at 88% 45%, rgba(61, 113, 124, 0.12), transparent 24rem);
}

a { color: var(--rust-dark); text-underline-offset: 0.2em; }
a:hover { color: var(--blue); }

.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--paper);
  background: var(--deep);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible { outline: 3px solid var(--rust); outline-offset: 4px; }

.site-header {
  color: var(--paper);
  background: var(--deep);
  border-bottom: 5px solid var(--mustard);
}

.header-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
}

.brand-line, .site-nav, .footer-inner nav { display: flex; align-items: center; gap: 18px; }
.brand, .site-nav a, .footer-inner a { color: var(--paper); }
.brand { font-family: var(--serif); font-size: 1.22rem; text-decoration: none; }
.brand-note, .eyebrow, .ledger-label, .trend-label, .proof-label, .scope-note, .ledger-index { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.095em; }
.brand-note { color: var(--blue-soft); font-size: 0.66rem; }
.site-nav { flex-wrap: wrap; justify-content: flex-end; font-size: 0.78rem; }
.site-nav a { text-decoration: none; }
.language-link { padding: 8px 10px; border: 1px solid rgba(243, 239, 228, 0.45); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.7fr);
  gap: 46px;
  align-items: end;
  padding-top: 80px;
  padding-bottom: 58px;
}

.eyebrow { margin: 0 0 12px; color: var(--rust-dark); font-size: 0.68rem; font-weight: 700; }
.site-header .eyebrow { color: var(--blue-soft); }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 700; letter-spacing: -0.025em; }
h1 { max-width: 820px; font-size: clamp(3rem, 7vw, 6.8rem); line-height: 0.96; }
h2 { font-size: clamp(2rem, 4vw, 4rem); line-height: 1.03; }
h3 { font-size: 1.32rem; line-height: 1.14; }
.deck { max-width: 760px; margin: 30px 0 0; color: var(--ink-soft); font-size: clamp(1.08rem, 1.7vw, 1.35rem); }
.deck strong { color: var(--ink); }
.hero-proof { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; max-width: 850px; margin-top: 30px; padding: 14px 16px; color: var(--deep); background: rgba(209, 160, 45, 0.19); border-left: 5px solid var(--mustard); font-size: 0.82rem; }
.proof-label { color: var(--rust-dark); font-size: 0.64rem; font-weight: 700; }
.proof-separator { color: var(--rust); font-family: var(--mono); }
.reader-contract { padding: 24px; background: var(--deep); color: var(--paper); box-shadow: var(--shadow); transform: translateY(10px); }
.reader-contract p:not(.eyebrow) { margin: 0 0 20px; font-family: var(--serif); font-size: 1.28rem; line-height: 1.24; }
.text-link { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; font-weight: 700; }
.reader-contract .text-link, .light-link { color: var(--paper); }

.visual-section { margin-top: 12px; }
.ledger-figure { margin: 0; padding: clamp(20px, 4vw, 42px); background: rgba(247, 244, 237, 0.9); border: 1px solid var(--line); box-shadow: var(--shadow); }
.figure-heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 24px; }
.figure-heading h2 { font-size: clamp(2rem, 4vw, 3.6rem); }
.figure-heading h2 span { color: var(--rust); }
.figure-intro { max-width: 330px; margin: 0; color: var(--ink-soft); }
.control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 25px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.control-row label { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; }
select { min-width: 150px; min-height: 2.75rem; padding: 8px 34px 8px 12px; color: var(--paper); background: var(--deep); border: 2px solid var(--deep); border-radius: 0; font: inherit; font-weight: 700; }
.scope-note { color: var(--ink-soft); font-size: 0.67rem; }
.ledger-grid { display: grid; grid-template-columns: 1fr 42px 1fr 42px 1fr; align-items: stretch; gap: 0; }
.ledger-cell { min-height: 245px; padding: 20px; border: 1px solid var(--line); border-right: 0; background: var(--paper); }
.ledger-cell:last-child { border-right: 1px solid var(--line); }
.ledger-ideal { border-top: 8px solid var(--blue); }
.ledger-intended { border-top: 8px solid var(--mustard); }
.ledger-actual { border-top: 8px solid var(--rust); }
.ledger-index { display: block; color: var(--ink-soft); font-size: 0.65rem; }
.ledger-label { display: block; margin-top: 27px; color: var(--ink-soft); font-size: 0.78rem; font-weight: 700; }
.ledger-value { display: block; margin-top: 8px; font-size: clamp(3rem, 6vw, 5.5rem); line-height: 0.92; letter-spacing: -0.06em; }
.ledger-unit { display: block; margin-top: 8px; color: var(--ink-soft); font-family: var(--mono); font-size: 0.75rem; }
.ledger-cell p { max-width: 160px; margin: 28px 0 0; color: var(--ink-soft); font-size: 0.86rem; line-height: 1.3; }
.ledger-arrow { display: grid; place-items: center; color: var(--rust); background: var(--paper-deep); font-size: 1.6rem; }
.gap-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.gap-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 14px 16px; background: var(--paper-deep); font-family: var(--mono); font-size: 0.78rem; }
.gap-row strong { color: var(--blue); font-size: 1.25rem; }
.gap-row-emphasis { background: rgba(168, 70, 54, 0.13); }
.gap-row-emphasis strong { color: var(--rust-dark); }
progress { width: 100%; height: 9px; grid-column: 1 / -1; accent-color: var(--blue); }
.gap-row-emphasis progress { accent-color: var(--rust); }
.figure-summary { max-width: 820px; margin: 22px 0 0; font-family: var(--serif); font-size: 1.25rem; line-height: 1.3; }
.source-line, .section-note, .archive-note { color: var(--ink-soft); font-size: 0.86rem; }
.source-line { margin: 20px 0 0; }

.narrative-section { padding-top: 104px; }
.section-lede { max-width: 800px; margin: 22px 0 0; color: var(--ink-soft); font-size: 1.13rem; }
.answer-grid, .definition-grid, .trend-grid, .context-grid, .method-grid { display: grid; gap: 18px; margin-top: 34px; }
.answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.answer-card { position: relative; min-height: 220px; padding: 28px; border: 1px solid var(--line); }
.answer-card-muted { background: rgba(61, 113, 124, 0.09); }
.answer-card-hot { background: rgba(168, 70, 54, 0.11); border-color: rgba(168, 70, 54, 0.4); }
.card-number { color: var(--rust); font-family: var(--mono); font-weight: 700; }
.answer-card h3 { margin-top: 22px; }
.answer-card strong { display: block; margin-top: 18px; font-family: var(--mono); font-size: 2.8rem; line-height: 1; }
.answer-card p { max-width: 420px; margin: 16px 0 0; color: var(--ink-soft); }
.boundary-note { margin-top: 26px; padding: 18px 20px; border-left: 5px solid var(--rust); background: rgba(168, 70, 54, 0.08); color: var(--ink-soft); }
.boundary-note strong { color: var(--rust-dark); }
.definition-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.definition-card { min-height: 245px; padding: 24px; background: var(--deep); color: var(--paper); }
.definition-card .ledger-label { color: var(--mustard); }
.definition-card h3 { margin-top: 25px; color: var(--paper); }
.definition-card p { margin-bottom: 0; color: var(--blue-soft); }
.section-note { max-width: 780px; margin: 20px 0 0; }
.table-wrap { margin-top: 30px; overflow-x: auto; border: 1px solid var(--line); background: rgba(247, 244, 237, 0.85); }
table { width: 100%; min-width: 740px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { padding: 16px; color: var(--ink-soft); text-align: left; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.03em; }
th, td { padding: 15px 16px; border-top: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--ink-soft); font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; }
tbody th { font-family: var(--serif); font-size: 1.1rem; }
tbody tr:first-child th, tbody tr:first-child td { border-top: 3px solid var(--mustard); }
.trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.trend-card { padding: 27px; border-top: 8px solid var(--blue); background: rgba(61, 113, 124, 0.1); }
.trend-card-hot { border-top-color: var(--rust); background: rgba(168, 70, 54, 0.1); }
.trend-label { color: var(--ink-soft); font-size: 0.68rem; }
.trend-card strong { display: block; margin-top: 25px; font-family: var(--mono); font-size: clamp(2.3rem, 5vw, 4.5rem); letter-spacing: -0.08em; }
.trend-card p { margin-bottom: 0; color: var(--ink-soft); }
.context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.context-card { padding: 28px; background: rgba(209, 160, 45, 0.14); border: 1px solid rgba(209, 160, 45, 0.55); }
.context-card-dark { color: var(--paper); background: var(--deep); border-color: var(--deep); }
.context-card .ledger-label { color: var(--rust-dark); }
.context-card-dark .ledger-label { color: var(--mustard); }
.context-card strong { display: block; margin-top: 18px; font-family: var(--mono); font-size: 2.45rem; line-height: 1; }
.context-card p { max-width: 500px; color: var(--ink-soft); }
.context-card-dark p { color: var(--blue-soft); }
.context-card .text-link { margin-top: 12px; }
.small-copy { font-size: 0.88rem; }
.method-section { padding-bottom: 20px; }
.method-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.formula-card { padding: 22px; border: 1px solid var(--line); background: var(--paper-deep); }
.formula-card span, .formula-card small { display: block; color: var(--ink-soft); font-family: var(--mono); font-size: 0.7rem; }
.formula-card strong { display: block; margin: 20px 0; font-family: var(--mono); font-size: 1.28rem; }
.method-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 30px; margin: 30px 0 0; border-top: 1px solid var(--line); }
.method-list div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.method-list dt { color: var(--rust-dark); font-family: var(--mono); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.method-list dd { margin: 0; color: var(--ink-soft); }
.source-section { display: grid; grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.2fr); gap: 40px; align-items: start; margin-top: 104px; padding: 34px 0 88px; border-top: 5px solid var(--deep); }
.source-list { margin: 0; padding-left: 1.4rem; }
.source-list li { margin-bottom: 16px; padding-left: 8px; color: var(--ink-soft); }
.source-list strong { color: var(--ink); }
.archive-note { grid-column: 2; margin: -6px 0 0; }
code { padding: 2px 5px; background: var(--paper-deep); font-family: var(--mono); font-size: 0.9em; }
.site-footer { color: var(--paper); background: var(--deep); border-top: 5px solid var(--mustard); }
.footer-inner { min-height: 100px; }
.footer-inner p { margin: 0; color: var(--blue-soft); }
.footer-inner nav { font-size: 0.82rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 54px; }
  .reader-contract { transform: none; }
  .figure-heading, .source-section { display: block; }
  .figure-intro { margin-top: 18px; }
  .definition-grid, .context-grid, .method-grid { grid-template-columns: 1fr; }
  .archive-note { margin-top: 24px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1180px); }
  .header-inner, .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 13px; padding: 18px 0; }
  .site-nav { justify-content: flex-start; gap: 10px 14px; }
  .hero { padding-bottom: 36px; }
  h1 { font-size: clamp(2.8rem, 15vw, 4.4rem); }
  h2 { font-size: clamp(2rem, 11vw, 3.1rem); }
  .hero-proof { display: block; }
  .hero-proof > * { margin-right: 8px; }
  .proof-separator { display: none; }
  .ledger-figure { padding: 18px 14px; }
  .ledger-grid { grid-template-columns: 1fr; }
  .ledger-cell { min-height: 192px; border-right: 1px solid var(--line); border-bottom: 0; }
  .ledger-cell:last-child { border-bottom: 1px solid var(--line); }
  .ledger-arrow { min-height: 34px; }
  .ledger-label { margin-top: 14px; }
  .ledger-cell p { margin-top: 16px; }
  .gap-ledger, .answer-grid, .trend-grid { grid-template-columns: 1fr; }
  .gap-row { grid-template-columns: 1fr auto; }
  .method-list { grid-template-columns: 1fr; }
  .method-list div { grid-template-columns: 90px 1fr; }
  .source-section { margin-top: 72px; padding-bottom: 62px; }
  .footer-inner nav { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media print {
  body { background: white; }
  .site-header, .site-footer, .reader-contract, .control-row { display: none; }
  .shell { width: 100%; }
  .narrative-section, .source-section { padding-top: 30px; margin-top: 0; }
}
