/*=============== PERFORMANCE OPTIMIZATIONS ===============*/
/* Optimizar elementos animados para GPU */
.hero__title,
.typing-effect,
.glitch-effect,
.float-animation,
.particles-canvas,
canvas#particles-canvas {
  will-change: transform;
  contain: layout style paint;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Prevenir layout shifts en elementos que cambian */
.service-card,
.feature-card,
.blog-card {
  contain: layout style;
}

/* Mejorar performance de hover */
.btn,
.service-card,
.feature-card {
  will-change: auto;
}

.btn:hover,
.service-card:hover,
.feature-card:hover {
  will-change: transform, box-shadow;
}

/*=============== ANIMATIONS.CSS ===============*/
/* Efectos especiales y animaciones para Normandia Web */

/*=============== FADE IN ANIMATIONS ===============*/
[data-aos] {
  opacity: 0;
  transition-property: opacity, transform;
  transition-duration: 0.6s;
  transition-timing-function: ease-out;
}

[data-aos].aos-animate {
  opacity: 1;
}

[data-aos="fade-up"] {
  transform: translateY(50px);
}

[data-aos="fade-up"].aos-animate {
  transform: translateY(0);
}

[data-aos="fade-right"] {
  transform: translateX(-50px);
}

[data-aos="fade-right"].aos-animate {
  transform: translateX(0);
}

[data-aos="fade-left"] {
  transform: translateX(50px);
}

[data-aos="fade-left"].aos-animate {
  transform: translateX(0);
}

/*=============== TYPING EFFECT ===============*/
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

.typing-animation {
  overflow: hidden;
  border-right: 3px solid var(--color-verde-lima);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

/*=============== GLOW EFFECTS ===============*/
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 5px currentColor,
                0 0 10px currentColor,
                0 0 20px currentColor;
  }
  50% {
    box-shadow: 0 0 10px currentColor,
                0 0 20px currentColor,
                0 0 40px currentColor;
  }
}

.glow-red {
  animation: glow-pulse 2s ease-in-out infinite;
  color: var(--color-rojo-coral);
}

.glow-green {
  animation: glow-pulse 2s ease-in-out infinite;
  color: var(--color-verde-lima);
}

.glow-blue {
  animation: glow-pulse 2s ease-in-out infinite;
  color: var(--color-azul-cyan);
}

/*=============== SCANLINE EFFECT ===============*/
@keyframes scanline {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100vh);
  }
}

.scanline-effect::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    rgba(127, 216, 86, 0.3),
    transparent
  );
  animation: scanline 8s linear infinite;
  pointer-events: none;
  z-index: 9999;
}

/*=============== GLITCH EFFECT ===============*/
@keyframes glitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}

.glitch {
  position: relative;
}

.glitch:hover {
  animation: glitch 0.3s infinite;
}

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

.glitch:hover::before {
  color: var(--color-rojo-coral);
  animation: glitch-before 0.3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  opacity: 0.8;
}

.glitch:hover::after {
  color: var(--color-azul-cyan);
  animation: glitch-after 0.3s infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  opacity: 0.8;
}

@keyframes glitch-before {
  0%, 100% {
    transform: translate(0);
  }
  33% {
    transform: translate(-2px, 0);
  }
  66% {
    transform: translate(2px, 0);
  }
}

@keyframes glitch-after {
  0%, 100% {
    transform: translate(0);
  }
  33% {
    transform: translate(2px, 0);
  }
  66% {
    transform: translate(-2px, 0);
  }
}

/*=============== FLOATING ANIMATION ===============*/
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/*=============== ROTATE ANIMATION ===============*/
@keyframes rotate-360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotate-animation {
  animation: rotate-360 20s linear infinite;
}

