/* Base layer: tokens, fonts, typography, and the shared components every view uses (buttons, cards, chips, sheet, toast, app bars).
   View styles live in css/trip.css (overview, day, map, profile) and css/shell.css (home, login, join, share, account, info).
   Identity: road signage. Overpass for display, Overpass Mono for data, county-route blue and guide-sign green as the only flourishes. */

@font-face { font-family: "Overpass"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/overpass-400-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass"; font-weight: 400; font-style: italic; font-display: swap; src: url("/fonts/overpass-400-italic.ttf") format("truetype") }
@font-face { font-family: "Overpass"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/overpass-500-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/overpass-600-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass"; font-weight: 600; font-style: italic; font-display: swap; src: url("/fonts/overpass-600-italic.ttf") format("truetype") }
@font-face { font-family: "Overpass"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/overpass-700-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass"; font-weight: 800; font-style: normal; font-display: swap; src: url("/fonts/overpass-800-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass"; font-weight: 900; font-style: normal; font-display: swap; src: url("/fonts/overpass-900-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/overpass-mono-400-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/overpass-mono-500-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass Mono"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/overpass-mono-600-normal.ttf") format("truetype") }
@font-face { font-family: "Overpass Mono"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/overpass-mono-700-normal.ttf") format("truetype") }
/* Overpass's own middot hugs the next word (" · " reads "·next"); borrow Overpass Mono's for U+00B7 in every weight. Declared last so it wins for that code point. */
@font-face { font-family: "Overpass"; font-weight: 100 900; font-style: normal; font-display: swap; src: url("/fonts/overpass-mono-500-normal.ttf") format("truetype"); unicode-range: U+00B7 }

:root {
  --bg: #F3F4EF; --surface: #FFFFFF; --sunk: #E8EBE4; --ink: #141D27; --ink-2: #48525E; --ink-3: #67707A; --rule: #D5DAD2;
  --county: #1F4E9B; --signal: #F2C230; --guide: #0E6B3D;
  --ok: #23703C; --no: #B3261E; --okbg: #E3F1E7; --nobg: #FBE4E2; --warnbg: #FCF1CF; --warnink: #6B4E00;
  --font-display: "Overpass", "Highway Gothic", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Overpass", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Overpass Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --img-filter: none;
  --radius: 14px; --radius-s: 10px;
  --tap: 48px;                       /* minimum touch target: gloves */
  --topbar-h: 56px; --tabbar-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --shadow: 0 1px 2px rgba(20,29,39,.06), 0 6px 20px rgba(20,29,39,.08);
  --c: var(--county); --dc: var(--county);   /* day color; views set --c/--dc per day */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E141B; --surface: #151D26; --sunk: #1B2530; --ink: #E7ECF0; --ink-2: #A9B3BD; --ink-3: #8D98A3; --rule: #283340;
  --county: #7EA4EC; --ok: #4CB872; --no: #F2726A; --okbg: #15301F; --nobg: #3A1C1A; --warnbg: #3A3010; --warnink: #F5D77A;
  --img-filter: brightness(.9); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0E141B; --surface: #151D26; --sunk: #1B2530; --ink: #E7ECF0; --ink-2: #A9B3BD; --ink-3: #8D98A3; --rule: #283340;
  --county: #7EA4EC; --ok: #4CB872; --no: #F2726A; --okbg: #15301F; --nobg: #3A1C1A; --warnbg: #3A3010; --warnink: #F5D77A;
  --img-filter: brightness(.9); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark }

* { box-sizing: border-box }
[hidden] { display: none !important }   /* component display rules (.btn, .tabbar, .chip) must not beat the hidden attribute */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden }
a { color: var(--county); text-underline-offset: 2px }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--signal); border-radius: 6px }
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; margin: 0 }
h1 { font-weight: 900; font-size: clamp(34px, 7vw, 72px); line-height: .98; letter-spacing: -0.02em }
h2 { font-weight: 900; font-size: clamp(26px, 4.4vw, 44px); line-height: 1.04; letter-spacing: -0.015em }
h3 { font-weight: 800; font-size: 20px; letter-spacing: -0.005em; margin-bottom: 12px }
h4 { font-weight: 800; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px }
p { margin: 0 }
img { display: block; max-width: 100%; height: auto; filter: var(--img-filter) }
figure { margin: 0 }
button, input, select, textarea { font: inherit; color: inherit }
.num, time, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums }
.eyebrow { font: 600 12px/1.2 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3) }
.muted { color: var(--ink-3) }
.small { font-size: 14px }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: max(16px, var(--safe-l)); padding-right: max(16px, var(--safe-r)) }
.stack { display: grid; gap: 16px }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap }
.spacer { flex: 1 }
.ic { width: 22px; height: 22px; flex: none; display: inline-block; vertical-align: middle }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--rule); background: var(--surface); color: var(--ink); font: 800 16px/1 var(--font-display); text-decoration: none; cursor: pointer; white-space: nowrap; touch-action: manipulation }
.btn:hover { border-color: var(--ink-3) }
.btn:active { transform: translateY(1px) }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg) }
.btn.go { background: var(--guide); border-color: var(--guide); color: #fff }
.btn.day { background: var(--dc); border-color: var(--dc); color: #fff }
:root[data-theme="dark"] .btn.day { color: #10161D }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.day { color: #10161D } }
.btn.danger { color: var(--no); border-color: currentColor; background: transparent }
.btn.ghost { border-color: transparent; background: transparent }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px }
.btn.block { width: 100% }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none }
.iconbtn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 999px; border: 0; background: transparent; color: var(--ink); cursor: pointer; flex: none }
.iconbtn:hover { background: var(--sunk) }

