/* ==========================================
   EFFECTS v2 — Scanlines, Glitch, Neon, Holographic
   Enhanced with deeper immersion & new effects
   ========================================== */

/* ========== SCANLINE OVERLAY ========== */
.scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.04) 0px,
    rgba(0, 0, 0, 0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.35;
}

/* Animated sweep line */
.scanline-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 240, 255, 0.06),
    rgba(0, 240, 255, 0.1),
    rgba(0, 240, 255, 0.06),
    transparent
  );
  animation: scanline-sweep 6s linear infinite;
}

@keyframes scanline-sweep {
  0%   { transform: translateY(-100vh); }
  100% { transform: translateY(100vh); }
}

/* ========== GLITCH TEXT — Multi-layer ========== */
.glitch-text {
  position: relative;
  display: inline-block;
  color: var(--text-primary);
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.glitch-text::before {
  color: var(--cyan);
  animation: glitch-shift-1 4s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
  z-index: -1;
}

.glitch-text::after {
  color: var(--magenta);
  animation: glitch-shift-2 3.5s infinite linear alternate-reverse;
  clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
  z-index: -1;
}

@keyframes glitch-shift-1 {
  0%, 85%, 100% { transform: translate(0); opacity: 0.8; }
  86% { transform: translate(-4px, 2px); opacity: 1; }
  88% { transform: translate(4px, -1px); opacity: 0.9; }
  90% { transform: translate(-3px, 0px); opacity: 1; }
  92% { transform: translate(5px, 2px); opacity: 0.7; }
  94% { transform: translate(-2px, -2px); opacity: 1; }
  96% { transform: translate(3px, 1px) skewX(-2deg); opacity: 0.8; }
  98% { transform: translate(-4px, -1px); opacity: 1; }
}

@keyframes glitch-shift-2 {
  0%, 82%, 100% { transform: translate(0); opacity: 0.8; }
  83% { transform: translate(3px, -3px); opacity: 1; }
  86% { transform: translate(-5px, 2px); opacity: 0.9; }
  89% { transform: translate(2px, 1px) skewX(3deg); opacity: 1; }
  91% { transform: translate(-3px, -2px); opacity: 0.7; }
  94% { transform: translate(4px, 2px); opacity: 1; }
  97% { transform: translate(-2px, -1px); opacity: 0.8; }
}

/* Intense glitch on hover */
.glitch-text:hover::before {
  animation-duration: 0.2s;
}
.glitch-text:hover::after {
  animation-duration: 0.15s;
}

/* ========== NEON GLOW CLASSES ========== */
.neon-glow-cyan {
  text-shadow:
    0 0 7px var(--cyan-glow),
    0 0 20px rgba(0, 240, 255, 0.25),
    0 0 42px rgba(0, 240, 255, 0.12),
    0 0 80px rgba(0, 240, 255, 0.06);
}

.neon-glow-magenta {
  text-shadow:
    0 0 7px var(--magenta-glow),
    0 0 20px rgba(255, 0, 170, 0.25),
    0 0 42px rgba(255, 0, 170, 0.12),
    0 0 80px rgba(255, 0, 170, 0.06);
}

.neon-glow-green {
  text-shadow:
    0 0 7px var(--neon-green-glow),
    0 0 20px rgba(57, 255, 20, 0.25),
    0 0 42px rgba(57, 255, 20, 0.12);
}

.neon-box-cyan {
  box-shadow: var(--shadow-neon-cyan);
  border: var(--border-glow);
}

.neon-box-magenta {
  box-shadow: var(--shadow-neon-magenta);
  border: var(--border-magenta);
}

/* ========== NEON FLICKER — Randomized ========== */
.neon-flicker {
  animation: neon-flicker-anim 5s infinite;
}

@keyframes neon-flicker-anim {
  0%, 18%, 22%, 25%, 53%, 57%, 100% {
    opacity: 1;
    text-shadow:
      0 0 7px var(--cyan-glow),
      0 0 20px rgba(0, 240, 255, 0.25),
      0 0 42px rgba(0, 240, 255, 0.12);
  }
  20%, 24%, 55% {
    opacity: 0.8;
    text-shadow: none;
  }
  21% {
    opacity: 0.4;
    text-shadow: none;
  }
}

/* ========== TYPEWRITER ========== */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--cyan);
  animation: typewriter-cursor 0.75s step-end infinite;
  width: 0;
}

.typewriter.active {
  animation:
    typewriter-reveal 2.5s steps(50, end) forwards,
    typewriter-cursor 0.75s step-end infinite;
}

