:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --placeholder: #e9e8e3;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --wi-blue: #002986; /* Wisconsin flag royal blue (usflags.design; statute names the colour only) */
  --seq-0: #f0efec; --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10); --accent: #3987e5; --placeholder: #2c2c2a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --wi-blue: #3557c4; /* flag blue lifted so it reads on a dark card */
    --seq-0: #383835; --seq-1: #104281; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #2a78d6; --seq-5: #5598e7; --seq-6: #9ec5f4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10); --accent: #3987e5; --placeholder: #2c2c2a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --wi-blue: #3557c4;
  --seq-0: #383835; --seq-1: #104281; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #2a78d6; --seq-5: #5598e7; --seq-6: #9ec5f4;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin: 4px 0 12px; letter-spacing: -0.01em; }
h2 { font-size: clamp(22px, 3vw, 28px); margin: 0 0 8px; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
h3 .sub { font-weight: 400; color: var(--muted); font-size: 13px; }
a { color: var(--accent); }
code { font-size: 0.9em; }

.hero { padding: 40px 0 24px; position: relative; }
.lede { color: var(--ink-2); max-width: 720px; margin: 0 0 20px; }
/* "In 1997, this week, ... was reading ..." under the title; a new pick on each visit */
.subtitle { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); margin: -4px 0 16px; min-height: 1.5em; }
/* short rule between the title block and the intro, same grey as the pull-quote line */
.rule { width: 64px; height: 3px; margin: 4px 0 20px; border: 0; border-radius: 2px; background: var(--ring); }
/* WPR's own line about the show, indented with a rule, between the two intro sentences */
.pull { margin: -8px 0 20px; padding: 2px 0 2px 16px; border-left: 3px solid var(--ring); max-width: 680px; }
.pull p { margin: 0; color: var(--ink-2); font-style: italic; }
.pull cite { display: block; margin-top: 2px; font-size: 14px; font-style: normal; color: var(--muted); }
.pull cite a { color: inherit; }
/* way back to the blog, small and quiet above the title */
.back { margin: 0 0 6px; font-size: 14px; letter-spacing: 0.02em; }
.back a { color: var(--ink-2); text-decoration: none; }
.back a:hover { color: var(--ink); text-decoration: underline; }
/* the donation ask between the last chart and About the data */
.thanks { text-align: center; font-size: 20px; font-weight: 600; margin: 48px 0 16px; }
.donate { margin: 8px 0 40px; padding: 18px 22px; border: 1px solid var(--ring); border-radius: 12px; background: var(--surface); }
.donate p { margin: 0; font-size: 17px; }
.theme-toggle {
  position: absolute; top: 16px; right: 16px; font: inherit; font-size: 13px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--ring); border-radius: 999px; padding: 4px 12px; cursor: pointer;
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 14px 16px; }
.tile .v { font-size: 30px; font-weight: 600; line-height: 1.1; }
.tile .l { color: var(--ink-2); font-size: 13px; }
.tiles.small { margin-bottom: 16px; }
.tiles.small .tile .v { font-size: 24px; }
button.tile { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.tile:hover { border-color: var(--accent); }
button.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.toc { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--ring); }
.toc .wrap { display: flex; gap: 16px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; white-space: nowrap;
  scrollbar-width: none; }
