// Dentstyle — App root
const { useEffect: useE_App } = React;

function App() {
  useReveal();

  // Smooth-scroll on nav clicks (account for sticky header offset)
  useE_App(() => {
    const onClick = (e) => {
      const a = e.target.closest('a[href^="#"]');
      if (!a) return;
      const id = a.getAttribute("href");
      if (!id || id === "#") return;
      const tgt = document.querySelector(id);
      if (!tgt) return;
      e.preventDefault();
      const y = tgt.getBoundingClientRect().top + window.scrollY - 80;
      window.scrollTo({ top: y, behavior: "smooth" });
    };
    document.addEventListener("click", onClick);
    return () => document.removeEventListener("click", onClick);
  }, []);

  return (
    <React.Fragment>
      <Header />
      <main>
        <Hero />
        <TrustStrip />
        <Treatments />
        <BeforeAfter />
        <Experience />
        <Testimonials />
        <FinalCTA />
      </main>
      <Footer />
      <Fab />
    </React.Fragment>
  );
}

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App/>);
