/* busapp — a departure board for the phone and the desk.
 *
 * THE DOCUMENT SCROLLS (~/claude/IOS.md §15): every screen is in-flow content
 * and the page is the one scroller. Nothing here needs a locked screen — a
 * board is a list — so there is no html.locked at all. Every screen's top
 * inset goes through --top once (§1). Light is the base; dark is the media
 * query. The tokens are the platform's (/login/ui.css), copied so the shell
 * is whole offline. */

:root {
  --bg: #f2f2f7; --panel: #ffffff; --panel-2: #f6f6f9;
  --line: rgba(60, 60, 67, .16); --ink: #000000; --ink-2: #3c3c43;
  --dim: #8a8a8e; --dim-2: #b0b0b6; --pill: #efeff0;
  --good: #1a9e4b; --warn: #b8730a; --bad: #e5322b; --link: #007aff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --r-card: 20px; --r-mid: 13px; --r-tile: 10px;
  --font: -apple-system, BlinkMacSystemFont, system-ui, "SF Pro Text", "Helvetica Neue", sans-serif;
  --font-round: "SF Pro Rounded", ui-rounded, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --red: #d71920;                     /* OC Transpo's red, the old logo's exact shade — the brand, the live dot */
  --glass-t: 20px;
  --top: calc(env(safe-area-inset-top, 0px) + var(--glass-t));
  --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --panel: #1c1c1e; --panel-2: #2c2c2e;
    --line: rgba(84, 84, 88, .48); --ink: #ffffff; --ink-2: #d7d7db;
    --dim: #98989f; --dim-2: #6c6c70; --pill: #2c2c2e;
    --good: #30d158; --warn: #ffd60a; --bad: #ff453a; --link: #0a84ff; --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
a { color: var(--link); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(32px + var(--bottom)); }
.screen { display: none; padding-top: calc(6px + var(--top)); }
.screen.on { display: block; }
.side { display: none; }

/* ── the bar at the top of every screen ───────────────────────────────────── */
.bar { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 0 10px; }
.bar h1 { font: 700 22px/1.2 var(--font-round); letter-spacing: -0.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar h1.brand { font-size: 28px; color: var(--red); display: flex; align-items: center; gap: 8px; }
.bar h1.brand .mark { flex: none; }
.bar .bar-title { flex: 1; min-width: 0; }
.bar .bar-title h1 { white-space: normal; }
.bar .sub { font-size: 13px; color: var(--dim); }
.back { width: 40px; height: 40px; margin-left: -10px; font-size: 34px; line-height: 1; color: var(--link); display: grid; place-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); font-size: 22px; display: grid; place-items: center; color: var(--ink-2); }
.pin { width: 44px; height: 44px; font-size: 28px; line-height: 1; color: var(--dim); display: grid; place-items: center; }
.pin.on { color: var(--warn); }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--dim); background: var(--panel); padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 2s infinite; }
.live-pill.stale .live-dot { background: var(--dim-2); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ── buttons ──────────────────────────────────────────────────────────────── */
.actions { display: flex; gap: 10px; margin: 2px 0 20px; }
.btn { flex: 1; padding: 13px 14px; border-radius: var(--r-mid); background: var(--panel); box-shadow: var(--shadow); font-weight: 600; font-size: 16px; color: var(--ink); min-height: 48px; text-align: center; }
.btn.primary { background: var(--red); color: #fff; }
.btn:disabled { opacity: .55; }
.tiny { font-size: 14px; font-weight: 600; color: var(--link); padding: 6px 2px; }
.sec-row { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 8px; }
.sec-row h2, .sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 600; }
.sec { margin: 18px 2px 8px; }

/* ── lists: stops and departures ──────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; text-align: left;
        padding: 12px 14px; border-radius: var(--r-mid); background: var(--panel); box-shadow: var(--shadow); color: var(--ink); min-height: 56px; }
.item:active { background: var(--panel-2); }
.item .mid { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.item .name { display: block; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { display: block; font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub:empty { display: none; }
.item .right { font-variant-numeric: tabular-nums; text-align: right; font-size: 15px; color: var(--ink-2); white-space: nowrap; }
.item .right b { font-family: var(--font-round); font-weight: 700; font-size: 20px; color: var(--ink); }
.item .right small { display: block; font-size: 12px; color: var(--dim); }

/* The badge: the number on the pole, or the route in OC Transpo's own colour. */
.badge { display: inline-grid; place-items: center; min-width: 48px; height: 36px; padding: 0 8px; border-radius: 9px;
         font: 700 17px/1 var(--font-round); background: var(--c, var(--pill)); color: var(--t, var(--ink)); letter-spacing: -0.01em; }
.badge.rail { border-radius: 999px; }
.badge.code { background: var(--pill); color: var(--ink); }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 2px var(--c); color: var(--ink); }

