:root {
  --paper: #f7f2e8;
  --paper-strong: #fcf8f0;
  --ink: #2a241c;
  --muted: #6d6355;
  --faint: #918675;
  --line: rgba(42, 36, 28, 0.15);
  --line-strong: rgba(42, 36, 28, 0.3);
  --oxide: #a33a1f;
  --oxide-dark: #7a1f14;
  --teal: #1d5f57;
  --indigo: #3f4a78;
  --sand: #c9b28a;
  --amber: #8a5a2b;
  --sea: #cfe1e6;
  --shadow: 0 12px 34px rgba(49, 38, 22, 0.14), 0 2px 8px rgba(49, 38, 22, 0.08);
  --radius: 12px;
  --header-h: 76px;
  --panel-w: 318px;
  --detail-w: 392px;
  --timeline-h: 206px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  transform: none;
}

.eyebrow {
  margin: 0 0 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Header ------------------------------------------------------------------ */

.site-header {
  position: relative;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 18px 0 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 260px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--oxide);
  border-radius: 50%;
  color: var(--oxide);
  font-size: 15px;
  transform: rotate(45deg);
}

.brand__text h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand__text p {
  margin: 3px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.015em;
}

.header-stats {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 0;
}

.header-stat {
  padding: 0 18px;
  border-left: 1px solid var(--line);
}

.header-stat dt {
  margin: 0;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.header-stat dd {
  margin: 1px 0 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.filters-toggle {
  display: none;
  align-items: center;
  gap: 6px;
}

.filter-badge {
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--oxide);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: #17130e;
}

.btn--ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn--ghost:hover {
  background: rgba(42, 36, 28, 0.06);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.icon-btn:hover {
  background: rgba(42, 36, 28, 0.06);
}

.play-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.play-btn:hover {
  transform: scale(1.05);
  background: #17130e;
}

.play-btn__icon {
  display: block;
  transform: translateX(1px);
}

.play-btn.is-playing .play-btn__icon {
  transform: none;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal);
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.link:hover {
  color: var(--oxide);
}

/* Layout ------------------------------------------------------------------ */

.app {
  position: relative;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
}

.map {
  position: absolute;
  inset: 0;
  background: var(--sea);
}

.map .maplibregl-ctrl-top-right {
  top: 10px;
  right: 10px;
}

.map .maplibregl-ctrl-bottom-right {
  bottom: calc(var(--timeline-h) + 12px);
  right: 8px;
}

.map .maplibregl-ctrl-attrib {
  font-size: 9.5px;
  background: rgba(247, 242, 232, 0.82);
  color: var(--muted);
}

.map .maplibregl-ctrl-attrib a {
  color: var(--muted);
}

.map .maplibregl-ctrl-group {
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(42, 36, 28, 0.12);
  background: rgba(252, 248, 240, 0.94);
}

.panel {
  position: absolute;
  z-index: 5;
  background: rgba(250, 246, 238, 0.955);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Filters ----------------------------------------------------------------- */

.filters {
  top: 14px;
  left: 14px;
  bottom: calc(var(--timeline-h) + 14px);
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--line);
}

.panel__head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.filters__close {
  display: none;
  border: 0;
  font-size: 23px;
}

.filters-backdrop {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  padding: 0;
  border: 0;
  background: rgba(28, 22, 14, 0.35);
  backdrop-filter: blur(1px);
}

body.filters-open .filters-backdrop {
  display: block;
}

.panel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 8px 14px 0;
  border-bottom: 1px solid var(--line);
}

.panel-tab {
  padding: 7px 4px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.panel-tab:hover {
  color: var(--ink);
}

.panel-tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--oxide);
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 15px;
  padding: 0 4px;
  margin-left: 3px;
  border-radius: 8px;
  background: rgba(42, 36, 28, 0.1);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0;
}

.filters__scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 14px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(42, 36, 28, 0.25) transparent;
}

.event-index-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.event-index-pane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 7px;
  border-bottom: 1px solid var(--line);
}

.event-index-pane__head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
}

.event-index-pane .event-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(42, 36, 28, 0.25) transparent;
}

.event-index-pane .empty {
  padding: 0 14px;
}