/*=============== PULSE ANIMATION ===============*/
@keyframes pulse-scale {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.pulse-animation {
  animation: pulse-scale 2s ease-in-out infinite;
}

/*=============== TEXT SHADOW GLOW ===============*/
@keyframes text-glow {
  0%, 100% {
    text-shadow: 0 0 5px currentColor,
                 0 0 10px currentColor;
  }
  50% {
    text-shadow: 0 0 10px currentColor,
                 0 0 20px currentColor,
                 0 0 30px currentColor;
  }
}

.text-glow-animation {
  animation: text-glow 2s ease-in-out infinite;
}

/*=============== SLIDE IN ANIMATIONS ===============*/
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.slide-in-up {
  animation: slideInUp 0.6s ease-out;
}

/*=============== BORDER ANIMATION ===============*/
@keyframes border-dance {
  0%, 100% {
    border-color: var(--color-rojo-coral);
  }
  25% {
    border-color: var(--color-naranja);
  }
  50% {
    border-color: var(--color-verde-lima);
  }
  75% {
    border-color: var(--color-azul-cyan);
  }
}

.border-dance {
  animation: border-dance 4s linear infinite;
}

/*=============== GRADIENT ANIMATION ===============*/
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-animation {
  background: linear-gradient(
    270deg,
    var(--color-rojo-coral),
    var(--color-naranja),
    var(--color-verde-lima),
    var(--color-azul-cyan)
  );
  background-size: 300% 300%;
  animation: gradient-shift 15s ease infinite;
}

/*=============== SHAKE ANIMATION ===============*/
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.shake-animation {
  animation: shake 0.5s ease-in-out;
}

/*=============== ZOOM IN ANIMATION ===============*/
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.zoom-in-animation {
  animation: zoomIn 0.5s ease-out;
}

/*=============== FADE IN DOWN ===============*/
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-down {
  animation: fadeInDown 0.6s ease-out;
}

/*=============== LOADING SPINNER ===============*/
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-gris-oscuro);
  border-top-color: var(--color-verde-lima);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/*=============== TYPEWRITER CURSOR ===============*/
@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

.cursor-blink {
  animation: blink 1s step-end infinite;
}

/*=============== NEON GLOW BORDER ===============*/
@keyframes neon-border {
  0%, 100% {
    box-shadow:
      0 0 5px var(--color-verde-lima),
      0 0 10px var(--color-verde-lima),
      inset 0 0 5px var(--color-verde-lima);
  }
  50% {
    box-shadow:
      0 0 10px var(--color-verde-lima),
      0 0 20px var(--color-verde-lima),
      inset 0 0 10px var(--color-verde-lima);
  }
}

.neon-border {
  animation: neon-border 2s ease-in-out infinite;
}

/*=============== WAVE ANIMATION ===============*/
@keyframes wave {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(20deg);
  }
  75% {
    transform: rotate(-20deg);
  }
}

.wave-animation {
  display: inline-block;
  animation: wave 2s ease-in-out infinite;
  transform-origin: 70% 70%;
}

/*=============== MATRIX RAIN EFFECT ===============*/
@keyframes matrix-rain {
  0% {
    top: -100%;
  }
  100% {
    top: 100%;
  }
}

.matrix-char {
  position: absolute;
  color: var(--color-verde-lima);
  font-family: var(--font-family);
  font-size: 14px;
  opacity: 0.7;
  animation: matrix-rain linear infinite;
}

/*=============== PROGRESS BAR ANIMATION ===============*/
@keyframes progress {
  from {
    width: 0%;
  }
  to {
    width: var(--progress-width, 100%);
  }
}

.progress-bar {
  animation: progress 2s ease-out forwards;
}

/*=============== UTILITY ANIMATION CLASSES ===============*/
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/*=============== HOVER EFFECTS ===============*/
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(127, 216, 86, 0.2);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px var(--color-verde-lima),
              0 0 40px var(--color-verde-lima);
}

.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/*=============== LOADING STATES ===============*/
@keyframes skeleton-loading {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-negro-card) 0%,
    var(--color-gris-oscuro) 50%,
    var(--color-negro-card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

/*=============== PAGE TRANSITIONS ===============*/
@keyframes page-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page-transition {
  animation: page-fade-in 0.5s ease-out;
}

/*=============== SCROLL REVEAL ===============*/
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/*=============== RESPONSIVE ANIMATIONS ===============*/
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media screen and (max-width: 768px) {
  /* Reduce animation intensity on mobile */
  .float-animation {
    animation-duration: 4s;
  }

  .rotate-animation {
    animation-duration: 30s;
  }

  .glow-pulse {
    animation: none;
  }
}
