/* Front-page activity map (built only with --map). */
.map-section {
  width: 100%;
  margin: 0 auto 2.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.map-heading {
  font-size: 1.05rem;
  margin: 0;
  padding: 0.8rem 1.5rem;
}

.map-frame {
  position: relative;
}

.live-map {
  height: 70vh;
  min-height: 360px;
  max-height: 820px;
  background: #070d24;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 600px) {
  .live-map {
    height: 60vh;
    min-height: 300px;
  }
}

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

.live-map .basemap-land {
  fill: #16214a;
  stroke: #2a3666;
}

.live-map .map-node {
  fill: var(--accent-strong);
  fill-opacity: 1;
  stroke: #0a1230;
  stroke-width: 1;
}

/* A live pulse: a solid violet core on the node and a violet ring that
 * ripples outward, so a single event stands out among the dots. Both, and
 * the lines, stay strong for most of the event's remaining life and fade
 * only at its end (map.js runs that fade). */
.live-map .map-pulse-core {
  fill: var(--accent);
  fill-opacity: 1;
  stroke: var(--text);
  stroke-width: 1.5;
}

.live-map .map-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  animation: map-ripple 1.8s ease-out infinite;
}

.live-map .map-pulse-still {
  animation: none;
  stroke-opacity: 0.8;
}

@keyframes map-ripple {
  0% {
    transform: scale(0.25);
    stroke-opacity: 1;
  }
  100% {
    transform: scale(1);
    stroke-opacity: 0;
  }
}


.live-map .map-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-opacity: 0.95;
  stroke-linecap: round;
}

.live-map .map-line-still {
  animation: none;
  stroke-opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .live-map .map-pulse {
    animation: none;
  }

  .live-map .map-pulse {
    transform: none;
    stroke-opacity: 0.8;
  }
}

.live-map .leaflet-tooltip {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
  font-size: 0.85rem;
}

.live-map .leaflet-tooltip-top::before {
  border-top-color: var(--border);
}

.live-map .leaflet-control-zoom a {
  background: var(--bg-panel);
  color: var(--text);
  border-color: var(--border);
}

.live-map .leaflet-control-attribution {
  background: rgba(10, 18, 48, 0.8);
  color: var(--text-muted);
}

.live-map .leaflet-control-attribution a {
  color: var(--accent-strong);
}

.map-status {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1000;
  margin: 0;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.8rem;
}

.map-status[data-state="offline"],
.map-status[data-state="reconnecting"] {
  border-color: var(--text-muted);
}

/* The legend sits with the map: below it on phones and tablets, beside it
 * on wide screens. Its glyphs repeat the map's own marks, and each has a
 * text label, so nothing depends on colour alone. */
.map-legend {
  padding: 1rem 1.5rem 1.25rem;
  background: var(--bg-panel);
  font-size: 0.9rem;
}

.map-legend h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.legend-list {
  margin: 0 0 0.75rem;
}

.legend-item {
  margin: 0 0 0.7rem;
}

.legend-item dt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.legend-item dd {
  margin: 0.1rem 0 0 calc(32px + 0.5rem);
  color: var(--text-muted);
}

.legend-glyph {
  width: 32px;
  height: 20px;
  flex: none;
}

.glyph-node {
  fill: var(--accent-strong);
  stroke: var(--bg);
  stroke-width: 1;
}

.glyph-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.glyph-core {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1.2;
}

.glyph-line {
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.legend-note,
.legend-sources {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
}

.legend-note strong {
  color: var(--text);
  font-weight: 600;
}

.legend-sources {
  margin: 0;
  font-size: 0.82rem;
}

.legend-sources a {
  color: var(--accent-strong);
}

/* Tablet and desktop: the introduction on the left and the map on the
 * right, side by side above the rest of the page. Phones read the
 * introduction first, then the map at full width. */
@media (min-width: 740px) {
  .lead-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }

  .lead-split > .hero {
    grid-column: 1;
    grid-row: 1;
    max-width: 640px;
    margin: 0 auto;
  }

  .lead-split > .map-section {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    margin: 0 0 2.5rem;
    border-top: 0;
    border-left: 1px solid var(--border);
  }

  .lead-split .map-heading {
    padding: 0.8rem 1rem;
  }

  .lead-split .map-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .lead-split .map-frame {
    flex: 1;
    min-height: min(64vh, 620px);
  }

  .lead-split .live-map {
    position: absolute;
    inset: 0;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .lead-split .map-legend {
    padding: 1rem 1rem 1.25rem;
  }
}

/* Wide screens: the legend becomes a column beside the map. */
@media (min-width: 1100px) {
  .lead-split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }

  .lead-split .map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
  }

  .lead-split .map-frame {
    min-height: min(78vh, 760px);
  }

  .lead-split .map-legend {
    border-left: 1px solid var(--border);
  }
}