.filter-block {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.filter-block:last-of-type {
  border-bottom: 0;
}

.filter-label {
  display: block;
  margin-bottom: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(42, 36, 28, 0.035);
}

.segmented__btn {
  padding: 6px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.segmented__btn:hover {
  color: var(--ink);
}

.segmented__btn.is-active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 1px 3px rgba(42, 36, 28, 0.2);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  cursor: pointer;
}

.check input {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  accent-color: var(--oxide);
  flex: 0 0 auto;
}

.hint {
  margin: 6px 0 0;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--faint);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.filter-grid label {
  min-width: 0;
}

.filter-grid select {
  width: 100%;
  padding: 6px 24px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-strong);
  font-size: 11.5px;
}

.legend {
  display: grid;
  gap: 6px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.legend__row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  color: var(--muted);
}

.legend__mark {
  position: relative;
  display: block;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--oxide);
  box-shadow: 0 0 0 1px rgba(42, 36, 28, 0.35);
}

.legend__mark--other {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--teal);
  transform: rotate(45deg);
}

.legend__mark--major {
  background: var(--oxide);
  box-shadow: 0 0 0 1px var(--oxide), 0 0 0 3px rgba(163, 58, 31, 0.28);
}

.legend__mark--month::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--paper);
}

.legend__mark--year {
  background: transparent;
  border: 2px solid var(--oxide);
}

.legend__mark--offshore {
  width: 13px;
  height: 12px;
  border: 0;
  border-radius: 0;
  background: var(--indigo);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  box-shadow: none;
}

.legend__mark--low {
  background: transparent;
  border: 2px dashed var(--oxide);
}

.legend__line {
  width: 15px;
  height: 0;
  flex: 0 0 auto;
  border-top: 2px dashed var(--amber);
}

.legend__action {
  justify-self: start;
  margin-top: 2px;
  font-size: 10px;
}

.filter-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0 5px;
  font-size: 11px;
}

.filter-result strong {
  font-size: 11.5px;
}

.filter-result .link {
  font-size: 10.5px;
}

.event-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-list li {
  border-bottom: 1px solid rgba(42, 36, 28, 0.09);
}

.event-list button {
  width: 100%;
  padding: 8px 7px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  text-align: left;
}

.event-list button:hover {
  background: rgba(42, 36, 28, 0.045);
}

.event-list button.is-selected {
  border-left-color: var(--oxide);
  background: rgba(163, 58, 31, 0.06);
}

.event-list__date {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.event-list__place {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
}

.event-list__casualty {
  display: block;
  color: var(--faint);
  font-size: 10px;
}

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

.empty {
  margin: 12px 0;
  font-size: 11.5px;
  color: var(--faint);
  font-style: italic;
}

/* Map markers ------------------------------------------------------------- */

.event-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.event-marker__shape {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--paper-strong);
  border-radius: 50%;
  background: var(--marker);
  box-shadow: 0 1px 5px rgba(42, 36, 28, 0.4);
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.event-marker--factory {
  --marker: var(--oxide);
}

.event-marker--other {
  --marker: var(--teal);
}

.event-marker--other .event-marker__shape {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  transform: rotate(45deg);
}

.event-marker--offshore {
  --marker: var(--indigo);
}

.event-marker--offshore .event-marker__shape {
  width: 14px;
  height: 13px;
  border: 0;
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 0 1px var(--paper-strong)) drop-shadow(0 1px 2px rgba(42, 36, 28, 0.5));
}

.event-marker--major .event-marker__shape {
  box-shadow: 0 0 0 2px rgba(247, 242, 232, 0.94), 0 0 0 3.5px var(--marker),
    0 0 0 6px rgba(163, 58, 31, 0.18), 0 1px 6px rgba(42, 36, 28, 0.4);
}

.event-marker--month .event-marker__shape::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--paper-strong);
}

.event-marker--year .event-marker__shape {
  background: transparent;
  border: 2.5px solid var(--marker);
  box-shadow: 0 0 0 1px var(--paper-strong), 0 1px 4px rgba(42, 36, 28, 0.3);
}

.event-marker--low {
  opacity: 0.72;
}

.event-marker--low .event-marker__shape {
  border-style: dashed;
}

.event-marker:hover,
.event-marker:focus-visible {
  transform: scale(1.2);
  z-index: 5;
}

.event-marker:hover .event-marker__shape,
.event-marker:focus-visible .event-marker__shape {
  box-shadow: 0 0 0 2px var(--paper-strong), 0 0 0 4px var(--marker),
    0 2px 8px rgba(42, 36, 28, 0.45);
}

.event-marker.is-selected {
  transform: scale(1.35);
  z-index: 10;
}

