/* ========================================
   ANIMACIONES - FADE
   ======================================== */
.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

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

.fade-in-delay-1 {
  animation: fadeIn 0.8s ease-out 0.2s forwards;
  opacity: 0;
}

.fade-in-delay-2 {
  animation: fadeIn 0.8s ease-out 0.4s forwards;
  opacity: 0;
}

.fade-in-delay-3 {
  animation: fadeIn 0.8s ease-out 0.6s forwards;
  opacity: 0;
}

/* ========================================
   ANIMACIONES - SLIDE
   ======================================== */
.slide-up {
  animation: slideUp 0.6s ease-out forwards;
}

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

.slide-down {
  animation: slideDown 0.4s ease-out forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-left {
  animation: slideLeft 0.6s ease-out forwards;
}

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

.slide-right {
  animation: slideRight 0.6s ease-out forwards;
}

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

/* ========================================
   ANIMACIONES - GLITCH
   ======================================== */
.glitch {
  position: relative;
  animation: glitch-skew 2s infinite;
}

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

.glitch::before {
  animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
  color: #ff00ff;
  z-index: -1;
}

.glitch::after {
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
  color: #00ffff;
  z-index: -2;
}

@keyframes glitch-anim-1 {
  0% {
    clip-path: inset(40% 0 61% 0);
    transform: translate(0);
  }
  20% {
    clip-path: inset(92% 0 1% 0);
    transform: translate(-2px, 2px);
  }
  40% {
    clip-path: inset(43% 0 1% 0);
    transform: translate(-2px, -2px);
  }
  60% {
    clip-path: inset(25% 0 58% 0);
    transform: translate(2px, 2px);
  }
  80% {
    clip-path: inset(54% 0 7% 0);
    transform: translate(2px, -2px);
  }
  100% {
    clip-path: inset(58% 0 43% 0);
    transform: translate(0);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip-path: inset(65% 0 10% 0);
    transform: translate(0);
  }
  20% {
    clip-path: inset(17% 0 15% 0);
    transform: translate(2px, -2px);
  }
  40% {
    clip-path: inset(38% 0 29% 0);
    transform: translate(2px, 2px);
  }
  60% {
    clip-path: inset(69% 0 6% 0);
    transform: translate(-2px, 2px);
  }
  80% {
    clip-path: inset(76% 0 4% 0);
    transform: translate(-2px, -2px);
  }
  100% {
    clip-path: inset(12% 0 84% 0);
    transform: translate(0);
  }
}

@keyframes glitch-skew {
  0%, 100% {
    transform: skew(0deg);
  }
  20% {
    transform: skew(0.5deg);
  }
  40% {
    transform: skew(-0.5deg);
  }
  60% {
    transform: skew(0.3deg);
  }
  80% {
    transform: skew(-0.3deg);
  }
}

/* ========================================
   ANIMACIONES - TYPEWRITER
   ======================================== */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--color-primary);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
  display: inline-block;
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--color-primary);
  }
}

/* ========================================
   ANIMACIONES - PULSE/GLOW
   ======================================== */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

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

@keyframes glow {
  from {
    box-shadow: 0 0 5px rgba(147, 51, 234, 0.4),
                0 0 10px rgba(147, 51, 234, 0.3),
                0 0 15px rgba(147, 51, 234, 0.2);
  }
  to {
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.6),
                0 0 20px rgba(147, 51, 234, 0.4),
                0 0 30px rgba(147, 51, 234, 0.3);
  }
}

/* ========================================
   ANIMACIONES - BOUNCE
   ======================================== */
.bounce {
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* ========================================
   ANIMACIONES - ROTATE
   ======================================== */
.rotate {
  animation: rotate 20s linear infinite;
}

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

.rotate-reverse {
  animation: rotateReverse 15s linear infinite;
}

@keyframes rotateReverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

/* ========================================
   ANIMACIONES - SCALE
   ======================================== */
.scale-in {
  animation: scaleIn 0.5s ease-out forwards;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-hover {
  transition: transform var(--transition-normal);
}

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

/* ========================================
   ANIMACIONES - FLIP
   ======================================== */
.flip-in {
  animation: flipIn 0.6s ease-out forwards;
  backface-visibility: visible;
}

@keyframes flipIn {
  from {
    opacity: 0;
    transform: rotateY(-90deg);
  }
  to {
    opacity: 1;
    transform: rotateY(0);
  }
}

/* ========================================
   ANIMACIONES - SHAKE
   ======================================== */
.shake {
  animation: shake 0.5s ease-in-out;
}

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

/* ========================================
   ANIMACIONES - FLOATING
   ======================================== */
.float {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* ========================================
   ANIMACIONES - REVEAL
   ======================================== */
.reveal {
  position: relative;
  overflow: hidden;
}

.reveal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  animation: reveal 1.2s ease-out forwards;
}

@keyframes reveal {
  0% {
    left: 0;
  }
  50% {
    left: 0;
  }
  100% {
    left: 100%;
  }
}

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

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

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