/* Screen-level layout: hero, presentation mode, sign-in, cryptography paths. */

/* ---------- overview hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: var(--s8);
  padding: var(--s8); border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
  position: relative; overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--hero-c, var(--line-strong)); }
.hero.tone-ok { --hero-c: var(--ok-fill); --hero-tint: var(--ok-tint); --hero-fg: var(--ok); }
.hero.tone-ok-soft { --hero-c: var(--ok-fill); --hero-tint: var(--ok-tint); --hero-fg: var(--ok); }
.hero.tone-warn { --hero-c: var(--warn-fill); --hero-tint: var(--warn-tint); --hero-fg: var(--warn); }
.hero.tone-crit { --hero-c: var(--crit-fill); --hero-tint: var(--crit-tint); --hero-fg: var(--crit); }
.hero.tone-proc { --hero-c: var(--cobalt); --hero-tint: var(--cobalt-tint); --hero-fg: var(--cobalt-strong); }
.hero.tone-neutral { --hero-c: var(--muted); --hero-tint: var(--surface-3); --hero-fg: var(--slate); }
.hero-main { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.posture { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.posture-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--hero-tint); color: var(--hero-fg); }
.posture-icon svg { width: 26px; height: 26px; }
.posture .h-page { color: var(--ink); }
.posture .lead { margin-top: 6px; }
.hero-device { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding-top: var(--s5); border-top: 1px solid var(--line); }
.hero-device a.h-section { color: var(--ink); }
.hero-stateline { margin-top: calc(var(--s3) * -1); }
.hero .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-lattice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); min-width: 0; }
.lattice-caption { text-align: center; max-width: 42ch; display: flex; flex-direction: column; gap: 6px; align-items: center; }
#score-math { width: 100%; max-width: 460px; }
@media (max-width: 1240px) { .hero { grid-template-columns: minmax(0, 1.15fr) minmax(280px, 1fr); padding: var(--s6); gap: var(--s6); } }
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .lattice { max-width: 380px; }
}
@media (max-width: 640px) {
  .rail-label { font-size: 9px; letter-spacing: 0; }
  .rail-when { display: none; }
  .channels { grid-template-columns: minmax(0, 1fr); }
}

.offline-bar {
  display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s8);
  background: var(--crit-tint); color: var(--crit); border-bottom: 1px solid var(--crit-line); font-size: var(--t-sm);
}
.offline-bar svg { width: 18px; height: 18px; flex: none; }
.offline-bar span { color: var(--ink-2); }
.offline-bar b { color: var(--crit); }

.act-wrap { display: inline-flex; }

/* ---------- sign-in ---------- */
.signin {
  min-height: 100vh; display: grid; place-items: center; padding: var(--s6);
  background:
    radial-gradient(1200px 600px at 20% -10%, #e8ecf8 0%, transparent 60%),
    var(--paper);
}
.signin-card { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s10); box-shadow: var(--shadow-lift); }
@media (max-width: 520px) { .signin-card { padding: var(--s6); } }

