/* Adelaide, moving — metro.simonyou.dev */
:root {
  --font-sans: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.75, 0.2, 1);
  --bus: #d99a1e; --tram: #c8102e; --train: #1f6fd6; --other: #7a8ba0;
}
:root[data-theme="day"] {
  color-scheme: light;
  --bg: #f6f1e7; --surface: #fcf9f2; --ink: #1d1a17; --dim: #6b625a;
  --line: rgba(29, 26, 23, 0.12); --line-strong: rgba(29, 26, 23, 0.3); --accent: #b07a00;
  --ok: #1f8f7a; --late: #b5473c; --early: #2f6fc4;
}
:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #0f1626; --surface: #161f33; --ink: #e8ecf3; --dim: #9aa3b5;
  --line: rgba(232, 236, 243, 0.12); --line-strong: rgba(232, 236, 243, 0.3); --accent: #f0b53c;
  --ok: #4fc2ad; --late: #f08a7a; --early: #8797f0;
}
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: clamp(15px, 0.45vw + 10px, 18px); line-height: 1.45; font-variant-ligatures: none; }
body { margin: 0; min-height: 100%; display: flex; flex-direction: column; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
.dim { color: var(--dim); }
small { font-size: 0.82em; }

/* ---------- top bar ---------- */
.top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--bus); box-shadow: 8px 0 0 -2px var(--tram), 16px 0 0 -4px var(--train); margin-right: 14px; }
.top-nav { display: flex; gap: 1rem; font-family: var(--font-mono); font-size: 0.8rem; }
.top-nav a { text-decoration: none; }
.search { position: relative; max-width: 34rem; }
.search input { width: 100%; font: inherit; font-size: 0.95rem; padding: 0.45rem 0.8rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results { position: absolute; top: calc(100% + 0.35rem); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 14px 40px -18px rgba(0,0,0,0.5); overflow: hidden; max-height: 60vh; overflow-y: auto; }
.search-results li a { display: flex; gap: 0.7rem; align-items: baseline; padding: 0.5rem 0.9rem; text-decoration: none; border-top: 1px solid var(--line); }
.search-results li:first-child a { border-top: 0; }
.search-results li a:hover, .search-results li.is-active a { background: rgba(217, 154, 30, 0.12); }
.search-results .code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--dim); min-width: 4.5ch; }

/* ---------- badges ---------- */
.badge { display: inline-block; min-width: 3.2ch; padding: 0.1rem 0.5rem; border-radius: 5px; font-family: var(--font-mono); font-weight: 700; font-size: 0.82rem; text-align: center; text-decoration: none; color: #fff; background: var(--badge, var(--bus)); }
.badge.mode-tram { background: var(--badge, var(--tram)); }
.badge.mode-train { background: var(--badge, var(--train)); }
.badge.mode-other, .badge.mode-ferry { background: var(--badge, var(--other)); }
.badge.big { font-size: 1.1rem; padding: 0.2rem 0.7rem; vertical-align: middle; margin-right: 0.3rem; }
.live { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--dim); }
.live-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--dim); }
.live-dot.is-on { background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 143, 122, 0.45); } 50% { box-shadow: 0 0 0 6px rgba(31, 143, 122, 0); } }

