.stream-chart {
  font-size: 0.75rem;
}

.stream-chart__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stream-chart__metric-select {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.375rem;
  background: var(--color-panel-main, #ffffff);
  color: var(--color-txt-main, #0f172a);
  cursor: pointer;
  outline: none;
}

.stream-chart__metric-select:focus {
  border-color: var(--color-brand, #e6c619);
  box-shadow: 0 0 0 2px rgba(230, 198, 25, 0.15);
}

.stream-chart__canvas-wrapper {
  width: 100%;
  height: 200px;
  position: relative;
}

.stream-chart__canvas {
  width: 100% !important;
  height: 100% !important;
}

.stream-chart__highlight-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  pointer-events: none;
  z-index: 10;
}

.stream-chart__highlight-dim {
  flex: 0 0 auto;
  background: rgba(15, 23, 42, 0.18);
  transition: width 0.2s ease;
}

.stream-chart__highlight-band {
  flex: 0 0 auto;
  background: transparent;
  border-left: 2px solid rgba(59, 130, 246, 0.5);
  border-right: 2px solid rgba(59, 130, 246, 0.5);
  transition: width 0.2s ease;
}

.stream-chart__empty {
  text-align: center;
  padding: 2rem 0;
  color: var(--color-txt-muted, #64748b);
  font-size: 0.7rem;
}

/* ===== Route Map expand ===== */

.route-map__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--color-panel-muted, #f8fafc);
  border-bottom: 1px solid var(--color-border-light, #e2e8f0);
}

.route-map__header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(100, 116, 139, 0.5);
}

.route-map__expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.375rem;
  background: var(--color-panel-main, #ffffff);
  color: var(--color-txt-muted, #64748b);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  padding: 0;
}

.route-map__expand-btn:hover {
  color: var(--color-txt-main, #0f172a);
  border-color: var(--color-brand, #e6c619);
}

.route-map__container {
  height: 360px;
  width: 100%;
  background: var(--color-panel-muted, #f8fafc);
  transition: height 0.25s ease;
}

.route-map__container--expanded {
  height: 500px;
}

/* Leaflet's default widgets are bright; restyle them from the theme tokens so a
   dark basemap is not framed by white boxes. Attribution must stay visible — it
   is required for the OSM data and names the tile provider. */
.route-map__container .leaflet-control-attribution {
  background: color-mix(in srgb, var(--color-panel-main, #ffffff) 80%, transparent);
  color: var(--color-txt-muted, #64748b);
  font-size: 0.625rem;
  padding: 0 4px;
}

.route-map__container .leaflet-control-attribution a {
  color: inherit;
  text-decoration: underline;
}

.route-map__container .leaflet-bar {
  border: 1px solid var(--color-border-light, #e2e8f0);
  box-shadow: none;
}

.route-map__container .leaflet-bar a {
  background: var(--color-panel-main, #ffffff);
  color: var(--color-txt-main, #0f172a);
  border-bottom-color: var(--color-border-light, #e2e8f0);
}

.route-map__container .leaflet-bar a:hover,
.route-map__container .leaflet-bar a:focus {
  background: var(--color-panel-muted, #f8fafc);
  color: var(--color-txt-main, #0f172a);
}

/* Basemap: MapLibre GL paints OpenFreeMap vector tiles into Leaflet's tile pane.
   The GL canvas must not swallow pointer events — Leaflet owns panning, zooming
   and the route hover; MapLibre only draws the tiles underneath them. */
.route-map__container .leaflet-gl-layer {
  pointer-events: none;
}

/* Start/finish dots: the white ring separates them from the map, the shadow lifts
   them off it. Applied to the Leaflet path element. */
.route-map__container .route-map__marker--start,
.route-map__container .route-map__marker--finish {
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.5));
}

/* ===== Elevation profile ===== */

/* A quiet terrain silhouette under the map. The cursor is driven by the stream
   chart and moves the map marker to the same point. */
.route-map__profile {
  position: relative;
  height: 84px;
  background: var(--color-panel-main, #ffffff);
  border-top: 1px solid var(--color-border-light, #e2e8f0);
  cursor: crosshair;
  touch-action: pan-y;
}

.route-map__profile-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.route-map__profile-stop-top {
  stop-color: var(--color-txt-main, #0f172a);
  stop-opacity: 0.22;
}

.route-map__profile-stop-bottom {
  stop-color: var(--color-txt-main, #0f172a);
  stop-opacity: 0;
}

.route-map__profile-line {
  fill: none;
  stroke: color-mix(in srgb, var(--color-txt-main, #0f172a) 55%, transparent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.route-map__profile-baseline {
  stroke: color-mix(in srgb, var(--color-border-strong, #cbd5e1) 60%, transparent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.route-map__profile-cursor {
  stroke: var(--color-txt-main, #0f172a);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0;
  transition: opacity 0.12s ease;
  vector-effect: non-scaling-stroke;
}

.route-map__profile-dot {
  fill: var(--color-brand, #e6c619);
  stroke: var(--color-panel-main, #ffffff);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.12s ease;
  vector-effect: non-scaling-stroke;
}

.route-map__profile-caption,
.route-map__profile-gain {
  position: absolute;
  top: 0.375rem;
  font-size: 0.625rem;
  line-height: 1;
  pointer-events: none;
}

.route-map__profile-caption {
  left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-txt-muted, #64748b);
}

.route-map__profile-gain {
  right: 0.5rem;
  font-weight: 600;
  color: var(--color-txt-muted, #64748b);
}

.route-map__profile-readout {
  position: absolute;
  transform: translate(-50%, -135%);
  padding: 0.1rem 0.35rem;
  border-radius: 0.375rem;
  background: var(--color-panel-elevated, #ffffff);
  border: 1px solid var(--color-border-light, #e2e8f0);
  color: var(--color-txt-main, #0f172a);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

.route-map__profile-readout[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .route-map__profile-cursor,
  .route-map__profile-dot {
    transition: none;
  }
}
