/* NEXUS v2 — atmospheric layers (guide shell only) */

/* —— Fixed surveillance stack —— */
.nx-atmo {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.nx-grain {
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="light"] .nx-grain,
[data-theme="light"] .nx-scanlines {
  opacity: 0;
}

.nx-scanlines {
  z-index: 9996;
  opacity: 0.035;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.45) 2px,
    rgba(0, 0, 0, 0.45) 4px
  );
}


.nx-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 100060;
  background: linear-gradient(90deg, var(--nx-phosphor-hi), var(--nx-infrared));
  box-shadow: 0 0 10px rgba(255, 76, 0, 0.4);
  pointer-events: none;
}

/* —— HUD corners —— */
.nx-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  font-family: var(--nx-font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: rgba(76, 89, 107, 0.62);
}
[data-theme="light"] .nx-hud {
  color: rgba(90, 82, 74, 0.5);
}


.nx-hud__corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: calc(var(--nx-bar-h) + 0.5rem) 1rem 1rem;
}
.nx-hud__tl { top: 0; left: 0; }
.nx-hud__tr { top: 0; right: 0; text-align: right; }
.nx-hud__bl { bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px)); left: 0; }
.nx-hud__br { bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px)); right: 0; text-align: right; }
@media (min-width: 900px) {
  .nx-hud__bl, .nx-hud__br { bottom: 1rem; }
}
@media (min-width: 1100px) {
  .nx-hud__tl { left: var(--nx-rail-w, 8.5rem); }
}

.nx-hud__rec {
  color: var(--nx-infrared);
  animation: nx-rec-blink 1.4s step-end infinite;
}
@keyframes nx-rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.nx-hud__phosphor { color: var(--nx-phosphor-hi); }
.nx-hud__ice { color: var(--nx-accent-cool); }

/* —— Dither strip — theme-invariant (never override in light mode) —— */
#nx-dither,
html[data-theme="light"] #nx-dither,
html[data-theme="dark"] #nx-dither {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: clamp(58px, 8vw, 102px);
  height: 100%;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: crosshair;
  z-index: 9997;
  opacity: 1;
  mix-blend-mode: screen;
  filter: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.1) 24%, #000 50%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.1) 24%, #000 50%);
}


/* —— Page canvas + frame —— */
.nx-page-canvas {
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.nx-page-frame {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 0;
  width: min(var(--nx-content-max, 920px), calc(100% - var(--nx-pad) * 2));
  transform: translateX(calc(-50% + var(--nx-rail-w, 0px) / 2));
  pointer-events: none;
}
@media (min-width: 1100px) {
  .nx-page-frame {
    display: block;
    width: min(
      var(--nx-content-max, 920px),
      calc(100% - var(--nx-rail-w, 0px) - var(--nx-pad) * 2)
    );
  }
}

.nx-page-frame__corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(47, 143, 104, 0.7);
  border-style: solid;
  filter: drop-shadow(0 0 5px rgba(47, 143, 104, 0.35));
}
.nx-page-frame__corner--tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
.nx-page-frame__corner--tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.nx-page-frame__corner--bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.nx-page-frame__corner--br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.nx-page-frame__seg {
  position: absolute;
  background: rgba(47, 143, 104, 0.55);
  box-shadow: 0 0 6px rgba(47, 143, 104, 0.3);
}
.nx-page-frame__seg--top {
  top: 0;
  left: 28px;
  right: 28px;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(47, 143, 104, 0.8) 0%,
    rgba(47, 143, 104, 0.25) 35%,
    rgba(168, 216, 255, 0.2) 50%,
    rgba(47, 143, 104, 0.25) 65%,
    rgba(47, 143, 104, 0.8) 100%
  );
}

