/* Critical Path shuttle survey
   Palette: Route Navy, Schist, Limestone, Signal Yellow, Lane Green, Brake Red.
   Type: Overpass (road-sign lettering) for questions and buttons,
         Atkinson Hyperlegible for answers and body text. */

@font-face {
  font-family: "Overpass";
  src: url("/fonts/Overpass-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --navy: #1E3A5F;
  --navy-press: #142A46;
  --schist: #2F3432;
  --limestone: #EDEFEC;
  --yellow: #F2C230;
  --green: #2E6B4E;
  --red: #B42318;
  --surface: #FFFFFF;
  --line: #5F6661;
  --line-soft: #C3C8C2;
  --muted: #4A514D;
  --on-navy: #FFFFFF;
  --focus: #1E3A5F;
  --f-sign: "Overpass", "Trebuchet MS", sans-serif;
  --f-body: "Atkinson Hyperlegible", Verdana, sans-serif;
  --r-btn: 14px;
  --r-row: 10px;
  --r-input: 6px;
  --bar-h: 84px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #7FA6CF;
    --navy-press: #A3C0DE;
    --schist: #E8EAE6;
    --limestone: #1A1D1C;
    --green: #6FB08D;
    --red: #F0A39A;
    --surface: #232726;
    --line: #9AA19C;
    --line-soft: #414744;
    --muted: #BCC2BD;
    --on-navy: #0F1A26;
    --focus: #C6D8EC;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #7FA6CF; --navy-press: #A3C0DE; --schist: #E8EAE6; --limestone: #1A1D1C;
  --green: #6FB08D; --red: #F0A39A; --surface: #232726; --line: #9AA19C;
  --line-soft: #414744; --muted: #BCC2BD; --on-navy: #0F1A26; --focus: #C6D8EC;
}

*, *::before, *::after { box-sizing: inherit; }
html { background: var(--limestone); scroll-padding-top: env(safe-area-inset-top, 0px); scroll-padding-bottom: calc(var(--bar-h) + 24px + env(safe-area-inset-bottom, 0px)); }
body {
  margin: 0;
  background: var(--limestone);
  color: var(--schist);
  font: 400 17px/1.5 var(--f-body);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body.has-bar main { padding-bottom: calc(var(--bar-h) + 32px + env(safe-area-inset-bottom, 0px)); }

.wrap { max-width: 34rem; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
main { outline: none; padding-bottom: 48px; }
p { margin: 0 0 16px; }
a { color: var(--navy); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1:focus, main:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Type scale ---------- */
.intro-title {
  font-family: var(--f-sign);
  font-weight: 800;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 28px 0 18px;
}
.q-title {
  font-family: var(--f-sign);
  font-weight: 750;
  font-size: 30px;
  line-height: 1.15;
  margin: 0;
}
.help { font-size: 15px; color: var(--muted); margin: 10px 0 0; }
.body-lg { font-size: 19px; }
@media (min-width: 700px) {
  .intro-title { font-size: 48px; margin-top: 40px; }
  .q-title { font-size: 36px; }
}

/* ---------- Preview banner (preview build only) ---------- */
.preview {
  background: var(--yellow);
  color: #1A1D1C;
  font-size: 15px;
  font-weight: 700;
}
.preview .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.preview button {
  font: 700 15px var(--f-body); color: #1A1D1C; background: none; border: 0;
  text-decoration: underline; text-underline-offset: 3px; min-height: 44px; cursor: pointer; padding: 0 4px;
}

/* ---------- Light / dark toggle: small, top right, above everything ---------- */
.topbar { display: flex; justify-content: flex-end; padding-top: 4px; }
.theme-btn { font-size: 15px; min-height: 44px; padding: 0 2px; }
.topbar + .strip { padding-top: 0; }
.topbar ~ main .routes { margin-top: 0; }

/* ---------- Strip map progress ---------- */
.strip { padding-top: 14px; padding-bottom: 6px; }
.track { position: relative; height: 30px; margin: 22px 10px 0; }
.track .line { position: absolute; top: 50%; height: 0; border-top: 4px solid var(--navy); margin-top: -2px; }
.track .line.dashed { border-top-style: dashed; }
.track .stop {
  position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; background: var(--limestone); border: 3px solid var(--navy);
}
.track .stop.done { background: var(--green); border-color: var(--green); }
.track .term {
  position: absolute; top: 50%; right: -2px; width: 5px; height: 24px; margin-top: -12px;
  background: var(--navy); border-radius: 2px;
}
.track .term-label {
  position: absolute; right: -6px; top: -22px; font: 700 15px/1 var(--f-sign); color: var(--schist);
}
.track .marker {
  position: absolute; top: 50%; left: var(--pos, 0%); width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; background: var(--yellow); border: 3px solid var(--schist);
  transition: left 200ms ease-out;
}
.strip-text { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; font-size: 15px; color: var(--muted); }
.strip-text strong { font: 700 17px var(--f-sign); color: var(--schist); }

/* ---------- Intro ---------- */
.routes { margin: 20px 0 0; }
.routes svg { display: block; width: 100%; max-width: 420px; height: auto; }
.routes .r-line { stroke: var(--navy); stroke-width: 5; fill: none; stroke-linecap: round; }
.routes .r-stop { fill: var(--limestone); stroke: var(--navy); stroke-width: 4; }
.routes .r-hub { fill: var(--surface); stroke: var(--navy); stroke-width: 4; }
.routes .r-name { font: 700 15px var(--f-sign); fill: var(--schist); }
.routes .r-sub { font: 400 13px var(--f-body); fill: var(--muted); }
.routes figcaption { font-size: 15px; color: var(--muted); margin-top: 6px; }

.facts { list-style: none; padding: 0; margin: 22px 0 22px; display: grid; gap: 10px; font-size: 17px; }
.facts li { margin: 0; }

.check {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 14px 16px; margin: 24px 0 0;
  background: var(--surface); border: 2px solid var(--line-soft); border-radius: var(--r-row);
  font: 700 19px var(--f-body); cursor: pointer;
}
.check input { width: 26px; height: 26px; margin: 0; accent-color: var(--navy); flex: none; }
.check:hover { border-color: var(--line); }

.stack { display: grid; gap: 12px; margin-top: 20px; }
.stack .btn { width: 100%; }

/* ---------- Questions ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin: 0 0 4px; width: 100%; }
.q { padding-top: 18px; }
.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 14px 16px;
  background: var(--surface); color: var(--schist);
  border: 2px solid var(--line-soft); border-radius: var(--r-row);
  font-size: 19px; line-height: 1.3; cursor: pointer;
}
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.opt:hover { border-color: var(--line); }
.opt .ind {
  flex: none; width: 24px; height: 24px; border: 2px solid var(--line); border-radius: 50%;
  display: grid; place-items: center;
}
.opt .ind.box { border-radius: 5px; }
.opt .key { margin-left: auto; padding-left: 8px; font-size: 15px; color: var(--muted); display: none; }
@media (hover: hover) and (pointer: fine) { .opt .key { display: inline; } }
.opt.is-on { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.opt.is-on .ind { border-color: var(--on-navy); }
.opt.is-on .ind::after { content: ""; width: 12px; height: 12px; border-radius: inherit; background: var(--on-navy); }
.opt.is-on .ind.box::after { border-radius: 2px; }
.opt.is-on .key { color: var(--on-navy); }
.opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
@supports not selector(:has(*)) { .opt:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; } }
.opt { transition: background-color 120ms linear, border-color 120ms linear; }

.opt.pair { align-items: flex-start; min-height: 92px; padding-top: 16px; padding-bottom: 16px; }
.opt.pair .ind { margin-top: 2px; }
.pair-tag { display: block; font: 750 17px var(--f-sign); margin-bottom: 4px; }

.field-label { display: block; font-size: 15px; font-weight: 700; margin: 0 0 6px; }
.other { margin-top: 14px; }
.text-in, .text-area {
  width: 100%; font: 400 18px/1.4 var(--f-body); color: var(--schist); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--r-input); padding: 12px 14px;
}
.text-area { min-height: 170px; resize: vertical; margin-top: 22px; }
.counter { font-size: 15px; color: var(--muted); margin-top: 6px; }

.err { color: var(--red); font-weight: 700; font-size: 17px; margin: 14px 0 0; }
.err:empty { display: none; }
.status { font-size: 17px; margin: 14px 0 0; }

.quiet-row { margin-top: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 56px; padding: 10px 22px;
  font: 750 19px/1.2 var(--f-sign); color: var(--on-navy); background: var(--navy);
  border: 2px solid var(--navy); border-radius: var(--r-btn); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--navy-press); border-color: var(--navy-press); }
.btn.secondary { background: transparent; color: var(--navy); border-radius: 12px; }
.btn.secondary:hover { background: var(--surface); }
.btn[aria-disabled="true"] { cursor: progress; }
.link-btn {
  background: none; border: 0; padding: 0 6px; min-height: 48px;
  font: 700 18px var(--f-sign); color: var(--navy);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; cursor: pointer;
}
.link-btn:hover { text-decoration-thickness: 3px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--limestone); border-top: 2px solid var(--line-soft);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
}
.bar-in { display: flex; align-items: center; gap: 12px; }
.bar .btn { flex: 1; }

/* Turnstile only shows itself if it needs a tap. It sits just above the bottom bar so it is always in view. */
.ts {
  position: fixed; left: 0; right: 0; z-index: 6;
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; pointer-events: none;
}
.ts:empty { display: none; }
.ts > * { pointer-events: auto; }

/* ---------- Plain pages (privacy, 404, results) ---------- */
.page h1 { font: 800 36px/1.1 var(--f-sign); margin: 32px 0 16px; }
.page h2 { font: 750 22px/1.2 var(--f-sign); margin: 32px 0 8px; }
.page ul { padding-left: 22px; margin: 0 0 16px; }
.page li { margin-bottom: 6px; }
@media (min-width: 700px) { .page h1 { font-size: 44px; } }

/* ---------- Results ---------- */
.results-wrap { max-width: 46rem; }
.res-q { margin: 36px 0 0; }
.res-q h2 { font: 750 21px/1.25 var(--f-sign); margin: 0 0 4px; }
.res-n { font-size: 15px; color: var(--muted); margin: 0 0 12px; }
.res-row { display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem; gap: 4px 12px; align-items: center; margin: 0 0 10px; }
.res-label { font-size: 16px; }
.res-count { font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.res-bar { grid-column: 1 / -1; height: 10px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.res-fill { height: 100%; width: var(--w, 0%); background: var(--navy); border-radius: 5px; }
.skeleton { background: var(--line-soft); border-radius: 6px; height: 18px; margin: 12px 0; }
.skeleton.wide { height: 26px; width: 70%; }
.table-scroll { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
