/* === App === */
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "headline": "trust",
  "primary": "navy",
  "display": "fraunces",
  "density": 120
}/*EDITMODE-END*/;
window.TWEAK_DEFAULTS = TWEAK_DEFAULTS;

const App = () => {
  // Mirror tweaks for hero text variant
  const [hl, setHl] = React.useState(TWEAK_DEFAULTS.headline);
  React.useEffect(() => {
    const handler = (e) => {
      const d = e.detail || {};
      if (d.headline) setHl(d.headline);
    };
    window.addEventListener('juris-tweak', handler);
    return () => window.removeEventListener('juris-tweak', handler);
  }, []);

  return (
    <>
      <Nav dark={true} />
      <Hero tweaks={{ headline: hl }} />
      <TrustBar />
      <Problem />
      <HowItWorks />
      <ForLawyers />
      <Testimonials />
      <ForClients />
      <FAQ />
      <FinalCTA />
      <Footer />
      <JurisTweaks />
    </>
  );
};

// Bridge tweak changes to App
const _origApply = window.__applyTweaks;
window.__applyTweaks = (tw) => {
  _origApply(tw);
  window.dispatchEvent(new CustomEvent('juris-tweak', { detail: tw }));
};

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