:root {
  --paper: #f4efe4;
  --paper-deep: #ebe4d4;
  --sheet: #fbf8f1;
  --ink: #102117;
  --ink-soft: #2a3b30;
  --muted: #4c5e52;
  --rule: rgba(16, 33, 23, 0.16);
  --rule-strong: rgba(16, 33, 23, 0.72);
  --ball: #e4ff5a;
  --ball-deep: #c9e21f;
  --hard: #245f86;
  --pad: clamp(20px, 4vw, 56px);
  --max: 1280px;
  --serif: "Instrument Serif", Georgia, serif;
  --label: Syne, "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.06 0 0 0 0 0.13 0 0 0 0 0.09 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
::selection { background: var(--ball); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.button:focus-visible, button:focus-visible { outline-color: var(--ink); box-shadow: 0 0 0 5px var(--ball); }
.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;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 10px 14px;
  font-family: var(--label); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

.kicker {
  margin: 0;
  font-family: var(--label);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.num { font-family: var(--label); font-weight: 700; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }

/* Masthead */
.masthead {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 22px var(--pad) 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--rule-strong);
  box-shadow: 0 3px 0 -2px var(--rule-strong);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand span { font-family: var(--label); font-weight: 700; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; }
.mark { width: 46px; height: 26px; }
.mark rect, .mark line { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.issue { margin: 0; justify-self: center; color: var(--muted); font-size: 12px; text-align: center; }
.site-nav { display: flex; gap: 22px; }
.site-nav a {
  font-family: var(--label); font-weight: 700; font-size: 12px; letter-spacing: 0.16em;
  text-transform: uppercase; text-decoration: none; padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--rule-strong); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--ink); }

main { display: block; }
section { width: min(var(--max), 100%); margin: 0 auto; padding-inline: var(--pad); }

/* Buttons and links */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin: 30px 0 0; }
.button, button.save, .finder button {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 12px 20px;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: 0;
  font-family: var(--label); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.button span { color: var(--ball); transition: transform 0.25s var(--ease); }
.button:hover { background: #1d3426; }
.button:hover span { transform: translateX(4px); }
.text-link {
  font-family: var(--label); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; border-bottom: 2px solid var(--ball-deep); padding-bottom: 3px;
}
.text-link:hover { border-bottom-color: var(--ink); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px;
  align-items: center;
  padding-top: clamp(36px, 7vw, 96px);
  padding-bottom: clamp(36px, 6vw, 80px);
  overflow: hidden;
}
.hero h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(64px, 10.5vw, 148px);
  line-height: 0.84;
  letter-spacing: -0.045em;
}
.hero h1 em { font-style: italic; position: relative; white-space: nowrap; }
.hero h1 em::after {
  content: ""; position: absolute; left: 0.02em; right: 0.06em; bottom: 0.2em; height: 0.2em;
  background: var(--ball); z-index: -1; transform-origin: left;
}
.pitch { max-width: 50ch; margin: 28px 0 0; font-size: 16px; line-height: 1.6; color: var(--ink-soft); }
.hero-court { margin: 0; justify-self: center; width: min(100%, 380px); }
.hero-court svg { display: block; width: 100%; height: auto; transform: rotate(-9deg); overflow: visible; }
.hero-court .draw { fill: none; stroke: var(--ink); stroke-width: 0.16; stroke-linecap: square; }
.hero-court .net { stroke-width: 0.34; }
.hero-court .ball { fill: var(--ball); stroke: var(--ink); stroke-width: 0.14; }
.hero-court figcaption { margin-top: 18px; text-align: center; color: var(--muted); font-size: 12px; }

/* Section heads */
.section-head { display: grid; gap: 10px; padding-top: 22px; border-top: 1px solid var(--rule-strong); }
.section-head h2, .featured h2, .tour-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

/* Scale */
.scale { padding-top: clamp(28px, 5vw, 64px); padding-bottom: clamp(36px, 6vw, 80px); }
.stats {
  list-style: none; margin: 34px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}
.stats li { padding: 22px 22px 6px 0; }
.stats li + li { padding-left: 22px; border-left: 1px solid var(--rule); }
.stats b {
  display: block;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, 5.4vw, 80px); line-height: 0.9; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.stats span { display: block; margin-top: 12px; color: var(--muted); font-size: 13px; max-width: 20ch; }
.pitch-note { max-width: 74ch; margin: 30px 0 0; color: var(--ink-soft); }

/* Featured */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  padding-top: clamp(36px, 6vw, 80px);
  padding-bottom: clamp(36px, 6vw, 80px);
  border-top: 1px solid var(--rule-strong);
  background: linear-gradient(var(--sheet), var(--sheet)) no-repeat 0 0 / 100% 100%;
}
.featured h2 { margin-top: 14px; }
.premise { max-width: 52ch; margin: 18px 0 0; font-size: 15px; color: var(--ink-soft); }

/* Figures and charts */
.figure { margin: 0; }
.map { position: relative; cursor: crosshair; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.map svg { display: block; width: 100%; height: auto; overflow: visible; }
.map .sel-ring { transform-box: fill-box; transform-origin: center; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.load-error { padding: 40px 0; color: var(--muted); }

/* Readout */
.readout { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--rule); }
.readout h3 {
  margin: 8px 0 0;
  font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3vw, 40px); line-height: 1; letter-spacing: -0.02em;
}
.facts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
.facts li { padding: 6px 0; border-bottom: 1px dotted var(--rule); font-size: 13px; }

/* Atlas */
.atlas { padding-top: clamp(36px, 6vw, 80px); padding-bottom: clamp(36px, 6vw, 80px); }
.atlas-tours { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 56px); margin-top: 36px; }
.atlas h3 {
  margin: 0 0 6px; font-family: var(--label); font-weight: 700; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
}
.atlas h3 span { color: var(--muted); margin-left: 8px; }
.atlas-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.atlas-list a {
  display: grid; grid-template-columns: 44px 1fr auto; grid-template-rows: auto auto; column-gap: 12px;
  padding: 18px 4px 18px 0; border-bottom: 1px solid var(--rule); text-decoration: none;
  transition: background-color 0.25s var(--ease), padding 0.25s var(--ease);
}
.atlas-list a::after { content: "→"; grid-column: 3; grid-row: 1 / span 2; align-self: center; color: var(--muted); transition: transform 0.25s var(--ease), color 0.25s var(--ease); }
.atlas-list .num { grid-row: 1 / span 2; padding-top: 6px; font-size: 12px; color: var(--muted); }
.atlas-list b { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.05; letter-spacing: -0.015em; }
.atlas-list .blurb { color: var(--muted); font-size: 13px; margin-top: 4px; }
.atlas-list a:hover { background: var(--sheet); padding-left: 10px; }
.atlas-list a:hover::after { transform: translateX(4px); color: var(--ink); }
.atlas-list a:hover .num { color: var(--ink); }
.wta .num { color: var(--hard); }

