/* Carolina, Mapped: one stylesheet for every page. Tokens match the graphics:
   the maps' off-white paper, their ink, and the British red as the only accent. */
:root {
  --bg: #f7f6f2;
  --surface: #fff;
  --ink: #1d1d1a;
  --body: #2f2e2a;
  --mute: #4f4e48;
  --soft: #5c5b55;
  --faint: #6b6a63;
  --rule: #dedcd4;
  --edge: #e0ded6;
  --accent: #9a2c23;
  --red: #b8332a;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
a { color: var(--ink); }
a:hover { color: var(--red); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.wrap.wide { max-width: 1440px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* header + footer */
.top { border-bottom: 1px solid var(--rule); }
.top .wrap { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 24px; text-decoration: none; white-space: nowrap; }
.top nav { display: flex; gap: 28px; font-size: 15px; font-weight: 500; }
.top nav a { text-decoration: none; }
@media (max-width: 640px) { .top .wrap { height: 56px; } .brand { font-size: 20px; } .top nav { gap: 18px; font-size: 14px; } .top nav .handle { display: none; } }
.foot { border-top: 1px solid var(--rule); margin-top: 96px; }
.foot .wrap { padding-top: 32px; padding-bottom: 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--soft); }

/* type */
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.kicker a { color: inherit; text-decoration: none; }
.kicker .hot { color: var(--accent); }
h1.title { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 52px; line-height: 1.06; }
.meta { font-size: 14px; color: var(--soft); }
.draft { display: inline-block; font: 600 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #8a5a00;
  background: #fbf0d6; border: 1px solid #ecd9a6; border-radius: 4px; padding: 4px 6px; vertical-align: 1px; }
.deck { margin: 0; font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.45; color: var(--mute); }
@media (max-width: 640px) { h1.title { font-size: 32px; } .deck { font-size: 18px; } }

/* buttons */
.btn { font: 600 15px/1 var(--sans); min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid #cfccc2;
  background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; text-decoration: none; }
.btn:hover { color: var(--ink); border-color: var(--ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #000; color: #fff; }
.btn.icon { width: 44px; padding: 0; }
.btn:disabled { opacity: .35; cursor: default; border-color: #cfccc2; }
.btn svg { flex: none; }

/* gallery */
.hero { padding: 72px 0 0; display: flex; flex-direction: column; gap: 18px; max-width: 820px; }
.hero h1 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 60px; line-height: 1.05; letter-spacing: -0.01em; }
.hero p { margin: 0; font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.45; color: var(--mute); }
.hero p a { color: var(--ink); text-underline-offset: 3px; }
@media (max-width: 640px) { .hero { padding-top: 40px; } .hero h1 { font-size: 38px; } .hero p { font-size: 18px; } }
.chips { display: flex; flex-wrap: wrap; gap: 10px; border-bottom: 1px solid var(--rule); padding: 40px 0 28px; }
.chip { font: 500 14px/1 var(--sans); min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid #cfccc2;
  background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.chip .n { opacity: .6; font-weight: 400; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.card { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 14px; }
.card:hover { color: inherit; }
.card .thumb { position: relative; }
.card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface);
  border-radius: 4px; border: 1px solid #e4e2da; }
.card:hover img { border-color: var(--ink); }
.card:hover .ct { text-decoration: underline; text-underline-offset: 3px; }
.card .ck { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.card .ct { margin: 0; font-family: var(--serif); font-size: 23px; line-height: 1.2; font-weight: 600; }
.card .cd { margin: 0; font-size: 15px; line-height: 1.5; color: var(--mute); }
.badge { position: absolute; left: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px; background: var(--ink);
  color: #fff; padding: 6px 10px 6px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.feature { margin-top: 48px; }
.feature .card { display: flex; flex-direction: row; flex-wrap: wrap; gap: 40px; align-items: center; }
.feature .thumb { flex: 999 1 640px; min-width: 0; }
.feature .txt { flex: 1 1 320px; display: flex; flex-direction: column; gap: 14px; }
.feature .ct { font-size: 38px; line-height: 1.1; font-weight: 700; }
.feature .cd { font-size: 17px; line-height: 1.55; }
.feature .ck { color: var(--accent); font-size: 13px; }
.playpill { position: absolute; left: 20px; bottom: 20px; display: inline-flex; align-items: center; gap: 10px; background: var(--ink);
  color: #fff; padding: 12px 18px 12px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 32px; margin-top: 56px; }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .feature .card { flex-direction: column; align-items: stretch; gap: 16px; }
  .feature .thumb, .feature .txt { flex: none; width: 100%; }
  .feature .ct { font-size: 28px; }
  .playpill { left: 12px; bottom: 12px; padding: 8px 14px 8px 10px; font-size: 13px; }
}
[hidden] { display: none !important; }

/* graphic pages */
.head { padding: 48px 0 28px; display: flex; flex-direction: column; gap: 14px; max-width: 920px; }
.figure { margin: 0; background: var(--surface); border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; }
.figure > a { display: block; cursor: zoom-in; }
.figure img { display: block; width: 100%; height: auto; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--faint); }
.cols { display: flex; flex-wrap: wrap; gap: 56px; margin-top: 56px; }
.about { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; font-family: var(--serif);
  font-size: 20px; line-height: 1.65; color: var(--body); }
.about h2 { margin: 0; font-size: 30px; line-height: 1.2; color: var(--ink); }
.about p { margin: 0; }
sup a { text-decoration: none; color: var(--accent); font-weight: 600; font-family: var(--sans); font-size: 13px; }
.side { flex: 1 1 280px; display: flex; flex-direction: column; gap: 12px; }
.side .fine { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 14px; line-height: 1.6; color: var(--soft); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 24px; }
.actions .fine { font-size: 14px; color: var(--soft); margin-left: 8px; }
.sources { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule); max-width: 900px; }
.sources h2 { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.sources ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.55; color: var(--body); }
.sources li:target { background: #fbf3d9; }
.pager { margin-top: 48px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-family: var(--serif); font-size: 19px; }

/* interactive map */
.split { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; }
.mapcol { flex: 3 1 720px; min-width: 0; display: flex; flex-direction: column; }
.stage { position: relative; }
.stage > svg { display: block; width: 100%; height: auto; }
.stage .playbig { position: absolute; left: 20px; bottom: 20px; min-height: 56px; padding: 0 24px 0 14px; font-size: 17px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.controls { margin-top: auto; border-top: 1px solid var(--edge); padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.controls .pair { display: flex; gap: 6px; }
.scrub { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.scrub input { width: 100%; margin: 0; accent-color: var(--ink); height: 28px; cursor: pointer; }
.chapters { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.chapters button { font: 500 13px/1 var(--sans); min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid #cfccc2;
  background: var(--surface); color: var(--ink); cursor: pointer; }
.chapters button:hover { border-color: var(--ink); }
.chapters button[aria-current="step"] { background: var(--ink); border-color: var(--ink); color: #fff; }
@media (max-width: 640px) { .chapters { flex-wrap: nowrap; overflow-x: auto; } .chapters button { flex: none; } }
.pbody .also { margin-top: 4px; padding-top: 12px; border-top: 1px solid #ebe9e2; gap: 4px; }
.pbody .also .kicker { font-size: 11px; display: flex; align-items: center; gap: 8px; }
.pbody .also ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pbody .also button { font: 500 14px/1.3 var(--sans); color: var(--ink); background: none; border: 0; padding: 6px 0; min-height: 36px;
  cursor: pointer; text-align: left; display: flex; align-items: center; gap: 8px; width: 100%; }
.pbody .also button:hover { color: var(--red); }
.pbody .also button span { color: #77756d; font-size: 13px; }
.readout { font-family: var(--mono); font-weight: 500; font-size: 17px; min-width: 120px; text-align: right; }
.panel { flex: 1 1 300px; min-width: 0; border-left: 1px solid var(--edge); display: flex; flex-direction: column; }
@media (max-width: 1100px) { .panel { border-left: 0; border-top: 1px solid var(--edge); } }
/* Side by side, the panel takes its height from the map and its text scrolls,
   so changing stories never resizes the map box. */
@media (min-width: 1101px) {
  .panel { position: relative; }
  .pin { position: absolute; inset: 0; display: flex; flex-direction: column; }
  .pbody { overflow-y: auto; overscroll-behavior: contain; }
}
.pbody { flex: 1; min-height: 0; padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.pbody > div { display: flex; flex-direction: column; gap: 12px; }
.pbody p { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.6; color: var(--body); }
.pbody .help { font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--soft); }
.pbody h2 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.12; }
.pbody .when { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--mute); }
.pbody .big { font-family: var(--mono); font-weight: 500; font-size: 30px; line-height: 1; }
.pbody .kicker { font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.pbody .src { font-size: 13px; color: var(--soft); }
.pbody .past { list-style: none; margin: 6px 0 0; padding: 12px 0 0; border-top: 1px solid #ebe9e2; display: flex; flex-direction: column;
  gap: 8px; font-size: 14px; color: #77756d; }
.pbody .past b { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.linkish { font: 500 14px/1.3 var(--sans); color: var(--ink); background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-align: left; }
.linkish:hover { color: var(--red); }
.pnav { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #ebe9e2; margin-top: 4px; }
.layers { border-top: 1px solid var(--edge); padding: 14px 20px 16px; }
.layers .kicker { display: block; margin: 0 0 6px 4px; font-size: 12px; }
.lrow { font: 500 14px/1.25 var(--sans); min-height: 40px; width: 100%; padding: 0 4px; border: 0; background: transparent; color: var(--ink);
  cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: left; }
.lrow:hover { background: #f3f2ee; }
.lrow .box { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--ink); display: inline-flex; align-items: center;
  justify-content: center; flex: none; }
.lrow .box svg { visibility: hidden; }
.lrow[aria-pressed="true"] .box svg { visibility: visible; }
.lrow[aria-pressed="false"] { color: #8a8880; }
.lrow[aria-pressed="false"] .gly { opacity: .3; }
.lrow[aria-pressed="false"] .box { border-color: #b9b6ac; }
.lrow .lab { flex: 1; }
.lrow .n { font-size: 13px; color: #8a8880; }

/* svg states, set by player.js */
svg .tl-off { opacity: 0; }
svg.tl-anim .tl-fade { transition: opacity .35s ease; }
svg .hit { fill: transparent; cursor: pointer; }
svg .hit:focus { outline: none; }
svg .hit:focus-visible + .ringmark, svg .ringmark.on { visibility: visible; }
svg .ringmark { visibility: hidden; fill: none; stroke: var(--ink); stroke-width: 3; pointer-events: none; }
svg .lay-off { visibility: hidden; }

/* A story, selected or playing, gets the whole panel; the layers come back
   with the overview. */
.panel.story .layers { display: none; }

/* phones: the panel becomes a bottom sheet while a battle is open */
@media (max-width: 640px) {
  .split { border-radius: 0; margin: 0 -16px; border-left: 0; border-right: 0; }
  .panel.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 70vh; overflow: auto; background: var(--surface);
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgba(29, 29, 26, .18); }
  .controls { padding: 12px 16px; }
  .readout { min-width: 0; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { svg.tl-anim .tl-fade { transition: none; } }
/* Other moves on the same date as the step's lead (Civil War: Sherman and
   Stoneman on the same day). */
.pbody .more { display: flex; flex-direction: column; gap: 6px; }
.pbody .more h3 { margin: 6px 0 0; font-family: var(--serif); font-weight: 700; font-size: 19px; line-height: 1.2; }
.pbody .more[hidden] { display: none; }

/* Phones: on a graphic page, the download and permalink buttons come before the About text. */
@media (max-width: 640px) { .cols .side { order: -1; } }

/* Clickable legend (barbecue): picking a zone dims every other county. */
.zones { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.zrow { font: 500 15px/1.35 var(--sans); width: 100%; min-height: 44px; padding: 8px 8px; border: 1px solid transparent;
  border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; display: flex; align-items: flex-start;
  gap: 12px; text-align: left; }
.zrow:hover { background: #f3f2ee; }
.zrow[aria-pressed="true"] { background: #f3f2ee; border-color: var(--ink); }
.zrow .sw { flex: none; width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(11, 11, 11, .3); margin-top: 1px; }
.zrow .n { color: #77756d; font-weight: 400; }
svg [data-zone] { transition: fill-opacity .25s ease; }
svg.picking [data-zone] { fill-opacity: .14; }
svg.picking [data-zone].on { fill-opacity: 1; }
@media (prefers-reduced-motion: reduce) { svg [data-zone] { transition: none; } }
