/* The tapped bus (P2.22 step 4): docs/design.md "A tapped bus" and the
   passed-stop rule. Moved out of unified.css and redrawn from the canvas's
   Bus_* boards (their .bd-* rules). The layout shell it sits in
   (.sb-body.vehicle-mode) is shell.css's; the header no longer carries a delay chip (P5.9q); its
   .veh-chip rules stay in unified.css only because css_contrast.test.mjs pins them.

   --veh-color is the route colour and --veh-ink the text colour that reads
   on it (white, or dark on a light route colour: textOn, P2.18); both are
   set inline on the header by vehicle-sheet.js. */

/* ── Header: a block in the route colour ───────────────────────────────
   P2.22g: from 600px a 16px card inside the panel gutter (the sheet body's
   own padding), under the navy card; on a phone it is the sheet's top
   (shell.css), so the corners stay square there. P5.9q: one row, 44px
   buttons with 10px round them (the left 16px keeps the badge off the
   sheet's rounded corner). */
.veh-header {
  padding: 10px 10px 10px 16px; background: var(--veh-color, var(--navy));
  color: var(--veh-ink, #fff);
}
@media (min-width: 600px) { .veh-header { border-radius: var(--radius-card); } }
.veh-top { display: flex; align-items: center; gap: 8px; }
.veh-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 24px; padding: 0 8px; flex-shrink: 0;
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 800;
  background: color-mix(in srgb, var(--veh-ink, #fff) var(--veh-wash, 22%), transparent);
  box-shadow: inset 0 0 0 var(--veh-ring, 0px) var(--veh-ink, #fff);   /* a barely tinted badge keeps its pill outline (P5.9x review) */
  color: var(--veh-ink, #fff);
}
.veh-hs {
  flex: 1; min-width: 0; font-size: 14px; font-weight: 700;
  /* One line when it fits; a long name wraps to a second (P2.22j), and only
     a third line is cut with an ellipsis. */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere; line-height: 1.25;
}
/* Track and close sit together at the right; the destination wraps, they never leave the row. */
/* Track: the ink colour as the button (white on most routes), the route
   colour as its text — the canvas's white "Track" on the blue header. */
.veh-track {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px; flex-shrink: 0;
  border: none; border-radius: var(--radius-pill); cursor: pointer;
  background: var(--veh-ink, #fff); color: var(--veh-color, var(--navy));
  font-family: inherit; font-size: 13px; font-weight: 800;
}
/* Tracking now: green, with a small pulsing stop square. #15803d is the
   darker green (white on it is 5.0:1; --live-dot's #16a34a is 3.3:1). */
.veh-track[aria-pressed="true"] { background: #15803d; color: #fff; }
.veh-track[aria-pressed="true"]::before {
  content: ''; width: 9px; height: 9px; margin-right: 8px;
  background: #fff; border-radius: 2px;
  animation: veh-track-rec 1.4s ease-in-out infinite;
}
@keyframes veh-track-rec { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .veh-track[aria-pressed="true"]::before { animation: none; }
}
.veh-close {
  width: 44px; height: 44px; flex-shrink: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-pill); cursor: pointer;
  background: color-mix(in srgb, var(--veh-ink, #fff) 16%, transparent);
  color: var(--veh-ink, #fff);
}
/* The line under the row (P5.13 item 12): "<Operator> · <lateness> · <N s ago>", in the header's own ink. It wraps
   (a not-started text or a waiting coach is longer than the three parts); the operator is the same bold text
   for every operator, no link, no underline (round 2). */
.veh-meta { margin: var(--space-8) 6px var(--space-12) 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.veh-meta .veh-late { font-weight: 800; }
.veh-meta .veh-op { font-weight: 700; }
.veh-meta .veh-sep { padding: 0 6px; opacity: .7; }
.veh-meta .veh-op, .veh-meta .veh-late, .veh-meta .veh-age { white-space: nowrap; }   /* an item never breaks inside itself; the line wraps after a dot (the <wbr>) */

/* A cancelled trip (P5.12): one line under the header, in the late-red token on the sheet surface. */
.veh-cancelled { padding: 8px 14px; font-size: 14px; font-weight: 700; color: var(--due-late); background: var(--surface); border-bottom: 1px solid var(--due-late); }

/* ── The trip's stops ────────────────────────────────────────────────── */
.veh-stops { background: transparent; }
.veh-stop-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; min-height: 44px; box-sizing: border-box;
  border-radius: 10px; font-size: 13px; color: var(--ink);
  cursor: pointer;
}
.veh-stop-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--veh-edge, var(--veh-color, var(--navy)));
}
body.dark .veh-stop-dot { background: var(--veh-color, var(--navy)); }
.veh-stop-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.veh-stop-time { font-size: 13px; color: var(--ink-secondary); white-space: nowrap; }
.veh-stop-time .eta-pred { font-weight: 700; color: var(--ink); }
.veh-stop-time .eta-pred.row-due { color: var(--due); }
.veh-stop-time .eta-struck {
  color: var(--ink-muted); font-size: 11px; text-decoration: line-through; margin-left: 4px;
}
/* A passed stop's time (P5.13 item 12): grey when recorded, grey and struck through when it is the scheduled time. */
.veh-stop-time .pass-act { font-weight: 600; }
.veh-stop-time .pass-est { font-weight: 400; }
.veh-stop-time .pass-sched { text-decoration: line-through; }
.veh-stops-key { padding: 8px 16px 12px; font-size: 11px; line-height: 1.4; color: var(--ink-muted); }

/* The next stop: the route colour at 7%, bold name. */
.veh-stop-row.next {
  background: color-mix(in srgb, var(--veh-color, var(--navy)) 7%, transparent);
}
.veh-stop-row.next .veh-stop-name { font-weight: 700; }

/* A stop the bus has probably passed (docs/design.md): ink-muted text, a
   neutral dot and its time (no "passed" chip since P5.13 item 12). Never faded with opacity — that would
   drop the text under 4.5:1. */
.veh-stop-row.passed,
.veh-stop-row.passed .veh-stop-time { color: var(--ink-muted); }
.veh-stop-row.passed .veh-stop-dot { background: var(--stop-dot); }
.veh-passed-chip {
  display: inline-flex; align-items: center; flex-shrink: 0;
  padding: 4px 12px; border-radius: var(--radius-pill);
  background: var(--chip-neutral-bg); color: var(--chip-neutral-ink);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}

/* ── The tapped bus on the map: scaled to 1.1 (docs/design.md "Bus icon").
   The SVG's own origin is the bus's anchor, so scale around it. ───────── */
/* A light route colour's icon outline is dark on the light map (bus-icon.js);
   on the dark map it goes back to white (P2.22c). */
body.dark .bus-edge-dark { stroke: #fff; }
.bus-sel svg { transform: scale(1.1); transform-origin: 0 0; }
/* P5.9r/P5.9y: droplets are .75 at zoom 12, .8 at 13, .85 at 14, full size from 15 (bus-declutter.js iconScale);
   a selected one keeps its 1.1 */
.bus-s75 svg { transform: scale(.75); transform-origin: 0 0; }
.bus-sel.bus-s75 svg { transform: scale(.825); }
.bus-s80 svg { transform: scale(.8); transform-origin: 0 0; }
.bus-sel.bus-s80 svg { transform: scale(.88); }
.bus-s85 svg { transform: scale(.85); transform-origin: 0 0; }
.bus-sel.bus-s85 svg { transform: scale(.935); }
/* A bus that loses the clash at zoom 14 and up (bus-icon.js discIcon): a 12 px SVG disc in its route colour
   with the droplet's edge, inside a 24 px box that is the tap target. Drawn under every droplet (live.js zIndexOffset). */
.bus-disc { position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; }

/* ── A private operator's coach (O.7f): the tap card, not the trip view ─────
   A floating card (docs/design.md: 16 px corners, surface fill, spacing 4/8/12/16/24).
   It holds the trip view's header (.veh-header, P5.13 item 12: the same for every
   operator), in the operator's droplet colour. Phones: along the bottom with a
   16 px gutter; 600 px and up: bottom left of the map, beside the panel while it is open. */
.coach-card {
  position: fixed; z-index: 1300; left: 16px; right: 16px; bottom: 16px;
  max-width: 420px; margin: 0 auto; overflow: hidden;
  background: var(--surface); color: var(--ink);
  border-radius: var(--radius-card); box-shadow: var(--shadow-map-control);
  font-family: inherit; outline: none;
}
.coach-card[hidden] { display: none; }
.coach-card .veh-header { border-radius: 0; }
@media (min-width: 600px) {
  .coach-card { left: 24px; right: auto; bottom: 24px; width: 360px; margin: 0; }
  body:has(#sidebar.open) .coach-card { left: calc(clamp(360px, 26vw, 420px) + 24px); }
}

/* The plain bus (P2.23c a3w): on a phone its sheet is as tall as its header, not the 45vh
   default, so there is no empty area under it. From 600px the panel is unchanged. */
@media (max-width: 599px) {
  #sidebar.vehicle-open.vehicle-plain { height: auto; }
}


/* P5.13 A3: the bus card, when the bus's last fix is over 5 minutes old */
