/* ═══════════════════════════════════════════════════════════════
   FLIGHT ENVELOPE — envoy cockpit deck (sidepage of orbit-station)

   The narrative is a FIXED cockpit deck, NOT stacked scroll-plates:
   #launch-scroll holds only invisible spacers that fly the rocket,
   while #flight-deck modules cross-fade per flight phase (driven by
   window.__envoyFlightT).  Content lives in EDGE BAYS that frame the
   centred rocket — a statement bay (lower-left) and an instrument
   bay (right) — so it never collides with the HUD or the scene.
   Strict monochrome: the only colour is the live scene through the
   glass.  Lexend 180 hairline, pushed hard.  Loads after
   station-surfaces.css.
   ═══════════════════════════════════════════════════════════════ */

/* invisible scroll-length — drives the rocket, shows nothing */
.flight-spacer { width: 100%; pointer-events: none; }

/* ── the fixed cockpit deck ── */
.flight-deck { position: absolute; inset: 0; z-index: 1; pointer-events: none; color: #fff;
  opacity: 0; transition: opacity .8s var(--ease-out) .3s;
  --dx: clamp(40px, 5vw, 96px); --dtop: clamp(96px, 11vh, 132px); --dbot: clamp(108px, 13vh, 156px); }
.envoy-launch.flying .flight-deck { opacity: 1; }

.deck-mod { position: absolute; inset: var(--dtop) var(--dx) var(--dbot); display: flex; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity .5s var(--ease-out), visibility 0s linear .5s; }
.deck-mod.active { opacity: 1; visibility: visible; transition: opacity .6s var(--ease-out); }

/* ── plate: a centred / edge-aligned content column inside the safe zone.
   Vertically centred in the viewport band, so it is never clipped by the
   HUD (the decouple fix) — content lives here, NOT in the scroll. ── */
.fp { display: flex; flex-direction: column; gap: 22px; width: 100%; max-width: 920px; }
.fp.al-left { align-items: flex-start; text-align: left; margin-right: auto;
  margin-left: clamp(78px, 7vw, 134px); transform-origin: left center; }
.fp.al-right { align-items: flex-end; text-align: right; margin-left: auto; transform-origin: right center; }
.fp.al-center { align-items: center; text-align: center; margin: 0 auto; max-width: 1000px; transform-origin: center center; }
.fp > * { pointer-events: none; }
.fp .fp-arm, .fp .fp-cta, .fp .fp-switch { pointer-events: auto; }

