/* Larkhaul live fleet: a light, warm product panel. The map is one SVG built by script.js (blocks, roads, bridges,
   routes, trucks); the card on the side shows the truck under the pointer or the selected one. One accent, signal
   orange, for the route on show, the flagged bridge and the selected cab. */
:root {
  --page: #ece8e1;          /* the page */
  --panel: #fbfaf7;         /* the panel */
  --ground: #f2efe9;        /* the map's ground */
  --block: #e8e3da;         /* the city blocks */
  --road: #ffffff;          /* the roads */
  --casing: #ddd6ca;        /* the edge of the roads */
  --river: #d9e0e0;         /* the river */
  --ink: #1d1c1a;           /* the words and the trucks */
  --muted: #8b857b;         /* the small words */
  --line: rgba(29, 28, 26, 0.08); /* the thin lines */
  --accent: #ff5a1f;        /* the route on show, the flag, the selected cab */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vmin, 32px);
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 40%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 70%),
    var(--page);
}

.panel {
  position: relative;
  width: min(94vw, 900px);
  height: min(88vh, 520px);
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--panel);
  border-radius: 22px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(29, 28, 26, 0.06),
    0 1px 1px rgba(29, 28, 26, 0.04),
    0 8px 16px -6px rgba(60, 44, 24, 0.10),
    0 30px 60px -20px rgba(60, 44, 24, 0.22);
  opacity: 0;
}

