/* /sdlc hero stage — the SDLC agents at work on a pixel pipeline board.
   Authored at 1600×480 (world px), scaled to fit by sdlc/hero.js; phones get a panning camera.
   Only transform/opacity animate on the timeline; chips, bubbles, tags, ticker and meter are set from timeline time.
   Sprites are <img> rendered pixelated at 6×. Fonts (Press Start 2P, VT323) come from the page's Google Fonts <link>. */

.sh-stage {
  --sh-bg: #0E0E14;
  --sh-panel: #17171F;
  --sh-panel-2: #1F1F2A;
  --sh-line: #2C2C3A;
  --sh-ink: #12101A;
  --sh-white: #F4F4F8;
  --sh-muted: #A9A9BA;
  --sh-blue: #0098EB;
  --sh-green: #22C58E;
  --sh-yellow: #FFD166;
  --sh-red: #FF5C7A;
  --sh-purple: #C05CF0;
  position: relative;
  width: 100vw;
  margin: 0 calc(50% - 50vw) 0;
  border: 0;
  border-bottom: 4px solid var(--sh-line);
  background: var(--sh-bg);
  color: var(--sh-white);
  user-select: none;
  -webkit-user-select: none;
}
.sh-stage *, .sh-stage *::before, .sh-stage *::after { box-sizing: border-box; }

.sh-px { font-family: "Press Start 2P", "VT323", monospace; text-transform: uppercase; line-height: 1; font-weight: 400; }
.sh-vt { font-family: "VT323", "Press Start 2P", monospace; line-height: 1; font-weight: 400; }

/* the viewport onto the world: fit-to-width on desktop, a panning camera on phones (height set by JS) */
.sh-view {
  position: relative;
  width: 100%;
  aspect-ratio: 1600 / 480;
  overflow: hidden;
  contain: layout paint;
}
.sh-cam .sh-view { aspect-ratio: auto; }

.sh-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 480px;
  transform-origin: 0 0;
  overflow: hidden;
}
/* CRT scanlines over the world */
.sh-world::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 4px);
}
/* checkerboard floor: floor line at y = 420 */
.sh-world::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60px;
  border-top: 4px solid var(--sh-line);
  background: conic-gradient(var(--sh-panel) 25%, var(--sh-ink) 0 50%, var(--sh-panel) 0 75%, var(--sh-ink) 0) 0 0 / 60px 60px;
  z-index: 0;
}

.sh-sprite {
  display: block;
  max-width: none;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  pointer-events: none;
}

/* ---------- columns (stations) ---------- */
.sh-col {
  position: absolute;
  top: 8px;
  height: 292px;
  width: 184px;
  z-index: 1;
  background: var(--sh-panel);
  border: 4px solid var(--sh-line);
}
.sh-col:nth-child(1) { left: 20px; }
.sh-col:nth-child(2) { left: 214px; }
.sh-col:nth-child(3) { left: 408px; }
.sh-col:nth-child(4) { left: 602px; }
.sh-col:nth-child(5) { left: 796px; width: 396px; }
.sh-col:nth-child(6) { left: 1202px; }
.sh-col:nth-child(7) { left: 1396px; }
.sh-colhd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 56px;
  padding: 0 10px;
  background: var(--sh-panel-2);
  border-bottom: 4px solid var(--sh-line);
}
.sh-colname { font-size: 14px; color: var(--sh-white); white-space: nowrap; }
.sh-col:nth-child(2) .sh-colname { line-height: 1.35; }
.sh-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 5px;
  font-size: 11px;
  color: var(--sh-muted);
  background: var(--sh-ink);
  border: 4px solid var(--sh-line);
  white-space: nowrap;
}
.sh-chip::before { content: ""; width: 8px; height: 8px; background: var(--sh-line); flex: none; }
.sh-chip[data-s="run"] { color: var(--sh-yellow); border-color: var(--sh-yellow); }
.sh-chip[data-s="run"]::before { background: var(--sh-yellow); animation: sh-blink 0.5s steps(2, jump-none) infinite; }
.sh-chip[data-s="ok"] { color: var(--sh-green); border-color: var(--sh-green); }
.sh-chip[data-s="ok"]::before { background: var(--sh-green); }
.sh-chip[data-s="bad"] { color: var(--sh-red); border-color: var(--sh-red); }
.sh-chip[data-s="bad"]::before { background: var(--sh-red); }
@keyframes sh-blink { 0% { opacity: 1; } 100% { opacity: 0.2; } }

/* ---------- story cards (positioned by transform: x/y set by the timeline) ---------- */
.sh-card {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  width: 164px;
  height: 62px;
  padding: 9px 10px 0 16px;
  background: var(--sh-panel-2);
  border: 4px solid var(--sh-line);
  will-change: transform, opacity;
}
.sh-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--sh-blue); }
.sh-cid { display: block; font-size: 12px; color: var(--sh-white); }
.sh-ctitle { display: block; margin-top: 6px; font-size: 22px; color: var(--sh-muted); white-space: nowrap; overflow: hidden; }
.sh-ctag { display: none; margin-top: 6px; font-size: 22px; color: var(--sh-red); white-space: nowrap; }
.sh-card.is-tag .sh-ctitle { display: none; }
.sh-card.is-tag .sh-ctag { display: block; }
.sh-card.is-fail { border-color: var(--sh-red); }
.sh-card.is-fail::before { background: var(--sh-red); }
.sh-card.is-done::before { background: var(--sh-green); }
.sh-card.is-done .sh-cid { color: var(--sh-green); }

