/* Mangaluru buses: floating glass UI over a terrain map (look follows Contour). */
:root {
  color-scheme: light;
  --paper: hsla(75, 18%, 95%, 1);
  --ink: hsla(165, 11%, 17%, 1);
  --muted: hsla(140, 4%, 49%, 1);
  --faint: hsla(90, 6%, 70%, 1);
  --line: hsla(75, 16%, 89%, 1);
  --accent: hsla(223, 67%, 59%, 1);
  --coral: hsla(14, 61%, 66%, 1);
  --sage: hsla(95, 10%, 52%, 1);
  --glass: hsla(60, 100%, 99%, 0.9);
  --glass-edge: hsla(0, 0%, 100%, 0.68);
  --hover: hsla(75, 18%, 90%, 0.7);
  --shadow: 0 8px 32px hsla(163, 20%, 19%, 0.13), 0 1px 3px hsla(163, 20%, 19%, 0.04);
  --thumb: hsla(140, 4%, 49%, 0.28);
  --thumb-hover: hsla(140, 4%, 49%, 0.5);
  --radius: 24px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: hsla(160, 8%, 11%, 1);
  --ink: hsla(75, 18%, 92%, 1);
  --muted: hsla(140, 5%, 64%, 1);
  --faint: hsla(140, 4%, 42%, 1);
  --line: hsla(160, 6%, 22%, 1);
  --accent: hsla(223, 80%, 72%, 1);
  --coral: hsla(14, 80%, 70%, 1);
  --sage: hsla(95, 14%, 60%, 1);
  --glass: hsla(160, 8%, 13%, 0.86);
  --glass-edge: hsla(0, 0%, 100%, 0.07);
  --hover: hsla(160, 6%, 22%, 0.7);
  --shadow: 0 8px 32px hsla(0, 0%, 0%, 0.42), 0 1px 3px hsla(0, 0%, 0%, 0.2);
  --thumb: hsla(75, 18%, 92%, 0.18);
  --thumb-hover: hsla(75, 18%, 92%, 0.34);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink);
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
#map { position: fixed; inset: 0; }
[hidden] { display: none !important; }

.glass { background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* brand */
.brand { position: fixed; top: 20px; left: 20px; z-index: 5; height: 48px; padding: 0 18px 0 14px; border-radius: 999px;
  display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand i { color: var(--accent); font-size: 16px; }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: 0; }

/* search */
.search-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 6; width: min(460px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 10px; }
.search { border-radius: 26px; padding: 6px 6px 6px 16px; }
.search-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.search-row > i { color: var(--muted); font-size: 14px; width: 16px; text-align: center; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 15px; padding: 8px 0; }
.search input::placeholder { color: var(--faint); }
.search .divider { height: 1px; background: var(--line); margin: 0 6px 0 26px; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); margin: 0 3.5px; flex: none; }
.dot.end { background: var(--coral); border-color: var(--coral); border-radius: 2px; }

.seg { display: inline-flex; gap: 2px; flex: none; }
.seg button { border: 0; background: none; cursor: pointer; padding: 7px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: var(--accent); }
.icon { border: 0; background: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; flex: none; }
.icon:hover { color: var(--ink); }

