'use client';

import { useEffect } from 'react';
// @ts-expect-error — aos has no bundled types and no @types/aos installed
import AOS from 'aos';
import { usePathname } from 'next/navigation';

export default function AosInit() {
  const pathname = usePathname();

  useEffect(() => {
    AOS.init({
      duration: 800,
      easing: 'ease-out-cubic',
      offset: 60,
      delay: 0,
      once: true,
      mirror: false,
      anchorPlacement: 'top-bottom',
      disable: () => window.matchMedia('(prefers-reduced-motion: reduce)').matches,
    });
  }, []);

  useEffect(() => {
    AOS.refreshHard();
  }, [pathname]);

  return null;
}
