// zp-app.jsx — wires the whole site together with Tweaks

const TWEAK_DEFAULTS = {
  "accent": "#FFD60A",
  "accentInk": "#0A0A0F",
  "ctaText": "Book a free strategy call",
  "headline": "default",
  "motion": "medium",
  "darkHero": false
};

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

  React.useEffect(() => {
    const root = document.documentElement;
    root.style.setProperty('--accent', t.accent);
    root.style.setProperty('--accent-ink', t.accentInk);
    document.body.classList.toggle('reduce-motion', t.motion === 'subtle');
    document.body.classList.toggle('hero-dark', !!t.darkHero);
  }, [t.accent, t.accentInk, t.motion, t.darkHero]);

  return (
    <>
      {t.darkHero && <DarkHeroOverride/>}
      <Nav ctaText={t.ctaText}/>
      <Hero heroVariant={t.headline} ctaText={t.ctaText}/>
      <ProblemSection/>
      <ServicesSection/>
      <DemoSection/>
      <HowSection/>
      <StatsSection/>
      <ROISection/>
      <TestimonialsSection/>
      <PricingSection ctaText={t.ctaText}/>
      <FaqSection/>
      <FinalCta ctaText={t.ctaText}/>
      <Footer/>

      <TweaksPanel title="Tweaks">
        <TweakSection label="Brand"/>
        <TweakColor label="Accent color" value={t.accent}
          onChange={(v) => setTweak('accent', v)}/>
        <TweakRadio label="Accent text"
          value={t.accentInk}
          options={[{value:'#0A0A0F',label:'Dark'},{value:'#FFFFFF',label:'Light'}]}
          onChange={(v) => setTweak('accentInk', v)}/>

        <TweakSection label="Copy"/>
        <TweakSelect label="Primary CTA"
          value={t.ctaText}
          options={[
            "Book a free strategy call",
            "Get a free website audit",
            "See a live demo",
            "Get started",
          ]}
          onChange={(v) => setTweak('ctaText', v)}/>

        <TweakSection label="Style"/>
        <TweakToggle label="Dark hero" value={t.darkHero}
          onChange={(v) => setTweak('darkHero', v)}/>
        <TweakRadio label="Motion"
          value={t.motion}
          options={['subtle','medium','heavy']}
          onChange={(v) => setTweak('motion', v)}/>
      </TweaksPanel>
    </>
  );
}

function DarkHeroOverride() {
  return (
    <style>{`
      body.hero-dark .hero{background:var(--ink);color:#fff}
      body.hero-dark .hero h1{color:#fff}
      body.hero-dark .hero p.lede{color:rgba(255,255,255,.75)}
      body.hero-dark .hero .trust-text{color:rgba(255,255,255,.6)}
      body.hero-dark .hero .trust-text b{color:#fff}
      body.hero-dark .hero .btn-primary{background:var(--accent);color:var(--accent-ink)}
      body.hero-dark .hero .btn-ghost{color:#fff;border-color:rgba(255,255,255,.18)}
      body.hero-dark .hero .btn-ghost:hover{background:rgba(255,255,255,.06)}
      body.hero-dark .hero-bg::before{
        background-image:
          linear-gradient(to right,rgba(255,255,255,.05) 1px,transparent 1px),
          linear-gradient(to bottom,rgba(255,255,255,.05) 1px,transparent 1px) !important;}
      body.hero-dark .strip{border-color:rgba(255,255,255,.08)}
      body.hero-dark .strip .lbl,body.hero-dark .strip .logos{color:rgba(255,255,255,.6)}
      body.hero-dark .nav{background:rgba(10,10,15,.78);color:#fff}
      body.hero-dark .nav .logo,body.hero-dark .nav .nav-links{color:#fff}
      body.hero-dark .nav .btn-primary{background:var(--accent);color:var(--accent-ink)}
      body.hero-dark .nav .btn-ghost{color:#fff;border-color:rgba(255,255,255,.18)}
      body.reduce-motion .reveal,body.reduce-motion .reveal-stagger > *{
        opacity:1 !important;transform:none !important;transition:none !important}
      body.reduce-motion .badge-float{animation:none !important}
    `}</style>
  );
}

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