:root {
  color: #172033;
  background: #f5f7fa;
  font-family: system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
}

.page {
  width: 100%;
  padding: 1rem;
}

.page.ultrawide {
  max-width: 100rem;
  margin-inline: auto;
}

.page__header {
  margin-bottom: 1rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3rem);
}

.panel {
  padding: 1.5rem;
  border: 1px solid #dce2eb;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 0.25rem 1rem rgb(23 32 51 / 5%);
}

.panel h2 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.panel p {
  margin-bottom: 0;
  color: #52617a;
  line-height: 1.6;
}

form,
.viewer {
  margin-top: 0.75rem;
}

#load-panel.loaded {
  padding: 0.75rem 1rem;
}

#load-panel.loaded h2,
#load-panel.loaded > p:not(#status),
#load-panel.loaded #status,
#load-panel.loaded #load-form label {
  display: none;
}

#load-form {
  margin: 0;
}

#load-form label {
  display: inline;
  margin: 0 0.5rem 0 0;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-controls,
.pagination,
.table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.history-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.history-select-label {
  margin: 0;
  font-weight: 600;
}

.history-controls[hidden] {
  display: none;
}

.warning-filter-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 0.75rem 0;
}

.warning-filter-columns h3 {
  margin: 0 0 0.25rem;
}

.warning-filter-category {
  border: 1px solid #dce2eb;
  border-radius: 0.35rem;
  padding: 0.75rem;
}

.warning-types,
.warning-tables {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin: 0;
}

.warning-types label,
.warning-tables label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}

.warning-filter-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.history-dropdown {
  position: relative;
}

#history-back,
#history-forward,
#history-select {
  min-width: 2.5rem;
  padding-inline: 0.5rem;
  text-align: center;
}

.history-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  min-width: 14rem;
  margin-top: 0.25rem;
  overflow: hidden;
  border: 1px solid #aebbd0;
  border-radius: 0.35rem;
  background: #fff;
  box-shadow: 0 0.25rem 1rem rgb(23 32 51 / 12%);
}

.history-menu[hidden] {
  display: none;
}

.history-menu-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  text-align: left;
  white-space: nowrap;
}

.history-menu-item[aria-selected="true"] {
  background: #eaf1fb;
  font-weight: 700;
}

button:where(:not(#map-canvas button)),
select,
input {
  font: inherit;
}

button:where(:not(#map-canvas button)),
select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #aebbd0;
  border-radius: 0.35rem;
  background: #fff;
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
}

#ultrawide-toggle[aria-pressed="true"] {
  border-color: #1554a0;
  background: #eaf1fb;
  color: #1554a0;
}

#ultrawide-toggle {
  margin-left: auto;
}

input[type="file"] {
  max-width: 100%;
}

.route-color-swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.5rem;
  border: 1px solid #aebbd0;
  vertical-align: -0.1rem;
}

.route-header-swatch {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.35rem;
  border: 1px solid #aebbd0;
  border-radius: 0.2rem;
  vertical-align: -0.12rem;
}

.accessibility-icon,
.bikes-icon,
.cars-icon,
.pickup-dropoff-icon {
  display: inline-block;
  line-height: 1;
  vertical-align: -0.05rem;
}

.accessibility-icon.not-accessible {
  filter: grayscale(1);
  opacity: 0.55;
}

.route-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1554a0;
  text-align: left;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

#agency-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: 80vh;
  overflow: auto;
  border: 1px solid #aebbd0;
  border-radius: 0.5rem;
}

#fare-dialog,
#shape-comparison-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: 80vh;
  overflow: auto;
  border: 1px solid #aebbd0;
  border-radius: 0.5rem;
}

#agency-dialog::backdrop,
#fare-dialog::backdrop,
#shape-comparison-dialog::backdrop {
  background: rgb(0 0 0 / 35%);
}

#shape-comparison-form input {
  width: 100%;
  min-width: 0;
}