/* Later */
.later { padding-top: 22px; padding-bottom: clamp(36px, 6vw, 72px); border-top: 1px solid var(--rule-strong); }
.later ul { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 40px; }
.later li { display: flex; align-items: baseline; gap: 12px; }
.later b { font-family: var(--serif); font-weight: 400; font-size: 32px; color: var(--ink-soft); }
.tag {
  font-family: var(--label); font-weight: 700; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  border: 1px solid var(--rule-strong); padding: 3px 7px;
}

/* Footer */
.footer {
  width: min(var(--max), 100%); margin: 0 auto; padding: 26px var(--pad) 56px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 40px;
  border-top: 1px solid var(--rule-strong);
}
.credit { max-width: 70ch; margin: 0; color: var(--ink-soft); }
.credit a { text-decoration-color: var(--ball-deep); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Charts page */
.charts-page .desk {
  width: min(var(--max), 100%); margin: 0 auto; padding-inline: var(--pad);
  display: grid; grid-template-columns: 252px minmax(0, 1fr); column-gap: clamp(32px, 4vw, 64px);
  grid-template-areas: "opener opener" "rail stream";
}
.charts-page { --max: 1440px; }
.opener { grid-area: opener; width: auto; margin: 0; padding: clamp(32px, 6vw, 80px) 0 clamp(28px, 4vw, 48px); }
.opener h1 {
  margin: 16px 0 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(56px, 8.5vw, 124px); line-height: 0.86; letter-spacing: -0.045em; max-width: 12ch;
}
.opener h1 em { font-style: italic; }
.opener .pitch { max-width: 60ch; }
.rail {
  grid-area: rail; align-self: start; position: sticky; top: 0;
  max-height: 100vh; overflow-y: auto; padding: 24px 2px 32px 0;
  scrollbar-width: thin;
}
.stream { grid-area: stream; min-width: 0; }

.finder { margin: 0; }
.finder label { display: block; }
.finder .line { display: flex; margin-top: 10px; border: 1px solid var(--rule-strong); background: var(--sheet); }
.finder input {
  flex: 1; min-width: 0; min-height: 46px; padding: 10px 12px;
  background: transparent; color: var(--ink); border: 0; border-radius: 0; font: inherit; font-size: 14px;
}
.finder input:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.finder button { min-height: 46px; padding: 10px 14px; }
.finder-note { min-height: 1.5em; margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.toc { margin-top: 26px; }
.toc h2 {
  margin: 22px 0 8px; font-family: var(--label); font-weight: 700; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-soft);
}
.toc h2:first-child { margin-top: 0; }
.toc > div + div { margin-top: 22px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.toc a {
  position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 6px; align-items: baseline;
  padding: 9px 8px 9px 10px; border-bottom: 1px solid var(--rule); text-decoration: none; font-size: 13px;
  transition: background-color 0.2s var(--ease);
}
.toc a::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink);
  transform: scaleY(0); transition: transform 0.3s var(--ease);
}
.toc a .num { font-size: 11px; color: var(--muted); }
.toc a:hover { background: var(--sheet); }
.toc a[aria-current="true"] { background: var(--sheet); font-weight: 500; }
.toc a[aria-current="true"]::before { transform: scaleY(1); }
.toc a[aria-current="true"] .num { color: var(--ink); }
.toc .wta a .num { color: var(--hard); }