/* cards, chips, pills */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px }
.card.flush { padding: 0; overflow: hidden }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 3px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); font: 600 12.5px/1.2 var(--font-mono); white-space: nowrap }
.chip .ic { width: 15px; height: 15px }
.chip.ok { background: var(--okbg); color: var(--ok) }
.chip.warn { background: var(--warnbg); color: var(--warnink) }
.chip.alert { background: var(--nobg); color: var(--no) }
.chip.day { background: var(--dc); color: #fff }
:root[data-theme="dark"] .chip.day { color: #10161D }   /* lifted day colors need dark text */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.day { color: #10161D } }
.pill { font: 700 11px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; padding: 6px 8px 5px; border-radius: 5px; white-space: nowrap }
.pill.ok { background: #2A7F45; color: #fff }
.pill.no { background: #B3261E; color: #fff }
.pill.chk { background: var(--signal); color: #141D27 }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); display: inline-block; flex: none }

/* forms */
.field { display: grid; gap: 6px }
.field > span { font: 600 12px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3) }
.input { min-height: var(--tap); width: 100%; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--rule); background: var(--surface); font-size: 17px }
.input:focus { border-color: var(--county); outline: none }
.check { display: flex; gap: 12px; align-items: flex-start; min-height: var(--tap); padding: 8px 0; cursor: pointer }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--guide); flex: none }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface) }
table { border-collapse: collapse; width: 100%; font-size: 15px }
th { text-align: left; font: 700 12px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 12px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap }
td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: top }
tbody tr:last-child td { border-bottom: 0 }
td.num { white-space: nowrap }

/* app chrome: top bar + bottom tab bar (phones) / top nav (desktop) */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--rule); padding-top: var(--safe-t) }
.topbar .wrap { display: flex; align-items: center; gap: 6px; min-height: var(--topbar-h) }
.topbar .ttl { font: 800 17px/1.1 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.topbar .ttl small { display: block; font: 600 11px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.syncdot { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--font-mono); color: var(--ink-3); padding: 0 8px; min-height: 36px; border-radius: 999px; border: 0; background: transparent; cursor: pointer }
.syncdot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok) }
.syncdot[data-s="pending"]::before { background: var(--signal) }
.syncdot[data-s="offline"]::before { background: var(--ink-3) }
.syncdot[data-s="error"]::before { background: var(--no) }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--rule); padding-bottom: var(--safe-b); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr }
.tabbar a { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: var(--tabbar-h); text-decoration: none; color: var(--ink-3); font: 700 12px/1 var(--font-display); letter-spacing: .02em }
.tabbar a .ic { width: 24px; height: 24px }
.tabbar a[aria-current="page"] { color: var(--ink) }
.tabbar a[aria-current="page"] .ic { color: var(--dc) }
main#view { min-height: 60vh; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px) }
.topnav { display: none }
@media (min-width: 900px) {
  .tabbar { display: none }
  main#view { padding-bottom: 48px }
  .topnav { display: flex; gap: 4px; margin-left: 12px }
  .topnav a { text-decoration: none; color: var(--ink); font: 700 14px/1 var(--font-display); padding: 10px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px }
  .topnav a:hover { background: var(--sunk) }
  .topnav a[aria-current="page"] { background: var(--sunk) }
}

/* sheet (dialog) */
dialog.sheet { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(560px, 100vw); max-height: min(88vh, 900px); border-radius: 18px; box-shadow: var(--shadow) }
dialog.sheet::backdrop { background: rgba(8,12,18,.5) }
.sheetin { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: inherit }
.sheethead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 4px 20px }
.sheethead h3 { margin: 0; font-size: 19px }
.sheetbody { overflow-y: auto; padding: 4px 20px 16px; display: grid; gap: 14px; align-content: start }
.sheetacts { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--rule) }
@media (max-width: 899px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0 }
  .sheetacts .btn { flex: 1 }
}

/* Overpass Mono joins "ffl" in "offline". :root raises specificity so component font: shorthands (which reset ligatures) don't cancel it. */
:root :is(.num, time, .mono, .eyebrow, .chip, .syncdot, .pill) { font-variant-ligatures: none }

/* toast */
#toasts { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)) }
@media (min-width: 900px) { #toasts { bottom: 24px } }
.toast { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--ink); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 15px; transition: opacity .3s, transform .3s }
.toast.out { opacity: 0; transform: translateY(8px) }
.toast .btn { background: var(--bg); color: var(--ink); border: 0 }
.toast .btn:not(.small) { min-height: 56px; padding: 0 20px }   /* toast({ big: true }): Undo with gloves */

/* empty / loading / error states */
.state { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 64px 16px; color: var(--ink-2) }
.state h2 { color: var(--ink) }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--rule); border-top-color: var(--ink); animation: spin .8s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s } * { scroll-behavior: auto !important } }

/* brand: a guide sign with the two riders and the wordmark (login, join, home). Same green and white border as the icon. */
.brandsign { display: inline-flex; align-items: flex-end; gap: 4px; background: var(--guide); color: #fff; border-radius: 16px; padding: 6px; box-shadow: var(--shadow); max-width: 100%; text-decoration: none }
.brandsign > span { display: flex; align-items: flex-end; gap: 10px; border: 3px solid #fff; border-radius: 11px; padding: 6px 18px 0 6px; overflow: hidden; min-width: 0 }
.brandsign img { width: 168px; height: auto; display: block; filter: none; flex: none; margin-bottom: -1px }
.brandsign b { font: 900 34px/1 var(--font-display); letter-spacing: -0.02em; padding-bottom: 14px; white-space: nowrap }
.brandsign.small img { width: 104px }
.brandsign.small b { font-size: 22px; padding-bottom: 9px }
@media (max-width: 400px) { .brandsign img { width: 132px } .brandsign b { font-size: 27px; padding-bottom: 11px } }