/* results */
.results { border-radius: var(--radius); max-height: min(42vh, 440px); display: flex; flex-direction: column; overflow: hidden; }
.results-head { padding: 14px 20px 8px; font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.results-list { overflow-y: auto; padding: 0 8px 10px; overscroll-behavior: contain; }
.result { display: grid; grid-template-columns: 46px 1fr; gap: 2px 10px; padding: 10px 12px; border-radius: 16px; cursor: pointer; }
.result .ends, .result .no { transition: color .15s ease; }
.result:hover .ends, .result:focus-visible .ends { color: var(--accent); }
.result:focus-visible { outline: none; }
.result.on .ends { color: var(--coral); }
.result .no { font-weight: 700; font-size: 15px; color: var(--accent); grid-row: span 2; padding-top: 1px; }
.result.on .no { color: var(--coral); }
.result .ends { font-weight: 600; }
.result .meta { font-size: 12px; color: var(--muted); }
.result .warn { color: var(--coral); }
.empty { padding: 6px 20px 18px; color: var(--muted); }

/* custom scrollbars */
.results-list, .about-body { scrollbar-width: thin; scrollbar-color: var(--thumb) transparent; }
.results-list::-webkit-scrollbar, .about-body::-webkit-scrollbar { width: 10px; }
.results-list::-webkit-scrollbar-track, .about-body::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.results-list::-webkit-scrollbar-thumb, .about-body::-webkit-scrollbar-thumb { background: var(--thumb); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
.results-list::-webkit-scrollbar-thumb:hover, .about-body::-webkit-scrollbar-thumb:hover { background: var(--thumb-hover); border: 3px solid transparent; background-clip: padding-box; }

/* map controls */
.controls { position: fixed; right: 20px; bottom: 28px; z-index: 5; display: flex; flex-direction: column; gap: 10px; }
.top-right { position: fixed; right: 20px; top: 20px; z-index: 5; }
.fab { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 14px; font-weight: 700; }
.fab:hover { color: var(--accent); }
.fab .n { font-size: 9px; font-weight: 700; display: block; line-height: 1; margin-bottom: -2px; }

/* time bar */
.timebar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.time-pill { border-radius: 999px; height: 40px; padding: 0 4px 0 12px; display: flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pill-btn { border: 0; background: none; cursor: pointer; display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 6px 0 0; font-weight: 600; }
.pill-play { border: 0; background: none; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); font-size: 12px; }
.pill-play:hover { color: var(--ink); }
.time-pill .chev { color: var(--muted); font-size: 11px; transition: transform .25s ease; }
.time-pill .live { color: var(--muted); font-weight: 500; font-size: 12px; }
.timebar.open .time-pill .chev { transform: rotate(180deg); }
.time-panel { border-radius: var(--radius); padding: 14px 18px 12px; width: min(560px, calc(100vw - 32px)); }
.time-row { display: flex; align-items: center; gap: 12px; }
.time-row .icon { color: var(--ink); }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 28px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--fill, 0%), var(--line) var(--fill, 0%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--glass); border: 2px solid var(--accent); box-shadow: var(--shadow); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--glass); border: 2px solid var(--accent); }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); padding: 0 44px 0 46px; font-variant-numeric: tabular-nums; }
.time-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; text-align: center; }


/* settings popover */
.settings { position: fixed; top: 76px; right: 20px; z-index: 7; width: 248px; border-radius: 22px; padding: 10px 10px 8px; }
.set-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.set-head span { letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.skins { display: flex; flex-direction: column; }
.skin { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 7px 10px; border-radius: 12px; text-align: left; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.skin:hover .skin-name { color: var(--accent); }
.skin[aria-pressed="true"] .skin-name { color: var(--accent); font-weight: 650; }
.skin .check { margin-left: auto; color: var(--accent); font-size: 11px; visibility: hidden; }
.skin[aria-pressed="true"] .check { visibility: visible; }
.sw { display: inline-flex; gap: 0; flex: none; }
.sw i { width: 11px; height: 11px; border-radius: 50%; margin-right: -3px; box-shadow: 0 0 0 1.5px var(--glass); }
.settings input[type=range] { width: calc(100% - 20px); margin: 0 10px; }
.set-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; border: 0; background: none; cursor: pointer; padding: 9px 10px; font-size: 13.5px; color: var(--ink); }
.set-toggle i { font-size: 20px; color: var(--accent); }
.set-toggle.off i { color: var(--faint); }
.set-toggle:hover span { color: var(--accent); }

/* about */
.about-btn { position: fixed; left: 20px; bottom: 24px; z-index: 5; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 12px; }
.about { position: fixed; left: 20px; bottom: 66px; z-index: 7; width: min(340px, calc(100vw - 40px)); border-radius: 20px; font-size: 12.5px; color: var(--muted); }
.about-body { max-height: 50vh; overflow-y: auto; padding: 16px 18px; }
.about b { color: var(--ink); font-weight: 600; }
.about p { margin: 0 0 8px; }

.maplibregl-ctrl-attrib { background: transparent !important; font-size: 10.5px; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { display: none; }
.maplibregl-popup-content { background: var(--glass); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 14px; font: 12.5px/1.4 Inter, sans-serif; backdrop-filter: blur(20px); }
.maplibregl-popup-tip { display: none; }
.pop-title { font-weight: 700; }
.pop-muted { color: var(--muted); }

@media (max-width: 1080px) { .brand { display: none; } }
@media (max-width: 720px) {
  .brand small { display: none; }
  .brand { top: auto; bottom: 84px; left: 16px; height: 40px; font-size: 15px; display: none; }
  .search-wrap { top: 14px; }
  .controls { right: 14px; bottom: 96px; }
  .top-right { top: auto; bottom: 330px; right: 14px; }
  .timebar { bottom: 18px; }
  .about-btn { left: 14px; bottom: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- smooth start: shimmer cover, then the map and panels ease in */
#map { opacity: 0; transition: opacity 0.9s ease; }
body.ready #map { opacity: 1; }
#loader { position: fixed; inset: 0; z-index: 1; background: var(--paper); overflow: hidden; pointer-events: none;
  transition: opacity 0.9s ease 0.1s; }
body.ready #loader { opacity: 0; }
#loader::before { content: ""; position: absolute; inset: -10%; opacity: 0.5;
  background: repeating-radial-gradient(ellipse at 62% 58%, transparent 0 22px, var(--line) 22px 23px, transparent 23px 46px); }
.loader-sheen { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, var(--glass) 50%, transparent 70%);
  background-size: 250% 100%; animation: sheen 1.6s ease-in-out infinite; }
@keyframes sheen { from { background-position: 130% 0; } to { background-position: -30% 0; } }
.loader-note { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted); letter-spacing: 0.01em; }
.loader-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.55); opacity: 0.4; } }
.brand, .search-wrap, .top-right, .controls, .timebar, .about-btn { opacity: 0; translate: 0 6px;
  transition: opacity 0.6s ease, translate 0.6s cubic-bezier(.2,.8,.2,1); }