.shape-id-field {
  margin-top: 0.75rem;
}

.shape-id-field label {
  display: block;
  margin: 0 0 0.25rem;
}

.shape-id-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.5rem;
  align-items: center;
  gap: 0.5rem;
}

#shape-comparison-form input.shape-id-invalid {
  border: 2px solid #c62828;
  outline-color: #c62828;
}

#shape-comparison-form input.shape-id-invalid:focus {
  outline: 2px solid #c62828;
  outline-offset: 1px;
}

.shape-id-status {
  display: inline-block;
  min-height: 1.25rem;
  margin: 0;
  text-align: center;
  font-size: 1rem;
}

#shape-comparison-error:not(:empty) {
  margin-top: 0.75rem;
  color: #a32121;
}

.route-map-icon {
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 1;
}

#route-heading {
  margin-top: 0.5rem;
}

.route-properties {
  display: grid;
  grid-template-columns: minmax(10rem, max-content) minmax(0, 1fr);
  gap: 0.5rem 1rem;
  overflow-wrap: anywhere;
}

.route-properties dt {
  font-weight: 600;
}

.route-properties dd {
  margin: 0;
  white-space: pre-wrap;
}

.route-properties .not-provided {
  color: #a4adbb;
}

#route-variants h4 {
  margin-bottom: 0.5rem;
  overflow-wrap: anywhere;
}

#route-variants h5 {
  margin-bottom: 0.5rem;
}

#route-variants > section {
  margin-bottom: 1.5rem;
}

#route-variants details {
  margin-top: 0.5rem;
}

.variant-expanders {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin-top: 0.5rem;
}

.variant-expanders .variant-expander {
  margin-top: 0;
}

.timetable {
  overflow-x: auto;
  font-family: monospace;
}

.timetable-date-range {
  margin: 0.75rem 0 0.25rem;
  color: #52617a;
  font-size: 0.85rem;
  font-family: monospace;
}

.timetable-row,
.timetable-headings {
  display: grid;
  grid-template-columns: 2.5rem repeat(var(--timetable-columns), 8rem);
  column-gap: 0.75rem;
  align-items: baseline;
  white-space: nowrap;
}

.timetable-headings {
  margin-bottom: 0.25rem;
}

.timetable-popular-days,
.timetable-hour {
  font-weight: bold;
}

.timetable-day-column:nth-child(2) {
  border-right: 1px solid #d7dbe2;
  padding-right: 0.75rem;
  margin-right: 0.75rem;
}

.timetable-exception-dates {
  margin-top: 0.5rem;
  font-family: monospace;
}

#route-variants summary {
  cursor: pointer;
  font-weight: 600;
}

#all-route-stops {
  margin-top: 1.5rem;
}

#all-route-stops summary {
  cursor: pointer;
  font-weight: 600;
}

#all-route-stops ol,
#route-variants ol {
  padding-left: 1.5rem;
}

.variant-link {
  margin-right: 1rem;
}

#trip-detail details,
#trip-detail section,
#date-schedule {
  margin-top: 1rem;
}

#trip-route-details summary,
#trip-detail section h3,
#date-schedule h3 {
  font-weight: 700;
  cursor: pointer;
}

#trip-stop-list {
  padding-left: 1.5rem;
}

.trip-stop-time[aria-selected="true"] {
  background: #eaf1fb;
  outline: 1px solid #9bb7dd;
}

.trip-stop-row {
  display: grid;
  grid-template-columns: 2rem 18rem 12rem 10rem;
  align-items: center;
  gap: 0.5rem;
}

