/* ================================================
   ANIMATIONS & TRANSITIONS
   ================================================ */

/* Fade Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

.fade-out {
  animation: fadeOut 0.5s ease-out;
}

/* Slide Animations */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

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

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

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

.slide-in-down {
  animation: slideInDown 0.5s ease-out;
}

/* Zoom Animations */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zoomOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

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

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

/* Bounce Animations */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

.bounce {
  animation: bounce 1s infinite;
}

.bounce-in {
  animation: bounceIn 0.6s ease-out;
}

/* Pulse Animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

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

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

/* Flip Animations */
@keyframes flipIn {
  from {
    opacity: 0;
    transform: perspective(400px) rotateY(90deg);
  }
  to {
    opacity: 1;
    transform: perspective(400px) rotateY(0deg);
  }
}

@keyframes flip {
  0%, 100% {
    transform: perspective(400px) rotateY(0deg);
  }
  50% {
    transform: perspective(400px) rotateY(180deg);
  }
}

.flip-in {
  animation: flipIn 0.6s ease-out;
}

.flip {
  animation: flip 3s infinite;
}

/* Rotate Animations */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotateInClockwise {
  from {
    opacity: 0;
    transform: rotate(-45deg);
  }
  to {
    opacity: 1;
    transform: rotate(0deg);
  }
}

.rotate {
  animation: rotate 2s linear infinite;
}

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

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

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

/* Glow Animations */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(232, 165, 55, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(232, 165, 55, 0.8);
  }
}

@keyframes glowText {
  0%, 100% {
    text-shadow: 0 0 10px rgba(232, 165, 55, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(232, 165, 55, 0.8);
  }
}

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

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

/* Slide & Fade Combinations */
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.slide-up-fade {
  animation: slideUpFade 0.6s ease-out;
}

.slide-left-fade {
  animation: slideLeftFade 0.6s ease-out;
}

/* Stagger Animation (for lists) */
.stagger-container > * {
  animation: slideUpFade 0.6s ease-out backwards;
}

.stagger-container > :nth-child(1) { animation-delay: 0.1s; }
.stagger-container > :nth-child(2) { animation-delay: 0.2s; }
.stagger-container > :nth-child(3) { animation-delay: 0.3s; }
.stagger-container > :nth-child(4) { animation-delay: 0.4s; }
.stagger-container > :nth-child(5) { animation-delay: 0.5s; }
.stagger-container > :nth-child(6) { animation-delay: 0.6s; }
.stagger-container > :nth-child(7) { animation-delay: 0.7s; }
.stagger-container > :nth-child(8) { animation-delay: 0.8s; }
.stagger-container > :nth-child(n+9) { animation-delay: 0.9s; }

/* Marquee Animation */
@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

.marquee {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-content {
  display: inline-block;
  padding-right: 50px;
  animation: marquee 20s linear infinite;
}

/* Gradient Animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-animated {
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

/* Underline Animation */
@keyframes underlineGrow {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.underline-animated {
  position: relative;
  padding-bottom: 5px;
}

.underline-animated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--secondary);
  animation: underlineGrow 0.6s ease-out forwards;
}

/* Number Counter Animation */
@keyframes countUp {
  from {
    counter-increment: counter 0;
  }
  to {
    counter-increment: counter var(--target);
  }
}

/* Typing Animation */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%, 49%, 100% {
    border-right-color: transparent;
  }
  50%, 99% {
    border-right-color: var(--secondary);
  }
}

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

/* Smooth Transitions */
.smooth-transition {
  transition: var(--transition);
}

.smooth-transition-fast {
  transition: var(--transition-fast);
}

.smooth-transition-slow {
  transition: var(--transition-slow);
}

/* Hover Effects */
.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px var(--shadow-lg);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(232, 165, 55, 0.4);
}

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

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-darken:hover {
  filter: brightness(0.9);
}

.hover-brighten:hover {
  filter: brightness(1.1);
}

/* Loading Animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  border: 3px solid var(--light);
  border-top-color: var(--secondary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

/* Skeleton Loader */
@keyframes skeleton-loading {
  0% {
    background-color: hsl(200, 20%, 80%);
  }
  100% {
    background-color: hsl(200, 20%, 95%);
  }
}

.skeleton {
  animation: skeleton-loading 1s linear infinite alternate;
  border-radius: var(--radius);
}

/* .parallax — background-attachment: fixed no funciona en iOS Safari.
   Para efecto parallax usar transform en JS o el zoomIn del hero en layout.css */
.parallax {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

.smooth-scroll {
  scroll-behavior: smooth;
}

/* ================================================
   ACCESIBILIDAD — Respeta preferencia del sistema
   Desactiva todas las animaciones y transiciones
   cuando el usuario tiene activado "Reducir movimiento"
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .stagger-container > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