body.ready :is(.brand, .search-wrap, .top-right, .controls, .timebar, .about-btn) { opacity: 1; translate: none; }
body.ready .search-wrap { transition-delay: 0.15s; } body.ready .controls, body.ready .top-right { transition-delay: 0.3s; }
body.ready .timebar, body.ready .about-btn { transition-delay: 0.45s; }
@media (prefers-reduced-motion: reduce) { .loader-sheen, .loader-dot { animation: none; } }

/* ---------- old-data notice above the search, and search hints */
:root { --warn: hsla(32, 85%, 36%, 1); } :root[data-theme="dark"] { --warn: hsla(40, 95%, 66%, 1); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 8px; border-radius: 16px;
  font-size: 12px; line-height: 1.45; color: var(--muted); }
.notice i { color: var(--warn); margin-top: 2px; font-size: 12px; }
.notice b { color: var(--warn); font-weight: 600; }
.result .near { color: var(--muted); font-weight: 400; }
.results-head b { color: var(--ink); }

/* ---------- trip planner rows and direction links (colour only, no fills inside the panel) */
.results-head .head-note { display: block; margin-top: 2px; font-size: 11.5px; color: var(--faint); }
.trip-opt .tt { font-variant-numeric: tabular-nums; }
.trip-opt .soon { color: var(--accent); font-weight: 600; }
.trip-opt .no i { font-size: 10px; color: var(--faint); margin: 0 1px; }
.trip-opt.on .tt { color: var(--coral); }
.dir-links { display: flex; gap: 18px; padding: 4px 12px 10px; }
.dir-links button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--accent); }
.dir-links button:hover { color: var(--ink); }
.dir-links button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- label for a hovered bus: follows the bus, never catches the mouse */
.bus-tip { position: fixed; left: 0; top: 0; z-index: 7; pointer-events: none; padding: 8px 12px 9px; border-radius: 14px; max-width: 280px;
  margin: 0; translate: -50% calc(-100% - 14px); font-size: 12.5px; line-height: 1.35; white-space: normal; will-change: transform; }
.bus-tip .tip-top { display: flex; gap: 8px; align-items: baseline; }
.bus-tip .tip-top b { font-size: 15px; color: var(--accent); }
.bus-tip .tip-top span { font-weight: 600; color: var(--ink); }
.bus-tip .tip-meta { color: var(--muted); margin-top: 2px; }

/* ---------- published site: brand links home; links are coloured, never underlined */
a { text-decoration: none; }
a.brand { color: var(--ink); }
a.brand:hover i { color: var(--ink); }
.about a { color: var(--accent); font-weight: 600; }
.about a:hover { color: var(--ink); }
