/* ============================================================
   StratoSense — scene layer

   The animated system demonstrations: the ecosystem, the protocol
   convergence, the Beacon detection scenario, the CAP protection
   scenario, the cloud convergence, the labelled telemetry pipeline,
   route deviation, the security chain.

   Everything here renders inside `.instr` (the dark operational
   scope defined in systems.css) and inherits its tokens.
   ============================================================ */

/* ══════════════ SCENE FRAME ══════════════ */
.scene{position:relative}
.scene svg{display:block;width:100%;height:auto;overflow:visible}

/* A scene that is taller than it is wide on a phone gets its own
   horizontal scroll rather than being squashed into illegibility. */
.scene-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.scene-scroll > svg{min-width:0}

/* ══════════════ NODES ══════════════ */
.sc-n rect,.sc-n circle{
  fill:var(--bg-3);stroke:var(--line-2);stroke-width:1;
  transition:fill .35s var(--ease),stroke .35s var(--ease);
}
.sc-n text{fill:var(--ink);font-family:var(--fm);font-size:9.5px;letter-spacing:.09em;text-transform:uppercase}
.sc-n .sub{fill:var(--ink-3);font-size:8px;letter-spacing:.05em;text-transform:none}
.sc-n.hot rect,.sc-n.hot circle{fill:rgba(255,193,7,.14);stroke:var(--gold)}
.sc-n.hot text{fill:var(--gold)}
.sc-n.ok rect,.sc-n.ok circle{fill:rgba(63,185,132,.14);stroke:var(--ok)}
.sc-n.bad rect,.sc-n.bad circle{fill:rgba(229,86,75,.16);stroke:var(--alarm)}
.sc-n.bad text{fill:var(--alarm)}
.sc-n.dim rect,.sc-n.dim circle{opacity:.45}

/* keyboard / pointer selectable nodes */
.sc-n[tabindex]{cursor:pointer}
.sc-n[tabindex]:focus-visible rect,.sc-n[tabindex]:focus-visible circle{
  stroke:var(--gold);stroke-width:2;
}
.sc-n[tabindex]:focus{outline:none}

/* ══════════════ EDGES ══════════════ */
.sc-e{stroke:var(--line-2);stroke-width:1.2;fill:none;transition:stroke .35s var(--ease)}
.sc-e.hot{stroke:var(--gold);stroke-width:1.7}
.sc-e.cut{stroke:var(--alarm);stroke-dasharray:5 7}
.sc-e.obs{stroke:var(--line-2);stroke-dasharray:3 5;opacity:.7}

/* ══════════════ PACKETS ══════════════ */
.sc-pkt{fill:var(--gold)}
.sc-pkt-lbl rect{fill:rgba(255,193,7,.16);stroke:var(--gold);stroke-width:1}
.sc-pkt-lbl text{fill:var(--gold);font-family:var(--fm);font-size:8px;letter-spacing:.04em}
.sc-pkt-lbl.raw rect{fill:rgba(154,161,169,.14);stroke:var(--ink-3)}
.sc-pkt-lbl.raw text{fill:var(--ink-2)}

/* ══════════════ AIRCRAFT MARKER ══════════════ */
.sc-ac{fill:var(--gold)}
.sc-ac.bad{fill:var(--alarm)}
.sc-ac.ok{fill:var(--ok)}
.sc-halo{fill:none;stroke:var(--gold);stroke-width:1;opacity:.4}
.sc-halo.bad{stroke:var(--alarm)}
.sc-halo.ok{stroke:var(--ok)}

/* ══════════════ ZONES / PATHS ══════════════ */
.sc-zone{fill:rgba(229,86,75,.10);stroke:rgba(229,86,75,.5);stroke-width:1}
.sc-zone.watch{fill:rgba(255,193,7,.08);stroke:rgba(255,193,7,.45)}
.sc-zone.free{fill:rgba(63,185,132,.07);stroke:rgba(63,185,132,.4)}
.sc-zone-lbl{fill:var(--ink-3);font-family:var(--fm);font-size:8.5px;letter-spacing:.11em;text-transform:uppercase}
.sc-plan{stroke:var(--line-2);stroke-width:1.4;fill:none;stroke-dasharray:5 5}
.sc-flown{stroke:var(--gold);stroke-width:2.2;fill:none;stroke-linecap:round}
.sc-flown.bad{stroke:var(--alarm)}
.sc-flown.rtl{stroke:var(--ok)}

/* ══════════════ SCENE READOUT STRIP ══════════════ */
.sc-read{
  display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  padding:13px 20px;border-top:1px solid var(--line);
  font-family:var(--fm);font-size:.74rem;letter-spacing:.06em;
  min-height:46px;
}
.sc-read .dot{width:8px;height:8px;border-radius:50%;background:var(--ink-3);flex:none;transition:background .3s}
.sc-read[data-v="ok"] .dot{background:var(--ok)}
.sc-read[data-v="warn"] .dot{background:var(--warn)}
.sc-read[data-v="bad"] .dot{background:var(--alarm)}
.sc-read[data-v="ok"]{color:var(--ok)}
.sc-read[data-v="warn"]{color:var(--warn)}
.sc-read[data-v="bad"]{color:var(--alarm)}
.sc-read .ctx{color:var(--ink-3);margin-left:auto;letter-spacing:.1em;text-transform:uppercase;font-size:.64rem}