/* ---------- cryptography ---------- */
.pq-name { font-size: var(--t-2xl); font-weight: 650; font-stretch: 108%; letter-spacing: -0.01em; }
.pq-stat { font-size: var(--t-3xl); font-weight: 650; font-stretch: 110%; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.pq-paths { min-width: 880px; width: 100%; height: auto; }
.pq-box { fill: #fff; stroke: var(--line-strong); }
.pq-t { font-size: 13px; font-weight: 600; fill: var(--ink); }
.pq-line { stroke-width: 2; stroke: var(--line-strong); }
.pq-line.pq { stroke: var(--cobalt); }
.pq-line.warn { stroke: var(--warn-fill); stroke-dasharray: 5 5; }
.pq-via { fill: #fff; stroke: var(--line-strong); }
.pq-via.pq { fill: var(--cobalt-tint); stroke: var(--cobalt-line); }
.pq-via.warn { fill: var(--warn-tint); stroke: var(--warn-line); }
.pq-via-t { font-size: 12px; font-weight: 600; fill: var(--ink-2); }
.pq-via-t.pq { fill: var(--cobalt-strong); }
.pq-via-t.warn { fill: var(--warn); }
.pq-note { font-size: 12.5px; font-weight: 650; fill: var(--slate); }
.pq-note.pq { fill: var(--cobalt-strong); }
.pq-note.warn { fill: var(--warn); }

/* ---------- camera & vision ---------- */
.pipe { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--t-xs); }
.pipe-step { padding: 3px 9px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; color: var(--ink-2); }
.pipe-step.pq { background: var(--cobalt-tint); border-color: var(--cobalt-line); color: var(--cobalt-strong); }
.pipe-step.warn { background: var(--warn-tint); border-color: var(--warn-line); color: var(--warn); }
.pipe-arrow svg { width: 13px; height: 13px; color: var(--muted); }
.vision-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vision-facts .fact:last-child { grid-column: 1 / -1; }
.obs-list { display: flex; flex-direction: column; }
.obs-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px var(--s3); align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.obs-item:first-child { border-top: 0; }
.obs-time { font-size: var(--t-xs); color: var(--slate); padding-top: 2px; }
.obs-title { font-weight: 600; font-size: var(--t-sm); }
.obs-sub { font-size: var(--t-xs); color: var(--slate); overflow-wrap: anywhere; }
.obs-item.is-rule .obs-title { color: var(--crit); }
.obs-tags { grid-column: 2; display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 520px) { .obs-item { grid-template-columns: minmax(0, 1fr); } .obs-tags { grid-column: 1; } .vision-facts { grid-template-columns: minmax(0, 1fr); } }

body.is-live .toasts { display: none; }

/* ---------- presentation mode ----------
   Sized from the viewport HEIGHT as well as the width, so the whole story (rail, state, reason/progress, both
   enforcement channels, latest decisions) fits one screen on 1366x768 and 1280x720 projectors without scrolling. */
.live {
  min-height: 100vh; display: flex; flex-direction: column; background: var(--paper);
  --lv-c: var(--ink); --lv-tint: var(--surface-3); --lv-fg: var(--ink);
  --lv-pad-x: clamp(20px, 2.8vw, 40px);
  --lr-size: clamp(38px, 6vh, 52px);
}
.live.tone-ok, .live.tone-ok-soft { --lv-c: var(--ok-fill); --lv-tint: var(--ok-tint); --lv-fg: var(--ok); }
.live.tone-warn { --lv-c: var(--warn-fill); --lv-tint: var(--warn-tint); --lv-fg: var(--warn); }
.live.tone-crit { --lv-c: var(--crit-fill); --lv-tint: var(--crit-tint); --lv-fg: var(--crit); }
.live.tone-proc { --lv-c: var(--cobalt); --lv-tint: var(--cobalt-tint); --lv-fg: var(--cobalt-strong); }
.live-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); padding: clamp(8px, 1.6vh, 16px) var(--lv-pad-x); background: var(--surface); border-bottom: 1px solid var(--line); }
.live-brand { font-weight: 700; font-stretch: 112%; letter-spacing: 0.05em; }
.live-tag { font-size: var(--t-xs); font-weight: 650; color: #fff; background: var(--crit-fill); padding: 2px 8px; border-radius: 4px; letter-spacing: 0.06em; text-transform: uppercase; }
.live-device { font-size: var(--t-xl); font-weight: 650; display: flex; align-items: center; gap: var(--s3); }
.live-clock { font-size: var(--t-xl); font-weight: 600; color: var(--ink-2); }

.live-rail { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: clamp(14px, 3.6vh, 40px) var(--lv-pad-x) clamp(8px, 2vh, 24px); gap: 0; container-type: inline-size; }
@container (max-width: 620px) {
  .lr-step:not(.is-now) .lr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lr-step.is-now .lr-label { white-space: nowrap; }
}
.lr-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.3vh, 12px); }
.lr-step::before { content: ""; position: absolute; top: calc(var(--lr-size) / 2 - 1.5px); right: 50%; width: 100%; height: 3px; background: var(--line-strong); }
.lr-step:first-child::before { display: none; }
.lr-step.is-past::before, .lr-step.is-now::before { background: var(--ink-2); }
.lr-node { position: relative; z-index: 1; width: var(--lr-size); height: var(--lr-size); border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 3px solid var(--line-strong); color: var(--muted); transition: all var(--dur-2) var(--ease); }
.lr-node svg { width: 46%; height: 46%; }
.lr-step.is-past .lr-node { border-color: var(--ink-2); color: var(--ink-2); }
.lr-step.is-now .lr-node { width: calc(var(--lr-size) + 12px); height: calc(var(--lr-size) + 12px); margin-top: -6px; border-color: var(--lv-c); background: var(--lv-c); color: #fff; box-shadow: 0 0 0 8px var(--lv-tint); }
.lr-label { font-size: clamp(11px, 1.1vw, 15px); font-weight: 700; letter-spacing: 0.06em; color: var(--muted); }
.lr-step.is-past .lr-label { color: var(--ink-2); }
.lr-step.is-now .lr-label { color: var(--lv-fg); }

.live-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 2.8vw, 40px); padding: clamp(10px, 2.2vh, 24px) var(--lv-pad-x) clamp(14px, 3.2vh, 40px); }
.live-state { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(18px, 3.6vh, 40px) clamp(20px, 2.8vw, 40px); display: flex; flex-direction: column; gap: clamp(8px, 1.5vh, 16px); position: relative; overflow: hidden; box-shadow: var(--shadow-lift); min-width: 0; }
.live-state::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--lv-c); }
.live-change { align-self: flex-start; font-size: clamp(14px, 2.2vh, 18px); font-weight: 650; color: #fff; background: var(--lv-c); padding: 3px 12px; border-radius: 6px; animation: pop-in var(--dur-2) var(--ease); }
.live-change.is-quiet { color: var(--slate); background: none; padding: 0; font-weight: 500; animation: none; }
.live-word { display: flex; align-items: center; gap: var(--s4); font-size: clamp(30px, min(3.7vw, 6.6vh), 64px); font-weight: 700; letter-spacing: 0.01em; color: var(--lv-fg); line-height: 1; overflow-wrap: anywhere; }
.live-word svg { width: 0.8em; height: 0.8em; flex: none; }
.live-score { display: flex; align-items: baseline; gap: var(--s4); }
.live-score .num { font-size: clamp(72px, min(12vw, 17vh), 180px); font-weight: 600; font-stretch: 116%; letter-spacing: -0.04em; line-height: 0.9; color: var(--ink); }
.live-of { font-size: clamp(16px, 2.4vh, 20px); color: var(--slate); }
.live-line { font-size: clamp(16px, 2.4vh, 20px); color: var(--ink-2); max-width: 34ch; line-height: 1.4; }

/* why / how far: quarantine reason, recovery progress, restored access */
.lv-ctx { display: flex; flex-direction: column; gap: 4px; padding: clamp(10px, 1.8vh, 16px) clamp(12px, 1.4vw, 18px); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.lv-ctx-label { display: flex; align-items: center; gap: 8px; font-size: clamp(12px, 1.8vh, 14px); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--slate); }
.lv-ctx-label svg { width: 17px; height: 17px; flex: none; }
.lv-ctx-main { font-size: clamp(16px, 2.5vh, 21px); font-weight: 650; line-height: 1.3; color: var(--ink); }
.lv-ctx-sub { font-size: clamp(12px, 1.8vh, 14px); color: var(--slate); }
.lv-ctx-detail { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; font-size: clamp(14px, 2.1vh, 17px); color: var(--ink-2); margin-top: 2px; }
.lv-reason { background: var(--crit-tint); border-color: var(--crit-line); }
.lv-reason .lv-ctx-label { color: var(--crit); }
.lv-restored { background: var(--ok-tint); border-color: var(--ok-line); }
.lv-restored .lv-ctx-label { color: var(--ok); font-size: clamp(14px, 2.2vh, 17px); }
.lv-progress-block { background: var(--cobalt-tint); border-color: var(--cobalt-line); gap: clamp(6px, 1.2vh, 10px); }
.lv-proof { background: var(--ok-tint); border-color: var(--ok-line); }
.lv-proof .lv-ctx-label { color: var(--ok); }
.lv-proof-list { display: flex; flex-direction: column; gap: clamp(2px, 0.5vh, 6px); font-size: clamp(13px, 1.9vh, 16px); color: var(--ink-2); }
.lv-proof-list li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: var(--s2); align-items: baseline; }
.lv-proof-list b { color: var(--ink); }
.lv-proof-list li.is-crit span { color: var(--crit); font-weight: 600; }
.lv-pips i { width: 30px; height: 8px; border-radius: 4px; }
.lv-progress { flex: 0 1 220px; height: 10px; border-radius: 5px; background: #fff; border: 1px solid var(--cobalt-line); }
.lv-progress.is-ok { border-color: var(--ok-line); }
.lv-progress.is-ok i { background: var(--ok-fill); }
.lv-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.lv-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.lv-steps li::before { content: ""; position: absolute; top: 10px; right: 50%; width: 100%; height: 2px; background: var(--cobalt-line); }
.lv-steps li:first-child::before { display: none; }
.lv-steps li.is-done::before, .lv-steps li.is-active::before { background: var(--cobalt); }
.lv-step-node { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--cobalt-line); color: #fff; }
.lv-step-node svg { width: 13px; height: 13px; }
.lv-steps li.is-done .lv-step-node { background: var(--cobalt); border-color: var(--cobalt); }
.lv-steps li.is-active .lv-step-node { border-color: var(--cobalt); box-shadow: 0 0 0 4px rgba(45, 69, 196, 0.16); }
.lv-steps li.is-active .lv-step-node::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cobalt); }
.lv-steps.is-advancing li.is-active .lv-step-node { --node-rest: 0 0 0 4px rgba(45, 69, 196, 0.16); animation: node-pulse 900ms var(--ease-out) 1; }
@media (prefers-reduced-motion: reduce) { .lv-steps.is-advancing li.is-active .lv-step-node { animation: none; } }
.lv-steps li.is-failed .lv-step-node { background: var(--crit); border-color: var(--crit); }
.lv-step-label { font-size: clamp(11px, 1.6vh, 13px); font-weight: 600; color: var(--slate); line-height: 1.2; }
.lv-steps li.is-done .lv-step-label { color: var(--ink-2); }
.lv-steps li.is-active .lv-step-label { color: var(--cobalt-strong); font-weight: 700; }

