// 228 FILMS · Footer
// Mirror grammaire OPERATORS V12 sans copie. Voix v16, sans archaïsme.
// Grand titre noir → ivoire, paragraphe + CTA primaire à droite,
// grille 4 colonnes (marque, paliers, contact, Groupe 228),
// signature mono en bas, sceau aurum décoratif qui saigne bas-droite.

function Footer() {
  const tr = useTr();
  const { isMobile } = useViewport();
  return (
    <footer id="contact" style={{
      position: 'relative',
      background: TOK.ivory, color: TOK.ink,
      paddingTop: isMobile ? 72 : 100, paddingBottom: 40,
      overflow: 'hidden',
      marginTop: 0,
      borderTop: `1px solid ${TOK.ink10}`,
    }}>
      <Container>
        {/* Grand call à la lecture · titre + CTA */}
        <div style={{
          display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1.4fr 1fr',
          gap: isMobile ? 36 : 64, alignItems: isMobile ? 'start' : 'end',
          paddingBottom: isMobile ? 48 : 64, borderBottom: `1px solid ${TOK.ink10}`,
        }}>
          <Reveal>
            <Kicker color="var(--bronze)" style={{ marginBottom: 22 }}>
              {tr({ fr: 'Premier pas', en: 'First step' })}
            </Kicker>
            <h2 style={{
              margin: 0, fontFamily: TOK.sans, fontWeight: 500,
              fontSize: 'clamp(40px, 6vw, 84px)',
              lineHeight: 1.0, letterSpacing: '-0.03em',
              color: TOK.ink, textWrap: 'balance',
            }}>
              {tr({
                fr: 'Cadrer votre\nprojet en cinq\nquestions.',
                en: 'Frame your\nproject in five\nquestions.',
              }).split('\n').map((line, i) => <div key={i}>{line}</div>)}
            </h2>
          </Reveal>
          <Reveal delay={2} style={{ alignSelf: 'end' }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
              <p style={{
                margin: 0, fontFamily: TOK.sans, fontSize: 15.5, lineHeight: 1.6,
                color: TOK.ink70,
              }}>
                {tr({
                  fr: 'Nous lisons chaque demande nous-mêmes, pour vous revenir avec un estimé clair sous 24 heures ouvrables.',
                  en: 'We read each request ourselves, to come back to you with a clear estimate within 24 business hours.',
                })}
              </p>
              <a href="#contact"
                onMouseEnter={e => { e.currentTarget.style.boxShadow = '0 0 0 6px rgba(139,111,31,.18)'; }}
                onMouseLeave={e => { e.currentTarget.style.boxShadow = 'none'; }}
                style={{
                  display: 'inline-flex', alignItems: 'center', gap: 14,
                  background: TOK.ink, color: TOK.ivory,
                  padding: '15px 26px', borderRadius: 999,
                  fontFamily: TOK.sans, fontSize: 15, fontWeight: 500,
                  width: 'fit-content', textDecoration: 'none',
                  transition: 'box-shadow .2s',
                }}>
                {tr({ fr: 'Demander une soumission', en: 'Request a quote' })}
                <span style={{ color: TOK.aurum }}>→</span>
              </a>
            </div>
          </Reveal>
        </div>

        {/* Grille 4 colonnes (desktop) / stack vertical (mobile) */}
        <div style={{
          display: 'grid',
          gridTemplateColumns: isMobile ? '1fr' : '1.4fr 1fr 1fr 1fr',
          gap: isMobile ? 36 : 48, paddingTop: isMobile ? 48 : 64, paddingBottom: isMobile ? 40 : 60,
        }}>
          {/* Bloc marque */}
          <div>
            <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginBottom: 22 }}>
              <Sceau size={38} color="var(--bronze)" withCenter />
              <span style={{ fontFamily: TOK.sans, fontSize: 24, fontWeight: 500, letterSpacing: '-0.02em' }}>228 FILMS</span>
            </div>
            <p style={{
              margin: 0, fontFamily: TOK.sans, fontSize: 14, lineHeight: 1.6,
              color: TOK.ink55, maxWidth: 340,
            }}>
              {tr({
                fr: 'Nous concevons et réalisons vos films, du tournage classique au drone FPV, pour vous donner des images qui élèvent vos lieux, vos marques et vos œuvres.',
                en: 'We design and shoot your films, from classic filming to FPV drone, so you get images that elevate your places, your brands and your work.',
              })}
            </p>
          </div>

          {/* Univers */}
          <FooterCol title={{ fr: 'UNIVERS', en: 'UNIVERSES' }} items={[
            { href: '#mandats',    label: { fr: 'Mandats récurrents',         en: 'Recurring engagements' } },
            { href: '#immobilier', label: { fr: 'Immobilier & architecture',  en: 'Real estate & architecture' } },
            { href: '#mandats',    label: { fr: 'Drone FPV',                   en: 'FPV drone' } },
          ]} />

          {/* Contact */}
          <FooterCol title={{ fr: 'CONTACT', en: 'CONTACT' }} items={[
            { href: 'mailto:info@228films.com', label: { fr: 'Nous écrire',          en: 'Write to us' } },
            { href: '#contact',                  label: { fr: 'Demander une soumission', en: 'Request a quote' } },
          ]} />

          {/* Groupe 228 */}
          <FooterCol title={{ fr: 'GROUPE 228', en: 'GROUPE 228' }} items={[
            { href: 'https://228operators.com', label: '228 OPERATORS ↗', external: true },
            { href: 'https://228academy.com',   label: '228 ACADEMY ↗',   external: true },
            { href: 'https://groupe228.com',    label: 'GROUPE 228 ↗',    external: true },
          ]} />
        </div>

        {/* Ligne condensée · mentions + signature à gauche, socials à droite */}
        <FooterLegalAndSocials />
      </Container>

      {/* Sceau bronze décoratif · saigne bas-droite */}
      <div aria-hidden="true" style={{
        position: 'absolute', bottom: -200, right: -200,
        opacity: .06, pointerEvents: 'none',
      }}>
        <Sceau size={520} color="var(--bronze)" withCenter />
      </div>
    </footer>
  );
}

