document.addEventListener('DOMContentLoaded', function() { // Mobile menu toggle const mobileMenuButton = document.querySelector('[aria-controls="mobile-menu"]'); const mobileMenu = document.createElement('div'); mobileMenu.id = 'mobile-menu'; mobileMenu.className = 'hidden sm:hidden'; mobileMenu.innerHTML = `
Home Templates Features Pricing
`; document.querySelector('nav').appendChild(mobileMenu); mobileMenuButton.addEventListener('click', function() { const expanded = this.getAttribute('aria-expanded') === 'true'; this.setAttribute('aria-expanded', !expanded); mobileMenu.classList.toggle('hidden'); // Toggle menu icon if (expanded) { feather.replace(); } else { const menuIcon = this.querySelector('svg'); if (menuIcon) { menuIcon.replaceWith(feather.icons['x'].toSvg()); } } }); // Template card hover effect const templateCards = document.querySelectorAll('.group.relative'); templateCards.forEach(card => { card.addEventListener('mouseenter', function() { const img = this.querySelector('img'); if (img) { img.style.transform = 'scale(1.05)'; img.style.transition = 'transform 0.3s ease'; } }); card.addEventListener('mouseleave', function() { const img = this.querySelector('img'); if (img) { img.style.transform = 'scale(1)'; } }); }); // Animate hero section const heroSection = document.querySelector('.lg\\:text-left'); if (heroSection) { heroSection.classList.add('animate-fadeInUp'); } // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { targetElement.scrollIntoView({ behavior: 'smooth' }); } }); }); });