/* ==========================================================================
   NM INNOVATION HUB — Cyberpunk Effects
   ========================================================================== */

/* ── Scanlines Overlay ──────────────────────────────────────────────────── */
.scanlines::after,
.scanlines-overlay::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: calc(var(--z-toast) + 1);
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.035) 1px,
    rgba(0, 0, 0, 0.035) 2px
  );
  mix-blend-mode: multiply;
  opacity: 0.9;
}

/* ── Grain / Noise Overlay (SVG filter based) ──────────────────────────── */
.grain::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: calc(var(--z-toast) + 2);
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  animation: grain-drift 8s steps(10) infinite;
}

@keyframes grain-drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-5%, -10%);
  }
  30% {
    transform: translate(3%, -15%);
  }
  50% {
    transform: translate(12%, 9%);
  }
  70% {
    transform: translate(9%, 4%);
  }
  90% {
    transform: translate(-1%, 7%);
  }
}

/* ── Glitch Text Effect ────────────────────────────────────────────────── */
.glitch {
  position: relative;
  display: inline-block;
  overflow: hidden;
}

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

/* Subtle ambient glitch */
.glitch::before {
  color: var(--color-cyan-500);
  z-index: -1;
  animation: glitch-ambient-1 4s infinite steps(2) alternate-reverse;
}

.glitch::after {
  color: var(--color-neon-pink);
  z-index: -2;
  animation: glitch-ambient-2 3s infinite steps(2) alternate-reverse;
}

/* Intense glitch on hover / active */
.glitch:hover::before,
.glitch.glitch--active::before {
  animation: glitch-intense-1 0.3s infinite steps(1);
}

.glitch:hover::after,
.glitch.glitch--active::after {
  animation: glitch-intense-2 0.3s infinite steps(1);
}

