/*
 * لوين؟ — /trip journey planner. Loaded only on /trip (before app.css, so
 * every rule is scoped under .page--trip or .planner to win by specificity).
 *
 * Phones: the map is the canvas, a search card floats on top and the
 * results live in a bottom sheet (peek / half / full). From 768px: a side
 * panel on the right (RTL start) with the search and the results.
 *
 * The one loud element is the line "placard": a white sign with a band in
 * the line's colour, like the route board behind a microbus windshield.
 */

/* ── Page frame: the planner fills the screen under the header ── */

html:has(body.page--trip) { overflow: hidden; }
body.page--trip { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.page--trip .site-main { display: flex; max-width: none; min-height: 0; padding: 0; }
.page--trip .site-footer { display: none; }
.page--trip .site-header { position: relative; z-index: 1400; padding-block: 6px; }

.trip-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0 4px; min-width: 0; }
.trip-nav a,
.trip-nav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--navy);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.trip-nav a:hover,
.trip-nav button:hover { background: var(--surface); }
.trip-nav button { border: 0; background: none; font-family: inherit; cursor: pointer; }
.trip-nav button[hidden] { display: none; }

.planner {
  --elev: 0 1px 2px rgba(20, 45, 78, 0.08), 0 6px 20px rgba(20, 45, 78, 0.12);
  --card-h: 0px;
  --sheet-visible: 0px;
  position: relative;
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.planner .ticon { flex-shrink: 0; }

/* ── Map canvas ── */

.planner__map { position: absolute; inset: 0; }
.planner .map--trip { width: 100%; height: 100%; min-height: 0; max-height: none; border-radius: 0; }
.planner .map--trip.leaflet-grab { cursor: crosshair; }
/* The centre crosshair (Enter puts the point there) only when the map is used by keyboard. */
.planner .map--trip:focus-visible ~ .map-crosshair { display: none; }
.planner .map--trip.is-keyboard:focus ~ .map-crosshair { display: block; }
.planner .map--trip:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }

/* Leaflet controls stay clear of the card (top) and follow the sheet (bottom). */
.planner .leaflet-top { top: calc(var(--card-h) + 8px); }
.planner .leaflet-bottom { bottom: var(--sheet-visible); transition: bottom 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.planner.is-dragging .leaflet-bottom { transition: none; }
.planner .leaflet-control-attribution { background: rgba(255, 255, 255, 0.92); }
.planner .layer-switch { top: calc(var(--card-h) + 16px); }

.map-hint {
  position: absolute;
  top: calc(var(--card-h) + 16px);
  left: 50%;
  z-index: 1000;
  max-width: calc(100% - 120px);
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  box-shadow: var(--elev);
  transform: translateX(-50%);
  pointer-events: none;
}
.map-hint:empty { display: none; }

.map-locate {
  position: absolute;
  bottom: calc(var(--sheet-visible) + 16px);
  left: 12px;
  z-index: 1000;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--elev);
  cursor: pointer;
  transition: bottom 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.planner.is-dragging .map-locate { transition: none; }
.map-locate .ticon { width: 22px; height: 22px; }
.map-locate:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* Start: yellow circle. Destination: teal square. A white halo keeps them clear of the tiles. */
.trip-pin { display: grid; place-items: center; cursor: grab; }
.trip-pin.leaflet-drag-target { cursor: grabbing; }
.trip-pin__shape {
  display: block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--navy);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 0 3px var(--white), 0 3px 8px rgba(20, 45, 78, 0.45);
}
.trip-pin--to .trip-pin__shape { border-radius: 6px; background: var(--teal); }
.trip-pin.leaflet-drag-target .trip-pin__shape { transform: scale(1.15); }

/* Boarding / alighting / transfer spots: a dot with a navy callout above it. */
.trip-stop {
  border: 3px solid var(--navy);
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 0 0 2px var(--white);
}
.callout {
  position: absolute;
  bottom: 14px;
  left: 50%;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(20, 45, 78, 0.3);
  transform: translateX(-50%);
}
.callout::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--navy);
}

/* ── Search card ── */

