document.addEventListener("DOMContentLoaded", function() { const mobileToggle = document.querySelector('.mobile-toggle'); const navMenu = document.querySelector('.nav-menu'); const mobileOverlay = document.querySelector('.mobile-overlay'); // Open/close mobile menu mobileToggle.addEventListener('click', () => { mobileToggle.classList.toggle('active'); navMenu.classList.toggle('active'); mobileOverlay.classList.toggle('active'); }); mobileOverlay.addEventListener('click', () => { mobileToggle.classList.remove('active'); navMenu.classList.remove('active'); mobileOverlay.classList.remove('active'); }); // Mobile dropdowns document.querySelectorAll('.has-dropdown').forEach(parent => { parent.addEventListener('click', function (e) { if (window.innerWidth <= 991) { e.preventDefault(); this.classList.toggle('active'); } }); }); // Close menu on nav click document.querySelectorAll('.nav-menu a').forEach(link => { link.addEventListener('click', function() { if (window.innerWidth <= 991 && !this.parentElement.classList.contains('has-dropdown')) { mobileToggle.classList.remove('active'); navMenu.classList.remove('active'); mobileOverlay.classList.remove('active'); } }); }); });