/* Dark military chart look. Map colors live in js/config.js; keep the two in sync. */

:root {
  --ink: #0b0d09;
  --panel: rgba(14, 17, 12, 0.82);
  --panel-solid: #0f120d;
  --panel-border: #3a4033;
  --text: #ddd5ba;
  --text-dim: #9a9480;
  --accent: #f2a33a;
  --accent-muted: #8f8166;
  --raf: rgb(150, 186, 232);
  --usaaf: rgb(238, 231, 210);
  --ember: rgb(118, 62, 26);
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: 20px;
  --timeline-height: 64px;
  --panel-width: 380px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-display);
  overflow: hidden;
}
/* Pinned to the window, so nothing (find-in-page, scrollIntoView, a screen
   reader) can scroll the page toward the closed panel waiting off-screen. */
body { position: fixed; inset: 0; overflow: clip; }

#map { position: absolute; inset: 0; }

button, select { font: inherit; color: inherit; }

/* Heads-up panels floating over the map */
.hud {
  position: absolute;
  z-index: 2;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 600ms ease;
}
.is-ready .hud { opacity: 1; }

.title-block {
  top: var(--gutter);
  left: var(--gutter);
  padding: 14px 20px 12px;
  border-left: 3px solid var(--accent);
}
.eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
.title-meta { margin: 6px 0 0; display: flex; align-items: baseline; gap: 14px; }
.about-link { font-family: var(--font-data); font-size: 12px; color: var(--text-dim); text-decoration: underline; text-decoration-color: var(--panel-border); text-underline-offset: 3px; }
.about-link:hover { color: var(--text); text-decoration-color: currentColor; }
.about-link:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.about-short { display: none; }
.ai-note a { color: var(--text); text-decoration-color: var(--panel-border); text-underline-offset: 2px; }
.ai-note a:hover { text-decoration-color: currentColor; }
.date-range {
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--accent);
}

.stats {
  top: var(--gutter);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 28px;
  padding: 10px 22px;
}
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-value { font-family: var(--font-data); font-size: 20px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }

/* Legend */
.legend {
  left: var(--gutter);
  bottom: calc(var(--timeline-height) + var(--gutter) * 1.5);
  width: 250px;
  padding: 12px 16px;
  font-size: 14px;
}
.legend h2 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.legend ul { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 5px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend-note { margin: 0; font-family: var(--font-data); font-size: 11px; line-height: 1.45; color: var(--text-dim); }
.dot, .ring { display: inline-block; flex: none; width: 10px; height: 10px; margin: 0 3px; border-radius: 50%; }
.dot-hot { background: rgb(255, 205, 120); box-shadow: 0 0 8px rgba(255, 190, 90, 0.8); }
.dot-ember { background: var(--ember); width: 14px; height: 14px; margin: 0 1px; }
.dot-base { background: var(--text); width: 8px; height: 8px; margin: 0 4px; }
.ring { border: 1.5px solid var(--text); }
.plane-swatch {
  flex: none;
  width: 16px;
  height: 16px;
  -webkit-mask: url("../assets/planes/medium.svg") center / contain no-repeat;
  mask: url("../assets/planes/medium.svg") center / contain no-repeat;
}
.plane-raf { background: var(--raf); }
.plane-usaaf { background: var(--usaaf); }

/* Timeline bar */
.timeline {
  left: var(--gutter);
  right: var(--gutter);
  bottom: var(--gutter);
  height: var(--timeline-height);
  display: grid;
  grid-template-columns: auto 210px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 14px 0 10px;
}
/* Back one day, play / pause, forward one day */
.transport { display: flex; align-items: center; gap: 6px; }
.day-step {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--text);
  cursor: pointer;
}
.day-step svg { width: 16px; height: 16px; fill: currentColor; }
.day-step:hover:not(:disabled) { border-color: var(--text-dim); }
.day-step:disabled { opacity: 0.3; cursor: default; }
.day-step:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.play {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play .icon-pause, .play.is-playing .icon-play { display: none; }
.play.is-playing .icon-pause { display: block; }
.play:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
body:not(.has-played) .play { animation: beckon 1.8s ease-in-out infinite; }
@keyframes beckon {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 163, 58, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(242, 163, 58, 0); }
}

.now { display: flex; flex-direction: column; min-width: 0; }
.now-date {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.05;
  white-space: nowrap;
}
.now-day { font-family: var(--font-data); font-size: 11px; line-height: 1.3; color: var(--text-dim); } /* wraps rather than being cut off */

