/* Census Curiosities: mobile-first, typography-led, one accent colour. */

:root {
  --bg: #fbfaf7;
  --ink: #1d1c1a;
  --muted: #6b675f;
  --rule: #e4e0d8;
  --track: #efebe3;
  --accent: #b3261e;
  --accent-soft: #e9b8b3;
  --land: #ebe7de;
  --hl: #f6ebe7;
  --cmp: #1f5f99;      /* the compared place: a second, quieter colour */
  --grp-res: #b3261e;  /* age scatter groups (validated pair, both modes) */
  --grp-north: #008a78;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 40rem;
  --gutter: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --ink: #ece9e3;
    --muted: #a19c92;
    --rule: #34312d;
    --track: #2a2825;
    --accent: #f06b5f;
    --accent-soft: #7a3631;
    --land: #2c2a27;
    --hl: #2a201e;
    --cmp: #7fb2e5;
    --grp-res: #e2584d;
    --grp-north: #2fa197;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

a { color: inherit; }

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

/* ---- Masthead ----------------------------------------------------------- */

.masthead,
main,
.colophon {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.masthead { padding-top: 2.5rem; padding-bottom: 1.5rem; }

.kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.25rem, 9vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.lede {
  margin: 1rem 0 0;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.45;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.toc a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.25rem 0;   /* larger tap target without visual bulk */
}

.toc a:hover { color: var(--accent); }

/* ---- Your place --------------------------------------------------------- */

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

.yp { margin-top: 1.75rem; max-width: 30rem; }
.yp[hidden], .yp [hidden] { display: none !important; }

.yp-label {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.yp-combo { position: relative; }

.yp-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--muted);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;   /* 16px, so phones don't zoom in on focus */
}

.yp-input::placeholder { color: var(--muted); opacity: 1; }
.yp-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.yp-list {
  position: absolute;
  z-index: 10;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: min(22rem, 60vh);
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.yp-opt { padding: 0.5rem 0.75rem; cursor: pointer; line-height: 1.3; }
.yp-opt:hover, .yp-opt[aria-selected="true"] { background: var(--hl); }
.yp-opt[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--accent); }
.yp-opt-name { display: block; font-weight: 600; }
.yp-opt-meta { display: block; color: var(--muted); font-size: 0.8125rem; }

.yp-help { margin: 0.375rem 0 0; color: var(--muted); font-size: 0.8125rem; }
.yp-help.is-empty { color: var(--ink); }

.yp-chosen {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 1rem;
}

.yp-chosen-text { margin: 0; line-height: 1.35; }
.yp-name { font-family: var(--serif); font-size: 1.25rem; }
.yp-where { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.yp-chosen .yours-mark,
.yp-chosen .cmp-mark { margin-right: 0.25rem; }

.picker--cmp { margin-top: 1.25rem; }

.yp-actions { display: flex; gap: 0.5rem; }

.yp-btn {
  min-height: 2.25rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--muted);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.yp-btn:hover { border-color: var(--ink); background: var(--track); }
.yp-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.yp-cancel { margin-top: 0.5rem; }

/* The reader's own place is marked with an outlined ring (ink, never the
   accent), the same on the maps, the pinned lines and the search box. */
.yours-mark {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle, var(--ink) 0 1.5px, transparent 2px);
  vertical-align: -0.05em;
}

/* The place it is compared with: a square in the second colour, everywhere
   the reader's place has a ring. */
.cmp-mark {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid var(--cmp);
  border-radius: 2px;
  background: radial-gradient(circle, var(--cmp) 0 1.5px, transparent 2px);
  vertical-align: -0.05em;
}

/* ---- Ranking sections --------------------------------------------------- */

.ranking {
  padding-top: 2.5rem;
  scroll-margin-top: 0.5rem;
}

.ranking + .ranking,
.callout + .ranking,
.compare:not([hidden]) + .ranking {
  border-top: 1px solid var(--rule);
  margin-top: 2.5rem;
}

h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1.15;
}

h2 .anchor { text-decoration: none; }

h2 .anchor::after {
  content: "#";
  margin-left: 0.4rem;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.7em;
  opacity: 0;
  transition: opacity 0.15s;
}

h2 .anchor:hover::after,
h2 .anchor:focus-visible::after { opacity: 1; }

.dek {
  margin: 0.5rem 0 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--ink);
}

