document.querySelectorAll('a[href^="#"]').forEach((link) => { link.addEventListener("click", (event) => { const id = link.getAttribute("href"); if (!id || id === "#") return; const target = document.querySelector(id); if (target) { event.preventDefault(); target.scrollIntoView({ behavior: "smooth", block: "start" }); } }); });