/* ==========================================================================
   Animations - Keyframes and Scroll Animations
   ========================================================================== */

/* -------------------------------------------------------------------------
   Keyframe Animations
   ------------------------------------------------------------------------- */

/* Pulse animation for status dot */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.1);
  }
}

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

/* Fade in up animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in down animation */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in left animation */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade in right animation */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale in animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Slide in from bottom for mobile nav */
@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------------------------------------------------------------------------
   Scroll Animation Classes (Intersection Observer)
   ------------------------------------------------------------------------- */

/* Base state for animated elements - hidden initially */
[data-animate] {
  opacity: 0;
  transition-property: opacity, transform;
  transition-duration: 0.8s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Visible state when in viewport */
[data-animate].animate-visible {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Animation variants */
[data-animate="fade-up"] {
  transform: translateY(60px);
}

[data-animate="fade-down"] {
  transform: translateY(-60px);
}

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

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

[data-animate="scale"] {
  transform: scale(0.9);
}

[data-animate="fade"] {
  /* Just opacity, no transform */
}

/* -------------------------------------------------------------------------
   Smooth Scroll Parallax Effects
   ------------------------------------------------------------------------- */
.parallax-section {
  position: relative;
  overflow: hidden;
}

.parallax-bg {
  position: absolute;
  inset: -20%;
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Scroll-triggered section reveals */
.section {
  position: relative;
  z-index: 1;
}

/* Stagger children animation */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-children.animate-visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children.animate-visible > *:nth-child(2) { transition-delay: 100ms; }
.stagger-children.animate-visible > *:nth-child(3) { transition-delay: 200ms; }
.stagger-children.animate-visible > *:nth-child(4) { transition-delay: 300ms; }
.stagger-children.animate-visible > *:nth-child(5) { transition-delay: 400ms; }
.stagger-children.animate-visible > *:nth-child(6) { transition-delay: 500ms; }

.stagger-children.animate-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Smooth reveal line animation */
.reveal-line {
  position: relative;
  overflow: hidden;
}

.reveal-line::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-line.animate-visible::after {
  transform: scaleX(1);
}

/* Text reveal animation */
.text-reveal {
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  transform: translateY(100%);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.text-reveal.animate-visible span {
  transform: translateY(0);
}

/* Image reveal with clip-path */
.image-reveal {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-reveal.animate-visible {
  clip-path: inset(0 0 0 0);
}

/* Smooth counter animation for stats */
.count-up {
  font-variant-numeric: tabular-nums;
}

/* Animation delays for staggered effects */
[data-animate-delay="100"] {
  transition-delay: 100ms;
}

[data-animate-delay="200"] {
  transition-delay: 200ms;
}

[data-animate-delay="300"] {
  transition-delay: 300ms;
}

[data-animate-delay="400"] {
  transition-delay: 400ms;
}

[data-animate-delay="500"] {
  transition-delay: 500ms;
}

[data-animate-delay="600"] {
  transition-delay: 600ms;
}

/* -------------------------------------------------------------------------
   Animation Utility Classes
   ------------------------------------------------------------------------- */

.animate-fade-in {
  animation: fadeIn var(--transition-base) ease forwards;
}

.animate-fade-in-up {
  animation: fadeInUp var(--transition-slow) var(--ease-out-expo) forwards;
}

.animate-fade-in-down {
  animation: fadeInDown var(--transition-slow) var(--ease-out-expo) forwards;
}

.animate-scale-in {
  animation: scaleIn var(--transition-base) var(--ease-out-back) forwards;
}

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

/* Animation delay utilities */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* -------------------------------------------------------------------------
   Hover Animations
   ------------------------------------------------------------------------- */

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

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

/* Scale on hover */
.hover-scale {
  transition: transform var(--transition-fast);
}

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

/* Glow on hover */
.hover-glow {
  transition: box-shadow var(--transition-base);
}

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

/* -------------------------------------------------------------------------
   Loading Animation
   ------------------------------------------------------------------------- */

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* -------------------------------------------------------------------------
   Reduced Motion Support
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  [data-animate],
  .animate-fade-in,
  .animate-fade-in-up,
  .animate-fade-in-down,
  .animate-scale-in,
  .animate-float,
  .hover-lift,
  .hover-scale {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }
}
