// site-chrome.jsx: the ONE header and footer used by every page.
// fixed, hides while the hero scrolls (needs Engine + #top)
// fixed, always visible (sub-pages)
// scrolls away with the Services hero, then docks fixed and slides in below it (needs Engine + #top)
//
// Change nav links or footer copy HERE (links) / content.js (contact, footer) and every page follows.
// Uses only plain browser APIs so it works on pages that don't load hero-fx.js / engine.js.
const NAV_LINKS = [
{ label: 'Services', href: '/services/', page: true, icon: 'camera' },
{ label: 'About', href: '#about', icon: 'smile' },
{ label: 'My Work', href: '#work', icon: 'film' },
];
// Small line icons (currentColor, rounded strokes) so they follow the link colour.
const NAV_ICONS = {
camera: <> >,
smile: <> >,
mail: <> >,
film: <> >,
};
const NavIcon = ({ name }) => (
{NAV_ICONS[name]}
);
// Services mega-dropdown: one card per entry in SERVICES_DATA (services-data.js), same
// torn-paper + tape language as the rest of the site. Opens on hover/focus of the "Services" link.
const SVC_TAPE = ['var(--sun)', 'var(--pop)', 'var(--blue)', 'var(--sun)'];
function ServicesPanel({ open }) {
const list = typeof SERVICES_DATA !== 'undefined' ? SERVICES_DATA : [];
if (!list.length) return null;
return (
);
}
function useIsMobile() {
const q = '(max-width: 699px)';
const [m, setM] = React.useState(() => matchMedia(q).matches);
React.useEffect(() => {
const mq = matchMedia(q), on = () => setM(mq.matches);
mq.addEventListener('change', on);
return () => mq.removeEventListener('change', on);
}, []);
return m;
}
// On the homepage anchors stay in-page; elsewhere they point back at the homepage.
const siteHref = (href, home) => (href.startsWith('#') && !home ? '/' + href : href);
// Same slow, interruptible glide as the hero's "Book your content" CTA, for in-page anchors.
const glideTo = (home, id) => (e) => {
if (!home || !window.Engine) return;
const el = document.getElementById(id);
if (!el) return;
e.preventDefault();
e.stopPropagation();
Engine.scrollTo(el);
};
function SiteHeader({ variant = 'fixed', active }) {
const home = variant === 'home';
const mobile = useIsMobile();
const ref = React.useRef(null);
const [open, setOpen] = React.useState(false);
const [svcOpen, setSvcOpen] = React.useState(false);
const svcTimer = React.useRef(null);
const navRef = React.useRef(null), markRef = React.useRef(null);
const svcShow = () => { clearTimeout(svcTimer.current); setSvcOpen(true); };
const svcHide = () => { clearTimeout(svcTimer.current); svcTimer.current = setTimeout(() => setSvcOpen(false), 140); };
// Highlighter marker: slides under the hovered/focused link, rests on the current page's link.
// Measured via getBoundingClientRect (not offsetLeft) so it still lands right when a link sits
// inside a positioned wrapper (e.g. .hx-svcitem) instead of being a direct child of the nav.
const moveMark = (a, rest) => {
const m = markRef.current, nav = navRef.current; if (!m || !a || !nav) return;
const navRect = nav.getBoundingClientRect(), aRect = a.getBoundingClientRect();
m.style.setProperty('--mx', (aRect.left - navRect.left) + 'px');
m.style.setProperty('--mw', aRect.width + 'px');
m.dataset.on = rest === 'off' ? '' : '1';
};
const rest = () => {
const cur = navRef.current && navRef.current.querySelector('[aria-current="page"]');
if (cur) moveMark(cur); else if (markRef.current) markRef.current.dataset.on = '';
};
React.useEffect(() => { if (!mobile) rest(); }, [mobile, active]);
// Homepage only: slide away while the hero plays, back once the intent page is past.
React.useEffect(() => {
if (!home || !window.Engine) return;
const hero = document.getElementById('top');
return Engine.add(() => {
const hd = ref.current; if (!hd || !hero) return;
const show = Engine.prog(hero) < 0.03 || hero.getBoundingClientRect().bottom < innerHeight * 0.98;
if (hd._s !== show) { hd._s = show; Engine.w(hd, 'transform', show ? 'none' : 'translateY(-130%)'); }
});
}, []);
// Static variant (Services): scrolls away with the hero, then docks as a fixed header
// that slides in once the hero (incl. "Four ways to work together") is scrolled past.
React.useEffect(() => {
if (variant !== 'static' || !window.Engine) return;
const hero = document.getElementById('top');
return Engine.add(() => {
const hd = ref.current; if (!hd || !hero) return;
const dock = hero.getBoundingClientRect().bottom < innerHeight * 0.98;
if (hd._d === dock) return;
const first = hd._d === undefined; hd._d = dock;
if (first && !dock) return;
if (dock) {
hd.style.transition = 'none';
hd.classList.remove('hx-header-abs');
hd.style.transform = 'translateY(-130%)';
hd.getBoundingClientRect();
hd.style.transition = '';
hd.style.transform = 'none';
} else {
hd.classList.add('hx-header-abs');
hd.style.transform = '';
}
});
}, []);
React.useEffect(() => { if (!mobile) setOpen(false); }, [mobile]);
React.useEffect(() => {
if (!open && !svcOpen) return;
const on = (e) => { if (e.key === 'Escape') { setOpen(false); setSvcOpen(false); } };
addEventListener('keydown', on);
return () => removeEventListener('keydown', on);
}, [open, svcOpen]);
return (
);
}
// "Made by Rabbhit" credit (Rabbhit client site standard, see CLAUDE.md). Inherits the
// footer's type and colour; the mark is currentColor.
const RABBHIT_MARK = 'M71 240C69 239 66 238 66 238C66 238 66 237 65 237C65 237 65 237 64 237C64 236 64 236 63 236C63 235 63 229 63 229C64 229 64 228 64 228C65 226 69 222 74 220C80 217 80 217 80 212C80 206 77 200 75 199C75 199 74 199 74 199C74 199 74 198 73 198C72 198 71 197 71 197C71 197 71 197 71 197C70 197 65 194 64 193C64 193 63 192 62 192C57 188 51 183 47 177C46 177 46 176 46 176C44 173 40 166 39 163C38 159 37 156 38 156C38 156 38 156 38 156C38 156 39 155 39 156C40 156 40 156 40 155C39 155 41 154 42 154C42 155 43 154 43 153C44 152 45 151 46 151C46 152 48 150 48 150C48 149 48 149 48 149C49 149 49 149 49 148C50 147 50 146 51 146C51 146 52 145 52 145C52 145 52 144 53 144C53 143 54 143 54 142C53 141 54 141 57 141C58 141 61 140 62 140C63 140 64 139 65 139C65 139 66 139 67 139C67 139 69 138 70 137C73 137 77 135 77 135C77 134 78 134 79 134C79 134 80 133 80 133C80 133 80 133 80 133C82 133 87 128 89 125C90 122 91 122 91 122C92 122 92 122 92 122C92 122 92 122 93 123C94 123 95 123 95 124C95 124 96 125 98 126C102 129 107 133 110 138C111 139 111 140 112 141C112 142 112 143 113 143C113 144 113 145 113 146C114 146 114 147 114 147C115 149 115 165 114 168C114 169 113 170 113 172C113 174 113 175 112 175C112 176 112 177 112 179C112 180 111 182 111 182C111 182 111 183 110 184C110 185 110 186 110 187C110 187 109 188 109 190C108 195 107 198 107 198C107 199 106 200 106 201C105 206 104 209 104 209C104 210 104 210 103 211C103 212 103 213 103 213C103 213 102 214 102 216C102 217 102 218 101 218C101 218 101 220 100 222C99 226 97 230 96 231C91 238 86 240 77 240C74 240 71 240 71 240ZM115 239C112 238 111 237 110 235C109 234 109 230 109 230C110 230 110 229 110 229C111 225 116 220 120 218C125 216 125 216 130 216C133 216 135 216 135 216C135 216 134 215 133 214C131 212 130 210 130 210C130 210 130 209 129 209C129 209 126 203 126 203C126 203 125 202 125 201C125 201 124 199 124 197C124 196 124 194 123 194C123 193 123 183 123 183C124 183 124 181 124 180C124 178 125 176 125 176C125 176 125 175 126 174C127 167 138 154 144 151C145 150 145 150 145 150C145 150 146 149 147 149C147 149 148 149 148 148C148 148 149 148 149 148C150 148 151 147 151 147C152 147 156 146 159 145C162 145 168 145 170 145C174 146 178 147 178 147C179 147 180 148 182 148C185 150 185 150 182 149C179 149 167 151 166 151C166 152 166 152 165 152C162 153 155 156 152 158C151 160 146 165 145 166C145 166 144 167 144 167C144 168 143 169 143 169C143 169 141 172 140 175C140 175 140 177 139 177C139 178 139 179 139 179C138 180 138 193 139 194C139 194 139 195 139 196C140 196 140 198 140 198C141 199 141 200 141 200C141 201 145 205 147 208C151 211 151 211 154 213C154 213 155 214 155 214C155 214 159 216 171 222C174 223 177 225 177 225C177 225 178 225 178 226C180 226 185 230 186 231C189 234 187 239 183 239C182 239 182 239 181 239C181 240 177 240 167 239C149 239 137 239 126 239C119 240 118 240 115 239ZM203 207C203 206 205 201 205 201C206 201 206 199 206 198C206 197 207 196 207 195C210 188 210 158 207 151C207 150 206 149 206 148C206 147 206 146 205 146C204 143 204 142 203 141C203 140 203 140 203 140C203 140 202 139 202 138C202 137 202 137 201 137C201 137 201 136 201 135C200 135 200 134 200 134C200 134 200 134 199 133C199 132 195 127 193 126C191 124 189 122 189 122C189 122 188 121 187 121C187 120 186 120 186 120C185 120 185 120 185 120C185 119 181 117 180 117C180 117 180 117 180 117C180 116 179 116 178 116C177 116 177 116 177 115C177 115 176 115 174 115C172 114 170 114 169 114C167 113 153 113 149 114C147 114 144 114 141 114C138 115 135 115 135 115C135 116 133 116 131 116C130 116 128 117 126 117C121 118 102 118 101 117C101 116 100 116 99 116C99 116 98 116 97 115C97 115 96 115 95 114C92 113 91 112 88 109C86 107 85 106 85 105C85 105 85 104 85 104C84 104 84 103 83 102L83 100 82 102C82 105 81 110 80 111C80 111 80 112 80 112C80 113 77 117 76 119C76 120 70 126 69 126C68 127 65 129 64 129C60 131 60 131 59 131C59 131 58 131 58 132C57 132 55 132 54 133C52 133 51 133 50 133C48 134 37 134 36 133C36 133 35 133 34 133C32 133 27 131 27 130C27 130 26 130 26 130C24 129 24 129 22 127C21 126 20 125 20 124C19 123 19 123 19 123C18 123 18 108 19 105C19 104 20 103 20 102C20 100 20 99 21 99C21 99 21 98 21 97C22 96 22 94 22 94C22 94 22 93 23 93C23 92 23 91 23 91C23 91 24 90 24 89C24 89 25 87 25 87C25 86 26 85 26 85C26 84 26 84 26 84C26 84 27 84 27 83C28 81 28 81 30 77C32 75 35 71 36 71C36 71 37 71 37 70C38 70 39 69 40 68C40 68 41 68 41 68C41 67 47 64 48 64C48 64 49 64 49 64C49 63 51 63 52 63C53 62 55 62 55 62C56 62 59 61 61 61C66 61 66 61 67 58C68 57 68 56 68 56C68 55 69 54 69 52C70 50 71 49 71 48C71 47 71 46 71 46C71 46 72 45 72 44C72 44 72 43 73 42C73 41 73 40 73 40C74 39 74 38 74 37C74 36 75 35 75 35C75 35 75 34 76 33C76 33 76 32 76 32C76 32 77 30 78 28C78 25 79 24 79 23C79 23 79 22 80 21C80 20 80 19 81 19C81 19 81 18 81 18C81 17 84 11 85 10C87 8 89 6 91 6C92 6 92 6 93 4C93 4 93 3 94 2C95 1 95 1 94 1C93 0 95 0 97 1C103 4 105 14 101 22C101 22 101 23 101 23C101 23 99 26 98 28C97 31 95 35 94 35C94 35 94 36 94 36C94 37 93 38 93 38C92 39 91 41 91 42C91 42 91 42 90 42C90 42 90 42 90 43C90 43 89 44 87 46C87 47 87 47 86 47C86 48 86 48 86 48C86 49 81 55 80 55C80 55 80 55 80 55C80 55 79 56 79 57C78 58 76 60 76 60L75 62 77 62C81 62 86 58 97 46C98 45 100 42 102 41C104 39 106 36 108 34C111 30 124 18 125 16C127 15 130 12 131 12C131 12 131 12 131 12C131 12 136 10 136 10C136 10 137 9 137 9C137 8 147 7 147 8C148 8 148 8 149 8C155 10 158 23 154 31C154 31 154 32 154 32C152 39 143 49 136 54C135 55 134 55 134 55C133 57 117 65 116 65C116 65 116 65 116 65C116 65 116 65 115 65C115 65 114 66 113 66C112 67 111 67 110 67C110 68 109 68 109 68C109 68 109 68 109 68C107 68 97 74 95 76C93 79 93 87 95 91C95 92 95 93 95 93C95 93 97 97 98 98C99 99 103 103 103 103C104 103 104 104 105 104C106 105 111 106 116 106C120 106 128 104 128 104C129 104 130 104 132 103C133 103 135 103 135 103C136 102 141 101 146 101C148 100 151 100 152 100C155 99 166 99 167 100C168 100 170 100 172 100C174 101 176 101 176 101C176 101 177 102 178 102C179 102 181 102 181 103C181 103 181 103 182 103C183 103 184 104 185 104C185 104 186 105 188 105C189 106 190 107 190 107C191 107 191 107 192 108C192 108 192 108 193 108C193 108 194 109 195 110C199 112 208 121 208 122C208 122 208 122 208 123C209 123 209 124 211 126C212 128 214 132 214 132C214 132 214 132 214 132C214 133 216 136 216 136C216 136 216 137 217 138C217 139 218 140 218 140C218 140 218 141 218 142C219 143 220 149 221 153C222 158 222 176 221 177C221 178 221 178 220 179C220 181 219 185 218 187C218 187 218 188 217 189C217 189 217 190 217 190C217 190 216 190 216 191C216 192 213 197 213 197C213 197 212 198 212 198C211 200 203 208 203 207ZM56 102C62 100 66 96 67 90C67 86 59 83 54 86C47 90 43 100 48 102C49 102 49 102 49 103C49 103 54 103 56 102ZM86 82C86 81 88 77 89 75C91 72 96 68 97 68C98 68 98 68 98 68C98 68 98 67 99 67C100 67 100 66 100 66C101 66 103 65 112 60C118 57 125 53 126 53C126 52 126 52 127 52C128 52 128 51 128 51C129 51 129 50 129 50C130 50 139 43 141 40C142 39 142 38 143 38C143 38 143 37 144 36C144 35 144 35 144 35C145 35 145 35 145 34C145 34 145 33 146 32C146 31 147 30 147 30C147 29 147 29 147 29C148 28 148 24 146 22C145 21 140 21 137 22C137 23 135 23 135 24C134 24 133 25 133 25C133 25 132 25 131 26C127 28 121 34 111 44C102 52 98 56 94 59C93 61 91 62 90 63C90 64 89 64 89 64C88 64 88 65 88 65C87 66 81 70 81 70C80 70 80 70 80 71C80 71 80 71 79 71C79 72 78 72 76 73C75 73 74 74 74 74C73 74 73 75 75 75C75 75 78 77 79 78C79 78 81 79 82 81C85 83 86 84 86 82Z';
function RabbhitCredit() {
return (
Made by Rabbhit
);
}
function SiteFooter() {
const c = (window.SITE_CONTENT && window.SITE_CONTENT.contact) || {};
const f = (window.SITE_CONTENT && window.SITE_CONTENT.footer) || {};
const email = c.email || 'info@lamialens.com';
return (
);
}
Object.assign(window, { SiteHeader, SiteFooter });