/* Ambient: subtle, infrequent twitches */
@keyframes glitch-ambient-1 {
  0%, 92% {
    clip-path: inset(0 0 0 0);
    transform: translate(0);
  }
  93% {
    clip-path: inset(30% 0 50% 0);
    transform: translate(-2px, 0);
  }
  95% {
    clip-path: inset(70% 0 10% 0);
    transform: translate(1px, 0);
  }
  97% {
    clip-path: inset(10% 0 80% 0);
    transform: translate(-1px, 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
    transform: translate(0);
  }
}

@keyframes glitch-ambient-2 {
  0%, 90% {
    clip-path: inset(0 0 0 0);
    transform: translate(0);
  }
  91% {
    clip-path: inset(55% 0 25% 0);
    transform: translate(2px, 0);
  }
  94% {
    clip-path: inset(5% 0 75% 0);
    transform: translate(-1px, 0);
  }
  96% {
    clip-path: inset(85% 0 5% 0);
    transform: translate(1px, 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
    transform: translate(0);
  }
}

/* Intense: rapid choppy horizontal strips */
@keyframes glitch-intense-1 {
  0% {
    clip-path: inset(40% 0 35% 0);
    transform: translate(-3px, 0);
  }
  10% {
    clip-path: inset(85% 0 1% 0);
    transform: translate(3px, 0);
  }
  20% {
    clip-path: inset(10% 0 70% 0);
    transform: translate(-2px, 0);
  }
  30% {
    clip-path: inset(60% 0 15% 0);
    transform: translate(2px, 0);
  }
  40% {
    clip-path: inset(5% 0 85% 0);
    transform: translate(-1px, 0);
  }
  50% {
    clip-path: inset(75% 0 5% 0);
    transform: translate(3px, 0);
  }
  60% {
    clip-path: inset(25% 0 55% 0);
    transform: translate(-2px, 0);
  }
  70% {
    clip-path: inset(90% 0 2% 0);
    transform: translate(1px, 0);
  }
  80% {
    clip-path: inset(15% 0 60% 0);
    transform: translate(-3px, 0);
  }
  90% {
    clip-path: inset(50% 0 30% 0);
    transform: translate(2px, 0);
  }
  100% {
    clip-path: inset(0 0 95% 0);
    transform: translate(-1px, 0);
  }
}

@keyframes glitch-intense-2 {
  0% {
    clip-path: inset(65% 0 13% 0);
    transform: translate(2px, 0);
  }
  15% {
    clip-path: inset(3% 0 80% 0);
    transform: translate(-3px, 0);
  }
  30% {
    clip-path: inset(45% 0 25% 0);
    transform: translate(1px, 0);
  }
  45% {
    clip-path: inset(80% 0 3% 0);
    transform: translate(-2px, 0);
  }
  60% {
    clip-path: inset(20% 0 60% 0);
    transform: translate(3px, 0);
  }
  75% {
    clip-path: inset(55% 0 20% 0);
    transform: translate(-1px, 0);
  }
  90% {
    clip-path: inset(8% 0 70% 0);
    transform: translate(2px, 0);
  }
  100% {
    clip-path: inset(70% 0 8% 0);
    transform: translate(-2px, 0);
  }
}

/* ── Neon Glow Pulse ────────────────────────────────────────────────────── */
.neon-glow {
  animation: neon-pulse 3s ease-in-out infinite;
}

@keyframes neon-pulse {
  0%,
  100% {
    box-shadow: 0 0 20px var(--color-cyan-glow), 0 0 40px rgba(0, 168, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 40px var(--color-cyan-glow), 0 0 80px rgba(0, 168, 255, 0.15);
  }
}

/* ── Fade-In on Scroll ──────────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.fade-in:nth-child(1) {
  transition-delay: 0ms;
}
.fade-in:nth-child(2) {
  transition-delay: 80ms;
}
.fade-in:nth-child(3) {
  transition-delay: 160ms;
}
.fade-in:nth-child(4) {
  transition-delay: 240ms;
}
.fade-in:nth-child(5) {
  transition-delay: 320ms;
}
.fade-in:nth-child(6) {
  transition-delay: 400ms;
}
.fade-in:nth-child(7) {
  transition-delay: 560ms;
}
.fade-in:nth-child(8) {
  transition-delay: 640ms;
}
.fade-in:nth-child(9) {
  transition-delay: 720ms;
}
.fade-in:nth-child(10) {
  transition-delay: 800ms;
}
.fade-in:nth-child(11) {
  transition-delay: 880ms;
}
.fade-in:nth-child(12) {
  transition-delay: 960ms;
}
.fade-in:nth-child(13) {
  transition-delay: 1040ms;
}
.fade-in:nth-child(14) {
  transition-delay: 1120ms;
}

/* ── Fade-In Variants ───────────────────────────────────────────────────── */
.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.fade-in-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* ── Counter Animation ──────────────────────────────────────────────────── */
.counter {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* ── Clients Marquee ────────────────────────────────────────────────────── */
.clients-marquee {
  overflow: hidden;
  position: relative;
  width: 100%;
}

.clients-marquee::before,
.clients-marquee::after {
  content: '';
  position: absolute;
  top: 0;
  width: 150px;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.clients-marquee::before {
  left: 0;
  background: linear-gradient(90deg, var(--color-navy-800) 0%, rgba(8, 14, 26, 0.6) 30%, transparent 100%);
}

.clients-marquee::after {
  right: 0;
  background: linear-gradient(270deg, var(--color-navy-800) 0%, rgba(8, 14, 26, 0.6) 30%, transparent 100%);
}

.clients-track {
  display: flex;
  gap: var(--space-4xl);
  animation: scroll-x 70s linear infinite;
  width: max-content;
  align-items: center;
}

.clients-track:hover {
  animation-play-state: paused;
}

@keyframes scroll-x {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.client-logo {
  height: 40px;
  opacity: 0.4;
  filter: grayscale(1) brightness(2);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.client-logo:hover {
  opacity: 0.8;
  filter: grayscale(0) brightness(1);
}

/* ── WhatsApp Float Button ──────────────────────────────────────────────── */
.whatsapp-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-success);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: var(--z-float);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.25);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-base);
  border: none;
}

/* Pulsing ripple ring animation — subtle */
.whatsapp-float::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px solid var(--color-success);
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: whatsapp-ripple 4s ease-out infinite;
  pointer-events: none;
}

@keyframes whatsapp-ripple {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

.whatsapp-float:hover {
  transform: scale(1.1);
  color: #ffffff;
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.35);
}

.whatsapp-float:hover::before {
  animation: none;
  opacity: 0;
}

.whatsapp-float:hover .whatsapp-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-8px);
}

