/** Shopify CDN: Minification failed

Line 16:0 Comments in CSS use "/* ... */" instead of "//"
Line 19:2 Comments in CSS use "/* ... */" instead of "//"
Line 40:2 Comments in CSS use "/* ... */" instead of "//"
Line 59:2 Comments in CSS use "/* ... */" instead of "//"
Line 72:2 Comments in CSS use "/* ... */" instead of "//"
Line 81:6 Comments in CSS use "/* ... */" instead of "//"
Line 85:6 Comments in CSS use "/* ... */" instead of "//"
Line 100:2 Comments in CSS use "/* ... */" instead of "//"
Line 124:2 Comments in CSS use "/* ... */" instead of "//"
Line 128:6 Comments in CSS use "/* ... */" instead of "//"
... and 7 more hidden warnings

**/
// Shogun Landing Page JavaScript for Shopify
document.addEventListener('DOMContentLoaded', function() {
  
  // Animated counter for stats
  function animateCounters() {
    const counters = document.querySelectorAll('.shogun-stat-number');
    
    counters.forEach(counter => {
      const target = parseInt(counter.getAttribute('data-count'));
      const duration = 2000;
      const step = target / (duration / 16);
      let current = 0;
      
      const timer = setInterval(() => {
        current += step;
        if (current >= target) {
          current = target;
          clearInterval(timer);
        }
        counter.textContent = Math.floor(current).toLocaleString();
      }, 16);
    });
  }

  // Trigger counter animation when stats section is visible
  const observerOptions = {
    threshold: 0.5
  };

  const observer = new IntersectionObserver((entries) => {
    entries.forEach(entry => {
      if (entry.isIntersecting) {
        animateCounters();
        observer.unobserve(entry.target);
      }
    });
  }, observerOptions);

  const statsSection = document.querySelector('.shogun-stats');
  if (statsSection) {
    observer.observe(statsSection);
  }

  // Smooth scrolling for hero scroll indicator
  const scrollIndicator = document.querySelector('.shogun-scroll-indicator');
  if (scrollIndicator) {
    scrollIndicator.addEventListener('click', () => {
      const featuresSection = document.querySelector('.shogun-features');
      if (featuresSection) {
        featuresSection.scrollIntoView({
          behavior: 'smooth'
        });
      }
    });
  }

  // Newsletter form enhancement
  const newsletterForms = document.querySelectorAll('.shogun-newsletter-form');
  
  newsletterForms.forEach(form => {
    form.addEventListener('submit', (e) => {
      const button = form.querySelector('button');
      const input = form.querySelector('input[type="email"]');
      const originalText = button.textContent;
      
      // Change button text to show loading
      button.textContent = 'Subscribing...';
      button.disabled = true;
      
      // Let the form submit, then provide feedback
      setTimeout(() => {
        button.textContent = 'Subscribed!';
        button.style.background = '#6bcf7f';
        
        setTimeout(() => {
          button.textContent = originalText;
          button.style.background = '';
          button.disabled = false;
          input.value = '';
        }, 3000);
      }, 1000);
    });
  });

  // Add parallax effect to hero
  let ticking = false;
  
  function updateParallax() {
    const scrolled = window.pageYOffset;
    const hero = document.querySelector('.shogun-hero');
    
    if (hero) {
      const speed = 0.5;
      hero.style.transform = `translateY(${scrolled * speed}px)`;
    }
    
    ticking = false;
  }

  function requestParallaxUpdate() {
    if (!ticking) {
      requestAnimationFrame(updateParallax);
      ticking = true;
    }
  }

  window.addEventListener('scroll', requestParallaxUpdate);

  // Category card click handlers
  const categoryCards = document.querySelectorAll('.shogun-category-card');
  categoryCards.forEach(card => {
    card.addEventListener('click', (e) => {
      // Check if there's a link inside the card
      const link = card.querySelector('a');
      if (link && !e.target.closest('a')) {
        window.location.href = link.href;
      }
    });
  });

  // Add entrance animations to feature cards
  const featureCards = document.querySelectorAll('.shogun-feature-card');
  
  const featureObserver = new IntersectionObserver((entries) => {
    entries.forEach((entry, index) => {
      if (entry.isIntersecting) {
        setTimeout(() => {
          entry.target.style.opacity = '1';
          entry.target.style.transform = 'translateY(0)';
        }, index * 100);
        featureObserver.unobserve(entry.target);
      }
    });
  }, { threshold: 0.1 });

  featureCards.forEach(card => {
    card.style.opacity = '0';
    card.style.transform = 'translateY(30px)';
    card.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
    featureObserver.observe(card);
  });

  // Add entrance animations to category cards
  const categoryCardsAnim = document.querySelectorAll('.shogun-category-card');
  
  const categoryObserver = new IntersectionObserver((entries) => {
    entries.forEach((entry, index) => {
      if (entry.isIntersecting) {
        setTimeout(() => {
          entry.target.style.opacity = '1';
          entry.target.style.transform = 'scale(1)';
        }, index * 150);
        categoryObserver.unobserve(entry.target);
      }
    });
  }, { threshold: 0.1 });

  categoryCardsAnim.forEach(card => {
    card.style.opacity = '0';
    card.style.transform = 'scale(0.8)';
    card.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
    categoryObserver.observe(card);
  });

  // Handle hero button interactions
  const heroButtons = document.querySelectorAll('.shogun-hero .shogun-btn');
  heroButtons.forEach(button => {
    button.addEventListener('mouseenter', () => {
      button.style.transform = 'translateY(-3px) scale(1.05)';
    });
    
    button.addEventListener('mouseleave', () => {
      button.style.transform = 'translateY(0) scale(1)';
    });
  });

  // Add loading states for category navigation
  categoryCards.forEach(card => {
    card.addEventListener('click', () => {
      card.style.opacity = '0.7';
      card.style.transform = 'scale(0.98)';
    });
  });

  // Smooth reveal for stats section
  const statItems = document.querySelectorAll('.shogun-stat-item');
  
  const statObserver = new IntersectionObserver((entries) => {
    entries.forEach((entry, index) => {
      if (entry.isIntersecting) {
        setTimeout(() => {
          entry.target.style.opacity = '1';
          entry.target.style.transform = 'translateY(0)';
        }, index * 100);
        statObserver.unobserve(entry.target);
      }
    });
  }, { threshold: 0.3 });

  statItems.forEach(item => {
    item.style.opacity = '0';
    item.style.transform = 'translateY(20px)';
    item.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
    statObserver.observe(item);
  });

  // Add subtle hover effects to floating cards
  const floatingCards = document.querySelectorAll('.shogun-floating-card');
  floatingCards.forEach(card => {
    card.addEventListener('mouseenter', () => {
      card.style.transform = 'translateY(-25px) scale(1.05)';
      card.style.background = 'rgba(255, 255, 255, 0.2)';
    });
    
    card.addEventListener('mouseleave', () => {
      card.style.transform = '';
      card.style.background = '';
    });
  });

});