@keyframes typewriter-reveal {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes typewriter-cursor {
  from, to { border-color: var(--cyan); }
  50% { border-color: transparent; }
}

/* ========== HOLOGRAPHIC SHIMMER ========== */
.holo-shimmer {
  position: relative;
  overflow: hidden;
}

.holo-shimmer::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(0, 240, 255, 0.04) 40%,
    rgba(124, 58, 237, 0.06) 50%,
    rgba(255, 0, 170, 0.04) 60%,
    transparent 70%
  );
  animation: holo-sweep 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes holo-sweep {
  0% { transform: translateX(-30%) translateY(-30%) rotate(0deg); }
  50% { transform: translateX(30%) translateY(30%) rotate(180deg); }
  100% { transform: translateX(-30%) translateY(-30%) rotate(360deg); }
}

/* ========== CIRCUIT DIVIDER — Enhanced ========== */
.circuit-divider {
  position: relative;
  width: 100%;
  height: 80px;
  overflow: hidden;
  opacity: 0.3;
}

.circuit-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--cyan-dim) 10%,
    var(--cyan) 20%,
    transparent 22%,
    transparent 35%,
    var(--violet) 45%,
    var(--magenta) 55%,
    transparent 57%,
    transparent 70%,
    var(--cyan-dim) 80%,
    var(--neon-green) 90%,
    transparent 100%
  );
}

.circuit-divider::after {
  content: '';
  position: absolute;
  top: calc(50% - 3px);
  left: 20%;
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow:
    0 0 6px var(--cyan),
    calc(15vw) 0 0 var(--violet),
    calc(15vw) 0 6px var(--violet),
    calc(35vw) 0 0 var(--magenta),
    calc(35vw) 0 6px var(--magenta),
    calc(55vw) 0 0 var(--neon-green),
    calc(55vw) 0 6px var(--neon-green);
  animation: circuit-pulse 3s ease-in-out infinite;
}

@keyframes circuit-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ========== FLOATING ANIMATION ========== */
.float {
  animation: float-y 6s ease-in-out infinite;
}

.float-delay-1 { animation-delay: -1.5s; }
.float-delay-2 { animation-delay: -3s; }
.float-delay-3 { animation-delay: -4.5s; }

@keyframes float-y {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
}

/* ========== PULSE RING ========== */
.pulse-ring {
  position: relative;
}
.pulse-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  animation: pulse-ring-anim 2s ease-out infinite;
}

@keyframes pulse-ring-anim {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* ========== FADE / REVEAL HELPERS ========== */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-spring);
}

.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* ========== GLOW PULSE — for interactive elements ========== */
@keyframes glow-pulse-cyan {
  0%, 100% { box-shadow: 0 0 5px var(--cyan-glow), 0 0 15px rgba(0,240,255,0.08); }
  50% { box-shadow: 0 0 10px var(--cyan-glow), 0 0 30px rgba(0,240,255,0.15), 0 0 60px rgba(0,240,255,0.05); }
}

@keyframes glow-pulse-magenta {
  0%, 100% { box-shadow: 0 0 5px var(--magenta-glow), 0 0 15px rgba(255,0,170,0.08); }
  50% { box-shadow: 0 0 10px var(--magenta-glow), 0 0 30px rgba(255,0,170,0.15), 0 0 60px rgba(255,0,170,0.05); }
}

/* ========== ORBIT PULSE — light traveling along path ========== */
@keyframes orbit-pulse {
  0% { opacity: 0; transform: scale(0.5); }
  10% { opacity: 1; transform: scale(1); }
  90% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.5); }
}

/* ========== DATA STREAM — vertical code rain hint ========== */
.data-stream-bg {
  position: relative;
}

.data-stream-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(0deg,
      transparent 0%,
      rgba(0, 240, 255, 0.01) 50%,
      transparent 100%
    );
  pointer-events: none;
  z-index: 0;
  animation: data-stream-flow 10s linear infinite;
}

@keyframes data-stream-flow {
  0% { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

/* ========== NOISE TEXTURE ========== */
.noise-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  pointer-events: none;
  z-index: 0;
}

/* ========== BORDER GLOW ANIMATION ========== */
@keyframes border-glow-rotate {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ========== HERO FLOATING CODE SNIPPETS ========== */
.hero-code-float {
  position: absolute;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-dim);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
  text-shadow: 0 0 4px rgba(0, 240, 255, 0.1);
  z-index: 1;
}

.hero-code-float.active {
  opacity: 0.3;
}

.hero-code-float:nth-child(odd) {
  color: var(--cyan-dim);
  opacity: 0.15;
}

.hero-code-float:nth-child(even) {
  color: var(--magenta-dim);
  opacity: 0.12;
}
