/* ============================================================
   FRAI SCM — V3 "Fédération" (deepdive3 orchestrator)
   Fork of deepdive/static/v2.css. Reuses demo.css :root tokens
   (linked first in v3.html). Adds the V3-specific layers: the
   persona lens rail, the federation tile grid, the NSN rosetta
   panel and the theatre inset styling.
   ============================================================ */

.v2-shell { max-width: 1180px; margin: 0 auto; padding: clamp(20px,4vh,40px) var(--pad) 80px;
  display: grid; grid-template-columns: 260px 1fr; gap: 26px; align-items: start; }

/* ---------- architecture map (sidebar) ---------- */
.archmap { position: sticky; top: 132px; }
.archmap h3 { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.12em;
  color: var(--text-faint); text-transform: uppercase; margin-bottom: 12px; }
.node { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--panel); margin-bottom: 8px; position: relative; transition: all 0.25s ease; }
.node .ic { font-size: 20px; width: 24px; text-align: center; }
.node .nm { font-family: var(--display); font-weight: 600; font-size: 14px; line-height: 1.15; }
.node .nm small { display: block; color: var(--text-faint); font-size: 11px; font-weight: 400; letter-spacing: 0.02em; }
.node.active { border-color: var(--accent); background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: 0 0 16px var(--accent-glow); }
.node.active .nm { color: var(--accent); }
.node.done { opacity: 0.55; }
.node.done::after { content: "✓"; position: absolute; right: 10px; color: var(--green); font-size: 12px; }
.node.active::after { content: "▸"; position: absolute; right: 8px; color: var(--accent); animation: blink 1s steps(2) infinite; }
.archmap .rail { position: relative; }

/* ---------- guided walkthrough (main) ---------- */
.walk { min-height: 60vh; }
.walk-progress { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.walk-progress span { height: 4px; flex: 1; min-width: 18px; border-radius: 2px; background: var(--line); }
.walk-progress span.on { background: var(--accent); }

.sysbadge { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600;
  letter-spacing: 0.04em; font-size: 13px; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 2px; padding: 4px 11px; margin-bottom: 12px; }
.walk h2 { font-family: var(--display); font-weight: 700; font-size: clamp(24px,4vw,38px); line-height: 1.06; }
.walk .what { color: var(--text); margin-top: 12px; max-width: 66ch; font-size: 16px; line-height: 1.55; }

.block { border-left: 2px solid var(--line-2); padding: 4px 0 4px 14px; margin-top: 16px; }
.block b { font-family: var(--display); letter-spacing: 0.05em; font-size: 12px; text-transform: uppercase; color: var(--text-faint); display: block; margin-bottom: 3px; }
.block.wall { border-left-color: var(--red); }
.block.wall b { color: var(--red); }

/* detail cards */
.detail { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
  border-radius: 4px; padding: 16px 18px; margin-top: 18px; }
.detail h4 { font-family: var(--display); font-size: 13px; letter-spacing: 0.06em; color: var(--text-dim);
  text-transform: uppercase; margin-bottom: 10px; }

/* LLM / raw-payload boxes */
.llm { font-family: var(--mono); font-size: 13px; background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 4px; padding: 12px 14px; white-space: pre-wrap; line-height: 1.5; color: var(--text); }
.llm .ev { color: var(--green); }
.llm .ev.err { color: var(--red); font-weight: 600; }
.llm-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: var(--text-faint); }
.scripted-flag { color: var(--amber-2); }
.live-flag { color: var(--green); font-family: var(--display); font-weight: 600; font-size: 11px;
  letter-spacing: 0.05em; margin-left: 8px; vertical-align: middle; }
