/* BlurTraveller — every screen, scoped under .tr-app (docs/SITE.md, docs/BRAND.md).
   The family's look (BlurNoter's K9): BlurFolder's teal, bar, buttons, type and corners.
   Two themes, dark by default (T1, BlurPager's docs/BLUR-THEME.md): every
   colour is a token below, once for each; nothing under it names a colour.
   BlurPager's /bp-theme.js sets <html data-theme> before the first paint. */

:root[data-theme="dark"] {
  --bg: #101317;
  --surface: #181c22;
  --ink: #e8eaee;
  --muted: #9aa3b0;
  --line: #262b33;
  --accent: #00c6cf;           /* BlurPaper's teal reads on the dark (9:1) */
  --accent-ink: #062a2c;
  --danger: #ff6b5e;
  --ok: #3ccf91;
  --focus: #7d9bff;
  --tr-accent-strong: #33d6dd; /* a button pressed or hovered */
  --tr-accent-soft: #0d3134;   /* a filter that is on */
  --tr-accent-text: #5fe3e9;   /* teal words */
  --tr-shade: rgba(255, 255, 255, 0.08);
  --tr-rule: rgba(255, 255, 255, 0.14);
  --tr-lift: rgba(255, 255, 255, 0.07);
  --tr-scrim: rgba(0, 0, 0, 0.6);
  --tr-shadow: rgba(0, 0, 0, 0.5);
  --tr-toast: #2a3039;
  --tr-toast-ink: #e8eaee;
  --tr-toast-link: #5fe3e9;
  --tr-warn-bg: #2e2512;
  --tr-warn-ink: #f3cf7a;
  --tr-warn-line: #5a4a22;
  --tr-ok-bg: #12261c;
  --tr-danger-bg: #2d1614;
  --tr-banner: #0b5e63;        /* the next turn, big: white words on deep teal (7:1) */
  --tr-banner-ink: #ffffff;
  --tr-on-danger: #ffffff;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --ink: #14161a;
  --muted: #5c6470;
  --line: #e3e6ea;
  --accent: #00c6cf;
  --accent-ink: #ffffff;
  --danger: #d92d20;
  --ok: #12805c;
  --focus: #2b5cff;
  --tr-accent-strong: #00a3ab;
  --tr-accent-soft: #e0f7f8;
  --tr-accent-text: #00636a;   /* teal words on a light ground: readable */
  --tr-shade: rgba(0, 0, 0, 0.06);
  --tr-rule: rgba(0, 0, 0, 0.12);
  --tr-lift: rgba(255, 255, 255, 0.6);
  --tr-scrim: rgba(20, 22, 28, 0.35);
  --tr-shadow: rgba(0, 0, 0, 0.18);
  --tr-toast: #2f3440;
  --tr-toast-ink: #ffffff;
  --tr-toast-link: #7fe7ec;
  --tr-warn-bg: #fff7e6;
  --tr-warn-ink: #6b4a00;
  --tr-warn-line: #f1d9a6;
  --tr-ok-bg: #eaf6ec;
  --tr-danger-bg: #fdecea;
  --tr-banner: #0b5e63;
  --tr-banner-ink: #ffffff;
  --tr-on-danger: #ffffff;
}
.tr-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.tr-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.tr-brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--accent); font-size: 1.35rem; text-decoration: none; white-space: nowrap; }
.tr-brand b { font-weight: 700; }
.tr-logo { display: block; width: 28px; height: 28px; border-radius: 4px; }
.tr-nav { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.tr-who { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
/* the ☀/☾ button (BlurPager's /bp-theme.js picks the glyph): before the account, never folded away */
.tr-app button.bp-theme-toggle { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--ink); font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.tr-app button.bp-theme-toggle:hover { background: var(--tr-shade); }
.tr-app button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tr-main { flex: 1 1 auto; width: 100%; max-width: 60rem; margin: 0 auto; padding: 1.5rem 1rem; box-sizing: border-box; }
.tr-foot { padding: 1rem; text-align: center; color: var(--muted); font-size: 0.85rem; }
.tr-muted { color: var(--muted); }
.tr-error, .tr-bad { color: var(--danger); }

/* Buttons: background, colour, border and radius together — BlurPager's
   baseline `button` rule paints white text and its own corners (its D143). */
.tr-app .tr-button, .tr-app button.tr-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem 1.2rem;
  border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.tr-app .tr-button:hover { background: var(--tr-accent-strong); border-color: var(--tr-accent-strong); }
.tr-app .tr-small { padding: 0.35rem 0.9rem; font-size: 0.9rem; }
.tr-app .tr-wide { display: flex; width: 100%; }
.tr-app button.tr-quiet, .tr-app button.tr-link, .tr-app button.tr-ghost {
  padding: 0.3rem 0.6rem; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); font: inherit; cursor: pointer;
}
.tr-app button.tr-ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.tr-app button.tr-ghost:hover { border-color: var(--accent); }
.tr-app button.tr-link { color: var(--tr-accent-strong); text-decoration: underline; padding: 0; }
.tr-app button.tr-quiet:hover { background: var(--tr-shade); color: var(--ink); }
.tr-app button:disabled { opacity: 0.6; cursor: default; }
.tr-paper-mark { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; border-radius: 2px; }
h1 .tr-paper-mark { margin-right: 0.45rem; }

.tr-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.tr-narrow { max-width: 26rem; margin: 2rem auto; }
.tr-card h1 { margin: 0 0 1rem; font-size: 1.4rem; display: flex; align-items: center; }
.tr-card h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.tr-or { text-align: center; margin: 1rem 0 0; color: var(--muted); }

.tr-hero { padding: 2rem 0; }
.tr-hero h1 { font-size: 2rem; margin: 0 0 1rem; line-height: 1.2; }
.tr-lead { font-size: 1.1rem; line-height: 1.6; max-width: 40rem; }
.tr-points { line-height: 1.8; padding-left: 1.2rem; }

/* ---- waiting: always a visible spinner, never just small text ---- */
.tr-spin { display: inline-block; flex: none; width: 1em; height: 1em; box-sizing: border-box; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: tr-spin 0.8s linear infinite; vertical-align: -0.15em; }
@keyframes tr-spin { to { transform: rotate(360deg); } }

/* ---- The map screen (functions/traveller-map.js): the map fills what the bar leaves ---- */
.tr-app.tr-signed-in { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.tr-main.tr-map-main { max-width: none; padding: 0; flex: 1 1 auto; min-height: 0; position: relative; }
.tr-map { position: absolute; inset: 0; overflow: hidden; }
.tr-canvas { position: absolute; inset: 0; background: var(--bg); }
.tr-loading { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; margin: 0;
  padding: 1rem; text-align: center; background: var(--bg); }
.tr-loading .tr-spin { width: 2.6rem; height: 2.6rem; border-width: 4px; }
.tr-loading[hidden] { display: none; }

.tr-search { position: absolute; top: 0.75rem; left: 0.75rem; right: 3.6rem; max-width: 28rem; z-index: 5; }
.tr-search[hidden] { display: none; }
.tr-search-row { display: flex; align-items: center; gap: 0.4rem; padding: 0 0.75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  box-shadow: 0 4px 14px var(--tr-shadow); }
.tr-search-row:focus-within { border-color: var(--accent); }
.tr-search-input { flex: 1 1 auto; min-width: 0; padding: 0.75rem 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-size: 1rem; }
.tr-search-spin[hidden] { display: none; }
.tr-results { list-style: none; margin: 0.4rem 0 0; padding: 0.25rem 0; max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: 0 6px 20px var(--tr-shadow); }
.tr-results[hidden] { display: none; }
.tr-result { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.9rem; cursor: pointer; }
.tr-result:hover, .tr-result:focus-visible { background: var(--tr-shade); outline: none; }
.tr-result span { color: var(--muted); font-size: 0.88rem; }

.tr-fabs { position: absolute; right: 0.75rem; bottom: 1.5rem; z-index: 5; display: flex; flex-direction: column; gap: 0.6rem; }
.tr-fabs[hidden] { display: none; }
.tr-app button.tr-fab { width: 3rem; height: 3rem; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1.4rem; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px var(--tr-shadow); }
.tr-app button.tr-fab.tr-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.tr-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; max-height: 55%; overflow: auto; box-sizing: border-box; padding: 1rem 1rem 1.25rem;
  border-radius: 16px 16px 0 0; background: var(--surface); box-shadow: 0 -6px 24px var(--tr-shadow); }
.tr-sheet[hidden] { display: none; }
.tr-sheet h2 { margin: 0 2rem 0.25rem 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.tr-sheet p { margin: 0.25rem 0; }
.tr-app button.tr-close { position: absolute; top: 0.5rem; right: 0.6rem; width: 2.4rem; height: 2.4rem; padding: 0; border: 0; border-radius: 50%; background: none;
  color: var(--muted); font: inherit; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.tr-app button.tr-close:hover { background: var(--tr-shade); }
.tr-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.tr-app button.tr-quietish { background: var(--surface); color: var(--ink); border-color: var(--line); }
.tr-wait { display: flex; align-items: center; gap: 0.5rem; }
.tr-route-head { position: relative; }
.tr-modes { display: flex; gap: 0.4rem; margin: 0.5rem 0; }
.tr-app button.tr-mode { flex: 1 1 0; padding: 0.55rem 0.4rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; cursor: pointer; }
.tr-app button.tr-mode.tr-on { border-color: var(--accent); background: var(--tr-accent-soft); color: var(--tr-accent-text); font-weight: 600; }
.tr-routes { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.tr-route { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.tr-route.tr-on { border-color: var(--accent); background: var(--tr-accent-soft); }
.tr-route b { font-size: 1.1rem; }
.tr-route span { color: var(--muted); }
.tr-route small { margin-left: auto; color: var(--tr-accent-text); }
.tr-app button.tr-go { flex: 1 1 auto; padding: 0.8rem; font-size: 1.1rem; }

/* navigation: the next turn big at the top, what is left at the bottom */
.tr-banner { position: absolute; top: 0.75rem; left: 0.75rem; right: 0.75rem; z-index: 7; padding: 0.9rem 1rem; border-radius: 14px; background: var(--tr-banner); color: var(--tr-banner-ink);
  box-shadow: 0 6px 20px var(--tr-shadow); }
.tr-banner[hidden] { display: none; }
.tr-banner-dist { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.tr-banner-text { margin-top: 0.25rem; font-size: 1.15rem; line-height: 1.3; overflow-wrap: anywhere; }
.tr-banner-sub { margin-top: 0.4rem; font-size: 0.9rem; }
.tr-nav-foot { display: flex; align-items: center; gap: 0.6rem; }
.tr-nav-left { flex: 1 1 auto; min-width: 0; }
.tr-nav-left b { font-size: 1.3rem; }
.tr-nav-left span { color: var(--muted); }
.tr-app button.tr-stop { background: var(--danger); border-color: var(--danger); color: var(--tr-on-danger); }

.tr-notice { position: absolute; left: 50%; bottom: 6rem; z-index: 8; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); box-sizing: border-box;
  padding: 0.65rem 1rem; border-radius: 8px; background: var(--tr-toast); color: var(--tr-toast-ink); box-shadow: 0 6px 20px var(--tr-shadow); text-align: center; }
.tr-notice[hidden] { display: none; }

.tr-dialog { width: min(30rem, calc(100% - 2rem)); box-sizing: border-box; padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.tr-dialog::backdrop { background: var(--tr-scrim); }
.tr-dialog h2 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.tr-dialog h3 { margin: 1rem 0 0.25rem; font-size: 1rem; }
.tr-dialog ul { margin: 0; padding-left: 1.2rem; line-height: 1.5; }

/* MapLibre's own controls, in the theme */
.tr-map .maplibregl-ctrl-group { background: var(--surface); }
.tr-map .maplibregl-ctrl-group button { background-color: var(--surface); }
:root[data-theme="dark"] .tr-map .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.tr-map .maplibregl-ctrl-top-right { top: 0.75rem; right: 0.25rem; }

@media (max-width: 600px) {
  .tr-bar { padding: 0.5rem 0.75rem; }
  .tr-who { display: none; }
  .tr-hero h1 { font-size: 1.6rem; }
  .tr-main { padding: 1rem 0.75rem; }
  .tr-brand { font-size: 1.15rem; }
}
