/* ==========================================================================
   Mesh Background Effects
   ========================================================================== */

:root {
  --mesh-blur: 30px;
  --mesh-scale: 1.5;
  --mesh-rotation: 0deg;
  --mesh-animation-duration: 10s;
  --mesh-color-1: rgba(0, 113, 227, 0.7);    /* Guardia Blue */
  --mesh-color-2: rgba(41, 0, 163, 0.7);     /* Guardia Blue Dark */
  --mesh-color-3: rgba(164, 0, 142, 0.88);   /* Guardia Blue Darker */
  --particle-count: 10;
  --particle-size: 2px;
  --particle-color: rgba(255, 255, 255, 0.5);
}

.motion-mesh-bg {
  position: relative;
  background: #000000;
  overflow: hidden;
  min-height: 400px;
  width: 100%;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  perspective: 1000;
}

.motion-mesh-bg::before {
  content: '';
  position: absolute;
  inset: -100%;
  background: 
    radial-gradient(circle at 20% 80%, var(--mesh-color-1) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, var(--mesh-color-2) 0%, transparent 40%),
    radial-gradient(circle at 40% 40%, var(--mesh-color-3) 0%, transparent 40%);
  -webkit-filter: blur(var(--mesh-blur));
  filter: blur(var(--mesh-blur));
  -webkit-animation: meshFloat var(--mesh-animation-duration) ease-in-out infinite;
  animation: meshFloat var(--mesh-animation-duration) ease-in-out infinite;
  -webkit-transform: translate3d(0, 0, 0) scale(var(--mesh-scale)) rotate(var(--mesh-rotation));
  transform: translate3d(0, 0, 0) scale(var(--mesh-scale)) rotate(var(--mesh-rotation));
  -webkit-will-change: transform;
  will-change: transform;
}

.motion-mesh-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
  opacity: 0.5;
  mix-blend-mode: overlay;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Partículas */
.floating-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

.particle {
  position: absolute;
  width: var(--particle-size);
  height: var(--particle-size);
  background: var(--particle-color);
  border-radius: 50%;
  pointer-events: none;
  animation: floatParticle 20s linear infinite;
}

@keyframes floatParticle {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) translateX(100px);
    opacity: 0;
  }
}

@-webkit-keyframes meshFloat {
  0%, 100% {
    -webkit-transform: translate3d(0, 0, 0) scale(var(--mesh-scale)) rotate(var(--mesh-rotation));
    transform: translate3d(0, 0, 0) scale(var(--mesh-scale)) rotate(var(--mesh-rotation));
  }
  25% {
    -webkit-transform: translate3d(-100px, -100px, 0) scale(calc(var(--mesh-scale) * 1.2)) rotate(calc(var(--mesh-rotation) + 5deg));
    transform: translate3d(-100px, -100px, 0) scale(calc(var(--mesh-scale) * 1.2)) rotate(calc(var(--mesh-rotation) + 5deg));
  }
  50% {
    -webkit-transform: translate3d(100px, -50px, 0) scale(calc(var(--mesh-scale) * 0.8)) rotate(calc(var(--mesh-rotation) - 5deg));
    transform: translate3d(100px, -50px, 0) scale(calc(var(--mesh-scale) * 0.8)) rotate(calc(var(--mesh-rotation) - 5deg));
  }
  75% {
    -webkit-transform: translate3d(-50px, 100px, 0) scale(calc(var(--mesh-scale) * 1.1)) rotate(calc(var(--mesh-rotation) + 3deg));
    transform: translate3d(-50px, 100px, 0) scale(calc(var(--mesh-scale) * 1.1)) rotate(calc(var(--mesh-rotation) + 3deg));
  }
}

@keyframes meshFloat {
  0%, 100% {
    -webkit-transform: translate3d(0, 0, 0) scale(var(--mesh-scale)) rotate(var(--mesh-rotation));
    transform: translate3d(0, 0, 0) scale(var(--mesh-scale)) rotate(var(--mesh-rotation));
  }
  25% {
    -webkit-transform: translate3d(-100px, -100px, 0) scale(calc(var(--mesh-scale) * 1.2)) rotate(calc(var(--mesh-rotation) + 5deg));
    transform: translate3d(-100px, -100px, 0) scale(calc(var(--mesh-scale) * 1.2)) rotate(calc(var(--mesh-rotation) + 5deg));
  }
  50% {
    -webkit-transform: translate3d(100px, -50px, 0) scale(calc(var(--mesh-scale) * 0.8)) rotate(calc(var(--mesh-rotation) - 5deg));
    transform: translate3d(100px, -50px, 0) scale(calc(var(--mesh-scale) * 0.8)) rotate(calc(var(--mesh-rotation) - 5deg));
  }
  75% {
    -webkit-transform: translate3d(-50px, 100px, 0) scale(calc(var(--mesh-scale) * 1.1)) rotate(calc(var(--mesh-rotation) + 3deg));
    transform: translate3d(-50px, 100px, 0) scale(calc(var(--mesh-scale) * 1.1)) rotate(calc(var(--mesh-rotation) + 3deg));
  }
}

/* Ajustes para mobile */
@media (max-width: 768px) {
  .motion-mesh-bg::before {
    --mesh-blur: 20px;
    --mesh-scale: 1.2;
    --mesh-color-1: rgba(0, 113, 227, 0.8);    /* Guardia Blue */
    --mesh-color-2: rgba(41, 0, 163, 0.8);     /* Guardia Blue Dark */
    --mesh-color-3: rgba(164, 0, 142, 0.88);   /* Guardia Blue Darker */
    -webkit-animation-duration: 15s;
    animation-duration: 15s;
  }
  :root {
    --particle-count: 30;
    --particle-size: 1.5px;
  }
}

@media (max-width: 480px) {
  .motion-mesh-bg::before {
    --mesh-blur: 15px;
    --mesh-scale: 1;
    --mesh-color-1: rgba(0, 113, 227, 0.9);
    --mesh-color-2: rgba(0, 81, 163, 0.9);
  }
  :root {
    --particle-count: 20;
    --particle-size: 1px;
  }
}

/* Ajustes para navegadores específicos */
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) {
  .motion-mesh-bg::before {
    -webkit-backdrop-filter: blur(var(--mesh-blur));
    backdrop-filter: blur(var(--mesh-blur));
  }
}

/* Ajustes para dispositivos com baixo poder de processamento */
@media (prefers-reduced-motion: reduce) {
  .motion-mesh-bg::before {
    -webkit-animation: none;
    animation: none;
  }
  .particle {
    display: none;
  }
} 