/* ==========================================================================
   BoobyBus — "Night Service"
   --------------------------------------------------------------------------
   A transit-signage design system, not a nightclub one.

   The job: be read by someone who has been drinking, outdoors, in the dark,
   on a bad mobile connection, in a hurry — and by a dispatcher in a moving
   van at 2 AM. Bus destination blinds, platform indicators and highway guide
   signs already solve exactly that problem, so the language comes from there.

   Rules this file follows:
     * ONE accent. Signal amber, the colour real destination blinds and hazard
       lights use, because amber on near-black is the most legible night
       combination there is. It replaced four competing neons.
     * Colour means STATE, never decoration. Green = your bus is coming.
       Amber = waiting on something. Red = a problem. If it is coloured, it is
       telling you something.
     * Type carries hierarchy, not glow. Barlow Condensed heavy caps for the
       destination-sign register; Barlow for everything a person actually
       reads. Long street names fit on narrow phones without shrinking.
     * Targets are at least 56px, because drunk thumbs in the cold.
     * No gradients, no glow, no scanlines, no animated background. Motion
       only when something actually changed.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Condensed:wght@500;600;700&display=swap');

:root {
  /* Night is the default: this is a service that only runs after dark. */
  --ink:          #0B0C0E;
  --surface:      #15171A;
  --surface-2:    #1E2126;
  --surface-3:    #272B31;
  --line:         #2C3137;
  --line-strong:  #434A53;

  --text:         #F3F2EF;   /* warm off-white, like paint on a sign */
  --text-dim:     #9EA4AC;
  --text-faint:   #6C727B;

  /* The one accent. */
  --amber:        #FFB020;
  --amber-dim:    #C98712;
  --amber-wash:   rgba(255, 176, 32, 0.12);
  --on-amber:     #1A1204;

  /* State. Separate from the accent, and never used ornamentally. */
  --go:           #35C27A;
  --go-wash:      rgba(53, 194, 122, 0.13);
  --stop:         #F0565B;
  --stop-wash:    rgba(240, 86, 91, 0.13);
  --idle:         #79808A;
  --idle-wash:    rgba(121, 128, 138, 0.13);

  --radius:       10px;
  --radius-sm:    6px;
  --radius-pill:  999px;
  --tap:          56px;            /* minimum interactive height */

  --cond: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gut: 16px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.45);
}

/* Daylight. Staff use the dispatcher screen in daylight more than riders use
   the app, and a phone forced to light mode must not render black-on-black. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink:         #F4F3F0;
    --surface:     #FFFFFF;
    --surface-2:   #F7F6F3;
    --surface-3:   #EDEBE6;
    --line:        #DBD8D1;
    --line-strong: #B8B4AB;
    --text:        #14161A;
    --text-dim:    #5A6069;
    --text-faint:  #858B94;
    --amber:       #A05E00;        /* darkened: amber on white needs it */
    --amber-dim:   #7E4A00;
    --amber-wash:  rgba(160, 94, 0, 0.10);
    --on-amber:    #FFFFFF;
    --go:          #0F7A48;
    --go-wash:     rgba(15, 122, 72, 0.10);
    --stop:        #B3262B;
    --stop-wash:   rgba(179, 38, 43, 0.10);
    --idle:        #5A6069;
    --idle-wash:   rgba(90, 96, 105, 0.10);
    --shadow: 0 1px 2px rgba(20,22,26,.06), 0 6px 18px rgba(20,22,26,.07);
  }
}
:root[data-theme="light"] {
  --ink:#F4F3F0; --surface:#FFFFFF; --surface-2:#F7F6F3; --surface-3:#EDEBE6;
  --line:#DBD8D1; --line-strong:#B8B4AB; --text:#14161A; --text-dim:#5A6069;
  --text-faint:#858B94; --amber:#A05E00; --amber-dim:#7E4A00;
  --amber-wash:rgba(160,94,0,.10); --on-amber:#FFFFFF; --go:#0F7A48;
  --go-wash:rgba(15,122,72,.10); --stop:#B3262B; --stop-wash:rgba(179,38,43,.10);
  --idle:#5A6069; --idle-wash:rgba(90,96,105,.10);
  --shadow: 0 1px 2px rgba(20,22,26,.06), 0 6px 18px rgba(20,22,26,.07);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

/* ---- layout ------------------------------------------------------------- */

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 var(--gut); }
.wrap-wide { max-width: 1240px; }
.stack { display: flex; flex-direction: column; gap: var(--gut); }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { height: var(--gut); }
.hidden { display: none !important; }
.center { text-align: center; }

/* ---- the route badge: the wordmark ------------------------------------- */