/* The whole-war strip: click a month to jump to its 1st, drag to scrub */
.track { position: relative; height: 46px; cursor: pointer; touch-action: none; }
#activity {
  position: absolute;
  inset: 3px 0 16px;
  width: 100%;
  height: calc(100% - 19px);
  --bar-past: rgba(242, 163, 58, 0.75);
  --bar-future: rgba(154, 148, 128, 0.28);
  --month-tick: rgba(154, 148, 128, 0.45);
  --bar-mark: rgba(255, 236, 200, 0.95);
}

/* Focus mode (a target open in the panel): the totals fade, the timeline shows the target */
.stats { transition: opacity 300ms ease; }
.is-focus .stats { opacity: 0.22; }
.is-focus-timeline .now-date { color: var(--accent); }
.is-focus-timeline #scrubber::-webkit-slider-thumb { opacity: 0.35; }
.is-focus-timeline #scrubber::-moz-range-thumb { opacity: 0.35; }
.month-hover {
  position: absolute;
  top: 0;
  bottom: 15px;
  background: rgba(221, 213, 186, 0.07);
  box-shadow: inset 1px 0 rgba(221, 213, 186, 0.3), inset -1px 0 rgba(221, 213, 186, 0.3);
  pointer-events: none;
}
.month-hover[hidden] { display: none; }

/* Key dates: small diamonds along the top edge of the strip, each with a faint line down the bars */
.event-markers { position: absolute; left: 0; right: 0; top: -8px; height: 0; --bars-height: 27px; }
.event-marker {
  position: absolute;
  top: 0;
  width: 12px;
  height: 14px;
  margin-left: -6px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.event-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  background: var(--text);
  box-shadow: 0 0 0 1.5px var(--ink);
  transform: rotate(45deg);
}
.event-marker::after { content: ""; position: absolute; left: 50%; top: 11px; width: 1px; height: var(--bars-height); background: rgba(221, 213, 186, 0.3); pointer-events: none; }
.event-marker:hover::before, .event-marker[aria-expanded="true"]::before { background: var(--accent); }
.event-marker:hover::after, .event-marker[aria-expanded="true"]::after { background: rgba(242, 163, 58, 0.7); }
.event-marker:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

.event-note {
  z-index: 4;
  bottom: calc(var(--timeline-height) + var(--gutter) + 12px);
  width: min(340px, calc(100vw - 20px));
  padding: 12px 44px 12px 14px;
  background: rgba(15, 18, 13, 0.96);
  border-top: 3px solid var(--accent);
}
.event-note[hidden] { display: none; }
.event-note .eyebrow { margin-top: 8px; color: var(--accent); }
.event-note-nav .stepper-label { color: var(--text-dim); }
.event-expand {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: none;
  border: 1px solid var(--panel-border);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
}
.event-expand svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }
.event-expand:hover { border-color: var(--text-dim); }
.event-expand:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* A key date expanded: the chapter card's layout, with the date in place of the year */
.event-card-nav { margin-bottom: 10px; }
.event-card-date { margin: 0; font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: 0.02em; color: var(--accent); }
.event-card .source-list { margin-top: 2px; }
.event-card .event-card-day { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--panel-border); }
.event-note h2 { margin: 2px 0 6px; font-size: 20px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; }
.event-note-text { margin: 0; font-size: 15px; line-height: 1.4; }
.event-note-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}
.event-note-close svg { width: 14px; height: 14px; stroke: var(--text); stroke-width: 2; fill: none; }
.event-note-close:hover { border-color: var(--text-dim); }
.event-note-close:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }

/* "Drafted with AI" lines and source lists (key-date notes, chapter cards) */
.ai-note { margin: 10px 0 2px; font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }
.source-list { margin: 0; padding-left: 18px; font-family: var(--font-data); font-size: 11px; line-height: 1.5; color: var(--text-dim); }
.source-list a { color: var(--text); text-decoration-color: var(--panel-border); text-underline-offset: 2px; }
.source-list a:hover { text-decoration-color: currentColor; }
#scrubber {
  position: absolute;
  inset: 0 0 14px;
  width: 100%;
  height: calc(100% - 14px);
  margin: 0;
  pointer-events: none; /* the strip handles the pointer; the scrubber stays for the keyboard */
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
#scrubber::-webkit-slider-runnable-track { height: 100%; background: transparent; }
#scrubber::-moz-range-track { height: 100%; background: transparent; }
#scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px;
  height: 100%;
  background: var(--text);
  box-shadow: 0 0 6px rgba(221, 213, 186, 0.7);
}
#scrubber::-moz-range-thumb { width: 3px; height: 100%; border: 0; border-radius: 0; background: var(--text); }
#scrubber:focus-visible { outline: 1px dashed var(--text-dim); outline-offset: 2px; }
/* Chapter tabs under the activity chart: one per year, as wide as the year */
.chapters { position: absolute; left: 0; right: 0; bottom: 0; height: 15px; }
.chapter-tab {
  position: absolute;
  bottom: 0;
  height: 15px;
  padding: 0 0 0 4px;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--panel-border);
  background: none;
  font-family: var(--font-data);
  font-size: 10px;
  line-height: 15px;
  text-align: left;
  white-space: nowrap;
  color: var(--text-dim);
  cursor: pointer;
}
.chapter-tab:hover { color: var(--text); background: rgba(221, 213, 186, 0.06); }
.chapter-tab[aria-current] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.chapter-tab:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.tab-short { display: none; }
.chapter-tab.is-narrow span { visibility: hidden; }

