import { cn } from '@/lib/utils';

const ROUTE = 'M30 78 C48 78, 56 40, 90 36';

/** Two pins joined by a dashed curve with a dot travelling along it (static for reduced motion). */
export function RouteIllustration({ size = 120, className }: { size?: number; className?: string }) {
  return (
    <svg width={size} height={size} viewBox="0 0 120 120" fill="none" className={cn('text-primary', className)} aria-hidden="true">
      <ellipse cx="24" cy="98" rx="10" ry="2.5" className="fill-border-strong" opacity="0.6" />
      <ellipse cx="96" cy="46" rx="10" ry="2.5" className="fill-border-strong" opacity="0.6" />
      <path d={ROUTE} className="stroke-border-strong" strokeWidth="1.5" strokeDasharray="4 4" strokeLinecap="round" />
      {/* Origin pin */}
      <path d="M24 96c-6-7-10-12-10-17a10 10 0 0 1 20 0c0 5-4 10-10 17Z" className="fill-primary-soft stroke-primary" strokeWidth="1.5" strokeLinejoin="round" />
      <circle cx="24" cy="79" r="3" className="fill-primary" />
      {/* Destination pin */}
      <path d="M96 44c-6-7-10-12-10-17a10 10 0 0 1 20 0c0 5-4 10-10 17Z" className="fill-primary-soft stroke-primary" strokeWidth="1.5" strokeLinejoin="round" />
      <circle cx="96" cy="27" r="3" className="fill-accent" />
      {/* Moving dot: CSS offset-path animation, disabled by the global reduced-motion rule */}
      <circle
        r="4"
        className="fill-accent motion-safe:animate-[route-dot_3.2s_cubic-bezier(0.2,0.8,0.2,1)_infinite]"
        style={{ offsetPath: `path('${ROUTE}')`, offsetDistance: '50%', offsetRotate: '0deg' }}
      />
    </svg>
  );
}
