"use client"; import { useEffect } from "react"; import Lenis from "lenis"; /** * Lenis smooth scroll. Disabled when the user prefers reduced motion so we keep * native, instant scrolling for those users. */ export function SmoothScroll() { useEffect(() => { if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; const lenis = new Lenis({ duration: 1.1, easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), }); let raf = 0; const loop = (time: number) => { lenis.raf(time); raf = requestAnimationFrame(loop); }; raf = requestAnimationFrame(loop); return () => { cancelAnimationFrame(raf); lenis.destroy(); }; }, []); return null; }