.nr-map-host {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--map-ground);
  color: var(--ink);
}

/* Pull-to-refresh: the site is static, so the browser's own refresh stays everywhere except over the map,
   where a downward pan must move the map, not reload the page (roadmap 198). */
.nr-map-host { overscroll-behavior-y: none; }

.nr-map-host .leaflet-container {
  width: 100%;
  height: 100%;
  min-height: 18rem;
  background: var(--map-ground);
  color: var(--ink);
  font: inherit;
  outline: 0;
}

.nr-map-host[data-map-layer="satellite"] .leaflet-tile-pane { filter: saturate(.85) sepia(.12) contrast(.96); }

.nr-map-host .leaflet-control-attribution {
  max-width: min(88%, 32rem);
  padding: 2px 6px;
  border-radius: 2px 0 0;
  background: rgb(var(--paper-rgb) / 90%);
  color: var(--ink);
  font-size: 10px;
  line-height: 1.4;
}

.nr-map-host .leaflet-control-attribution a {
  color: var(--route-line);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nr-map-host .leaflet-control-scale-line {
  border-color: var(--ink);
  background: rgb(var(--paper-rgb) / 82%);
  color: var(--ink);
  font-size: 10px;
  text-shadow: none;
}

.nr-map-host .nr-map-marker-shell {
  border: 0;
  background: transparent;
}

.nr-map-start-marker,
.nr-map-stop-marker {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 2px 8px rgb(var(--ink-deep-rgb) / 35%);
}

.nr-map-start-marker::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--paper-bright);
  content: '';
}

.nr-map-stop-marker {
  color: var(--paper-bright);
  font: 700 13px/1 system-ui, sans-serif;
}

.nr-map-host .nr-map-status {
  position: absolute;
  z-index: 800;
  inset: auto 1rem 2.25rem 1rem;
  display: flex;
  width: fit-content;
  max-width: min(34rem, calc(100% - 2rem));
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgb(var(--ink-deep-rgb) / 16%);
  border-radius: 3px;
  background: var(--paper-bright);
  box-shadow: 0 4px 18px rgb(var(--ink-deep-rgb) / 14%);
  color: var(--ink);
  font: 500 0.82rem/1.4 system-ui, sans-serif;
}

.nr-map-host .nr-map-status[hidden] {
  display: none;
}

.nr-map-host .nr-map-status button {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--orange);
  border-radius: 2px;
  background: transparent;
  color: var(--orange-deep);
  cursor: pointer;
  font: inherit;
}

.nr-map-host .nr-map-status button:focus-visible {
  background: var(--orange-wash);
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

@media (hover: hover) {
  .nr-map-host .nr-map-status button:hover {
    background: var(--orange-wash);
    outline: 2px solid var(--orange);
    outline-offset: 2px;
  }
}

.nr-map-host .leaflet-popup-content-wrapper {
  border-radius: 3px;
  background: var(--paper-bright);
  color: var(--ink);
}

.nr-map-host .leaflet-popup-content {
  font: 500 0.85rem/1.45 system-ui, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  .nr-map-host *,
  .nr-map-host *::before,
  .nr-map-host *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Numbered stop markers, matched to the static previews. */
.nr-map-stop-marker {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--orange); color: var(--white); font: 700 13px/1 'DM Sans', system-ui, sans-serif;
  border: 2.5px solid var(--white); box-shadow: 0 2px 8px rgb(var(--ink-deep-rgb) / 35%);
  transition: transform .18s;
}
.nr-map-stop-marker.is-selected {
  width: 38px; height: 38px; font-size: 15px; background: var(--ink);
  box-shadow: 0 4px 14px rgb(var(--ink-deep-rgb) / 45%);
}
@media (hover: hover) { .nr-map-marker-shell:hover .nr-map-stop-marker { transform: scale(1.08); } }
.nr-map-start-marker {
  display: block; width: 24px; height: 24px; border-radius: 50%;
  background: var(--sage); border: 3px solid var(--white); box-shadow: 0 2px 8px rgb(var(--ink-deep-rgb) / 35%);
}
@media (prefers-reduced-motion: reduce) { .nr-map-stop-marker { transition: none; } }

/* The static preview stays beneath the live map until real tiles load. */
.nr-map-host .map-placeholder.is-behind {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
}
.nr-map-host .leaflet-pane { z-index: 1; }

/* The atlas: one dot per route, orange where the route has stories. */
.atlas-dot { display: block; width: 20px; height: 20px; transition: transform .18s; border-radius: 50%; background: var(--ink); border: 3px solid var(--white); box-shadow: 0 2px 8px rgb(var(--ink-deep-rgb) / 35%); }
.atlas-dot.has-stories { background: var(--orange); }
@media (hover: hover) { .nr-map-marker-shell:hover .atlas-dot { transform: scale(1.12); } }

.nr-map-stop-marker.is-playing { outline: 3px solid var(--ink-deep); outline-offset: 2px; }
.nr-map-elevation-cursor-shell { border: 0; background: transparent; }
.nr-map-elevation-cursor {
  display: block; width: 14px; height: 14px; margin: 3px; border: 2px solid var(--ink-deep);
  border-radius: 50%; background: var(--white); box-shadow: 0 1px 4px rgb(12 28 51 / 55%);
}
