// Main app for Industrolearn homepage
//
// Layout choices for each section. Tweaks panel was removed in a cleanup —
// these values are now the production layouts. Edit here to change a section.
const TWEAKS = {
  italTreatment:   "saffron",
  routerLayout:    "cards",
  manifestoLayout: "pullquote",
  programsLayout:  "hero",
  studioLayout:    "grid",
  founderLayout:   "portrait"
};

function App() {
  const tweak = TWEAKS;
  const setTweak = () => {}; // no-op; kept so section components don't need prop changes

  // Scroll to URL hash once the React tree has mounted (anchors don't exist
  // at initial paint, so the browser's native hash-jump misses).
  React.useEffect(() => {
    const id = window.location.hash.slice(1);
    if (!id) return;
    requestAnimationFrame(() => {
      const el = document.getElementById(id);
      if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
    });
  }, []);

  // Reveal-on-scroll
  React.useEffect(() => {
    const els = document.querySelectorAll(".reveal:not(.is-in)");
    const io = new IntersectionObserver((entries) => {
      entries.forEach((e) => {
        if (e.isIntersecting) {
          e.target.classList.add("is-in");
          io.unobserve(e.target);
        }
      });
    }, { threshold: 0.15 });
    els.forEach((el) => io.observe(el));
    return () => io.disconnect();
  }, [tweak]);

  return (
    <>
      <Nav />
      <Hero tweak={tweak} setTweak={setTweak} />
      <Router tweak={tweak} />
      <Manifesto tweak={tweak} />
      <Programs tweak={tweak} />
      <Studio tweak={tweak} />
      <Events />
      <Proof />
      <Founder tweak={tweak} />
      <LeadMagnet />
      <Footer />
    </>
  );
}

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