'use client'; import { useEffect, useRef } from 'react'; /** Lightweight progressive enhancement: content is visible before JavaScript runs. */ export function SectionEntrance({ children, id }: { children: React.ReactNode; id: string }) { const sectionRef = useRef(null); useEffect(() => { const element = sectionRef.current; if (!element || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; const observer = new IntersectionObserver( ([entry]) => { if (!entry.isIntersecting) return; element.dataset.revealed = 'true'; observer.disconnect(); }, { rootMargin: '0px 0px -6% 0px', threshold: 0.03 } ); observer.observe(element); return () => observer.disconnect(); }, []); return (
{children}
); }