0
document.addEventListener('DOMContentLoaded', () => { if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; const observer = new IntersectionObserver((entries, obs) => { entries.forEach(entry => { // Check if it's intersecting OR already above the viewport if (entry.isIntersecting || entry.boundingClientRect.top < 0) { requestAnimationFrame(() => { entry.target.classList.add('is-in-view'); obs.unobserve(entry.target); }); } }); }, { // Changed to 10% to be slightly more responsive rootMargin: "0px 0px -10% 0px", threshold: 0.01 }); document.querySelectorAll('section').forEach(section => { observer.observe(section); }); });