.tour { width: auto; margin: 0; padding: 0; }
.tour-head { padding: 26px 0 8px; border-top: 3px solid var(--ink); }
.tour-head h2 span { font-style: italic; color: var(--muted); }
.tour-head p { max-width: 70ch; margin: 14px 0 0; color: var(--ink-soft); }
.tour + .tour { margin-top: 48px; }

.chapter {
  min-height: min(100vh, 1100px);
  padding: clamp(36px, 5vw, 72px) 0;
  border-bottom: 1px solid var(--rule-strong);
  scroll-margin-top: 0;
}
.chapter-no { display: flex; gap: 14px; align-items: baseline; }
.chapter-no .num { font-size: 13px; }
.chapter[data-tour="wta"] .chapter-no .num { color: var(--hard); }
.chapter h2 {
  margin: 10px 0 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, 6vw, 84px); line-height: 0.9; letter-spacing: -0.035em;
}
.chapter .premise { font-size: 16px; }
.chapter-body {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 28px;
}
.chapter .figure .map { max-width: min(100%, 82vh); }
.chapter-notes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px 40px; align-content: start; }
.chapter-notes .readout { margin-top: 0; }
.chapter .actions { margin-top: 18px; }
.status { color: var(--muted); font-size: 12px; min-height: 1.2em; }
button.save:disabled { opacity: 0.5; cursor: progress; }
.method { padding-top: 16px; border-top: 1px solid var(--rule); }
.method > p { margin: 10px 0 0; color: var(--ink-soft); }
.method dl { margin: 12px 0 0; }
.method dt { margin-top: 12px; font-family: var(--label); font-weight: 700; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }
.method dd { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }

@media (min-width: 1280px) {
  .chapter-body { grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; }
  .chapter-notes { grid-template-columns: minmax(0, 1fr); }
}

/* Motion */
.will-reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.will-reveal.is-in { opacity: 1; transform: none; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ring { from { opacity: 0; transform: scale(2.2); } to { opacity: 1; transform: scale(1); } }
@keyframes settle { from { opacity: 0.35; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  html.smooth { scroll-behavior: smooth; }
  .hero-copy > *, .opener > * { animation: rise 0.8s var(--ease) both; }
  .hero-copy > :nth-child(2), .opener > :nth-child(2) { animation-delay: 0.08s; }
  .hero-copy > :nth-child(3), .opener > :nth-child(3) { animation-delay: 0.16s; }
  .hero-copy > :nth-child(4) { animation-delay: 0.24s; }
  .hero h1 em::after { animation: underline 0.9s 0.5s var(--ease) both; }
  .hero-court .draw { stroke-dasharray: 1 1; animation: draw 1.4s 0.2s var(--ease) both; }
  .hero-court .draw:nth-of-type(n+2) { animation-delay: 0.45s; }
  .hero-court .draw:nth-of-type(n+4) { animation-delay: 0.7s; }
  .hero-court .draw.net { animation-delay: 0.95s; }
  .hero-court .ball { transform-box: fill-box; transform-origin: center; animation: pop 0.6s 1.4s var(--ease) both; }
  .map .sel-ring { animation: ring 0.45s var(--ease) both; }
  .pulse { animation: settle 0.4s var(--ease) both; }
}

/* Tablet */
@media (max-width: 1079px) {
  .charts-page .desk { grid-template-columns: minmax(0, 1fr); grid-template-areas: "opener" "rail" "stream"; }
  .rail { position: static; max-height: none; overflow: visible; padding: 0 0 36px; }
  .toc { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
  .toc > div + div { margin-top: 0; }
}
@media (max-width: 900px) {
  .masthead { grid-template-columns: 1fr auto; }
  .issue { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-court { width: min(70%, 300px); justify-self: end; margin-top: -10px; }
  .featured { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .featured-copy { display: contents; }
  .featured-figure { order: 1; margin-top: 28px; }
  .featured .readout { order: 2; }
  .featured .actions { order: 3; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .atlas-tours { grid-template-columns: minmax(0, 1fr); }
}

/* Phone */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .masthead { padding-top: 16px; gap: 12px; }
  .brand span { font-size: 11px; letter-spacing: 0.12em; }
  .mark { width: 38px; height: 22px; }
  .site-nav { gap: 16px; }
  .hero { padding-top: 28px; }
  .hero h1 { font-size: clamp(56px, 17vw, 84px); }
  .pitch { font-size: 15px; }
  .hero-court { width: 62%; }
  .stats li { padding-right: 12px; }
  .stats li + li { padding-left: 12px; }
  .stats b { font-size: clamp(36px, 11vw, 52px); }
  .figure { margin-inline: calc(-1 * var(--pad)); }
  .figure .hint { padding-inline: var(--pad); }
  .chapter-notes { grid-template-columns: minmax(0, 1fr); }
  .chapter h2 { font-size: clamp(40px, 12vw, 56px); }
  .toc { grid-template-columns: minmax(0, 1fr); }
  .toc > div + div { margin-top: 22px; }
  .atlas-list b { font-size: 24px; }
  .footer { flex-direction: column; }
}
