// Hair · Cut & Style · Growing Out — L3 app

function GrowingOutApp() {
  const [t, setTweak] = useTweaks(window.TWEAK_DEFAULTS);
  React.useEffect(() => {
    const io = new IntersectionObserver((entries) => {
      entries.forEach((e) => { if (e.isIntersecting) { e.target.classList.add("in"); io.unobserve(e.target); } });
    }, { threshold: 0.08, rootMargin: "0px 0px -40px 0px" });
    const scan = () => { document.querySelectorAll(".reveal:not(.in)").forEach((el) => io.observe(el)); };
    const raf = requestAnimationFrame(() => requestAnimationFrame(scan));
    const mo = new MutationObserver(scan);
    mo.observe(document.body, { childList: true, subtree: true });
    return () => { cancelAnimationFrame(raf); io.disconnect(); mo.disconnect(); };
  }, []);
  React.useEffect(() => {
    const b = document.body;
    b.classList.remove("fp-playfair-dmsans","fp-dmserif-dmsans","fp-fraunces-inter");
    b.classList.add(`fp-${t.fontPairing}`);
    b.classList.remove("ac-coral","ac-oxblood","ac-champagne","ac-terracotta","ac-bronze","ac-carmine","ac-mahogany");
    b.classList.add(`ac-${t.accent}`);
    b.classList.toggle("dark", !!t.dark);
    b.classList.remove("cs-editorial","cs-rounded","cs-framed","cs-minimal");
    b.classList.add(`cs-${t.cardStyle || "editorial"}`);
  }, [t.fontPairing, t.accent, t.dark, t.cardStyle]);
  return (
    <>
      <Header onDark={false} />
      <nav className="crumb" aria-label="Breadcrumb">
        <a href="/">Home</a><span className="sl">/</span><a href="/en/hair/">Hair</a><span className="sl">/</span>
        <a href="/en/hair/cut-style/">Cut &amp; Style</a><span className="sl">/</span><span className="cur">Growing out</span>
      </nav>
      <div className="l2" data-screen-label="Growing Out L3">
        <GrowingOutSidebar />
        <main className="l2-main">
          <GrowingOutHero /><GrowingOutRail /><GrowingOutEditorIntro />
          <SectionHead n="I." eyebrow="Definitions · Plain English" h={<>Why growing out is a <em>stage, not just waiting.</em></>} />
          <GrowingOutQuickFacts />
          <SectionHead n="II." eyebrow="Starting the grow-out" h={<>Your <em>roadmap.</em></>} link="Print as PDF" />
          <GrowingOutBeginnerPath />
          <SectionHead n="III." eyebrow="Trending now · Top 5" h={<>What everyone's <em>reading</em> this week.</>} link="See top 100" />
          <GrowingOutTrending />
          <SectionHead n="IV." eyebrow="By starting cut · Timeline" h={<>The grow-out, <em>by cut type.</em></>} />
          <GrowingOutFormatGuide />
          <SectionHead n="V." eyebrow={`The library · ${GROWING_OUT.totalCount} how-to's`} h={<>Everything we've published on <em>growing out.</em></>} link="Full index A–Z" />
          <GrowingOutHowToLibrary cardStyle={t.libCardStyle || "editorial"} />
          <SectionHead n="VI." eyebrow="Related" h={<>Where you're headed.</>} link="All cuts" />
          <GrowingOutCrosslinks />
          <GrowingOutNext />
        </main>
      </div>
      <NellyTop3 category="growing out hair" />
      <Newsletter />
      <Footer />
    </>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<GrowingOutApp />);