.measure {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.measure strong { color: var(--ink); font-weight: 600; }

.measure [data-count] { white-space: nowrap; }

/* ---- Entries ------------------------------------------------------------ */

.entries {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.entry {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  grid-template-areas:
    "rank place value"
    "rank meta  meta"
    "rank bar   bar"
    "rank note  note";
  column-gap: 0.5rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--rule);
}

.entry:last-child { border-bottom: 1px solid var(--rule); }

.rank {
  grid-area: rank;
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.6rem;
}

.place {
  grid-area: place;
  min-width: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.place a {
  text-decoration: none;
  background-image: linear-gradient(var(--rule), var(--rule));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
}

.place a:hover {
  color: var(--accent);
  background-image: linear-gradient(var(--accent), var(--accent));
}

.value {
  grid-area: value;
  align-self: baseline;
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  text-align: right;
  white-space: nowrap;
}

.meta {
  grid-area: meta;
  margin-top: 0.125rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.bar {
  grid-area: bar;
  position: relative;
  height: 0.375rem;
  margin-top: 0.5rem;
  background: var(--track);
  border-radius: 1px;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 1px;
}

.entry:not(:first-child) .bar-fill { background: var(--accent-soft); }

.bar-ref {
  position: absolute;
  top: -0.1875rem;
  bottom: -0.1875rem;
  width: 1px;
  background: var(--ink);
}

.note {
  grid-area: note;
  margin: 0.5rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--ink);
}

.note:empty { display: none; }

/* Highlighted from the map (or by hovering the entry itself). The two side
   shadows widen the tint into the gutter without moving anything. */
.entry { transition: background-color 0.15s, box-shadow 0.15s; }

.entry.is-active {
  background: var(--hl);
  box-shadow: -0.5rem 0 0 var(--hl), 0.5rem 0 0 var(--hl);
}

.entry.is-active .rank { color: var(--accent); font-weight: 700; }

/* The reader's place when it made the list: its rank is ringed like its dot. */
.entry.is-yours .rank {
  justify-self: start;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

/* The compared place when it made the list: its rank is squared like its mark. */
.entry.is-compare .rank {
  justify-self: start;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--cmp);
  border-radius: 3px;
  color: var(--cmp);
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

.yours-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.375rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
  vertical-align: 0.15em;
  white-space: nowrap;
}

/* ---- Pinned line for the reader's place ---------------------------------- */

.pin {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  grid-template-areas:
    "mark text"
    "mark bar";
  column-gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0.75rem 0;
  background: var(--track);
  box-shadow: -0.5rem 0 0 var(--track), 0.5rem 0 0 var(--track);
}

.pin[hidden] { display: none; }

.pin-mark { grid-area: mark; margin-top: 0.25rem; }

.pin-text {
  grid-area: text;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pin-name {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(var(--muted), var(--muted));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
}

.pin-name:hover { color: var(--accent); }

.tag-compare { border-color: var(--cmp); color: var(--cmp); }

.pin + .pin { margin-top: 0.25rem; }

.pin .bar { background: var(--bg); }
.pin .bar-fill { background: var(--ink); }
.pin--compare .bar-fill { background: var(--cmp); }
.entry.is-active .bar-fill { background: var(--accent); }

/* ---- Locator maps ------------------------------------------------------- */

/* The box sets the size; app.js fits Canada inside it, so space is reserved
   before the data arrives and nothing jumps. */
.map {
  width: 100%;
  max-width: 24rem;
  aspect-ratio: 7 / 6;
  margin: 1.25rem 0 0;
  /* Without this, the previous drawing's fixed height stops the box shrinking
     when the window narrows, so the map is never redrawn smaller. */
  overflow: hidden;
  position: relative;
}

.no-maps .map { display: none; }

.map-svg {
  display: block;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.map .land {
  fill: var(--land);
  stroke: var(--bg);
  stroke-width: 0.75;
  stroke-linejoin: round;
}

.map .leader { stroke: var(--muted); stroke-width: 0.75; }
.map .anchor { fill: var(--muted); }

.dots--numbered circle {
  fill: var(--bg);
  stroke: var(--accent);
  stroke-width: 1.25;
}

.dots--numbered text {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  pointer-events: none;
}

.dots--numbered .is-first circle { fill: var(--accent); }
.dots--numbered .is-first text { fill: var(--bg); }

/* Unnumbered dots for the callouts: many places, so small and see-through. */
.dots:not(.dots--numbered) circle {
  fill: var(--accent);
  fill-opacity: 0.6;
  stroke: var(--bg);
  stroke-width: 0.5;
}

.dot circle { transition: transform 0.15s; }
.dot.is-active circle { transform: scale(1.25); fill: var(--accent); fill-opacity: 1; }
.dots--numbered .is-active text { fill: var(--bg); }
.dots:not(.dots--numbered) .is-active circle { transform: scale(1.8); }

.map-svg.has-active .dot:not(.is-active),
.map-svg.has-active .leaders { opacity: 0.4; }

/* The label: HTML over the map, positioned by app.js. With a mouse it is
   display-only; after a tap it carries a "Census profile" link. */
.map-tip {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.3rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.35;
  pointer-events: none;
}

.map-tip[hidden] { display: none; }
.map-tip.has-link { pointer-events: auto; }
.map-tip.is-measuring { white-space: nowrap; max-width: none !important; }

.tip-name { font-weight: 600; }
.tip-sub { color: var(--muted); white-space: nowrap; }
.is-stacked .tip-sep { display: none; }
.is-stacked .tip-sub { display: block; }

.tip-link {
  display: block;
  margin-top: 0.125rem;
  padding: 0.25rem 0;   /* comfortable tap target */
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.tip-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.map.is-pointing { cursor: pointer; }

/* The reader's place on the maps: an ink ring, labelled. */
.dot--yours .ring { fill: var(--bg); fill-opacity: 0.85; stroke: var(--ink); stroke-width: 2; }
.dot--yours .core { fill: var(--ink); }
.dot--yours.is-active .ring { transform: scale(1.2); fill: var(--bg); }
.dot--yours.is-active .core { transform: none; fill: var(--ink); }

.dots .dot .ring { fill: none; stroke: var(--ink); stroke-width: 2; fill-opacity: 1; }
.dots .dot.is-active .ring { fill: none; }

/* The compared place on the maps: a square in the second colour. */
.dots .dot .sq { fill: none; stroke: var(--cmp); stroke-width: 2; }
.dot--cmp .sq { fill: var(--bg); fill-opacity: 0.85; stroke: var(--cmp); stroke-width: 2; }
.dot--cmp .core { fill: var(--cmp); }
.dot--cmp .sq { transition: transform 0.15s; }
.dot--cmp.is-active .sq { transform: scale(1.2); }
.dot--cmp.is-active .core { transform: none; fill: var(--cmp); fill-opacity: 1; }

.yours-label {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.yours-label.is-cmp { fill: var(--cmp); }

@media (prefers-reduced-motion: reduce) {
  .entry, .dot circle, .dot--cmp .sq { transition: none; }
}

/* ---- Age scatter ------------------------------------------------------- */

.sc-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
}

.sc-swatch {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  margin-right: 0.375rem;
  border-radius: 50%;
  vertical-align: 0;
}

.sc-swatch--reserve { background: var(--grp-res); }
.sc-swatch--north { background: var(--grp-north); }
.sc-swatch--other { background: var(--muted); opacity: 0.5; }

/* The box sets the size; app.js draws to fit it. */
.scatter {
  position: relative;
  width: 100%;
  max-width: 46rem;
  aspect-ratio: 1 / 1;
  margin: 1rem 0 0;
  overflow: hidden;
}

.no-scatter .scatter,
.no-scatter .sc-key { display: none; }

.scatter.is-pointing { cursor: pointer; }

.scatter-svg {
  display: block;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sc-grid { stroke: var(--rule); stroke-width: 1; }
.sc-base { stroke: var(--muted); stroke-width: 1; }

.sc-tick,
.sc-title {
  font-family: var(--sans);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.sc-tick { fill: var(--muted); }
.sc-title { fill: var(--ink); font-weight: 600; }

.sc-other { fill: var(--muted); fill-opacity: 0.32; }
.sc-north,
.sc-reserve { fill-opacity: 0.85; stroke: var(--bg); stroke-width: 0.6; }
.sc-north { fill: var(--grp-north); }
.sc-reserve { fill: var(--grp-res); }

.sc-picked { fill: none; stroke: var(--ink); stroke-width: 1; }
.sc-leader { stroke: var(--muted); stroke-width: 0.75; }
.sc-hl { fill: none; stroke: var(--ink); stroke-width: 1.5; pointer-events: none; }

.sc-label {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.sub-h {
  margin: 2rem 0 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.2;
}

.sub-dek { margin: 0.25rem 0 0; font-size: 0.9375rem; color: var(--muted); }

.footnote {
  max-width: 38rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* ---- Two places compared ------------------------------------------------ */

.compare {
  padding-top: 2.5rem;
  scroll-margin-top: 0.5rem;
}

.compare[hidden] { display: none; }

.cmp-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.cmp-key .yours-mark,
.cmp-key .cmp-mark { margin-right: 0.125rem; }

.cmp-rows { max-width: 40rem; margin-top: 1rem; }

.cmp-row {
  padding: 1rem 0 1.125rem;
  border-top: 1px solid var(--rule);
}

.cmp-row:last-child { border-bottom: 1px solid var(--rule); }

.cmp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.75rem;
}

.cmp-measure { margin: 0; font-size: 1rem; font-weight: 600; }

/* Group headings (People, Money, Housing, Moving). */
.cmp-group {
  margin: 2rem 0 0.25rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cmp-group:first-child { margin-top: 0.5rem; }

.cmp-note { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8125rem; font-style: italic; }

.cmp-text { margin: 0.5rem 0 0; padding: 0; list-style: none; font-size: 0.9375rem; line-height: 1.5; }
.cmp-text li + li { margin-top: 0.25rem; }
.cmp-text .yours-mark, .cmp-text .cmp-mark { margin-right: 0.125rem; }
.cmp-among { color: var(--muted); font-size: 0.8125rem; }

/* Percentile strip: 0 at the left, 100 at the right. The reader's place is
   labelled above the line, the compared place below, so labels never collide. */
.strip {
  position: relative;
  height: 4.25rem;
  margin-top: 0.25rem;
}

.strip-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--rule);
}

.strip-line::before,
.strip-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 10px;
  background: var(--muted);
}

.strip-line::before { left: 0; }
.strip-line::after { right: 0; }

/* The middle place. */
.strip-mid {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 8px;
  margin-top: -4px;
  background: var(--muted);
}

.strip-mark { position: absolute; top: 50%; width: 0; height: 0; }

.strip-mark > .yours-mark,
.strip-mark > .cmp-mark {
  position: absolute;
  left: -0.4375rem;
  top: -0.4375rem;
  background-color: var(--bg);
}

.strip-val {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.strip-val.is-left { transform: translateX(-0.4375rem); }
.strip-val.is-right { transform: translateX(calc(-100% + 0.4375rem)); }

.strip-mark--yours .strip-val { bottom: 0.75rem; }
.strip-mark--compare .strip-val { top: 0.75rem; color: var(--cmp); }

.strip-ends {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.cmp-sentence {
  margin: 0.5rem 0 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.4;
}

/* ---- Callouts ----------------------------------------------------------- */

.callout {
  margin: 2.5rem 0 0;
  padding: 1.25rem 0 1.25rem 1rem;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.3;
}

.callout-text { margin: 0; }

.callout .map { max-width: 20rem; }

.callout-foot {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.4;
}

.callout strong { color: var(--accent); }

.callout-sub {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
}

/* ---- Loading and error status ------------------------------------------ */

.load-status {
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.load-status.is-error {
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink);
}

.retry {
  margin-left: 0.25rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.retry:hover { background: var(--accent); color: var(--bg); }

.retry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Footer ------------------------------------------------------------- */

.colophon {
  margin-top: 4rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
}

.colophon p { margin: 0 0 0.5rem; }

/* ---- Wider screens ------------------------------------------------------ */

@media (min-width: 40rem) {
  :root { --gutter: 1.5rem; }

  .masthead { padding-top: 4rem; }

  .entry {
    grid-template-columns: 2rem minmax(0, 1fr) 8rem 4.5rem;
    grid-template-areas:
      "rank place bar value"
      "rank meta  bar value"
      "rank note  note note";
    column-gap: 1rem;
  }

  .bar { align-self: center; margin-top: 0; }

  .pin {
    grid-template-columns: 2rem minmax(0, 1fr) 8rem 4.5rem;
    grid-template-areas: "mark text bar .";
    column-gap: 1rem;
  }

  .callout { font-size: 1.5rem; }

  .scatter { aspect-ratio: 4 / 3; }
}

@media (min-width: 60rem) {
  /* Wide enough for the list (long place names fit beside the bar) plus a map
     column; prose stays short. */
  :root {
    --measure: 68rem;
    --map-col: clamp(17rem, 28vw, 22rem);
  }

  /* Heading, text and list in the left column; the map sits beside them and
     stays in view while the list scrolls past. */
  .ranking,
  .callout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--map-col);
    column-gap: 3rem;
  }

  .ranking { align-items: start; }
  .ranking > * { grid-column: 1; }

  .ranking > .map {
    grid-column: 2;
    grid-row: 1 / span 8;   /* heading, dek, measure, up to two pinned lines, list */
    position: sticky;
    top: 1.5rem;
    max-width: none;
    margin-top: 0.25rem;
  }

  .callout { align-items: center; }
  .callout .map { grid-column: 2; max-width: none; margin-top: 0; }
  .callout-foot { grid-column: 1 / -1; }

  .entry,
  .pin { grid-template-columns: 2rem minmax(0, 1fr) 11rem 4.5rem; }

  .lede, .dek, .callout-text, .colophon p { max-width: 38rem; }

  /* The age section is one wide column: scatter, then its two lists side by side. */
  .ranking.ranking--wide { display: block; }
  .scatter { aspect-ratio: 3 / 2; }
  .sublists { display: grid; grid-template-columns: 1fr 1fr; column-gap: 3rem; }
  .sublists .entry,
  .sublists .pin { grid-template-columns: 2rem minmax(0, 1fr) 5rem 4rem; }
}
