/* Animations - My Daily Bread
   Scroll-triggered animations with reduced motion support */

/* === Keyframes === */

@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 slideInUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

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

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

@keyframes blurIn {
  from { opacity: 0; filter: blur(10px); }
  to { opacity: 1; filter: blur(0); }
}

/* === Scroll-triggered animation base === */

.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.fade-up {
  transform: translateY(30px);
}

.animate-on-scroll.fade-down {
  transform: translateY(-30px);
}

.animate-on-scroll.fade-left {
  transform: translateX(-30px);
}

.animate-on-scroll.fade-right {
  transform: translateX(30px);
}

.animate-on-scroll.scale-in {
  transform: scale(0.9);
}

.animate-on-scroll.blur-in {
  filter: blur(10px);
  transition: opacity 0.6s ease, transform 0.6s ease, filter 0.6s ease;
}

/* Visible state (added by IntersectionObserver) */
.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
  filter: blur(0);
}

/* === Stagger delays === */

.stagger-1 { transition-delay: 100ms; }
.stagger-2 { transition-delay: 200ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 400ms; }
.stagger-5 { transition-delay: 500ms; }
.stagger-6 { transition-delay: 600ms; }

/* === Utility animation classes === */

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

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

.animate-shimmer {
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.3) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* === Phone frame component === */

.phone-frame {
  position: relative;
  width: 280px;
  background: #1a1a1a;
  border-radius: 40px;
  padding: 12px;
  box-shadow: var(--shadow-phone);
}

.phone-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  background: #1a1a1a;
  border-radius: 0 0 16px 16px;
  z-index: 2;
}

.phone-frame.no-notch::before {
  display: none;
}

.phone-frame img {
  width: 100%;
  height: auto;
  border-radius: 30px;
  display: block;
}

.phone-frame-sm {
  max-width: 220px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.phone-frame-sm::before {
  width: 90px;
  height: 22px;
  border-radius: 0 0 12px 12px;
}

.phone-frame-sm img {
  width: 100%;
  height: auto;
  border-radius: 24px;
  display: block;
}

/* === Hover effects === */

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

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

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(142, 151, 253, 0.3);
}

/* === Reduced motion === */

@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  .animate-on-scroll.is-visible {
    transition: none;
  }

  .stagger-1, .stagger-2, .stagger-3,
  .stagger-4, .stagger-5, .stagger-6 {
    transition-delay: 0ms;
  }

  .animate-float,
  .animate-pulse,
  .animate-shimmer {
    animation: none;
  }

  .hover-lift:hover {
    transform: none;
  }
}