.toc .wrap::-webkit-scrollbar { display: none; }
.toc a { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 2px 0; flex: none; }
.toc a:hover { color: var(--ink); }
/* current section: colour + underline (not bold, so the bar doesn't shift) */
.toc a.active { color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
.toc .short { display: none; }
@media (max-width: 640px) { .toc .long { display: none; } .toc .short { display: inline; } }
/* fades at either edge when there's more to swipe to (.toc is sticky, so it anchors these) */
.toc::before, .toc::after { content: ""; position: absolute; top: 0; bottom: 0; width: 32px; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.toc::before { left: 0; background: linear-gradient(to left, transparent, var(--page)); }
.toc::after { right: 0; background: linear-gradient(to right, transparent, var(--page)); }
.toc.more-left::before, .toc.more-right::after { opacity: 1; }

section { padding: 40px 0 8px; scroll-margin-top: 48px; }
/* a small open book between the story sections; a mask so it takes the theme's color */
section + section::before { content: ""; display: block; width: 24px; height: 24px; margin: -8px auto 32px; background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 6.5C10.5 5 8 4.5 3 4.5v13c5 0 7.5.5 9 2 1.5-1.5 4-2 9-2v-13c-5 0-7.5.5-9 2z'/%3E%3Cpath d='M12 6.5v13'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 6.5C10.5 5 8 4.5 3 4.5v13c5 0 7.5.5 9 2 1.5-1.5 4-2 9-2v-13c-5 0-7.5.5-9 2z'/%3E%3Cpath d='M12 6.5v13'/%3E%3C/svg%3E") center / contain no-repeat; }
.finding { font-size: 17px; max-width: 820px; margin: 0 0 16px; }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.weeks-key .k { white-space: nowrap; margin-right: 12px; }
.weeks-key i { display: inline-block; width: 18px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: 0;
  background: color-mix(in srgb, var(--c) calc(var(--o) * 100%), transparent); }
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 12px; }
.seg-label { color: var(--muted); font-size: 13px; margin-right: 4px; }
.seg button { font: inherit; font-size: 13px; color: var(--ink-2); background: none; border: 1px solid var(--ring); border-radius: 999px;
  padding: 3px 11px; cursor: pointer; }
.seg button:hover { border-color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tiles-note { margin: -8px 0 16px; }
/* on phones the five top tiles wrap two to a row; the last one takes the whole row instead of sitting alone */
@media (max-width: 480px) { #tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 16px; margin-bottom: 16px; min-width: 0; }

.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.scroll-x { overflow-x: auto; }
.chart text { fill: var(--ink-2); font-size: 12px; }
.chart .axis path, .chart .axis line { stroke: var(--axis); }
.chart .axis text { fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); }
.chart .grid path { display: none; }
.chart .label-strong { fill: var(--ink); font-weight: 600; }
/* keyboard focus on chart marks: an outline, plus a stroke for browsers that don't outline SVG */
.chart [tabindex]:focus { outline: none; }
.chart [tabindex]:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; stroke: var(--ink); stroke-width: 2px; }
.chart .unit { fill: var(--muted); font-size: 11px; }

details { margin-top: 10px; font-size: 14px; }
summary { cursor: pointer; color: var(--ink-2); }
details table { border-collapse: collapse; width: 100%; font-size: 13px; }
.age-table { display: flex; flex-direction: column; align-items: center; gap: 20px; margin: 4px 0 8px; }
.age-table table.narrow { display: none; }
@media (max-width: 480px) { .age-table table.wide { display: none; } .age-table table.narrow { display: table; width: 100%; } .age-table table.narrow :is(th, td):first-child { width: 40%; } }
.age-table table { border-collapse: collapse; font-size: 15px; }
.age-table th, .age-table td { text-align: left; padding: 6px 20px 6px 0; border-bottom: 1px solid var(--grid); }
.age-table th { font-weight: 600; color: var(--ink-2); font-size: 13px; }
.age-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.age-table th:not(:first-child) { text-align: left; }
.age-table td { white-space: nowrap; }
.age-table td.bar-cell { font-variant-numeric: tabular-nums; }
.cell-bar { position: relative; display: inline-block; vertical-align: middle; width: 90px; height: 10px; margin-right: 8px;
  border-radius: 2px; background: var(--grid); overflow: hidden; }
.cell-bar i, .cell-bar b { position: absolute; top: 0; bottom: 0; left: 0; background: var(--c); }
.cell-bar i { width: var(--lo); }
.cell-bar b { left: var(--lo); width: calc(var(--hi) - var(--lo)); opacity: 0.35; }
@media (max-width: 480px) { .cell-bar { width: 56px; } .age-table th, .age-table td { padding-right: 12px; } }
details th, details td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--grid); }
details td.n { text-align: right; font-variant-numeric: tabular-nums; }
details > div { max-height: 320px; overflow: auto; margin-top: 8px; }

.lists ol { margin: 0; padding-left: 20px; font-size: 14px; }
.lists li { margin: 4px 0; }
.lists .meta { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search], .filters select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--ring); border-radius: 8px; padding: 6px 10px; min-width: 0;
}
.filters input[type=search] { flex: 1 1 200px; }
.finding sup { font-size: 0.7em; line-height: 0; }
.finding sup a, .footnote > a:first-child { text-decoration: none; }
.footnote > a:first-child { margin-right: 4px; }
.clear-filters { font: inherit; font-size: 14px; color: var(--ink-2); background: none; border: 1px solid var(--ring);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.clear-filters:hover { color: var(--ink); border-color: var(--ink-2); }
.clear-filters[hidden] { display: none; }
.check { font-size: 14px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }

.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.wall.collapsed { max-height: 420px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.more-btn { display: block; margin: 8px auto 0; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--ring); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.more-btn.floating { position: sticky; bottom: 16px; z-index: 5; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }
.wall button, .strip button {
  padding: 0; border: 0; background: var(--placeholder); border-radius: 4px; cursor: pointer; aspect-ratio: 2 / 3;
  overflow: hidden; position: relative; font: inherit;
}
.wall img, .strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall .nocover, .strip .nocover { font-size: 10px; line-height: 1.2; padding: 4px; color: var(--ink-2); text-align: left;
  display: block; height: 100%; overflow: hidden; }
.wall button:focus-visible, .strip button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }  /* same size as the bookshelf wall */
.authors { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px 32px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.authors li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: center; }
.authors .who { font-size: 13px; line-height: 1.3; }
.authors .n { display: block; color: var(--muted); font-size: 12px; }
.authors .covers { display: grid; grid-template-columns: repeat(var(--cols, 9), minmax(0, 1fr)); gap: 4px; }
.authors button, .authors .nobook { width: 100%; aspect-ratio: 2 / 3; padding: 0; border: 0; border-radius: 3px; overflow: hidden;
  background: var(--placeholder); font: inherit; cursor: pointer; display: block; }
.authors .nobook { cursor: default; }
.authors img { width: 100%; height: 100%; object-fit: cover; display: block; }
.authors .nocover { font-size: 6px; line-height: 1.1; padding: 2px; color: var(--ink-2); display: block; overflow: hidden; height: 100%; }
.authors button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) { .authors li { grid-template-columns: 1fr; gap: 4px; } .authors .n { display: inline; } }
.strip figure { margin: 0; font-size: 12px; color: var(--ink-2); }
.strip figcaption { margin-top: 4px; line-height: 1.25; }
.wi-maps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px 16px; max-width: 760px; margin: 8px auto 0; }
.wi-maps figure { margin: 0; text-align: center; }
.wi-maps svg { display: block; width: 100%; height: auto; overflow: visible; }
/* no land fill: the empty part of the state is the card's own background; only the outline and the water show */
.wi-edge { fill: none; stroke: var(--wi-blue); stroke-width: 0.75; vector-effect: non-scaling-stroke; stroke-opacity: 0.08;
  transition: stroke-opacity 1.4s; }
