"use client";

import { useEffect, useState } from "react";
import SmoothScroll from "@/components/SmoothScroll";
import EntranceExperience from "@/components/EntranceExperience";
import RestaurantStory from "@/components/RestaurantStory";
import ChefShowcase from "@/components/ChefShowcase";
import InteriorGallery from "@/components/InteriorGallery";
import Testimonials from "@/components/Testimonials";
import EventsAccordion from "@/components/EventsAccordion";
import MenuPreview from "@/components/MenuPreview";
import ReservationForm from "@/components/ReservationForm";
import RouteMap from "@/components/RouteMap";
import Footer from "@/components/Footer";

import CustomCursor from "@/components/CustomCursor";
import SoundManager from "@/components/SoundManager";

export default function Home() {
  const [mounted, setMounted] = useState(false);

  useEffect(() => {
    setMounted(true);
  }, []);

  return (
    <main className="w-full relative bg-darkbg text-foreground overflow-hidden select-none">
      {/* Isolated wrapper for client-only widgets to prevent hydration insertion conflicts */}
      <div id="client-only-widgets">
        {mounted && <SoundManager />}
        {mounted && <CustomCursor />}
      </div>

      {/* Lenis Scroll syncing with GSAP triggers */}
      <SmoothScroll>
        
        {/* Sections 1 & 2: Landing Exterior Zoom & Door opening into Welcome reception */}
        <EntranceExperience />

        {/* Section 3: Heritage Story timeline */}
        <RestaurantStory />

        {/* Section 4: Premium Breakfast Menu Card Section */}
        <MenuPreview />

        {/* Section 5: Chef Sundaram showcase with canvas heat waves */}
        <ChefShowcase />

        {/* Section 6: GSAP Horizontal space gallery */}
        <InteriorGallery />

        {/* Section 7: 3D-tilting Testimonials diaries */}
        <Testimonials />

        {/* Section 8: Expanding Special Events Accordion */}
        <EventsAccordion />

        {/* Section 9: Reservation Form with canvas sparks */}
        <ReservationForm />

        {/* Section 11: Cartographic Route SVG Map with animated Chariot */}
        <RouteMap />

        {/* Section 12: Footer with hanging Toran, contact logs and floating diyas */}
        <Footer />

      </SmoothScroll>
    </main>
  );
}
