// odd duck — app entry + Tweaks
const { useEffect: useEffect2 } = React;

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "typeface": "serif"
}/*EDITMODE-END*/;

const App = () => {
  const [t, setTweak] = window.useTweaks(TWEAK_DEFAULTS);

  // Apply typeface mode to <body> as a class so CSS variables swap.
  useEffect2(() => {
    document.body.classList.remove('serif-mode', 'sans-mode');
    document.body.classList.add(t.typeface === 'sans' ? 'sans-mode' : 'serif-mode');
    // Update --display variable
    document.documentElement.style.setProperty(
      '--display',
      t.typeface === 'sans' ? 'var(--sans)' : 'var(--serif)'
    );
  }, [t.typeface]);

  return (
    <>
      <Nav />
      <Hero />
      <Marquee />
      <Manifesto />
      <About />
      <Contact />
      <Footer />

      <window.TweaksPanel title="Tweaks">
        <window.TweakSection title="Typography">
          <window.TweakRadio
            label="Display typeface"
            value={t.typeface}
            options={[
              {value:'serif', label:'Serif'},
              {value:'sans', label:'Sans'},
            ]}
            onChange={(v) => setTweak('typeface', v)}
          />
          <p style={{fontSize:12, opacity:0.65, marginTop:8, lineHeight:1.45}}>
            Swaps the display headlines between Instrument Serif (italic editorial)
            and Space Grotesk (geometric sans). Body copy stays sans.
          </p>
        </window.TweakSection>
      </window.TweaksPanel>
    </>
  );
};

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