/* Carpooling micro-animation for the hero white space. Seats fill one-by-one with passengers and the per-person cost drops live (€74 solo → €18.50 split four ways). Loops. Light-section friendly. */ function CarpoolAnimation() { const [count, setCount] = React.useState(1); const [, force] = React.useState(0); const TOTAL = 74; const D = window.__ELLA_DRIVERS__ || {}; const seats = [ { id: 'ΓΚ', color: '#1486E6', photo: D.d4 }, { id: 'ΜΠ', color: '#00A86B', photo: D.d2 }, { id: 'ΑΔ', color: '#7A5AF8', photo: D.d1 }, { id: 'ΕΛ', color: '#F5A623', photo: D.d5 }, ]; React.useEffect(() => { const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches; if (reduce) { setCount(4); return; } let n = 1; const id = setInterval(() => { n = n >= 4 ? 1 : n + 1; setCount(n); }, 1500); const onLang = () => force(x => x + 1); window.addEventListener('langchange', onLang); return () => { clearInterval(id); window.removeEventListener('langchange', onLang); }; }, []); React.useEffect(() => { const s = document.createElement('style'); s.id = 'carpool-kf'; s.textContent = ` @keyframes seatPop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } } @keyframes carpoolWheel { to { transform: rotate(360deg); } } `; document.head.appendChild(s); return () => { const el = document.getElementById('carpool-kf'); if (el) el.remove(); }; }, []); const t = window.t; const lang = window.__LANG__ || 'el'; const perPerson = (TOTAL / count); const label = lang === 'el' ? `Κόστος μοιρασμένο σε ${count} ${count === 1 ? 'ταξιδιώτη' : 'ταξιδιώτες'}` : `Cost split between ${count} ${count === 1 ? 'traveller' : 'travellers'}`; const perLabel = lang === 'el' ? 'ανά άτομο' : 'per person'; return (