.filled .wi-edge { stroke-opacity: var(--edge); }
.wi-water { fill: var(--wi-blue); transform: translateY(120px); transition: transform 1.4s cubic-bezier(0.3, 0.7, 0.4, 1); }
.filled .wi-water { transform: translateY(var(--level)); }
/* the percentage is HTML laid over the map so it keeps a readable size on phones; it rides the waterline up */
.wi-map { position: relative; }
.wi-pct { position: absolute; left: 56%; top: 100%; transform: translate(-50%, calc(-100% - 2px)); white-space: nowrap; pointer-events: none;
  font-size: clamp(15px, 2.4vw, 22px); font-weight: 600; line-height: 1; color: var(--ink); opacity: 0;
  /* on phones the number is wider than the state; a card-coloured halo keeps it clear of the outline */
  text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface), 0 0 2px var(--surface);
  transition: top 1.4s cubic-bezier(0.3, 0.7, 0.4, 1), opacity 1.4s; }
.filled .wi-pct { top: var(--top); opacity: 1; }
.wi-maps figcaption { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .wi-water, .wi-pct, .wi-edge { transition: none; } }
.strip-label { margin: 16px 0 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.strip-label:first-of-type { margin-top: 4px; }

.about ul { padding-left: 20px; max-width: 820px; color: var(--ink-2); font-size: 14px; }
.about li { margin: 6px 0; }
.about b { color: var(--ink); }
.about p { color: var(--ink-2); font-size: 14px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.echoes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px 20px; }
.echoes li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 13px; }
.echoes button { padding: 0; border: 0; background: var(--placeholder); border-radius: 4px; cursor: pointer; aspect-ratio: 2 / 3;
  overflow: hidden; font: inherit; width: 56px; }
.echoes button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.echoes img { width: 100%; height: 100%; object-fit: cover; display: block; }
.echoes .nocover { font-size: 9px; line-height: 1.2; padding: 3px; color: var(--ink-2); display: block; text-align: left; }
.echoes .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.echoes .t { font-weight: 600; color: var(--ink); font-size: 14px; margin: 1px 0 4px; }
.echoes .listen { display: inline-block; margin-top: 4px; font-size: 12px; text-decoration: none; }
.echoes .listen:hover { text-decoration: underline; }
.echoes .m { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }


.tooltip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 280px; font-size: 13px; line-height: 1.4;
  background: var(--surface); color: var(--ink); border: 1px solid var(--ring); border-radius: 8px;
  padding: 8px 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.tooltip .tt-title { font-weight: 600; }
.tooltip .tt-meta { color: var(--ink-2); }

dialog { border: 1px solid var(--ring); border-radius: 12px; background: var(--surface); color: var(--ink);
  max-width: min(640px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.list-dialog { width: min(900px, calc(100vw - 32px)); max-width: none; max-height: 85vh; }
.list-dialog h3 { font-size: 18px; margin: 4px 0 14px; }
dialog .close { float: right; font-size: 22px; background: none; border: 0; color: var(--ink-2); cursor: pointer; }
.detail { display: grid; grid-template-columns: 120px 1fr; gap: 16px; }
.detail img { width: 120px; border-radius: 4px; }
.detail .cover-missing { width: 120px; aspect-ratio: 2 / 3; border-radius: 4px; background: var(--placeholder);
  display: grid; place-items: center; padding: 8px; text-align: center; font-size: 12px; color: var(--muted); }
.detail h3 { font-size: 18px; margin: 0; }
.detail .by { color: var(--ink-2); margin: 2px 0 8px; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; margin: 8px 0; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.detail p { font-size: 14px; }
@media (max-width: 520px) { .detail { grid-template-columns: 1fr; } }

.foot { color: var(--muted); font-size: 13px; padding: 32px 0 48px; }
