/* Design tokens shared by every site in sites/ (see README). Each build puts this in front of its own style.css. */
:root {
  --sign-blue: #1E4B8F; --ink: #16202B; --ink-2: #4A5763; --ink-3: #5E6B76;
  --page: #F5F5F2; --card: #FFFFFF; --line: #DDE0DB; --divider: #E6E8E3; --pill-border: #C9CEC8;
  --sky: #D6E2E2; --sky-top: #C7D7DA; --ridge-far: #2E6E73; --ridge-near: #1C4A50;
}
/* Buss. Colours from ../../shared/tokens.css; line colours come with the data (worker/config.js). Light only. */
:root { --late: #8A4B08; --late-bg: #FFF1D6; --cancelled: #B42318; --cancelled-bg: #FDECEA; --live: #2E8B57; --now: #C0392B; color-scheme: light }

* { box-sizing: border-box }
body { margin: 0; background: var(--page); color: var(--ink); font-family: Barlow, system-ui, sans-serif; -webkit-text-size-adjust: 100% }
a { color: inherit }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px }
:is(a, button, select):focus-visible { outline: 3px solid var(--sign-blue); outline-offset: 2px }
[hidden] { display: none !important }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }

/* Header: the small BYGSTAD sign (links home to bygstad.com) and the page name, as on the other apps */
.top { padding: calc(28px + env(safe-area-inset-top)) 16px 4px; text-align: center }
.sign { display: inline-block; background: var(--sign-blue); border-radius: 6px; padding: 3px; box-shadow: 0 3px 8px rgba(18, 52, 59, .25); text-decoration: none }
.sign-inner { display: block; border: 2px solid #fff; border-radius: 4px; padding: 4px 12px 3px }
.sign-text { display: block; font: 700 22px/.95 'Barlow Condensed', sans-serif; letter-spacing: .02em; color: #fff; text-transform: uppercase }
.top h1 { margin: 14px 0 0; font-size: 30px; font-weight: 600; line-height: 1.1 }
.tagline { margin: 4px 0 0; font-size: 17px; color: var(--ink-2) }

/* "2 bussar på vegen · oppdatert 20:41": always say how old the data is */
.status { margin: 16px 0 12px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: center }
.status .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--pill-border) }
.status.live .dot { background: var(--live); animation: pulse 2.4s ease-out infinite }
.status.stale { color: var(--late) }
.status.stale .dot { background: #D98E04 }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46, 139, 87, .45) } 70%, 100% { box-shadow: 0 0 0 8px rgba(46, 139, 87, 0) } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px }

/* The map, with the line legend underneath */
.map-card { position: relative; overflow: hidden }
.map { height: clamp(340px, 105vw, 540px); background: #DCE6E8 }
.map-fallback { margin: 0; padding: 14px 16px; font-size: 15px; color: var(--ink-2) }
.map-card.failed .map { display: none }
.maplibregl-ctrl-attrib { font: 11px Barlow, sans-serif }
.maplibregl-ctrl-group button { width: 36px; height: 36px }
.home-button { display: grid; place-items: center; color: var(--ink) }
.legend { margin: 0; padding: 10px 14px; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; border-top: 1px solid var(--divider); font-size: 14.5px; color: var(--ink-2) }
.legend li { display: flex; align-items: center; gap: 8px }
.legend:empty { display: none }

/* A line number, in the line's colour: the same on the map, in the legend and in the lists */
.line { display: inline-grid; place-items: center; min-width: 38px; height: 26px; padding: 0 6px; border-radius: 7px; background: var(--c); color: #fff; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1 }

/* Buses: the line number in a circle of the line's colour, with an arrow pointing where it's going */
.bus { position: relative; width: 34px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center }
.bus-code { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2.5px solid #fff; color: #fff; font: 600 12.5px/1 Barlow, sans-serif; box-shadow: 0 1px 4px rgba(18, 52, 59, .45) }
.bus-arrow { position: absolute; inset: -3px; width: 40px; height: 40px; transform: rotate(var(--rot, 0deg)); fill: var(--c); stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; transition: transform .6s ease }
.bus.no-bearing .bus-arrow { display: none }
.bus.old { opacity: .55 }
.bus:focus-visible { outline: none }
.bus:focus-visible .bus-code { outline: 3px solid var(--sign-blue); outline-offset: 2px }

.maplibregl-popup-content { padding: 12px 14px; border-radius: 12px; font: 15px/1.4 Barlow, sans-serif; color: var(--ink); box-shadow: 0 4px 16px rgba(18, 52, 59, .25) }
.maplibregl-popup-close-button { width: 32px; height: 32px; font-size: 20px; color: var(--ink-2) }
.bus-pop p { margin: 0 0 3px }
.bus-pop .bus-pop-title { display: flex; align-items: center; gap: 8px; margin: 0 26px 6px 0; font-size: 17px; font-weight: 600 }
.bus-pop .muted { margin-top: 4px; font-size: 13.5px; color: var(--ink-3) }
.link { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: var(--pill-border); text-underline-offset: 3px; cursor: pointer }
.link:hover { color: var(--sign-blue) }

/* The chosen stop: name, its lines, and a picker for all the stops */
.stop { margin-top: 26px; scroll-margin-top: 12px }
.stop-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin: 0 2px 12px }
.stop-head h2 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 24px; font-weight: 600; line-height: 1.2; scroll-margin-top: 12px }
.stop-lines { display: inline-flex; gap: 5px }
.stop-lines .line { min-width: 34px; height: 23px; font-size: 13.5px; border-radius: 6px }
.picker select { min-height: 42px; max-width: 220px; padding: 0 36px 0 12px; border-radius: 10px; border: 1px solid var(--pill-border); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%234A5763' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--ink); font: 500 16px Barlow, sans-serif; appearance: none; cursor: pointer }
.hint-line { margin: 10px 4px 0; font-size: 14px; color: var(--ink-3); text-align: center }

.situation { margin: 0 0 10px; padding: 11px 14px; border-radius: 12px; background: var(--late-bg); border: 1px solid #F2D49B; font-size: 15px; line-height: 1.45; color: #4A2F06 }
.situation strong { display: block; font-weight: 600 }
.situation p { margin: 4px 0 0 }

/* Departures: line | time | where to (+ delay, "Sjå bussen") | countdown */
.calls { margin: 0; padding: 0; list-style: none; overflow: hidden }
.calls li + li { border-top: 1px solid var(--divider) }
.empty { padding: 18px 16px; color: var(--ink-2); text-align: center; line-height: 1.45 }
.call { display: grid; grid-template-columns: 42px 54px 1fr auto; align-items: center; gap: 4px 12px; min-height: 62px; padding: 9px 14px 9px 12px; font-variant-numeric: tabular-nums }
.call .line { min-width: 42px; height: 30px; font-size: 16px }
.when { font-size: 20px; font-weight: 600; line-height: 1.15 }
.when s { display: block; font-size: 14.5px; font-weight: 400; color: var(--ink-3) }
.what { min-width: 0 }
.to { display: block; font-size: 17px; font-weight: 600; line-height: 1.25 }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; color: var(--ink-2); line-height: 1.4 }
.state { justify-self: end; padding: 3px 9px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--ink); background: var(--page) }

.call.off .when strong, .call.off .meta { color: var(--late) }
.call.cancelled .state { color: var(--cancelled); background: var(--cancelled-bg) }
.call.cancelled .when s { font-size: 20px; font-weight: 600; color: var(--cancelled) }
.call.cancelled .to { text-decoration: line-through; text-decoration-color: var(--cancelled) }
.call.gone .when, .call.gone .to { color: var(--ink-2); font-weight: 500 }
.call.gone .line { opacity: .5 }
.call.gone .state { color: var(--ink-3); font-weight: 500 }

.see-bus { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px 0 8px; border: 1px solid #B9DCC6; border-radius: 999px; background: #EEF8F1; color: #1D6B45; font: 600 13.5px Barlow, sans-serif; cursor: pointer }
.see-bus:hover { background: #E2F1E8 }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 2.4s ease-out infinite }

/* "No 15:12": between the buses that have gone and the next ones */
.calls li.now { position: relative; height: 0; border-top: 2px solid var(--now) }
.calls li.now + li { border-top: 0 }
.now span { position: absolute; left: 12px; top: -11px; padding: 1px 8px; border-radius: 999px; background: var(--now); color: #fff; font-size: 12.5px; font-weight: 600; line-height: 18px; font-variant-numeric: tabular-nums }
.calls li.day-sep { padding: 9px 14px 7px; background: var(--page); font-size: 14px; font-weight: 600; color: var(--ink-2) }
.calls li.day-sep::first-letter { text-transform: uppercase }
.calls li.now + li.day-sep { padding-top: 16px } /* room for the "No" pill above it */
.more button { display: block; width: 100%; min-height: 48px; border: 0; background: var(--page); color: var(--ink-2); font: 600 15px Barlow, sans-serif; cursor: pointer }
.more button:hover { color: var(--ink) }
.more button:focus-visible { outline-offset: -3px }

@media (max-width: 400px) {
  .call { grid-template-columns: 38px 50px 1fr auto; gap: 4px 10px; padding-inline: 10px }
  .call .line { min-width: 38px; font-size: 15px }
  .map-card { margin: 0 -8px; border-radius: 12px }
}
@media (prefers-reduced-motion: reduce) { .status.live .dot, .live-dot { animation: none } .bus-arrow { transition: none } }

/* About + footer, as on the other apps */
.about { max-width: 580px; margin: 36px auto 0; padding: 0 8px; font-size: 16px; line-height: 1.5; text-align: center; color: #2C3A44 }
.about h2 { margin: 0 0 6px; font: 700 15px 'Barlow Condensed', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2) }
.about p { margin: 0 0 8px }
.about a, footer a { text-decoration: underline; text-decoration-color: var(--pill-border); text-underline-offset: 3px }
.about a:hover, footer a:hover { color: var(--sign-blue); text-decoration-color: currentColor }
footer { padding: 40px 8px calc(32px + env(safe-area-inset-bottom)); text-align: center; font-size: 14px; line-height: 1.5; color: #2C3A44 }
