/* ============================================================ CHAINUS — Nav + Hero (asymmetric, cinematic) + live ticker ============================================================ */ function Nav({ t, theme, onToggleTheme }) { const [scrolled, setScrolled] = useState(false); const [open, setOpen] = useState(false); useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 24); onScroll(); window.addEventListener('scroll', onScroll, { passive: true }); return () => window.removeEventListener('scroll', onScroll); }, []); const go = (id) => (e) => { e.preventDefault(); setOpen(false); const el = document.getElementById(id); if (el) window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - 78, behavior: reduceMotion() ? 'auto' : 'smooth' }); }; return ( ); } /* native live market mini-card (used in hero composition) */ function HeroMarketCard({ t }) { const d = [58,60,59,62,61,64,63,66,65,68,67,71]; return (
{t.hero.cardCoin} · Bitcoin Live
▲ {t.hero.cardCoinChg}
24h Vol $28.4B {t.hero.cardMood} {t.hero.cardMoodVal}
); } function Hero({ t }) { const heroRef = useRef(null); const openWebApp = () => { window.location.href = 'https://app.chainus.org'; }; useEffect(() => { const el = heroRef.current; if (!el) return; const video = el.querySelector('.hero-video-player'); let wasReady = false; const setProgress = () => { const wantsReduced = reduceMotion(); let ready = false; if (wantsReduced) { el.style.setProperty('--hero-scroll', '1'); ready = true; } else { const rect = el.getBoundingClientRect(); const range = Math.max(1, rect.height - window.innerHeight); const p = Math.min(1, Math.max(0, -rect.top / range)); el.style.setProperty('--hero-scroll', p.toFixed(3)); ready = p > 0.56; } el.dataset.videoReady = ready ? 'true' : 'false'; if (video && ready !== wasReady) { if (ready && !wantsReduced) { video.currentTime = 0; video.play().catch(() => {}); } else { if (ready) video.currentTime = 0; video.pause(); } } wasReady = ready; }; setProgress(); window.addEventListener('scroll', setProgress, { passive: true }); window.addEventListener('resize', setProgress); return () => { window.removeEventListener('scroll', setProgress); window.removeEventListener('resize', setProgress); }; }, []); return (

{t.hero.sub}
); } function HeroVideoTeaser({ t }) { return (
); } Object.assign(window, { Nav, Hero, HeroVideoTeaser });