/* Deadhead — landing page.
   The palette is the Flutter client's theme.dart, so the page and the app
   agree about what a colour means: amber is your fleet, cyan is the network,
   violet is a truck the world has stopped. */

:root {
  --ground:  #0E1116;
  --surface: #151A21;
  --raised:  #1D242E;
  --line:    #2A3341;
  --line-hi: #33404F;

  --cream:   #ECE6D8;
  --mute:    #8A97A8;
  --faint:   #5A6478;

  --amber:   #F6A723;
  --amber-d: #6B4A1B;
  --cyan:    #3BC9DB;
  --held:    #9B8AFB;
  --good:    #4CC38A;
  --bad:     #E5484D;

  --display: "Oswald", system-ui, sans-serif;
  --body:    "Barlow", system-ui, sans-serif;
  --mono:    "Space Mono", ui-monospace, monospace;

  --gutter:  clamp(16px, 3vw, 40px);
  --radius:  6px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--cream);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* A faint map graticule behind everything, rather than graph paper. */
.graticule {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right,  rgba(138,151,168,.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(138,151,168,.055) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 40%, #000 35%, transparent 100%);
}

.head, .wrap, .foot { position: relative; z-index: 1; }

.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;
}

/* ---------- header ---------- */

.head {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(14,17,22,.8);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }

/* The app's own crest, its painted-on checkerboard stripped — see
   tool/make_brand_assets.py. It carries the name too, but at this size that
   banner is unreadable, so the wordmark beside it still does that work. */
.mark {
  height: 42px;
  width: auto;
  display: block;
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .09em; }
.brand-sub  { font-family: var(--mono); font-size: 9px; color: var(--faint); letter-spacing: .1em; }

.nav { display: flex; gap: 26px; margin-inline: auto; }

.nav-link, .link {
  background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  color: var(--mute); padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-link:hover, .link:hover { color: var(--cream); border-bottom-color: var(--amber); }
.nav-link:focus-visible, .link:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.link { font-size: inherit; font-family: inherit; letter-spacing: 0; color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--amber); border-bottom-color: transparent; }

.head-right { display: flex; align-items: center; gap: 12px; }

.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-hi);
  border-radius: var(--radius);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  color: var(--mute);
  white-space: nowrap;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.pill[data-state="online"]  .pill-dot { background: var(--good); box-shadow: 0 0 0 0 rgba(76,195,138,.6); animation: ping 2.4s ease-out infinite; }
.pill[data-state="online"]  { color: var(--cream); }
.pill[data-state="offline"] .pill-dot { background: var(--amber); }
.pill[data-state="checking"] .pill-dot { background: var(--faint); animation: blink 1.2s ease-in-out infinite; }

