const App = () => {
  const [type, setType] = React.useState("regular");
  const [submitted, setSubmitted] = React.useState(false);
  const formRef = React.useRef(null);

  const handleCta = (kind) => {
    setType(kind);
    setSubmitted(false);
    requestAnimationFrame(() => {
      const el = document.getElementById("apply");
      if (el) {
        const top = el.getBoundingClientRect().top + window.scrollY - 80;
        window.scrollTo({ top, behavior: "smooth" });
      }
    });
  };

  return (
    <>
      <Header onCta={handleCta} />
      <Hero onCta={handleCta} />
      <Ticker />
      <WhatIs disc={{ tilt: 32, idle: true, idleAmp: 1.2 }} />
      <Positioning />
      <Why />
      <CtaBand
        title="Превратите релиз"
        accent="в съедобный инфоповод."
        note="Слоты ограничены · бриф за 1 день"
        cta="Занять слот в очереди"
        to="regular"
        onCta={handleCta}
      />
      <Customization />
      <Process />
      <Scenarios />
      <Queue onPick={handleCta} />
      <PaidPriority onCta={handleCta} />
      <Trust />
      <CtaBand
        title="Обсудим ваш релиз"
        accent="и соберём первый тираж."
        note="Ответим в течение дня"
        cta="Оставить заявку"
        to="regular"
        onCta={handleCta}
      />
      <Investors onCta={handleCta} />
      <Form
        ref={formRef}
        type={type}
        setType={(t) => { setType(t); setSubmitted(false); }}
        submitted={submitted}
        onSubmit={() => setSubmitted(true)}
      />
      <FAQ />
      <Footer onCta={handleCta} />
    </>
  );
};

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

