/* ============================================================
   ambient.css — Canvas 3D, mesh fallback y textura de ruido.
   ============================================================ */

.ambient-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Fallback CSS mesh (móvil / reduced-motion) */
.ambient-mesh {
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 40% at 70% 30%, rgba(59, 130, 246, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 45% 35% at 25% 70%, rgba(16, 185, 129, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse 30% 25% at 50% 50%, rgba(20, 184, 166, 0.1) 0%, transparent 45%);
  animation: meshDrift 18s ease-in-out infinite alternate;
  filter: blur(40px);
}

[data-theme="light"] .ambient-mesh {
  background:
    radial-gradient(ellipse 50% 40% at 70% 30%, rgba(37, 99, 235, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 45% 35% at 25% 70%, rgba(5, 150, 105, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 30% 25% at 50% 50%, rgba(13, 148, 136, 0.08) 0%, transparent 45%);
}

@keyframes meshDrift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(2%, -3%) scale(1.05); }
}

/* Textura de ruido premium */
.noise-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

[data-theme="light"] .noise-overlay::after {
  opacity: 0.025;
}

@media (prefers-reduced-motion: reduce) {
  .ambient-mesh {
    animation: none;
  }
}
