/* ==========================================================================
   ROUTES PAGE
   ========================================================================== */

.routes-page {
  /* Bottom of the navbar and the sticky page tabs: sticky parts of an
     expanded variant (stop column headers, map) stay below them. */
  --routes-sticky-top: calc(var(--navbar-height) + 4.25rem);
  background:
    radial-gradient(1200px 500px at 10% -20%, var(--color-primary-subtle) 0%, transparent 70%),
    radial-gradient(900px 420px at 90% -10%, var(--color-success-subtle) 0%, transparent 68%),
    var(--color-bg-subtle);
  min-height: calc(100vh - 60px);
  padding: 0 0 var(--space-5);
}

.routes-container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
}

/* Wide screens: the extra width goes mostly to the variant map. */
@media (min-width: 1600px) {
  .routes-container {
    max-width: 1760px;
  }
}

/* Keep the fade outside the tabs' horizontal scroll area on mobile. */
.routes-page-tabs {
  margin-bottom: var(--space-2);
}

.routes-page-tabs > .c-page-tabs {
  margin-bottom: 0;
}

.routes-page-tabs::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: var(--space-4);
  background: linear-gradient(to bottom, var(--color-bg-subtle), transparent);
  pointer-events: none;
}

/* The GTFS↔SLOID view is a map workspace: same tabs and page width as the
   other route views, with the map filling the viewport height below them. */
.routes-page--gtfs-map {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--navbar-height));
  height: calc(100dvh - var(--navbar-height));
  min-height: 0;
  padding-bottom: var(--space-2);
}

.routes-page--gtfs-map .routes-container {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.routes-header {
  margin-bottom: var(--space-2);
}

.routes-header h1 {
  margin: 0;
  color: var(--color-fg);
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
}

.routes-header p {
  margin: var(--space-2) 0 0 0;
  color: var(--color-fg-muted);
  font-size: var(--text-sm);
}

.routes-header__note {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-fg);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.routes-header__note strong {
  font-weight: var(--font-semibold);
}

.routes-toolbar {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: var(--space-4);
  overflow: visible;
  position: relative;
  z-index: 30;
}

.routes-toolbar__form {
  display: block;
}

.routes-toolbar__inline {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-3);
  overflow: visible;
  padding-bottom: 2px;
}

.routes-toolbar__inline-item {
  flex: 0 0 auto;
  min-width: 0;
}

.routes-toolbar__inline-item--search {
  width: 270px;
}

.smart-search-input-group {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  width: 100%;
}

.smart-search-hint {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1705;
  background: var(--color-surface-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3);
  min-width: 260px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-fg);
  pointer-events: none;
}

.smart-search-hint__title {
  font-weight: var(--font-semibold);
  color: var(--color-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-1);
  font-size: 0.65rem;
}

.smart-search-hint__item {
  padding: 2px 0;
  line-height: var(--leading-snug);
}

.smart-search-hint__item kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 0.3rem;
  color: var(--color-primary);
  font-weight: var(--font-medium);
}

.routes-toolbar__inline-item .dropdown-menu {
  margin-top: 0.4rem;
  z-index: 1700;
}

.routes-summary {
  color: var(--color-fg-muted);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
  margin-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.routes-summary__text {
  white-space: nowrap;
}

.routes-gtfs-map-view {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.routes-gtfs-map-shell {
  --zoom-banner-position: absolute;
  --zoom-banner-top: 70px;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  box-shadow: var(--shadow-md);
}

.routes-gtfs-map {
  width: 100%;
  height: 100%;
}

.routes-gtfs-map-top-right {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: calc(100% - 2rem);
}

.routes-gtfs-map-overlay {
  min-width: 0;
  max-width: 360px;
}

.routes-gtfs-map-overlay .header-summary {
  position: static;
  width: fit-content;
  min-width: 0;
  margin-left: 0;
}

.routes-gtfs-map-controls {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: calc(100% - 430px);
}

.routes-gtfs-map-search {
  position: relative;
  flex: 0 1 250px;
  width: 250px;
  min-width: 180px;
}

.routes-gtfs-map-controls .filter-item {
  flex: 0 0 auto;
}

.routes-gtfs-map-controls .dropdown-menu {
  width: 260px;
  max-height: 60vh;
  overflow-y: auto;
}

.routes-gtfs-map-controls .form-check-label {
  white-space: normal;
}

.routes-gtfs-map-search .input-group-text {
  cursor: pointer;
}

.routes-gtfs-map-search .input-group-text:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.routes-gtfs-map-search .form-control {
  min-width: 0;
  box-shadow: none;
}

.routes-gtfs-map-search .smart-search-feedback,
.routes-gtfs-map-search .smart-search-hint {
  width: 100%;
}

.routes-gtfs-map-info {
  position: relative;
  flex: 0 0 auto;
}

.routes-gtfs-map-info__button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-full);
  background: var(--color-surface-glass);
  color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: help;
}

