/* ============================================
   ANIMATIONS & MICROINTERACTIONS
   Azmeh Amer LLC Website
   ============================================ */

/* ============================================
   ACCESSIBILITY - RESPECT USER 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;
  }
  
  .hero .reveal,
  .reveal-on-scroll,
  .hero-image,
  .btn,
  .btn-pulse {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* ============================================
   1. HERO ENTRANCE ANIMATION
   ============================================ */
.hero .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: transform 700ms cubic-bezier(0.2, 0.9, 0.3, 1),
              opacity 700ms ease;
}

.hero .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for hero elements */
.hero .reveal:nth-child(1) { transition-delay: 100ms; }
.hero .reveal:nth-child(2) { transition-delay: 250ms; }
.hero .reveal:nth-child(3) { transition-delay: 400ms; }
.hero .reveal:nth-child(4) { transition-delay: 550ms; }

/* ============================================
   2. SCROLL REVEAL ANIMATIONS - NO DELAYS
   ============================================ */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: transform 400ms cubic-bezier(0.2, 0.9, 0.3, 1),
              opacity 400ms ease;
  will-change: transform, opacity;
}

.reveal-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* NO STAGGER - Immediate reveals */
.reveal-on-scroll:nth-child(1) { transition-delay: 0ms; }
.reveal-on-scroll:nth-child(2) { transition-delay: 0ms; }
.reveal-on-scroll:nth-child(3) { transition-delay: 0ms; }
.reveal-on-scroll:nth-child(4) { transition-delay: 0ms; }

/* ============================================
   3. BUTTON MICROINTERACTIONS
   ============================================ */
.btn,
.nav-link.btn-primary {
  position: relative;
  transition: transform 180ms cubic-bezier(0.2, 0.9, 0.3, 1),
              box-shadow 180ms ease,
              background-color 180ms ease;
  will-change: transform;
}

/* Accessible focus state */
.btn:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid rgba(139, 115, 85, 0.3);
  outline-offset: 4px;
}

/* Hover state */
.btn:hover,
.nav-link.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(139, 115, 85, 0.12);
}

.btn:active,
.nav-link.btn-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 115, 85, 0.08);
}

/* Primary CTA pulse animation (subtle) */
.btn-pulse {
  animation: subtle-pulse 3s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 75%, 100% {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.08);
  }
  85% {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(139, 115, 85, 0.12);
  }
}

/* ============================================
   4. NAVIGATION LINK UNDERLINE
   ============================================ */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  height: 2px;
  width: 100%;
  background: var(--primary-color, #8B7355);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* ============================================
   5. STICKY HEADER BEHAVIOR - DISABLED
   ============================================ */
/* All header positioning is now handled in styles.css */
/* Navbar stays fixed at top at all times */

/* ============================================
   6. IMAGE EFFECTS - KEN BURNS & PARALLAX
   ============================================ */
.hero-image-wrapper {
  overflow: hidden;
  border-radius: 8px;
}

.hero-image {
  transition: transform 20s ease-out;
  transform-origin: center center;
  will-change: transform;
}

.hero.loaded .hero-image {
  transform: scale(1.08);
}

/* Parallax effect on scroll */
.parallax-image {
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  will-change: transform;
}

/* ============================================
   7. SERVICE CARD HOVER EFFECTS - ENHANCED BOUNCE
   ============================================ */
.service-card {
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 300ms ease;
  will-change: transform;
}

.service-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 16px 40px rgba(139, 115, 85, 0.15);
}

/* ============================================
   8. FORM INPUT ANIMATIONS
   ============================================ */
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary-color, #8B7355);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.08);
  transition: border-color 200ms ease,
              box-shadow 200ms ease;
}

/* Floating label effect (if implemented later) */
.form-group {
  position: relative;
}

.form-label {
  transition: transform 200ms cubic-bezier(0.2, 0.9, 0.3, 1),
              font-size 200ms ease,
              color 200ms ease;
}

/* ============================================
   9. SUCCESS/LOADING STATES
   ============================================ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 400ms cubic-bezier(0.2, 0.9, 0.3, 1),
              opacity 400ms ease;
  z-index: 9999;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-left: 4px solid #4CAF50;
}

.toast.error {
  border-left: 4px solid #f44336;
}

/* ============================================
   10. FADE-IN UTILITY CLASSES
   ============================================ */
.fade-in {
  animation: fadeIn 600ms ease-out forwards;
}

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

.fade-in-slow {
  animation: fadeIn 1000ms ease-out forwards;
}

/* ============================================
   11. SMOOTH SCROLLING
   ============================================ */
html {
  scroll-behavior: smooth;
}

/* ============================================
   12. LOADING SKELETON (optional, for future)
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(232, 223, 208, 0.2) 25%,
    rgba(232, 223, 208, 0.4) 50%,
    rgba(232, 223, 208, 0.2) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

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

/* ============================================
   13. TESTIMONIAL CARD ANIMATIONS - ENHANCED BOUNCE
   ============================================ */
.testimonial {
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 300ms ease;
}

.testimonial:hover {
  transform: translateY(-10px) scale(1.015);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

/* ============================================
   14. MOBILE MENU ANIMATIONS
   ============================================ */
.mobile-menu {
  transition: transform 350ms cubic-bezier(0.2, 0.9, 0.3, 1),
              opacity 350ms ease;
}

.mobile-menu.active {
  transform: translateX(0);
  opacity: 1;
}

/* Hamburger icon animation */
.hamburger span {
  transition: transform 250ms cubic-bezier(0.2, 0.9, 0.3, 1),
              opacity 250ms ease;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ============================================
   15. SECTION DIVIDER ANIMATION
   ============================================ */
.section-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color, #8B7355), var(--secondary-color, #E8DFD0));
  margin: 0 auto 30px;
  transform: scaleX(0);
  transition: transform 700ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.section-divider.visible {
  transform: scaleX(1);
}

/* ============================================
   16. PERFORMANCE OPTIMIZATIONS
   ============================================ */
/* Only apply will-change when needed */
.animating {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.animation-complete {
  will-change: auto;
}
