function App() {
  const [lang, setLangState] = React.useState(() => {
    try { return localStorage.getItem('rc_lang') || 'en'; } catch(e){ return 'en'; }
  });
  const t = window.TRANSLATIONS[lang];

  React.useEffect(() => {
    document.documentElement.setAttribute('lang', lang);
    document.documentElement.setAttribute('dir', t.dir);
    try { localStorage.setItem('rc_lang', lang); } catch(e){}
  }, [lang, t.dir]);

  const setLang = (l) => setLangState(l);

  return (
    <window.LangContext.Provider value={{ lang, t, setLang }}>
      <div className="relative">
        <Nav/>
        <Hero/>
        <Curriculum/>
        <Methodology/>
        <Social/>
        <Footer/>
      </div>
    </window.LangContext.Provider>
  );
}

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