/* ==========================================================================
   css/fig-routes.css — figure "routes" (section #routes)
   Six 9:16 clip frames in the Shorts-studio format — status tag, kinetic caption,
   counters and a leader-window readout over the clip — with the route's label,
   name and line set under each frame, so all six titles share one baseline.
   Categories are named, never numbered. No red on a route: nothing is tested yet.
   Scoped to #routes / .fig--routes.
   ========================================================================== */

#routes .id { text-transform: none; letter-spacing: 0; }

/* ---- white ink, glass, floor and frame: the page's own light text and darks ---------------- */
#routes { --wh-rgb: var(--text-rgb); --rt-glass-rgb: 9 9 10; --rt-floor-rgb: 6 6 6; --rt-frame: #080809; }

/* ---- header: title + one-liner left, the card legend right ---------------- */
#routes .routes__head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 48px;
}
#routes .routes__intro { min-width: 0; }
#routes .routes__legend {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px;
}
#routes .routes__legend li {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 10px;
  border-radius: var(--r-sm); background: var(--s1); box-shadow: inset 0 0 0 1px var(--line);
  font: 500 13px/1 var(--f-ui); color: var(--muted-2); white-space: nowrap;
}
#routes .routes__legend .i { width: 14px; height: 14px; color: rgb(var(--wh-rgb) / .82); }
#routes .routes__legend .is-bite .i { color: var(--pink); }
#routes .routes__legend b { font: 700 13px/1 var(--f-mono); color: rgb(var(--wh-rgb)); }

/* ---- colour per category: six clips, six lights of their own (js/fig-routes.js draws with the
        same values). Direct is the accent (our own send); none is the bite colour, none is numbered. */