.whatsapp-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(0);
  background: var(--color-navy-600);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  border: 1px solid var(--color-navy-400);
  pointer-events: none;
}

.whatsapp-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--color-navy-600);
}

@keyframes float-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.25);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
  }
}

/* ── Typewriter Cursor ──────────────────────────────────────────────────── */
.typewriter-cursor {
  border-right: 2px solid var(--color-cyan-500);
  padding-right: 2px;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%,
  100% {
    border-color: var(--color-cyan-500);
  }
  50% {
    border-color: transparent;
  }
}

/* ── Orbit Animation (Hero Decorative) ──────────────────────────────────── */
.orbit-ring {
  position: absolute;
  border: 1px solid var(--color-navy-400);
  border-radius: 50%;
  animation: orbit-spin 20s linear infinite;
}

.orbit-ring:nth-child(2) {
  animation-duration: 30s;
  animation-direction: reverse;
}

.orbit-ring:nth-child(3) {
  animation-duration: 25s;
}

.orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--color-cyan-500);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--color-cyan-glow);
}

@keyframes orbit-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ── Circuit Board / Particle Background ────────────────────────────────── */
.circuit-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.circuit-line {
  position: absolute;
  background: linear-gradient(
    180deg,
    transparent,
    var(--color-cyan-dim),
    transparent
  );
  width: 1px;
  height: 100px;
  opacity: 0.3;
  animation: circuit-flow 4s linear infinite;
}

.circuit-line:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
  height: 80px;
}
.circuit-line:nth-child(2) {
  left: 25%;
  animation-delay: 1s;
  height: 120px;
}
.circuit-line:nth-child(3) {
  left: 45%;
  animation-delay: 2s;
  height: 90px;
}
.circuit-line:nth-child(4) {
  left: 65%;
  animation-delay: 0.5s;
  height: 110px;
}
.circuit-line:nth-child(5) {
  left: 80%;
  animation-delay: 3s;
  height: 70px;
}
.circuit-line:nth-child(6) {
  left: 92%;
  animation-delay: 1.5s;
  height: 100px;
}

@keyframes circuit-flow {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(calc(100vh + 100%));
    opacity: 0;
  }
}

/* Circuit nodes */
.circuit-node {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--color-cyan-500);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-cyan-glow);
  opacity: 0.3;
  animation: node-blink 3s ease-in-out infinite;
}

.circuit-node:nth-child(odd) {
  animation-delay: 1.5s;
}

@keyframes node-blink {
  0%,
  100% {
    opacity: 0.1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.5);
  }
}

/* ── Grid Background Pattern ────────────────────────────────────────────── */
.grid-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--color-navy-400) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-navy-400) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.08;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

/* ── Horizontal Scan Line (decorative) ──────────────────────────────────── */
.scan-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-cyan-glow),
    var(--color-cyan-500),
    var(--color-cyan-glow),
    transparent
  );
  opacity: 0.4;
  animation: scan-down 6s linear infinite;
  pointer-events: none;
}

@keyframes scan-down {
  0% {
    top: -2px;
  }
  100% {
    top: 100%;
  }
}

/* ── Liquid Glass Background ───────────────────────────────────────────── */
.liquid-glass {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.liquid-glass + .container {
  position: relative;
  z-index: 2;
}

.glass-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  will-change: transform;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 168, 255, 0.25) 0%, rgba(0, 100, 200, 0.08) 60%, transparent 80%);
  top: -10%;
  right: -8%;
  animation: blob-drift-1 18s ease-in-out infinite;
}

