// App root — composes everything + Tweaks wiring

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "heroVariant": "split",
  "heroHeadline": "default",
  "heroShot": "browser",
  "pricingLayout": "cards",
  "typeset": "editorial"
}/*EDITMODE-END*/;

function App() {
  const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);

  // Apply typeset to <body data-typeset="...">
  useEffect(() => {
    document.body.dataset.typeset = t.typeset || "editorial";
  }, [t.typeset]);

  return (
    <>
      <Nav />
      <main>
        <Hero
          variant={t.heroVariant}
          headline={t.heroHeadline}
          shotStyle={t.heroShot}
        />
        <ManifestoStrip />
        <MethodSection />
        <Differentiators />
        <AppTour />
        <SocialProofBig />
        <AboutJaime />
        <PullQuote />
        <Pricing layout={t.pricingLayout} />
        <LeadMagnet />
        <FAQSection />
        <FinalCTA />
      </main>
      <Footer />

      <TweaksPanel title="Tweaks" defaultOpen={false}>
        <TweakSection label="Hero">
          <TweakSelect
            label="Layout"
            value={t.heroVariant}
            onChange={(v) => setTweak("heroVariant", v)}
            options={[
              { value: "split", label: "Split (texto + visual)" },
              { value: "centered", label: "Centrado, gran titular" },
              { value: "editorial", label: "Editorial (titular protagonista)" },
            ]}
          />
          <TweakSelect
            label="Headline"
            value={t.heroHeadline}
            onChange={(v) => setTweak("heroHeadline", v)}
            options={[
              { value: "default", label: '"Crea tu plan de marketing pro con IA…"' },
              { value: "methodology", label: '"No es un chatbot. Es metodología."' },
              { value: "method", label: '"El método, ahora con IA"' },
              { value: "learn", label: '"Aprende mientras creas tu plan"' },
            ]}
          />
          <TweakRadio
            label="Pantallazo"
            value={t.heroShot}
            onChange={(v) => setTweak("heroShot", v)}
            options={[
              { value: "browser", label: "Browser" },
              { value: "floating", label: "Flotantes" },
              { value: "stack", label: "Stack" },
            ]}
          />
        </TweakSection>

        <TweakSection label="Tipografía">
          <TweakSelect
            label="Pareja de fuentes"
            value={t.typeset}
            onChange={(v) => setTweak("typeset", v)}
            options={[
              { value: "editorial", label: "Editorial (Instrument Serif + Geist)" },
              { value: "modern", label: "Modern (Geist con itálicas serif)" },
              { value: "classic", label: "Classic (Newsreader + Plus Jakarta)" },
              { value: "bold", label: "Bold (Fraunces + Geist)" },
            ]}
          />
        </TweakSection>

        <TweakSection label="Precios">
          <TweakRadio
            label="Presentación"
            value={t.pricingLayout}
            onChange={(v) => setTweak("pricingLayout", v)}
            options={[
              { value: "cards", label: "Cards" },
              { value: "table", label: "Tabla" },
            ]}
          />
        </TweakSection>
      </TweaksPanel>
    </>
  );
}

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