1document.addEventListener('DOMContentLoaded',()=>{
2 const links=document.querySelectorAll('.nav a');
3 const here=location.pathname.split('/').pop()||'index.html';
4 links.forEach(a=>{ if(a.getAttribute('href')===here){ a.classList.add('active'); a.style.fontWeight='700'; } });
5});