/* Parada's look comes from the street: the dark plate of a stop sign, the
   yellow of its code tag, the block of colour and big numerals of a bus's
   destination sign. Company colours are the only other colours on screen. */
@import url("/fonts/fonts.css");

:root {
  --bg: #edf1f3;        /* niebla: the page */
  --surface: #ffffff;   /* papel: anything you read from */
  --ink: #0f2231;       /* tinta: text, and the sign plate */
  --plate-ink: #ffffff;
  --muted: #566975;
  --line: #d5dde2;
  --signal: #ffc61a;    /* señal: live, selected, "now" */
  --signal-ink: #0f2231;
  --warn: #b4380a;
  --warn-bg: #ffe9dc;
  --good: #0b7a43;
  --bad: #b3261e;
  --shadow: 0 10px 30px rgba(15, 34, 49, 0.18);
  --tabs: 64px;
  /* the one that is chosen, among options side by side (Now, a route, a day, a setting):
     the sign plate's navy in light; in dark a raised navy, not the white text colour */
  --chosen: #0f2231;
  --chosen-ink: #ffffff;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --text: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
/* dark: chosen in js/theme.js (the phone's own setting, night-time, or the rider's choice) */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b161e;
    --surface: #14222c;
    --ink: #e9f0f4;
    --plate-ink: #e9f0f4;
    --muted: #8da0ac;
    --line: #26363f;
    --warn: #ff9a62;
    --warn-bg: #3b2213;
    --good: #58d68d;
    --bad: #ff8a80;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    --chosen: #2e4b5e;
    --chosen-ink: #ffffff;
}

* { box-sizing: border-box; }
/* The page itself never scrolls: only the panel inside it does. Without this a
   phone slides the whole app up when a field is focused and can leave it
   there, header cut off and a blank band under the tabs. */
html, body { height: 100%; margin: 0; }
html { overflow: hidden; overscroll-behavior: none; }
body {
  font: 400 16px/1.45 var(--text);
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden; position: fixed; inset: 0; width: 100%;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1, h2, h3, p { margin: 0; }
h1 { font: 700 1.9rem/1.05 var(--display); letter-spacing: 0.005em; }
h2 { font: 600 1.25rem/1.2 var(--display); padding: 22px 16px 10px; }
h3 { font: 600 1.45rem/1.1 var(--display); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.pad { padding: 6px 16px; }
.bad { color: var(--bad); }

/* ---------- layout ---------- */
/* (z-index: its zoom buttons stay under the panel that slides over the map) */
#map { position: fixed; inset: 0 0 var(--tabs) 0; visibility: hidden; z-index: 0; }
body[data-view="mapa"] #map { visibility: visible; }
#panel {
  position: fixed; inset: 0 0 var(--tabs) 0; overflow-y: auto; background: var(--bg);
  padding-bottom: 28px; overscroll-behavior: contain;
}
body[data-view="mapa"] #panel { inset: 0 0 auto 0; background: none; pointer-events: none; overflow: visible; padding: 0; }
body[data-view="mapa"] #panel > * { pointer-events: auto; }

#top { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; position: sticky; top: 0; z-index: 5; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 8px; font: 700 1.5rem/1 var(--display); }
.brand svg { stroke: none; width: 24px; height: 24px; }
#health { display: flex; gap: 5px; margin-left: auto; }
#health i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
#health i.down { background: none; box-shadow: inset 0 0 0 2px var(--bad); }
.ghost { min-width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font: 600 1rem var(--display); color: var(--muted); }
.ghost:hover { background: var(--surface); }

#tabs {
  position: fixed; inset: auto 0 0 0; height: var(--tabs); display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); z-index: 10; padding-bottom: env(safe-area-inset-bottom);
}
#tabs a { display: grid; place-items: center; align-content: center; gap: 3px; font-size: 0.74rem; font-weight: 500; color: var(--muted); }
#tabs a svg { box-sizing: content-box; padding: 3px 16px; border-radius: 999px; }
#tabs a.on { color: var(--ink); font-weight: 600; }
#tabs a.on svg { background: var(--signal); color: var(--signal-ink); }

