"use client";

import Link from "next/link";
import { motion } from "framer-motion";
import { HeroVisualCollage } from "@/components/layout/HeroVisualCollage";
import { FeatureStatsRow } from "@/components/ui/FeatureStatsRow";
import {
  scaleInSpring,
  fadeUpStrong,
  fadeUp,
  slideInLeftSubtle,
  fadeIn,
  staggerFast,
} from "@/lib/animations";

const HERO_STATS = [
  { title: "Verified Local Stores", icon: "store", desc: "Growing local commerce" },
  { title: "2km Neighbourhood", icon: "location_on", desc: "Hyperlocal service radius" },
  { title: "Happy Customers", icon: "mood", desc: "Growing neighbourhood community" },
  { title: "Trusted Platform", icon: "star", desc: "Loved by local shoppers" },
];

const COLLAGE_CARDS = [
  { text: "Discover Nearby", icon: "explore" },
  { text: "Save Favourites", icon: "favorite" },
  { text: "Order Anytime", icon: "shopping_bag" },
];

// Choreography: badge bounces in (spring) → h1 strong fade-up → p subtle up → CTAs slide from left
// Fast stagger (0.07) gives a snappy, energetic feel — phone/fast/mobile-first vibe
const badgeVariant = scaleInSpring;
const titleVariant = fadeUpStrong;
const descVariant = fadeUp;
const ctaVariant = slideInLeftSubtle;

export function PeopleHero() {
  return (
    <section className="w-full flex flex-col pt-6 md:pt-10 select-none bg-gradient-to-br from-white via-[#FEFCFF] to-[#F4ECFA]">
      <div className="border-b border-[#6330D6]/10">
        <div className="grid grid-cols-1 lg:grid-cols-[45%_55%] items-center gap-10 lg:gap-6 px-6 md:px-12 lg:px-16 pb-12 max-w-[1600px] mx-auto">

          {/* Left Column: snappy fast-stagger sequence */}
          <motion.div
            className="flex flex-col text-left max-w-xl"
            variants={staggerFast}
            initial="hidden"
            animate="visible"
          >
            <motion.span
              variants={badgeVariant}
              className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-black tracking-widest bg-[#6330D6]/10 text-[#6330D6] uppercase mb-6 w-fit"
            >
              Nearle for People
            </motion.span>

            <motion.h1
              variants={titleVariant}
              className="font-display text-4xl sm:text-5xl lg:text-[48px] xl:text-[54px] font-black text-[#16001D] leading-[1.1] tracking-tight"
            >
              Your Neighbourhood,
              <br />
              Now in Your <span className="text-[#6330D6]">Pocket.</span>
            </motion.h1>

            <motion.p
              variants={descVariant}
              className="text-sm md:text-base text-[#5E5866] font-bold mt-6 leading-relaxed"
            >
              Discover verified local stores, save your favorite merchants, and order everyday items with superfast local fulfillment.
            </motion.p>

            <motion.div
              variants={ctaVariant}
              className="flex flex-col sm:flex-row gap-3.5 mt-8 w-full sm:w-auto"
            >
              <a
                href="#download-section"
                className="bg-[#6330D6] hover:bg-[#5225b8] text-white font-black px-8 py-3.5 rounded-xl text-sm md:text-base text-center shadow-md hover:shadow-lg transition-all duration-200 active:scale-[0.98]"
              >
                Get the App
              </a>
              <Link
                href="/"
                className="border-2 border-[#6330D6]/20 hover:border-[#6330D6]/40 text-[#6330D6] font-black px-8 py-3.5 rounded-xl text-sm md:text-base text-center transition-all duration-200 hover:bg-[#6330D6]/5 active:scale-[0.98]"
              >
                Explore Stores
              </Link>
            </motion.div>
          </motion.div>

          {/* Right Column: subtle fade — HeroVisualCollage's internal animations handle phone, images, badges individually */}
          <motion.div
            className="w-full"
            variants={fadeIn}
            initial="hidden"
            animate="visible"
            transition={{ delay: 0.15 }}
          >
            <HeroVisualCollage
              centerImage="/images/app-mockup.png"
              leftImage="/images/cat-hot-food.png"
              rightImage="/images/cat-health-wellness.png"
              glassCards={COLLAGE_CARDS}
              isPhoneCenter={true}
            />
          </motion.div>
        </div>
      </div>

      <div className="bg-[#FAF7FD] border-b border-[#6330D6]/10">
        <div className="px-6 md:px-12 lg:px-16 max-w-[1600px] mx-auto">
          <FeatureStatsRow items={HERO_STATS} />
        </div>
      </div>
    </section>
  );
}