.detail.loading { color: var(--text-faint); }
.detail.loading .ev { color: var(--text-faint); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* the LIVE badges breathe; honest amber downgrade once anything falls back */
.data-mode, .live-flag { animation: livepulse 2.4s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.data-mode.degraded { color: var(--amber-2); animation: none; }

/* streaming think-beam + caret (FRAI + Sentinel boxes) */
.llm.streaming { position: relative; overflow: hidden;
  border-color: var(--accent); box-shadow: 0 0 24px var(--accent-glow); }
.llm.streaming::before { content: ""; position: absolute; top: 0; left: 0; height: 2px; width: 38%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 1.25s linear infinite; }
.llm.streaming::after { content: "\258B"; color: var(--accent);
  animation: blink 0.9s steps(2) infinite; }

/* stock table with before/after */
.stock { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock th, .stock td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.stock th { color: var(--text-faint); font-weight: 500; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.stock .num { text-align: right; font-variant-numeric: tabular-nums; font-size: 16px; }
.stock .drop { color: var(--red); font-weight: 700; font-size: 20px; }
.stock .rise { color: var(--green); font-weight: 700; font-size: 20px; }
.stock .drop::after { content: " \25BC"; font-size: 12px; }
.stock .rise::after { content: " \25B2"; font-size: 12px; }
.stock td.drop { animation: flashred 1.2s ease-out; }
.stock td.rise { animation: flashgreen 1.2s ease-out; }
@keyframes flashred { 0% { background: rgba(248, 113, 113, 0.32); } 100% { background: transparent; } }
@keyframes flashgreen { 0% { background: rgba(52, 211, 153, 0.26); } 100% { background: transparent; } }

/* deep-links */
.deeplinks { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.deeplink { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.03em;
  border: 1px solid var(--line-2); border-radius: 3px; padding: 8px 13px; color: var(--text-dim); transition: all 0.18s ease; }
.deeplink:hover { border-color: var(--accent); color: var(--accent); }
.deeplink .real { color: var(--green); font-size: 10px; margin-left: 6px; }

/* nav */
.walk-nav { margin-top: 26px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* topbar reset button */
.reset-demo { font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--text-dim);
  background: transparent; cursor: pointer; border: 1px solid var(--line-2); border-radius: 3px;
  padding: 5px 11px; transition: all 0.2s ease; }
.reset-demo:hover:not(:disabled) { color: var(--amber-2); border-color: var(--amber-2); }
.reset-demo:disabled { opacity: 0.6; cursor: default; }

/* ============================================================
   V3: the persona LENS RAIL — six pairs of eyes on one incident.
   Sticky lens re-tints the whole page via body[data-lens].
   ============================================================ */

body[data-lens="mech"]     { --accent: var(--amber);  --accent-glow: rgba(217,119,6,0.45); }
body[data-lens="siteop"]   { --accent: var(--blue);   --accent-glow: rgba(91,141,239,0.45); }
body[data-lens="frsn"]     { --accent: #8b96f8;       --accent-glow: rgba(139,150,248,0.40); }
body[data-lens="approver"] { --accent: var(--green);  --accent-glow: rgba(53,214,164,0.40); }
body[data-lens="nsatu"]    { --accent: #38bdf8;       --accent-glow: rgba(56,189,248,0.40); }
body[data-lens="general"]  { --accent: #d6b25e;       --accent-glow: rgba(214,178,94,0.42); }

.lens-rail { position: sticky; top: 57px; z-index: 40;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px var(--pad); background: rgba(10,11,13,0.88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.lens-label { font-family: var(--display); font-weight: 600; font-size: 10px;
  letter-spacing: 0.14em; color: var(--text-faint); }
.lens-chip { font-family: var(--display); font-weight: 600; font-size: 12px;
  letter-spacing: 0.04em; color: var(--text-dim); background: var(--panel);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 13px;
  cursor: pointer; transition: all 0.2s ease; }
.lens-chip:hover { color: var(--text); border-color: var(--accent); }
.lens-chip.active { color: #0a0b0d; background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), 0 0 14px var(--accent-glow); }
.lens-chip.follow { border-style: dashed; }
.lens-chip.follow.active { color: var(--accent); background: transparent;
  border-style: solid; box-shadow: 0 0 10px var(--accent-glow); }
/* the "viewing as" hint when a sticky lens overrides the step's primary */
.lens-note { display: inline-flex; align-items: center; gap: 7px; margin-left: 10px;
  font-size: 11px; color: var(--text-faint); }
.standby { border-style: dashed; color: var(--text-dim); }
.standby b { color: var(--text); font-family: var(--display); letter-spacing: 0.03em; }

/* ============================================================
   V3: federation tile grid (the FRSN rollup, step 3)
   ============================================================ */
.fedgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.fedtile { border: 1px solid var(--line); border-radius: 4px; background: var(--bg-1);
  padding: 10px 12px; }
.fedtile .ft-name { font-family: var(--display); font-weight: 600; font-size: 13px; }
.fedtile .ft-kind { color: var(--text-faint); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; }
.fedtile .ft-stats { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.fedtile .ft-stats b { font-family: var(--display); font-size: 17px; color: var(--text); }
.fedtile.hot { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.fedtile.bad { border-color: var(--red); }
.fedtile.bad .ft-name { color: var(--red); }
/* stat tiles (site board, step 2) */
.tiles { display: flex; gap: 12px; flex-wrap: wrap; }
.tile { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg-1); padding: 12px 14px; }
.tile b { display: block; font-family: var(--display); font-weight: 700; font-size: 26px;
  color: var(--accent); line-height: 1.1; }
.tile small { color: var(--text-faint); font-size: 11px; letter-spacing: 0.04em; }

/* ============================================================
   V3: NSN rosetta panel (step 6) — one part, many catalogues
   ============================================================ */
.nsn-panel { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.nsn-card { flex: 1; min-width: 170px; border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--bg-1); padding: 11px 13px; }
.nsn-card .nc-nation { font-size: 11px; color: var(--text-faint); letter-spacing: 0.06em;
  text-transform: uppercase; }
.nsn-card .nc-mat { font-family: var(--mono); font-size: 14px; color: var(--text); margin-top: 3px; }
.nsn-card .nc-nsn { font-family: var(--mono); font-size: 13px; color: var(--amber-2); margin-top: 2px; }
.nsn-card.req { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.nsn-arrow { align-self: center; font-size: 20px; color: var(--accent); }
.nsn-group { display: inline-block; font-family: var(--mono); font-size: 12px; color: var(--green);
  border: 1px solid var(--green); border-radius: 10px; padding: 2px 10px; margin: 6px 0; }

/* ---- decision panel (Sentinel verdict, step 4) ---- */
.decision { background: var(--bg-1); border: 1px solid var(--line); border-radius: 4px;
  padding: 14px 16px; }
.vthinking { color: var(--accent); font-family: var(--display); font-weight: 600;
  animation: livepulse 1.2s ease-in-out infinite; }
.vrow { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 0; font-size: 14px; }
.vk { color: var(--text-faint); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.vv { font-family: var(--mono); font-size: 15px; color: var(--text); }
.vlabel { color: var(--text-faint); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; margin: 12px 0 7px; }
.cands { display: flex; flex-direction: column; gap: 7px; }
.cand { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 4px; opacity: 0.62; transition: all 0.2s ease; }
.cand .rk { width: 18px; text-align: center; font-weight: 700; color: var(--text-faint); }
.cand .mode { font-family: var(--display); font-weight: 600; font-size: 15px; }
.cand .eta { color: var(--text-dim); font-size: 13px; }
.cand.win { opacity: 1; border-color: var(--accent);
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); box-shadow: 0 0 16px var(--accent-glow); }
.cand.win .rk { color: var(--accent); font-size: 16px; }
.cand .badge { margin-left: auto; font-family: var(--display); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 10px; padding: 2px 9px; }
.verdict { margin-top: 13px; padding: 11px 14px; border-radius: 4px; font-size: 14px; line-height: 1.5; }
.verdict.ok { border: 1px solid var(--green); background: rgba(52, 211, 153, 0.10); }
.verdict.ok b { color: var(--green); }
.verdict.warn { border: 1px solid var(--amber-2); background: rgba(251, 191, 36, 0.10); }
.verdict.warn b { color: var(--amber-2); }
.rawwrap { margin-top: 10px; }
.rawwrap summary { cursor: pointer; color: var(--text-faint); font-family: var(--display);
  font-size: 12px; letter-spacing: 0.04em; padding: 4px 0; user-select: none; }
.rawwrap summary:hover { color: var(--accent); }
.rawwrap[open] summary { margin-bottom: 8px; }

/* ---- the killer number: live Sentinel decision time ---- */
.speed { display: flex; align-items: center; gap: 12px; margin: 12px 0;
  padding: 12px 16px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent-glow); }
.speed b { font-family: var(--display); font-weight: 700; font-size: 30px;
  line-height: 1; color: var(--accent); white-space: nowrap; }
.speed span { font-size: 12.5px; line-height: 1.45; color: var(--text-dim); }

/* ---- the wall: human-approval gate banner (step 5 climax) ---- */
.wall-gate { display: flex; gap: 13px; align-items: flex-start; margin: 4px 0 14px;
  padding: 14px 16px; border-radius: 8px; border: 1px solid; }
.wall-gate .wg-ic { font-size: 26px; line-height: 1.1; }
.wall-gate .wg-t { display: block; font-family: var(--display); font-weight: 700;
  font-size: 15px; letter-spacing: 0.03em; }
.wall-gate .wg-d { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.5;
  color: var(--text-dim); }
.wall-gate.hold { border-color: var(--amber-2); background: rgba(217,165,33,0.07); }
.wall-gate.hold .wg-t { color: var(--amber-2); }
.wall-gate.hold .wg-ic { animation: blink 1.3s steps(2) infinite; }
.wall-gate.ok { border-color: var(--green); background: rgba(53,214,164,0.10); }
.wall-gate.ok .wg-t { color: var(--green); }
.wall-gate.bad { border-color: var(--red); background: rgba(224,85,107,0.08); }
.wall-gate.bad .wg-t { color: var(--red); }
/* "what if the operator says no?" — the unhappy path, shown on demand */
.whatif { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.whatif > summary { cursor: pointer; font-family: var(--display); font-weight: 600;
  font-size: 13px; color: var(--text-dim); }
.whatif > summary:hover, .whatif[open] > summary { color: var(--red); }
.whatif[open] > summary { margin-bottom: 8px; }

/* ---- closing recap (step 8): the whole loop in one glance ---- */
.recap { border: 1px solid var(--accent); border-radius: 8px; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.recap-head { font-family: var(--display); font-weight: 700; font-size: 14px;
  letter-spacing: 0.02em; color: var(--accent); padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--accent-glow); }
.recap-row { display: grid; grid-template-columns: 26px 168px 1fr; gap: 10px;
  align-items: baseline; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.recap-row:last-child { border-bottom: none; }
.recap-row .rn { font-family: var(--display); font-weight: 700; color: var(--accent); font-size: 15px; }
.recap-row .rk { font-family: var(--display); font-weight: 600; font-size: 12px;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.recap-row .rv { font-family: var(--mono); font-size: 13px; color: var(--text); }
@media (max-width: 620px) {
  .recap-row { grid-template-columns: 22px 1fr; }
  .recap-row .rk, .recap-row .rv { grid-column: 2; }
}

/* ---- theatre band: the federation map + the part's journey ---- */
.theatre { max-width: 920px; margin: 0 auto; padding: 16px var(--pad) 0; }
.theatre-head { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.theatre-map { position: relative; aspect-ratio: 1200 / 500; max-width: 880px; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--bg-1); }
.theatre-bg { width: 100%; height: 100%; display: block; opacity: 0.95; }
.stop { position: absolute; transform: translate(-50%, -50%); z-index: 3; }
.stop .dot { display: block; width: 13px; height: 13px; border-radius: 50%;
  background: var(--panel-2); border: 2px solid var(--line-2); transition: all 0.4s ease; }
.stop.reached .dot { border-color: var(--accent); background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow); }
.stop.current .dot { animation: ping 1.6s ease-out infinite; }
.stop .lbl { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--text-dim);
  text-shadow: 0 1px 4px var(--bg), 0 0 4px var(--bg); }
.stop.reached .lbl { color: var(--text); }
.stop .lbl small { display: block; font-weight: 400; font-size: 10px; color: var(--text-faint);
  letter-spacing: 0.02em; text-align: center; }
.stop .flag { font-size: 13px; }
.mover { position: absolute; transform: translate(-50%, -50%); font-size: 19px; z-index: 4;
  transition: left 1.5s cubic-bezier(0.45, 0, 0.4, 1), top 1.5s cubic-bezier(0.45, 0, 0.4, 1);
  filter: drop-shadow(0 0 6px var(--accent-glow)); }
.mover.delivered { filter: drop-shadow(0 0 9px var(--green)); }
.theatre-route { position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none; }
#theatre-route { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 5;
  opacity: 0.45; vector-effect: non-scaling-stroke; }
/* the six federation site markers (labelled overlay over the baked SVG dots) */
#theatre-sites { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sitedot { position: absolute; transform: translate(-50%, -50%); }
.sitedot i { display: block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); opacity: 0.85; }
.sitedot em { position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-style: normal; font-size: 9px; color: var(--text-faint);
  text-shadow: 0 1px 3px var(--bg); }
.sitedot.inset-dot em { color: var(--text-dim); }
@media (max-width: 820px) {
  .stop .lbl small { display: none; } .stop .lbl { font-size: 11px; }
  .sitedot em { display: none; }
}

/* ---- intro overlay (orient a cold viewer; Begin or Play the full story) ---- */
.intro { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 11, 0.86); backdrop-filter: blur(3px); padding: 20px; }
.intro.hidden { display: none; }
.intro-card { max-width: 560px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 28px 30px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.intro-kicker { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.intro-card h2 { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 3.4vw, 30px);
  line-height: 1.1; margin-bottom: 12px; }
.intro-card p { color: var(--text-dim); line-height: 1.6; margin-bottom: 22px; }
.intro-card p b { color: var(--text); }
.intro-actions { display: flex; gap: 12px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .v2-shell { grid-template-columns: 1fr; }
  .archmap { position: static; }
  .archmap .rail { display: flex; gap: 8px; overflow-x: auto; }
  .node { margin-bottom: 0; min-width: 150px; }
  .fedgrid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Gate page (gate.html links only this sheet, so these stay
   self-contained — no demo.css token dependencies).
   ============================================================ */
.gate-body { display: flex; align-items: center; justify-content: center; min-height: 100vh;
  margin: 0; background: #0a0b0d; color: #ccd1d9;
  font-family: ui-monospace, 'Cascadia Mono', monospace; }
.gate-card { border: 1px solid #2a3542; border-radius: 8px; padding: 2rem 2.5rem; background: #10161e; }
.gate-card .brand-name { font-weight: 700; letter-spacing: .08em; }
.gate-card .brand-tag { font-size: .75rem; opacity: .7; margin-bottom: 1rem; }
.gate-card label { display: block; margin-bottom: .75rem; }
.gate-card input { display: block; margin-top: .25rem; padding: .4rem .6rem; background: #0b0f14;
  color: #ccd1d9; border: 1px solid #2a3542; border-radius: 4px; }
.gate-card button.primary { padding: .4rem 1.2rem; background: #d97706; color: #10161e;
  border: 0; border-radius: 4px; cursor: pointer; }
.gate-card .error { margin-top: .75rem; color: #ef6a6a; }
