/* ============================================
   Animations - Keyframes and Reveal Effects
   ============================================ */

/* ========== Reveal Animations ========== */

/* Reveal from bottom (default) */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

.reveal-up.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Reveal from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Reveal from right */
.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Reveal with scale */
.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Fade in only */
.reveal-fade {
  opacity: 0;
  transition: opacity 0.8s var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

.reveal-fade.revealed {
  opacity: 1;
}

/* Stagger delays for children */
.stagger-children > * {
  --delay: calc(var(--stagger-index, 0) * 0.1s);
}

.stagger-children > *:nth-child(1) { --stagger-index: 0; }
.stagger-children > *:nth-child(2) { --stagger-index: 1; }
.stagger-children > *:nth-child(3) { --stagger-index: 2; }
.stagger-children > *:nth-child(4) { --stagger-index: 3; }
.stagger-children > *:nth-child(5) { --stagger-index: 4; }
.stagger-children > *:nth-child(6) { --stagger-index: 5; }
.stagger-children > *:nth-child(7) { --stagger-index: 6; }
.stagger-children > *:nth-child(8) { --stagger-index: 7; }

/* ========== Hero Animations ========== */

/* Initial load animation */
@keyframes heroFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-animate {
  animation: heroFadeIn 1s var(--ease-out-expo) forwards;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

.hero-animate-1 { --delay: 0.2s; }
.hero-animate-2 { --delay: 0.4s; }
.hero-animate-3 { --delay: 0.6s; }
.hero-animate-4 { --delay: 0.8s; }

/* Background zoom effect */
@keyframes heroZoom {
  from {
    transform: scale(1.1);
  }
  to {
    transform: scale(1);
  }
}

.hero-bg-animate {
  animation: heroZoom 20s ease-out forwards;
}

/* ========== Decorative Animations ========== */

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

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

.animate-float-slow {
  animation: float 8s ease-in-out infinite;
}

.animate-float-fast {
  animation: float 4s ease-in-out infinite;
}

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

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

/* Glow pulse */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(227, 27, 35, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(227, 27, 35, 0.5);
  }
}

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

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

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

.animate-rotate-reverse {
  animation: rotate 25s linear infinite reverse;
}

/* ========== Text Animations ========== */

/* Typewriter effect */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%, 50% {
    border-color: transparent;
  }
  50.01%, 100% {
    border-color: currentColor;
  }
}

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid;
  animation:
    typewriter 3s steps(40) 1s forwards,
    blink 0.75s step-end infinite;
}

/* Text gradient animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.text-gradient-animate {
  background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 3s ease infinite;
}

/* ========== Number Counter ========== */
.number-counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ========== Button Hover Effects ========== */

/* Shine effect */
@keyframes shine {
  from {
    transform: translateX(-100%) skewX(-15deg);
  }
  to {
    transform: translateX(200%) skewX(-15deg);
  }
}

.btn-shine {
  position: relative;
  overflow: hidden;
}

.btn-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: translateX(-100%) skewX(-15deg);
}

.btn-shine:hover::after {
  animation: shine 0.6s ease forwards;
}

/* ========== Card Hover Effects ========== */

/* Lift effect */
.card-lift {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.card-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

/* Border glow */
.card-glow {
  position: relative;
}

.card-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: var(--gradient-cta);
  border-radius: inherit;
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-base);
}

.card-glow:hover::before {
  opacity: 1;
}

/* ========== Loading Animations ========== */

/* Skeleton loading */
@keyframes skeleton {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 0px,
    var(--gray-100) 40px,
    var(--gray-200) 80px
  );
  background-size: 200px 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ========== Page Transitions ========== */

/* Fade out for page navigation */
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.page-transition-out {
  animation: fadeOut 0.3s ease forwards;
}

/* ========== Decorative Circle Animations ========== */
.decor-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
  pointer-events: none;
}

.decor-circle-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: -100px;
  right: -100px;
  animation: float 8s ease-in-out infinite;
}

.decor-circle-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  bottom: -50px;
  left: -50px;
  animation: float 10s ease-in-out infinite reverse;
}

.decor-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.decor-line-1 {
  width: 100%;
  height: 1px;
  top: 30%;
  left: 0;
}

/* ========== Reduce Motion ========== */
@media (prefers-reduced-motion: reduce) {
  .reveal-up,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .reveal-fade {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .animate-float,
  .animate-float-slow,
  .animate-float-fast,
  .animate-pulse,
  .animate-glow-pulse,
  .animate-rotate,
  .animate-rotate-reverse,
  .typewriter,
  .text-gradient-animate,
  .hero-animate,
  .hero-bg-animate {
    animation: none;
  }
}
