/* Dankie Driver: the passenger app. Built on slip-base.css (palette, mono figures, frosted
   header, the slip). A rank is a till roll of destinations, each with hours and price on one
   line; tap one and its slip prints. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.dk {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font-family: var(--ui); font-size: 17px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column;
}
h1, h2, p { margin: 0; }
a { color: var(--blue); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
.dk-main:focus { outline: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------------ map + panel
   The frosted header floats over the top of the map, so the map starts under it. */

.dk-app {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  margin-top: calc(-1 * (var(--head) + env(safe-area-inset-top)));
}
.dk-map { height: 48vh; height: 48dvh; min-height: 300px; background: var(--paper-2); border-bottom: 1px solid var(--rule); }
.dk-panel { container-type: inline-size; display: flex; flex-direction: column; }
@media (min-width: 900px) {
  body.dk { height: 100vh; height: 100dvh; }
  .dk-app { flex-direction: row; }
  .dk-map { flex: 1; height: auto; border-bottom: 0; border-right: 1px solid var(--rule); }
  .dk-panel { width: 460px; flex: none; overflow-y: auto; padding-top: calc(var(--head) + 5px + env(safe-area-inset-top)); }
}

.leaflet-container { font-family: var(--ui); background: var(--paper-2); }
.leaflet-top { top: calc(var(--head) + 5px + env(safe-area-inset-top)); }
/* the base map in grey, so the red rank, the blue routes and the taxis carry the colour */
.dk-tiles { filter: grayscale(1) brightness(1.04) contrast(0.92); }
.leaflet-bar { border: 1px solid var(--rule-strong) !important; border-radius: 8px !important; overflow: hidden; box-shadow: none !important; }
.leaflet-bar a { color: var(--ink) !important; background: var(--white) !important; border-color: var(--rule) !important; }
.leaflet-control-attribution { background: rgba(255, 255, 255, 0.85) !important; color: var(--ink-2) !important; font-size: 11px; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.dk-line { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 2 6; stroke-linecap: round; opacity: 0.75; }
.dk-line.is-on { stroke: var(--blue); stroke-width: 4; stroke-dasharray: none; opacity: 1; }

/* pins: a mark with its name beside it, labels printed on white */
.pin { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; transform: translate(-8px, -8px); white-space: nowrap; cursor: pointer; }
.pin i { width: 16px; height: 16px; flex: none; background: var(--white); border: 2.5px solid var(--ink); border-radius: 50%; }
.pin b {
  font-weight: 600; font-size: 13px; line-height: 1; padding: 5px 7px 4px;
  background: var(--white); color: var(--ink); border: 1px solid var(--ink); border-radius: 3px;
}
.pin b em { font-style: normal; font-family: var(--mono); color: var(--ink-2); margin-right: 6px; }
.leaflet-marker-icon:hover .pin b, .leaflet-marker-icon:focus-visible .pin b { background: var(--blue); border-color: var(--blue); color: var(--white); }
.leaflet-marker-icon:hover .pin b em, .leaflet-marker-icon:focus-visible .pin b em { color: var(--blue-wash); }
.leaflet-marker-icon:focus-visible { outline: none; }
.pin.is-dim { opacity: 0.55; }
/* map-labels.js moves a label that would run off the edge or cover another to the left of its
   pin, or hides it until the pin is hovered or focused */
.pin.is-left { left: auto; right: 0; flex-direction: row-reverse; transform: translate(8px, -8px); }
.pin.lbl-off b { visibility: hidden; }
.leaflet-marker-icon:hover .pin.lbl-off b, .leaflet-marker-icon:focus-visible .pin.lbl-off b { visibility: visible; }
.leaflet-marker-icon:hover, .leaflet-marker-icon:focus-visible { z-index: 2000 !important; }
.pin-here { transform: translate(-11px, -11px); cursor: default; }
.pin-here i { width: 22px; height: 22px; border-radius: 3px; background: var(--red); border: 3px solid var(--white); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.pin-here b { font-size: 16px; font-weight: 600; background: var(--red); color: var(--white); border-color: var(--red); }
.pin-dest { transform: translate(-6px, -6px); }
.pin-here.is-left { transform: translate(11px, -11px); }
.pin-dest.is-left { transform: translate(6px, -6px); }
.pin-dest i { width: 12px; height: 12px; border-width: 2.5px; }
.pin-dest b { font-size: 12px; }
.pin-dest.is-on i { background: var(--blue); border-color: var(--blue); }
.pin-dest.is-on b { background: var(--blue); border-color: var(--blue); color: var(--white); }
.leaflet-marker-icon:not(.leaflet-interactive) .pin { cursor: default; }

/* ------------------------------------------------------------------ trail */

.dk-trail { padding: 16px 16px 0; }
.dk-trail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 0; font-size: 15px; color: var(--ink-2); }
.dk-trail li:not(:last-child)::after { content: '/'; padding: 0 8px; color: var(--rule); }
.dk-trail a { color: var(--ink-2); display: inline-block; padding: 12px 0; margin: -12px 0; min-height: 44px; } /* 44 px to tap, same layout */
.dk-trail [aria-current] { color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------------ main */

.dk-main { flex: 1; padding: 12px 16px 32px; }
.dk-main h1 { font-size: 28px; line-height: 1.15; font-weight: 500; text-wrap: balance; }
.dk-lede { margin-top: 4px; color: var(--ink-2); font-size: 16px; }

.dk-list { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.dk-list li { border-bottom: 1px solid var(--rule); }
.dk-list a {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 4px;
  color: var(--ink); text-decoration: none; transition: background-color 0.2s var(--ease);
}
.dk-list a:hover, .dk-list a:active { background: var(--paper-2); }
.dk-code {
  flex: none; width: 48px; padding: 4px 0; text-align: center;
  border-radius: 6px; background: var(--paper-2); color: var(--ink-2);
  font-family: var(--mono); font-weight: 400; font-size: 13px; line-height: 1.25;
}
.dk-name { flex: 1; min-width: 0; font-weight: 500; font-size: 17px; line-height: 1.25; }
.dk-name small { display: block; margin-top: 2px; font-weight: 400; font-size: 14px; color: var(--ink-2); }
.dk-go { width: 18px; height: 18px; flex: none; color: var(--ink-3); }

.dk-empty { margin-top: 18px; color: var(--ink-2); font-size: 17px; }
.dk-back { display: inline-block; margin-top: 16px; font-weight: 500; }
.dk-small { margin-top: 16px; font-size: 14px; color: var(--ink-2); }

/* ------------------------------------------------------------------ fares: the till roll */

/* the fare list is the till roll: dashed tear lines between entries */
.dk-fares { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px dashed var(--rule-strong); }
.dk-fare { border-bottom: 1px dashed var(--rule-strong); }
.dk-fare-btn {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 10px;
  width: 100%; min-height: 64px; padding: 12px 4px 4px; text-align: left;
  background: none; border: 0; cursor: pointer; color: var(--ink);
  transition: background-color 0.2s var(--ease);
}
.dk-fare-btn:hover { background: var(--paper-2); }
.dk-fare-btn[aria-expanded='true'] { background: var(--blue-wash); }
.dk-to { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 17px; font-weight: 500; line-height: 1.25; }
.dk-to-name { overflow-wrap: anywhere; }
.dk-to::after { content: ''; flex: 1; min-width: 16px; border-bottom: 2px dotted var(--rule-strong); transform: translateY(-4px); }
.dk-price { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--blue); }
.dk-when { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 13px; }
.dk-time { font-family: var(--mono); color: var(--ink-3); }
.dk-fare.is-closed .dk-to, .dk-fare.is-closed .dk-price { color: var(--ink-2); }

/* running now / last taxi soon / closed, set by the live update */
.dk-open { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--go); }
.dk-open::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dk-open:empty { display: none; }
.dk-open.is-soon { color: var(--soon); }
.dk-open.is-closed { color: var(--stop); }

.dk-live { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 0 4px 12px; font-size: 14px; color: var(--ink-2); }
.dk-load { display: inline-flex; align-items: center; gap: 8px; }
.dk-load:empty { display: none; }
.dk-seats { display: inline-flex; gap: 2px; }
.dk-seats i { width: 5px; height: 12px; border-radius: 1px; background: var(--rule); }
.dk-seats i.on { background: var(--ink); }

/* ------------------------------------------------------------------ the slip (signature) */

.dk-slip {
  position: fixed; left: 50%; bottom: 0; z-index: 1100; width: min(560px, 100%); translate: -50% 0;
  max-height: 80dvh; overflow-y: auto;
  padding: 28px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(10, 14, 30, 0.10);
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.55s var(--ease), visibility 0s 0.55s;
  visibility: hidden;
}
.dk-slip[hidden] { display: none; }
.dk-slip.is-open { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path 0.55s var(--ease); }
@media (min-width: 900px) { .dk-slip { left: auto; right: 0; translate: none; width: 460px; } }
.dk-slip-top { display: flex; justify-content: space-between; align-items: center; }
.dk-slip-close { width: 44px; height: 44px; margin: -12px -10px -12px 0; display: grid; place-items: center; border-radius: 50%; background: none; border: 0; cursor: pointer; color: var(--ink); }
.dk-slip-close:hover { background: var(--paper-2); }
.dk-slip-to { font-size: 22px; line-height: 1.2; font-weight: 500; margin-top: 12px; }
.dk-slip-to:focus { outline: none; }
.dk-slip-from { font-size: 15px; color: var(--ink-2); }
.dk-slip-fare { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0; padding: 12px 0; border-block: 1.5px dashed var(--ink); }
.dk-slip-fare span { font-size: 15px; color: var(--ink-2); }
.dk-slip-fare b { font-family: var(--mono); color: var(--blue); font-size: 56px; line-height: 1; font-weight: 600; letter-spacing: -0.03em; }
.dk-slip .slip-rows dd .dk-seats { vertical-align: -1px; margin-right: 6px; }
.dk-slip-note { margin-top: 16px; font-size: 13px; color: var(--ink-3); }

.dk-preview {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; margin-top: 20px; border-radius: 10px;
  font-size: 16px; font-weight: 600; color: var(--white); background: var(--blue); border: 0; cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.1s;
}
.dk-preview:hover { background: var(--blue-deep); }
.dk-preview:active { transform: scale(0.98); }
.dk-preview[aria-pressed='true'] { background: var(--white); color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.dk-preview svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------------ footer */

.dk-foot {
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-3);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px;
}
.dk-foot a { display: inline-block; padding: 13px 0; margin: -13px 0; }

/* ------------------------------------------------------------------ taxis on the map, trip preview */

.dk-taxi-icon { transition: transform 1s linear; }
.leaflet-zoom-anim .dk-taxi-icon { transition: none; }
/* a minibus seen from above: a pill, so it never reads as a rank pin */
.dk-taxi { display: block; width: 22px; height: 12px; margin: 2px -3px; border-radius: 6px; background: var(--white); border: 2.5px solid var(--blue); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.dk-taxi.is-in { background: var(--blue-wash); border-color: var(--ink); }
.dk-taxi.is-trip { width: 30px; height: 16px; margin: 3px -4px; border-radius: 8px; background: var(--white); border: 3.5px solid var(--blue); }
.dk-trip-line { stroke: var(--red); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; opacity: 0.95; }
.dk-trip {
  position: absolute; z-index: 800; top: calc(var(--head) + env(safe-area-inset-top) + 17px); left: 56px; right: 12px; max-width: 420px;
  display: flex; flex-direction: column; gap: 2px; padding: 18px 14px 10px;
  background: var(--white); box-shadow: 0 2px 12px rgba(17, 18, 20, 0.18);
  -webkit-mask: radial-gradient(circle 4px at 8px 0, #0000 98%, #000) 0 0 / 16px 100% repeat-x;
          mask: radial-gradient(circle 4px at 8px 0, #0000 98%, #000) 0 0 / 16px 100% repeat-x;
  font-size: 14px; color: var(--ink-2);
}
.dk-trip b { font-size: 17px; font-weight: 500; color: var(--ink); line-height: 1.2; }
.dk-trip[hidden] { display: none; }
.leaflet-tooltip { font-family: var(--ui); font-weight: 500; background: var(--white); color: var(--ink); border: 1px solid var(--ink); box-shadow: none; }
.leaflet-tooltip-top::before { border-top-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .dk-slip, .dk-slip.is-open, .dk-taxi-icon, .dk-fare-btn, .dk-list a { transition: none; }
}

/* a fare change the association has announced, and the holding-area note */
.dk-next { margin: -4px 4px 12px; padding-left: 12px; box-shadow: inset 3px 0 0 var(--red); font-size: 14px; font-weight: 500; color: var(--ink); }
.dk-next::before { content: 'Changing: '; font-weight: 400; color: var(--ink-2); }
.dk-hold { margin-top: 16px; padding: 12px 16px; border-radius: 10px; background: var(--paper-2); font-size: 15px; color: var(--ink); }

@media (pointer: coarse), (max-width: 760px) {
  .leaflet-touch .leaflet-bar a { width: 44px !important; height: 44px !important; line-height: 44px !important; font-size: 22px !important; }
}

/* "Add to home screen" bar (js/install.js) */
.dk-install {
  position: fixed; z-index: 1200; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 436px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px;
  background: var(--ink); color: var(--white); border-radius: 14px; box-shadow: var(--lift); font: 400 15px/1.4 var(--ui);
  animation: dk-install-in 0.3s var(--ease);
}
.dk-install p { margin: 0; flex: 1 1 220px; }
.dk-install-do { display: flex; gap: 8px; margin-left: auto; }
.dk-install button { min-height: 44px; padding: 0 16px; border-radius: 10px; font: 600 15px var(--ui); cursor: pointer; }
.dk-install-go { border: 0; background: var(--red); color: var(--white); }
.dk-install-x { border: 1px solid rgba(255, 255, 255, 0.35); background: transparent; color: var(--white); }
.dk-install button:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
@keyframes dk-install-in { from { opacity: 0; translate: 0 12px; } }
@media (prefers-reduced-motion: reduce) { .dk-install { animation: none; } }