@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(76,195,138,.55); } 70%,100% { box-shadow: 0 0 0 7px rgba(76,195,138,0); } }
@keyframes blink { 50% { opacity: .3; } }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-family: var(--display); font-weight: 600;
  font-size: 13px; letter-spacing: .1em;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.btn-primary { background: var(--amber); color: #1A1206; }
.btn-primary:hover { background: #ffb840; }

.btn-soon {
  border-color: var(--line-hi); color: var(--mute);
  background: transparent; cursor: default;
  font-size: 11px; padding: 9px 14px; font-family: var(--mono); letter-spacing: .1em;
}

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

.wrap {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(20px, 3.4vh, 44px) var(--gutter);
  display: flex;
  align-items: center;
}

.hero {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}

/* ---------- hero copy ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px;
  border: 1px solid var(--amber-d);
  border-radius: 999px;
  background: rgba(246,167,35,.07);
  color: var(--amber);
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

.display {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 4.6vw, 62px);
  line-height: .96;
  letter-spacing: -.005em;
  margin: 20px 0 0;
  text-transform: uppercase;
}
.accent { color: var(--amber); }

.lede { color: var(--mute); max-width: 44ch; margin: 18px 0 0; }

.signup { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; max-width: 460px; }

.signup input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 11px 14px;
  background: var(--raised);
  border: 1px solid var(--line-hi);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 13px;
}
.signup input::placeholder { color: var(--faint); }
.signup input:focus { outline: none; border-color: var(--amber); background: #222a36; }
.signup input[aria-invalid="true"] { border-color: var(--bad); }

.form-msg {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
  min-height: 17px;
}
.form-msg[data-tone="ok"]  { color: var(--good); }
.form-msg[data-tone="err"] { color: var(--bad); }

.fineprint { color: var(--mute); font-size: 13px; margin: 12px 0 0; }
.fineprint strong { color: var(--cream); }

.stats {
  display: flex;
  gap: clamp(18px, 2.4vw, 34px);
  margin: 30px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.stat + .stat { padding-left: clamp(18px, 2.4vw, 34px); border-left: 1px solid var(--line); }
.stats dt { font-family: var(--mono); font-weight: 700; font-size: 21px; color: var(--cream); letter-spacing: -.01em; }
.stats dd { margin: 3px 0 0; font-size: 10.5px; color: var(--faint); font-family: var(--mono); letter-spacing: .04em; white-space: nowrap; }

/* ---------- dispatcher panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line-hi);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(0,0,0,.9);
}

.panel-head {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1a212b, var(--surface));
}
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-hi); }
.dots i:first-child { background: var(--amber); }
.dots i:nth-child(2) { background: var(--cyan); }

.panel-title { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--mute); }

.panel-meta {
  margin-left: auto;
  display: flex; gap: 16px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; color: var(--faint);
}
.panel-meta b { color: var(--cream); font-weight: 400; }
.panel-meta .pos { color: var(--good); }
.live { display: flex; align-items: center; gap: 6px; color: var(--cyan); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: blink 2s ease-in-out infinite; }

.panel-body { display: grid; grid-template-columns: 1.42fr 1fr; }
.panel-map { padding: 14px 16px; border-right: 1px solid var(--line); min-width: 0; }

.map-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--faint);
  margin-bottom: 10px;
}
.map-head b { font-weight: 400; }
.cy { color: var(--cyan); }
.dim { color: var(--faint); }

.map { width: 100%; height: auto; display: block; border-radius: var(--radius); background: #0b0e13; }
.map-labels text { fill: var(--faint); font-family: "Space Mono", monospace; letter-spacing: .08em; }
.endpoint { stroke: var(--cyan); stroke-width: 2.5; }
.lane-active { filter: drop-shadow(0 0 5px rgba(59,201,219,.35)); }

/* Your truck is stopped because the driver is resting. Rival carriers keep
   moving, so the world reads as inhabited while yours is held. */
.truck { offset-path: path("M 122 122 C 170 142, 214 154, 252 152 C 310 149, 360 124, 404 96"); offset-distance: 62%; offset-rotate: 0deg; }
.held-halo { animation: breathe 3.4s ease-in-out infinite; transform-origin: center; }
@keyframes breathe { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

.rival { offset-rotate: 0deg; opacity: .85; }
.r1 { offset-path: path("M 148 28 L 392 44");  animation: drift 26s linear infinite; }
.r2 { offset-path: path("M 292 262 L 250 156"); animation: drift 19s linear infinite -6s; }
.r3 { offset-path: path("M 296 186 L 404 96");  animation: drift 15s linear infinite -3s; }
@keyframes drift { from { offset-distance: 0%; } to { offset-distance: 100%; } }

.panel-load { padding: 14px 16px; display: flex; flex-direction: column; min-width: 0; }

.label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; color: var(--faint); }
.row-head, .meter-head { display: flex; justify-content: space-between; gap: 10px; }
.row-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 4px; }

.load-name { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: .01em; }
.pay { font-family: var(--mono); font-weight: 700; font-size: 20px; color: var(--amber); }
.load-rig { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--faint); margin-top: 5px; }

.meter { margin-top: 16px; }
.bar { height: 5px; border-radius: 3px; background: var(--raised); margin-top: 6px; overflow: hidden; }
.fill { display: block; height: 100%; border-radius: 3px; }
.fill.amber { background: var(--amber); }
.fill.cyan  { background: var(--cyan); }

.held-note {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(155,138,251,.3);
  background: rgba(155,138,251,.08);
  border-radius: var(--radius);
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  color: var(--held);
}
.held-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.held-title { font-weight: 700; letter-spacing: .1em; }
.held-time { color: #b9a9ff; white-space: nowrap; }
.held-time b { color: #d6cbff; font-weight: 700; }
.held-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--held); flex: none; animation: breathe 3.4s ease-in-out infinite; }
.held-why { margin: 9px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--faint); }

