document.querySelectorAll('a[href^="#"]').forEach(link => { link.addEventListener('click', function(e) { const id = this.getAttribute('href').slice(1); const target = document.getElementById(id); if (target) { e.preventDefault(); target.scrollIntoView({ behavior: 'smooth' }); } }); });