.live-channels { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-top: auto; }
.lc { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 2px var(--s3); align-items: center; padding: clamp(10px, 1.8vh, 16px) var(--s5); border-radius: var(--r-md); border: 1px solid var(--line); }
.lc svg { grid-row: span 2; width: 28px; height: 28px; color: var(--slate); }
.lc span { font-size: var(--t-sm); color: var(--slate); }
.lc b { font-size: clamp(20px, 3.3vh, 26px); font-weight: 650; }
.lc.ok svg, .lc.ok b { color: var(--ok); }
.lc.crit { background: var(--crit-tint); border-color: var(--crit-line); }
.lc.crit svg, .lc.crit b { color: var(--crit); }
.lc.is-restored { background: var(--ok-tint); border-color: var(--ok-fill); box-shadow: 0 0 0 3px var(--ok-tint); }
.lc.is-restored.is-new { animation: restored 1.8s var(--ease) 1; }
@keyframes restored { 0% { box-shadow: 0 0 0 0 rgba(26, 154, 108, 0.45); } 60% { box-shadow: 0 0 0 14px rgba(26, 154, 108, 0); } 100% { box-shadow: 0 0 0 3px var(--ok-tint); } }
/* suspicion moment: one amber pass across the posture card (overview hero, presentation state card) */
.hero.is-sweep::after, .live-state.is-sweep::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(225, 154, 44, 0.16) 50%, transparent 70%);
  transform: translateX(-100%); animation: amber-sweep 760ms var(--ease-out) 1 forwards;
}
@keyframes amber-sweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .hero.is-sweep::after, .live-state.is-sweep::after { display: none; } }
/* access restored: a short emerald wash behind the stage, and the "Normal channel restored" callout rises in */
.live { position: relative; isolation: isolate; }
.live.is-restoring::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(70% 60% at 28% 62%, rgba(26, 154, 108, 0.14), transparent 70%);
  animation: lv-wash 2.4s var(--ease-out) forwards;
}
@keyframes lv-wash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
.live.is-restoring .lv-restored { animation: lv-rise 600ms var(--ease-out) 1 backwards; }
@keyframes lv-rise { from { opacity: 0; transform: translateY(8px); } }

