/* BinTat modern — shared UI */
const { useState, useEffect, useRef } = React;
const ICONS = {
arrow:'M5 12h14M13 6l6 6-6 6',
arrowTR:'M7 17L17 7M8 7h9v9',
chev:'M9 6l6 6-6 6',
back:'M19 12H5M11 18l-6-6 6-6',
check:'M20 6L9 17l-5-5',
box:'M21 8l-9-5-9 5v8l9 5 9-5V8zM3 8l9 5 9-5M12 13v8',
shield:'M12 3l8 3v6c0 5-3.5 7.5-8 9-4.5-1.5-8-4-8-9V6l8-3z|M9 12l2 2 4-4',
truck:'M3 6h11v9H3zM14 9h4l3 3v3h-7M6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM17.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z',
snow:'M12 2v20M5 5l14 14M19 5L5 19M2 12h20',
tag:'M3 7v5l9 9 7-7-9-9H3zM7.5 7.5h.01',
store:'M4 9l1-5h14l1 5M4 9v11h16V9M9 20v-6h6v6M4 9a2 2 0 004 0 2 2 0 004 0 2 2 0 004 0 2 2 0 004 0',
users:'M16 21v-2a4 4 0 00-4-4H6a4 4 0 00-4 4v2M9 11a4 4 0 100-8 4 4 0 000 8z',
leaf:'M11 20C6 20 3 16 3 11c0-1 .2-2 .5-3C8 9 13 6 21 4c0 9-4 16-10 16zM3 21c2-5 5-8 9-10',
pin:'M12 21s-7-6-7-11a7 7 0 1114 0c0 5-7 11-7 11zM12 12a2.5 2.5 0 100-5 2.5 2.5 0 000 5z',
repeat:'M17 2l4 4-4 4M3 11V9a4 4 0 014-4h14M7 22l-4-4 4-4M21 13v2a4 4 0 01-4 4H3',
phone:'M22 16.9v3a2 2 0 01-2.2 2 19.8 19.8 0 01-8.6-3 19.5 19.5 0 01-6-6 19.8 19.8 0 01-3-8.6A2 2 0 014.1 2h3a2 2 0 012 1.7c.1 1 .4 1.9.7 2.8a2 2 0 01-.5 2.1L8.1 9.9a16 16 0 006 6l1.3-1.3a2 2 0 012.1-.5c.9.3 1.8.6 2.8.7a2 2 0 011.8 2z',
mail:'M4 4h16v16H4zM4 6l8 6 8-6',
clock:'M12 22a10 10 0 100-20 10 10 0 000 20zM12 6v6l4 2',
spark:'M12 2l2.2 6.6L21 11l-6.8 2.4L12 20l-2.2-6.6L3 11l6.8-2.4z',
bolt:'M13 2L3 14h7l-1 8 10-12h-7l1-8z',
meat:'M12 3a6 6 0 016 6c0 2-1 3.5-2.5 4.5L8 21l-2-2 7.5-7.5C12.5 10 11 9 9 9a6 6 0 013-6z',
cup:'M5 8h12l-1 11a2 2 0 01-2 2H8a2 2 0 01-2-2L5 8zM5 8l-1-3h14M9 5V3h6v2',
sound:'M11 5L6 9H2v6h4l5 4V5z|M15.5 8.5a5 5 0 010 7|M19 5a9 9 0 010 14',
mute:'M11 5L6 9H2v6h4l5 4V5z|M22 9l-6 6|M16 9l6 6',
};
function Icon({name, style}){
const d = ICONS[name] || '';
return (
);
}
const Arrow = () => ;
function Sparkle({size=26, style}){
return (
);
}
function Reveal({children, as='div', className='', style={}}){
const ref = useRef(null);
useEffect(()=>{
const el = ref.current; if(!el) return;
if(window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches){ el.classList.add('in'); return; }
const show = ()=>el.classList.add('in');
const vh = window.innerHeight || 800;
if(el.getBoundingClientRect().top < vh*0.95){ requestAnimationFrame(show); }
else {
var io = new IntersectionObserver((es,o)=>es.forEach(e=>{ if(e.isIntersecting){ show(); o.disconnect(); }}),{threshold:0.08, rootMargin:'0px 0px -6% 0px'});
io.observe(el);
}
const fb = setTimeout(()=>{ if(el.getBoundingClientRect().top < (window.innerHeight||800)) el.classList.add('in','settled'); },1100);
return ()=>{ if(typeof io!=='undefined') io.disconnect(); clearTimeout(fb); };
},[]);
const Tag = as;
return {children};
}
function Slot({id, label, height, radius=20, dark=false, style={}, className=''}){
return (
);
}
function Logo({onClick, footer=false}){
return (
);
}
/* Marquee — duplicated track */
function Marquee({words, rev}){
const block = (k)=>(
{words.map((w,i)=>(
{w}
))}
);
return (
);
}
function TagMarquee({tags}){
const block = (k)=>(
{tags.map((t,i)=>({t}))}
);
return (
);
}
/* Nav */
function Nav({t, lang, setLang, page, go}){
const [open, setOpen] = useState(false);
useEffect(()=>{ setOpen(false); },[page]);
const items = [['home',t.nav.home],['brands',t.nav.brands],['logistics',t.nav.logistics],['about',t.nav.about],['contact',t.nav.contact]];
const nav = (p)=>(e)=>{ e.preventDefault(); go(p); };
return (
);
}
/* Footer (lime card) */
function Footer({t, go}){
const c = t.footer, ct = t.contact;
const [sub, setSub] = useState(false);
const nav = (p)=>(e)=>{ e.preventDefault(); go(p); };
return (
);
}
function lang_ok(t){ return t.lang==='en' ? 'Subscribed!' : 'Inscrit !'; }
/* 3D tilt card — pointer-tracked rotation + lime glare */
function Tilt({children, max=9, radius=20, className='', style={}}){
const ref = useRef(null);
const onMove = (e)=>{
if(window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches) return;
const el = ref.current; if(!el) return;
const r = el.getBoundingClientRect();
const px = (e.clientX - r.left)/r.width - .5;
const py = (e.clientY - r.top)/r.height - .5;
el.style.setProperty('--rx', (-py*max).toFixed(2)+'deg');
el.style.setProperty('--ry', (px*max).toFixed(2)+'deg');
el.style.setProperty('--gx', (px*100+50).toFixed(1)+'%');
el.style.setProperty('--gy', (py*100+50).toFixed(1)+'%');
};
const onLeave = ()=>{
const el = ref.current; if(!el) return;
el.style.setProperty('--rx','0deg');
el.style.setProperty('--ry','0deg');
};
return (
);
}
/* animated count-up number */
function CountUp({value, lang}){
const ref = useRef(null);
const target = parseInt(String(value).replace(/[^\d]/g,''),10) || 0;
useEffect(()=>{
const el = ref.current; if(!el) return;
const fmt = (n)=> n.toLocaleString(lang==='en' ? 'en-US' : 'fr-FR');
let started = false;
const run = ()=>{
if(started) return; started = true;
if(window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches){ el.textContent = fmt(target); return; }
const t0 = performance.now(), dur = 1300;
const step = (now)=>{
const p = Math.min(1,(now-t0)/dur);
const e2 = 1-Math.pow(1-p,3);
el.textContent = fmt(Math.round(target*e2));
if(p<1) requestAnimationFrame(step);
};
requestAnimationFrame(step);
};
const io = new IntersectionObserver((es)=>{ es.forEach(en=>{ if(en.isIntersecting){ run(); io.disconnect(); } }); },{threshold:.4});
io.observe(el);
return ()=>{ io.disconnect(); };
},[target,lang]);
return 0;
}
/* ambient lime glow following the cursor */
function CursorGlow(){
useEffect(()=>{
const el = document.createElement('div');
el.className = 'cursor-glow';
document.body.appendChild(el);
const mv = (e)=>{ el.style.setProperty('--cx', e.clientX+'px'); el.style.setProperty('--cy', e.clientY+'px'); };
addEventListener('pointermove', mv, {passive:true});
return ()=>{ removeEventListener('pointermove', mv); el.remove(); };
},[]);
return null;
}
/* Partner logos data + scrolling strip */
const PARTNERS = [
{name:'Düzgün Food GmbH', src:'assets/partner-duzgun.png'},
{name:'Dost Food Production', src:'assets/partner-dostfood.webp'},
{name:'Birtat Döner', src:'assets/partner-birtat.png', dark:true},
];
function PartnerMarquee(){
const block = (k, hide)=>(
{PARTNERS.map((p,i)=>(
{p.src
?
: {p.name}}
))}
);
return (
{block('a')}{block('b',true)}
);
}
Object.assign(window, { Icon, Arrow, Sparkle, Reveal, Slot, Logo, Nav, Footer, Marquee, TagMarquee, Tilt, CountUp, CursorGlow, PartnerMarquee, PARTNERS });