// Footer.jsx
function Footer({ onNavigate }) {
  const go = (route) => (e) => {
    if (typeof route === "string" && route.startsWith("mailto:")) return; // let mailto open
    e.preventDefault();
    if (onNavigate && route) onNavigate(route);
  };

  const cols = [
    {
      h: "Council",
      links: [
        ["Charter", "charter"],
        ["Governance", "governance"],
        ["Methodology Council", "methodology-council"],
        ["Working groups", "working-groups"],
      ],
    },
    {
      h: "Benchmarks",
      links: [
        ["PatentBench", "patentbench"],
        ["DraftBench", "draftbench"],
        ["ValueBench", "valuebench"],
        ["Apply for accreditation", "accreditation"],
      ],
    },
    {
      h: "Resources",
      links: [
        ["Press kit", "presskit"],
        ["Open Questions v0.1", "open-questions"],
        ["Therasense Standard", "therasense"],
        ["contact@openipcouncil.org", "mailto:contact@openipcouncil.org"],
      ],
    },
  ];

  return (
    <footer className="footer">
      <div className="container">
        <div className="footer-grid">
          <div className="footer-brand">
            <div className="footer-brand-head">
              <a href="#" onClick={go("home")} className="footer-brand-link">
                <img src="assets/seal-ink.svg" width="40" height="40" alt="" />
                <div>
                  <div className="footer-brand-name">Open IP Council</div>
                  <div className="footer-brand-meta">EST · MMXXVI · INTA</div>
                </div>
              </a>
            </div>
            <p className="footer-brand-body">
              A standards body for evaluating AI tools used in intellectual property workflows. The Council does not own any benchmark. It accredits, coordinates, and publishes joint reports.
            </p>
            <div className="footer-status">
              <span className="footer-status-dot" aria-hidden="true"></span>
              <span className="footer-status-label">Pre-formation · Charter v0.1 in public comment</span>
            </div>
          </div>

          {cols.map((col) => (
            <div key={col.h} className="footer-col">
              <h4>{col.h}</h4>
              <ul>
                {col.links.map(([label, route]) => {
                  const isMail = typeof route === "string" && route.startsWith("mailto:");
                  return (
                    <li key={label}>
                      <a href={isMail ? route : "#"} onClick={go(route)}>{label}</a>
                    </li>
                  );
                })}
              </ul>
            </div>
          ))}
        </div>

        <div className="footer-meta">
          <div className="footer-meta-l">
            <span>© 2026 Open IP Council</span>
            <span className="footer-meta-sep">·</span>
            <span>Apache-2.0 unless otherwise noted</span>
          </div>
          <div className="footer-meta-r">
            <span>OIPC-SITE-v0.1</span>
            <span className="footer-meta-sep">·</span>
            <span>last updated 2026-04-29</span>
          </div>
        </div>
      </div>
    </footer>
  );
}
window.Footer = Footer;
