/* GRG Fine Foods - Animations & Interactions */

/* ============================================
   Loading Screen
   ============================================ */
.loader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #fff, #fff5e6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  text-align: center;
}

.loader-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 2rem;
  animation: logoFloat 3s ease-in-out infinite;
}

.loader-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(107, 52, 16, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

.loader-text {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 500;
  animation: pulse 2s ease-in-out infinite;
}

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

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

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

/* ============================================
   Scroll Progress Indicator
   ============================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(to right, var(--primary), var(--amber-600), var(--orange-600));
  z-index: 10000;
  transition: width 0.1s ease;
  box-shadow: 0 2px 4px rgba(107, 52, 16, 0.3);
}

/* ============================================
   Scroll Fade-In Animations
   ============================================ */
/* GSAP handles scroll animations - keeping class for targeting */
.scroll-fade-in {
  /* Initial state - GSAP will animate */
}

/* ============================================
   Hero Content Animations
   ============================================ */
/* Hero animations are now in swiper-custom.css */

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

/* ============================================
   Enhanced Hover Effects
   ============================================ */
.stat-card,
.feature-card,
.contact-card,
.brochure-feature,
.product-feature {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.stat-card:hover,
.feature-card:hover,
.contact-card:hover {
  transform: translateY(-8px) scale(1.02);
}

.brochure-feature:hover,
.product-feature:hover {
  transform: translateX(5px);
}

/* ============================================
   Button Animations
   ============================================ */
.btn-primary,
.btn-gradient,
.btn-white,
.btn-outline-white {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-primary::before,
.btn-gradient::before,
.btn-white::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:hover::before,
.btn-gradient:hover::before,
.btn-white:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:active,
.btn-gradient:active,
.btn-white:active {
  transform: scale(0.95);
}

/* ============================================
   Image Parallax Effect (Subtle)
   ============================================ */
/* GSAP handles parallax effects */
.brand-image-card,
.brand-product-img {
  /* GSAP will handle parallax */
}

.brand-image-card:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* ============================================
   Number Counter Animation
   ============================================ */
/* GSAP handles number counter animations */
.stat-number {
  /* GSAP will animate */
}

/* ============================================
   Section Entrance Animations
   ============================================ */
/* GSAP handles section animations */
.section-header,
.section-badge {
  /* GSAP will animate */
}

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

/* ============================================
   Stagger Animation for Grids
   ============================================ */
/* GSAP handles stagger animations with better performance */

/* ============================================
   Smooth Scroll Behavior
   ============================================ */
/* GSAP handles smooth scrolling - disable CSS smooth scroll */
html {
  scroll-behavior: auto; /* GSAP handles this */
}

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

/* ============================================
   Micro-interactions
   ============================================ */
.nav-link {
  position: relative;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Icon Hover Effects */
.feature-icon,
.stat-icon,
.contact-icon,
.brochure-icon {
  transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon,
.stat-card:hover .stat-icon,
.contact-card:hover .contact-icon,
.brochure-feature:hover .brochure-icon {
  transform: scale(1.1) rotate(5deg);
}

/* ============================================
   Video Wrapper Animation
   ============================================ */
.video-wrapper {
  animation: fadeInScale 1s ease 0.3s both;
}

/* ============================================
   Brand Section Animations
   ============================================ */
.brand-logo-wrapper {
  animation: fadeInScale 0.8s ease both;
}

.brand-tagline {
  animation: fadeInUp 0.8s ease 0.2s both;
}

.brand-description {
  animation: fadeInUp 0.8s ease 0.4s both;
}

/* ============================================
   Footer Animation
   ============================================ */
.footer {
  animation: fadeInUp 0.8s ease both;
}

/* ============================================
   Loading State for Images
   ============================================ */
img {
  opacity: 0;
  transition: opacity 0.5s ease;
  will-change: opacity;
}

img.loaded {
  opacity: 1 !important;
}

/* Ensure images are visible if they load before JS runs */
img[loading="eager"] {
  opacity: 1;
}

/* Fallback for images that fail to load */
img[src=""],
img:not([src]) {
  opacity: 0;
  display: none;
}

/* Picture element images */
picture img {
  opacity: 0;
  transition: opacity 0.5s ease;
}

picture img.loaded {
  opacity: 1 !important;
}

/* ============================================
   Smooth Transitions for All Interactive Elements
   ============================================ */
a, button, .nav-link, .hero-dot {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Enhanced Mobile Menu Animation
   ============================================ */
.nav.active {
  animation: slideDown 0.3s ease;
}

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

.mobile-menu-btn.active .menu-icon {
  transform: rotate(90deg);
}

.menu-icon {
  transition: transform 0.3s ease;
}

/* ============================================
   Pulse Animation for CTAs
   ============================================ */
.btn-primary {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 10px 35px rgba(107, 52, 16, 0.5);
  }
}

/* ============================================
   Scroll Reveal Animation
   ============================================ */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* ============================================
   Text Reveal Animation
   ============================================ */
.text-reveal {
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.text-reveal.revealed span {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Gradient Animation (Subtle)
   ============================================ */
.video-section::before,
.brochure-section::before,
.about-section::before,
.contact-section::before {
  animation: gradientShift 10s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.3;
  }
}

/* ============================================
   Card Hover Lift Effect
   ============================================ */
.brochure-card,
.vision-card,
.partner-cta {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brochure-card:hover,
.vision-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Badge Animation
   ============================================ */
.brand-badge {
  animation: badgeFloat 3s ease-in-out infinite;
}

@keyframes badgeFloat {
  0%, 100% {
    transform: rotate(12deg) translateY(0);
  }
  50% {
    transform: rotate(12deg) translateY(-5px);
  }
}

.brand-badge.spego {
  animation: badgeFloatReverse 3s ease-in-out infinite;
}

@keyframes badgeFloatReverse {
  0%, 100% {
    transform: rotate(-12deg) translateY(0);
  }
  50% {
    transform: rotate(-12deg) translateY(-5px);
  }
}

/* ============================================
   Smooth Image Loading
   ============================================ */
/* Hero image transitions handled by Swiper */

/* ============================================
   Interactive Elements
   ============================================ */
/* Hero navigation styles are in swiper-custom.css */

/* ============================================
   Section Divider Animation
   ============================================ */
.brand-divider {
  animation: fadeInScale 0.8s ease 0.3s both;
}

/* ============================================
   Product Variant Animation
   ============================================ */
.variant-item {
  transition: all 0.3s ease;
}

.variant-item:hover {
  transform: translateX(8px);
  background: rgba(255, 255, 255, 0.8) !important;
}

.variant-item.spego:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* ============================================
   Certification Badge Animation
   ============================================ */
.cert-badge {
  transition: all 0.3s ease;
}

.cert-badge:hover {
  transform: scale(1.1) translateY(-5px);
  background: rgba(255, 255, 255, 0.4) !important;
}

/* ============================================
   Footer Link Animation
   ============================================ */
.footer-links li {
  transition: transform 0.3s ease;
}

.footer-links li:hover {
  transform: translateX(5px);
}

/* ============================================
   Partner Button Animation
   ============================================ */
.partner-buttons button {
  position: relative;
  overflow: hidden;
}

.partner-buttons button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.partner-buttons button:hover::after {
  width: 300px;
  height: 300px;
}

/* ============================================
   Performance Optimizations
   ============================================ */
.scroll-fade-in,
.hero-content-slide,
.stat-card,
.feature-card {
  will-change: transform, opacity;
}

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
  .loader,
  .scroll-fade-in,
  .hero-content-slide,
  .stat-number,
  .brand-badge {
    animation: none !important;
    transition: none !important;
  }
}

