/* Genesis DMA — root app + router */
const { useEffect: _uapp } = React;

function App() {
  const path = useHashRoute();

  // Smooth scroll-to-top on route change (instant to avoid jank)
  _uapp(() => { window.scrollTo({ top: 0, behavior: 'auto' }); }, [path]);

  let page;
  if (path === '/' || path === '') page = <HomePage />;
  else if (path === '/about') page = <AboutPage />;
  else if (path === '/contact') page = <ContactPage />;
  else if (path.startsWith('/capabilities/')) {
    const slug = path.replace('/capabilities/', '');
    page = SERVICES[slug] ? <ServicePage slug={slug} /> : <NotFoundPage />;
  } else page = <NotFoundPage />;

  return (
    <>
      <BrandBar />
      <CustomCursor />
      <Header path={path} />
      {page}
      <Footer />
    </>
  );
}

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