/* ==========================================================================
   SIGMATECH // GUARDIAN — Phosphor Protocol
   Foundation stylesheet: tokens, type, chrome, panels, section layout.
   Scene-specific styles live in css/scene-*.css
   ========================================================================== */

:root {
  --void:        #050807;
  --carbon:      #0C1210;
  --green:       #00FF88;
  --green-dim:   #113D2C;
  --amber:       #FFB000;
  --red:         #FF3B30;
  --ghost:       #E6F2EA;

  --font-display: "Big Shoulders", "Arial Narrow", "Segoe UI", sans-serif;
  --font-mono:    "IBM Plex Mono", "Consolas", "Courier New", monospace;

  --banner-h: 28px;
  --nav-h: 52px;
  --tape-w: 72px;
  --z-content: 10;
  --z-chrome: 90;
  --z-banner: 100;
  --z-boot: 200;
  --z-fx: 999;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }
html, body { background: var(--void); }

body {
  color: var(--ghost);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient backdrop — one continuous phosphor grid + faint stars behind the
   whole page. Sections are transparent over it, so pinned-section handoffs
   (and any transient unpin during a ScrollTrigger refresh) never expose a
   dead void: the backdrop is always there. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 11% 23%, rgba(0,255,136,0.20) 50%, transparent 51%),
    radial-gradient(1px 1px at 67% 12%, rgba(230,242,234,0.16) 50%, transparent 51%),
    radial-gradient(1px 1px at 41% 64%, rgba(0,255,136,0.12) 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 47%, rgba(230,242,234,0.13) 50%, transparent 51%),
    radial-gradient(1px 1px at 23% 87%, rgba(0,255,136,0.15) 50%, transparent 51%),
    radial-gradient(1px 1px at 74% 79%, rgba(230,242,234,0.10) 50%, transparent 51%),
    linear-gradient(rgba(17,61,44,0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17,61,44,0.22) 1px, transparent 1px);
  background-size:
    100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%,
    96px 96px, 96px 96px;
}

::selection { background: var(--green); color: var(--void); }

/* Themed scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--green-dim); border: 2px solid var(--void); }
::-webkit-scrollbar-thumb:hover { background: var(--green); }

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}

.hero-h1, .sec-h2 {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ghost);
  line-height: 0.95;
  letter-spacing: 0.01em;
}

.hero-h1 { font-size: clamp(2.6rem, 6.3vw, 6rem); }
.sec-h2  { font-size: clamp(2.2rem, 5.5vw, 4.6rem); margin-bottom: 1.2rem; }

.sec-sub {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  color: var(--ghost);
  opacity: 0.78;
  max-width: 56ch;
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 1.3vw, 1.05rem);
  color: var(--ghost);
  opacity: 0.85;
  max-width: 52ch;
  margin: 1.6rem 0 1rem;
}

/* ==========================================================================
   CLASSIFICATION BANNERS
   ========================================================================== */

.class-banner {
  height: var(--banner-h);
  background: var(--amber);
  color: #0A0A00;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}
.class-banner--top { position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-banner); }
.class-banner--bottom { position: relative; }
.class-banner .banner-short { display: none; }
@media (max-width: 600px) {
  .class-banner .banner-full { display: none; }
  .class-banner .banner-short { display: inline; }
}

/* ==========================================================================
   NAV
   ========================================================================== */

.site-nav {
  position: fixed;
  top: var(--banner-h);
  left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(var(--tape-w) + 16px) 0 28px;
  z-index: var(--z-chrome);
  background: linear-gradient(to bottom, rgba(5,8,7,0.92), rgba(5,8,7,0.0));
  opacity: 0;             /* revealed by JS after hero */
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.site-nav.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.nav-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--ghost);
  text-decoration: none;
}
.nav-wordmark-cursor { color: var(--green); animation: blink 1.1s steps(1) infinite; }

.nav-links { display: flex; gap: 22px; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ghost);
  opacity: 0.6;
  text-decoration: none;
  transition: opacity 0.2s, color 0.2s;
  position: relative;
}
.nav-links a:hover { opacity: 1; color: var(--green); }
.nav-links a.is-active { opacity: 1; color: var(--green); }
.nav-links a.is-active::before { content: "▸ "; }

/* ==========================================================================
   ALTITUDE TAPE (scroll indicator)
   ========================================================================== */