.trip-inline-fare {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.trip-stop-time {
  display: grid;
  grid-template-columns: 5.5rem 5.5rem;
  width: 12rem;
  padding: 0.35rem 0.5rem;
  border: 0;
  background: transparent;
  font-family: monospace;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.trip-arrival-time,
.trip-departure-time {
  display: block;
  white-space: nowrap;
  text-align: left;
}

.trip-stop-details {
  white-space: nowrap;
}

.trip-stop-item {
  margin-bottom: 0.25rem;
}

.trip-calendar-summary p {
  margin: 0.25rem 0;
  color: #52617a;
}

.trip-calendar-table {
  width: auto;
  max-width: 100%;
  margin-top: 0.25rem;
}

.trip-calendar-table th,
.trip-calendar-table td {
  min-width: 2.5rem;
  max-width: none;
  text-align: center;
  white-space: nowrap;
}

.trip-calendar-table th:first-child,
.trip-calendar-table td:first-child {
  min-width: 8rem;
  max-width: 10rem;
  text-align: left;
}

.trip-calendar-table th:nth-child(2),
.trip-calendar-table td:nth-child(2) {
  min-width: 18rem;
  text-align: left;
}

.trip-calendar-active {
  color: #1554a0;
  font-weight: 700;
}

.date-schedule-current-day {
  outline: 2px solid #1554a0;
  outline-offset: -2px;
}

.trip-calendar-exception {
  color: #1554a0;
  font-weight: 700;
}

.trip-inline-fare {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #52617a;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.trip-fare-origin,
.trip-fare-value {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

#trip-fares table,
#schedule-variants table {
  margin-top: 0.75rem;
}

.schedule-exception-button,
.schedule-date-button {
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1554a0;
  text-decoration: underline;
}

#clear-filter {
  margin-top: 0.75rem;
}

#status:not(:empty),
#table-summary {
  margin-top: 1rem;
}

.loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.75rem;
  border: 3px solid #dce2eb;
  border-top-color: #1554a0;
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
  vertical-align: middle;
}

.loading-spinner[hidden] {
  display: none;
}

#loading-progress {
  display: block;
  width: min(24rem, 100%);
  height: 0.75rem;
  margin-top: 0.75rem;
}

#loading-progress[hidden] {
  display: none;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.viewer label {
  margin-top: 1.25rem;
}

.table-controls input {
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #aebbd0;
  border-radius: 0.35rem;
}

.table-scroll {
  max-width: 100%;
  margin-top: 0.75rem;
  overflow: auto;
  border: 1px solid #dce2eb;
  border-radius: 0.35rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  min-width: 8rem;
  max-width: 24rem;
  padding: 0.65rem;
  border-bottom: 1px solid #dce2eb;
  overflow-wrap: anywhere;
  vertical-align: top;
  white-space: pre-wrap;
}

th {
  background: #f5f7fa;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.warnings-table th:nth-child(1),
.warnings-table td:nth-child(1) {
  width: 6rem;
  min-width: 6rem;
  max-width: 6rem;
  white-space: nowrap;
}

.warnings-table th:nth-child(2),
.warnings-table td:nth-child(2) {
  width: 14rem;
  min-width: 14rem;
  max-width: 14rem;
  overflow-wrap: anywhere;
}

.warnings-table th:nth-child(3),
.warnings-table td:nth-child(3) {
  width: 4rem;
  min-width: 4rem;
  max-width: 4rem;
  text-align: right;
  white-space: nowrap;
}

.pagination {
  margin-top: 1rem;
}

.table-selection-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.table-selection-row label {
  margin: 0;
}

#stops-map,
#routes-map {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}

#stops-map[hidden],
#routes-map[hidden] {
  display: none;
}

#feed-summary {
  margin-left: auto;
  color: #52617a;
  white-space: nowrap;
}

.pagination label {
  margin: 0 0 0 0.75rem;
}

#date-schedule .form-controls {
  align-items: center;
}

#date-schedule .form-controls label {
  margin: 0;
}

#schedule-date-prev,
#schedule-date-next,
#schedule-date {
  height: 2.25rem;
}

#schedule-date-prev,
#schedule-date-next {
  min-width: 2.25rem;
  padding: 0;
  line-height: 1;
}

