document.addEventListener("DOMContentLoaded", function() { const links = document.querySelectorAll('a[href*="#"]'); links.forEach(link => { link.addEventListener("click", function(e) { const targetID = this.getAttribute("href").split("#")[1]; const target = document.getElementById(targetID); if (target) { e.preventDefault(); target.scrollIntoView({ behavior: "smooth", block: "start" }); } }); }); });