// Page bootstrap — each subpage HTML sets window.__ADLEY_PAGE before
// loading the design scripts. We pull the matching Page component off
// of window (babel-standalone runs each script in its own scope so
// bare identifier lookups across scripts don't resolve — the design
// scripts explicitly attach their exports to window).

(function () {
  const page = window.__ADLEY_PAGE || 'landing';
  const accent = '#FF6B1A';
  const tone = 'tactical';

  function render() {
    const mount = document.getElementById('root');
    if (!mount) return;
    const W = window;
    let el;
    if (page === 'how')           el = <W.PageHowItWorks accent={accent} tone={tone}/>;
    else if (page === 'features') el = <W.PageFeatures   accent={accent} tone={tone}/>;
    else if (page === 'faq')      el = <W.PageFAQ        accent={accent} tone={tone}/>;
    else if (page === 'privacy')  el = <W.PagePrivacy    accent={accent} tone={tone}/>;
    else if (page === 'terms')    el = <W.PageTerms      accent={accent} tone={tone}/>;
    else if (page === 'delete')   el = <W.PageDeleteAccount accent={accent} tone={tone}/>;
    else                          el = <W.MarketingLanding accent={accent} tone={tone} heroVariant="rustmap"/>;
    ReactDOM.createRoot(mount).render(el);
  }
  requestAnimationFrame(render);
})();
