/* Delivery, ported from route/: the trucks hero with the yard's open status, the zone diagram with
   its lookup, key and rates, fleet photos and delivery questions. Built on the site.css tokens.
   The map's water is --water (illustration only); red only ever marks the selected zone. */

/* ---------- hero ---------- */
.dl-hero { padding-block: clamp(28px, 4vw, 56px) 0; }
.dl-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 28px var(--gap-wide);
}
/* The claim lines up with the top of the photo, the lead and buttons with its foot */
.dl-hero-text { display: flex; flex-direction: column; }
.dl-hero-text .lead { margin-top: auto; padding-top: 28px; }
.dl-hero h1 { margin-top: -0.08em; font-size: var(--h1-page); line-height: 1.02; letter-spacing: -0.026em; }
.dl-claim {
  margin-top: 16px;
  font-family: var(--display);
  font-size: clamp(22px, 2.1vw, 29px);
  line-height: 1.2;
  letter-spacing: -0.012em;
}
.dl-hero .lead { max-width: 30em; }
.dl-hero .actions { margin-top: 26px; }

.dl-hero-photo { position: relative; align-self: start; background: var(--stone); }
.dl-hero-photo img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 50% 62%; }
/* The open status, pinned to the photo as a small white label */
.yard-tag {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  gap: 1px;
  padding: 8px 14px 9px;
  background: var(--white);
  line-height: 1.3;
}
.yard-tag-place { font-size: 13.5px; color: var(--grey); }
.yard-tag .status { font-size: 15px; }

/* ---------- zone lookup ---------- */
.dl-zones { padding-top: clamp(48px, 6vw, 88px); }
.zones-head {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 20px var(--gap-wide);
  align-items: start;
}
.zones-intro .lead { max-width: 28em; }

.zone-result {
  min-height: 128px;
  margin-top: 12px;
  padding: 16px 20px 18px;
  background: var(--stone);
}
.zone-result:focus { outline: none; }
.zone-result:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.zr-hint { color: var(--grey); font-size: var(--fs-small); max-width: 36em; }
.zr-title {
  text-wrap: pretty;
  font-family: var(--display);
  font-size: clamp(21px, 1.8vw, 25px);
  line-height: 1.2;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}
.zr-tags { display: inline-flex; gap: 4px; margin-right: 10px; vertical-align: 3px; }
.zr-rate { margin-top: 6px; font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; }
.zr-body { margin-top: 4px; max-width: 40em; color: var(--grey); font-size: var(--fs-small); overflow-wrap: anywhere; }
.zr-body a { color: var(--ink); font-weight: 600; white-space: nowrap; }
.zr-next { margin-top: 10px; font-size: var(--fs-small); }
.zr-next a { font-weight: 600; }
.zr-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Zone tags: the same small square ink tag on the map, in the key, the table and the answer */
.ztag {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  background: var(--ink);
  color: var(--white);
  font: 600 13.5px/1 var(--sans);
  font-variant-numeric: tabular-nums;
}
.ztag.is-on { background: var(--red); }

/* ---------- the diagram ---------- */
.route-map { margin-top: clamp(28px, 3.5vw, 48px); }
.map-box {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  background: var(--water);
}
.map-box:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.route { display: block; width: 100%; min-width: 1000px; height: auto; }
.route-map figcaption { margin-top: 10px; }