.alt-tape {
  position: fixed;
  top: calc(var(--banner-h) + 8px);
  bottom: 8px;
  right: 0;
  width: var(--tape-w);
  z-index: var(--z-chrome);
  pointer-events: none;
}

.alt-tape-ruler {
  position: absolute;
  inset: 0 8px 0 auto;
  width: 40px;
  border-right: 1px solid var(--green-dim);
}
.alt-tick {
  position: absolute;
  right: 0;
  width: 8px;
  height: 1px;
  background: var(--green-dim);
}
.alt-tick--major { width: 14px; background: var(--green); opacity: 0.5; }

.alt-wpt {
  position: absolute;
  right: 18px;
  transform: translateY(-50%);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--green-dim);
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
  transition: color 0.2s;
}
.alt-wpt::after { content: " ◂"; }
.alt-wpt:hover, .alt-wpt.is-active { color: var(--amber); }

.alt-tape-readout {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--carbon);
  border: 1px solid var(--amber);
  color: var(--amber);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 86px;
  box-shadow: 0 0 18px rgba(255,176,0,0.12);
}
.alt-tape-readout .alt-label { font-size: 8px; opacity: 0.7; }
.alt-tape-readout.is-flash { animation: amberflash 0.5s ease; }
@keyframes amberflash {
  0%, 100% { background: var(--carbon); color: var(--amber); }
  40% { background: var(--amber); color: var(--void); }
}

/* ==========================================================================
   TELEMETRY CORNER
   ========================================================================== */

.telemetry-corner {
  position: fixed;
  left: 16px;
  bottom: 14px;
  z-index: var(--z-chrome);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--green-dim);
  line-height: 1.7;
  user-select: none;
  pointer-events: none;
}
.telemetry-corner #tlm-clock { color: var(--green); opacity: 0.7; }
.tlm-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}
.telemetry-corner.is-engaged #tlm-status-text { color: var(--amber); }
.telemetry-corner.is-engaged .tlm-dot { background: var(--amber); animation-duration: 0.6s; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.blink { animation: blink 1.1s steps(1) infinite; }

/* ==========================================================================
   BOOT OVERLAY
   ========================================================================== */

.boot-overlay {
  position: fixed;
  inset: 0;
  background: var(--void);
  z-index: var(--z-boot);
  display: flex;
  align-items: flex-start;
  padding: 12vh 0 0 8vw;
}
.boot-lines {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 2;
  color: var(--green);
  white-space: pre-wrap;
}
.boot-lines .ok { color: var(--green); }
.boot-overlay.is-done { display: none; }

/* ==========================================================================
   HERO GL CANVAS (fixed, behind sections 1-2)
   ========================================================================== */

.hero-gl {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.hero-gl canvas { display: block; width: 100%; height: 100%; }

/* ==========================================================================
   SECTIONS — shared layout
   ========================================================================== */

.sec {
  position: relative;
  min-height: 100vh;
  padding: calc(var(--banner-h) + var(--nav-h) + 2vh) calc(var(--tape-w) + 3vw) 5vh 7vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  z-index: var(--z-content);
}

/* Presentation mode: every section is exactly one page and scrolling
   snaps slide-to-slide. Scenes auto-play on arrival (wired in main.js). */
@media (min-width: 768px) and (min-height: 640px) {
  /* proximity only settles scrollbar drags near a slide edge — actual
     slide-to-slide motion is driven by the wheel/keyboard controller in
     main.js (mandatory snap rubber-bands small wheel ticks and feels stuck) */
  html { scroll-snap-type: y proximity; }
  .sec {
    scroll-snap-align: start;
    height: 100vh;
  }
  .sec-radar .scene-mount { min-height: 44vh; }
  .sec-log .scene-mount { min-height: 36vh; }
  .sec-network .scene-mount { min-height: 26vh; }
  .patch { max-width: 124px; }
}

.copy-block { position: relative; z-index: 3; max-width: 1100px; }

.scene-mount { position: absolute; inset: 0; z-index: 1; }

/* All sections are transparent over the fixed ambient backdrop — one
   continuous surface, so section handoffs never flash a different void.
   (The hero GL canvas is visibility-hidden once past the brief, so it
   can't bleed into lower sections.) */
.sec { background: transparent; }

/* ==========================================================================
   HERO
   ========================================================================== */

/* Command Deck hero: copy column on the left, globe owns the right half */
.sec-hero { justify-content: center; padding-bottom: 8vh; }
.hero-copy { max-width: min(720px, 54vw); }
.hero-h1 .w { display: inline-block; }

.hero-coord {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--amber);
  margin: 0 0 2rem;
  min-height: 1.5em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 767px) {
  .hero-copy { max-width: 100%; }
  .hero-gl canvas { opacity: 0.55; }
}

.hud-btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green-dim);
  padding: 14px 26px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: border-color 0.25s, box-shadow 0.25s, color 0.25s, background 0.25s;
}
.hud-btn:hover {
  border-color: var(--green);
  box-shadow: 0 0 24px rgba(0,255,136,0.25), inset 0 0 12px rgba(0,255,136,0.08);
}
.hud-btn:active { background: rgba(0,255,136,0.12); }

