// GSP Navbar — two-tier fixed bar with mega-menus, compacts on scroll. // Faithful to the canonical wireframe-home: Guardias · Electrónica · Nosotros · Clientes · Conocimiento · Contacto. function Navbar() { const [open, setOpen] = React.useState(null); const [scrolled, setScrolled] = React.useState(false); const [mobileOpen, setMobileOpen] = React.useState(false); const [mobileSec, setMobileSec] = React.useState(null); // Anchor links a secciones de la home deben funcionar también desde las páginas internas. const onHome = /(^|\/)index\.html$/.test(location.pathname) || location.pathname.endsWith('/'); const hp = onHome ? '' : 'index.html'; React.useEffect(() => { document.body.style.overflow = mobileOpen ? 'hidden' : ''; return () => { document.body.style.overflow = ''; }; }, [mobileOpen]); React.useEffect(() => { let ticking = false; const onScroll = () => { if (ticking) return; ticking = true; requestAnimationFrame(() => { setScrolled(window.scrollY > 60); ticking = false; }); }; window.addEventListener('scroll', onScroll, { passive: true }); return () => window.removeEventListener('scroll', onScroll); }, []); const Icon = window.Icon; const item = (key, label, href, dropdown, wide) => (