/* ---------- cards ---------- */

.cards { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0 0; padding: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--amber-d);
  border-radius: var(--radius);
  padding: 13px 15px;
  transition: border-color .18s, background .18s;
}
.card:hover { border-left-color: var(--amber); background: #18202a; }
.card-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; color: var(--amber); }
.card p { margin: 7px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--mute); }

/* ---------- footer ---------- */

.foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 14px var(--gutter);
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--faint);
}
.foot-links { margin-left: auto; display: flex; gap: 20px; align-items: center; }
.foot-links a { color: var(--mute); text-decoration: none; }
.foot-links a:hover { color: var(--amber); }

/* ---------- overlays ---------- */

.sheet {
  width: min(640px, calc(100vw - 32px));
  max-height: min(80vh, 760px);
  padding: 30px clamp(20px, 4vw, 38px) 34px;
  background: var(--surface);
  border: 1px solid var(--line-hi);
  border-radius: 10px;
  color: var(--cream);
  box-shadow: 0 40px 90px -30px #000;
}
.sheet::backdrop { background: rgba(6,8,11,.78); backdrop-filter: blur(3px); }
.sheet h2 { font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: .1em; margin: 0 0 18px; }
.sheet p { color: var(--mute); margin: 0 0 14px; font-size: 14px; }
.sheet p b { color: var(--cream); font-weight: 600; }

.sheet-close { position: absolute; top: 12px; right: 14px; }
.sheet-close button {
  background: none; border: 1px solid var(--line-hi); color: var(--mute);
  width: 30px; height: 30px; border-radius: var(--radius);
  font-size: 17px; line-height: 1; cursor: pointer;
}
.sheet-close button:hover { color: var(--cream); border-color: var(--amber); }

.price { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14px; }
.price th, .price td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.price th { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--mute); }
.price td:nth-child(2) { font-family: var(--mono); font-weight: 700; color: var(--amber); }
.price td:last-child { text-align: right; font-family: var(--mono); font-size: 11.5px; }

.warn-note {
  border-left: 2px solid var(--amber);
  padding: 2px 0 2px 14px;
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .wrap { align-items: flex-start; }
  .hero { grid-template-columns: 1fr; gap: 34px; }
  .lede, .signup { max-width: none; }
  .panel-body { grid-template-columns: 1fr; }
  .panel-map { border-right: 0; border-bottom: 1px solid var(--line); }
  /* The map goes full width here, so the SVG scales up and its labels
     with it. Shrink the base size to keep them at reading size. */
  .map-labels text { font-size: 7px; }

  /* The nav drops to its own row rather than disappearing: the three
     overlays are where the pricing and the world are explained, and they
     have to stay reachable on a phone. */
  .head { flex-wrap: wrap; row-gap: 0; }
  .head-right { margin-left: auto; }
  .nav {
    order: 3; width: 100%; margin-inline: 0;
    justify-content: flex-start; gap: 22px;
    padding-top: 10px; margin-top: 10px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .head { gap: 10px; }
  .head-right { flex-wrap: wrap; gap: 8px; }
  .pill, .btn-soon { font-size: 9px; letter-spacing: .08em; padding: 7px 9px; }
  .map-labels text { font-size: 11px; }
  .display { font-size: clamp(34px, 11vw, 48px); }
  .stats { flex-direction: column; gap: 14px; }
  .stat + .stat { padding-left: 0; border-left: 0; }
  .cards { grid-template-columns: 1fr; }
  .foot { flex-direction: column; align-items: flex-start; }
  .foot-links { margin-left: 0; flex-wrap: wrap; }
}

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

/* ---------- status overlay ---------- */

.status-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin: 0 0 22px;
  padding: 16px 18px;
  background: var(--raised);
  border: 1px solid var(--line-hi);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
}
.status-grid [hidden] { display: none; }
.status-grid dt { color: var(--faint); letter-spacing: .08em; }
.status-grid dd { margin: 0; color: var(--cream); }
.status-grid dd[data-tone="wait"] { color: var(--mute); }
.status-grid dd[data-tone="ok"]   { color: var(--good); }
.status-grid dd[data-tone="bad"]  { color: var(--bad); }
.status-grid dd[data-tone="held"] { color: var(--held); }
