"use client"; import { useEffect } from "react"; import { usePathname } from "next/navigation"; import gsap from "gsap"; export default function Intro() { const pathname = usePathname(); useEffect(() => { const overlay = "[data-intro-overlay]"; const reveal = gsap.utils.toArray("[data-reveal]"); const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches; // No reveal targets (e.g. error / not-found pages) or reduced motion: skip the intro. if (reduce || reveal.length === 0) { gsap.set(overlay, { display: "none" }); return; } gsap.set(reveal, { autoAlpha: 0, y: 12 }); const tl = gsap.timeline({ defaults: { ease: "power3.out" }, onComplete: () => gsap.set(reveal, { clearProps: "all" }), }); tl.to("[data-intro-mark]", { autoAlpha: 1, scale: 1, duration: 0.45, ease: "power2.out" }, 0) .fromTo( "[data-intro-bar]", { scaleX: 0 }, { scaleX: 1, duration: 0.85, ease: "power2.inOut" }, 0.1, ) .to(overlay, { yPercent: -100, duration: 0.5, ease: "power3.inOut" }, ">-0.1") .to(reveal, { autoAlpha: 1, y: 0, duration: 0.5, stagger: 0.07 }, "<0.2") .set(overlay, { display: "none" }); return () => { tl.kill(); gsap.set(reveal, { clearProps: "all" }); }; }, []); if (pathname !== "/") return null; return (