/* ============================================
   Animations - AppCraft Landing Page
   ============================================ */

/* ========== Keyframes ========== */

/* Fade Animations */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-left {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale Animations */
@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scale-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes scale-up {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

@keyframes scale-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Slide Animations */
@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slide-left {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slide-right {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Rotate Animations */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotate-reverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

@keyframes rotate-pulse {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(5deg);
  }
  75% {
    transform: rotate(-5deg);
  }
}

/* Bounce Animations */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* Float Animations */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes float-slow {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(2deg);
  }
  50% {
    transform: translateY(-20px) rotate(0deg);
  }
  75% {
    transform: translateY(-10px) rotate(-2deg);
  }
}

@keyframes float-horizontal {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(20px);
  }
}

/* Glow Animations */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.6);
  }
}

@keyframes glow-blue-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.6), 0 0 60px rgba(0, 212, 255, 0.3);
  }
}

@keyframes glow-purple-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.6), 0 0 60px rgba(139, 92, 246, 0.3);
  }
}

@keyframes glow-text {
  0%, 100% {
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 30px rgba(139, 92, 246, 0.5);
  }
}

/* Pulse Animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Blink Animations */
@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes blink-slow {
  0%, 100% {
    opacity: 1;
  }
  25%, 75% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* Shimmer Animations */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes shimmer-text {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Wave Animations */
@keyframes wave {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(20deg);
  }
  75% {
    transform: rotate(-15deg);
  }
}

/* Shake Animations */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Typewriter Animation */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--color-electric-blue);
  }
}

/* Gradient Animation */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Border Animation */
@keyframes border-glow {
  0%, 100% {
    border-color: var(--color-electric-blue);
  }
  33% {
    border-color: var(--color-neon-purple);
  }
  66% {
    border-color: var(--color-hot-pink);
  }
}