.panel::after {
  /* the light catching the top edge */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* the header */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand__mark {
  width: 22px;
  height: 22px;
  flex: none;
}

.brand__mark rect {
  fill: var(--ink);
}

.brand__mark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand__name {
  font-weight: 640;
  font-variation-settings: 'wdth' 108;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand__sub {
  font-size: 13px;
  color: var(--muted);
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.bar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.bar__count b {
  color: var(--ink);
  font-weight: 600;
}

.bar__time {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(29, 28, 26, 0.05);
}

/* the body: the map and the card */
.body {
  display: grid;
  grid-template-columns: 1fr 252px;
  min-height: 0;
}

.map {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ground);
}

.map__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.ground {
  fill: var(--ground);
}

.block {
  fill: var(--block);
}

.block--park {
  fill: #e4e1d5;
}

.river {
  fill: none;
  stroke: var(--river);
  stroke-width: 26;
  stroke-linecap: round;
}

.river--bank {
  stroke: #cfd7d7;
  stroke-width: 29;
}

.river--sheen {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 1.2;
  stroke-dasharray: 18 26;
}

.road__casing {
  fill: none;
  stroke: var(--casing);
  stroke-width: 9;
  stroke-linecap: square;
}

.road {
  fill: none;
  stroke: var(--road);
  stroke-width: 7;
  stroke-linecap: square;
}

.road--minor.road__casing {
  stroke-width: 5.5;
}

.road--minor.road {
  stroke-width: 4;
}

.rail {
  fill: none;
  stroke: #b7aea1;
  stroke-width: 1.2;
  stroke-linecap: round;
}

.clear {
  font: 500 9px 'Mona Sans Variable', system-ui, sans-serif;
  fill: var(--muted);
  paint-order: stroke;
  stroke: var(--ground);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.route {
  fill: none;
  stroke: rgba(29, 28, 26, 0.16);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route__hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: pointer;
}

.route--hi {
  stroke: var(--accent);
  stroke-width: 2.6;
}

.route--glow {
  stroke: var(--accent);
  stroke-opacity: 0.14;
  stroke-width: 9;
}

.mark__box {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.4;
}

.mark--depot .mark__box {
  fill: var(--ink);
}

.mark__text {
  font: 600 9.5px 'Mona Sans Variable', system-ui, sans-serif;
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--ground);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* the flag on the low bridge */
.flag__card {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 1.2;
}

.flag__icon {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flag__text {
  font: 650 10px 'Mona Sans Variable', system-ui, sans-serif;
  fill: var(--ink);
}

.flag__bar {
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* the trucks */
.truck {
  cursor: pointer;
}

.truck__shadow {
  fill: #3a2c1c;
  opacity: 0.22;
  filter: url(#soft);
}

.truck__trailer {
  fill: #cfc8bd;
  stroke: rgba(29, 28, 26, 0.18);
  stroke-width: 0.6;
}

.truck__rib {
  stroke: rgba(255, 255, 255, 0.6);
  stroke-width: 0.6;
}

.truck__cab {
  fill: #8f887d;
}

.truck__glass {
  fill: none;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 0.9;
  stroke-linecap: round;
}

.truck__hit {
  fill: transparent;
}

.truck__grow {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.truck.is-shown .truck__trailer {
  fill: var(--ink);
  stroke: none;
}

.truck.is-shown .truck__rib {
  stroke: rgba(255, 255, 255, 0.16);
}

.truck.is-shown .truck__cab {
  fill: var(--accent);
}

.truck.is-hover .truck__grow {
  transform: scale(1.22);
}

.map__scale {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
}

.map__ruler {
  width: 38px;
  height: 5px;
  border: 1px solid var(--muted);
  border-top: 0;
}

.map__hint {
  position: absolute;
  right: 12px;
  bottom: 10px;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(251, 250, 247, 0.85);
  box-shadow: 0 0 0 1px var(--line);
}

/* the card */
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-left: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card__label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 560;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(29, 28, 26, 0.05);
  box-shadow: inset 0 0 0 1px rgba(29, 28, 26, 0.06);
  transition: color 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.chip.is-warn {
  color: #c2410c;
  background: rgba(255, 90, 31, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 90, 31, 0.28);
}

.chip__icon {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip__icon g {
  display: none;
}

.chip__icon g.is-on {
  display: inline;
}

.plate {
  margin: 0;
  display: inline-block;
  align-self: flex-start;
  font-weight: 650;
  font-variation-settings: 'wdth' 112;
  font-size: 22px;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 7px 10px 6px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(29, 28, 26, 0.12), 0 1px 2px rgba(29, 28, 26, 0.06);
}

.card__main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.driver {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: linear-gradient(160deg, #f1ece4, #ddd5c9);
  box-shadow: inset 0 0 0 1px rgba(29, 28, 26, 0.08);
}

.stats {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.stat dt {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.stat--low {
  grid-column: 1 / -1;
}

.stat.is-warn dd {
  color: #c2410c;
}

.eta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.eta__label {
  font-size: 10.5px;
  color: var(--muted);
}

.eta__row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.roll {
  display: inline-flex;
  font-size: 30px;
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.roll__digit {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
}

.roll__reel {
  display: flex;
  flex-direction: column;
}

.roll__reel span {
  height: 1em;
  line-height: 1;
}

.roll__colon {
  padding: 0 0.04em;
}

.eta__delta {
  font-size: 12px;
  font-weight: 600;
  color: #c2410c;
  opacity: 0;
}

.trip {
  height: 3px;
  border-radius: 3px;
  background: rgba(29, 28, 26, 0.07);
  overflow: hidden;
}

.trip__fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--ink);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.note {
  margin: 0;
  margin-top: auto;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}

@media (hover: hover) {
  .map__hint {
    transition: opacity 0.3s;
  }
}

/* narrow: the card goes under the map, in a short form */
@media (max-width: 620px) {
  .panel {
    width: 100%;
    height: min(94vh, 560px);
    border-radius: 16px;
  }

  .bar {
    padding: 9px 12px;
  }

  .bar__count {
    display: none;
  }

  .brand__name {
    font-size: 13px;
  }

  .brand__mark {
    width: 19px;
    height: 19px;
  }

  .body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .map__hint,
  .map__scale {
    display: none;
  }

  .card {
    border-left: 0;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "main eta"
      "top top"
      "trip trip";
    gap: 8px 10px;
    padding: 10px 12px 11px;
  }

  .card__top {
    grid-area: top;
  }

  .card__label {
    display: none;
  }

  .card__main {
    grid-area: main;
    gap: 6px;
    min-width: 0;
  }

  .plate {
    font-size: 15px;
    padding: 5px 7px 4px;
    border-radius: 6px;
  }

  .driver {
    font-size: 11.5px;
    gap: 6px;
  }

  .avatar {
    width: 19px;
    height: 19px;
    font-size: 8px;
  }

  .stats {
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 4px 14px;
  }

  .stat--cargo,
  .stat--low {
    display: none;
  }

  .stat dt {
    font-size: 9.5px;
    margin-bottom: 0;
  }

  .stat dd {
    font-size: 12px;
  }

  .eta {
    grid-area: eta;
    border-top: 0;
    padding-top: 0;
    align-items: flex-end;
    justify-content: flex-start;
  }

  .eta__row {
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 2px;
  }

  .roll {
    font-size: 24px;
  }

  .eta__delta {
    font-size: 10.5px;
  }

  .trip {
    grid-area: trip;
  }

  .note {
    display: none;
  }

  .chip {
    font-size: 10.5px;
  }
}

@media (max-height: 380px) {
  .map__hint {
    display: none;
  }
}

[data-hi],
[data-marks],
[data-flag],
.route {
  pointer-events: none;
}
