/* GrandpaBurn — Design Doctrine v1.1. Tokens first; nothing outside §1. */

:root {
  --bg: #000000;
  --ink: #FFFFFF;
  --dim: #A3A3A3;
  --amber: #FFB000;
  --phosphor: #3DF5FF;
  --magenta: #FF2BD6;
  --panel: rgba(0, 0, 0, 0.82);
  --scrim-top: rgba(0, 0, 0, 0.72);
  --scrim-bot: rgba(0, 0, 0, 0.78);
  --rule: rgba(255, 255, 255, 0.28);
  --scan: rgba(0, 0, 0, 0.14);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-display: "Syncopate", var(--font-mono);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); }

body {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.55;
}

@media (min-width: 768px) {
  body { font-size: 17px; }
}

/* --- Stage ------------------------------------------------------------- */

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  --glitch-period: 8s;
}

.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  animation: track var(--glitch-period) steps(1, end) infinite;
}

/* Scrim (Doctrine §3 — the demo's gradient) */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, var(--scrim-top), transparent 32%, var(--scrim-bot));
}

/* Scanlines (Doctrine §4.1) */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, var(--scan) 2px 3px);
}

/* Video failed at runtime → still image, no blank stage (Spec §9.2). */
.stage--still {
  background: var(--bg) url("/assets/hero-broadcast-still.webp") center / cover no-repeat;
}
.stage--still video { display: none; }

/* --- Wordmark ------------------------------------------------------------ */

.ident {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--ink);
}

.fringe { text-shadow: -1px 0 var(--phosphor), 1px 0 var(--magenta); }

/* --- Terminal panel ------------------------------------------------------ */

.panel {
  position: absolute;
  left: 50%;
  bottom: 7vh;
  z-index: 2;
  width: min(760px, calc(100% - 32px));
  transform: translateX(-50%);
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 18px 20px;
  max-height: 48vh;
  overflow-y: auto;
  text-align: left;
}

#boot {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: inherit;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--ink);
}

#boot .cursor {
  color: var(--phosphor);
  text-shadow: -1px 0 var(--phosphor), 1px 0 var(--magenta);
  animation: blink 1s steps(2, end) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* --- Jack directory ------------------------------------------------------ */

#jacks {
  list-style: none;
  margin: 0;
  padding: 0;
  opacity: 1;
  transition: opacity 200ms linear;
}

#jacks[aria-hidden="true"] { opacity: 0; }

#jacks li { border-top: 1px solid var(--rule); }

#jacks a,
#jacks .row--dark {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 44px;
  padding: 8px 2px;
  color: var(--ink);
  text-decoration: none;
}

#jacks a:hover .label { color: var(--ink); }

#jacks .row--dark { color: var(--dim); }

#jacks .status { font-size: 14px; letter-spacing: 0.08em; }
.status--live { color: var(--ink); }
.status--testing { color: var(--amber); }
.status--dark { color: var(--dim); }

/* --- Footer -------------------------------------------------------------- */

.foot {
  margin-top: 14px;
  font-size: 14px;
  color: var(--dim);
}
.foot p { margin: 2px 0; }

/* --- Focus (Doctrine §10.5) ---------------------------------------------- */

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--phosphor);
  outline-offset: 2px;
}

/* --- Signal layer --------------------------------------------------------- */

/* Tracking glitch (Doctrine §4.2): one burst per period, translate + clip only. */
@keyframes track {
  0%, 96%, 100% { transform: translateX(0); clip-path: inset(0); }
  96.5% { transform: translateX(-6px); clip-path: inset(38% 0 50% 0); }
  97% { transform: translateX(5px); clip-path: inset(12% 0 71% 0); }
  97.5% { transform: translateX(-3px); clip-path: inset(62% 0 18% 0); }
  98% { transform: translateX(0); clip-path: inset(0); }
}

/* Typing jitter (Doctrine §4.3): translate only — the demo's filter pulse is gone. */
.stage.typing video { animation: signal 130ms steps(2, end) infinite; }
@keyframes signal { 50% { transform: translateX(2px); } }

/* --- Reduced motion (Doctrine §6.3 — binding) ------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .stage video { display: none; }
  .stage { background: var(--bg) url("/assets/hero-broadcast-still.webp") center / cover no-repeat; }
  .stage::after { display: none; }
  #boot .cursor { animation: none; }
  #jacks { transition: none; opacity: 1; }
}