/* eyebrow */
.fp-tag { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--60); mix-blend-mode: exclusion; }
.fp-tag::before { content: ""; width: 34px; height: 1px; background: currentColor; opacity: .7; }
.fp.al-right .fp-tag { flex-direction: row-reverse; }
.fp-tag b { color: #fff; font-weight: 400; }

/* statement */
.fp-h { margin: 0; font-family: var(--f-sans); font-weight: 180; line-height: .98; letter-spacing: -2px;
  color: #fff; mix-blend-mode: exclusion; font-size: clamp(40px, 5.6vw, 92px); text-wrap: balance; }
.fp-h.big { font-size: clamp(52px, 8vw, 124px); letter-spacing: -3.5px; }

/* support */
.fp-sub { margin: 0; max-width: 560px; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.6;
  color: rgba(255,255,255,.74); font-weight: 200; }
.fp.al-right .fp-sub { margin-left: auto; }
.fp-sub b { color: #fff; font-weight: 300; }

/* word cascade (JS wraps .fp-h[data-type] words → .w spans) */
.fp-h .w { display: inline-block; opacity: 0; transform: translateY(.5em);
  transition: opacity .6s var(--ease-out), transform .75s var(--ease-out); }
.deck-mod.active .fp-h .w { opacity: 1; transform: none; }

/* staged reveal of non-headline pieces on module activation */
.fp .fp-tag, .fp .fp-sub, .fp .fp-arm, .fp .fp-cta, .fp .fp-nodes, .fp .fp-disc, .fp .fp-stat, .fp .fp-cred {
  opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease-out), transform .7s var(--ease-out); }
.deck-mod.active .fp .fp-tag { transition-delay: 0s; }
.deck-mod.active .fp .fp-sub { transition-delay: .16s; }
.deck-mod.active .fp .fp-arm, .deck-mod.active .fp .fp-cta { transition-delay: .30s; }
.deck-mod.active .fp .fp-nodes, .deck-mod.active .fp .fp-disc, .deck-mod.active .fp .fp-stat, .deck-mod.active .fp .fp-cred { transition-delay: .12s; }
.deck-mod.active .fp .fp-tag, .deck-mod.active .fp .fp-sub, .deck-mod.active .fp .fp-arm, .deck-mod.active .fp .fp-cta,
.deck-mod.active .fp .fp-nodes, .deck-mod.active .fp .fp-disc, .deck-mod.active .fp .fp-stat, .deck-mod.active .fp .fp-cred { opacity: 1; transform: none; }

/* ECOSYSTEM — product cards */
.fp-nodes { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; max-width: 820px;
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; background: var(--10); border: 1px solid var(--10); }
.fp-node { background: rgba(0,0,0,.4); backdrop-filter: blur(7px); padding: 18px 18px 20px; text-align: left;
  display: flex; flex-direction: column; gap: 11px; transition: background var(--dur-base) var(--ease-out); }
.fp-node:hover { background: rgba(0,0,0,.16); }
.fp-node .top { display: flex; align-items: center; justify-content: space-between; }
.fp-node [data-orbit] { width: 20px; height: 20px; color: #fff; }
.fp-node .stat { font-family: var(--f-mono); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--40);
  display: inline-flex; align-items: center; gap: 6px; }
.fp-node .stat.on { color: var(--60); }
.fp-node .stat.on::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; }
.fp-node .nm { font-size: 17px; font-weight: 200; color: #fff; }
.fp-node .ds { font-size: 12px; line-height: 1.45; color: var(--60); }

/* DISCIPLINES — 2-col cards */
.fp-disc { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; max-width: 720px;
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; background: var(--10); border: 1px solid var(--10); }
.fp.al-right .fp-disc { margin-left: auto; }
.fp-disc li { background: rgba(0,0,0,.4); backdrop-filter: blur(7px); padding: 22px; display: flex; flex-direction: column; gap: 9px; text-align: left; }
.fp-disc .h { display: flex; align-items: baseline; gap: 12px; }
.fp-disc .ix { font-family: var(--f-mono); font-size: 11px; color: var(--40); letter-spacing: 1px; }
.fp-disc .nm { font-size: 19px; font-weight: 200; color: #fff; }
.fp-disc .ds { font-size: 12.5px; line-height: 1.5; color: var(--60); }
.fp-disc .mt { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--40); }

/* STAT — giant commission number */
.fp-stat { display: inline-flex; align-items: flex-start; font-family: var(--f-sans); font-weight: 180;
  line-height: .82; letter-spacing: -6px; color: #fff; mix-blend-mode: exclusion;
  font-size: clamp(140px, 22vw, 320px); font-variant-numeric: tabular-nums; }
.fp-stat .unit { font-size: .34em; font-weight: 200; margin-top: .14em; letter-spacing: -2px; }

/* ── tactile arm switch + gated readout (bidirectional-safe UI) ── */
.fp-arm { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 540px; }
.fp-switch { display: inline-flex; align-items: center; gap: 16px; cursor: pointer; user-select: none; pointer-events: auto;
  background: rgba(0,0,0,.42); backdrop-filter: blur(8px); border: 1px solid var(--20);
  padding: 13px 18px; align-self: flex-start; transition: border-color var(--dur-base) var(--ease-out); }
.fp-switch:hover { border-color: var(--40); }
.fp-switch .tgl { position: relative; width: 46px; height: 22px; border: 1px solid var(--40); border-radius: 2px; flex: none; }
.fp-switch .tgl::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 16px;
  background: var(--60); transition: transform .32s var(--ease-out), background .32s var(--ease-out); }
.fp-switch .lbl { font-family: var(--f-mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--60); }
.fp-switch[aria-pressed="true"] .tgl { border-color: #fff; }
.fp-switch[aria-pressed="true"] .tgl::after { transform: translateX(22px); background: #fff; box-shadow: 0 0 10px #fff; }
.fp-switch[aria-pressed="true"] .lbl { color: #fff; }
.fp-switch .lbl .on { display: none; }
.fp-switch[aria-pressed="true"] .lbl .off { display: none; }
.fp-switch[aria-pressed="true"] .lbl .on { display: inline; }
.fp-payout { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--10); border: 1px solid var(--10);
  max-height: 0; opacity: 0; overflow: hidden; transition: max-height .5s var(--ease-out), opacity .5s var(--ease-out); }
.fp-arm.armed .fp-payout { max-height: 320px; opacity: 1; }
.fp-payout .row { background: rgba(0,0,0,.4); backdrop-filter: blur(8px); padding: 13px 18px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.fp-payout .row .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--60); }
.fp-payout .row .v { font-size: 14px; color: #fff; font-weight: 200; }

.fp-cta { margin-top: 4px; pointer-events: auto; }

/* ── DOCK credential — the Envoy boarding pass ── */
.fp-cred { width: min(36vw, 520px); background: rgba(0,0,0,.5); backdrop-filter: blur(12px);
  border: 1px solid var(--20); display: flex; flex-direction: column; text-align: left; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.fp-cred .cred-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 22px;
  border-bottom: 1px solid var(--10); font-family: var(--f-mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; }
.fp-cred .cred-head .prog { color: #fff; display: inline-flex; align-items: center; gap: 9px; }
.fp-cred .cred-head .prog [data-orbit] { width: 15px; height: 15px; }
.fp-cred .cred-head .ser { color: var(--60); }
.fp-cred .cred-body { display: flex; gap: 20px; align-items: center; padding: 24px 22px; }
.fp-cred .cred-port { width: 74px; height: 90px; flex: none; overflow: hidden; border: 1px solid var(--20);
  background: var(--5); filter: grayscale(1) contrast(1.05); }
.fp-cred .cred-port img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.fp-cred .cred-id { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.fp-cred .cred-id .role { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--60); }
.fp-cred .cred-id .nm { font-size: clamp(30px, 3.4vw, 46px); font-weight: 180; color: #fff; line-height: .92; letter-spacing: -1.5px; }
.fp-cred .cred-id .sig { font-family: var(--f-mono); font-size: 10px; color: var(--40); letter-spacing: .5px; }
.fp-cred .cred-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--10);
  border-top: 1px solid var(--10); border-bottom: 1px solid var(--10); }
.fp-cred .cred-grid > div { background: rgba(0,0,0,.34); padding: 13px 15px; display: flex; flex-direction: column; gap: 5px; }
.fp-cred .cred-grid .k { font-family: var(--f-mono); font-size: 8.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--40); }
.fp-cred .cred-grid .d { font-size: 12.5px; color: #fff; font-weight: 200; }
.fp-cred .cred-grid .d.ok { display: inline-flex; align-items: center; gap: 6px; }
.fp-cred .cred-grid .d.ok::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 7px #fff; }
.fp-cred .cred-strip { display: flex; align-items: center; gap: 16px; padding: 14px 22px; }
.fp-cred .cred-strip .code { font-family: var(--f-mono); font-size: 10px; letter-spacing: 2px; color: var(--60); white-space: nowrap; }
.fp-cred .cred-strip .bars { flex: 1; height: 26px; opacity: .5;
  background-image: repeating-linear-gradient(90deg, #fff 0 1px, transparent 1px 3px, #fff 3px 5px, transparent 5px 6px, #fff 6px 9px, transparent 9px 11px, #fff 11px 12px, transparent 12px 15px); }

/* ═══════════════════ persistent HUD frame ═══════════════════ */
.flight-hud { position: absolute; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0; transition: opacity 1s var(--ease-out) .3s; font-family: var(--f-mono); color: #fff; }
.envoy-launch.flying .flight-hud { opacity: 1; }

.hud-top { position: absolute; top: clamp(22px, 2.6vw, 40px); left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(40px, 5vw, 96px); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; }
.hud-top .desig { color: var(--60); display: inline-flex; align-items: center; gap: 12px; }
.hud-top .desig [data-orbit] { width: 15px; height: 15px; color: #fff; }
.hud-top .phase { color: #fff; display: inline-flex; align-items: center; gap: 10px; }
.hud-top .phase::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 8px #fff; animation: hud-pulse 2.4s var(--ease-out) infinite; }
@keyframes hud-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.hud-ribbon { position: absolute; left: clamp(40px, 5vw, 96px); top: 22%; bottom: 18%; width: 2px; display: flex; }
.hud-ribbon .track { position: relative; width: 1px; height: 100%; background: var(--10); margin: 0 auto; }
.hud-ribbon .fill { position: absolute; left: 0; bottom: 0; width: 1px; height: 0%; background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.7); }
.hud-ribbon .pip { position: absolute; left: 50%; transform: translateX(-50%); width: 7px; height: 1px; background: var(--20); }
.hud-ribbon .pip.hot { background: #fff; width: 11px; }
.hud-ribbon .pip span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 8.5px; letter-spacing: 1.5px; color: var(--40); white-space: nowrap; }
.hud-ribbon .pip.hot span { color: #fff; }

.hud-tele { position: absolute; left: 0; right: 0; bottom: clamp(22px, 2.6vw, 40px);
  display: flex; gap: clamp(26px, 4vw, 64px); justify-content: center; padding: 0 clamp(40px, 5vw, 96px); }
.hud-tele .cell { display: flex; flex-direction: column; gap: 5px; min-width: 76px; }
.hud-tele .k { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--40); }
.hud-tele .val { display: inline-flex; align-items: baseline; gap: 4px; }
.hud-tele .v { font-size: clamp(18px, 2vw, 26px); font-weight: 200; color: #fff; font-variant-numeric: tabular-nums;
  font-family: var(--f-sans); letter-spacing: -.5px; }
.hud-tele .u { font-size: 10px; color: var(--40); letter-spacing: .5px; }

/* ── responsive: stack bays so they never cross the centre on narrow panes ── */
@media (max-width: 1000px) {
  .fp { max-width: 100%; }
  .fp.al-left { margin-left: 0; }
  .fp-nodes { grid-template-columns: 1fr 1fr; }
  .fp-disc { grid-template-columns: 1fr; }
  .fp-cred { width: 100%; max-width: 520px; }
  .hud-ribbon { display: none; }
  .hud-tele { gap: 20px; flex-wrap: wrap; }
}
@media (max-width: 680px) {
  .fp-nodes { grid-template-columns: 1fr; }
  .fp-h { font-size: clamp(34px, 9vw, 56px); }
  .fp-cred .cred-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .deck-mod .fp-h .w, .fp .fp-tag, .fp .fp-sub, .fp .fp-arm, .fp .fp-cta,
  .fp .fp-nodes, .fp .fp-disc, .fp .fp-stat, .fp .fp-cred { opacity: 1 !important; transform: none !important; }
}
