:root {
  --paper: #f4f0e8;
  --ink: #171a1b;
  --muted: #686b67;
  --line: #c9c5ba;
  --accent: #ef5b49;
  --deep: #183229;
  --display: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  --sans: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 50; padding: .7rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }
.masthead {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  height: 4.5rem;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid color-mix(in srgb, var(--ink), transparent 70%);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.masthead-meta { color: var(--muted); }
.language-switch { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.language-switch button { border: 0; padding: .5rem .25rem; background: transparent; color: var(--muted); font: inherit; font-weight: 800; letter-spacing: .12em; cursor: pointer; }
.language-switch button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: .3rem; }
.language-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hero {
  min-height: auto;
  padding: clamp(9rem, 15vw, 13rem) var(--gutter) clamp(5rem, 9vw, 8rem);
  display: block;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  width: 32rem;
  height: 32rem;
  left: -17rem;
  top: 15%;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 0 0 5rem rgba(23,26,27,.018), 0 0 0 10rem rgba(23,26,27,.012);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; max-width: 76rem; }
.eyebrow {
  margin: 0 0 1.1rem;
  font-size: .7rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
}
h1, h2 { font-family: var(--display); font-weight: 500; letter-spacing: -.035em; }
h1 { margin: 0; font-size: clamp(4rem, 7.4vw, 8.5rem); line-height: .82; }
h1 em { color: var(--accent); font-weight: 400; }
.dek { max-width: 30rem; margin: 2rem 0 0; font-size: clamp(1.05rem, 1.7vw, 1.35rem); line-height: 1.45; }

.chapter {
  padding: clamp(6rem, 11vw, 10rem) var(--gutter);
  display: grid;
  grid-template-columns: 4rem minmax(16rem, .58fr) minmax(25rem, 1.42fr);
  gap: 2rem 4vw;
  border-top: 1px solid var(--line);
  position: relative;
}
.chapter-number { font-family: var(--display); font-size: 1.15rem; color: var(--accent); }
.chapter-copy { max-width: 35rem; }
.chapter h2, .takeaway h2, .methods h2 { margin: 0 0 1.5rem; font-size: clamp(2.6rem, 4.7vw, 5.3rem); line-height: .98; }
.chapter-copy p:not(.eyebrow) { max-width: 31rem; }
.headline-pair { align-self: center; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; }
.headline-pair > div:not(.versus) { border-top: 1px solid var(--ink); padding-top: 1rem; }
.city-label { display: block; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.headline-pair strong { display: block; margin-top: .4rem; font-family: var(--display); font-size: clamp(3rem, 6vw, 7rem); font-weight: 500; line-height: 1; }
.headline-pair small { color: var(--muted); }
.versus { font-family: var(--display); font-size: 2rem; color: var(--accent); }
.margin-note { grid-column: 3; max-width: 27rem; display: flex; gap: .8rem; color: var(--muted); font-size: .82rem; }
.note-mark { color: var(--accent); font-size: 2rem; line-height: 1; }
.margin-note p { margin: 0; }

.dark-section { background: var(--deep); color: var(--paper); border-color: rgba(255,255,255,.18); }
.dark-section .chapter-copy { align-self: start; }
.dark-section .chapter-copy strong { color: #ff7868; }
.chart-figure { margin: 0; align-self: center; min-width: 0; }
.chart-figure.wide { grid-column: 3; margin-top: 0; align-self: center; }
.figure-kicker { padding-bottom: .75rem; border-bottom: 1px solid currentColor; font-size: .67rem; letter-spacing: .11em; text-transform: uppercase; }
.chart-figure figcaption { margin-top: 1rem; max-width: 54rem; color: var(--muted); font-size: .75rem; }
.dark-section .chart-figure figcaption { color: #b9c3bd; }
.svg-chart { width: 100%; min-height: 25rem; }
.svg-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.density-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid color-mix(in srgb, currentColor, transparent 65%); color: var(--muted); font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; }
.density-legend strong { margin-right: .3rem; color: currentColor; font-size: inherit; }
.density-legend span { display: inline-flex; align-items: center; gap: .28rem; white-space: nowrap; }
.density-legend i { width: .66rem; height: .66rem; border: 1px solid rgba(23,26,27,.16); border-radius: 50%; }
.dark-section .density-legend { color: #b9c3bd; }
.dark-section .density-legend i { border-color: rgba(255,255,255,.25); }

.distribution-chart { padding: 2rem 0 0; }
.distribution-city { display: grid; grid-template-columns: 7rem 1fr; gap: .75rem 1.25rem; margin-bottom: 2.4rem; align-items: center; }
.distribution-city h3 { grid-row: 1 / span 2; margin: 0; font-family: var(--display); font-size: 1.6rem; font-weight: 500; }
.distribution-row { display: grid; grid-template-columns: 6.5rem 1fr; align-items: center; gap: .75rem; }
.distribution-label { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stack { height: clamp(2.8rem, 6vw, 4.5rem); display: flex; overflow: hidden; background: #ddd8cc; }
.segment { min-width: 0; position: relative; border-right: 1px solid rgba(244,240,232,.5); transition: filter .18s ease, transform .18s ease; }
.segment:focus, .segment:hover { filter: saturate(1.4) brightness(.92); outline: 2px solid var(--ink); outline-offset: -2px; z-index: 2; }
.segment span { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); font-size: .68rem; font-weight: 800; color: var(--ink); white-space: nowrap; }
.segment.dark span { color: white; }

.concentration-section { background: #e8e4da; }
.concentration-section .chapter-copy span { color: #b54237; }
.substory { grid-column: 2; margin-top: clamp(5rem, 9vw, 9rem); padding-top: 1.5rem; border-top: 1px solid var(--ink); }
.substory h3 { margin: 0 0 1.2rem; font-family: var(--display); font-size: clamp(2rem, 3.5vw, 3.8rem); font-weight: 500; line-height: 1.02; letter-spacing: -.03em; }
.substory + .chart-figure { margin-top: clamp(5rem, 9vw, 9rem); }
.extreme-section { background: #efe9df; }
.threshold-figure { align-self: center; }

.takeaway { padding: clamp(7rem, 13vw, 13rem) var(--gutter); background: var(--accent); color: var(--ink); }
.takeaway h2 { max-width: 75rem; font-size: clamp(3.2rem, 7vw, 8rem); }
.takeaway-lines { margin: 4rem 0 0 auto; max-width: 52rem; border-top: 1px solid var(--ink); }
.takeaway-lines p { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; margin: 0; padding: 1rem 0; border-bottom: 1px solid var(--ink); }
.takeaway-lines span { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.takeaway-lines b { font-weight: 400; }

.methods { padding: clamp(6rem, 10vw, 10rem) var(--gutter); display: grid; grid-template-columns: .8fr 1.2fr; gap: 4vw; }
.methods-copy { columns: 2; column-gap: 3rem; }
.methods-copy p { break-inside: avoid; margin-top: 0; font-size: .88rem; }
footer { padding: 3rem var(--gutter); background: var(--ink); color: #d8d4cc; font-size: .72rem; }
.source-block { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; }
.source-block span { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
footer p { max-width: 65rem; margin: 1.5rem 0 0; color: #8f918e; }

.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.75,.2,1); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.hero .reveal:nth-child(2) { transition-delay: .12s; }
.hero .reveal:nth-child(3) { transition-delay: .2s; }

@media (max-width: 900px) {
  .hero { padding-top: 8rem; }
  .chapter { grid-template-columns: 2.2rem 1fr; gap: 1.5rem; }
  .chapter-copy, .headline-pair, .chart-figure, .chart-figure.wide, .margin-note, .substory { grid-column: 2; }
  .chart-figure.wide { margin-top: 2rem; }
  .methods { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .masthead { position: absolute; }
  .masthead-meta { max-width: 12rem; line-height: 1.2; }
  .hero { min-height: auto; padding-bottom: 4.5rem; }
  h1 { font-size: clamp(3.8rem, 18vw, 6rem); }
  .chapter { padding-block: 5rem; grid-template-columns: 1fr; }
  .chapter-number { padding-bottom: .5rem; border-bottom: 1px solid currentColor; }
  .chapter-copy, .headline-pair, .chart-figure, .chart-figure.wide, .margin-note, .substory { grid-column: 1; }
  .headline-pair { gap: .6rem; }
  .headline-pair strong { font-size: 2.8rem; }
  .distribution-city { grid-template-columns: 1fr; }
  .distribution-city h3 { grid-row: auto; }
  .distribution-row { grid-template-columns: 4.8rem 1fr; }
  .substory { margin-top: 4rem; }
  .substory + .chart-figure { margin-top: 1rem; }
  .takeaway-lines p { grid-template-columns: 1fr; }
  .methods-copy { columns: 1; }
  .svg-chart { min-height: 20rem; }
  .threshold-figure .svg-chart { min-height: 0; }
  .svg-chart svg { min-width: 39rem; }
  .threshold-figure .svg-chart svg { min-width: 0; }
  .chart-figure { overflow-x: auto; overflow-y: hidden; padding-bottom: .4rem; }
  .density-legend { position: sticky; left: 0; width: calc(100vw - 2 * var(--gutter)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .segment { transition: none; }
}