/* On a phone, the page of a stop, a bus or a line is a sheet over the map. */
@media (max-width: 559px), (max-width: 899px) and (min-height: 501px) {
  /* the map fills the screen; the sheet covers its lower part and can be dragged by its handle */
  body.sheet #map { visibility: visible; }
  body.sheet #panel {
    inset: auto 0 var(--tabs) 0; height: var(--sheet, 55vh); border-radius: 14px 14px 0 0;
    box-shadow: 0 -6px 20px rgba(15, 34, 49, 0.25); padding-top: 0;
  }
  #panel.settling { transition: height 0.22s ease; }
  body.sheet #top { display: none; }
  body.sheet #grab { display: grid; }
  /* tucked away: just the handle and the title; nothing below should scroll into view */
  body.sheet[data-sheet="peek"] #panel { overflow: hidden; }
}
@media (max-width: 559px), (max-width: 899px) and (min-height: 501px) {
@media (prefers-reduced-motion: reduce) {
  #panel.settling { transition: none; }
}
}
#grab {
  display: none; position: sticky; top: 0; z-index: 6; width: 100%; height: 40px; place-items: center;
  background: var(--bg); border-radius: 14px 14px 0 0; touch-action: none; cursor: grab;
}
#grab i { width: 44px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.6; }
#grab:active { cursor: grabbing; }
#grab:active i, #grab:focus-visible i { opacity: 1; }

#fold { display: none; }
.time.more { background: none; border: 2px solid var(--ink); font: 600 0.9rem var(--text); display: inline-flex; align-items: center; }

@media (min-width: 900px), (min-width: 560px) and (max-height: 500px) {
  /* the panel and its tab bar slide out to the left; a handle on the edge brings them back */
  #panel, #tabs, #fold { transition: transform 0.25s ease; }
  #fold {
    display: grid; place-items: center; position: fixed; left: calc(var(--panel) + 12px); top: 50%; margin-top: -32px; width: 26px; height: 64px; z-index: 11;
    background: var(--surface); color: var(--ink); border-radius: 0 8px 8px 0; box-shadow: 4px 2px 10px rgba(15, 34, 49, 0.18);
  }
  #fold:hover { background: var(--signal); color: var(--signal-ink); }
  #fold svg { width: 18px; height: 18px; stroke-width: 2.4; transition: transform 0.25s ease; }
  body.folded #panel, body.folded #tabs { transform: translateX(calc(-100% - 24px)); }
  body.folded #fold { transform: translateX(calc(-1 * var(--panel) - 12px)); }
  body.folded #fold svg { transform: rotate(180deg); }
  /* nothing in a folded panel should be reachable by keyboard */
  body.folded #panel, body.folded #tabs { visibility: hidden; transition: transform 0.25s ease, visibility 0s 0.25s; }
}
@media (min-width: 900px), (min-width: 560px) and (max-height: 500px) {
@media (prefers-reduced-motion: reduce) {
  #panel, #tabs, #fold, #fold svg { transition: none; }
}
}

@media (min-width: 900px), (min-width: 560px) and (max-height: 500px) {
  :root { --tabs: 0px; }
  #map { visibility: visible; inset: 0; }
  #panel, body[data-view="mapa"] #panel {
    inset: 12px auto 12px 12px; width: var(--panel); border-radius: 10px; box-shadow: var(--shadow); background: var(--bg);
    pointer-events: auto; overflow-y: auto; padding-bottom: 84px;
  }
  #top { border-radius: 10px 10px 0 0; }
  #tabs { inset: auto auto 12px 12px; width: var(--panel); height: 64px; border-radius: 0 0 10px 10px; }
}

/* ---------- search ---------- */
.search { padding: 2px 12px 6px; position: relative; }
input[type="search"] {
  width: 100%; height: 50px; border-radius: 8px; border: 2px solid var(--ink); background: var(--surface);
  color: var(--ink); font: 500 1.05rem var(--text); padding: 0 14px; -webkit-appearance: none; appearance: none;
}
input[type="search"]::placeholder { color: var(--muted); font-weight: 400; }
input[type="search"]:focus { outline: 3px solid var(--signal); outline-offset: 0; }
#results:not(:empty), .results:not(:empty) { background: var(--surface); border-radius: 8px; margin-top: 6px; padding: 0 12px; }
.result { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: 0; }
.result b { font-weight: 600; }
.result small { display: block; color: var(--muted); font-size: 0.82rem; }
.pin { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--ink); flex: none; margin: 0 9px; }

