---
import rawThemeConfig from 'virtual:prosefly/lotus/config';
import FooterLinks from 'virtual:prosefly/lotus/components/FooterLinks';
import SiteBrand from 'virtual:prosefly/lotus/components/SiteBrand';
import Credits from '../theme/Credits.astro';
import { isPagefindSearchEnabled } from '../../lib/search';
import type { LotusThemeConfig } from '../../lib/theme';

const themeConfig = rawThemeConfig as LotusThemeConfig;
const pagefindIgnoreAttrs = isPagefindSearchEnabled(themeConfig)
  ? { 'data-pagefind-ignore': true }
  : {};
---

<footer class="lotus-border-subtle border-t bg-(--lotus-footer-background)" {...pagefindIgnoreAttrs}>
  <div class="mx-auto flex flex-col justify-between lg:flex-row max-w-screen-2xl gap-10 px-4 py-10 sm:px-6">
    <div class="space-y-4">
      <SiteBrand class="inline-flex" markIdPrefix="lotus-footer-brand" textClass="text-sm font-semibold sm:text-base" />
      {themeConfig.footer.copyright && (
        <p class="max-w-sm text-sm leading-6 text-(--lotus-text-muted)">
          {themeConfig.footer.copyright}
        </p>
      )}
      {themeConfig.credits && <Credits />}
    </div>
    <FooterLinks />
  </div>
</footer>
