/* Router. Hash routing, same as before, so a single static file set can
   be served from anywhere. */
function Root2() {
  const route = useRoute2();
  const r = route || '/';

  React.useEffect(() => { window.scrollTo(0, 0); }, [r]);

  /* Routes of the previous site keep working: "about" is the team
     section here, the retired product pages go home. The demo request
     lands on the form with its reason already set. */
  React.useEffect(() => {
    if (r.startsWith('/about')) goToSection('team');
    else if (r.startsWith('/atlas') || r.startsWith('/lab')) window.location.hash = '/';
  }, [r]);

  if (r === '/' || r === '') return <Landing2/>;
  if (r.startsWith('/case/automotive')) return <CaseAutomotivePage/>;
  if (r.startsWith('/evidence')) return <CaseAutomotivePage/>;
  if (r.startsWith('/verify')) return <VerifyPage/>;
  if (r.startsWith('/limits')) return <LimitsPage/>;
  if (r.startsWith('/contact') || r.startsWith('/demo')) return <ContactPage2/>;
  if (r.startsWith('/impressum') || r.startsWith('/imprint')) return <ImpressumPage/>;
  if (r.startsWith('/datenschutz') || r.startsWith('/privacy')) return <DatenschutzPage/>;
  if (r.startsWith('/about') || r.startsWith('/atlas') || r.startsWith('/lab')) return <Landing2/>;

  return (
    <Page>
      <div className="min-h-[60vh] flex flex-col items-center justify-center text-center px-8">
        <Eyebrow>404</Eyebrow>
        <h1 className="mt-3 text-[32px] font-semibold tracking-tight">No such page here.</h1>
        <a href="#/" className="mt-6 rounded-full bg-ink text-paper px-5 py-2.5 text-[13px]">Back to the start</a>
      </div>
    </Page>
  );
}

ReactDOM.createRoot(document.getElementById('root')).render(<Root2/>);
