/* Route for the first units (js/route.js): stop badges and the start marker on the map, the button in the map controls,
   and the rows of the route card in the "Where to start." chapter. Tokens come from app.css. */

/* A stop on the map. MapLibre positions the element, which is the 40px hit area; the badge is the 28px disc inside it.
   Light fill, dark number and a dark ring keep the number readable over aerial imagery and over the yellow of a unit. */
.rt-stop{display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:50%;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
.rt-stop>span,.rt-n{display:grid;place-items:center;flex:none;border-radius:50%;background:var(--ink);color:var(--ground);font-family:var(--font-sans);font-weight:700;line-height:1;font-variant-numeric:tabular-nums}
.rt-stop>span{width:28px;height:28px;font-size:.875rem;box-shadow:0 0 0 2px var(--ground),0 2px 6px rgba(0,0,0,.5);transition:background-color var(--t-state) var(--ease)}
.rt-stop:hover>span{background:var(--gorse-bright)}
.rt-stop:focus-visible{border-radius:50%;outline-offset:-2px}
/* In the story the badges mark places and the card lists the stops, so route.js sets them inert there. */
.rt-stop[inert]{pointer-events:none;cursor:default}

/* Start: a dark tag with a light ring, the reverse of a stop. The pointer passes through it to the map. */
.rt-start{pointer-events:none}
.rt-start>span{display:block;padding:4px 6px;border-radius:4px;background:var(--ground);color:var(--ink);white-space:nowrap;box-shadow:0 0 0 1.5px var(--ink),0 2px 6px rgba(0,0,0,.5)}

/* Map controls: the route button while the route is on */
#routeBtn[aria-pressed="true"]{background:var(--raised);color:var(--gorse);box-shadow:var(--inner-ring),0 1px 2px rgba(0,0,0,.4)}

/* Route card: a heading line, one row per stop, the totals, the notes. The number disc repeats the badge on the map. */
.rt-head{display:flex;justify-content:space-between;align-items:baseline;gap:var(--s-2);margin-bottom:var(--s-2)}
.rt-head .mono:first-child{color:var(--ink)}
.rt-list{list-style:none;margin:var(--s-1) 0 0;padding:0}
.rt-list li{display:grid;grid-template-columns:22px auto minmax(0,1fr) auto 4.5rem;align-items:center;gap:8px;min-height:34px;box-shadow:inset 0 -1px 0 var(--ring)}
.rt-list li:last-child{box-shadow:none}
.rt-n{width:22px;height:22px;font-size:.75rem}
.rt-list b{font:600 .875rem/1.3 var(--font-sans);font-variant-numeric:tabular-nums;white-space:nowrap}
.rt-tri{display:flex;min-width:0}
.rt-num{font-size:.8125rem;line-height:1.3;color:var(--ink-2);text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.rt-walk{color:var(--ink)}
.rt-tot{display:flex;justify-content:space-between;gap:var(--s-2);margin-top:var(--s-1);padding-top:var(--s-3);box-shadow:inset 0 1px 0 var(--ring)}
.rt-tot b{display:block;font:500 1rem/1.2 var(--font-sans);letter-spacing:-.01em;white-space:nowrap;font-variant-numeric:tabular-nums}
.rt-tot .mono{display:block;margin-top:2px;font-size:.625rem}
.rt-saved{margin-top:var(--s-2);font-size:.8125rem;line-height:1.4;color:var(--ink);font-variant-numeric:tabular-nums}
.rt-plan{font-weight:600;text-wrap:pretty}
.rt-plan+.rt-saved{margin-top:var(--s-1);color:var(--ink-2,var(--ink))}
/* The rows keep their height. If a longer route does not fit the slot, the list scrolls inside the card and the notes stay in view. */
#actionsCard>.rt-list{flex:0 1 auto;min-height:4.5rem;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ink-3) transparent}
/* Short screens. The slot is the viewport minus 220px, and seven stops, the totals, a three-line plan and the notes must
   fit it without a scroll. 800px and less (1280 x 720): the rows close up. 700px and less (1366 x 650): they close up
   further, the gaps above the totals and the notes shrink, and the urgency key goes, because every row prints its class. */
@media (max-height:800px){
  .rt-list li{min-height:30px}
}
@media (max-height:700px){
  .rt-list li{min-height:26px}
  #actionsCard:has(.rt-list) .tri-key{display:none}
  .rt-head{margin-bottom:var(--s-1)}
  .rt-tot{margin-top:0;padding-top:var(--s-2)}
  .rt-saved,#actionsCard:has(.rt-list)>.note{margin-top:var(--s-1)}
}

/* A badge and the start tag scale in when they are added to the map. The inner element moves: MapLibre owns the transform of the marker. */
@keyframes rt-in{from{opacity:0;scale:.8}}
@media (prefers-reduced-motion:no-preference){
  .rt-stop>span,.rt-start>span{animation:rt-in var(--t-state) var(--ease) both}
}

@media (forced-colors:active){
  .rt-stop>span,.rt-n,.rt-start>span{border:1px solid CanvasText}
}

/* Touch screens: the hit area of a stop grows to 44px, like the other controls. The 28px disc stays. */
@media (pointer:coarse){
  .rt-stop{width:44px;height:44px}
}