/* Line Draw Animation */
@keyframes draw-line {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Ripple Animation */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ========== Animation Classes ========== */

/* Fade Classes */
.animate-fade-in {
  animation: fade-in 0.5s ease forwards;
}

.animate-fade-in-up {
  animation: fade-in-up 0.6s ease forwards;
}

.animate-fade-in-down {
  animation: fade-in-down 0.6s ease forwards;
}

.animate-fade-in-left {
  animation: fade-in-left 0.6s ease forwards;
}

.animate-fade-in-right {
  animation: fade-in-right 0.6s ease forwards;
}

/* Scale Classes */
.animate-scale-in {
  animation: scale-in 0.5s ease forwards;
}

.animate-scale-pulse {
  animation: scale-pulse 2s ease-in-out infinite;
}

/* Float Classes */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-float-slow {
  animation: float-slow 6s ease-in-out infinite;
}

.animate-float-horizontal {
  animation: float-horizontal 4s ease-in-out infinite;
}

/* Glow Classes */
.animate-glow-pulse {
  animation: glow-pulse 2s ease-in-out infinite;
}

.animate-glow-blue {
  animation: glow-blue-pulse 2s ease-in-out infinite;
}

.animate-glow-purple {
  animation: glow-purple-pulse 2s ease-in-out infinite;
}

/* Pulse Classes */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-blink {
  animation: blink 1s ease-in-out infinite;
}

.animate-blink-slow {
  animation: blink-slow 3s ease-in-out infinite;
}

/* Bounce Classes */
.animate-bounce {
  animation: bounce 2s ease infinite;
}

.animate-bounce-in {
  animation: bounce-in 0.8s ease forwards;
}

/* Rotate Classes */
.animate-rotate {
  animation: rotate 10s linear infinite;
}

.animate-rotate-reverse {
  animation: rotate-reverse 10s linear infinite;
}

/* Shimmer Classes */
.animate-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

/* Gradient Animation Class */
.animate-gradient {
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

/* ========== Hover Effects ========== */

/* Button Hover Effects */
.btn--hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn--hover-lift:hover {
  transform: translateY(-4px);
}

.btn--hover-glow {
  transition: box-shadow 0.3s ease;
}

.btn--hover-glow:hover {
  box-shadow: var(--glow-blue-strong);
}

.btn--hover-scale {
  transition: transform 0.3s ease;
}

.btn--hover-scale:hover {
  transform: scale(1.05);
}

/* Card Hover Effects */
.card--hover-lift {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.card--hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-dark-xl);
}

.card--hover-glow {
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.card--hover-glow:hover {
  box-shadow: var(--glow-blue);
  border-color: var(--color-electric-blue);
}

.card--hover-scale {
  transition: transform 0.4s ease;
}

.card--hover-scale:hover {
  transform: scale(1.02);
}

/* Link Hover Effects */
.link--hover-underline {
  position: relative;
}

.link--hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

.link--hover-underline:hover::after {
  width: 100%;
}

.link--hover-glow {
  transition: text-shadow 0.3s ease, color 0.3s ease;
}

.link--hover-glow:hover {
  color: var(--color-electric-blue);
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Icon Hover Effects */
.icon--hover-rotate {
  transition: transform 0.3s ease;
}

.icon--hover-rotate:hover {
  transform: rotate(15deg);
}

.icon--hover-scale {
  transition: transform 0.3s ease;
}

.icon--hover-scale:hover {
  transform: scale(1.2);
}

.icon--hover-bounce {
  transition: transform 0.3s ease;
}

.icon--hover-bounce:hover {
  animation: bounce 0.5s ease;
}

/* ========== Scroll Animations ========== */

/* Elements hidden before animation */
[data-animate] {
  opacity: 0;
}

[data-animate="fade-in"] {
  opacity: 0;
}

[data-animate="fade-in-up"] {
  opacity: 0;
  transform: translateY(30px);
}

[data-animate="fade-in-down"] {
  opacity: 0;
  transform: translateY(-30px);
}

[data-animate="fade-in-left"] {
  opacity: 0;
  transform: translateX(-30px);
}

[data-animate="fade-in-right"] {
  opacity: 0;
  transform: translateX(30px);
}

[data-animate="scale-in"] {
  opacity: 0;
  transform: scale(0.9);
}

/* Animated state */
[data-animate].animated {
  animation: fade-in 0.6s ease forwards;
}

[data-animate="fade-in-up"].animated {
  animation: fade-in-up 0.6s ease forwards;
}

[data-animate="fade-in-down"].animated {
  animation: fade-in-down 0.6s ease forwards;
}

[data-animate="fade-in-left"].animated {
  animation: fade-in-left 0.6s ease forwards;
}

[data-animate="fade-in-right"].animated {
  animation: fade-in-right 0.6s ease forwards;
}

[data-animate="scale-in"].animated {
  animation: scale-in 0.6s ease forwards;
}

/* Stagger Animation Delays */
[data-delay="1"] {
  animation-delay: 0.1s;
}

[data-delay="2"] {
  animation-delay: 0.2s;
}

[data-delay="3"] {
  animation-delay: 0.3s;
}

[data-delay="4"] {
  animation-delay: 0.4s;
}

[data-delay="5"] {
  animation-delay: 0.5s;
}

[data-delay="6"] {
  animation-delay: 0.6s;
}

/* ========== Page Load Animations ========== */

/* Hero Section */
.hero__title {
  opacity: 0;
  animation: fade-in-up 0.8s ease forwards;
  animation-delay: 0.2s;
}

.hero__subtitle {
  opacity: 0;
  animation: fade-in-up 0.8s ease forwards;
  animation-delay: 0.4s;
}

.hero__buttons {
  opacity: 0;
  animation: fade-in-up 0.8s ease forwards;
  animation-delay: 0.6s;
}

.hero__scroll-indicator {
  opacity: 0;
  animation: fade-in 0.8s ease forwards, bounce 2s ease infinite;
  animation-delay: 1s;
}

/* Header */
.header {
  animation: fade-in-down 0.6s ease forwards;
}

/* Service Cards Stagger */
.service-card:nth-child(1) {
  animation-delay: 0.1s;
}

.service-card:nth-child(2) {
  animation-delay: 0.2s;
}

.service-card:nth-child(3) {
  animation-delay: 0.3s;
}

.service-card:nth-child(4) {
  animation-delay: 0.4s;
}

/* Stat Cards Stagger */
.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}

/* Portfolio Cards Stagger */
.portfolio-card:nth-child(1) {
  animation-delay: 0.1s;
}

.portfolio-card:nth-child(2) {
  animation-delay: 0.15s;
}

.portfolio-card:nth-child(3) {
  animation-delay: 0.2s;
}

.portfolio-card:nth-child(4) {
  animation-delay: 0.25s;
}

.portfolio-card:nth-child(5) {
  animation-delay: 0.3s;
}

.portfolio-card:nth-child(6) {
  animation-delay: 0.35s;
}

/* Process Steps Stagger */
.process-step:nth-child(1) {
  animation-delay: 0.1s;
}

.process-step:nth-child(2) {
  animation-delay: 0.2s;
}

.process-step:nth-child(3) {
  animation-delay: 0.3s;
}

.process-step:nth-child(4) {
  animation-delay: 0.4s;
}

.process-step:nth-child(5) {
  animation-delay: 0.5s;
}

/* ========== Reduced Motion ========== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero__scroll-indicator {
    animation: none;
    opacity: 1;
  }
  
  [data-animate] {
    opacity: 1;
    transform: none;
  }
}
