document.addEventListener('DOMContentLoaded', () => { // Mobile menu toggle const mobileMenuBtn = document.getElementById('mobile-menu-btn'); const mobileMenu = document.getElementById('mobile-menu'); if (mobileMenuBtn && mobileMenu) { mobileMenuBtn.addEventListener('click', () => { mobileMenu.classList.toggle('hidden'); }); // Close mobile menu when clicking a link mobileMenu.querySelectorAll('a').forEach(link => { link.addEventListener('click', () => { mobileMenu.classList.add('hidden'); }); }); } // Navbar scroll effect const navbar = document.getElementById('navbar'); let lastScroll = 0; window.addEventListener('scroll', () => { const currentScroll = window.pageYOffset; if (currentScroll > 100) { navbar.classList.add('shadow-md'); } else { navbar.classList.remove('shadow-md'); } lastScroll = currentScroll; }); // Animation for cards on page load const cards = document.querySelectorAll('.group, .bg-white'); cards.forEach((card, index) => { card.style.opacity = '0'; card.style.transform = 'translateY(20px)'; setTimeout(() => { card.style.transition = 'opacity 0.5s ease, transform 0.5s ease'; card.style.opacity = '1'; card.style.transform = 'translateY(0)'; }, 100 * index); }); // Smooth scroll for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); // Form submission handling const form = document.querySelector('form'); if (form) { form.addEventListener('submit', (e) => { e.preventDefault(); const email = form.querySelector('input[type="email"]').value; if (email) { alert('Thank you! We will contact you shortly to schedule your free session.'); form.reset(); } }); } });