/* App.jsx — orchestrates the views */

function App() {
  const [view, setView] = React.useState('home');
  const onNav = (id) => {
    setView(id);
    window.scrollTo({top: 0, behavior: 'instant'});
  };
  // Expose globally so server-side child links can navigate too
  window.__navigate = onNav;

  return (
    <React.Fragment>
      <Nav active={view} onNav={onNav} />
      {view === 'home' && <Home onNav={onNav} />}
      {view === 'services' && <Services onNav={onNav} />}
      {view === 'about' && <About onNav={onNav} />}
      {view === 'contact' && <Contact onNav={onNav} />}
      <Footer onNav={onNav} />
    </React.Fragment>
  );
}

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