(() => { const header = document.querySelector(".site-header"); const onScroll = () => { if (!header) return; header.classList.toggle("is-scrolled", window.scrollY > 12); }; onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); const reveals = document.querySelectorAll(".reveal"); if ("IntersectionObserver" in window) { const observer = new IntersectionObserver( (entries) => { entries.forEach((entry, index) => { if (!entry.isIntersecting) return; const el = entry.target; el.style.transitionDelay = `${Math.min(index * 0.04, 0.2)}s`; el.classList.add("is-visible"); observer.unobserve(el); }); }, { threshold: 0.12, rootMargin: "0px 0px -8% 0px" } ); reveals.forEach((el) => observer.observe(el)); } else { reveals.forEach((el) => el.classList.add("is-visible")); } })();