export function backToTop(){ const btn = document.getElementById('btn--back-to-top'); if (!btn) return; let lastY = window.scrollY; let peakY = window.scrollY; window.addEventListener('scroll', () => { const currentY = window.scrollY; if (currentY > lastY) { peakY = currentY; btn.classList.remove('is-visible'); } else { if (currentY <= 800) { btn.classList.remove('is-visible'); } else if (peakY - currentY >= 200 && peakY > 600) { btn.classList.add('is-visible'); } } lastY = currentY; }, { passive: true }); }