/* Danex Roofing — landing page composition. */
function App() {
  const goQuote = () => {
    const el = document.getElementById('quote');
    if (el) window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - 70, behavior: 'smooth' });
  };

  return (
    <React.Fragment>
      <Header onQuote={goQuote} />
      <Hero onQuote={goQuote} />
      <Services />
      <WhyUs onQuote={goQuote} />
      <ServiceAreas />
      <Gallery />
      <Testimonials />
      <QuoteForm />
      <Faq />
      <Footer />
    </React.Fragment>
  );
}

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

/* Convert Lucide <i data-lucide> placeholders to SVG, and keep converting
   as React mounts/updates the tree (e.g. the quote-form success state). */
(function () {
  let queued = false;
  const draw = () => { queued = false; window.lucide && window.lucide.createIcons(); };
  const schedule = () => { if (!queued) { queued = true; requestAnimationFrame(draw); } };
  schedule();
  const root = document.getElementById('root');
  new MutationObserver(schedule).observe(root, { childList: true, subtree: true });
})();
