const { useEffect, useState, useRef } = React;
/* ===== Cursor ===== */
function Cursor() {
const dotRef = useRef(null);
const ringRef = useRef(null);
useEffect(() => {
if (window.matchMedia('(hover: none), (max-width: 880px)').matches) return;
let mx = innerWidth/2, my = innerHeight/2, rx = mx, ry = my, raf;
const onMove = (e) => {
mx = e.clientX; my = e.clientY;
if (dotRef.current) dotRef.current.style.transform = `translate(${mx}px,${my}px) translate(-50%,-50%)`;
};
const loop = () => {
rx += (mx - rx) * 0.18;
ry += (my - ry) * 0.18;
if (ringRef.current) ringRef.current.style.transform = `translate(${rx}px,${ry}px) translate(-50%,-50%)`;
raf = requestAnimationFrame(loop);
};
loop();
const hov = 'a, button, .service-card, .testi, .loc, .brand, .menu-btn, .chip';
const onEnter = () => document.body.classList.add('cursor-hover');
const onLeave = () => document.body.classList.remove('cursor-hover');
const attachTimer = setTimeout(() => {
document.querySelectorAll(hov).forEach((el) => {
el.addEventListener('mouseenter', onEnter);
el.addEventListener('mouseleave', onLeave);
});
}, 300);
window.addEventListener('mousemove', onMove);
return () => {
cancelAnimationFrame(raf);
clearTimeout(attachTimer);
window.removeEventListener('mousemove', onMove);
};
}, []);
return (
<>
>
);
}
/* ===== Site Shell (ambient bg + cursor) ===== */
function SiteShell() {
return (
<>
>
);
}
/* ===== Navigation (multi-page) ===== */
const PAGES = {
home: { href: 'index.html', label: 'Inicio' },
servicios: { label: 'Servicios', children: [
{ href: 'polarizados.html', label: 'Polarizados', desc: 'Hüperoptik · Autobahn · Americano' },
{ href: 'pelicula-seguridad.html', label: 'Película de Seguridad', desc: 'UltraSecure — 300–1500 µ' },
{ href: 'ppf.html', label: 'PPF', desc: 'Paint Protection Film 3M' },
{ href: 'wraps.html', label: 'Wraps', desc: 'Personalización vehicular 3M' },
{ href: 'detailing.html', label: 'Detailing & Ceramic', desc: 'Recubrimiento nanotecnológico' },
]},
accesorios: { href: 'accesorios.html', label: 'Accesorios' },
nosotros: { href: 'nosotros.html', label: 'Nosotros' },
sedes: { href: 'sedes.html', label: 'Sedes' },
contacto: { href: 'contacto.html', label: 'Contacto' },
};
function Nav({ active = 'home' }) {
const [scrolled, setScrolled] = useState(false);
const [open, setOpen] = useState(false);
const [dropdown, setDropdown] = useState(false);
const [mobileServicesOpen, setMobileServicesOpen] = useState(false);
useEffect(() => {
const onScroll = () => setScrolled(window.scrollY > 24);
onScroll();
window.addEventListener('scroll', onScroll, { passive: true });
return () => window.removeEventListener('scroll', onScroll);
}, []);
useEffect(() => { document.body.style.overflow = open ? 'hidden' : ''; }, [open]);
return (
<>
>
);
}
/* ===== Footer ===== */
function Footer() {
return (
);
}
/* ===== WhatsApp float ===== */
function WhatsappFloat() {
return (
¡Escríbenos ahora!
);
}
window.Cursor = Cursor;
window.SiteShell = SiteShell;
window.Nav = Nav;
window.Footer = Footer;
window.WhatsappFloat = WhatsappFloat;