.fig--routes .route[data-key="direct"] { --c: var(--lime);  --c2: #D2CEC2; }
.fig--routes .route[data-key="rpc"]    { --c: var(--blue);  --c2: var(--ice); }
.fig--routes .route[data-key="swqos"]  { --c: #A996DB;      --c2: var(--ice); }
.fig--routes .route[data-key="sender"] { --c: #8CC7A1;      --c2: var(--ice); }
.fig--routes .route[data-key="ofa"]    { --c: var(--amber); --c2: #EDE3CF; }
.fig--routes .route[data-key="bam"]    { --c: #7FC6D3;      --c2: #D5ECEF; }

/* ---- card = frame (the clip) + copy under it -------------------------------- */
.fig--routes .route {
  --ar: 9 / 16;
  aspect-ratio: auto; overflow: visible; border-radius: 0;
  display: flex; flex-direction: column; gap: 14px;
  container-type: inline-size;
}
.fig--routes .route__frame {
  position: relative; z-index: 1; aspect-ratio: var(--ar);
  border-radius: var(--r-md); overflow: hidden; isolation: isolate; background: var(--rt-frame);
  box-shadow: 0 0 0 1px rgb(var(--wh-rgb) / .05), 0 22px 44px -32px rgba(0, 0, 0, .9);
  transition: transform .7s var(--ease-out);
}
/* a soft floor under the counters and the caption — the clip keeps its light above it */
.fig--routes .route__frame::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%; z-index: 2; pointer-events: none;
  background: linear-gradient(to top, rgb(var(--rt-floor-rgb) / .62), rgb(var(--rt-floor-rgb) / .22) 48%, rgb(var(--rt-floor-rgb) / 0));
}
/* hover halo: a sibling of the frame (the frame clips), shown by opacity only */
.fig--routes .route::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; z-index: 0; aspect-ratio: var(--ar);
  border-radius: var(--r-md); pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent), 0 30px 60px -26px color-mix(in srgb, var(--c) 46%, transparent);
  transition: opacity .5s ease, transform .7s var(--ease-out);
}

/* status — Inter, sentence case, accent dot (base .tag--queued gives the dot) */
.fig--routes .route__tag { top: 10px; left: 10px; z-index: 8; }
.fig--routes .tag--queued {
  height: 24px; padding: 0 9px 0 8px; gap: 7px; border-radius: 6px;
  background: rgb(var(--rt-glass-rgb) / .66); box-shadow: inset 0 0 0 1px rgb(var(--wh-rgb) / .14);
  font: 600 12px/1 var(--f-ui); letter-spacing: 0; text-transform: none; color: rgb(var(--wh-rgb));
}

/* kinetic caption, word by word, in the lower third of the shot */
.fig--routes .route__cap {
  position: absolute; left: 10px; right: 10px; bottom: 21%; z-index: 4; margin: 0;
  text-align: center; pointer-events: none;
  font: 600 clamp(17px, 9cqi, 26px)/1.05 var(--f-ui); letter-spacing: -0.03em; color: rgb(var(--wh-rgb) / .94);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 0 14px rgba(0, 0, 0, .55), 0 0 28px color-mix(in srgb, var(--c) 30%, transparent);
}
.fig--routes .route__cap span {
  display: inline-block; opacity: 0; transform: translateY(.42em) scale(.86); filter: blur(4px);
  transition: opacity .2s ease, transform .2s ease, filter .2s ease;
}
.fig--routes .route__cap span:nth-child(2) { --i: 1; }
.fig--routes .route__cap span:nth-child(3) { --i: 2; }
.fig--routes .route__cap.is-on span {
  opacity: 1; transform: none; filter: none;
  transition: opacity .45s ease calc(var(--i, 0) * 110ms), transform .6s var(--ease-back) calc(var(--i, 0) * 110ms), filter .45s ease calc(var(--i, 0) * 110ms);
}

/* counters — eye/heart pills; the pilot hasn't run, so they read "—" */
.fig--routes .route__stats {
  position: absolute; left: 10px; bottom: 10px; z-index: 5; margin: 0;
  display: flex; flex-wrap: nowrap; gap: 6px;
}
.fig--routes .stat {
  height: 26px; padding: 0 9px 0 8px; gap: 6px; border-radius: 7px;
  background: rgb(var(--rt-glass-rgb) / .64); box-shadow: inset 0 0 0 1px rgb(var(--wh-rgb) / .12);
  font: 600 12px/1 var(--f-ui); color: rgb(var(--wh-rgb) / .88);
}
.fig--routes .stat .i { width: 13px; height: 13px; color: rgb(var(--wh-rgb) / .8); }
.fig--routes .stat--bite .i { color: var(--pink); }
.fig--routes .stat__k { font: 600 12px/1 var(--f-ui); color: rgb(var(--wh-rgb) / .68); }
.fig--routes .stat b { font: 700 12px/1 var(--f-mono); color: rgb(var(--wh-rgb)); }

/* leader-window readout — four slots S … S+3; one lights as each canary lands (JS) */
.fig--routes .route__win {
  position: absolute; right: 10px; bottom: 10px; z-index: 5;
  display: grid; justify-items: start; gap: 6px; padding: 7px 9px;
  border-radius: 8px; background: rgb(var(--rt-glass-rgb) / .66); box-shadow: inset 0 0 0 1px rgb(var(--wh-rgb) / .14);
  font: 600 12px/1 var(--f-ui); color: rgb(var(--wh-rgb) / .74); white-space: nowrap;
}
.fig--routes .route__pips { display: flex; gap: 4px; font-size: 12px; }
.fig--routes .route__pips i {
  display: block; width: 10px; height: 12px; border-radius: 2px;
  background: rgb(var(--wh-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--wh-rgb) / .2);
  transition: background-color .35s ease, box-shadow .35s ease, opacity .35s ease, transform .5s var(--ease-back);
}
.fig--routes .route__pips i.is-wait {
  background: rgb(var(--wh-rgb) / .3); box-shadow: inset 0 0 0 1px rgb(var(--wh-rgb) / .62);
  animation: routes-wait .9s ease-in-out infinite alternate;
}
.fig--routes .route__pips i.is-done { background: rgb(var(--lime-rgb) / .46); box-shadow: inset 0 0 0 1px rgb(var(--lime-rgb) / .62); }
.fig--routes .route__pips i.is-hit {
  background: var(--lime); box-shadow: 0 0 0 1px var(--lime), 0 0 10px rgb(var(--lime-rgb) / .7);
  transform: scale(1.14);
}
@keyframes routes-wait { from { opacity: .4; } to { opacity: 1; } }

/* copy under the frame: label + hairline, name, line */
.fig--routes .route__copy { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 0 1px; }
.fig--routes .route__alt {
  order: -1; display: flex; align-items: center; gap: 8px; margin: 0 0 1px;
  font: 600 12px/1.2 var(--f-ui); letter-spacing: 0; text-transform: none; color: rgb(var(--wh-rgb) / .66);
}
.fig--routes .route__alt::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 70%, transparent);
}
.fig--routes .route__alt::after {
  content: ""; flex: 1; height: 1px; min-width: 12px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 46%, transparent), transparent 88%);
  opacity: .7; transition: opacity .5s ease;
}
.fig--routes .route__name {
  font: 700 clamp(16px, 9.2cqi, 22px)/1 var(--f-display); letter-spacing: -0.025em; text-transform: uppercase; color: rgb(var(--wh-rgb));
}
.fig--routes .route__line { font-size: 14px; line-height: 1.45; color: rgb(var(--wh-rgb) / .68); }
.fig--routes .route__line code { font-size: .9em; color: rgb(var(--wh-rgb)); }

