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

/* ===================
   KEYFRAME ANIMATIONS
   =================== */

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

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

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

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

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

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

@keyframes scaleInUp {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

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

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(var(--color-primary-rgb), 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(var(--color-primary-rgb), 0.5);
  }
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ===================
   SCROLL ANIMATIONS
   =================== */

/* Hidden state for elements before animation */
/* Temporarily show all elements - JS will add animations when loaded */
[data-animate] {
  opacity: 1;
}

/* When JS loads and adds is-visible, animate from opacity 0 */
[data-animate].will-animate {
  opacity: 0;
}

/* Fade animations */
[data-animate="fade-in"].is-visible {
  animation: fadeIn 0.6s ease forwards;
}

[data-animate="fade-up"].is-visible {
  animation: fadeInUp 0.6s ease forwards;
}

[data-animate="fade-down"].is-visible {
  animation: fadeInDown 0.6s ease forwards;
}

[data-animate="fade-left"].is-visible {
  animation: fadeInLeft 0.6s ease forwards;
}

[data-animate="fade-right"].is-visible {
  animation: fadeInRight 0.6s ease forwards;
}

/* Scale animations */
[data-animate="scale-in"].is-visible {
  animation: scaleIn 0.6s ease forwards;
}

[data-animate="scale-up"].is-visible {
  animation: scaleInUp 0.6s ease forwards;
}

/* Animation delays */
[data-animate-delay="100"].is-visible {
  animation-delay: 0.1s;
}

[data-animate-delay="200"].is-visible {
  animation-delay: 0.2s;
}

[data-animate-delay="300"].is-visible {
  animation-delay: 0.3s;
}

[data-animate-delay="400"].is-visible {
  animation-delay: 0.4s;
}

[data-animate-delay="500"].is-visible {
  animation-delay: 0.5s;
}

[data-animate-delay="600"].is-visible {
  animation-delay: 0.6s;
}

/* ===================
   STAGGER ANIMATIONS
   =================== */

/* Show by default, JS will add will-animate for animation */
[data-animate-stagger] > * {
  opacity: 1;
}

[data-animate-stagger].will-animate > * {
  opacity: 0;
}

[data-animate-stagger].is-visible > *:nth-child(1) {
  animation: fadeInUp 0.5s ease 0.1s forwards;
}

[data-animate-stagger].is-visible > *:nth-child(2) {
  animation: fadeInUp 0.5s ease 0.2s forwards;
}

[data-animate-stagger].is-visible > *:nth-child(3) {
  animation: fadeInUp 0.5s ease 0.3s forwards;
}

[data-animate-stagger].is-visible > *:nth-child(4) {
  animation: fadeInUp 0.5s ease 0.4s forwards;
}

[data-animate-stagger].is-visible > *:nth-child(5) {
  animation: fadeInUp 0.5s ease 0.5s forwards;
}

[data-animate-stagger].is-visible > *:nth-child(6) {
  animation: fadeInUp 0.5s ease 0.6s forwards;
}

[data-animate-stagger].is-visible > *:nth-child(7) {
  animation: fadeInUp 0.5s ease 0.7s forwards;
}

[data-animate-stagger].is-visible > *:nth-child(8) {
  animation: fadeInUp 0.5s ease 0.8s forwards;
}

/* ===================
   HOVER EFFECTS
   =================== */

.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

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

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

.hover-glow {
  transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

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

.hover-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.hover-shine:hover::after {
  left: 100%;
}

/* Image hover zoom */
.img-zoom {
  overflow: hidden;
}

.img-zoom img {
  transition: transform var(--transition-slow);
}

.img-zoom:hover img {
  transform: scale(1.1);
}

/* ===================
   UTILITY ANIMATIONS
   =================== */

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

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

.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

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

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

/* Gradient animation */
.animate-gradient {
  background-size: 200% 200%;
  animation: gradientFlow 4s ease infinite;
}

/* ===================
   PAGE TRANSITIONS
   =================== */

.page-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-exit {
  opacity: 1;
}

.page-exit-active {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ===================
   HERO ANIMATIONS
   =================== */

.hero-title {
  animation: fadeInUp 0.8s ease 0.2s forwards;
}

.hero-subtitle {
  animation: fadeInUp 0.8s ease 0.4s forwards;
}

.hero-cta {
  animation: fadeInUp 0.8s ease 0.6s forwards;
}

.hero-image {
  animation: scaleIn 1s ease 0.4s forwards;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-muted);
  animation: bounce 2s ease-in-out infinite;
}

.scroll-indicator__mouse {
  width: 24px;
  height: 40px;
  border: 2px solid currentColor;
  border-radius: 12px;
  position: relative;
}

.scroll-indicator__wheel {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: currentColor;
  border-radius: 2px;
  animation: scrollWheel 1.5s ease-in-out infinite;
}

@keyframes scrollWheel {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
  }
}

.scroll-indicator__text {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
}

/* ===================
   COUNTER ANIMATION
   =================== */

.counter {
  font-variant-numeric: tabular-nums;
}

/* ===================
   TEXT ANIMATIONS
   =================== */

.text-reveal {
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  transform: translateY(100%);
  animation: textReveal 0.6s ease forwards;
}

@keyframes textReveal {
  to {
    transform: translateY(0);
  }
}

/* Typewriter effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--color-primary);
  white-space: nowrap;
  animation:
    typing 3.5s steps(40, end),
    blinkCursor 0.75s step-end infinite;
}

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

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

/* ===================
   PARALLAX
   =================== */

[data-parallax] {
  will-change: transform;
}

/* ===================
   MOTION PREFERENCES
   =================== */

@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;
  }

  [data-animate],
  [data-animate-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Disable interactive effects */
  [data-tilt],
  [data-magnetic],
  [data-parallax] {
    transform: none !important;
  }

  .hero__particle,
  .hero__image-wrapper::before,
  .hero__line,
  .text-gradient,
  .btn--glow::before {
    animation: none !important;
    opacity: 0 !important;
  }

  /* Hero 3D animation - show static */
  .hero__3d-visual,
  .hero__3d-model,
  .hero__3d-glow {
    animation: none !important;
  }

  .hero__3d-visual {
    opacity: 0.25 !important;
    transform: translateY(-50%) !important;
  }

  .animate-on-load {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .text-gradient {
    -webkit-text-fill-color: var(--color-primary) !important;
    opacity: 1 !important;
  }
}
