/* ===========================
   CRT SCANLINE OVERLAY
   =========================== */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.03) 0px,
    rgba(0, 0, 0, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ===========================
   BLINKING CURSOR
   =========================== */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.terminal__cursor {
  animation: blink 1s step-end infinite;
}

/* ===========================
   TEXT FLICKER (hero heading)
   =========================== */
@keyframes flicker {
  0%, 97%, 100% { opacity: 1; }
  98% { opacity: 0.8; }
  99% { opacity: 0.9; }
}

.hero__text h1 {
  animation: flicker 4s infinite;
}

/* ===========================
   FADE-IN UP (scroll reveal)
   =========================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   TYPING EFFECT
   =========================== */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

.typing-line {
  overflow: hidden;
  white-space: pre;
  display: block;
  width: 0;
  font-family: var(--font-body);
}

.typing-line.active {
  animation: typing 1s steps(40) forwards;
}

/* ===========================
   GLOW PULSE (for CTA button)
   =========================== */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 5px var(--green-glow);
  }
  50% {
    box-shadow: 0 0 20px var(--green-glow-strong), 0 0 40px var(--green-glow);
  }
}

.btn--primary {
  animation: glowPulse 3s ease-in-out infinite;
}

.btn--primary:hover {
  animation: none;
}

/* ===========================
   CARD HOVER GLOW
   =========================== */
.lib-card {
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-base);
}

.lib-card:hover {
  transform: translateY(-4px);
}

/* ===========================
   NAV LINK UNDERLINE
   =========================== */
.nav__link {
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--green-terminal);
  transition: width var(--transition-base);
}

.nav__link:hover::after {
  width: 100%;
}

/* ===========================
   LOGO FLOAT (disabled)
   =========================== */

/* ===========================
   STAGGER CHILDREN (for grid reveals)
   =========================== */
.armory-grid .lib-card.reveal.visible:nth-child(1) { transition-delay: 0ms; }
.armory-grid .lib-card.reveal.visible:nth-child(2) { transition-delay: 100ms; }
.armory-grid .lib-card.reveal.visible:nth-child(3) { transition-delay: 200ms; }
.armory-grid .lib-card.reveal.visible:nth-child(4) { transition-delay: 300ms; }

/* ===========================
   MOBILE PERFORMANCE
   =========================== */
@media (max-width: 768px) {
  body::after {
    display: none;
  }

  .btn--primary {
    animation: none;
  }

  .lib-card:hover {
    transform: none;
  }
}

/* ===========================
   REDUCED MOTION
   =========================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body::after {
    display: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .btn--primary {
    animation: none;
  }
}
