/* Maison Silya — site header with a quiet mega-menu + EN·FR toggle. Transparent over the dark hero; settles to a solid ivory bar with a hairline on scroll, on inner pages, or whenever a menu panel is open. Nav labels read from i18n (t) so they follow the chosen language. */ function Header({ current, onNav, overHero = false, lang = 'en' }) { const [scrolled, setScrolled] = React.useState(!overHero); const [open, setOpen] = React.useState(null); // open mega panel id const [menu, setMenu] = React.useState(false); // mobile drawer React.useEffect(() => { if (!overHero) { setScrolled(true); return; } setScrolled(false); const el = document.getElementById('ms-scroll'); const onScroll = () => setScrolled((el ? el.scrollTop : window.scrollY) > 80); const target = el || window; target.addEventListener('scroll', onScroll); return () => target.removeEventListener('scroll', onScroll); }, [overHero, current]); const NAV = [ { id: 'collections', label: t('nav.collections'), children: [ { label: t('nav.signature'), route: 'signature', desc: t('nav.signature_d') }, { label: t('nav.bespoke'), route: 'bespoke', desc: t('nav.bespoke_d') }, { label: t('nav.materials'), route: 'materials', desc: t('nav.materials_d') }, { label: t('nav.tufted'), route: 'tufted', desc: t('nav.tufted_d') }, ]}, { id: 'maison', label: t('nav.maison'), children: [ { label: t('nav.philosophy'), route: 'philosophy', desc: t('nav.philosophy_d') }, { label: t('nav.craftsmanship'), route: 'craftsmanship', desc: t('nav.craftsmanship_d') }, { label: t('nav.process'), route: 'process', desc: t('nav.process_d') }, ]}, { id: 'journal', label: t('nav.journal'), route: 'journal' }, { id: 'contact', label: t('nav.contact'), route: 'contact' }, ]; const activeOf = { signature: 'collections', bespoke: 'collections', materials: 'collections', philosophy: 'maison', craftsmanship: 'maison', process: 'maison', journal: 'journal', contact: 'contact' }; const solid = scrolled || !!open; const light = overHero && !solid; const ink = light ? C('ivory') : C('ink'); const openItem = NAV.find((n) => n.id === open); return (
setOpen(null)} style={{ position: 'fixed', top: 0, left: 0, right: 0, zIndex: 50, background: solid ? 'rgba(247,243,236,0.94)' : 'transparent', backdropFilter: solid ? 'saturate(120%) blur(8px)' : 'none', borderBottom: `1px solid ${solid ? C('line') : 'transparent'}`, transition: 'background 600ms var(--ms-ease), border-color 600ms var(--ms-ease)' }}>
{/* Mega panel */}
{openItem && openItem.children && (
{openItem.children.map((c) => ( ))}
)}
{/* Mobile / tablet drawer — rendered as a SIBLING of
so the header's backdrop-filter (which becomes a containing block for position:fixed children on iOS Safari) can't trap this panel inside the 84px bar. */}
setMenu(false)} style={{ position: 'absolute', inset: 0, background: 'rgba(21,17,12,0.45)', opacity: menu ? 1 : 0, transition: 'opacity 420ms var(--ms-ease)' }} />
); } const iconBtn = { background: 'none', border: 'none', cursor: 'pointer', color: 'inherit', padding: 4, display: 'flex' }; Object.assign(window, { Header });