/* The three states of an arrival: ● seen, ○ predicted, nothing = timetable. */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.seen { background: var(--good); }
.dot.pred { box-shadow: inset 0 0 0 2px var(--good); }
.dep.open { grid-template-rows: auto auto; }
.dep .detail { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-2); padding-top: 8px; border-top: 1px solid var(--line); margin-top: 2px; }
.dep .detail .tiny { padding: 4px 0; }
.item .remove { width: 32px; height: 32px; border-radius: 50%; background: var(--pill); color: var(--bad); font-size: 20px; line-height: 1; display: none; place-items: center; }
.editing .item .remove { display: grid; }
.editing .item .right { display: none; }
.empty { color: var(--dim); text-align: center; padding: 28px 12px; font-size: 15px; }
.note { color: var(--dim); font-size: 13px; text-align: center; margin: 12px 0 0; min-height: 18px; }
.note.bad { color: var(--bad); }
.search { margin: 0 0 12px; }
.search input { width: 100%; font: 17px var(--font); color: var(--ink); background: var(--panel); border: 0; border-radius: var(--r-mid); padding: 13px 14px; box-shadow: var(--shadow); outline: none; -webkit-appearance: none; }
.search input:focus { box-shadow: 0 0 0 2px var(--link); }

/* ── settings rows (the house's shape) ─────────────────────────────────────── */
.card { background: var(--panel); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 4px 16px; }
.rows .row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 0; text-align: left; color: var(--ink); }
.rows .row + .row, .rows .row-note + .row { border-top: 1px solid var(--line); }
.row-k { flex: 1; font-size: 16px; }
.row-v { color: var(--dim); font-size: 15px; }
.chev { color: var(--dim-2); font-size: 22px; line-height: 1; }
.row-note { font-size: 13px; color: var(--dim); padding: 0 0 12px; }
.rows .row.danger .row-k { color: var(--red); }
.link-form input { width: 7.5em; font: 600 17px/1 ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); background: var(--bg); border: 0; border-radius: var(--r-mid); padding: 9px 10px; outline: none; -webkit-appearance: none; }
.link-form input:focus { box-shadow: 0 0 0 2px var(--link); }
.watch-row .row-v { font-size: 13px; }
.technical { margin-top: 14px; }
.technical summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 0; cursor: pointer; }
.technical summary::-webkit-details-marker { display: none; }
.technical[open] summary .chev { transform: rotate(90deg); }
.kv { margin: 0; padding: 4px 0 8px; border-top: 1px solid var(--line); }
.kv div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 6px 0; font-size: 14px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.fineprint { color: var(--dim-2); font-size: 12px; text-align: center; margin: 18px 0 0; }
.fineprint a { color: var(--dim); }
.update-note { color: var(--ink-2); }

