"use client";

import * as React from "react";
import { motion } from "motion/react";

import { Section } from "@workspace/ui/components/layout/layout-utils";

type AnimatedSectionProps = React.ComponentProps<typeof Section> & {
  /** Delay in seconds for staggered entrance */
  delay?: number;
};

export function AnimatedSection({ children, className, delay = 0, ...props }: AnimatedSectionProps) {
  return (
    <Section className={className} {...props}>
      <motion.div
        initial={{ opacity: 0, y: 12 }}
        whileInView={{ opacity: 1, y: 0 }}
        viewport={{ once: true, margin: "-10%" }}
        transition={{ duration: 0.22, ease: [0.2, 0.8, 0.2, 1], delay }}
      >
        {children}
      </motion.div>
    </Section>
  );
}

