/* /map/ only: the page around the map, and Leaflet restyled in the site's
   tokens. Pin and key styles are shared with the home page, in site.css. */

.map-page .page-title {
  font-size: var(--step-4);
  margin: var(--sp-3) 0 var(--sp-4);
}
.map-page .page-lede {
  max-width: 68ch;
  color: var(--ink-muted);
  margin-bottom: var(--sp-5);
}

/* ---- toolbar (shown by map.js; without JS there is nothing to filter) ---- */
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-5);
  margin-bottom: var(--sp-4);
}
.map-toolbar[hidden] {
  display: none;
}
.map-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.map-chip,
.map-play {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--ink-faint);
  cursor: pointer;
}
.map-chip[aria-pressed='true'] {
  color: var(--ink);
  border-color: var(--ink-faint);
}
.map-chip[aria-pressed='false'] {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.map-chip:hover,
.map-play:hover {
  border-color: var(--accent);
}
.map-play {
  color: var(--ink);
  border-color: var(--ink-faint);
  min-width: 5.5rem;
}
.map-play[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.map-years {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.map-years input[type='range'] {
  width: clamp(8rem, 22vw, 14rem);
  accent-color: var(--marking);
}
.map-years label {
  white-space: nowrap;
}
.map-years output {
  font-weight: 600;
  color: var(--ink);
  min-width: 4ch;
}
.map-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink-faint);
}

/* ---- the map ---- */
.map-stage {
  background: var(--map-sea);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
/* Without JS the stage holds the static SVG at its own proportions. */
.map-stage:not(.is-live) {
  padding: clamp(var(--sp-2), 2vw, var(--sp-4));
}
.map-stage.is-live {
  /* Roughly the world's proportions on a phone, most of the screen on a desktop. */
  height: clamp(20rem, min(68vh, 62vw), 44rem);
}

.map-below {
  display: grid;
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}
@media (min-width: 48rem) {
  .map-below {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: var(--sp-7);
  }
  .map-below .map-key {
    grid-template-columns: 1fr 1fr;
  }
}
.map-notes p {
  font-size: var(--step--1);
  color: var(--ink-muted);
  max-width: 62ch;
}

.map-list {
  margin-top: var(--sp-6);
  border-top: 1px solid var(--rule-soft);
  padding-top: var(--sp-4);
}
.map-list summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--accent-ink);
}
.map-list .data-table-wrap {
  margin-top: var(--sp-4);
}
.map-list td a {
  color: var(--ink);
}

/* ---- Leaflet, in the site's clothes ---- */
.leaflet-container {
  background: var(--map-sea);
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--ink);
}
.leaflet-container a {
  color: var(--accent-ink);
}
.map-land-path {
  fill: var(--map-land);
  fill-opacity: 1;
  stroke: var(--map-coast);
  stroke-width: 0.8;
  stroke-opacity: 1;
}

/* Markers are divIcons holding the same SVG glyph as the static map. */
.map-marker {
  background: none;
  border: 0;
}
.map-marker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.map-marker:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 50%;
}
.map-marker:hover .pin {
  stroke-width: 2;
}

/* Airport codes beside the pins, once zoomed in far enough to read them. */
.leaflet-tooltip.map-label {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-shadow: 0 0 3px var(--map-land), 0 0 3px var(--map-land), 0 0 2px var(--map-land);
  display: none;
}
.leaflet-tooltip.map-label::before {
  display: none;
}
.show-labels .leaflet-tooltip.map-label {
  display: block;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-raised);
  color: var(--ink);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.leaflet-popup-content-wrapper {
  border: 1px solid var(--rule);
}
.leaflet-popup-content {
  margin: var(--sp-4);
  line-height: 1.45;
}
.leaflet-container a.leaflet-popup-close-button {
  color: var(--ink-faint);
}
.map-pop h2 {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 700;
  margin: 0 1.2rem var(--sp-3) 0;
}
.map-pop h2 span {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink-faint);
  margin-left: 0.35rem;
}
.map-pop ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.map-pop li + li {
  border-top: 1px solid var(--rule-soft);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
}
.map-pop .pop-system {
  font-weight: 600;
}
.map-pop .pop-meta {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.15rem 0 0.35rem;
}
.map-pop .pop-status {
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.map-pop .pop-status .status-pill {
  white-space: normal;
  margin-bottom: 0.2rem;
}
.map-pop .pop-links {
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--step--2);
}

.leaflet-bar a,
.leaflet-bar a:hover {
  background: var(--bg-raised);
  color: var(--ink);
  border-bottom-color: var(--rule);
}
.leaflet-bar {
  border: 1px solid var(--rule) !important;
  box-shadow: none !important;
}
.leaflet-container .leaflet-control-attribution {
  background: color-mix(in srgb, var(--bg-raised) 85%, transparent);
  color: var(--ink-faint);
  font-size: 0.68rem;
}