/* HUD corner brackets around hero viewport */
.hud-brackets { position: absolute; inset: calc(var(--banner-h) + 18px) calc(var(--tape-w) + 14px) 18px 18px; z-index: 2; pointer-events: none; }
.hud-brackets .br { position: absolute; width: 34px; height: 34px; border-color: var(--green); border-style: solid; border-width: 0; opacity: 0.65; }
.br-tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.br-tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.br-bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.br-br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

/* ==========================================================================
   HUD PANELS (shared component)
   ========================================================================== */

.hud-panel {
  background: rgba(12,18,16,0.88);
  border: 1px solid var(--green-dim);
  padding: 20px 22px;
  position: relative;
}
.hud-panel::before, .hud-panel::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border-color: var(--green);
  border-style: solid;
}
.hud-panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.hud-panel::after  { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.hud-panel-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--green);
  margin-bottom: 10px;
}
.hud-panel p { font-size: 13px; opacity: 0.85; }

/* ==========================================================================
   02 BRIEF
   ========================================================================== */

.sec-brief { justify-content: center; }
.brief-panels {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 460px;
  margin-left: auto;
  margin-top: -14vh;
}
.brief-panel { padding: 16px 18px; }

/* ==========================================================================
   03 INTERCEPT
   ========================================================================== */

.sec-intercept { justify-content: flex-end; padding-bottom: 9vh; }
.intercept-copy { max-width: 980px; }
.intercept-stamp {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.1rem, 2.2vw, 1.8rem);
  letter-spacing: 0.18em;
  color: var(--green);
  border: 2px solid var(--green);
  display: inline-block;
  padding: 6px 18px;
  margin-bottom: 1.4rem;
  text-shadow: 0 0 18px rgba(0,255,136,0.5);
}

/* ==========================================================================
   04 RADAR
   ========================================================================== */

.sec-radar .radar-copy { max-width: 700px; }
.sec-radar .scene-mount { position: relative; inset: auto; min-height: 58vh; margin-top: 2vh; }

/* ==========================================================================
   05 AVIATION
   ========================================================================== */

.sec-aviation { justify-content: flex-start; padding-top: calc(var(--banner-h) + var(--nav-h) + 7vh); }
.aviation-copy { max-width: 860px; }

/* ==========================================================================
   06 LOG
   ========================================================================== */

.sec-log .scene-mount { position: relative; inset: auto; min-height: 46vh; margin-top: 3vh; }

/* ==========================================================================
   07 STATS
   ========================================================================== */

.stats-grid {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 2vh;
  max-width: 1180px;
}
.stat-panel { padding: 18px 20px 16px; }
.stat-led {
  position: absolute;
  top: 12px; right: 12px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255,176,0,0.7);
}
.stat-panel.is-locked .stat-led { background: var(--green); box-shadow: 0 0 8px rgba(0,255,136,0.7); animation: pulse 3s ease-in-out infinite; }
.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 3.4vw, 3rem);
  color: var(--green);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-bottom: 10px;
}
.stat-label { font-size: 10.5px; letter-spacing: 0.1em; opacity: 0.65; line-height: 1.6; }
.stats-wink {
  position: relative;
  z-index: 3;
  margin-top: 22px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--green-dim);
}

/* contract-vehicle marquee */
.vehicle-ticker {
  position: relative;
  z-index: 3;
  margin-top: 16px;
  max-width: 1180px;
  overflow: hidden;
  border-top: 1px solid var(--green-dim);
  border-bottom: 1px solid var(--green-dim);
  padding: 9px 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.vehicle-ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 36s linear infinite;
}
.vehicle-ticker-track span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--green);
  opacity: 0.75;
  white-space: nowrap;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .vehicle-ticker-track { animation: none; }
}