/* ---------- line numbers ---------- */
/* the number on the front of the bus */
.badge {
  display: inline-grid; place-items: center; min-width: 40px; height: 30px; padding: 0 8px; border-radius: 4px;
  background: var(--c); color: #fff; font: 700 1.25rem/1 var(--display); font-variant-numeric: tabular-nums; flex: none; vertical-align: middle;
}
.lines { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px; }
.lines.big .badge { min-width: 58px; height: 46px; font-size: 1.6rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { font-size: 0.78rem; font-weight: 500; padding: 1px 8px; border-radius: 4px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.go { background: var(--signal); color: var(--signal-ink); font-weight: 600; }
.chip.bad { color: var(--bad); }
.chip.occ { background: linear-gradient(90deg, color-mix(in srgb, var(--ink) 22%, var(--bg)) var(--o), var(--bg) var(--o)); color: var(--ink); }

/* ---------- a stop and its arrivals ---------- */
.card { margin: 0 12px 14px; border-radius: 8px; overflow: hidden; background: var(--surface); }
/* the stop's sign plate */
.card > header { display: flex; align-items: center; padding: 12px 4px 12px 14px; gap: 6px; background: #0f2231; color: #fff; }
.card-title { flex: 1; min-width: 0; }
.card-title h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title p { font-size: 0.86rem; color: #b9c7d0; margin-top: 2px; }
.code { display: inline-block; background: var(--signal); color: var(--signal-ink); font: 700 0.95rem/1 var(--display); padding: 2px 6px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }
.star, .bell { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; flex: none; }
.card > header .star { color: #b9c7d0; }
.star.on, .card > header .star.on { color: var(--signal); }
.star.on svg { fill: currentColor; }
.bell.on { color: var(--ink); }
.bell.on svg { fill: var(--signal); }

.arrs { list-style: none; margin: 0; padding: 0; background: var(--surface); }
.arr { display: flex; align-items: stretch; border-top: 1px solid var(--line); }
.arr:first-child { border-top: 0; }
.arr > a { display: flex; align-items: stretch; gap: 12px; flex: 1; min-width: 0; }
/* the block of company colour with the line number, edge to edge like a destination sign */
.slab { display: grid; place-items: center; width: 62px; flex: none; background: var(--c); color: #fff; font: 700 1.9rem/1 var(--display); font-variant-numeric: tabular-nums; }
.arr-main { flex: 1; min-width: 0; display: grid; gap: 3px; align-content: center; padding: 11px 0; }
.arr-head { font: 600 1.3rem/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arr-via { font-size: 0.86rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arr-kind { font-size: 0.82rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px var(--ink); flex: none; margin-left: 2px; }
.arr.learned .dot { animation: pulse 2s infinite; }
.arr.estimated .dot { background: var(--surface); }
.arr.scheduled .dot { background: none; box-shadow: none; width: 0; margin: 0 -3px 0 0; }
.arr-time { display: grid; align-content: center; justify-items: end; padding: 0 14px 0 4px; font-family: var(--display); font-variant-numeric: tabular-nums; line-height: 0.9; flex: none; }
.arr-time strong { font-size: 2.7rem; font-weight: 700; }
.arr-time small { font: 500 0.78rem var(--text); color: var(--muted); }
.arr-time strong.now { font-size: 1.5rem; background: var(--signal); color: var(--signal-ink); padding: 5px 8px; border-radius: 4px; }
.arr.scheduled .arr-time strong { font-size: 1.7rem; font-weight: 600; color: var(--muted); }
.arr .bell { align-self: center; margin-right: 4px; }
/* promised by the timetable, but no bus is reporting it */
.arr.missing .slab, .arr.gone .slab { background: var(--muted); }
.arr.missing .arr-head, .arr.gone .arr-head { color: var(--muted); }
.arr.missing .arr-kind, .arr.gone .arr-kind { color: var(--warn); }
.arr.missing .dot { display: none; }
.arr-time .strike { font-size: 1.7rem; font-weight: 600; color: var(--muted); text-decoration: line-through; }
/* each line at a stop, with its next buses */
.perline .slab { width: 54px; font-size: 1.6rem; }
.perline .arr-main { padding: 9px 0; }
.nexts { display: grid; align-content: center; justify-items: end; gap: 1px; padding: 0 14px 0 4px; flex: none; }
.next { font: 600 1.15rem/1.15 var(--display); font-variant-numeric: tabular-nums; }
.next.sched { color: var(--muted); }
.next.none { font: 500 0.8rem var(--text); color: var(--muted); }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--ink), 0 0 0 7px color-mix(in srgb, var(--signal) 45%, transparent); } }
@media (prefers-reduced-motion: reduce) { .arr.learned .dot { animation: none; } }

.notice { display: block; margin: 0 12px 10px; padding: 11px 14px; border-radius: 8px; background: var(--surface); font-size: 0.94rem; border-left: 6px solid var(--muted); }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.empty { padding: 4px 16px; display: grid; gap: 10px; justify-items: start; }
.primary { background: var(--signal); color: var(--signal-ink); font: 700 1.25rem var(--display); padding: 12px 20px; border-radius: 8px; }
.button { display: inline-flex; align-items: center; min-height: 46px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 8px; font-weight: 600; font-size: 0.95rem; background: var(--surface); }
.button:hover { background: var(--signal); color: var(--signal-ink); border-color: var(--signal-ink); }
.row { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 12px; }
.link { color: var(--muted); text-decoration: underline; font-size: 0.85rem; }
.foot { display: flex; justify-content: space-between; padding: 20px 16px; font-size: 0.85rem; color: var(--muted); }
.foot a { text-decoration: underline; }

/* ---------- home ---------- */
.livecount { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 4px 16px 12px; font-size: 0.9rem; color: var(--muted); }
.livecount b { color: var(--ink); font-weight: 600; margin-right: 2px; }
.livecount span { display: inline-flex; align-items: center; gap: 5px; font: 600 1rem var(--display); }
.livecount i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.card.invite .card-title h3 { white-space: normal; }

/* ---------- detail headers ---------- */
.head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 14px 16px; }
.head > div { flex: 1; min-width: 0; }
.head .back { margin-left: -10px; }
.head p { font-size: 0.9rem; margin-top: 4px; }
/* the sign plate, for the page of one stop, one bus or one line */
.head.plate { background: #0f2231; color: #fff; padding: 14px 8px 14px 16px; margin: 0 12px 12px; border-radius: 8px; }
.head.plate p { color: #b9c7d0; }
.head.plate .ghost, .head.plate .star { color: #b9c7d0; }
.head.plate .ghost:hover { background: rgba(255, 255, 255, 0.12); }
.head.plate .star.on { color: var(--signal); }
.head.plate .badge { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }

/* riding: your stop, and the button that picks it */
.ridecard { display: flex; align-items: center; gap: 12px; margin: 0 12px 10px; padding: 12px 14px; border-radius: 8px; background: var(--signal); color: var(--signal-ink); }
.ridecard > div { flex: 1; min-width: 0; display: grid; }
.ridecard b { font: 700 1.6rem/1.1 var(--display); }
.ridecard small { font-size: 0.86rem; font-weight: 500; }
.ridecard .button { background: none; border-color: var(--signal-ink); min-height: 40px; }
.stops.ride li { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.stops.ride li:last-child { border-bottom: 0; }
.stops.ride a { flex: 1; min-width: 0; border-bottom: 0; }
.getoff { flex: none; min-height: 44px; font: 600 0.8rem var(--text); color: var(--muted); padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line); white-space: nowrap; }
.getoff.on { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.stops.ride .mine > a span:first-child { font-weight: 600; }
.stops.ride .mine::before { background: var(--signal); width: 12px; height: 12px; left: -19px; }

.head h1 .badge { height: 34px; font-size: 1.5rem; vertical-align: 3px; margin-right: 4px; }
.tabs { display: flex; gap: 6px; padding: 2px 12px 12px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 12px; border-radius: 6px; background: var(--surface); font-size: 0.9rem; font-weight: 500; white-space: nowrap; }
.tabs a.on { background: var(--chosen); color: var(--chosen-ink); font-weight: 600; }
.tabs a small { font-weight: 400; opacity: 0.75; }
.tabs a .count { font: 700 0.8rem var(--display); font-style: normal; background: var(--signal); color: var(--signal-ink); border-radius: 3px; padding: 0 5px; margin-left: 4px; }
.dir { font: 600 1rem var(--display); color: var(--muted); padding: 2px 16px 4px; }
.tabs.days a.on { background: var(--signal); color: var(--signal-ink); }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 12px; }
.facts div { background: var(--surface); border-radius: 8px; padding: 10px 12px; }
.facts dt { font-size: 0.8rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font: 600 1.35rem/1.15 var(--display); }
.meter { display: inline-block; width: 60px; height: 8px; border-radius: 2px; background: var(--line); vertical-align: middle; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); }

/* the route as a line with its stops */
.stops { list-style: none; margin: 0 12px; padding: 4px 12px 4px 26px; background: var(--surface); border-radius: 8px; position: relative; }
.stops::before { content: ""; position: absolute; left: 15px; top: 20px; bottom: 20px; width: 4px; background: var(--ink); border-radius: 2px; }
.stops li { position: relative; }
.stops li::before { content: ""; position: absolute; left: -17px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); }
.stops a { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0 11px 6px; border-bottom: 1px solid var(--line); }
.stops li:last-child a { border-bottom: 0; }
.stops .eta { font: 600 1.2rem/1.2 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stops .onroute a { justify-content: flex-start; align-items: center; background: var(--signal); color: var(--signal-ink); border-radius: 6px; padding: 7px 8px; margin: 5px 0; border: 0; font-weight: 600; font-size: 0.92rem; }
.stops .onroute::before { border-color: var(--ink); background: var(--signal); width: 12px; height: 12px; left: -19px; top: 15px; }
.stops .skipped span { text-decoration: line-through; color: var(--warn); }
/* a stop the route passes but no bus has confirmed yet */
.stops .assumed::before { border-color: var(--muted); border-width: 2px; left: -16px; top: 17px; }
.stops .assumed span { color: var(--muted); }

/* ---------- timetables ---------- */
.times { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px; }
.time { background: var(--surface); border-radius: 4px; font: 600 1.3rem/1 var(--display); font-variant-numeric: tabular-nums; padding: 8px 10px; }
details.time { padding: 0; }
details.time summary { list-style: none; padding: 8px 10px; cursor: pointer; }
details.time summary::-webkit-details-marker { display: none; }
details.time[open] { flex-basis: 100%; }
.time.next { background: var(--signal); color: var(--signal-ink); }
.time sup { color: var(--muted); font: 500 0.68rem var(--text); margin-left: 3px; }
.time.next sup { color: inherit; }
.time sup.late { background: var(--signal); color: var(--signal-ink); border-radius: 3px; padding: 0 3px; font-weight: 600; }
.reports .button .count { font: 700 0.8rem var(--display); font-style: normal; background: var(--signal); color: var(--signal-ink); border-radius: 3px; padding: 0 5px; margin-left: 6px; }
.reports .button:disabled { opacity: 0.5; }
.time ol { list-style: none; margin: 0; padding: 0 10px 8px; }
.time ol li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font: 400 0.92rem var(--text); border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.time ol b { font: 600 1.05rem var(--display); }

/* ---------- trip ---------- */
.picker { padding: 2px 12px 10px; }
.picker label { font-size: 0.82rem; font-weight: 500; color: var(--muted); display: block; margin: 0 4px 4px; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 50px; padding: 0 14px; border-radius: 8px; background: #0f2231; color: #fff; }
.picked b { font: 600 1.3rem var(--display); }
.picked small { color: #b9c7d0; }

/* a planned trip */
.plan .then { margin: 0 6px; color: #b9c7d0; font: 600 1.2rem var(--display); }
.plan .total { display: grid; justify-items: end; padding-right: 12px; line-height: 1; font-family: var(--display); }
.plan .total strong { font-size: 2.4rem; font-weight: 700; color: var(--signal); }
.plan .total small { font: 500 0.78rem var(--text); color: #b9c7d0; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .walk { padding: 11px 14px 11px 44px; font-size: 0.95rem; position: relative; }
.steps .walk::before { content: ""; position: absolute; left: 20px; top: 9px; bottom: 9px; border-left: 4px dotted var(--muted); }
.steps .walk.change { background: var(--bg); font-weight: 500; }
.steps .ride { display: flex; align-items: stretch; gap: 12px; }
.steps .ride > span:last-child { display: grid; gap: 2px; padding: 10px 12px 10px 0; align-content: center; }
.steps .ride b { font: 600 1.3rem/1.1 var(--display); }
.steps small { font-size: 0.84rem; color: var(--muted); }
.steps small.bad { color: var(--warn); }
button.result { width: 100%; text-align: left; }
.pin.me { background: var(--signal); }
.pin.place { border-radius: 2px; }

/* ---------- map ---------- */
#running { margin-bottom: 4px; }
.running .slab { width: 54px; font-size: 1.6rem; }
.running .arr-main { padding: 9px 0; }
.running .arr-time strong { font-size: 1.7rem; }
.mapbar { display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.pill { background: var(--surface); border-radius: 6px; padding: 8px 12px; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 500; white-space: nowrap; box-shadow: 0 2px 8px rgba(15, 34, 49, 0.18); }
.pill::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: 7px; }
.pill[aria-pressed="true"] { background: var(--c); color: #fff; }
.pill[aria-pressed="true"]::before { background: #fff; }
.pill small { opacity: 0.7; }

/* A bus on the map, seen from the front: the windscreen on top, the line number
   where the destination sign goes, headlights and wheels below. The body takes
   the company's colour. (No `position` on .bus: MapLibre positions markers
   absolutely and overriding it scatters them.) */
.bus {
  --c: #555; --ring: #ffffff; width: 27px; height: 27px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 700 14px/1 "Barlow Condensed", "Arial Narrow", sans-serif; font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .bus { --ring: #0b161e; }
.bus-body { position: absolute; inset: 0 0 3px; display: grid; place-items: center; padding-top: 4px; background: var(--paint, var(--c)); color: #fff; border-radius: 7px 7px 4px 4px; box-shadow: 0 0 0 1.5px var(--ring); }
/* the windscreen */
.bus-body::before { content: ""; position: absolute; left: 3px; right: 3px; top: 2px; height: 5px; border-radius: 3px 3px 1px 1px; background: #ffffff; }
/* the headlights */
.bus-body::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; background: radial-gradient(circle at 1.5px 50%, #ffe27a 1.5px, transparent 2px), radial-gradient(circle at calc(100% - 1.5px) 50%, #ffe27a 1.5px, transparent 2px); }
.bus-body b { position: relative; }
/* three figures still fit: a little narrower */
.bus.wide { width: 32px; }
.bus-wheels { position: absolute; left: 4px; right: 4px; bottom: 0; height: 4px; border-radius: 0 0 2px 2px; background: linear-gradient(90deg, #1a1a1a 0 5px, transparent 5px calc(100% - 5px), #1a1a1a calc(100% - 5px)); }
.bus-dir { position: absolute; inset: -10px; pointer-events: none; }
.bus-dir::after { content: ""; position: absolute; left: 50%; top: 0; margin-left: -5px; border: 5px solid transparent; border-bottom: 7px solid var(--paint, var(--c)); border-top: 0; }
/* No signal, or not part of what is being looked at: plain grey, never
   see-through (MapLibre sets opacity inline on markers, hence !important). */
.bus { opacity: 1 !important; }
.bus.stale, body.cut .bus { --paint: #8a979f; }
.bus.dim { --paint: #b4bfc5; pointer-events: none; z-index: 0; }
:root[data-theme="dark"] .bus.dim { --paint: #33454f; }
.bus.dim .bus-body { color: var(--ring); }
.bus.dim .bus-body::before, .bus.dim .bus-body::after, .bus.dim .bus-wheels { display: none; }
.bus.warn .bus-body { box-shadow: 0 0 0 1.5px var(--ring), 0 0 0 4px #ea580c; }
.bus.sel { z-index: 2; }
.bus.sel .bus-body { box-shadow: 0 0 0 1.5px var(--ring), 0 0 0 4px #ffc61a; }
.maplibregl-ctrl-bottom-right { bottom: 8px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs) + 16px); transform: translate(-50%, 20px); max-width: min(92vw, 420px);
  background: #0f2231; color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 0.94rem; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 20; box-shadow: var(--shadow); border-left: 6px solid var(--signal);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px), (min-width: 560px) and (max-height: 500px) { #toast { bottom: 24px; } }

/* "did it come?" on a stop's page */
.notice.ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; border-left-color: var(--signal, #ffc61a); }
.notice.ask .row { margin: 0; padding: 0; gap: 8px; }
.notice.ask .button { padding: 8px 14px; }
.slab.small { display: inline-block; width: auto; font-size: 1rem; padding: 2px 7px; border-radius: 4px; vertical-align: 1px; }

/* a short explanation over the app (how to get notifications on an iPhone) */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 16px; overflow-y: auto; overscroll-behavior: contain; background: rgb(8 18 28 / 0.55); }
.modal-card { width: min(100%, 420px); padding: 20px 20px 16px; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 50px rgb(0 0 0 / 0.35); }
.modal-card h2 { margin: 0 0 8px; padding: 0; font: 700 1.45rem/1.15 var(--display); }
.modal-card p { margin: 0 0 10px; }
.modal-card ol { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; }
.modal-card li svg { width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal-card .button { width: 100%; justify-content: center; }
@media (min-width: 900px), (min-width: 560px) and (max-height: 500px) { .modal { place-items: center; } }
.modal-card .button { background: var(--signal); color: var(--signal-ink); border-color: transparent; font-weight: 700; }

/* a notice that can be put away */
.notice.closable { display: flex; align-items: flex-start; gap: 8px; padding-right: 6px; }
.notice.closable > a, .notice.closable > span { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.notice-close { flex: none; width: 44px; height: 44px; margin: -10px -4px -10px 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.notice-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.notice-close:hover { background: rgb(0 0 0 / 0.08); }

/* the server cannot be reached: said across the top, and the buses on the map fade */
#offline { position: fixed; z-index: 40; top: 0; left: 0; right: 0; margin: 0; padding: calc(6px + env(safe-area-inset-top)) 14px 6px; background: var(--warn); color: #fff; font: 600 0.9rem/1.25 var(--text); text-align: center; }


/* the trip picked in "Ir", over the map */
.tripbar { display: flex; align-items: center; gap: 6px; margin: 0 12px 8px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--surface); border-left: 6px solid var(--signal); box-shadow: 0 2px 10px rgb(0 0 0 / 0.18); }
.tripbar a { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.tripline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tripline > span:last-child { display: grid; min-width: 0; line-height: 1.2; }
.tripline b, .tripline small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tripline small { color: var(--muted); }

/* "Ir": when to leave */
.picker.when .whenrow { display: flex; align-items: center; gap: 10px; }
.picker.when .pill.on { background: var(--chosen); color: var(--chosen-ink); }
.picker.when input[type="time"] { font: inherit; padding: 8px 10px; border: 2px solid var(--line, #c9d3d9); border-radius: 8px; background: var(--surface); color: var(--ink); min-height: 40px; }
/* first visit */
.welcome ul { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 12px; }
.welcome li { display: flex; gap: 12px; align-items: flex-start; }
.welcome li svg { flex: none; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.modal-card .button.plain { background: transparent; color: inherit; border-color: transparent; font-weight: 500; margin-top: 6px; }
.sharepref { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* the weather: a chip in the corner, the forecast on a tap */
.wx { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; min-height: 44px; font: 600 1.05rem/1 var(--display); font-variant-numeric: tabular-nums; }
.wx svg, .wxcard svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wxnow { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.wxnow > svg { width: 46px; height: 46px; }
.wxnow h2 { margin: 0; font-size: 2.4rem; line-height: 1; }
.wxnow h2 small { font: 500 1rem var(--text); color: var(--muted); }
.wxnow p { margin: 4px 0 0; }
.wxhours { list-style: none; margin: 12px 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; text-align: center; }
.wxhours li { display: grid; justify-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.wxhours span, .wxhours small { font-size: 0.78rem; color: var(--muted); min-height: 1em; }
.wxdays { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.wxdays li { display: grid; grid-template-columns: 1fr 22px 5.5em 2.4em 2.4em; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.wxdays span { text-transform: capitalize; }
.wxdays small { color: var(--muted); font-size: 0.8rem; }
.wxdays b, .wxdays i { text-align: right; font-style: normal; }
.wxdays i { color: var(--muted); }

/* "Acerca": light, dark or by itself */
.themepref { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--ink); font: 600 0.92rem var(--text); padding: 8px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--chosen); color: var(--chosen-ink); }

/* the bell in the corner: notices in force, read on a tap */
.noticebell { position: relative; }
.noticebell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.noticebell b { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center; background: var(--muted); color: var(--bg); font: 700 0.72rem/1 var(--text); font-variant-numeric: tabular-nums; }
.noticebell.fresh { color: var(--ink); }
.noticebell.fresh b { background: var(--signal); color: var(--signal-ink); }
.noticelist h2 { margin-bottom: 12px; }
.noticelist .notice { margin: 0 0 8px; background: var(--bg); }
.noticelist .notice.warn { background: var(--warn-bg); }
.noticelist .button { margin-top: 6px; }

/* ---------- motion ----------
   Each of these answers something: a tap, a page opening, a minute passing,
   a bus arriving. Nothing moves for decoration, nothing moves text someone is
   reading, and all of it stays still for whoever asked their phone for less
   motion. */
@media (prefers-reduced-motion: no-preference) {
  /* a page opening: its content comes up into place */
  #view.enter > * { animation: rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  #view.enter > *:nth-child(2) { animation-delay: 0.03s; }
  #view.enter > *:nth-child(n + 3) { animation-delay: 0.06s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }

  /* a card over the app (the forecast, the notices): the back dims, the card comes up from where the thumb is */
  .modal { animation: dim 0.18s ease-out both; }
  .modal-card { animation: sheet-up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  @keyframes dim { from { background-color: rgb(8 18 28 / 0); } }
  @keyframes sheet-up { from { transform: translateY(28px); opacity: 0; } }

  /* a minute goes by: the number rolls, like a board changing */
  .arr-time strong.tick, .eta.tick, .next.tick { animation: roll 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); display: inline-block; }
  @keyframes roll { from { transform: translateY(-45%); opacity: 0; } }

  /* "arriving": the one thing on the board that asks for attention */
  .arr-time strong.now { animation: beat 1.4s ease-in-out infinite; }
  @keyframes beat { 50% { transform: scale(1.06); } }

  /* what was tapped answers: a press sinks, a star or a bell that turns on pops */
  .button, .pill, .result, .getoff, .seg button, .card.plan .button, #tabs a svg { transition: transform 0.09s ease-out, background-color 0.15s, color 0.15s; }
  .button:active, .pill:active, .result:active, .getoff:active, .seg button:active { transform: scale(0.96); }
  .star.pop svg, .bell.pop svg, .noticebell.pop svg { animation: pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1); }
  @keyframes pop { 40% { transform: scale(1.35) rotate(-8deg); } }
  .noticebell.pop b { animation: pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1); }
  #tabs a.on svg { animation: tab-in 0.24s cubic-bezier(0.3, 1.5, 0.5, 1); }
  @keyframes tab-in { from { transform: scale(0.8); } }

  /* a bus that has just come onto the map grows into place; the one being followed has a ring that breathes */
  .bus.born .bus-body, .bus.born .bus-wheels { animation: born 0.3s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
  @keyframes born { from { transform: scale(0.3); opacity: 0; } }
  .bus.sel .bus-body { animation: follow 1.8s ease-in-out infinite; }
  @keyframes follow { 50% { box-shadow: 0 0 0 1.5px var(--ring), 0 0 0 6px #ffc61a; } }

  /* waiting for the server: bars where the rows will be, breathing, instead of the word "loading" */
  .skeleton i { animation: wait 1.1s ease-in-out infinite alternate; }
  .skeleton i:nth-child(2) { animation-delay: 0.15s; }
  .skeleton i:nth-child(3) { animation-delay: 0.3s; }
  @keyframes wait { to { background: var(--line); } }

  /* the toast and the "no data" bar come in rather than appear */
  #offline:not([hidden]) { animation: drop 0.25s ease-out; }
  @keyframes drop { from { transform: translateY(-100%); } }
}
.skeleton { display: grid; gap: 2px; padding: 0; margin: 0; }
.skeleton i { display: block; height: 76px; background: var(--surface); }
.skeleton span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* routes of a line that nothing has been seen running on: out of the way, one tap from view */
details.quiet { margin: 4px 12px 10px; }
details.quiet summary { cursor: pointer; color: var(--muted); font-size: 0.86rem; padding: 8px 4px; min-height: 44px; display: flex; align-items: center; }
details.quiet .tabs { margin-top: 4px; }
/* "tell us": a small button in the corner, and the form it opens */
.fbk svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.fbform { display: grid; gap: 10px; }
.fbform .seg { justify-self: start; }
.fbform textarea { width: 100%; min-height: 110px; resize: vertical; font: inherit; padding: 10px 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.fbform textarea:focus-visible { outline: 3px solid var(--signal); outline-offset: 1px; }
@media (max-width: 419px) { #health { display: none; } }
/* while following one bus the others are greyed, but another can still be tapped to follow it instead */
body[data-view="bus"] .bus.dim { pointer-events: auto; }
/* narrow phones: with the company squares gone the buttons still go to the right, and on the
   narrowest ones (old small phones, a folded phone's outer screen) the header gives up its
   word and some air so that every button stays on the screen */
@media (max-width: 419px) { #top .brand { margin-right: auto; } }
@media (max-width: 359px) {
  #top { gap: 2px; padding: 8px 6px 8px 10px; }
  #top .ghost { min-width: 40px; }
  #top .wx { padding: 4px; }
}
@media (max-width: 319px) { #top .brand span { display: none; } }
/* a header button with nothing to say takes no room */
#top [hidden] { display: none; }
/* a card taller than the screen (a phone lying down) scrolls inside itself */
.modal-card { max-height: calc(100dvh - 32px); overflow-y: auto; }
/* installed on a phone the app runs under the clock and the notch: the header keeps clear of them */
#top { padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-left: calc(16px + env(safe-area-inset-left, 0px)); padding-right: calc(10px + env(safe-area-inset-right, 0px)); }
@media (max-width: 359px) { #top { padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-left: calc(10px + env(safe-area-inset-left, 0px)); padding-right: calc(6px + env(safe-area-inset-right, 0px)); } }
/* the panel beside the map: its usual width, and a narrower one on a phone lying on its side */
:root { --panel: 430px; }
@media (max-width: 899px) and (max-height: 500px) {
  :root { --panel: min(360px, 50vw); }
  #panel, body[data-view="mapa"] #panel { inset: 6px auto 6px 6px; padding-bottom: 70px; }
  #tabs { inset: auto auto 6px 6px; height: 56px; }
  #fold { left: calc(var(--panel) + 6px); }
  body.folded #fold { transform: translateX(calc(-1 * var(--panel) - 6px)); }
  #top { padding-top: 6px; padding-bottom: 6px; }
  /* a narrow panel: the company squares give their room to the buttons */
  #health { display: none; }
  #top .brand { margin-right: auto; }
}
/* no scroll bars anywhere: everything still scrolls (wheel, touch, keyboard), the bar itself is not drawn */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
/* the speaker on a stop's page */
.speak svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
