'use client';

import React, {useEffect} from "react";
import HomeServices from "@/app/(root)/sections/HomeServices";
import {motion} from "framer-motion";
import Hero from "@/app/(root)/sections/Hero";
import About from "@/app/(root)/sections/About";
import ProcessSection from "@/app/(root)/sections/ProcessSection";
import WhyUs from "@/app/(root)/sections/WhyUs";
import Faq from "@/app/(root)/sections/Faq";
import ReferralSection from "@/app/(root)/sections/ReferralSection";

const Home = () => {
    useEffect(() => {
        const scrollToId = localStorage.getItem('scrollToId')
        if (scrollToId) {
            localStorage.removeItem('scrollToId')
            const el = document.getElementById(scrollToId)
            if (el) {
                setTimeout(() => {
                    el.scrollIntoView({behavior: 'smooth', block: 'start'})
                }, 200)
            }
        }
    }, [])

    return (
        <motion.div
            initial={{opacity: 0}}
            animate={{opacity: 1}}
            transition={{duration: 0.7, ease: "easeOut"}}
            className="overflow-hidden"
        >
            <Hero/>
            <HomeServices/>
            <About/>
            <ProcessSection/>
            <WhyUs/>
            <ReferralSection/>
            <Faq/>
        </motion.div>
    );
};

export default Home;
