// Shared JavaScript across all pages document.addEventListener('DOMContentLoaded', () => { console.log('PixelPulse Gallery Explorer loaded!'); // Add animation classes to sections when they come into view const sections = document.querySelectorAll('section'); const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('animate-fadeIn'); observer.unobserve(entry.target); } }); }, { threshold: 0.1 }); sections.forEach((section, index) => { section.style.opacity = '0'; section.classList.add(`delay-${(index % 6) * 100}`); observer.observe(section); }); // Like button functionality document.addEventListener('click', (e) => { if (e.target.closest('[data-feather="heart"]')) { const heart = e.target.closest('[data-feather="heart"]'); const parentCard = heart.closest('.card-hover'); if (heart.classList.contains('text-purple-600')) { heart.classList.remove('text-purple-600'); heart.classList.add('text-red-500'); parentCard.classList.add('ring-2', 'ring-red-300'); // Temporary animation parentCard.style.transform = 'scale(1.05)'; setTimeout(() => { parentCard.style.transform = ''; }, 300); } else { heart.classList.add('text-purple-600'); heart.classList.remove('text-red-500'); parentCard.classList.remove('ring-2', 'ring-red-300'); } feather.replace(); } }); });