.blob-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(157, 0, 255, 0.18) 0%, rgba(100, 0, 200, 0.05) 60%, transparent 80%);
  bottom: 5%;
  right: 10%;
  animation: blob-drift-2 22s ease-in-out infinite;
}

.blob-3 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(0, 168, 255, 0.15) 0%, transparent 70%);
  top: 30%;
  left: -5%;
  animation: blob-drift-3 20s ease-in-out infinite;
}

.blob-4 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 0, 102, 0.1) 0%, transparent 70%);
  top: 10%;
  right: 30%;
  animation: blob-drift-4 25s ease-in-out infinite;
}

.blob-5 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.1) 0%, transparent 70%);
  bottom: -15%;
  left: 20%;
  animation: blob-drift-5 16s ease-in-out infinite;
}

@keyframes blob-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-40px, 30px) scale(1.05); }
  50% { transform: translate(-20px, 60px) scale(0.95); }
  75% { transform: translate(20px, 20px) scale(1.02); }
}

@keyframes blob-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.08); }
  50% { transform: translate(50px, -20px) scale(0.92); }
  75% { transform: translate(10px, -50px) scale(1.04); }
}

@keyframes blob-drift-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.06); }
  66% { transform: translate(15px, 25px) scale(0.94); }
}

@keyframes blob-drift-4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  30% { transform: translate(-25px, 35px) scale(1.1); }
  60% { transform: translate(20px, 15px) scale(0.9); }
}

@keyframes blob-drift-5 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(35px, -30px) scale(1.07); }
}

/* Purple-tinted glass for testimonials/about sections */
.liquid-glass--purple .blob-1 {
  background: radial-gradient(circle, rgba(157, 0, 255, 0.2) 0%, transparent 70%);
}
.liquid-glass--purple .blob-2 {
  background: radial-gradient(circle, rgba(0, 168, 255, 0.15) 0%, transparent 70%);
}

/* Green-tinted glass for CTA sections */
.liquid-glass--green .blob-1 {
  background: radial-gradient(circle, rgba(37, 211, 102, 0.15) 0%, transparent 70%);
}
.liquid-glass--green .blob-2 {
  background: radial-gradient(circle, rgba(0, 168, 255, 0.12) 0%, transparent 70%);
}

/* Subtle version for general sections */
.liquid-glass--subtle .glass-blob {
  opacity: 0.25;
}

@media (max-width: 768px) {
  .glass-blob { filter: blur(60px); opacity: 0.35; }
  .blob-1 { width: 300px; height: 300px; }
  .blob-2 { width: 200px; height: 200px; }
  .blob-3 { width: 180px; height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .glass-blob { animation: none; }
  .neon-glow { animation: none; }
  .typewriter-cursor { animation: none; }
  .section-label::after { animation: none; }
}

/* ── Glassmorphism ──────────────────────────────────────────────────────── */
.glass-card {
  background: rgba(15, 26, 46, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(26, 42, 68, 0.8);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  transition: all var(--transition-smooth);
}

.glass-card:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(0, 168, 255, 0.3);
  box-shadow: 0 12px 40px rgba(0, 168, 255, 0.1);
  transform: translateY(-4px);
}

/* ── Mesh Network / Tech Orb ────────────────────────────────────────────── */
.mesh-network-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle at center, var(--color-cyan-glow) 0%, rgba(5, 10, 20, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
  filter: blur(40px);
  animation: pulse-mesh 8s ease-in-out infinite alternate;
}

.mesh-network-bg::before,
.mesh-network-bg::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(0, 168, 255, 0.2);
}

.mesh-network-bg::before {
  width: 60%;
  height: 60%;
  animation: spin-slow 20s linear infinite;
  border-top-color: var(--color-cyan-500);
}

.mesh-network-bg::after {
  width: 85%;
  height: 85%;
  animation: spin-slow 30s linear infinite reverse;
  border-bottom-color: var(--color-cyan-400);
}

@keyframes pulse-mesh {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.9; }
}

@keyframes spin-slow {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