.event-marker.is-selected .event-marker__shape {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--paper-strong),
    0 0 0 6px var(--marker), 0 2px 10px rgba(42, 36, 28, 0.45);
}

.locality-label {
  font-family: var(--font-ui);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #5d5345;
  white-space: nowrap;
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 5px var(--paper);
  transition: opacity 0.2s ease;
  user-select: none;
}

.region-label {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: rgba(63, 53, 38, 0.55);
  text-shadow: 0 0 4px var(--paper), 0 0 6px var(--paper);
  user-select: none;
}

/* Detail ------------------------------------------------------------------ */

.detail {
  top: 14px;
  right: 14px;
  bottom: calc(var(--timeline-h) + 14px);
  width: var(--detail-w);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.detail.is-open {
  animation: detail-in 0.22s ease-out;
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.detail__head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 248, 240, 0.7);
}

.detail__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.detail__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.badge--factory {
  border-color: rgba(163, 58, 31, 0.35);
  background: rgba(163, 58, 31, 0.08);
  color: var(--oxide-dark);
}

.badge--other {
  border-color: rgba(29, 95, 87, 0.35);
  background: rgba(29, 95, 87, 0.08);
  color: var(--teal);
}

.badge--major {
  border-color: rgba(122, 31, 20, 0.4);
  background: rgba(122, 31, 20, 0.1);
  color: var(--oxide-dark);
}

.detail__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.detail__place {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.detail__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 20px;
  scrollbar-width: thin;
}

.detail__precision {
  margin: 0 0 12px;
  padding: 7px 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-size: 10.5px;
  color: var(--muted);
}

.detail__summary {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: 15.5px;
  line-height: 1.55;
}

.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 6px;
}

.detail__casualty-note {
  margin: 0 0 14px;
  font-size: 9.5px;
}

.detail-stat {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(252, 248, 240, 0.6);
}

.detail-stat dt {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-stat dd {
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-size: 25px;
  line-height: 1;
}

.detail-stat dd.is-unknown {
  font-family: var(--font-ui);
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.3;
}

.callout {
  margin: 0 0 12px;
  padding: 10px 11px;
  border-left: 3px solid var(--line-strong);
  background: rgba(42, 36, 28, 0.035);
  border-radius: 0 7px 7px 0;
}

.callout--major {
  border-left-color: var(--oxide);
  background: rgba(163, 58, 31, 0.055);
}

.callout--extent {
  border-left-color: var(--amber);
  background: rgba(138, 90, 43, 0.06);
}

.callout--conflict {
  border-left-color: #a57a1f;
  background: rgba(165, 122, 31, 0.075);
}

.callout h4 {
  margin: 0 0 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.callout p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
}

.detail-section {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-section h4 {
  margin: 0 0 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-section p {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.55;
}

.observation {
  margin: 0 0 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.observation__type {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--teal);
}

.observation__type span:last-child {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--faint);
}

.observation p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.source-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  margin: 0 0 8px;
  padding-left: 12px;
  position: relative;
  font-size: 11px;
  line-height: 1.45;
}

.source-list li::before {
  content: "↗";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--faint);
  font-size: 9px;
}

.source-list a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.source-list a:hover {
  color: var(--oxide);
}

.source-list .source-meta {
  display: block;
  color: var(--faint);
  font-size: 10px;
}

.detail__actions {
  display: flex;
  gap: 7px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: rgba(252, 248, 240, 0.7);
}

.detail__actions .btn {
  flex: 1;
  font-size: 10.5px;
}

.detail__actions .icon-btn {
  flex: 0 0 auto;
}

/* Timeline ---------------------------------------------------------------- */

.timeline-panel {
  left: 14px;
  right: 14px;
  bottom: 14px;
  height: var(--timeline-h);
  padding: 8px 14px 8px;
  display: flex;
  flex-direction: column;
  z-index: 8;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 44px;
}

.transport {
  display: flex;
  align-items: center;
  gap: 5px;
}

.transport .icon-btn {
  border-color: transparent;
  font-size: 22px;
}

.transport .icon-btn:hover {
  border-color: var(--line);
}

.timeline-readout {
  min-width: 185px;
}

.timeline-readout .eyebrow {
  margin-bottom: 1px;
  font-size: 8px;
}

.timeline-readout strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.speed {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(42, 36, 28, 0.035);
}

.speed button {
  min-width: 30px;
  padding: 4px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.speed button:hover {
  color: var(--ink);
}

.speed button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

#show-all {
  margin-left: auto;
  font-size: 10.5px;
}

