/* dont ded — HQ page (index.html) only.
 * Builds on assets/site.css. The plant scene is a 3D diorama: every pixel layer sits at its own
 * translateZ inside .parallax-stage and is scaled back so the resting view is the flat 2D picture.
 */

/* ---------- the hero wrapper ---------- */
.hq {
  --hq-head: 70px;
  --mx: 0; --my: 0;
  position: relative;
  min-height: 540px;
  height: calc(100vh - var(--hq-head));
  height: calc(100svh - var(--hq-head));
  max-height: 1100px;
  background: linear-gradient(180deg, var(--sky-0), var(--sky-3) 55%, var(--sky-6) 80%, #6E6656 90%);
  overflow: hidden;
}
.hq-scene { position: absolute; inset: 0; min-height: 0; background: transparent; }
.hq-scene .parallax-stage { z-index: 1; }

/* Our own layers inside the scene: stations, walkers, foreground props */
.hq-layer .scene-art { pointer-events: none; }
.hq-layer .scene-art > * { pointer-events: auto; }
.hq-layer .scene-art > .hq-deco, .hq-layer .scene-art > canvas.particles, .hq-layer .scene-art > .hq-tracer { pointer-events: none; }
.hq-layer--walk .walker { pointer-events: auto; z-index: 3; }
.hq-layer--fg { pointer-events: none; }
.hq-layer--fg * { pointer-events: none !important; }
.hq-sprite { position: absolute; display: block; height: auto; image-rendering: pixelated; }
.hq-tracer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; image-rendering: pixelated; }

/* Night-shift flashlight: hard stepped bands that follow the pointer (no blur) */
.hq-light {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at calc(50% + var(--mx) * 46%) calc(55% + var(--my) * 40%),
    transparent 0 18%, rgba(8, 12, 10, .06) 18% 28%, rgba(8, 12, 10, .12) 28% 42%, rgba(8, 12, 10, .18) 42%);
}
.hq-vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(16, 21, 18, .55) 0, rgba(16, 21, 18, .2) 22%, transparent 40%);
}
/* scanlines over the whole screen, very faint */
.hq-scan { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .09) 0 1px, transparent 1px 3px); }