.route .land { fill: none; stroke: var(--white); stroke-width: 92; stroke-linecap: round; stroke-linejoin: round; }
.route .island { fill: var(--white); }
.route .water-label { font: italic 400 15px var(--sans); fill: var(--grey); }
.route .road { fill: none; stroke: var(--ink); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.route .ferry { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 0.1 6; }
.route .bound line { stroke: var(--grey); stroke-width: 1.5; stroke-dasharray: 5 4; }
.route .bound text { font: 500 14px var(--sans); fill: var(--grey); }
.route .stop { fill: var(--white); stroke: var(--ink); stroke-width: 2.5; }
.route .stop.end { stroke-width: 3; }
.route .stop-label { font: 500 16px var(--sans); fill: var(--ink); }
.route .stop-label.major { font-weight: 700; }
.route .yard-mark { fill: var(--white); stroke: var(--ink); stroke-width: 3; }
.route .yard-label { font: 700 16px var(--sans); fill: var(--ink); }
.route .island-label { font: 600 16px var(--sans); fill: var(--ink); }
.route text, .route .land, .route .island, .route .stop, .route .yard-mark, .route .ferry, .route .bound line { pointer-events: none; }

/* The selected zone: its stretch of route, its badges and the island in red */
.route .zone-hi { opacity: 0; pointer-events: none; transition: opacity 0.18s ease; }
.route .zone-hi.is-on { opacity: 1; }
.route .hi { fill: none; stroke: var(--red); stroke-width: 8; stroke-linejoin: round; }
.route .hi-cap { fill: var(--red); }
.route .island-hi { fill: none; stroke: var(--red); stroke-width: 3; }
/* A looked-up town: its station (or the zone line it sits on) */
.route .stn.is-town .stop { fill: var(--red); stroke: var(--ink); stroke-width: 2.5; r: 7.5; }
.route .stn.is-town text { font-weight: 700; }
.route .yard.is-town .yard-mark { fill: var(--red); }
.route .bound.is-town line { stroke: var(--ink); stroke-width: 2; stroke-dasharray: none; }
.route .bound.is-town text { fill: var(--ink); font-weight: 700; }

.route .zone-hit { fill: none; stroke: transparent; stroke-width: 26; pointer-events: stroke; cursor: pointer; }
.route .zone-hit.area { fill: transparent; pointer-events: all; }
.route .badge { cursor: pointer; }
.route .badge rect { fill: var(--ink); stroke: var(--white); stroke-width: 2.5; }
.route .badge text { font: 600 13.5px var(--sans); fill: var(--white); text-anchor: middle; dominant-baseline: central; }
.route .badge.is-on rect { fill: var(--red); }

/* The one moment of motion: the routes draw out from the yard, and each station, badge and zone
   line appears as its route reaches it. Only when the diagram starts below the fold. */
.route.pre-draw .road, .route.draw .road { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.route.pre-draw .pop { opacity: 0; }
.route.draw .road { animation: dl-road var(--dur, 1.3s) linear forwards; }
.route.draw .pop { opacity: 0; animation: dl-pop 0.3s ease-out var(--d, 0s) forwards; }
@keyframes dl-road { to { stroke-dashoffset: 0; } }
@keyframes dl-pop { to { opacity: 1; } }

/* ---------- zone key: the map's legend, each zone a toggle chip ---------- */
.zone-key { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.zk {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 14px 6px 8px;
  border: 1.5px solid var(--rule-strong);
  background: var(--white);
  font-size: 15.5px;
  line-height: 1.2;
  cursor: pointer;
}
.zk-name { font-weight: 600; }
.zk-price { color: var(--grey); font-variant-numeric: tabular-nums; }
.zk:hover { border-color: var(--ink); }
.zk[aria-pressed="true"] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.zk[aria-pressed="true"] .ztag { background: var(--red); }
.zk[aria-pressed="true"] .zk-price { color: var(--ink); font-weight: 600; }

/* ---------- rates ---------- */
.rates-intro .lead { max-width: 26em; }
.rates-intro .lead + .lead { margin-top: 14px; }
.rates-intro .actions { gap: 12px 24px; margin-top: 26px; }
.where-short { display: none; }
.rates-table th .ztag { width: 32px; padding: 0; margin-right: 10px; vertical-align: 1px; }
.rates-table tbody th { white-space: nowrap; }
.rates-table .where { color: var(--grey); }
/* Room for the selection bar on every row, so a selected row doesn't jump. The table sits on a
   stone band, so a selected row turns white (the shared style uses stone). */
.rates-table caption, .rates-table tr > :first-child, .rates-table tr.is-hit > :first-child { padding-left: 12px; }
.rates-table tr > :last-child { padding-right: 12px; }
.dl-rates .rates-table tr.is-hit > * { background: var(--white); }
.rates-table tr.is-hit .where { color: var(--ink); }
.rates-table tr.is-hit .ztag { background: var(--red); }
.rates-table .stop-rows th { font-weight: 500; white-space: normal; }
.rates-table .stop-rows tr:first-child > * { padding-top: 22px; }

/* ---------- fleet photos: rows of equal height, every photo uncropped ---------- */
.mosaic { display: grid; gap: 28px; }
.m-row { display: flex; align-items: flex-start; gap: 16px; }
.m-row .photo { flex: var(--a) 1 0; min-width: 0; }
.m-row .photo img { background: var(--stone); }

/* ---------- smaller screens ---------- */
@media (max-width: 1080px) {
  .dl-hero-grid, .zones-head { grid-template-columns: minmax(0, 1fr); }
  .dl-hero-text .lead { padding-top: 14px; }
  .dl-hero-photo img { aspect-ratio: 16 / 9; }
}
@media (max-width: 720px) {
  .dl-hero-photo img { aspect-ratio: 3 / 2; }
  .yard-tag { top: 10px; left: 10px; padding: 6px 10px 7px; }
  .yard-tag-place { font-size: 12.5px; }
  .yard-tag .status { font-size: 14px; }
  .zone-result { min-height: 0; padding: 14px 16px 16px; }
  .zone-key { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zk { width: 100%; gap: 8px; padding-right: 10px; }
  .zk-price { margin-left: auto; }
  .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .m-row { display: contents; }
  .m-row .photo img { aspect-ratio: 4 / 3; object-fit: cover; }
  .m-row:first-child .photo:first-child, .m-row:last-child .photo:last-child { grid-column: 1 / -1; }
  .m-row:first-child .photo:first-child img { aspect-ratio: 16 / 9; }
  .where-long { display: none; }
  .where-short { display: inline; }
}

/* Never leave the diagram half drawn */
@media (prefers-reduced-motion: reduce) {
  .route.pre-draw .road, .route.draw .road { stroke-dashoffset: 0; }
  .route.pre-draw .pop, .route.draw .pop { opacity: 1; }
}
@media print {
  .route.pre-draw .road, .route.draw .road { stroke-dashoffset: 0; animation: none; }
  .route.pre-draw .pop, .route.draw .pop { opacity: 1; animation: none; }
  .map-box { overflow: visible; }
  .route { min-width: 0; }
}
