'use client' import { useEffect, useRef, useState } from 'react' import { useLang } from '@/context/LangContext' function useReveal() { useEffect(() => { const els = document.querySelectorAll('.reveal, .reveal-fade') const obs = new IntersectionObserver( (entries) => entries.forEach(e => { if (e.isIntersecting) e.target.classList.add('active') }), { threshold: 0.12 } ) els.forEach(el => obs.observe(el)) return () => obs.disconnect() }, []) } export default function Hero() { useReveal() const bgRef = useRef(null) const { t } = useLang() const [segChoice, setSegChoice] = useState<0 | 1 | null>(null) useEffect(() => { const handle = () => { if (bgRef.current) { const y = window.scrollY * 0.3 bgRef.current.style.transform = `scale(1.08) translateY(${y}px)` } } window.addEventListener('scroll', handle, { passive: true }) setTimeout(() => bgRef.current?.classList.add('loaded'), 100) return () => window.removeEventListener('scroll', handle) }, []) const handleSeg = (choice: 0 | 1) => { setSegChoice(choice) const target = choice === 0 ? '#features' : '#brownleaf' const el = document.querySelector(target) if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' }) } return (
{/* Background */}
) }