(function(){ 'use strict'; const sidebar=document.querySelector('.side'); const menu=document.querySelector('.hamburger'); if(menu&&sidebar){ const close=()=>{sidebar.classList.remove('open');menu.setAttribute('aria-expanded','false')}; menu.addEventListener('click',()=>{const open=sidebar.classList.toggle('open');menu.setAttribute('aria-expanded',String(open))}); sidebar.querySelectorAll('a').forEach(a=>a.addEventListener('click',close)); document.addEventListener('keydown',e=>{if(e.key==='Escape')close()}); } const links=[...document.querySelectorAll('.nav-item[href^="#"]')].filter(a=>a.hash); const sections=links.map(a=>document.getElementById(a.hash.slice(1))).filter(Boolean); if('IntersectionObserver' in window&§ions.length){ const observer=new IntersectionObserver(entries=>{ const shown=entries.filter(x=>x.isIntersecting).sort((a,b)=>a.boundingClientRect.top-b.boundingClientRect.top); if(shown.length){const id=shown[0].target.id;links.forEach(a=>a.classList.toggle('active',a.hash==='#'+id))} },{rootMargin:'-15% 0px -67% 0px',threshold:0}); sections.forEach(s=>observer.observe(s)); } document.querySelectorAll('[data-print]').forEach(b=>b.addEventListener('click',()=>window.print())); })();