.timeline {
  position: relative;
  flex: 1;
  min-height: 112px;
  margin: 0 -2px;
}

.timeline-svg {
  display: block;
  width: 100%;
  height: 118px;
  overflow: visible;
}

.timeline-band-label {
  font-family: var(--font-ui);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  fill: var(--faint);
}

.timeline-baseline {
  stroke: var(--line);
  stroke-width: 1;
}

.timeline-axis text {
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  fill: var(--muted);
}

.timeline-event line {
  stroke-linecap: round;
}

.timeline-playhead {
  pointer-events: none;
}

.timeline-range {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 54px;
  height: 30px;
  width: auto;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
  z-index: 6;
}

.timeline-range::-webkit-slider-runnable-track {
  height: 30px;
  background: transparent;
}

.timeline-range::-moz-range-track {
  height: 30px;
  background: transparent;
}

.timeline-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 2px;
  height: 30px;
  background: transparent;
  border: 0;
}

.timeline-range::-moz-range-thumb {
  width: 2px;
  height: 30px;
  background: transparent;
  border: 0;
}

.timeline-range:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 5px;
}

.timeline-tooltip {
  position: absolute;
  z-index: 20;
  max-width: 250px;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10.5px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.12s ease;
  box-shadow: 0 6px 18px rgba(42, 36, 28, 0.25);
}

.timeline-tooltip strong {
  font-size: 11px;
}

.timeline-caption,
.timeline-disclaimer {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.35;
  color: var(--faint);
}

.timeline-caption .link {
  font-size: 9.5px;
  font-weight: 600;
}

.timeline-caption .attribution {
  margin-left: 4px;
  white-space: nowrap;
}

.timeline-caption .attribution a {
  color: inherit;
  text-underline-offset: 2px;
}

.timeline-disclaimer {
  margin-top: 2px;
  color: var(--muted);
}

/* About ------------------------------------------------------------------- */

.about {
  width: min(780px, calc(100vw - 32px));
  max-height: 88dvh;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(20, 15, 9, 0.35);
}

.about::backdrop {
  background: rgba(28, 22, 14, 0.5);
  backdrop-filter: blur(3px);
}

.about__inner {
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.about__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 242, 232, 0.97);
  backdrop-filter: blur(8px);
}

.about__head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.about__body {
  padding: 4px 24px 30px;
}

.about__lede {
  font-size: 14.5px;
  line-height: 1.6;
}

.about__context {
  padding: 11px 13px;
  border-left: 3px solid var(--oxide);
  background: rgba(163, 58, 31, 0.055);
  border-radius: 0 7px 7px 0;
}

.about__body p {
  font-size: 12.5px;
  line-height: 1.62;
  color: #463d31;
}

.about__body h3 {
  margin: 26px 0 7px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.about__body ul {
  margin: 8px 0 12px;
  padding-left: 18px;
}

.about__body li {
  margin: 0 0 5px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #463d31;
}

.about__body code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(42, 36, 28, 0.07);
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0 8px;
}

.about-stat {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.about-stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}

