/* Station map (the home page) — builds on the dashboard's /styles.css tokens. */

.back-link { font-size: 13px; color: var(--text-secondary); text-decoration: none; white-space: nowrap; }
.back-link:hover { color: var(--accent); }
.map-updated { font-size: 12.5px; white-space: nowrap; }

/* The map fills the dashboard's 1080px column, and the window's height less
   the top bar, main's padding and the legend. */
#map {
  height: calc(100vh - 61px - 40px - 34px); height: calc(100dvh - 61px - 40px - 34px);
  min-height: 420px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); z-index: 0;
}
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; padding: 10px 2px 0; margin-bottom: 18px; color: var(--text-secondary); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.lg-live { background: var(--accent); }
.lg-stale { background: #d03b3b; }
.lg-planned { border: 2px dashed var(--text-muted); width: 7px; height: 7px; }

/* OSM tiles only come in light; darken them for the dark theme. */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
:root[data-theme="dark"] .leaflet-container { background: #1b1b19; }

/* Station pins: a temperature pill over a dot. */
.pin { background: none; border: 0; }
/* bottom: -6px puts the 12px dot's centre exactly on the station, where the
   wind arrow starts. */
.pin-body { position: absolute; left: 0; bottom: -6px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.pin-label {
  font: 600 13px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--surface-1); color: var(--text-primary); border: 2px solid var(--accent);
  border-radius: 999px; padding: 4px 9px; box-shadow: 0 1px 6px rgba(0, 0, 0, .25);
}
.pin-label small { font-weight: 500; color: var(--text-secondary); margin-left: 5px; }
.pin-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface-1); margin-top: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .2); }
.pin.stale .pin-label { border-color: #d03b3b; }
.pin.stale .pin-dot { background: #d03b3b; }
.pin.planned .pin-label { border-style: dashed; border-color: var(--text-muted); color: var(--text-secondary); font-weight: 500; box-shadow: none; }
.pin.planned .pin-dot { background: var(--surface-1); border: 2px dashed var(--text-muted); }

/* Wind arrows: drawn over the pins (click-through), dark with a light halo so they read on
   any part of the map; flipped in dark theme. */
.wind-arrow { background: none; border: 0; pointer-events: none; }
.wind-arrow svg { display: block; overflow: visible; }
.wa-body line { stroke: #1d4f91; stroke-linecap: round; }
.wa-body path { fill: #1d4f91; }
.wa-halo line { stroke: rgba(255, 255, 255, .85); stroke-linecap: round; }
.wa-halo path { fill: rgba(255, 255, 255, .85); }
.wind-arrow.stale { opacity: .45; }
:root[data-theme="dark"] .wa-body line { stroke: #9cc3f5; }
:root[data-theme="dark"] .wa-body path { fill: #9cc3f5; }
:root[data-theme="dark"] .wa-halo line { stroke: rgba(0, 0, 0, .7); }
:root[data-theme="dark"] .wa-halo path { fill: rgba(0, 0, 0, .7); }
.lg-wind { width: 18px; height: 10px; }
.lg-radar { width: 11px; height: 11px; border-radius: 3px; background: #3d8be0; opacity: .7; }

/* Popups follow the page theme. */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-1); color: var(--text-primary); }
.leaflet-popup-content { margin: 12px 16px; font: 13px/1.45 system-ui, sans-serif; }
.pop h3 { margin: 0 0 4px; font-size: 15px; }
.pop .big { font-size: 26px; font-weight: 620; font-variant-numeric: tabular-nums; }
.pop dl { display: grid; grid-template-columns: auto auto; gap: 1px 12px; margin: 6px 0 8px; }
.pop dt { color: var(--text-muted); }
.pop dd { margin: 0; font-variant-numeric: tabular-nums; }
.pop .warn { color: #d03b3b; font-weight: 600; }
.pop a.open { color: var(--accent); font-weight: 600; text-decoration: none; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }
.leaflet-control-attribution { font-size: 11px; }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(31, 31, 29, .85); color: #bbb; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #8ab4f0; }

/* Rain radar. Leaflet's tile-seam fix (plus-lighter blending) brightens the
   overlaps of translucent tiles into faint lines along the tile edges. */
.leaflet-radar-pane img.leaflet-tile { mix-blend-mode: normal; }

/* Rain radar toggle (top right). */
.radar-ctl button {
  display: flex; align-items: center; gap: 7px; border: 0; cursor: pointer;
  font: 600 12.5px/1 system-ui, sans-serif; padding: 8px 10px; border-radius: 4px;
  background: var(--surface-1); color: var(--text-secondary);
}
.radar-ctl button:hover { color: var(--text-primary); }
.radar-ico { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--text-muted); }
.radar-ctl button[aria-pressed="true"] { color: var(--text-primary); }
.radar-ctl button[aria-pressed="true"] .radar-ico { background: #3d8be0; border-color: #3d8be0; }
.radar-ctl button.err .radar-ico { background: none; border-color: #d03b3b; }
.radar-time { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-muted); min-width: 0; }
.radar-time:empty { display: none; }
.leaflet-touch .leaflet-bar.radar-ctl { border-color: var(--border); }

@media (max-width: 600px) {
  .map-updated { display: none; }
  #map { min-height: 360px; height: 65vh; }
}

/* Phones: the search gets a row of its own above the status row (its styles are in /styles.css). */
@media (max-width: 620px) {
  .site-search { order: 1; }
  .topbar-right { order: 2; }
}
