/* ============================================
   Background Effects
   Gradient mesh, mouse glow, dot grids
   ============================================ */

/* === Animated Gradient Mesh === */

.bg-mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(14, 165, 233, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(2, 132, 199, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(249, 115, 22, 0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 60%, rgba(5, 150, 105, 0.05) 0%, transparent 45%);
  background-size: 200% 200%, 200% 200%, 200% 200%, 200% 200%;
  animation: meshShift 20s ease-in-out infinite;
}

@keyframes meshShift {
  0% {
    background-position: 0% 50%, 100% 50%, 50% 100%, 80% 20%;
  }
  25% {
    background-position: 50% 0%, 0% 100%, 100% 50%, 20% 80%;
  }
  50% {
    background-position: 100% 50%, 50% 0%, 0% 50%, 60% 40%;
  }
  75% {
    background-position: 50% 100%, 100% 50%, 50% 0%, 40% 60%;
  }
  100% {
    background-position: 0% 50%, 100% 50%, 50% 100%, 80% 20%;
  }
}

/* Ensure content sits above mesh */
.hero > .container,
.product-hero > .container,
.pricing-hero > .container,
.contact-hero > .container,
.about-hero > .container,
.section-cta-final > .container,
.section-footer-cta > .container {
  position: relative;
  z-index: 1;
}


/* === Mouse Glow Follower === */

.mouse-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.07) 0%, rgba(14, 165, 233, 0.03) 30%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: left, top;
}


/* === Dot Grid Pattern Overlay === */

.bg-dot-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: radial-gradient(circle, var(--color-border) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 20%, rgba(0,0,0,0.3) 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 20%, rgba(0,0,0,0.3) 80%, transparent 100%);
}

/* Ensure section content sits above grid */
.section-alt > .container {
  position: relative;
  z-index: 1;
}


/* === Subtle Grain Texture on Body === */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  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-repeat: repeat;
  background-size: 256px 256px;
  mix-blend-mode: multiply;
}


/* === Section Divider Lines with Gradient === */

.section + .section:not(.section-alt):not(.section-cta-final)::before,
.section-alt + .section:not(.section-cta-final)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--color-border) 30%, var(--color-primary-glow) 50%, var(--color-border) 70%, transparent 100%);
  pointer-events: none;
}


/* === Reduced Motion === */

@media (prefers-reduced-motion: reduce) {
  .bg-mesh {
    animation: none !important;
  }
  .mouse-glow {
    display: none;
  }
  .bg-dot-grid {
    display: none;
  }
  body::before {
    display: none;
  }
}


/* === Performance: tone down on small screens === */

@media (max-width: 768px) {
  .bg-mesh {
    animation-duration: 30s;
  }
  .bg-dot-grid {
    opacity: 0.2;
  }
}