.mark { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.mark-badge {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  background: var(--amber);
  color: var(--on-amber);
  padding: 3px 8px 2px;
  border-radius: 3px;
  line-height: 1.15;
  white-space: nowrap;
}
.mark-word {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .035em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}

/* ---- destination blind: the single most important fact on the screen --- */

.blind {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--c, var(--amber));
  border-radius: var(--radius);
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.blind-go   { --c: var(--go); }
.blind-wait { --c: var(--amber); }
.blind-stop { --c: var(--stop); }
.blind-idle { --c: var(--idle); }
.blind-label {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c, var(--amber));
}
.blind-main {
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(26px, 7vw, 36px);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: .01em;
  text-wrap: balance;
}
.blind-sub { color: var(--text-dim); font-size: 15px; }

/* ---- type -------------------------------------------------------------- */

h1, h2, h3, h4 { font-family: var(--cond); font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(32px, 9vw, 52px); line-height: 1.02; text-transform: uppercase; letter-spacing: .005em; }
h2 { font-size: clamp(22px, 5.5vw, 30px); line-height: 1.1; text-transform: uppercase; }
h3 { font-size: 19px; line-height: 1.2; }
p  { margin: 0; }
.lede { color: var(--text-dim); font-size: 17px; }
.eyebrow {
  font-family: var(--cond); font-weight: 600; font-size: 12px;
  letter-spacing: .15em; text-transform: uppercase; color: var(--amber);
}
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.big-num {
  font-family: var(--cond); font-weight: 700;
  font-size: clamp(40px, 13vw, 64px); line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ---- buttons ----------------------------------------------------------- */

.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--tap);
  padding: 0 22px;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--amber); color: var(--on-amber); border-color: var(--amber); }
.btn-primary:hover { background: var(--amber-dim); border-color: var(--amber-dim); }
.btn-go { background: var(--go); color: #06130C; border-color: var(--go); }
.btn-danger { background: transparent; color: var(--stop); border-color: var(--stop); }
.btn-danger:hover { background: var(--stop-wash); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-xl { min-height: 68px; font-size: 22px; }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 14px; }

/* ---- forms ------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.label {
  font-family: var(--cond); font-weight: 600; font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
}
.input, select.input, textarea.input {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 17px;            /* >=16px or iOS zooms the viewport on focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.input::placeholder { color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); }
textarea.input { min-height: 88px; resize: vertical; }

/* Phone and code entry: big, spaced, unmistakable. */
.input-xl {
  font-family: var(--cond); font-weight: 700;
  font-size: 30px; letter-spacing: .06em; text-align: center;
  min-height: 68px;
  font-variant-numeric: tabular-nums;
}
.input-code { letter-spacing: .5em; text-indent: .5em; }

.hint { font-size: 14px; color: var(--text-faint); }
.err { font-size: 15px; color: var(--stop); }

/* ---- surfaces ---------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card-pad-lg { padding: 20px; }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-title {
  font-family: var(--cond); font-weight: 700; font-size: 15px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
}
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---- pills: state, at a glance ---------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--cond); font-weight: 700;
  font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--idle-wash); color: var(--idle);
  white-space: nowrap;
}
.pill-go   { background: var(--go-wash);    color: var(--go); }
.pill-wait { background: var(--amber-wash); color: var(--amber); }
.pill-stop { background: var(--stop-wash);  color: var(--stop); }
.pill-solid { background: var(--amber); color: var(--on-amber); }

/* ---- progress through a journey --------------------------------------- */

.steps { display: flex; gap: 6px; }
.step {
  flex: 1 1 0; height: 5px; border-radius: var(--radius-pill);
  background: var(--surface-3);
}
.step-done { background: var(--amber); }
.step-now  { background: var(--amber); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---- seat meter: capacity you can read without arithmetic ------------- */

.meter { display: flex; gap: 3px; align-items: center; }
.meter-seat {
  width: 9px; height: 16px; border-radius: 2px;
  background: var(--surface-3); border: 1px solid var(--line);
}
.meter-seat-taken { background: var(--amber); border-color: var(--amber); }
.meter-seat-over  { background: var(--stop);  border-color: var(--stop); }

/* ---- toast (auth.js creates .toast / .toast.error) -------------------- */

.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 90;
  max-width: calc(100% - 32px);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 13px 17px;
  font-size: 16px;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
}
.toast.error { border-left-color: var(--stop); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---- spinner ---------------------------------------------------------- */

.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- app chrome ------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
  padding-top: calc(11px + env(safe-area-inset-top));
}
@supports not (backdrop-filter: blur(8px)) { .topbar { background: var(--ink); } }

.linkish {
  background: none; border: 0; padding: 8px;
  color: var(--text-dim); font-family: var(--sans); font-size: 15px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  min-height: 44px;
}
.linkish:hover { color: var(--text); }

/* ---- scrollable wide content never pushes the page sideways ----------- */

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- accessibility ---------------------------------------------------- */

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.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;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
