---
import { site } from '../data/site';
import ContactForm from './ContactForm.astro';
import { t, contentImageUrl } from '../lib/content';
import T from './content/T.astro';
const year = new Date().getFullYear();
---
<footer class="ftr">
  <div class="container ftr__grid">
    <div>
      <img src={contentImageUrl('footer.logo.image', '/img/logo-light.png')} alt="InsanityLab" width="140" loading="lazy" />
      <T tag="footer.tagline" as="p" class="ftr__tag" />
      <T tag="footer.about" as="p" />
      <p>{t('global.contact.address')}, {t('global.contact.city-line')}<br />{t('global.contact.phone')}<br /><a href={`mailto:${t('global.contact.email')}`}>{t('global.contact.email')}</a></p>
      <p class="ftr__hours">{t('global.hours.1')}</p>
      <p class="ftr__hours">{t('global.hours.2')}</p>
      <p class="ftr__legal">IN-SANITY LAB S.R.L. — P. IVA 03927341200</p>
    </div>
    <nav aria-label="training">
      <T tag="footer.col.training-title" as="h4" />
      {site.footerTraining.map((l, i) => <a href={l.href}>{t(`footer.training.${i + 1}.label`)}</a>)}
    </nav>
    <nav aria-label="servizi">
      <T tag="footer.col.services-title" as="h4" />
      {site.footerServices.map((l, i) => <a href={l.href}>{t(`footer.services.${i + 1}.label`)}</a>)}
    </nav>
    <div>
      <T tag="footer.col.contact-title" as="h4" />
      <ContactForm variant="footer" />
    </div>
  </div>
  <div class="ftr__bar">
    <div class="container ftr__bar-in">
      <p>© {year} <T tag="footer.copyright" as="span" /> <span class="ftr__sep">·</span> <a href="/privacy">Privacy Policy</a> <span class="ftr__sep">·</span> <a href="/cookie-policy">Cookie Policy</a></p>
      <p>{t('footer.social-label')} {site.socials.map((s) => <a href={s.url} rel="noopener" target="_blank">{s.label}</a>)}</p>
    </div>
  </div>
</footer>

<style>
  .ftr { background: var(--c-dark); color: #b9aea4; font-size: .88rem; }
  .ftr a { color: #b9aea4; text-decoration: none; display: block; padding: 4px 0; }
  .ftr a:hover { color: #fff; }
  .ftr h4 { color: #fff; text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; margin-bottom: 18px; }
  .ftr__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.3fr; gap: 40px; padding-block: 70px; }
  .ftr__tag { font-family: var(--font-heading); font-size: .7rem; letter-spacing: .2em; color: #fff; }
  .ftr__hours { margin: 0; }
  .ftr__legal { margin-top: 14px; font-size: .78rem; opacity: .8; }
  .ftr__bar-in .ftr__sep { margin: 0 4px; opacity: .5; }
  .ftr__bar { border-top: 1px solid rgba(255,255,255,.08); padding-block: 18px; }
  .ftr__bar-in { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
  .ftr__bar-in a { display: inline; margin-left: 12px; }
  @media (max-width: 991px) { .ftr__grid { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 600px) { .ftr__grid { grid-template-columns: 1fr; } }
</style>
