function Footer() {
  const isHome = (typeof window !== 'undefined') && (
    window.location.pathname.endsWith('/') ||
    window.location.pathname.endsWith('/index.html') ||
    window.location.pathname === ''
  );
  const base = isHome ? '' : 'index.html';
  const link = (hash) => base + hash;

  const items = [
    { href: link('#problemy'),  label: 'Dla kogo' },
    { href: link('#pomagam'),   label: 'Jak pomagam' },
    { href: 'portfolio.html',   label: 'Portfolio' },
    { href: link('#proces'),    label: 'Współpraca' },
    { href: link('#omnie'),     label: 'O mnie' },
    { href: link('#faq'),       label: 'FAQ' },
  ];

  return (
    <footer className="g-footer">
      <div className="g-footer-top">
        <a className="g-brand g-brand--footer" href={isHome ? '#' : 'index.html'}>
          <img src="/assets/growthly-logo.svg" alt="Maciej Matera" />
        </a>
        <nav className="g-footer-nav" aria-label="Nawigacja w stopce">
          {items.map((it) => (
            <a key={it.label} href={it.href}>{it.label}</a>
          ))}
        </nav>
      </div>
      <div className="g-footer-bottom">
        <span>© 2026 Maciej Matera</span>
        <a href={link('#kontakt')}>kontakt@maciejmatera.pl</a>
        <span className="g-footer-legal">
          <a href="/e-commerce/polityka-prywatnosci/">Polityka prywatności</a>
        </span>
      </div>
    </footer>
  );
}

window.Footer = Footer;
