const { useEffect: _useE, useState: _useS, useRef: _useR } = React; /* ===== Reveal hook (with safety net) ===== */ function useReveal() { _useE(() => { const els = Array.from(document.querySelectorAll('.reveal')); if (!els.length) return; document.documentElement.classList.add('js-reveal'); const revealIfVisible = (el) => { const r = el.getBoundingClientRect(); const vh = window.innerHeight || document.documentElement.clientHeight; if (r.top < vh * 0.95 && r.bottom > 0) { el.classList.add('in'); return true; } return false; }; requestAnimationFrame(() => els.forEach(revealIfVisible)); let io; if (typeof IntersectionObserver !== 'undefined') { io = new IntersectionObserver((entries) => { entries.forEach((e) => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }); }, { threshold: 0.12, rootMargin: '0px 0px -8% 0px' }); els.forEach((el) => { if (!el.classList.contains('in')) io.observe(el); }); } const onScroll = () => { els.forEach((el) => { if (!el.classList.contains('in')) revealIfVisible(el); }); }; window.addEventListener('scroll', onScroll, { passive: true }); const safety = setTimeout(() => els.forEach((el) => el.classList.add('in')), 1500); return () => { if (io) io.disconnect(); window.removeEventListener('scroll', onScroll); clearTimeout(safety); }; }, []); } /* ===== Parallax (transform translateY by data-parallax speed) ===== */ function useParallax() { _useE(() => { if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; let raf; const els = Array.from(document.querySelectorAll('[data-parallax]')); const heroBg = document.querySelector('.hero-video-bg'); const handle = () => { const y = window.scrollY; const vh = window.innerHeight; els.forEach((el) => { const speed = parseFloat(el.dataset.parallax) || 0.2; const r = el.getBoundingClientRect(); const center = r.top + r.height / 2; const offset = (vh / 2 - center) * speed; el.style.transform = `translate3d(0, ${offset}px, 0)`; }); if (heroBg) { // Hero video scales + drifts down as user scrolls const progress = Math.min(1, y / 900); heroBg.style.transform = `translate3d(0, ${y * 0.35}px, 0) scale(${1 + progress * 0.08})`; } raf = null; }; const onScroll = () => { if (raf == null) raf = requestAnimationFrame(handle); }; window.addEventListener('scroll', onScroll, { passive: true }); handle(); return () => { window.removeEventListener('scroll', onScroll); if (raf) cancelAnimationFrame(raf); }; }, []); } /* ===== SVG icons ===== */ const Arrow = ({ className = "arrow" }) => ( ); const Whatsapp = () => ( ); const InstagramIcon = () => ( ); const TiktokIcon = () => ( ); const FacebookIcon = () => ( ); window.useReveal = useReveal; window.useParallax = useParallax; window.Arrow = Arrow; window.Whatsapp = Whatsapp; window.InstagramIcon = InstagramIcon; window.TiktokIcon = TiktokIcon; window.FacebookIcon = FacebookIcon;