.speed { display: flex; flex-direction: column; gap: 2px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
/* A box showing the short pace, with the real menu invisible on top of it */
.speed-box {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 28px;
  padding: 5px 26px 5px 8px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  font-family: var(--font-data);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  white-space: nowrap;
}
.speed-box::after { content: ""; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border: solid var(--text-dim); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); pointer-events: none; }
.speed-box:hover { border-color: var(--text-dim); }
.speed-box:has(select:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.speed-name { color: var(--text-dim); }
.speed-box select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: pointer; }

.status {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-family: var(--font-data);
  font-size: 13px;
  letter-spacing: 0.04em;
  transition: opacity 400ms ease;
}
.is-ready .status { opacity: 0; pointer-events: none; }
.status.is-error { color: #ffb4a0; max-width: min(90vw, 520px); line-height: 1.5; }

/* Hover / tap card */
.target-card .maplibregl-popup-content {
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: 0;
  padding: 10px 12px;
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.target-card .maplibregl-popup-tip { display: none; }
.target-card div { display: grid; gap: 2px; }
.target-card strong { font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase; }
.card-country { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.card-stats, .card-dates { font-family: var(--font-data); font-size: 12px; }
.card-stats { color: var(--accent); }
.card-dates { color: var(--text-dim); }

/* MapLibre controls, restyled to match */
.maplibregl-ctrl-group {
  background: var(--panel) !important;
  border: 1px solid var(--panel-border);
  border-radius: 0 !important;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--panel-border) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.85) sepia(0.3); }
.maplibregl-ctrl-top-right { right: calc(var(--gutter) - 10px); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--timeline-height) + var(--gutter) + 4px); right: calc(var(--gutter) - 10px); }
.maplibregl-ctrl-attrib {
  max-width: calc(100vw - 320px);
  background: rgba(14, 17, 12, 0.75) !important;
  color: var(--text-dim);
  font-family: var(--font-data);
  font-size: 10px;
}
.maplibregl-ctrl-attrib-inner { color: var(--text-dim); }
.maplibregl-ctrl-attrib a { color: var(--text); }
.maplibregl-ctrl-attrib-button { filter: invert(0.85); }

/* Toolbar: target search and filters (top right) */
.toolbar {
  top: var(--gutter);
  right: var(--gutter);
  display: flex;
  gap: 6px;
  padding: 6px;
}
.search { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 9px; width: 16px; height: 16px; fill: none; stroke: var(--text-dim); stroke-width: 2; pointer-events: none; }
#search {
  width: 220px;
  height: 34px;
  padding: 0 10px 0 32px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: 0;
  color: var(--text);
  font-family: var(--font-data);
  font-size: 13px;
}
#search::placeholder { color: var(--text-dim); }
#search:focus-visible, .filters-toggle:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.search-results {
  position: absolute;
  z-index: 7;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.search-results li { display: grid; gap: 1px; padding: 6px 12px; cursor: pointer; }