.trip-card {
  position: absolute;
  top: 8px;
  inset-inline: 8px;
  z-index: 1100;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--elev);
}

.trip-fields {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 44px;
  grid-template-rows: auto auto;
  gap: 6px 4px;
  align-items: center;
}
.trip-mark { grid-column: 1; justify-self: center; position: relative; z-index: 1; width: 14px; height: 14px; border: 2.5px solid var(--navy); }
.trip-mark--from { grid-row: 1; border-radius: 999px; background: var(--yellow); }
.trip-mark--to { grid-row: 2; border-radius: 3px; background: var(--teal); }
.trip-mark.is-active { box-shadow: 0 0 0 4px var(--white), 0 0 0 6px var(--navy); }
/* Dotted connector between the two marks. */
.trip-rail {
  grid-column: 1;
  grid-row: 1 / 3;
  justify-self: center;
  align-self: stretch;
  width: 0;
  margin-block: 25px;
  border-inline-start: 2px dotted var(--border-strong);
}
.trip-field {
  grid-column: 2;
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.trip-field[data-point="from"] { grid-row: 1; }
.trip-field[data-point="to"] { grid-row: 2; }
.trip-field.is-active { border-color: var(--navy); background: var(--white); box-shadow: inset 0 0 0 1px var(--navy); }
.trip-field:focus-within { border-color: var(--navy); background: var(--white); box-shadow: inset 0 0 0 1px var(--navy), 0 0 0 3px rgba(20, 45, 78, 0.16); }
.trip-field__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-size: 1rem;
}
.trip-field__input::placeholder { color: var(--muted); opacity: 1; }
.trip-field__input:focus { outline: none; }
.trip-field__input::-webkit-search-cancel-button { display: none; }
.trip-field.is-set .trip-field__input { font-weight: 600; }
.trip-field__clear {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.trip-field__clear .ticon { width: 18px; height: 18px; }
.trip-field__clear:hover { color: var(--navy); }
.trip-field__clear:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }

.trip-swap {
  grid-column: 3;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
}
.trip-swap:hover:not(:disabled) { border-color: var(--navy); }
.trip-swap:disabled { color: var(--border-strong); cursor: not-allowed; }
.trip-swap:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

.trip-card__row { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-inline-start: 32px; }

/* Walk limit: a pill around a native select (the phone's own picker). */
.walk-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding-inline: 12px 4px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.walk-chip .ticon { width: 18px; height: 18px; color: var(--muted); }
.walk-chip:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(20, 45, 78, 0.16); }
.walk-chip__select {
  min-height: 40px;
  padding-inline: 8px 28px;
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23142D4E' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  appearance: none;
  cursor: pointer;
}
.walk-chip__select:focus { outline: none; }

/* Suggestions under the card: my location, pick on the map, search results. */
.suggest {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  z-index: 2;
  max-height: min(60vh, 28rem);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--elev);
}
.suggest__list { margin: 0; padding: 0; list-style: none; }
.suggest__list--places:empty { display: none; }
.suggest__list--places { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.suggest__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--navy);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.suggest__item:hover,
.suggest__item:focus-visible { background: var(--surface); }
.suggest__item:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.suggest__icon { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: var(--surface); }
.suggest__item:hover .suggest__icon,
.suggest__item:focus-visible .suggest__icon { background: var(--white); }
.suggest__text { display: flex; flex-direction: column; min-width: 0; }
.suggest__name { font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.suggest__sub {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.suggest__status { margin: 6px 8px 2px; font-size: 0.875rem; color: var(--muted); }
.suggest__status:empty { display: none; }

/* ── Results sheet (phones) ── */

.trip-sheet {
  position: absolute;
  inset-inline: 0;
  /* Full height stops under the search card, so the points stay in view. */
  top: calc(var(--card-h, 0px) + 4px);
  bottom: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  margin: 0;
  border-radius: 20px 20px 0 0;
  background: var(--white);
  box-shadow: 0 -1px 2px rgba(20, 45, 78, 0.06), 0 -6px 24px rgba(20, 45, 78, 0.14);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.planner.is-dragging .trip-sheet { transition: none; }
.trip-sheet__head { flex: none; padding: 0 16px 12px; touch-action: none; cursor: grab; user-select: none; }
.trip-sheet__grip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: grab;
}
.trip-sheet__grip span { width: 44px; height: 5px; border-radius: 999px; background: var(--border-strong); }
.trip-sheet__grip:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; border-radius: 12px; }
.trip-sheet__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.trip-sheet__title { margin: 0; font-size: 1.125rem; font-weight: 700; line-height: 1.4; }
.trip-sheet__title:focus { outline: none; }
.trip-sheet__toggle {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
}
.trip-sheet__toggle:hover { border-color: var(--navy); }
.trip-sheet__toggle:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.trip-sheet__peek:empty,
.trip-sheet:not([data-snap="peek"]) .trip-sheet__peek { display: none; }
.trip-sheet__peek { margin-top: 4px; }
.trip-sheet[data-phase="intro"] .trip-sheet__toggle { display: none; }
.trip-sheet__peek-text { margin: 0; color: var(--muted); }
.trip-sheet__peek-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--navy);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.trip-sheet__peek-btn:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.trip-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
.trip-sheet[data-snap="peek"] .trip-sheet__body { visibility: hidden; }