/* —— IR frame (hero + panels) —— */
.nx-ir-frame {
  position: relative;
  overflow: hidden;
}
.nx-ir-frame__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  filter: grayscale(0.15) contrast(1.12) brightness(0.52);
  transition: filter 0.6s var(--nx-ease);
}
.nx-ir-frame:hover .nx-ir-frame__img,
.nx-ir-frame.is-hot .nx-ir-frame__img {
  filter: sepia(1) hue-rotate(-28deg) saturate(2.6) contrast(1.22) brightness(0.68);
}
.nx-ir-frame .nx-veil,
.nx-ir-frame .nx-mock-hero-veil,
.nx-ir-frame .nx-mock-footer__hero-veil {
  z-index: 1;
}
.nx-ir-frame__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(circle at 55% 42%, rgba(255, 76, 0, 0.32), transparent 48%);
  opacity: 0;
  transition: opacity 0.5s var(--nx-ease);
  mix-blend-mode: screen;
  pointer-events: none;
}
.nx-ir-frame:hover .nx-ir-frame__overlay,
.nx-ir-frame.is-hot .nx-ir-frame__overlay { opacity: 1; }

.nx-ir-frame__reticle {
  position: absolute;
  z-index: 4;
  top: 38%;
  left: 52%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--nx-infrared);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.nx-ir-frame__reticle::before,
.nx-ir-frame__reticle::after {
  content: "";
  position: absolute;
  background: var(--nx-infrared);
}
.nx-ir-frame__reticle::before {
  left: 50%;
  top: -5px;
  bottom: -5px;
  width: 1px;
  transform: translateX(-50%);
}
.nx-ir-frame__reticle::after {
  top: 50%;
  left: -5px;
  right: -5px;
  height: 1px;
  transform: translateY(-50%);
}
.nx-ir-frame:hover .nx-ir-frame__reticle,
.nx-ir-frame.is-hot .nx-ir-frame__reticle {
  opacity: 0.8;
  animation: nx-reticle-pulse 1.5s ease-in-out infinite;
}
@keyframes nx-reticle-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.07); }
}

.nx-ir-frame__box {
  position: absolute;
  z-index: 3;
  border: 1px solid rgba(168, 216, 255, 0.45);
  opacity: 0.45;
  pointer-events: none;
  animation: nx-target-float 4s ease-in-out infinite;
}
.nx-ir-frame__box--1 { width: 16%; height: 20%; top: 22%; left: 44%; }
.nx-ir-frame__box--2 {
  width: 11%;
  height: 13%;
  top: 40%;
  left: 58%;
  animation-delay: -1.2s;
  border-color: rgba(255, 76, 0, 0.55);
}
@keyframes nx-target-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(3px, -5px); }
}

.nx-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, var(--nx-void) 12%, transparent 62%),
    radial-gradient(ellipse 45% 35% at 78% 22%, rgba(30, 74, 56, 0.22), transparent),
    radial-gradient(ellipse 38% 28% at 18% 58%, rgba(76, 89, 107, 0.14), transparent);
}
/* —— Panel crosshairs —— */
.nx-panel--specimen {
  position: relative;
}
.nx-panel--specimen::before,
.nx-panel--specimen::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(168, 216, 255, 0.35);
  pointer-events: none;
  z-index: 1;
}
.nx-panel--specimen::before {
  top: 6px;
  left: 6px;
  border-right: none;
  border-bottom: none;
}
.nx-panel--specimen::after {
  bottom: 6px;
  right: 6px;
  border-left: none;
  border-top: none;
}

/* —— Runway color strip —— */
.nx-runway-strip {
  display: flex;
  height: 3px;
  margin-bottom: var(--nx-space-5);
  gap: 1px;
}
.nx-runway-strip span { flex: 1; }
.nx-runway-strip span:nth-child(1) { background: var(--nx-void); }
.nx-runway-strip span:nth-child(2) { background: var(--nx-phosphor); }
.nx-runway-strip span:nth-child(3) { background: var(--nx-slate); }
.nx-runway-strip span:nth-child(4) { background: var(--nx-ice); }
.nx-runway-strip span:nth-child(5) { background: var(--nx-infrared); }

@media (prefers-reduced-motion: reduce) {
  .nx-hud__rec,
  .nx-ir-frame__box,
  .nx-ir-frame__reticle { animation: none; }
  .nx-ir-frame__img { transition: none; }
}