/* the Direct card's fine print: an accent marker on the card, the caveat set under the row */
.fig--routes .route__mark { margin-left: 2px; font-weight: 700; color: var(--lime); }
#routes .routes__note {
  display: flex; align-items: baseline; gap: 8px; max-width: 920px; margin: 30px 0 0; padding-inline: 1px;
  font: 400 13px/1.55 var(--f-ui); color: var(--muted-2); text-wrap: pretty;
}
#routes .routes__note-mark { flex: none; font-weight: 700; color: var(--lime); }
#routes .routes__note b { font-weight: 600; color: rgb(var(--wh-rgb)); }

/* hover (fine pointers): the frame lifts, the halo comes up in the route's light, the clip runs ×2 (JS) */
@media (hover: hover) and (pointer: fine) {
  .fig--routes .route:hover .route__frame,
  .fig--routes .route:hover::before { transform: translate3d(0, -4px, 0); }
  .fig--routes .route:hover::before { opacity: 1; }
  .fig--routes .route:hover .route__alt::after { opacity: 1; }
  .fig--routes .route:hover .tag--queued::before { animation: routes-blink .8s steps(1) infinite; }
}
@keyframes routes-blink { 50% { opacity: .2; } }

/* narrow cards: icons carry the counters (the legend names them); the readout steps aside under 205 px */
@container (max-width: 299.98px) {
  .fig--routes .stat__k {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
}
@container (max-width: 204.98px) {
  .fig--routes .route__win { display: none; }
}
@container (max-width: 200px) {
  .fig--routes .route__line { font-size: 13.5px; }
}

/* tablet: 3 × 2, a little shorter, more air between the rows for the copy */
@media (min-width: 768px) and (max-width: 1199px) {
  .fig--routes .routes__grid { row-gap: 36px; }
  .fig--routes .route { --ar: 9 / 14; }
}

/* pager — phones only */
.fig--routes .routes__pager { display: none; }

@media (max-width: 767px) {
  #routes .routes__head { gap: 14px; }
  #routes .routes__legend li { height: 30px; }
  #routes .routes__note { margin-top: 18px; }
  .fig--routes .route { --ar: 9 / 16; }
  .fig--routes .route__line { font-size: 15px; }
  .fig--routes .routes__grid { padding-top: 6px; }
  .fig--routes .routes__grid:focus-visible { outline-offset: -2px; }
  .fig--routes .routes__pager {
    display: flex; align-items: center; gap: 12px;
    padding: 14px var(--gutter) 0;
  }
  .fig--routes .routes__bars { display: flex; gap: 5px; }
  .fig--routes .routes__bars i {
    display: block; width: 12px; height: 3px; border-radius: 2px; background: rgb(var(--wh-rgb) / .18);
    transition: width .5s var(--ease-out), background-color .3s ease, box-shadow .3s ease;
  }
  .fig--routes .routes__bars i.is-on { width: 28px; background: var(--lime); box-shadow: 0 0 8px rgb(var(--lime-rgb) / .6); }
  .fig--routes .routes__hint { margin-right: auto; font: 600 12px/1 var(--f-ui); color: var(--muted-2); }
  .fig--routes .routes__btns { display: flex; gap: 8px; }
  .fig--routes .routes__btn {
    display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-btn);
    background: rgb(var(--wh-rgb) / .05); box-shadow: inset 0 0 0 1px var(--line-2); color: rgb(var(--wh-rgb));
    -webkit-tap-highlight-color: transparent; transition: opacity .25s ease, background-color .25s ease;
  }
  .fig--routes .routes__btn .i { width: 16px; height: 16px; }
  .fig--routes .routes__btn:active { background: rgb(var(--wh-rgb) / .12); }
  .fig--routes .routes__btn[aria-disabled="true"] { opacity: .32; }
}

/* reduced motion: composed final states — captions, readout and copy are simply there */
.fig--routes.is-still .route__cap.is-on span { transition: none; }
.fig--routes.is-still .route__pips i { transition: none; animation: none; }