.date-schedule-rule {
  margin-bottom: 0.75rem;
}

.date-schedule-rule-header,
.date-schedule-rule-range,
.date-schedule-rule-exception {
  margin-bottom: 0.25rem;
}

.date-schedule-week-legend {
  margin: 0.25rem 0 0;
  color: #52617a;
  font-size: 0.75rem;
}

#map-heading {
  margin-top: 0.5rem;
}

#map-error:not(:empty) {
  color: #a32121;
}

.map-layout {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

#map-canvas {
  width: 100%;
  min-width: 0;
  height: 65vh;
  min-height: 24rem;
}

#map-canvas-container {
  position: relative;
  flex: 1;
  min-width: 0;
}

#map-canvas.map-canvas--no-basemap {
  background-color: #f8fafc;
}

#map-sidebar {
  width: 24rem;
  max-height: 65vh;
  overflow: auto;
}

#map-variant-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 1rem;
}

#map-variant-controls[hidden] {
  display: none;
}

#map-variant-controls label {
  margin: 0;
}

#map-route,
#map-variant {
  min-width: 16rem;
  max-width: 100%;
}

.map-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.map-option input {
  margin: 0;
}

.map-settings {
  position: relative;
  overflow: visible;
}

.map-settings-menu {
  position: absolute;
  z-index: 1;
  top: 100%;
  right: 0;
  min-width: max-content;
  padding: 0.75rem;
  border: 1px solid #aebbd0;
  border-radius: 0.35rem;
  background: #fff;
}

.map-settings-menu .map-option + .map-option {
  margin-top: 0.5rem;
}

.stop-routes {
  margin: 0;
  padding-left: 1rem;
}

.stop-routes--compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  padding: 0;
  list-style: none;
}

.map-stop-list-toggle {
  padding: 0.1rem 0.4rem;
  margin-right: 0.5rem;
}

#map-sidebar h3 {
  display: flex;
  align-items: flex-start;
  overflow-wrap: anywhere;
}

#map-sidebar li {
  margin-bottom: 0.5rem;
}

.shape-comparison-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.shape-range-color-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.shape-range-color-toggle input {
  margin-top: 0.3rem;
}

.shape-comparison-legend-item::before {
  display: inline-block;
  width: 1.25rem;
  height: 0.25rem;
  margin-right: 0.35rem;
  background: var(--shape-color);
  content: "";
  vertical-align: middle;
}

.shape-range {
  display: block;
  width: 100%;
  margin-bottom: 0.35rem;
  text-align: left;
}

#map-sidebar h4 {
  margin: 0.75rem 0 0.35rem;
}

.map-variant-label {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: inherit;
  text-align: left;
}

.map-variant-label:hover,
.map-variant-label:focus-visible,
.map-variant-label.map-variant-hover,
.map-variant-label[aria-pressed="true"] {
  color: #b33a08;
  text-decoration: underline;
}

.stop-details-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1554a0;
  line-height: inherit;
  text-decoration: underline;
}

#map-canvas .maplibregl-popup-content {
  width: min(32rem, calc(100vw - 3rem));
  max-width: min(32rem, calc(100vw - 3rem));
  max-height: 55vh;
  overflow: auto;
}

#map-canvas .maplibregl-popup-content h3 {
  margin-bottom: 0.5rem;
}

#map-canvas .route-properties {
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
  font-size: 0.85rem;
}

#map-sidebar .map-stop-highlight {
  background: #ffe2cc;
  outline: 2px solid #e95e21;
}

@media (max-width: 700px) {
  .map-layout {
    flex-direction: column;
  }

  #map-canvas-container {
    flex: none;
    width: 100%;
  }

  #map-canvas {
    flex: none;
    width: 100%;
    height: 55vh;
  }

  #map-sidebar {
    width: 100%;
    max-height: 20rem;
  }
}