.live-feed { display: flex; flex-direction: column; gap: clamp(8px, 1.5vh, 16px); min-width: 0; }
.live-h { font-size: clamp(16px, 2.4vh, 20px); font-weight: 600; color: var(--slate); }
.live-feed ol { display: flex; flex-direction: column; gap: clamp(6px, 1.3vh, 12px); }
.lf-item { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: clamp(8px, 1.6vh, 16px) var(--s5); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--r-md); animation: tl-enter var(--dur-2) var(--ease); }
.lf-item[data-tone="crit"] { border-left-color: var(--crit-fill); }
.lf-item[data-tone="warn"] { border-left-color: var(--warn-fill); }
.lf-item[data-tone="ok"], .lf-item[data-tone="ok-soft"] { border-left-color: var(--ok-fill); }
.lf-item[data-tone="proc"] { border-left-color: var(--cobalt); }
.lf-item.is-first { padding-block: clamp(10px, 2vh, 20px); box-shadow: var(--shadow-lift); }
.lf-item.is-first .lf-title { font-size: clamp(18px, 3vh, 26px); }
.lf-time { color: var(--slate); font-size: clamp(14px, 2.1vh, 16px); }
.lf-title { font-size: clamp(16px, 2.5vh, 20px); font-weight: 650; line-height: 1.25; }
.lf-title .tag { vertical-align: 3px; margin-left: 4px; }
.lf-sub { color: var(--slate); font-size: clamp(12px, 1.9vh, 14px); margin-top: 2px; }
.lf-score { font-size: clamp(16px, 2.6vh, 20px); font-weight: 650; text-align: right; }
.lf-score .delta { display: block; font-size: var(--t-md); }
.live-foot { margin-top: auto; color: var(--slate); font-size: clamp(14px, 2.2vh, 18px); }
.live-foot svg { width: 22px; height: 22px; color: var(--ok); }
/* short screens: keep the four most recent decisions so nothing below the fold is needed */
@media (max-height: 820px) { .live-feed .lf-item:nth-child(n + 5) { display: none; } }
/* 720-760 px tall (1280x720 projectors): tighten vertical rhythm, keep every element */
@media (max-height: 760px) {
  .live-rail { padding-top: 12px; }
  .live-score .num { font-size: clamp(64px, min(12vw, 15vh), 180px); }
  .live-state { gap: 6px; padding-block: 16px; }
  .lv-ctx { padding-block: 8px; }
}
@media (max-width: 900px) {
  .live-main { grid-template-columns: minmax(0, 1fr); }
  .live-feed .lf-item:nth-child(n + 5) { display: grid; }
}
@media (max-width: 640px) {
  .live-top { flex-wrap: wrap; padding-block: var(--s3); }
  .live-rail { padding-top: var(--s6); }
  .live { --lr-size: 34px; }
  .lr-node { border-width: 2px; }
  .lr-step.is-now .lr-node { width: 40px; height: 40px; margin-top: -3px; box-shadow: 0 0 0 4px var(--lv-tint); }
  .lr-label { font-size: 8px; letter-spacing: 0; }
  .live-state { padding: var(--s6); }
  .live-channels { grid-template-columns: minmax(0, 1fr); }
  .lv-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
  .lv-steps li:nth-child(4)::before { display: none; }
  .lf-item { grid-template-columns: minmax(0, 1fr) auto; }
  .lf-time { grid-column: 1 / -1; font-size: var(--t-sm); }
}
@media (prefers-reduced-motion: reduce) { .lf-item, .live-change, .lc.is-restored.is-new, .live.is-restoring .lv-restored { animation: none; } .live.is-restoring::before { display: none; } }