/* ══════════════ STAGE TICKER ══════════════ */
.sc-stages{display:flex;gap:0;border-top:1px solid var(--line);overflow-x:auto;-webkit-overflow-scrolling:touch}
.sc-stage{
  flex:1 0 auto;min-width:0;padding:11px 16px;border-right:1px solid var(--line);
  font-family:var(--fm);font-size:.64rem;letter-spacing:.12em;text-transform:uppercase;
  color:var(--ink-3);white-space:nowrap;position:relative;
  transition:color .3s var(--ease),background .3s var(--ease);
}
.sc-stage:last-child{border-right:0}
.sc-stage.done{color:var(--ok)}
.sc-stage.on{color:var(--gold);background:rgba(255,193,7,.07)}
.sc-stage.on::after{content:"";position:absolute;left:0;bottom:0;height:2px;width:100%;background:var(--gold)}

/* ══════════════ SCENE CONTROLS ══════════════ */
.sc-ctl{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 20px;border-top:1px solid var(--line)}
.sc-ctl .sim-note{margin-left:auto}
.sc-seg{display:inline-flex;border:1px solid var(--line-2);border-radius:999px;overflow:hidden}
.sc-seg button{
  border:0;background:transparent;color:var(--ink-2);font:inherit;font-size:.76rem;font-weight:600;
  padding:8px 15px;cursor:pointer;transition:.2s var(--ease);white-space:nowrap;
}
.sc-seg button + button{border-left:1px solid var(--line-2)}
.sc-seg button[aria-pressed="true"]{background:var(--gold);color:#0B0B0B}
.sc-seg button:focus-visible{outline:2px solid var(--gold);outline-offset:-2px}

/* ══════════════ PROTOCOL CONVERGENCE ══════════════ */
.sc-proto-lbl{fill:var(--ink-2);font-family:var(--fm);font-size:9px;letter-spacing:.08em;text-anchor:end}
.sc-proto-lbl.on{fill:var(--gold)}

/* ══════════════ FLIGHT RECORD TIMELINE ══════════════ */
.tl{list-style:none;margin:0;padding:0;position:relative}
.tl::before{content:"";position:absolute;left:7px;top:10px;bottom:10px;width:1px;background:var(--line-2)}
.tl li{position:relative;padding:8px 0 8px 28px;font-size:.84rem;color:var(--ink-2)}
.tl li::before{
  content:"";position:absolute;left:2px;top:14px;width:11px;height:11px;border-radius:50%;
  background:var(--bg);border:1.5px solid var(--line-2);
}
.tl li.on::before{border-color:var(--gold);background:var(--gold)}
.tl li.warn::before{border-color:var(--warn);background:var(--warn)}
.tl li .t{font-family:var(--fm);font-size:.72rem;color:var(--ink-3);margin-right:10px}
.tl li strong{color:var(--ink);font-weight:600}

/* ══════════════ STALE DATA ══════════════ */
.trust-cell dd.stale{color:var(--alarm)}
.stale-banner{
  display:flex;align-items:center;gap:10px;padding:12px 20px;
  background:rgba(229,86,75,.10);border-top:1px solid rgba(229,86,75,.35);
  color:var(--alarm);font-family:var(--fm);font-size:.7rem;letter-spacing:.12em;text-transform:uppercase;
}
.stale-banner[hidden]{display:none}
.stale-banner .vi{width:8px;height:8px;border-radius:50%;background:currentColor;flex:none}

/* ══════════════ SCROLL STORY ══════════════ */
.story-step{
  border-left:2px solid var(--line,#E2E2E2);padding:4px 0 4px 26px;
  transition:border-color .45s var(--ease);
}
.story-step.on{border-left-color:var(--gold)}
.story-step + .story-step{margin-top:38px}
.story-step .n{
  font-family:var(--fm);font-size:.66rem;letter-spacing:.16em;color:var(--ink-3,#8A8A8A);
  display:block;margin-bottom:9px;transition:color .45s var(--ease);
}
.story-step.on .n{color:var(--gold-2,#E8A317)}

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width:820px){
  .sc-n text{font-size:11px}
  .sc-n .sub{font-size:9px}
  .sc-zone-lbl{font-size:10px}
  .sc-proto-lbl{font-size:10.5px}
}
@media (max-width:560px){
  .sc-read{padding:12px 16px;font-size:.72rem}
  .sc-read .ctx{margin-left:0;width:100%}
  .sc-ctl{padding:12px 16px}
  .sc-ctl .sim-note{margin-left:0;width:100%}
}

@media (prefers-reduced-motion:reduce){
  .sc-pkt,.sc-pkt-lbl{display:none}
  .scene *{transition-duration:.01ms !important;animation-duration:.01ms !important}
}