/* ── the leave alert (2026-10-04) ──────────────────────────────────────────── */
.pin.bell { color: var(--dim); }
.pin.bell.on { color: var(--red); }
.pin.bell[aria-expanded="true"] { color: var(--link); }
.pin.bell.on[aria-expanded="true"] { color: var(--red); }
.bell-mark { display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; color: var(--red); }
.bell-mark svg { display: block; width: 100%; height: 100%; }
.alert-card { margin: 0 0 14px; padding: 6px 16px 14px; }
.alert-card .row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 0; color: var(--ink); }
.alert-card .row-tap { border-top: 1px solid var(--line); }
.alert-lede { padding-top: 10px; }
.alert-sub { padding: 0 0 10px; margin-top: -10px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 999px; padding: 3px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--link); display: grid; place-items: center; }
.stepper button:disabled { color: var(--dim-2); }
.stepper b { min-width: 4.2em; text-align: center; font: 700 17px/1 var(--font-round); font-variant-numeric: tabular-nums; }
.seg { display: flex; background: var(--bg); border-radius: var(--r-tile); padding: 3px; gap: 3px; margin: 2px 0 10px; }
.seg button { flex: 1; min-height: 38px; border-radius: 8px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.days { display: flex; gap: 6px; justify-content: space-between; margin: 0 0 4px; }
.days button { flex: 1; min-width: 0; height: 40px; border-radius: 10px; background: var(--bg); font-weight: 700; font-size: 14px; color: var(--ink-2); }
.days button.on { background: var(--red); color: #fff; }
.alert-times input { font: 600 16px var(--font); color: var(--ink); background: var(--bg); border: 0; border-radius: var(--r-mid); padding: 8px 8px; min-height: 40px; -webkit-appearance: none; }
.alert-times input:focus { outline: none; box-shadow: 0 0 0 2px var(--link); }
.alert-actions { display: flex; gap: 10px; }
.alert-actions .btn { box-shadow: none; background: var(--bg); }
.alert-actions .btn.primary { background: var(--red); }
.switch { width: 22px; height: 22px; accent-color: var(--good); flex: none; margin: 0; }
.switch[switch] { width: auto; height: auto; }

/* ── one bus on a map (2026-10-07) ─────────────────────────────────────────── */
.detail-acts { display: flex; align-items: center; gap: 16px; }
#bus .bar .badge { flex: none; }
.map { height: min(68vh, 640px); min-height: 300px; border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow); background: var(--panel-2); }
.map.near { height: min(40vh, 360px); min-height: 220px; margin-bottom: 14px; }
.map[hidden] { display: none; }
/* Nearby's marks (2026-10-08): a stop is the bus map's red ring on a 32px target; you are a blue dot. */
.stopmark-wrap, .youmark-wrap { background: none; border: 0; }
.stopmark { display: block; width: 32px; height: 32px; position: relative; }
.stopmark::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #fff; border: 3px solid #d71920; box-sizing: border-box; }
.youmark { display: block; width: 18px; height: 18px; border-radius: 50%; background: #0a84ff; border: 3px solid #fff; box-sizing: border-box; box-shadow: 0 0 0 6px rgba(10, 132, 255, .22); }
.map .leaflet-popup-content-wrapper { border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.map .leaflet-popup-tip { background: var(--panel); }
.map .leaflet-popup-content { margin: 0; }
.stop-pop { display: block; padding: 10px 14px; border: 0; background: none; color: var(--ink); font: 600 15px/1.3 var(--font); text-align: left; cursor: pointer; }
.stop-pop small { display: block; color: var(--dim); font-weight: 400; font-size: 13px; }
.map.leaflet-container { background: var(--panel-2); font: 12px/1.4 var(--font); }
.map .leaflet-control-attribution { background: color-mix(in srgb, var(--panel) 80%, transparent); color: var(--dim); }
.map .leaflet-control-attribution a { color: var(--dim); }
.busmark-wrap { background: none; border: 0; }
/* The bus: its route in its colour, and a point the way it is heading. */
.busmark { position: relative; display: grid; place-items: center; width: 44px; height: 44px; }
.busmark b { position: relative; z-index: 1; display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 5px; border-radius: 999px;
             background: var(--c); color: var(--t); font: 700 15px/1 var(--font-round); box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(0,0,0,.35); }
.busmark i { position: absolute; inset: 0; }
.busmark i::before { content: ''; position: absolute; left: 50%; top: -5px; margin-left: -7px; border: 7px solid transparent; border-bottom: 10px solid var(--c); border-top: 0; }
.busmark.old b { opacity: .55; }

/* ── the banner ───────────────────────────────────────────────────────────── */
.banner { position: fixed; left: 12px; right: 12px; bottom: calc(14px + var(--bottom)); z-index: 50; display: flex; align-items: center; gap: 10px;
          padding: 12px 14px; border-radius: var(--r-mid); background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.banner span { flex: 1; }
.banner button { color: inherit; font-size: 22px; line-height: 1; width: 32px; height: 32px; }

/* ── the desk: two panes side by side ─────────────────────────────────────── */
@media (min-width: 900px) {
  .app { max-width: 1040px; display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 28px; align-items: start; }
  .app:not(.menu-open) #home { display: block; grid-column: 1; position: sticky; top: 0; }
  .app:not(.menu-open) .screen.on:not(#home) { grid-column: 2; }
  .app:not(.menu-open) #side.on { display: block; }
  #side .empty { padding-top: 120px; }
  .app.menu-open #menu { grid-column: 1 / -1; max-width: 560px; justify-self: center; width: 100%; }
  .back { display: none; }
  .app.menu-open .back, #bus .back { display: grid; }
}

/* the "myjp.ca apps" row at the foot of Settings: the shelf's lockup (mealapp's) */
.lockrow { font-weight: 800; letter-spacing: -.02em; flex: none; }
.lockrow .lc { color: var(--red); }