.routes-gtfs-map-info__button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.routes-gtfs-map-info__tooltip {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(430px, calc(100vw - 2.5rem));
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-glass);
  color: var(--color-fg);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.routes-gtfs-map-info:hover .routes-gtfs-map-info__tooltip,
.routes-gtfs-map-info:focus-within .routes-gtfs-map-info__tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.routes-gtfs-map-info__tooltip p {
  margin: 0;
}

.routes-gtfs-map-info__legend-title {
  margin-top: var(--space-2) !important;
  font-weight: var(--font-semibold);
  color: var(--color-primary);
}

.routes-gtfs-map-info__legend-list {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
}

.routes-gtfs-map-info__legend-list li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.routes-gtfs-map-info__legend-list li + li {
  margin-top: var(--space-1);
}

.routes-gtfs-map-info__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex: 0 0 10px;
  margin-top: 0.32rem;
}

.routes-gtfs-map-info__dot--atlas-matched {
  background: var(--color-map-atlas-matched);
}

.routes-gtfs-map-info__dot--gtfs-matched {
  background: var(--color-map-gtfs-matched);
}

.routes-gtfs-map-info__dot--atlas-unmatched {
  background: var(--color-map-atlas-unmatched);
}

.routes-gtfs-map-info__dot--gtfs-unmatched {
  background: var(--color-map-osm-unmatched);
}

.routes-filters-display {
  position: relative;
  min-width: 0;
}

.routes-filters-display .header-summary {
  position: static;
  width: 100%;
  max-width: none;
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
  backdrop-filter: none;
  min-width: 0;
}

.routes-filters-display .header-summary__content {
  display: block !important;
  width: 100%;
}

.routes-filters-display .header-summary__filters-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.routes-filters-display #activeFilters {
  padding: 0;
  border-top: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.routes-filters-display .header-summary__mobile-bar {
  display: none !important;
}

.routes-filters-display #headerSummaryFiltersToggle {
  display: none;
}

.routes-list {
  display: grid;
  gap: var(--space-4);
}

.route-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  /* clip, not hidden: hidden would make the card a scroll container and stop
     the stop headers and map inside it from sticking to the page. */
  overflow: clip;
}

.route-card__header {
  display: block;
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-subtle) 100%);
}

.route-card__header--matched {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Both cards open together (routes.js), so keep them the same height. */
  align-items: stretch;
  gap: var(--space-2);
}

.route-card--gtfs_only .route-card__header,
.route-card--osm_only .route-card__header {
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-subtle) 100%);
}

.route-meta {
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.route-meta--solo {
  width: 100%;
}

.route-meta--gtfs {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary);
}

.route-meta--osm {
  background: var(--color-success-subtle);
  border-color: var(--color-success);
}

.route-meta--gtfs.route-meta--unmatched {
  background: var(--color-danger-subtle);
  border-color: var(--color-danger);
}

.route-meta--osm.route-meta--unmatched {
  background: var(--color-secondary-subtle);
  border-color: var(--color-secondary);
}

.route-meta--gtfs.route-meta--matched .route-meta__title {
  color: var(--color-primary);
}

.route-meta--osm.route-meta--matched .route-meta__title {
  color: var(--color-success-fg);
}

.route-meta--gtfs.route-meta--unmatched .route-meta__title {
  color: var(--color-danger-fg);
}

.route-meta--osm.route-meta--unmatched .route-meta__title {
  color: var(--color-secondary);
}

.route-meta__title {
  display: inline-block;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  font-weight: var(--font-semibold);
  color: var(--color-fg-muted);
  text-transform: uppercase;
}

.route-meta__topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.route-meta__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2);
}

.route-meta__summary::-webkit-details-marker {
  display: none;
}