function FooterCol({ title, items }) {
  const tr = useTr();
  return (
    <div>
      <div style={{
        fontFamily: TOK.mono, fontSize: 10, letterSpacing: '.22em',
        color: TOK.bronze, marginBottom: 22,
      }}>{tr(title)}</div>
      <ul style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: 12 }}>
        {items.map((it, i) => (
          <li key={i}>
            <a href={it.href}
              target={it.external ? '_blank' : undefined}
              rel={it.external ? 'noopener noreferrer' : undefined}
              onMouseEnter={e => e.currentTarget.style.color = 'var(--bronze)'}
              onMouseLeave={e => e.currentTarget.style.color = 'var(--fg-70)'}
              style={{
                fontFamily: TOK.sans, fontSize: 13.5, lineHeight: 1.5,
                color: TOK.ink70, transition: 'color .2s',
              }}>
              {tr(it.label)}
            </a>
          </li>
        ))}
      </ul>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// FooterLegalAndSocials · ligne combinée
// Gauche : Mentions · Confidentialité · CGV (boutons setPage)
// Droite : 5 icônes sociaux Simon Senez (perso opérés en mode pro)
// ─────────────────────────────────────────────────────────────
function FooterLegalAndSocials() {
  const tr = useTr();
  const { setPage } = usePage();
  const links = [
    { page: 'mentions', label: { fr: 'Mentions légales', en: 'Legal notice' } },
    { page: 'privacy',  label: { fr: 'Confidentialité',  en: 'Privacy' } },
    { page: 'cgv',      label: { fr: 'CGV',              en: 'Terms' } },
  ];
  return (
    <div style={{
      paddingTop: 32, paddingBottom: 28,
      borderTop: `1px solid ${TOK.ink10}`,
      display: 'flex', justifyContent: 'space-between', alignItems: 'center',
      flexWrap: 'wrap', gap: 22,
    }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 22, flexWrap: 'wrap' }}>
        {links.map((it) => (
          <button key={it.page} onClick={() => setPage(it.page)}
            onMouseEnter={e => e.currentTarget.style.color = 'var(--bronze)'}
            onMouseLeave={e => e.currentTarget.style.color = 'var(--fg-55)'}
            style={{
              all: 'unset', cursor: 'pointer',
              fontFamily: TOK.mono, fontSize: 10, letterSpacing: '.22em',
              color: TOK.ink55,
              textTransform: 'uppercase',
              transition: 'color .2s',
            }}>{tr(it.label)}</button>
        ))}
        <span aria-hidden="true" style={{
          width: 1, height: 12, background: TOK.ink18,
        }} />
        <span style={{
          fontFamily: TOK.mono, fontSize: 10, letterSpacing: '.22em',
          color: TOK.ink35, textTransform: 'uppercase',
        }}>228 FILMS · {tr({ fr: 'TOUS DROITS RÉSERVÉS', en: 'ALL RIGHTS RESERVED' })}</span>
      </div>
      <FooterSocials />
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// FooterSocials · 5 comptes perso Simon Senez (LinkedIn / IG / FB / X / YT)
// Doctrine : « Réseaux sociaux 100% perso opérés en mode pro · 5 comptes
// Simon distribuent 3 marques. Aucune company page. » (memory)
// Mirror exact du pattern OPERATORS V12 footer.
// Hover : couleur bronze aurum + lift -2px. target="_blank" + noopener.
// ─────────────────────────────────────────────────────────────
function FooterSocials() {
  const socials = [
    { name: 'LinkedIn',  href: 'https://www.linkedin.com/in/simonsenez/', icon: <LogoLinkedIn /> },
    { name: 'Instagram', href: 'https://www.instagram.com/simonsenez/',   icon: <LogoInstagram /> },
    { name: 'Facebook',  href: 'https://www.facebook.com/SimSenez',       icon: <LogoFacebook /> },
    { name: 'X',         href: 'https://x.com/SimonSenez',                 icon: <LogoX /> },
    { name: 'YouTube',   href: 'https://www.youtube.com/@SimonSenez',     icon: <LogoYouTube /> },
    { name: 'Email',     href: 'mailto:info@228films.com',                  icon: <LogoEmail />,    external: false, label: '228 FILMS · info@228films.com' },
  ];
  return (
    <div style={{ display: 'flex', gap: 12 }}>
      {socials.map((s) => (
        <a key={s.name} href={s.href}
          {...(s.name === 'Email' ? {} : { target: '_blank', rel: 'noopener noreferrer' })}
          aria-label={s.label || `Simon Senez · ${s.name}`}
          style={{
            width: 34, height: 34, borderRadius: 6,
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            color: TOK.ink70,
            transition: 'color .2s, transform .2s, background .2s',
          }}
          onMouseEnter={e => {
            e.currentTarget.style.color = 'var(--bronze)';
            e.currentTarget.style.transform = 'translateY(-2px)';
            e.currentTarget.style.background = 'rgba(139,111,31,.08)';
          }}
          onMouseLeave={e => {
            e.currentTarget.style.color = 'var(--fg-70)';
            e.currentTarget.style.transform = 'translateY(0)';
            e.currentTarget.style.background = 'transparent';
          }}>
          {s.icon}
        </a>
      ))}
    </div>
  );
}

// LinkedIn · official mark
function LogoLinkedIn() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
      <path d="M20.45 20.45h-3.55v-5.57c0-1.33-.03-3.04-1.85-3.04-1.86 0-2.14 1.45-2.14 2.95v5.66H9.36V9h3.41v1.56h.05c.47-.9 1.63-1.85 3.36-1.85 3.6 0 4.27 2.37 4.27 5.45v6.29zM5.34 7.43A2.06 2.06 0 1 1 5.34 3.3a2.06 2.06 0 0 1 0 4.13zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.77C.79 0 0 .77 0 1.72v20.56C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.72V1.72C24 .77 23.2 0 22.22 0z" />
    </svg>
  );
}
// Instagram · official mark
function LogoInstagram() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
      <path d="M12 2.16c3.2 0 3.58.01 4.85.07 1.17.05 1.8.25 2.23.41.56.22.96.48 1.38.9.42.42.68.82.9 1.38.16.42.36 1.06.41 2.23.06 1.27.07 1.65.07 4.85s-.01 3.58-.07 4.85c-.05 1.17-.25 1.8-.41 2.23-.22.56-.48.96-.9 1.38-.42.42-.82.68-1.38.9-.42.16-1.06.36-2.23.41-1.27.06-1.65.07-4.85.07s-3.58-.01-4.85-.07c-1.17-.05-1.8-.25-2.23-.41a3.7 3.7 0 0 1-1.38-.9 3.7 3.7 0 0 1-.9-1.38c-.16-.42-.36-1.06-.41-2.23C2.17 15.58 2.16 15.2 2.16 12s.01-3.58.07-4.85c.05-1.17.25-1.8.41-2.23.22-.56.48-.96.9-1.38.42-.42.82-.68 1.38-.9.42-.16 1.06-.36 2.23-.41C8.42 2.17 8.8 2.16 12 2.16M12 0C8.74 0 8.33.01 7.05.07 5.78.13 4.9.33 4.14.63a5.86 5.86 0 0 0-2.13 1.38A5.86 5.86 0 0 0 .63 4.14C.33 4.9.13 5.78.07 7.05.01 8.33 0 8.74 0 12s.01 3.67.07 4.95c.06 1.27.26 2.15.56 2.91.31.78.73 1.45 1.38 2.13.68.65 1.35 1.07 2.13 1.38.76.3 1.64.5 2.91.56C8.33 23.99 8.74 24 12 24s3.67-.01 4.95-.07c1.27-.06 2.15-.26 2.91-.56a5.86 5.86 0 0 0 2.13-1.38c.65-.68 1.07-1.35 1.38-2.13.3-.76.5-1.64.56-2.91.06-1.28.07-1.69.07-4.95s-.01-3.67-.07-4.95c-.06-1.27-.26-2.15-.56-2.91a5.86 5.86 0 0 0-1.38-2.13A5.86 5.86 0 0 0 19.86.63C19.1.33 18.22.13 16.95.07 15.67.01 15.26 0 12 0zm0 5.84a6.16 6.16 0 1 0 0 12.32 6.16 6.16 0 0 0 0-12.32zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.4-11.84a1.44 1.44 0 1 1 0 2.88 1.44 1.44 0 0 1 0-2.88z" />
    </svg>
  );
}
// Facebook · official mark
function LogoFacebook() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
      <path d="M24 12.07C24 5.4 18.63 0 12 0S0 5.4 0 12.07C0 18.1 4.39 23.1 10.13 24v-8.44H7.08v-3.49h3.05V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.69.24 2.69.24v2.97h-1.52c-1.49 0-1.96.93-1.96 1.89v2.26h3.33l-.53 3.49h-2.8V24C19.61 23.1 24 18.1 24 12.07z" />
    </svg>
  );
}
// X (ex-Twitter) · official mark 2023 refresh
function LogoX() {
  return (
    <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
      <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231 5.45-6.231zm-1.161 17.52h1.833L7.084 4.126H5.117l11.966 15.644z" />
    </svg>
  );
}
// YouTube · official mark
function LogoYouTube() {
  return (
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
      <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
    </svg>
  );
}
// Email · enveloppe minimaliste
function LogoEmail() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
      <rect x="2.5" y="5" width="19" height="14" rx="2" />
      <path d="m3.5 7 8.5 6 8.5-6" />
    </svg>
  );
}

Object.assign(window, { Footer });