.about-stat span {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.coverage-table {
  margin: 10px 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.coverage-row {
  display: grid;
  grid-template-columns: 95px 150px 1fr;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.4;
}

.coverage-row:last-child {
  border-bottom: 0;
}

.coverage-row--head {
  background: rgba(42, 36, 28, 0.05);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.coverage-row span:nth-child(2) {
  font-weight: 600;
}

.coverage-row span:nth-child(3) {
  color: var(--muted);
}

.about__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}

.about__provenance {
  padding: 10px 12px;
  border-left: 3px solid var(--sand);
  background: rgba(201, 178, 138, 0.13);
  border-radius: 0 7px 7px 0;
}

.about__version {
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 10px !important;
  color: var(--faint) !important;
  font-variant-numeric: tabular-nums;
}

.shortcuts {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
}

.shortcuts div {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.shortcuts dt {
  min-width: 90px;
  margin: 0;
}

.shortcuts dd {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper-strong);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
}

/* Toast ------------------------------------------------------------------- */

@media (min-width: 901px) {
  body.detail-open .maplibregl-ctrl-top-right {
    right: calc(var(--detail-w) + 28px);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--timeline-h) + 34px);
  z-index: 120;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(42, 36, 28, 0.3);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast--error {
  background: #7a1f14;
}

.fatal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(520px, calc(100vw - 40px));
  transform: translate(-50%, -50%);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.fatal h2 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
}

.fatal p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.fatal code {
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(42, 36, 28, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  margin: 0;
  background: var(--paper);
  font-family: var(--font-serif);
  font-size: 20px;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1240px) {
  :root {
    --panel-w: 296px;
    --detail-w: 360px;
  }

  .header-stat {
    padding: 0 13px;
  }

  .brand {
    min-width: 230px;
  }
}

@media (max-width: 1060px) {
  .header-stat:nth-child(3) {
    display: none;
  }

  .header-stat {
    padding: 0 11px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 62px;
    --timeline-h: 190px;
  }

  .site-header {
    gap: 10px;
    padding: 0 12px;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .brand__mark {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .brand__text h1 {
    font-size: 19px;
  }

  .brand__text p {
    display: none;
  }

  .header-stats {
    gap: 0;
  }

  .header-stat {
    padding: 0 9px;
  }

  .header-stat:nth-child(n + 3) {
    display: none;
  }

  .header-stat dt {
    font-size: 7px;
    letter-spacing: 0.07em;
  }

  .header-stat dd {
    font-size: 17px;
  }

  .header-actions {
    gap: 5px;
  }

  .header-actions .btn {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 10.5px;
  }

  .filters-toggle {
    display: inline-flex;
  }

  .filters {
    top: 0;
    left: 0;
    bottom: 0;
    width: min(342px, 88vw);
    border-radius: 0 14px 14px 0;
    transform: translateX(-104%);
    transition: transform 0.24s ease;
    z-index: 60;
  }

  .filters-backdrop {
    z-index: 59;
  }

  body.filters-open .filters {
    transform: none;
  }

  .filters__close {
    display: inline-grid;
  }

  .detail {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 76dvh;
    border-radius: 16px 16px 0 0;
    z-index: 55;
    animation: detail-up 0.24s ease-out;
  }

  @keyframes detail-up {
    from {
      transform: translateY(100%);
    }
    to {
      transform: none;
    }
  }

  .timeline-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 6px 10px 7px;
    height: var(--timeline-h);
  }

  .timeline-controls {
    gap: 9px;
    min-height: 40px;
  }

  .timeline-readout {
    min-width: 0;
    flex: 1;
  }

  .timeline-readout strong {
    font-size: 13.5px;
  }

  .transport .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 20px;
  }

  .play-btn {
    width: 36px;
    height: 36px;
  }

  .speed button {
    min-width: 25px;
    font-size: 9.5px;
  }

  #show-all {
    display: none;
  }

  .timeline-svg {
    height: 118px;
  }

  .timeline-caption {
    font-size: 8.5px;
  }

  .timeline-disclaimer {
    display: none;
  }

  .timeline-range {
    top: 54px;
    height: 30px;
  }

  .timeline-tooltip {
    display: none;
  }

  @media (min-width: 901px) {
  body.detail-open .maplibregl-ctrl-top-right {
    right: calc(var(--detail-w) + 28px);
  }
}

.toast {
    bottom: calc(var(--timeline-h) + 20px);
  }

  .about {
    width: calc(100vw - 16px);
    max-height: 92dvh;
  }

  .about__inner {
    max-height: 92dvh;
  }

  .about__head {
    padding: 14px 16px 12px;
  }

  .about__head h2 {
    font-size: 21px;
  }

  .about__body {
    padding: 2px 16px 24px;
  }

  .about-stats {
    grid-template-columns: 1fr 1fr;
  }

  .coverage-row {
    grid-template-columns: 78px 1fr;
    gap: 4px 10px;
  }

  .coverage-row span:nth-child(3) {
    grid-column: 1 / -1;
  }

  .coverage-row--head span:nth-child(3) {
    display: none;
  }
}

@media (max-width: 640px) {
  .header-stats {
    display: none;
  }

  .about-btn__long {
    display: none;
  }

  .brand__text h1 {
    font-size: 18px;
  }

  .header-actions .btn {
    font-size: 10px;
  }

  .header-actions #about-btn {
    padding: 5px 7px;
  }

  .timeline-readout .eyebrow {
    font-size: 7px;
  }

  .timeline-readout strong {
    font-size: 12.5px;
  }

  .speed {
    display: none;
  }

  .detail__title {
    font-size: 21px;
  }

  .detail-stats {
    gap: 6px;
  }
}

@media (max-height: 720px) and (min-width: 901px) {
  :root {
    --timeline-h: 190px;
  }

  .timeline-caption,
  .timeline-disclaimer {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