.route-meta__summary::after {
  content: '\f078';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-size: 0.7rem;
  color: var(--color-fg-muted);
  margin-left: auto;
  margin-top: 0.15rem;
}

.route-meta__summary-main {
  min-width: 0;
  flex: 1 1 auto;
}

.route-meta[open] .route-meta__summary {
  background: var(--color-surface-veil);
}

.route-meta[open] .route-meta__summary::after {
  content: '\f077';
}

.route-meta__content {
  display: grid;
  gap: var(--space-2);
  padding: 0 var(--space-2) var(--space-2);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-veil);
}

.route-meta__attributes {
  display: grid;
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
  gap: 0.2rem 0.65rem;
  margin: 0;
}

.route-meta__attributes dt,
.route-meta__attributes dd {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.45;
}

.route-meta__attributes dt {
  color: var(--color-fg-muted);
  font-weight: var(--font-medium);
}

.route-meta__attributes dd {
  color: var(--color-fg);
  word-break: break-word;
}

.route-meta__name {
  margin-top: var(--space-1);
  color: var(--color-fg);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  word-break: break-word;
}

.route-meta__id {
  margin-top: 0.15rem;
  color: var(--color-fg-muted);
  font-size: var(--text-xs);
  word-break: break-word;
}

.route-meta__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  text-decoration: none;
}

.route-meta__link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.route-meta__detail {
  margin-top: 0.15rem;
  color: var(--color-fg-muted);
  font-size: var(--text-xs);
  word-break: break-word;
}

.route-meta__note {
  color: var(--color-fg-muted);
  font-size: var(--text-xs);
}

.route-meta__operator {
  margin-top: 0;
  margin-left: auto;
  text-align: right;
  color: var(--color-fg-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52%;
}

.route-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 var(--space-4);
}

.route-card__badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.route-card__badge--matched {
  background: var(--color-success-subtle);
  color: var(--color-success-fg);
}

.route-card__badge--support {
  background: var(--color-bg-muted);
  color: var(--color-fg-muted);
  border: 1px solid var(--color-border);
  font-weight: 600;
}

.route-card__badge--unmatched-gtfs {
  background: var(--color-danger-subtle);
  color: var(--color-danger-fg);
}

.route-card__badge--unmatched-osm {
  background: var(--color-bg-muted);
  color: var(--color-fg-muted);
  border: 1px solid var(--color-border);
}

.route-card__badge--unmatched {
  background: var(--color-danger-subtle);
  color: var(--color-danger-fg);
}

.route-card__summary {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  color: var(--color-fg-muted);
  font-size: var(--text-xs);
}

/* The other matches of a line: each match is a card of its own. */
.route-card__also-matched {
  margin: var(--space-2) var(--space-4) 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-bg-muted);
  color: var(--color-fg);
  font-size: var(--text-xs);
}

.route-card__also-matched i {
  margin-right: 0.3rem;
  color: var(--color-fg-muted);
}

.route-card__also-matched-reason {
  color: var(--color-fg-muted);
}

.route-card__panel {
  border-top: 1px solid var(--color-border);
}

.route-card__panel summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-fg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  background: var(--color-bg);
}

.route-card__panel summary::-webkit-details-marker {
  display: none;
}

.route-card__panel summary::after {
  content: '\f078';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-size: 0.7rem;
  color: var(--color-fg-muted);
  margin-top: 0.2rem;
}

.route-card__panel[open] summary {
  background: var(--color-bg-subtle);
}

.route-card__panel[open] summary::after {
  content: '\f077';
}

.route-card__panel-content {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-3);
  background: var(--color-bg-subtle);
}

/* A permalink scrolls its variant to the top, below the sticky tabs. */
.route-card__panel--map {
  scroll-margin-top: calc(var(--routes-sticky-top) + var(--space-3));
}

.route-card__panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: calc(-1 * var(--space-2));
}

.route-copy-link {
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-xs);
  color: var(--color-primary);
  cursor: pointer;
}

.route-copy-link:hover {
  text-decoration: underline;
}

.route-copy-link.is-copied {
  color: var(--color-success);
}