.trip-note { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 4px; font-size: 0.8125rem; line-height: 1.5; color: var(--muted); }
.trip-note .ticon { width: 16px; height: 16px; margin-top: 2px; }
.trip-note--approx { margin-top: 12px; }
.trip-links { margin: 16px 0 0; font-size: 0.8125rem; }
.trip-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }

/* ── States ── */

.trip-state:empty { display: none; }
.state { padding: 16px 0 8px; }
.state__text { margin: 0 0 12px; line-height: 1.6; }
.state--error .state__text { font-weight: 600; }
.state__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--navy);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.pill-btn:hover { background: var(--surface); color: var(--navy); }
.pill-btn--primary { background: var(--navy); color: var(--white); }
.pill-btn--primary:hover { background: var(--navy-700); color: var(--white); }
.pill-btn:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.pill-btn .ticon { width: 18px; height: 18px; }

.skeleton { padding: 16px 0; border-bottom: 1px solid var(--border); }
.skeleton__bar { height: 14px; margin-bottom: 10px; border-radius: 7px; background: #E6ECF1; }
.skeleton__bar--wide { width: 82%; height: 30px; border-radius: 8px; }
.skeleton__bar--short { width: 46%; margin-bottom: 0; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton__bar { animation: trip-pulse 1.4s ease-in-out infinite; }
}
@keyframes trip-pulse { 50% { opacity: 0.45; } }

/* ── Routes ── */

/* Each suggestion is its own card: a clear edge, a gap between cards, and a number. */
.routes { display: grid; gap: 10px; margin: 8px 0 0; padding: 0; list-style: none; }
.route {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(20, 45, 78, 0.06);
}
.route__num {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 700;
}
.route__head {
  position: relative;
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 14px 12px;
  border: 0;
  border-radius: 16px;
  background: none;
  color: var(--navy);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.route__head:hover,
.route.is-previewed .route__head { background: var(--surface); }
/* Selected: a navy edge around the whole card and a little lift. */
.route.is-selected { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy), 0 6px 16px rgba(20, 45, 78, 0.12); }
.route.is-selected .route__head:hover { background: none; }
.route__head:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }

/* The trip at a glance: walk → placard → (transfer → placard) → walk, in reading order. */
/* Wraps rather than crushing the placards: line names stay readable. */
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; min-width: 0; }
.strip__leg { display: inline-flex; flex: none; align-items: center; gap: 2px; color: var(--muted); font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.strip__leg .ticon { width: 18px; height: 18px; }
.strip__leg--transfer { color: var(--navy); }
.strip__next { flex: none; width: 14px; height: 14px; color: var(--border-strong); }

.placard {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 4px 10px 5px 8px;
  border: 1.5px solid var(--line);
  border-top-width: 4px;
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
}
.placard .ticon { width: 18px; height: 18px; }
.placard__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.placard__name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.placard__dir { font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.placard--return .placard__dir { color: #5B1F93; }
/* Way back estimated from the outbound: a dashed sign. */
.placard--estimated { border-style: dashed; border-top-style: solid; }

.route__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 0.875rem; color: var(--muted); }
.route__best { padding: 1px 10px; border-radius: 999px; background: var(--yellow); color: var(--navy); font-size: 0.8125rem; font-weight: 700; }
.route__kind { font-weight: 700; color: var(--navy); }
.route__walk { display: inline-flex; align-items: center; gap: 2px; }
.route__walk .ticon { width: 16px; height: 16px; }
.route__trust { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.trip-badge { padding: 1px 8px; border: 1px solid; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.trip-badge--useful { border-color: #8CD9CF; background: var(--teal-50); color: #0B5E55; }
.trip-badge--new { border-color: #EBCB7A; background: var(--yellow-50); color: #6B4700; }
.votes { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.votes--ok.has-votes { color: #0B5E55; }
.votes--bad.has-votes { color: #9B1C1C; }

/* Step-by-step: a rail of dots (walking) and solid line colour (riding). */
.route__steps { padding: 4px 12px 16px; }
.trip-steps { margin: 0; padding: 0; list-style: none; }
.trip-step { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.trip-step:last-child { padding-bottom: 0; }
.trip-step::before {
  content: "";
  position: absolute;
  top: 34px;
  bottom: 2px;
  inset-inline-start: 15px;
  border-inline-start: 2px dotted var(--border-strong);
}
.trip-step:last-child::before { display: none; }
.trip-step--ride::before { inset-inline-start: 14px; border-inline-start: 4px solid var(--line); }
.trip-step__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
}
.trip-step__icon .ticon { width: 18px; height: 18px; }
.trip-step--ride .trip-step__icon { border: 2.5px solid var(--line); color: var(--navy); }
.trip-step--stop .trip-step__icon { border: 3px solid var(--navy); }
.trip-step__body { min-width: 0; padding-top: 4px; }
.trip-step__text { margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
.trip-step--ride .trip-step__text { font-weight: 700; }
.trip-step__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 0.875rem; }
.trip-step__hint { margin: 6px 0 0; font-size: 0.8125rem; line-height: 1.5; color: var(--muted); }
.trip-step__link { display: inline-flex; align-items: center; min-height: 44px; color: var(--navy); font-size: 0.9375rem; font-weight: 700; }

.dir-tag { padding: 1px 8px; border: 1px solid #8CD9CF; border-radius: 999px; background: var(--teal-50); color: #0B5E55; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.dir-tag--return { border-color: #C9A6EA; background: #F4ECFB; color: #5B1F93; }

/* Line colours: same palette and order as /map (PALETTE in map.js and trip.js). */
.lc-0 { --line: #16B8A6; }
.lc-1 { --line: #1D4ED8; }
.lc-2 { --line: #DB2777; }
.lc-3 { --line: #4D7C0F; }
.lc-4 { --line: #7B2CBF; }
.lc-5 { --line: #B91C1C; }
.lc-6 { --line: #0E7490; }
.lc-7 { --line: #9333EA; }
.lc-8 { --line: #059669; }
.lc-9 { --line: #BE185D; }

/* ── Tablet and laptop: side panel on the right (RTL start), map fills the rest ── */

@media (min-width: 48em) {
  .planner { display: grid; grid-template-columns: 22.5rem minmax(0, 1fr); }
  .planner__panel {
    position: relative;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-inline-end: 1px solid var(--border);
    background: var(--white);
  }
  .planner__map { position: relative; inset: auto; min-width: 0; }
  .planner .leaflet-top { top: 0; }
  .planner .leaflet-bottom { bottom: 0; }
  .planner .layer-switch { top: 12px; }
  .map-hint { top: 16px; }
  .map-locate { bottom: 32px; }

  /* Flex items: z-index applies even unpositioned. The card (and its suggestions) stays above the results. */
  .trip-card { position: relative; top: auto; inset-inline: auto; z-index: 2; flex: none; margin: 16px 16px 8px; padding: 0; border: 0; box-shadow: none; }
  .suggest { top: calc(100% + 4px); }

  .trip-sheet { position: static; z-index: 1; flex: 1 1 auto; min-height: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; transform: none; transition: none; }
  .trip-sheet__head { padding: 12px 16px 4px; cursor: auto; touch-action: auto; user-select: auto; }
  .trip-sheet__grip,
  .trip-sheet__toggle,
  .trip-sheet__peek { display: none; }
  .trip-sheet[data-snap="peek"] .trip-sheet__body { visibility: visible; }
  .trip-sheet__body { padding-bottom: 24px; }
}

@media (min-width: 64em) {
  .planner { grid-template-columns: 25rem minmax(0, 1fr); }
  .trip-card { margin: 20px 20px 12px; }
  .trip-sheet__head { padding-inline: 20px; }
  .trip-sheet__body { padding-inline: 20px; }
}

@media (max-width: 30em) {
  .trip-nav a { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .trip-sheet,
  .planner .leaflet-bottom,
  .map-locate { transition: none; }
}

@media (forced-colors: active) {
  .trip-field.is-active,
  .route.is-selected .route__head { outline: 3px solid CanvasText; }
  .placard { border-color: CanvasText; }
}

/* ── Phones: a compact header and search card; the card folds to one line ── */

.trip-collapse,
.trip-summary { display: none; }

@media (max-width: 47.99em) {
  .page--trip .site-header { padding: 2px 10px; min-height: 0; }
  .page--trip .brand { min-height: 40px; gap: 6px; }
  .page--trip .icon-logo { width: 28px; height: 28px; border-radius: 8px; }
  .page--trip .brand__name { font-size: 1.0625rem; }
  .page--trip .brand__tagline { display: none; }
  /* Icon-only links; the text stays as their accessible name. */
  .trip-nav a,
  .trip-nav button { justify-content: center; min-width: 44px; padding: 0; }
  .trip-nav a span,
  .trip-nav button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

  .trip-card { top: 6px; inset-inline: 6px; padding: 6px; border-radius: 16px; }
  .trip-fields { grid-template-columns: 24px minmax(0, 1fr) 40px; gap: 4px; }
  .trip-mark { width: 12px; height: 12px; border-width: 2px; }
  .trip-rail { margin-block: 22px; }
  .trip-field__input { height: 40px; padding: 0 10px; font-size: 0.9375rem; }
  .trip-field__clear { width: 40px; height: 40px; }
  .trip-swap { width: 40px; height: 40px; }
  .trip-card__row { margin-top: 4px; padding-inline-start: 28px; }

  .trip-collapse {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    margin-inline-start: auto;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--navy);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
  }
  .trip-collapse .ticon { width: 16px; height: 16px; transform: rotate(90deg); }
  .trip-collapse:hover { background: var(--surface); }
  .trip-collapse:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

  .trip-card.is-collapsed .trip-fields,
  .trip-card.is-collapsed .trip-card__row { display: none; }
  .trip-card.is-collapsed .trip-summary:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 44px;
    padding: 0 6px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--navy);
    font: inherit;
    text-align: start;
    cursor: pointer;
  }
  .trip-summary:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
  .trip-summary__mark { flex: none; width: 10px; height: 10px; border: 2px solid var(--navy); }
  .trip-summary__mark--from { border-radius: 999px; background: var(--yellow); }
  .trip-summary__mark--to { border-radius: 2px; background: var(--teal); }
  .trip-summary__text { flex: 1 1 0; min-width: 0; overflow: hidden; font-size: 0.9375rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .trip-summary__arrow { flex: none; color: var(--muted); }
  .trip-summary__edit { flex: none; padding: 4px 12px; border-radius: 999px; background: var(--surface); font-size: 0.8125rem; font-weight: 700; }
}

/* Where the suggested lines run («دمشق» / «ريف دمشق»). */
.route__gov { color: var(--muted); font-size: 0.8125rem; }
.placard__name .verified { margin-inline-start: 3px; vertical-align: -2px; }
