/* The Lightning card (/shared/lightning-card.js). Scoped under .lc; the page supplies the panel around it.
   Colours alias the site tokens in /shared/styles.css (DESIGN.md) where one exists; skirt, "good" green and the mono
   stack come from landing.css's :root, with the same values as fallbacks for a page that doesn't load it. */
.lc{--lc-ink:var(--gray-900,#141d24);--lc-muted:var(--gray-500,#576875);--lc-line:var(--gray-200,#dee4e8);
  --lc-accent:var(--brand-blue,#009de0);--lc-card:#ffffff;--lc-skirt:var(--skirt,#d9e0e5);--lc-good:var(--q-good,#2ca02c);
  --lc-mono:var(--mono,"JetBrains Mono",ui-monospace,Menlo,monospace)}
.lc .meta{display:flex;justify-content:space-between;font-family:var(--lc-mono);font-size:12px;letter-spacing:.06em;
  color:var(--lc-muted);text-transform:uppercase;margin-bottom:56px;gap:12px}
.lc .rail{position:relative;height:150px;margin:0 6px}
.lc .rail .track{position:absolute;left:0;right:0;top:64px;height:4px;border-radius:2px;background:var(--lc-line)}
/* --lc-p (0..1) is the replay's progress, set by the script; unset = the finished card */
.lc .rail .fill{position:absolute;left:0;top:64px;height:4px;border-radius:2px;background:var(--lc-accent);width:calc(var(--lc-p,1) * 100%)}
.lc .rail .seg{position:absolute;top:60px;height:12px;border-radius:6px;background:var(--lc-ink)}
.lc .rail .st{position:absolute;top:0;width:0}
.lc .rail .st .lab{position:absolute;top:30px;white-space:nowrap;font-family:var(--lc-mono);font-size:11px;letter-spacing:.08em;
  text-transform:uppercase;color:var(--lc-muted)}
.lc .rail .st .res{position:absolute;top:84px;white-space:nowrap;font-family:var(--lc-mono);font-size:15px;font-weight:500}
.lc .rail .st .res small{display:block;font-size:11.5px;font-weight:400;color:var(--lc-muted);margin-top:2px}
.lc .rail .st .dot{position:absolute;top:58px;left:-8px;width:16px;height:16px;border-radius:50%;background:var(--lc-card);
  box-shadow:inset 0 0 0 3px var(--lc-ink)}
.lc .rail .st.r .lab,.lc .rail .st.r .res{right:0;text-align:right}
.lc .rail .st.c .lab,.lc .rail .st.c .res{transform:translateX(-50%);text-align:center}
.lc .ping{display:block;width:100%;height:46px;margin-top:22px}
.lc .ping .line{stroke:var(--lc-ink)}
.lc .ping .area{fill:var(--lc-ink);fill-opacity:.06}
.lc .ping-cap{font-family:var(--lc-mono);font-size:11px;color:var(--lc-muted);letter-spacing:.06em;text-transform:uppercase;margin:4px 6px 0}
/* The "good for" chips in equal-width columns (owner, card I): as many 240px+ columns as fit, never more than three
   (the max() floor is a third of the row), one on a narrow phone. The same grid on the landing and the result. Each
   chip's value sits at its right edge (the columns line up), and drops under the label, still right, when it can't fit. */
.lc .answers{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,max(240px,calc((100% - 28px) / 3))),1fr));
  gap:12px 14px;margin-top:34px}