.route-card__panel-summary-main {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.route-card__panel-summary-main > * + * {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.route-card__panel-summary-main > * + *::before {
  content: "•";
  color: var(--color-fg-muted);
  opacity: 0.35;
  margin-right: 0.65rem;
  font-weight: normal;
}

.route-card__panel-summary-prefix {
  color: var(--color-fg-muted);
  font-weight: 500;
}

.route-card__panel-summary-label {
  min-width: 0;
  word-break: break-word;
}

.route-card__panel-summary-muted {
  flex: none;
  color: var(--color-fg-muted);
  font-weight: 500;
  white-space: nowrap;
}

.route-card__panel-summary-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.route-card__panel-summary-badge .route-card__badge {
  font-size: 0.8em;
}

/* An expanded variant: stops, then the map; side by side on wide screens,
   where the map sticks below the page tabs while the stops scroll. */
.variant-workspace {
  display: grid;
  gap: var(--space-3);
  align-items: start;
}

.variant-map {
  position: relative;
  /* Keep Leaflet's pane and control z-indexes inside the map card. */
  isolation: isolate;
  height: 340px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg);
}

@media (min-width: 1200px) {
  /* Wider than about 42% below 1600px, the stop rows (SLOID and UIC on each
     side) get cramped. */
  .variant-workspace--with-map {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
  }

  /* As tall as the stop list, at most the viewport below the page tabs. */
  .variant-workspace--with-map > .variant-map {
    position: sticky;
    top: calc(var(--routes-sticky-top) + var(--space-3));
    align-self: stretch;
    height: auto;
    min-height: 380px;
    max-height: calc(100vh - var(--routes-sticky-top) - var(--space-6));
  }
}

@media (min-width: 1600px) {
  .variant-workspace--with-map {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 45%);
  }
}

.route-card__map {
  width: 100%;
  height: 100%;
  background: var(--color-bg);
}

.route-card__map .leaflet-control-layers {
  font-size: 0.72rem;
}

/* "See other markers" and "Main map", top right; they wrap on narrow maps. */
.variant-map__actions {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-1);
  max-width: calc(100% - 4rem);
}

.variant-map__action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--color-border-emphasis);
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-fg);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.variant-map__action:hover {
  background: var(--color-bg-subtle);
}

.variant-map__main-map,
.variant-map__main-map:hover {
  color: var(--color-fg);
  text-decoration: none;
}

/* Collapsed by default, bottom right above the attribution; opens upwards. */
.variant-map__legend {
  position: absolute;
  right: var(--space-2);
  bottom: 1.6rem;
  z-index: 1000;
  max-width: calc(100% - 4rem);
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--color-border-emphasis);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-fg);
  font-size: var(--text-xs);
  box-shadow: var(--shadow-sm);
}

/* Inside a route panel: drop the panel summary's padding and fill, keep its chevron. */
.variant-map .variant-map__legend summary {
  align-items: center;
  padding: 0;
  background: none;
  font-size: inherit;
}

.variant-map__legend ul {
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
}

.variant-map__legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.1rem 0;
}

.variant-map__legend p {
  margin: var(--space-1) 0 0;
  color: var(--color-fg-muted);
}

.variant-map__key {
  flex: none;
  width: 1.4rem;
  height: 0.7rem;
}

.variant-map__key--matched {
  background:
    radial-gradient(circle at 25% 50%, var(--color-map-atlas-matched) 0.3rem, transparent 0.32rem),
    radial-gradient(circle at 75% 50%, var(--color-map-osm-matched) 0.3rem, transparent 0.32rem);
}

.variant-map__key--unmatched {
  background:
    radial-gradient(circle at 25% 50%, var(--color-map-atlas-unmatched) 0.3rem, transparent 0.32rem),
    radial-gradient(circle at 75% 50%, var(--color-map-osm-unmatched) 0.3rem, transparent 0.32rem);
}

.variant-map__key--line,
.variant-map__key--platform {
  height: 0;
  border-top: 2px solid var(--color-map-line-atlas-osm);
}

.variant-map__key--platform {
  border-top: 2px dashed var(--color-map-not-shared);
}

.variant-map__key--match {
  height: 0;
  border-top: 1.5px solid var(--color-map-line-atlas-osm);
  opacity: 0.5;
}

.variant-map__key--ring {
  width: 0.8rem;
  height: 0.8rem;
  margin: 0 0.3rem;
  border: 2px dashed var(--color-map-not-shared);
  border-radius: var(--radius-full);
}

.variant-map__context[aria-pressed="true"] {
  border-color: var(--color-fg);
  background: var(--color-surface-dark);
  color: var(--color-on-dark);
}

