// DEMIURGE — LEGAL HUB (/legal)
const LegalHub = () => {
  const docs = window.LEGAL_DOCS || {};
  const order = window.LEGAL_ORDER || Object.keys(docs);
  const S = window.SITE || {};
  const cards = order.map(k => docs[k]).filter(Boolean);
  return (
    <React.Fragment>
      <a href="#main" className="lp-skip">Skip to content</a>
      <div className="lp-starfield" aria-hidden="true"></div>
      <div className="lp-vignette" aria-hidden="true"></div>
      <SiteNav/>
      <main id="main" className="page-wrap">
        <section className="page-hero">
          <div className="lp">
            <div className="lp-eyebrow">/ Legal</div>
            <h1 className="page-h1">Legal &amp; compliance</h1>
            <p className="page-lede">
              Everything governing how {S.legalName || 'Demiurge Systems Ltd'} operates, handles data, and secures its
              services. We publish only what is accurate today, and flag anything still being finalised.
            </p>
          </div>
        </section>
        <section className="page-body">
          <div className="lp">
            <div className="card-grid">
              {cards.map(d => (
                <a key={d.key} href={d.route} className="card" style={{textDecoration: 'none'}}>
                  <div className="k">{d.route}</div>
                  <h2>{d.title}</h2>
                  <p>{d.description}</p>
                  <div style={{marginTop: 'auto', fontFamily: 'Geist Mono', fontSize: 11, color: '#8388a8'}}>
                    v{d.version} · updated {d.lastUpdated} →
                  </div>
                </a>
              ))}
            </div>

            <div className="prose" style={{marginTop: 40}}>
              <h2>Cookies &amp; tracking</h2>
              <p>This site does not set non-essential or advertising cookies and embeds no third-party analytics trackers, so there are no cookie preferences to manage here. Strictly-necessary cookies may be set by our payment processor on its own domain during checkout. Full details are in the <a href="/legal/privacy#cookies">cookies section of the Privacy Policy</a>.</p>
              <h2>Contact for legal, privacy &amp; accessibility</h2>
              <p>Legal, privacy, DPA, security, and accessibility enquiries — including requests for any policy in an alternative format: <a href={`mailto:${S.legalEmail || 'ops@demiurge.systems'}`}>{S.legalEmail || 'ops@demiurge.systems'}</a>, or use the <a href="/contact">contact form</a>.</p>
              <div className="note warn">
                Registered office address, any ICO fee registration, and the final governing-law confirmation are being completed and will appear here before they are relied upon.
              </div>
            </div>
          </div>
        </section>
      </main>
      <SiteFooter/>
    </React.Fragment>
  );
};
ReactDOM.createRoot(document.getElementById('root')).render(<LegalHub/>);
