// Root app - loads localized CV content and composes the page.

function App() {
  const { data, loading, error } = useCVContent();
  useRevealOnScroll();

  if (loading) {
    return (
      <div className="boot">
        <span className="boot-dot" aria-hidden="true" />
        <span className="boot-label">loading…</span>
      </div>
    );
  }
  if (error || !data) {
    return (
      <div className="boot boot-error" role="alert">
        Could not load CV content. Open this page via a web server (not <code>file://</code>) so the JSON files can be fetched.
      </div>
    );
  }


  return (
    <React.Fragment>
      <a className="skip-link" href="#main">Skip to content</a>
      <CustomCursor />
      <KonamiTrigger message={data.ui.bossModeNote} />
      <Nav data={data} />
      <main id="main">
        <Hero data={data} />
        <About data={data} />
        <Experience data={data} />
        <SkillsCluster data={data} />
        <Education data={data} />
        <Awards data={data} />
        <Talks data={data} />
        <Hobbies data={data} />
        <Contact data={data} />
      </main>
      <Footer data={data} />
      <AIBuddy lines={data.buddyLines} />
    </React.Fragment>
  );
}

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