.search-results li[aria-selected="true"], .search-results li:hover { background: rgba(242, 163, 58, 0.14); }
.search-results li.is-muted .search-name { color: var(--text-dim); }
.search-name { font-size: 16px; font-weight: 600; }
.search-meta { font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }
.search-results .search-empty { cursor: default; font-family: var(--font-data); font-size: 12px; color: var(--text-dim); }
.filters-toggle {
  height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.filters-toggle.is-active { border-color: var(--accent); color: var(--accent); }
.filters-count:not(:empty) {
  min-width: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: var(--ink);
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

/* Filter popover */
.filters {
  z-index: 6;
  top: calc(var(--gutter) + 54px);
  right: var(--gutter);
  width: 340px;
  max-height: calc(100vh - var(--timeline-height) - var(--gutter) * 3 - 64px);
  overflow-y: auto;
  padding: 12px 16px 0;
  background: rgba(13, 16, 11, 0.97);
}
.filters[hidden] { display: none; }
.filters fieldset { margin: 0 0 12px; padding: 0; border: 0; }
.filters legend { margin-bottom: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); }
.filter-group { margin-bottom: 6px; }
.filter-head { display: flex; align-items: center; gap: 8px; }
.filters label { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 26px; font-size: 15px; cursor: pointer; }
.filters input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.filter-head .filter-name { font-weight: 600; }
.filter-count { margin-left: auto; font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }
.filter-items { padding-left: 22px; }
.filter-items label { font-size: 14px; min-height: 24px; }
.filter-only {
  padding: 1px 6px;
  background: none;
  border: 1px solid var(--panel-border);
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-dim);
  cursor: pointer;
}
.filter-only:hover { color: var(--text); border-color: var(--text-dim); }
.filters .filter-duplicates { padding-top: 10px; border-top: 1px solid var(--panel-border); }
.filter-hint { margin: 2px 0 0 23px; font-family: var(--font-data); font-size: 11px; line-height: 1.45; color: var(--text-dim); }
.filter-hint a { color: var(--text); text-decoration-color: var(--panel-border); text-underline-offset: 2px; }
.filter-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-dates legend { grid-column: 1 / -1; }
.filter-dates label { flex-direction: column; align-items: stretch; gap: 3px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.filter-dates input {
  padding: 5px 6px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--font-data);
  font-size: 12px;
  color-scheme: dark;
}
.filters-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 -16px;
  padding: 10px 16px 12px;
  background: rgba(13, 16, 11, 0.98);
  border-top: 1px solid var(--panel-border);
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text-dim);
}
.filters-footer button, .filter-status button {
  padding: 3px 10px;
  background: none;
  border: 1px solid var(--panel-border);
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
}
.filter-only:focus-visible, .filters-footer button:focus-visible, .filter-status button:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

/* "Showing N of M attacks" while filters are on */
.filter-status {
  top: calc(var(--gutter) + 54px);
  right: calc(var(--gutter) + 52px);
  margin: 0;
  padding: 5px 10px;
  border-color: var(--accent-muted);
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text);
}
.filter-status[hidden] { display: none; }
.filters:not([hidden]) ~ .filter-status { display: none; } /* the popover's footer says the same */

/* Dates outside the filter's range, shaded on the timeline */
.range-shade {
  position: absolute;
  top: 0;
  bottom: 15px;
  width: 0;
  pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(11, 13, 9, 0.72) 0 4px, rgba(11, 13, 9, 0.9) 4px 8px);
}
.range-before { left: 0; }
.range-after { right: 0; }
.chapter-tab:disabled { opacity: 0.3; cursor: default; background: none; }

/* Map controls sit under the toolbar */
.maplibregl-ctrl-top-right { top: calc(var(--gutter) + 44px); }

/* With the panel open, the toolbar, filters and status move left of it */
.panel-open .toolbar,
.panel-open .filters { right: calc(var(--panel-width) + var(--gutter) * 2); }
.panel-open .filter-status { right: calc(var(--panel-width) + var(--gutter) * 2 + 52px); }

/* Slide-out panel for one attack */
.panel {
  position: absolute;
  z-index: 4;
  top: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--timeline-height) + var(--gutter) * 1.5);
  width: var(--panel-width);
  display: flex;
  flex-direction: column;
  background: rgba(15, 18, 13, 0.96);
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--accent);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(calc(100% + var(--gutter) + 20px));
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.panel.is-open { transform: none; }
.panel-header { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 12px 52px 12px 18px; border-bottom: 1px solid var(--panel-border); }
.panel-header h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.05; }
.panel-header h2:focus { outline: none; }
.panel-header .eyebrow { margin: 0; }
.panel-country { margin: 0; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}
.panel-close svg { width: 16px; height: 16px; stroke: var(--text); stroke-width: 2; fill: none; }
.panel-close:hover { border-color: var(--text-dim); }
.panel-close:focus-visible, .list-item:focus-visible, .panel-back:focus-visible, .step:focus-visible,
.crumb:focus-visible, .more-button:focus-visible, .date-link:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }

/* Way back up: a back button, then the breadcrumb (Berlin › Daimler-Benz › 6 Oct 1944) */
.panel-back {
  justify-self: start;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 9px 3px 3px;
  background: none;
  border: 1px solid var(--panel-border);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
}
.panel-back[hidden] { display: none; }
.panel-back span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.panel-back svg, .step svg { flex: none; width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.panel-back:hover, .step:hover:not(:disabled) { border-color: var(--text-dim); }
.breadcrumb ol { display: flex; flex-wrap: wrap; row-gap: 2px; margin: 0; padding: 0; list-style: none; font-family: var(--font-data); font-size: 11px; line-height: 1.4; color: var(--text-dim); }
.breadcrumb li { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.breadcrumb li[aria-current] { color: var(--text); }
.breadcrumb li + li::before { content: "›"; margin: 0 5px; }
.crumb { padding: 0; background: none; border: 0; font: inherit; color: inherit; text-decoration: underline; text-decoration-color: var(--panel-border); text-underline-offset: 3px; cursor: pointer; }
.crumb:hover { color: var(--text); text-decoration-color: currentColor; }

/* Previous / next among siblings: ‹ Facility 3 of 11 › */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper[hidden] { display: none; }
.stepper-label { font-size: 12px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); font-variant-numeric: tabular-nums; }
.step { width: 26px; height: 24px; display: grid; place-items: center; padding: 0; background: none; border: 1px solid var(--panel-border); color: var(--text); cursor: pointer; }
.step:disabled { opacity: 0.3; cursor: default; }

.panel-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 14px 18px 16px; }
.panel-filter-note, .panel-empty { margin: 0; font-family: var(--font-data); font-size: 11px; color: var(--accent); }
.panel-empty { color: var(--text-dim); }
.panel-section h3 { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }

/* Label / value rows (facility, raid day and record facts) */
.facts { margin: 0; display: grid; gap: 7px; }
.fact { display: grid; grid-template-columns: 104px 1fr; gap: 12px; }
.fact dt { padding-top: 2px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.fact dd { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.fact-value { font-size: 16px; font-weight: 600; letter-spacing: 0.02em; }
.fact-note { flex-basis: 100%; font-family: var(--font-data); font-size: 11px; line-height: 1.45; color: var(--text-dim); }
.badge {
  padding: 0 5px;
  border: 1px solid var(--accent);
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
/* Suspected duplicate records: a badge linking to the record each one copies */
.duplicate-note { display: grid; justify-items: start; gap: 6px; padding: 8px 10px; border-left: 2px solid var(--accent); background: rgba(242, 163, 58, 0.06); }
.duplicate-note p { margin: 0; font-family: var(--font-data); font-size: 11px; line-height: 1.45; color: var(--text-dim); }
.badge-link { padding: 3px 7px; background: none; font-size: 11px; cursor: pointer; }
.badge-link::after { content: " ›"; }
.badge-link:hover { background: rgba(242, 163, 58, 0.14); }
.badge-link:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.panel-notes { margin: 0; padding: 8px 10px 8px 26px; border-left: 2px solid var(--accent-muted); font-family: var(--font-data); font-size: 11px; line-height: 1.5; color: var(--text-dim); }
.context { padding: 10px 12px; border: 1px dashed var(--panel-border); }
.context h3 { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.context p { margin: 0; font-family: var(--font-data); font-size: 12px; font-style: italic; color: var(--text-dim); }

/* City totals */
.panel-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.panel-stats dt { margin: 0 0 2px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.panel-stats dd { margin: 0; font-family: var(--font-data); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Attacks by air force: one thin bar each, colored by service like the planes */
.bars { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 14px; font-weight: 600; }
.bar-count { font-family: var(--font-data); font-size: 12px; font-weight: 400; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 4px; background: linear-gradient(currentColor, currentColor) 0 0 / var(--share) 100% no-repeat, var(--panel-border); color: var(--accent-muted); }
.bar-raf { color: var(--raf); }
.bar-usaaf { color: var(--usaaf); }

/* Attacks by year: a small column chart */
.years { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 92px; }
.year { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 3px; min-width: 0; }
.year-count { font-family: var(--font-data); font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.year-bar { align-self: end; width: 100%; height: max(var(--share), 1px); background: var(--accent); opacity: 0.85; }
.year.is-empty .year-bar { background: var(--panel-border); }
.year-label { font-family: var(--font-data); font-size: 11px; }

/* Lists to step down into: facilities, raid days, records */
.item-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--panel-border); }
.item-list li { border-bottom: 1px solid rgba(58, 64, 51, 0.5); }
.list-item {
  width: 100%;
  display: grid;
  gap: 1px;
  padding: 6px 26px 6px 8px;
  border: 0;
  border-left: 2px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.list-item::after { content: "›"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--text-dim); }
.list-item:hover { background: rgba(221, 213, 186, 0.06); }
.list-item:hover::after { color: var(--accent); }
.list-item[aria-current="true"] { border-left-color: var(--accent); background: rgba(242, 163, 58, 0.1); }
.list-primary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 15px; font-weight: 600; }
.list-secondary { font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }
.more-button, .date-link {
  width: 100%;
  padding: 8px;
  background: none;
  border: 0;
  font-family: var(--font-data);
  font-size: 12px;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
}
.more-button:hover, .date-link:hover { background: rgba(242, 163, 58, 0.08); }
.date-link { border: 1px solid var(--panel-border); }
.date-link::after { content: " ›"; }

/* Keep map controls clear of the open panel */
.panel-open .maplibregl-ctrl-top-right,
.panel-open .maplibregl-ctrl-bottom-right { right: calc(var(--panel-width) + var(--gutter) * 2 - 10px); }
.panel-open .maplibregl-ctrl-attrib { max-width: calc(100vw - var(--panel-width) - 330px); }
@media (min-width: 1001px) {
  .panel-open .stats { top: calc(var(--gutter) + 104px); left: var(--gutter); transform: none; }
}

/* Chapter title card */
.chapter-card {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - var(--gutter) * 2));
  max-height: calc(100vh - var(--timeline-height) - var(--gutter) * 4);
  overflow-y: auto;
  padding: 22px 26px 20px;
  background: rgba(13, 16, 11, 0.95);
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--accent);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  margin-top: calc(var(--timeline-height) / -2);
  animation: card-in 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.chapter-card[hidden] { display: none; }
.chapter-card:focus { outline: none; }
@keyframes card-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)); } }
.chapter-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}
.chapter-close svg { width: 16px; height: 16px; stroke: var(--text); stroke-width: 2; fill: none; }
.chapter-year { margin: 0; font-size: 72px; font-weight: 700; line-height: 0.9; letter-spacing: 0.02em; color: var(--accent); }
.chapter-title { margin: 6px 0 0; font-size: 26px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.chapter-title.is-placeholder { font-weight: 500; font-style: italic; text-transform: none; color: var(--text-dim); }
.chapter-narrative { margin: 10px 0 0; font-size: 17px; line-height: 1.4; }
.chapter-narrative.is-placeholder {
  padding: 8px 10px;
  border: 1px dashed var(--panel-border);
  font-family: var(--font-data);
  font-size: 12px;
  font-style: italic;
  color: var(--text-dim);
}
.chapter-sources { margin: 8px 0 0; }
.chapter-sources summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; list-style: none; cursor: pointer; }
.chapter-sources summary::-webkit-details-marker { display: none; }
.chapter-sources summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.chapter-sources .ai-note { margin: 0; }
.sources-toggle { font-family: var(--font-data); font-size: 11px; color: var(--accent); }
.sources-toggle::after { content: " ▸"; }
.chapter-sources[open] .sources-toggle::after { content: " ▾"; }
.chapter-sources .source-list { margin-top: 6px; }
.chapter-stats { margin: 14px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.chapter-stat dt, .chapter-card h3 { margin: 0 0 3px; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.chapter-stat dd { margin: 0; font-family: var(--font-data); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.chapter-stat .chapter-stat-note { font-size: 11px; font-weight: 400; color: var(--text-dim); }
.chapter-lists { margin-top: 14px; display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; }
.chapter-lists ol { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: 15px; }
.chapter-lists li::marker { font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }
.list-name { display: block; font-weight: 600; }
.list-detail { display: block; font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }
.chapter-services { margin-top: 12px; }
.service-bar { display: flex; height: 8px; gap: 2px; background: var(--panel-border); }
.service { min-width: 2px; }
.service-raf { background: var(--raf); }
.service-usaaf { background: var(--usaaf); }
.service-saaf, .service-unknown { background: var(--accent-muted); }
.service-legend { margin: 5px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }
.service-key::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; background: currentColor; vertical-align: 0; }
.service-key.service-raf, .service-key.service-usaaf, .service-key.service-saaf, .service-key.service-unknown { background: none; }
.service-key.service-raf::before { background: var(--raf); }
.service-key.service-usaaf::before { background: var(--usaaf); }
.service-key.service-saaf::before, .service-key.service-unknown::before { background: var(--accent-muted); }
.chapter-note { margin: 10px 0 0; font-family: var(--font-data); font-size: 11px; line-height: 1.5; color: var(--text-dim); }
/* The play button stays in view at the bottom of the card while the rest scrolls */
.chapter-actions {
  position: sticky;
  bottom: -20px;
  margin: 8px -26px -20px;
  padding: 14px 26px 20px;
  background: linear-gradient(to bottom, rgba(13, 16, 11, 0), rgba(13, 16, 11, 0.97) 35%);
}
.chapter-play {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px 10px 18px;
  border: 0;
  background: var(--accent);
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.chapter-play svg { width: 18px; height: 18px; fill: currentColor; }
.chapter-play:focus-visible, .chapter-close:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
/* Countdown before a chapter starts by itself: a bar filling along the button */
.chapter-play::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--ink); opacity: 0.45; }
.is-counting .chapter-play::after { animation: countdown var(--countdown, 7s) linear forwards; }
@keyframes countdown { to { width: 100%; } }

/* Year banner while playing freely through a new year */
.chapter-banner {
  position: absolute;
  z-index: 3;
  top: calc(var(--gutter) + 82px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.chapter-banner.is-showing { animation: banner 2.6s ease forwards; }
.banner-year { font-size: 54px; font-weight: 700; color: var(--accent); }
.banner-kicker { font-size: 18px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
@keyframes banner { 0% { opacity: 0; } 15%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* ---- Polish ---------------------------------------------------------- */

/* Corner brackets on heads-up panels, like a gunsight or cockpit display */
.hud:not(.filters)::after,
.panel::after {
  --bracket: rgba(242, 163, 58, 0.75);
  --arm: 10px;
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(var(--bracket), var(--bracket)) top left / var(--arm) 1px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) top left / 1px var(--arm) no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) top right / var(--arm) 1px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) top right / 1px var(--arm) no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom left / var(--arm) 1px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom left / 1px var(--arm) no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom right / var(--arm) 1px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) bottom right / 1px var(--arm) no-repeat;
}

/* Darkened edges and a faint film grain over the map (under the panels) */
.map-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 46%, transparent 55%, rgba(4, 5, 3, 0.62) 100%);
}
.map-vignette::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  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%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Gentle feedback on every control */
button, select, input { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 100ms ease; }
.play:hover, .chapter-play:hover { filter: brightness(1.08); }
.play:active, .chapter-play:active { transform: scale(0.97); }
.filters-toggle:hover, .panel-close:hover, .chapter-close:hover { border-color: var(--text-dim); }