.variant-map__hint {
  position: absolute;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: var(--space-4);
  background: var(--color-overlay);
  color: var(--color-on-dark);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.variant-map.is-wheel-hint .variant-map__hint {
  opacity: 1;
}

.route-card__map-status {
  position: absolute;
  top: var(--space-2);
  left: 50%;
  z-index: 1000;
  max-width: calc(100% - 12rem);
  margin: 0;
  padding: 0.25rem 0.6rem;
  transform: translateX(-50%);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
}

.route-card__map-status--error {
  color: var(--color-danger);
}

.direction-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
  padding: var(--space-3);
}

.direction-block__columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.direction-block__columns--single {
  grid-template-columns: 1fr;
}

.stops-column {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  min-width: 0;
}

.stops-column h4 {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-fg);
  font-weight: var(--font-semibold);
}

.stops-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  min-height: 24px;
}

.stops-column-header .route-meta__link {
  margin-top: 0;
  white-space: nowrap;
}

.stops-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: var(--space-1);
}

.stops-list li {
  color: var(--color-fg);
  font-size: var(--text-sm);
  line-height: 1.35;
  word-break: break-word;
}

.stops-list--nested {
  margin-top: 0.2rem;
  padding-left: 1rem;
  display: block;
}

.stops-list--nested li {
  margin: 0;
  padding: 0;
  list-style-type: disc;
}

.stop-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.stop-label {
  font-weight: var(--font-medium);
}

.stop-uic {
  color: var(--color-fg-muted);
  font-size: var(--text-xs);
}

.stop-id {
  color: var(--color-fg-muted);
  font-size: var(--text-xs);
}

.stop-id--secondary {
  margin-left: 1rem;
  margin-top: 0.1rem;
  font-size: 0.72rem;
}

.stops-empty {
  margin: 0;
  color: var(--color-fg-muted);
  font-size: var(--text-sm);
}

.routes-empty-state {
  background: var(--color-bg);
  border: 1px dashed var(--color-border-emphasis);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.routes-empty-state h2 {
  margin: 0;
  color: var(--color-fg);
  font-size: var(--text-xl);
}

.routes-empty-state p {
  margin: var(--space-2) 0 var(--space-4) 0;
  color: var(--color-fg-muted);
}

@media (max-width: 991px) {
  .routes-gtfs-map-top-right {
    top: calc(var(--space-3) + 42px);
    right: var(--space-3);
    max-width: calc(100% - 1.5rem);
  }

  .routes-gtfs-map-controls {
    top: var(--space-3);
    left: var(--space-3);
    max-width: calc(100% - 1.5rem);
  }

  .routes-toolbar__inline {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .routes-toolbar__inline-item--search {
    width: 100%;
  }

  .route-card__header--matched,
  .direction-block__columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .routes-page {
    padding: 0 0 var(--space-4);
  }

  .routes-gtfs-map-shell {
    --zoom-banner-top: 88px;
  }

  .routes-gtfs-map-top-right {
    top: calc(var(--space-2) + 92px);
    right: var(--space-2);
    max-width: calc(100% - 1rem);
    flex-direction: column;
    align-items: flex-end;
  }

  .routes-gtfs-map-overlay,
  .routes-gtfs-map-overlay .header-summary {
    max-width: calc(100vw - 2rem);
  }

  .routes-gtfs-map-controls {
    top: var(--space-2);
    left: var(--space-2);
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
    gap: var(--space-1);
    flex-wrap: wrap;
  }

  .routes-gtfs-map-search {
    flex: 1 0 100%;
    width: 100%;
    min-width: 100%;
  }

  .routes-gtfs-map-controls .filter-item .btn {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  .routes-container {
    padding: 0 0.85rem;
  }

  .route-card__header,
  .route-card__panel summary,
  .route-card__panel-content,
  .route-card__badges,
  .route-card__summary,
  .direction-block,
  .stops-column {
    padding: var(--space-2);
  }

  .variant-map {
    height: 260px;
  }

  .route-meta__attributes {
    grid-template-columns: 1fr;
  }

  /* Variant name and labels stacked, overlap and status on their own line. */
  .route-card__panel summary {
    flex-wrap: wrap;
  }

  .route-card__panel-summary-main {
    flex: 1 1 calc(100% - 1.5rem);
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .route-card__panel-summary-main > * + *::before {
    display: none;
  }

  .route-card__panel-summary-badge {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
  }
}
