const { useState, useEffect } = React;
function LangToggle() {
const en = window.LANG === 'en';
const page = window.location.pathname.includes('project.html') ? 'project.html' + window.location.search : 'index.html';
const ptHref = en ? '../' + page : page;
const enHref = en ? page : 'en/' + page;
const st = (act) => ({ fontFamily: 'Helvetica,Arial,sans-serif', fontWeight: act ? 700 : 400, fontSize: 12, letterSpacing: '.14em', color: '#fff', opacity: act ? 1 : .45, textDecoration: 'none', transition: 'opacity .25s ease' });
const hov = (e) => { e.currentTarget.style.opacity = '1'; };
return (
);
}
function WebsiteNav({ showLinks = true } = {}) {
const [scrolled, setScrolled] = useState(false);
const [menuOpen, setMenuOpen] = useState(false);
const { isMobile } = useViewport();
useEffect(() => {
const fn = () => setScrolled(window.scrollY > window.innerHeight * 0.8);
window.addEventListener('scroll', fn, { passive: true });
fn();
return () => window.removeEventListener('scroll', fn);
}, []);
// lock page scroll while the overlay menu is open
useEffect(() => {
document.body.style.overflow = menuOpen ? 'hidden' : '';
return () => { document.body.style.overflow = ''; };
}, [menuOpen]);
// close menu if we grow back to desktop
useEffect(() => { if (!isMobile) setMenuOpen(false); }, [isMobile]);
const links = [['#portfolio', T('trabalhos', 'works')], ['#servicos', T('serviços', 'services')], ['#sobre', T('sobre', 'about')], ['#contato', T('contato', 'contact')]];
if (isMobile) {
if (!showLinks) {
return (
);
}
const bar = (rot, ty) => ({
width: 22, height: 2, borderRadius: 2,
background: menuOpen ? '#1D1D1B' : '#fff',
transition: 'transform .35s cubic-bezier(.76,0,.24,1), background .2s',
transform: menuOpen ? 'translateY(' + ty + 'px) rotate(' + rot + 'deg)' : 'none',
});
return (
{/* Hamburger — always reachable on mobile; mix-blend so it reads on dark hero & light sections */}
{/* Full-screen overlay menu */}
{links.map(([href, label]) => (
setMenuOpen(false)} style={{
fontFamily: 'HelveticaCompressed, "Arial Narrow", Arial, sans-serif', fontWeight: 700,
fontSize: 'clamp(42px, 14vw, 76px)', textTransform: 'uppercase', lineHeight: 1.05,
color: '#E3DDD8', textDecoration: 'none', letterSpacing: '-.01em',
}}>{label}
))}
);
}
return (
);
}
Object.assign(window, { WebsiteNav });