/* ---------- agents ---------- */
.sh-bot {
  position: absolute;
  top: 324px;
  width: 96px;
  height: 96px;
  z-index: 4;
  will-change: transform;
}
.sh-bot .sh-sprite { width: 96px; height: 96px; }
.sh-bot-name {
  position: absolute;
  left: 50%;
  top: 108px;
  transform: translateX(-50%);
  padding: 5px 6px 4px;
  font-size: 11px;
  color: var(--sh-muted);
  background: var(--sh-ink);
  white-space: nowrap;
}
#sh-builder { left: 452px; }
#sh-verifier { left: 646px; }
#sh-rev-0 { left: 814px; }
#sh-rev-1 { left: 946px; }
#sh-rev-2 { left: 1078px; }
#sh-auditor { left: 1246px; }

/* speech bubbles: score / verdict above a head */
.sh-bubble {
  position: absolute;
  left: -24px;
  right: -24px;
  bottom: 104px;
  width: max-content;
  min-width: 48px;
  margin: 0 auto;
  padding: 10px 8px 8px;
  font-size: 18px;
  text-align: center;
  color: var(--sh-white);
  background: var(--sh-ink);
  border: 4px solid var(--sh-line);
  white-space: nowrap;
  visibility: hidden;
  transform-origin: 50% 100%;
}
.sh-bubble.sh-wide { min-width: 80px; font-size: 13px; padding: 10px 8px 9px; }
.sh-bubble[data-s] { visibility: visible; }
.sh-bubble[data-s="ok"] { color: var(--sh-green); border-color: var(--sh-green); }
.sh-bubble[data-s="warn"] { color: var(--sh-yellow); border-color: var(--sh-yellow); }
.sh-bubble[data-s="bad"] { color: var(--sh-red); border-color: var(--sh-red); }

/* auditor's five dimensions */
.sh-dims {
  position: absolute;
  left: 50%;
  bottom: 104px;
  display: flex;
  gap: 6px;
  padding: 6px;
  transform: translateX(-50%);
  background: var(--sh-ink);
  border: 4px solid var(--sh-line);
}
.sh-dims:not(.on) { visibility: hidden; }
.sh-dims i { display: block; width: 12px; height: 12px; background: var(--sh-line); }
.sh-dims i.on { background: var(--sh-green); }

/* due-diligence scanner: parks on the floor under REFINE, sweeps the board at the end of each loop */
.sh-scanner {
  position: absolute;
  left: 64px;
  top: 330px;
  width: 96px;
  height: 72px;
  z-index: 12;
  will-change: transform;
}
.sh-scanner .sh-sprite { width: 96px; height: 72px; position: relative; z-index: 1; animation: sh-hover 1.2s steps(2, jump-none) infinite alternate; }
@keyframes sh-hover { from { transform: translateY(0); } to { transform: translateY(-6px); } }
.sh-scanner .sh-bot-name { top: 90px; }
.sh-beam {
  position: absolute;
  left: 24px;
  top: 66px;
  width: 48px;
  height: 350px;
  background: repeating-linear-gradient(to bottom, rgba(34, 197, 142, 0.34) 0 4px, rgba(34, 197, 142, 0.14) 4px 8px);
  border-left: 4px solid var(--sh-green);
  border-right: 4px solid var(--sh-green);
  opacity: 0;
  transform-origin: 50% 0;
}

/* ---------- HUD: sprint, ticker, readiness (unscaled, below the world) ---------- */
.sh-hud {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 8px 14px;
  background: var(--sh-ink);
  border-top: 4px solid var(--sh-line);
}
.sh-sprint { flex: none; font-size: 10px; color: var(--sh-blue); padding: 6px 7px 5px; border: 3px solid var(--sh-blue); white-space: nowrap; }
.sh-ticker {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 22px;
  color: var(--sh-green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.sh-caret { display: inline-block; width: 10px; height: 18px; margin-left: 3px; vertical-align: -2px; background: var(--sh-green); animation: sh-blink 0.9s steps(2, jump-none) infinite; }
.sh-meter { flex: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.sh-meter-l { font-size: 10px; color: var(--sh-muted); }
.sh-meter-s { display: none; }
.sh-segs { display: flex; gap: 3px; }
.sh-segs i { display: block; width: 8px; height: 16px; background: var(--sh-line); }
.sh-segs i.on { background: var(--sh-yellow); }
.sh-meter.is-hi .sh-segs i.on { background: var(--sh-green); }
.sh-ready { font-size: 24px; color: var(--sh-yellow); min-width: 50px; }
.sh-meter.is-hi .sh-ready { color: var(--sh-green); }

@media (max-width: 720px) {
  .sh-hud { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; }
  .sh-meter { margin-left: auto; gap: 8px; }
  .sh-meter-l { display: none; }
  .sh-meter-s { display: inline; }
  .sh-segs i { width: 6px; height: 14px; }
  .sh-ready { font-size: 22px; min-width: 44px; }
  .sh-ticker { order: 3; flex-basis: 100%; font-size: 19px; white-space: normal; min-height: 38px; line-height: 19px; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  .sh-chip[data-s="run"]::before, .sh-caret, .sh-scanner .sh-sprite { animation: none; }
}
