document.addEventListener('DOMContentLoaded', function () { // Sticky header const navbar = document.querySelector('.navbar'); if (navbar) { window.addEventListener('scroll', () => { if (window.scrollY > 50) { navbar.classList.add('navbar-sticky'); } else { navbar.classList.remove('navbar-sticky'); } }); } // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); // Contact form validation const contactForm = document.getElementById('contactForm'); if (contactForm) { contactForm.addEventListener('submit', function(e) { if (!this.checkValidity()) { e.preventDefault(); e.stopPropagation(); } this.classList.add('was-validated'); }, false); } });