/* ---------- stations ---------- */
.station {
  --lift: 0px; --tz: 0px;
  position: absolute; display: block;
  color: var(--cream); text-decoration: none;
  transform-style: preserve-3d;
  transform-origin: 50% 100%;
  transform: perspective(700px) rotateY(calc(var(--mx) * 14deg)) rotateX(calc(var(--my) * -6deg)) translateZ(var(--lift)) translateY(calc(var(--lift) * -0.25));
  transition: transform .18s steps(3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.station:hover, .station:focus-visible, .station.is-hot { --lift: 34px; color: var(--cream); }
.station:focus-visible { outline: var(--px) dashed var(--hazard); outline-offset: calc(var(--px) * 2); }
.station-art { position: relative; display: block; width: 100%; transform-style: preserve-3d; }
.station-art canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
/* extruded back copies: the flat sprite gets thickness when it turns */
.station-art canvas.ext { position: absolute; left: 0; top: 0; filter: brightness(.28) saturate(.6); }
.station-art canvas.front { position: relative; }
.station:hover .station-art canvas.front, .station:focus-visible .station-art canvas.front, .station.is-hot .station-art canvas.front {
  filter: drop-shadow(1px 0 0 var(--hazard)) drop-shadow(-1px 0 0 var(--hazard)) drop-shadow(0 1px 0 var(--hazard)) drop-shadow(0 -1px 0 var(--hazard));
}
/* the ground shadow stays flat on the yard */
.station-shadow { position: absolute; left: 8%; right: 8%; bottom: -3%; height: 8%; background: rgba(10, 12, 10, .45); transform: translateZ(-1px); }
.station:hover .station-shadow, .station:focus-visible .station-shadow, .station.is-hot .station-shadow { left: 16%; right: 16%; background: rgba(10, 12, 10, .3); }

/* sign plate above each station (always visible) */
.station-tag {
  position: absolute; left: 50%; bottom: calc(100% + 6px);
  transform: translateX(-50%) translateZ(12px);
  white-space: nowrap;
  font-family: var(--font-pixel); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  font-size: clamp(.5rem, .9vw, .72rem); line-height: 1;
  padding: 5px 7px 4px;
  background: var(--navy); color: var(--cream);
  box-shadow: inset 0 0 0 2px var(--steel-deep), inset 0 2px 0 2px #3A4A44, 3px 3px 0 var(--shadow-hard);
}
.station-tag::before { content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .45em; vertical-align: .05em; background: var(--hazard); }
.station:hover .station-tag, .station:focus-visible .station-tag, .station.is-hot .station-tag { background: var(--hazard); color: var(--hazard-ink); box-shadow: inset 0 0 0 2px #4E3A04, 3px 3px 0 var(--shadow-hard); }
.station:hover .station-tag::before, .station:focus-visible .station-tag::before, .station.is-hot .station-tag::before { background: var(--hazard-ink); }
/* the info card that swings out in z on hover/focus */
.station-card {
  position: absolute; left: 50%; bottom: calc(100% + 34px); z-index: 2;
  width: max-content; max-width: 220px;
  padding: 8px 10px 7px;
  font-family: var(--font-body); font-size: 1.1rem; line-height: 1.05; text-transform: none; text-align: left;
  color: var(--navy); background: var(--concrete);
  box-shadow: inset 0 0 0 2px #1C221F, inset 0 3px 0 2px #F4F2EA, 4px 4px 0 var(--shadow-hard);
  transform: translateX(-50%) translateZ(60px) rotateX(-70deg) scale(.6);
  transform-origin: 50% 100%;
  opacity: 0; visibility: hidden;
  transition: transform .2s steps(4), opacity .1s steps(2), visibility 0s linear .2s;
  pointer-events: none;
}
.station-card b { display: block; font-family: var(--font-pixel); font-size: .62rem; letter-spacing: .08em; color: var(--red); margin-bottom: 3px; }
.station:hover .station-card, .station:focus-visible .station-card, .station.is-hot .station-card {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateZ(60px) rotateX(0) scale(1);
  transition: transform .2s steps(4), opacity .1s steps(2), visibility 0s;
}
/* keep the cards inside the screen at the edges */
.station[data-edge="left"] .station-card { left: 0; transform: translateZ(60px) rotateX(-70deg) scale(.6); transform-origin: 0 100%; }
.station[data-edge="left"]:is(:hover, :focus-visible, .is-hot) .station-card { transform: translateZ(60px) rotateX(0) scale(1); }
.station[data-edge="right"] .station-card { left: auto; right: 0; transform: translateZ(60px) rotateX(-70deg) scale(.6); transform-origin: 100% 100%; }
.station[data-edge="right"]:is(:hover, :focus-visible, .is-hot) .station-card { transform: translateZ(60px) rotateX(0) scale(1); }

/* beacons and the gate arm are separate pixels so they can move */
.station-beacon { position: absolute; width: 4%; min-width: 3px; aspect-ratio: 1; background: var(--beacon); box-shadow: 0 0 0 2px rgba(255, 59, 48, .35); }
.station-arm { position: absolute; transform-origin: 3% 50%; transition: transform .25s steps(4); }
.station-arm canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.station--gate:hover .station-arm, .station--gate:focus-visible .station-arm { transform: rotate(-24deg); }
.station--gate.is-locked .station-arm { animation: hq-arm-rattle .4s steps(4); }
@keyframes hq-arm-rattle { 0%, 50% { transform: rotate(-4deg); } 25%, 75% { transform: rotate(2deg); } 100% { transform: rotate(0); } }

/* boss HP pips + hit flash on walkers */
.walker.is-hit canvas { filter: brightness(3) saturate(0) !important; }
.hq-hp { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); display: flex; gap: 2px; }
.hq-hp i { display: block; width: 5px; height: 5px; background: var(--red); box-shadow: 1px 1px 0 #000; }
.hq-hp i.off { background: #3B2020; }
.walker.is-boss { z-index: 4; }

/* screen shake when a shot lands */
.hq.is-shake .parallax-stage { animation: hq-shake .16s steps(3); }
@keyframes hq-shake { 0% { translate: 2px -1px; } 33% { translate: -2px 1px; } 66% { translate: 1px 2px; } 100% { translate: 0 0; } }

/* ---------- HUD over the sky ---------- */
.hq-hud {
  position: absolute; z-index: 10; left: 0; right: 0; top: 0;
  padding: clamp(14px, 3vh, 34px) 0 0;
  pointer-events: none;
}
.hq-hud .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 24px; align-items: start; }
.hq-hud a, .hq-hud button, .hq-hud .crt { pointer-events: auto; }
/* the badge is a note, not a control: clicks pass through it to the stations behind */
.hq-hud .soon { pointer-events: none; }
/* keyboard-only: shoots the front-most zombie; out of sight until it has focus */
.hq-shoot { position: absolute; z-index: 12; left: 50%; bottom: 14px; transform: translateX(-50%); }
.hq-shoot:not(:focus):not(:focus-visible) { width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hq-title { margin: 0; }
.hq-kicker { display: inline-flex; gap: .6em; align-items: center; background: rgba(16, 21, 18, .75); padding: 4px 8px; box-shadow: 2px 2px 0 var(--shadow-hard); }
.hq-kicker .dot { width: 8px; height: 8px; background: var(--beacon); }

/* extruded 3D pixel wordmark */
.hq-logo {
  position: relative; display: block;
  width: min(620px, 52vw);
  margin: 10px 0 6px;
  transform-style: preserve-3d;
  transform: perspective(800px) rotateX(calc(var(--my) * -12deg)) rotateY(calc(var(--mx) * 18deg));
}
.hq-logo svg { display: block; width: 100%; height: auto; overflow: visible; }
.hq-logo .ext { position: absolute; left: 0; top: 0; }
.hq-logo .front { position: relative; }
.hq-lede { font-size: clamp(1.3rem, 2.2vw, 1.75rem); line-height: 1.1; margin: 4px 0 12px; max-width: 30ch; text-shadow: 2px 2px 0 var(--shadow-hard); }
.hq-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.hq-hint { display: inline-block; margin-top: 12px; padding: 4px 10px; font-size: 1.1rem; color: var(--text); background: rgba(16, 21, 18, .78); box-shadow: 3px 3px 0 var(--shadow-hard); }
.hq [hidden] { display: none !important; }
.hq-hint kbd { color: var(--cream); }

.hq-crt { font-size: .62rem; line-height: 1.6; transform-style: preserve-3d; transform: perspective(800px) rotateY(calc(var(--mx) * -8deg - 6deg)) rotateX(calc(var(--my) * 5deg)); transform-origin: 100% 50%; }
.hq-crt h2 { font-size: .7rem; color: inherit; text-shadow: inherit; margin: 0 0 .4em; letter-spacing: .08em; }
.hq-crt .crt-line > span:first-child { opacity: .75; }
.hq-crt .crt-log { margin-top: .5em; min-height: 3.2em; color: var(--rad-soft); word-break: break-word; }
.hq-crt .ok { color: var(--rad); }
.hq-crt .flash { animation: hq-flash .5s steps(2) 3; }
@keyframes hq-flash { 50% { color: #fff; } }

/* ---------- the gate dialog ---------- */
.hq-dialog { border: 0; padding: 0; background: none; color: var(--cream); max-width: min(92vw, 520px); }
.hq-dialog::backdrop { background: rgba(8, 11, 9, .78); }
.hq-dialog .panel { padding: 26px 26px 40px; }
.hq-dialog h2 { color: var(--hazard); }
.hq-dialog .row { margin-top: 16px; }

/* ---------- below the scene ---------- */
.hq-ticker { position: relative; z-index: 2; background: var(--steel-dark); color: var(--hazard); font-family: var(--font-pixel); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; overflow: hidden; white-space: nowrap; box-shadow: 0 -3px 0 var(--olive); }
.hq-ticker .hazard-band { height: 9px; }
.hq-ticker-track { display: inline-flex; gap: 3em; padding: 10px 0; animation: hq-ticker 40s steps(400) infinite; }
.hq-ticker-track span::before { content: "\25A0  "; color: var(--red); }
@keyframes hq-ticker { to { transform: translateX(-50%); } }

.dir-card { padding-top: calc(var(--px) * 6); }
.dir-card .card-art { min-height: calc(var(--px) * 46); }
.dir-card .card-title { display: flex; align-items: center; gap: .5em; }
.dir-card .card-title .num { font-size: .6rem; color: var(--muted); }
.panel--navy.dir-card .card-title .num { color: var(--text-dim); }
.dir-card .go { font-family: var(--font-pixel); font-size: .62rem; letter-spacing: .08em; }
.shift-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.shift-list li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; margin: 0; }
.shift-list canvas { width: 33px; height: 33px; }
.cta-scene { position: relative; height: 210px; margin-bottom: calc(var(--px) * 10); }
.cta-scene canvas { position: absolute; bottom: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .hq-hud .wrap { grid-template-columns: minmax(0, 1fr) 250px; }
  .hq-crt { font-size: .56rem; }
}
@media (max-width: 860px) {
  .hq { --hq-head: 120px; min-height: 620px; }
}
@media (max-width: 760px) {
  .hq { height: auto; min-height: 0; overflow: visible; background: none; }
  .hq-stagebox { position: relative; height: calc(100svh - var(--hq-head)); min-height: 600px; max-height: 900px; overflow: hidden; background: linear-gradient(180deg, var(--sky-0), var(--sky-3) 55%, var(--sky-6) 80%, #6E6656 90%); }
  .hq-hud { padding-top: 14px; }
  .hq-hud .wrap { grid-template-columns: 1fr; }
  .hq-logo { width: min(100%, 360px); margin: 6px 0 2px; }
  .hq-kicker { font-size: .56rem; }
  .hq-lede { font-size: 1.2rem; margin-bottom: 10px; }
  .hq-actions { gap: 8px 10px; }
  .hq-actions .btn--lg { min-height: 48px; font-size: var(--fs-ui); padding: calc(var(--px) * 4) calc(var(--px) * 8); }
  .hq-actions .soon { padding: calc(var(--px) * 4) calc(var(--px) * 7); gap: calc(var(--px) * 4); }
  .hq-actions .soon-main { font-size: .78rem; }
  .hq-hint { display: none; }
  .hq-crt { position: relative; transform: none; margin: 0 auto; width: min(100% - 32px, 560px); font-size: .62rem; }
  .hq-crt-slot { padding: 18px 0 4px; background: var(--steel-dark); }
  .station-card { display: none; }
  .station-tag { font-size: .5rem; padding: 4px 5px 3px; bottom: calc(100% + 3px); }
}
@media (min-width: 761px) {
  .hq-stagebox { position: absolute; inset: 0; }
  .hq-crt-slot { position: absolute; z-index: 11; top: clamp(14px, 3vh, 34px); right: max(16px, calc((100% - var(--wrap)) / 2)); width: clamp(250px, 26vw, 340px); }
  .hq-hud .wrap { grid-template-columns: minmax(0, 1fr); padding-right: clamp(270px, 28vw, 360px); }
}

/* ---------- reduced motion: flat 2D picture, nothing moves ---------- */
html.reduce-motion .station, html.reduce-motion .hq-logo, html.reduce-motion .hq-crt { transform: none !important; }
html.reduce-motion .station-card { transform: translateX(-50%) !important; }
html.reduce-motion .station[data-edge] .station-card { transform: none !important; }
html.reduce-motion .station-art canvas.ext, html.reduce-motion .hq-logo .ext { display: none; }
html.reduce-motion .hq-light { display: none; }
html.reduce-motion .hq-ticker-track { animation: none; white-space: normal; display: flex; flex-wrap: wrap; gap: .5em 2em; padding: 10px 16px; }
html.reduce-motion .hq-ticker-track [aria-hidden="true"] { display: none; }
html.reduce-motion .station-arm { transform: none !important; }
@media print { .hq { height: auto; } .hq-stagebox, .hq-crt-slot { display: none; } .hq-hud { position: static; } }

/* buttons inside dark panels keep their own ink (".panel--navy a" would otherwise recolour them) */
.panel a.btn { color: var(--hazard-ink); }
.panel a.btn--cream, .panel a.btn--gold { color: var(--navy); }
.panel a.btn--navy, .panel a.btn--red, .panel a.btn--dark { color: var(--cream); }
@media (max-height: 860px) and (min-width: 761px) { .hq-hint { display: none; } }
/* short desktop/tablet screens: the badge would sit on the top-row station tags.
   The GATE station, the CRT and the ticker still say COMING SOON. */
@media (min-width: 761px) and (max-height: 760px) {
  .hq-actions .soon { display: none; }
  /* a shorter HUD so the SKIP button clears the back-row stations */
  .hq-logo { width: min(620px, 52vw, 56vh); margin: 6px 0 4px; }
  .hq-lede { font-size: clamp(1.1rem, 1.8vw, 1.35rem); margin-bottom: 8px; }
  .hq-actions .btn--lg { min-height: 40px; font-size: .7rem; padding: calc(var(--px) * 3) calc(var(--px) * 6); }
}