.lc .ans{display:flex;flex-wrap:wrap;align-items:center;gap:2px 10px;min-width:0;background:var(--lc-card);border-radius:12px;padding:10px 14px 10px 12px;
  box-shadow:inset 0 1px 0 #fff,0 3px 0 0 var(--lc-skirt),0 4px 5px rgba(20,29,36,.10)}
.lc .ans .tk{width:22px;height:22px;border-radius:50%;background:var(--lc-good);display:flex;align-items:center;justify-content:center;flex:none}
.lc .ans .tk path{stroke:var(--lc-card)}
.lc .ans b{font-weight:600;font-size:17px;min-width:0}
.lc .ans span{font-family:var(--lc-mono);font-size:13px;color:var(--lc-muted)}
.lc .ans b+span{margin-left:auto;white-space:nowrap}

/* phone: the rail turns vertical, stops stack, the fill grows downwards */
@media (max-width:640px){
  .lc .meta{flex-direction:column;margin-bottom:22px}
  .lc .rail{height:auto;margin:0;padding-left:30px}
  .lc .rail .track{left:7px;right:auto;top:0;bottom:0;width:4px;height:auto}
  .lc .rail .fill{left:7px;top:0;width:4px;height:calc(var(--lc-p,1) * 100%)}
  .lc .rail .seg{display:none}
  .lc .rail .st{position:relative;left:auto!important;width:auto;padding:10px 0 14px}
  .lc .rail .st .lab,.lc .rail .st .res,.lc .rail .st.r .lab,.lc .rail .st.r .res,.lc .rail .st.c .lab,.lc .rail .st.c .res{position:static;transform:none;text-align:left;display:block}
  .lc .rail .st .dot{left:-31px;top:14px}
  .lc .ping{display:none}.lc .ping-cap{display:none}
}

/* ---- live + static (/quick/'s run and result, /quick/r/): EQUAL-WIDTH stops, each a column holding its label, ring,
   value (or, while it runs, the live number), a sub-line and its own slice of the ping trace. Set by the script at the
   driver's 4 Hz tick: --n (stop count), --lc-at (0..1, the rail between the first and last ring), --f (a ring's fill),
   data-status / data-phase / data-live. The transitions below do the motion between ticks. */
.lc{--lc-dl:var(--brand-blue-strong,#0077aa);--lc-ul:var(--gray-900,#141d24);--lc-idle:var(--gray-400,#627584);
  --lc-warn:var(--orange,#f97316)}
.lc-live .meta,.lc-static .meta{margin-bottom:18px}
/* min-height: room for the active stop's big number, so the card doesn't grow when it appears (the traces sit at the
   columns' feet) */
.lc .lr{list-style:none;margin:0;padding:0;display:flex;position:relative}
.lc-live .lr{min-height:166px}
.lc-final .lr{min-height:0}
.lc .lr::before,.lc .lr::after{content:"";position:absolute;top:31px;height:4px;border-radius:2px;left:calc(50% / var(--n,1))}
.lc .lr::before{right:calc(50% / var(--n,1));background:var(--lc-line)}
.lc .lr::after{background:var(--lc-accent);width:calc((100% - 100% / var(--n,1)) * var(--lc-at,0));transition:width .25s linear}
.lc .ls{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;text-align:center;position:relative;
  z-index:1;padding:0 4px}
.lc .ls .lab{height:16px;white-space:nowrap;font-family:var(--lc-mono);font-size:11px;letter-spacing:.08em;
  text-transform:uppercase;color:var(--lc-muted)}
.lc .ls[data-status=active] .lab{color:var(--lc-ink);font-weight:600}
.lc .ls .dot{margin-top:6px;width:22px;height:22px;border-radius:50%;flex:none;background:
  radial-gradient(closest-side,var(--lc-card) 60%,transparent 64%),
  conic-gradient(var(--lc-accent) calc(var(--f,0) * 360deg),var(--lc-line) 0)}
.lc .ls[data-status=done] .dot{background:radial-gradient(closest-side,var(--lc-accent) 32%,var(--lc-card) 36%,
  var(--lc-card) 60%,transparent 64%),var(--lc-accent)}
.lc .ls[data-status=skipped] .dot{display:flex;align-items:center;justify-content:center;
  background:radial-gradient(closest-side,var(--lc-card) 60%,transparent 64%),var(--lc-warn)}
.lc .ls[data-status=skipped] .dot::after{content:"\2715";color:#c2410c;font:800 10px/1 sans-serif}
.lc .ls .val{margin-top:12px;font-family:var(--lc-mono);font-size:14px;font-weight:500;color:var(--lc-ink);
  font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.lc .ls .val:empty{display:none}
.lc .ls .big{margin-top:10px;font:700 30px/1.05 Inter,-apple-system,sans-serif;letter-spacing:-.02em;color:var(--lc-ink);
  font-variant-numeric:tabular-nums;white-space:nowrap}
.lc .ls .big small{font-size:13px;font-weight:600;letter-spacing:0;color:var(--lc-muted);margin-left:4px}
.lc .ls[data-live="0"] .big{display:none}
.lc .ls .sub{margin-top:3px;font-size:11.5px;line-height:1.3;color:var(--lc-muted)}
.lc .ls[data-status=skipped] .sub{color:#9a3412;font-weight:600}
.lc .ls[data-status=active][data-phase=download] .sub{color:var(--lc-dl);font-weight:600}
.lc .ls[data-status=active][data-phase=upload] .sub{color:var(--lc-ul);font-weight:600}
/* each stop's trace: its own column of the ping line, so it lines up under its stop; phase colours */
.lc .ls .pg{display:block;width:100%;height:44px;margin-top:auto;padding-top:16px;overflow:visible}
.lc .pg .ph-idle,.lc .pg .ph-tail{stroke:var(--lc-idle)}
.lc .pg .ph-download{stroke:var(--lc-dl)}
.lc .pg .ph-upload{stroke:var(--lc-ul)}
.lc.no-pings .pg,.lc.no-pings .ping-cap{display:none}
.lc-live .ping-cap,.lc-static .ping-cap{margin:6px 4px 0}
.lc-live .answers,.lc-static .answers{margin-top:24px}
.lc .answers:empty{display:none}
/* the "good for" chips: the landing's ✓ chip, its badge coloured by the verdict */
.lc .ans.st-ok .tk{background:var(--lc-good)}
.lc .ans.st-limited .tk{background:var(--amber,#f59e0b)}
.lc .ans.st-limited .tk path{stroke:var(--lc-ink)} /* a white "!" on amber is ~2:1; ink clears 3:1 easily */
.lc .ans.st-poor .tk{background:var(--red,#ef4444)}
.lc-live .ans{transition:transform .35s cubic-bezier(.3,1.6,.5,1),opacity .2s}
.lc-live .ans.pre{opacity:0;transform:translateY(8px)}
.lc-static .lr::after{transition:none}
@media (prefers-reduced-motion:reduce){
  .lc .lr::after,.lc-live .ans{transition:none}
}

/* phone: one row per stop (ring, then label + value, the stop's trace on the right); a connector runs ring to ring */
@media (max-width:640px){
  .lc-live .meta,.lc-static .meta{flex-direction:row;margin-bottom:14px}
  .lc-live .ping-cap,.lc-static .ping-cap{display:block}
  .lc .lr{flex-direction:column;min-height:0}
  .lc .lr::before,.lc .lr::after{display:none}
  .lc .ls{display:grid;grid-template-columns:22px minmax(0,1fr) minmax(0,40%);column-gap:12px;align-items:start;
    text-align:left;padding:6px 0 14px}
  .lc .ls>*{grid-column:2}
  .lc .ls .lab{height:auto}
  .lc .ls .dot{grid-column:1;grid-row:1 / span 4;margin:0}
  .lc .ls .val,.lc .ls .big{margin-top:2px}
  .lc .ls .pg{grid-column:3;grid-row:1 / span 4;height:36px;margin:0;padding:0;align-self:center}
  /* no ping line (static, or the run is over): no column kept for it */
  .lc-static .ls,.lc-final .ls{grid-template-columns:22px minmax(0,1fr)}
  .lc .ls:not(:last-child)::before{content:"";position:absolute;left:9px;top:28px;bottom:-6px;width:4px;border-radius:2px;
    background:var(--lc-line)}
  .lc .ls[data-status=done]:not(:last-child)::before,.lc .ls[data-status=skipped]:not(:last-child)::before{background:var(--lc-accent)}
}
