/* Geographic view. Shares the status bar and panel styling with the schematic
   view via style.css; everything here is specific to the Leaflet map. */

main {
  padding: 0;
  gap: 0;
}

#geoMap {
  width: 100%;
  height: 100%;
  background: #e9e5dc; /* the tile background, so gaps do not flash white */
}

/* The line colours have to carry meaning over a busy street map, so the track
   is drawn with a white casing under it - the same trick the printed map uses
   to keep a coloured line legible across everything beneath it. */
.leaflet-container {
  font: inherit;
}

/* Train markers are divIcons so they can be styled and rotated in CSS rather
   than redrawn as images every frame. */
.train-marker {
  background: none;
  border: none;
}

.train-marker svg {
  display: block;
  overflow: visible;
}

.station-dot {
  background: none;
  border: none;
}

/* Station names, set at 45 degrees as on the printed map.

   The icon itself is zero-sized and anchored exactly on the station, so the
   inner span is what gets positioned and rotated - pivoting on its own left
   edge means the text always starts at the dot and runs away from it, whatever
   the name's length. */
.station-label {
  background: none;
  border: none;
  pointer-events: none; /* the dot underneath stays clickable */
  white-space: nowrap;
}

.station-label span {
  display: inline-block;
  transform-origin: 0 50%;
  /* Up and to the right, clear of any east-west track beside it. The gap is
     set from JS because it has to grow with the station dot and the track,
     both of which thicken as you zoom in; the extra few pixels on the X are a
     fixed nudge clear of the dot, applied before the rotation so it reads as a
     straight shift to the right. */
  transform:
    translate(calc(var(--label-gap, 9px) + 6px), calc(var(--label-gap, 9px) * -0.35))
    rotate(-45deg);
  font-weight: 700;
  line-height: 1;
  color: #14181c;
  /* A halo rather than a box: the basemap stays visible through the gaps
     between letters, which a solid background would blank out. */
  text-shadow:
     0 0 3px #fff,  0 0 3px #fff,  0 0 3px #fff,
     1px 1px 2px #fff, -1px 1px 2px #fff, 1px -1px 2px #fff, -1px -1px 2px #fff;
}

/* Transient geolocation messages. Muted, because none of them are errors -
   a declined location is a perfectly normal outcome. */
.geo-notice {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Matches Leaflet's own zoom buttons so it reads as part of the same set. */
.locate-control {
  display: block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 17px;
  color: #14181c;
  background: #fff;
  text-decoration: none;
}

.locate-control:hover {
  background: #f4f4f4;
}

/* Popups reuse the arrival-row look from the schematic view. */
.leaflet-popup-content {
  margin: 8px 10px;
  min-width: 190px;
}

.leaflet-popup-content h2 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 700;
}

.leaflet-popup-content .arrival-row {
  padding: 4px 0;
}

.leaflet-popup-content .arrival-row:last-child {
  border-bottom: none;
}

.leaflet-popup-content .arrival-note {
  padding: 6px 0 0;
  margin: 0;
}

.geo-attrib {
  font-size: 0.7rem;
}