/* ---------- the app: panel + map ---------- */
.app { flex: 1; display: grid; grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr); min-height: 0; height: calc(100vh - 3.4rem); height: calc(100dvh - 3.4rem); }
.panel { overflow-y: auto; border-right: 1px solid var(--line); padding: 1.25rem 1.25rem 2rem; display: flex; flex-direction: column; gap: 1.5rem; }
.map { min-height: 0; height: 100%; }
.map-fallback { display: grid; place-items: center; padding: 2rem; color: var(--dim); text-align: center; }
.maplibregl-map { font-family: var(--font-sans); }
.maplibregl-ctrl-attrib { font-size: 10px; }
.hero-number { font-size: clamp(3.4rem, 5vw, 4.6rem); font-weight: 700; line-height: 0.9; letter-spacing: -0.04em; margin: 0.6rem 0 0.3rem; font-variation-settings: "opsz" 96; }
.hero-copy { font-size: 1.1rem; font-weight: 500; line-height: 1.25; max-width: 24ch; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0 0; }
.stats div { min-width: 0; }
.stats dt { color: var(--dim); font-size: 0.78rem; }
.stats dd { margin: 0.1rem 0 0; font-weight: 600; font-size: 1rem; line-height: 1.25; }
.rhythm { margin-top: 1rem; }
.rhythm .label, .label { color: var(--dim); font-family: var(--font-mono); font-size: 0.74rem; }
.rhythm-svg { display: block; width: 100%; height: 54px; margin-top: 0.3rem; overflow: visible; }
.rhythm-svg .area { fill: var(--accent); opacity: 0.18; }
.rhythm-svg .line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; }
.rhythm-svg .end { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.rhythm-svg text { font-family: var(--font-mono); font-size: 9.5px; fill: var(--dim); }
.panel h2 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; animation: rise 300ms var(--ease) both; }
.detail h3 { display: flex; align-items: center; gap: 0.6rem; font-size: 1.05rem; }
.detail .meta { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; margin-top: 0.6rem; font-size: 0.85rem; }
.detail .meta dt { color: var(--dim); }
.detail .meta dd { margin: 0; }
.detail .close { float: right; font: inherit; background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.detail .links { margin-top: 0.7rem; display: flex; gap: 0.8rem; font-size: 0.85rem; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fav { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.fav:first-child { border-top: 0; }
.fav-head { display: flex; justify-content: space-between; gap: 0.6rem; align-items: baseline; }
.fav-head a { font-weight: 600; text-decoration: none; }
.fav-head button { font: inherit; font-size: 0.75rem; color: var(--dim); background: none; border: 0; cursor: pointer; }
.fav-deps { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; font-size: 0.82rem; }
.fav-deps span b { font-weight: 600; }
.alert-list li { padding: 0.55rem 0; border-top: 1px solid var(--line); font-size: 0.85rem; }
.alert-list li:first-child { border-top: 0; }
.alert-list b { font-weight: 600; }
.alert-list .tags { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.3rem; }
.alert-list .tags .badge { font-size: 0.7rem; padding: 0 0.4rem; }
.credits { color: var(--dim); font-size: 0.75rem; margin-top: auto; }

/* ---------- pages (stop, line) ---------- */
.page { width: min(100% - 2rem, 78rem); margin: 0 auto; padding: 1.5rem 0 3rem; }
.page-head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; align-items: end; margin-bottom: 1.25rem; }
.page-head h1 { font-size: clamp(1.4rem, 2.4vw, 2.1rem); line-height: 1.15; }
.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; color: var(--dim); margin-bottom: 0.3rem; }
.eyebrow a { color: var(--dim); }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.page-stat { font-size: 0.95rem; color: var(--dim); }
.page-stat b { color: var(--ink); font-size: 1.3rem; }
.btn { font: inherit; font-size: 0.85rem; padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.is-on { background: var(--accent); border-color: var(--accent); color: #1d1a17; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 30rem); gap: 1.5rem 2.5rem; align-items: start; }
.page-grid.wide-map { grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr); }
.map.mini { height: clamp(300px, 55vh, 560px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.map.mini .map { border-radius: 12px; }
.section-title { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
.board { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1.1rem; }
.board-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-family: var(--font-mono); font-size: 0.76rem; color: var(--dim); margin-bottom: 0.4rem; }
.departures .dep { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.9rem; align-items: center; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.departures .dep:first-child { border-top: 0; }
.dep-head { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-when { text-align: right; line-height: 1.2; }
.dep-when b { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.dep-when small { display: block; color: var(--dim); font-family: var(--font-mono); font-size: 0.72rem; margin-top: 0.15rem; }
.delay.is-late { color: var(--late); } .delay.is-early { color: var(--early); } .delay.is-ok { color: var(--ok); } .delay.is-sched { color: var(--dim); }
.stop-list li { padding: 0.35rem 0; border-top: 1px solid var(--line); font-size: 0.92rem; }
.stop-list li:first-child { border-top: 0; }
.stop-list a { text-decoration: none; }
.stop-list a:hover { text-decoration: underline; }

/* ---------- small screens: map on top, panel below ---------- */
@media (max-width: 900px) {
  .top { grid-template-columns: auto minmax(0, 1fr); }
  .top-nav { display: none; }
  .app { grid-template-columns: 1fr; grid-template-rows: 52vh minmax(0, 1fr); height: auto; }
  .app .map { order: -1; height: 52vh; }
  .panel { border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .page-grid, .page-grid.wide-map { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .live-dot.is-on { animation: none; } .detail { animation: none; } }