/* ==========================================================================
   08 NETWORK
   ========================================================================== */

.sec-network .scene-mount { position: relative; inset: auto; min-height: 40vh; margin-top: 2vh; }
.patch-row {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  justify-items: center;
  align-items: center;
  gap: 22px;
  width: 100%;
  max-width: 1240px;
  margin: 4vh auto 0;
}
.patch { width: 100%; max-width: 148px; aspect-ratio: 1; position: relative; }

/* ==========================================================================
   09 CONTACT / TOUCHDOWN
   ========================================================================== */

/* footer is anchored inside the contact section so nothing scrolls after the
   pin releases — the page ends exactly on the landing frame */
.sec-contact { justify-content: center; padding-bottom: 130px; }
@media (min-width: 768px) and (min-height: 700px) {
  .sec-contact { height: 100vh; overflow: hidden; }
}

.helipad-ripple {
  position: absolute;
  left: 50%; top: 55%;
  width: 10px; height: 10px;
  z-index: 1;
  pointer-events: none;
}
.helipad-ripple::before, .helipad-ripple::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--green);
  border-radius: 50%;
  opacity: 0;
}
.helipad-ripple.is-landed::before { animation: ripple 1.6s ease-out 1; }
.helipad-ripple.is-landed::after  { animation: ripple 1.6s ease-out 0.35s 1; }
@keyframes ripple {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(90); opacity: 0; }
}

.comms-console {
  position: relative;
  z-index: 3;
  margin-top: 4vh;
  max-width: 620px;
  background: var(--carbon);
  border: 1px solid var(--green-dim);
  box-shadow: 0 0 40px rgba(0,255,136,0.06);
}
.comms-titlebar {
  background: var(--green-dim);
  color: var(--ghost);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  padding: 8px 14px;
}
.comms-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.comms-row { display: flex; gap: 12px; align-items: baseline; }
.comms-row--msg { align-items: flex-start; }
.comms-prompt { color: var(--green); font-size: 13px; font-weight: 600; white-space: nowrap; }
.comms-row input, .comms-row textarea {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--green-dim);
  color: var(--ghost);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 2px;
  caret-color: var(--green);
  outline: none;
  resize: vertical;
}
.comms-row input:focus, .comms-row textarea:focus { border-bottom-color: var(--green); }
.comms-output { font-size: 12px; color: var(--green); line-height: 1.9; min-height: 0; white-space: pre-wrap; }
.comms-send { align-self: flex-start; }

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-content);
  background: var(--void);
}
.footer-line {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--green-dim);
  padding: 26px 16px 30px;
}

/* ==========================================================================
   ATMOSPHERE FX
   ========================================================================== */

.fx-scanlines {
  position: fixed;
  inset: 0;
  z-index: var(--z-fx);
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0)    0px,
    rgba(0, 0, 0, 0)    3px,
    rgba(0, 255, 136, 0.022) 3px,
    rgba(0, 255, 136, 0.022) 4px
  );
  mix-blend-mode: screen;
}
.fx-vignette {
  position: fixed;
  inset: 0;
  z-index: var(--z-fx);
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,0.42) 100%);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1023px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 10px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patch-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
  :root { --tape-w: 0px; }
  .sec { padding-left: 6vw; padding-right: 6vw; }
  .nav-links { display: none; }
  .alt-tape .alt-tape-ruler { display: none; }
  .alt-tape { top: auto; bottom: 12px; right: 12px; width: auto; }
  .alt-tape-readout { position: static; transform: none; }
  .brief-panels { max-width: 100%; margin-left: 0; margin-top: 4vh; }
  .stats-grid { grid-template-columns: 1fr; }
  .patch-row { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .patch { max-width: 124px; }
  .telemetry-corner { display: none; }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .nav-wordmark-cursor, .blink, .tlm-dot { animation: none !important; }
  .alt-tape-readout.is-flash { animation: none; }
  .helipad-ripple.is-landed::before, .helipad-ripple.is-landed::after { animation: none; }
  html.reduced-motion * { transition: none !important; }
  html.reduced-motion svg path { stroke-dashoffset: 0 !important; }
}
