/* ──────────────────────────────────────────────────────────
   App entry — wait for ALL Babel scripts before render
   (avoids race when type=text/babel scripts XHR in parallel)
   ────────────────────────────────────────────────────────── */
function App() {
  return (
    <>
      <IntroAnimation />
      <Navbar />
      <Hero />
      <IcebergSection />
      <HowMataiSolves />
      <WhatWeDoSection />
      <BentoSection />
      <CTASection />
      <AboutSection />
      <Footer />
    </>
  );
}

const required = [
  'Navbar', 'Footer', 'Reveal', 'Eyebrow',
  'DotOrb', 'Hero', 'IcebergSection',
  'HowMataiSolves', 'WhatWeDoSection',
  'BentoSection', 'CTASection', 'AboutSection',
];

function tryMount(attempt = 0) {
  const missing = required.filter(k => typeof window[k] === 'undefined');
  if (missing.length === 0) {
    ReactDOM.createRoot(document.getElementById('root')).render(<App />);
    return;
  }
  if (attempt > 80) {
    console.error('Mount failed — missing:', missing);
    return;
  }
  setTimeout(() => tryMount(attempt + 1), 30);
}
tryMount();