/* Pop-overs appear rather than snap */
.filters:not([hidden]), .search-results:not([hidden]) { animation: pop-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } }

/* Collapsible legend */
.legend-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0 0 6px;
  padding: 0;
  background: none;
  border: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
}
.legend-toggle::after { content: "–"; font-family: var(--font-data); }
.legend.is-collapsed .legend-toggle { margin: 0; }
.legend.is-collapsed .legend-toggle::after { content: "+"; }
.legend.is-collapsed .legend-body { display: none; }
.legend-toggle:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Date under the pointer while hovering the timeline */
.track-hint {
  position: absolute;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 3px 8px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  font-family: var(--font-data);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.track-hint[hidden] { display: none; }

/* Loading screen */
.status:not(.is-error) { padding: 16px 22px 18px; text-align: center; }
.status:not(.is-error)::before {
  content: "Air War Over Europe";
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status:not(.is-error)::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 12px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 40% 100% no-repeat, var(--panel-border);
  animation: loading 1.2s ease-in-out infinite;
}
@keyframes loading { from { background-position: -40% 0, 0 0; } to { background-position: 140% 0, 0 0; } }

@media (prefers-reduced-motion: reduce) {
  body:not(.has-played) .play { animation: none; }
  .panel { transition: none; }
  .chapter-card, .filters:not([hidden]), .search-results:not([hidden]) { animation: none; }
  .status:not(.is-error)::after { animation: none; }
}

/* Narrower screens: totals move under the title */
@media (max-width: 1100px) {
  .stats { top: calc(var(--gutter) + 104px); left: var(--gutter); transform: none; }
  .chapter-banner { top: calc(var(--gutter) + 180px); }
}

/* Tablets and phones: timeline on two rows (controls, then the scrubber) */
@media (max-width: 1000px) {
  .timeline { grid-template-columns: auto 168px minmax(0, 1fr) auto; gap: 12px; }
  .now-date { font-size: 19px; }
  .speed-caption, .speed-name { display: none; }
}

/* Phones: title and totals on top, timeline at the bottom, map in between */
@media (max-width: 700px) {
  :root { --gutter: 10px; }
  .title-block { right: var(--gutter); padding: 10px 14px; }
  h1 { font-size: 24px; }
  .eyebrow { font-size: 10px; }
  .date-range, .about-long { display: none; }
  .about-short { display: inline; }
  .title-meta { position: absolute; right: 14px; bottom: 12px; margin: 0; } /* level with the title, clear of the eyebrow */
  .eyebrow-more { display: none; } /* "Western Allied air operations" fits on one line */
  .stats {
    top: calc(var(--gutter) + 66px);
    right: var(--gutter);
    justify-content: space-around;
    gap: 8px;
    padding: 6px 10px;
  }
  .stat-value { font-size: 16px; }
  .stat-label { font-size: 10px; }
  .legend {
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    bottom: calc(var(--timeline-height) + var(--gutter) * 1.5);
    padding: 5px 10px;
  }
  .legend h2, .legend ul, .legend-toggle { display: none; }
  .legend.is-collapsed .legend-body { display: block; } /* phones show just the short note */
  .legend-note { font-size: 10px; }
  /* Timeline on two rows: buttons and date, then the strip and speed */
  .timeline {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "transport now now" "track track speed";
    grid-template-rows: 46px 52px;
    gap: 10px 10px;
    padding: 6px 10px;
  }
  .transport { grid-area: transport; }
  .now { grid-area: now; }
  .track { grid-area: track; }
  .speed { grid-area: speed; align-self: start; }
  .now-date { font-size: 18px; }
  .maplibregl-ctrl-top-right { top: calc(var(--gutter) + 170px); }
  .toolbar { top: calc(var(--gutter) + 116px); left: var(--gutter); }
  .search { flex: 1; }
  #search { width: 100%; }
  .search-results { left: 0; right: auto; width: calc(100vw - var(--gutter) * 2 - 12px); }
  .filters { top: calc(var(--gutter) + 166px); left: var(--gutter); width: auto; max-height: 52vh; }
  .filter-status { top: calc(var(--gutter) + 166px); left: var(--gutter); right: auto; }
  /* While the details sheet is up, give the map the room between title and sheet */
  .panel-open .toolbar, .panel-open .filters, .panel-open .filter-status { display: none; }
  .maplibregl-ctrl-bottom-right { bottom: calc(var(--timeline-height) + var(--gutter) * 1.5 + 30px); }
  .maplibregl-ctrl-attrib { max-width: none; }
  .panel {
    top: auto;
    left: var(--gutter);
    width: auto;
    height: min(50vh, 460px);
    transform: translateY(calc(100% + var(--timeline-height) + var(--gutter) * 3));
  }
  .panel-header h2 { font-size: 22px; }
  .panel-open .stats, .panel-open .legend { display: none; } /* give the map room while the sheet is up */
  .panel-open .maplibregl-ctrl-top-right,
  .panel-open .maplibregl-ctrl-bottom-right { right: calc(var(--gutter) - 10px); }
  .panel-open .maplibregl-ctrl-attrib { max-width: none; }
  .fact { grid-template-columns: 92px 1fr; }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .chapter-card { padding: 16px 16px 14px; }
  .chapter-actions { bottom: -14px; margin: 8px -16px -14px; padding: 12px 16px 14px; }
  .chapter-year { font-size: 56px; }
  .chapter-title { font-size: 20px; }
  .chapter-stats { grid-template-columns: repeat(2, 1fr); }
  .chapter-lists { grid-template-columns: 1fr; gap: 12px; }
  .chapter-play { width: 100%; justify-content: center; font-size: 16px; }
  .chapter-banner { top: calc(var(--gutter) + 130px); }
  .banner-year { font-size: 40px; }

  /* Touch targets: nothing important smaller than about a fingertip */
  :root { --timeline-height: 120px; }
  .event-markers { --bars-height: 24px; }
  .day-step { width: 38px; height: 38px; }
  .track { height: 52px; }
  #activity { inset: 2px 0 26px; height: calc(100% - 28px); }
  #scrubber { inset: 0 0 24px; height: calc(100% - 24px); }
  .range-shade, .month-hover { bottom: 24px; }
  .chapters, .chapter-tab { height: 24px; }
  .chapter-tab { line-height: 24px; padding-left: 2px; font-size: 10px; letter-spacing: -0.03em; } /* the short 1939 tab still fits ’39 */
  .speed-box { min-height: 40px; align-items: center; padding-top: 0; padding-bottom: 0; }
  .now-day { white-space: normal; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .maplibregl-ctrl-group button { width: 38px; height: 38px; }
  #search, .filters-toggle { height: 40px; }
  .filters label { min-height: 36px; }
  .filter-items label { min-height: 34px; }
  .filter-only, .filters-footer button, .filter-status button { min-height: 32px; padding: 4px 12px; }
  .maplibregl-ctrl-top-right { top: calc(var(--gutter) + 178px); }
  .filters, .filter-status { top: calc(var(--gutter) + 172px); }
  .maplibregl-ctrl-bottom-right { bottom: calc(var(--timeline-height) + var(--gutter) * 1.5 + 62px); } /* above the legend note */
}
