{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "spotlight-card",
  "type": "registry:ui",
  "title": "Spotlight Card",
  "author": "Rishabh Bose <https://theb0se.vercel.app/>",
  "description": "Minimal surface card with GPU-composited radial cursor illumination, 1px CSS mask border reveal, and optional 3D perspective tilt.",
  "dependencies": [
    "framer-motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "components/ui/spotlight-card.tsx",
      "content": "\"use client\";\n\nimport React, { useRef, useState } from \"react\";\nimport {\n  motion,\n  useMotionTemplate,\n  useMotionValue,\n  useSpring,\n  useReducedMotion,\n  type HTMLMotionProps,\n} from \"framer-motion\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface SpotlightCardProps extends HTMLMotionProps<\"div\"> {\n  children: React.ReactNode;\n  /** Primary radial spotlight color. Default: \"rgba(128, 128, 128, 0.14)\" */\n  spotlightColor?: string;\n  /** Border highlight color on pointer proximity. Default: \"rgba(128, 128, 128, 0.55)\" */\n  borderColor?: string;\n  /** Radius of the radial spotlight in pixels. Default: 320 */\n  spotlightRadius?: number;\n  /** Enable subtle 3D tilt when moving pointer across card. Default: false */\n  enableTilt?: boolean;\n}\n\nexport function SpotlightCard({\n  children,\n  className,\n  spotlightColor = \"rgba(128, 128, 128, 0.14)\",\n  borderColor = \"rgba(128, 128, 128, 0.55)\",\n  spotlightRadius = 320,\n  enableTilt = false,\n  onMouseMove,\n  onMouseEnter,\n  onMouseLeave,\n  ...props\n}: SpotlightCardProps) {\n  const cardRef = useRef<HTMLDivElement>(null);\n  const shouldReduceMotion = useReducedMotion();\n  const [isHovered, setIsHovered] = useState(false);\n\n  const mouseX = useMotionValue(-1000);\n  const mouseY = useMotionValue(-1000);\n\n  const smoothX = useSpring(mouseX, { stiffness: 320, damping: 28, mass: 0.25 });\n  const smoothY = useSpring(mouseY, { stiffness: 320, damping: 28, mass: 0.25 });\n\n  const rotateX = useSpring(useMotionValue(0), { stiffness: 200, damping: 22 });\n  const rotateY = useSpring(useMotionValue(0), { stiffness: 200, damping: 22 });\n\n  const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {\n    if (!cardRef.current) return;\n    const rect = cardRef.current.getBoundingClientRect();\n    const x = e.clientX - rect.left;\n    const y = e.clientY - rect.top;\n\n    mouseX.set(x);\n    mouseY.set(y);\n\n    if (enableTilt && !shouldReduceMotion) {\n      const pctX = (x / rect.width - 0.5) * 2;\n      const pctY = (y / rect.height - 0.5) * 2;\n      rotateX.set(-pctY * 4);\n      rotateY.set(pctX * 4);\n    }\n\n    onMouseMove?.(e);\n  };\n\n  const handleMouseEnter = (e: React.MouseEvent<HTMLDivElement>) => {\n    setIsHovered(true);\n    onMouseEnter?.(e);\n  };\n\n  const handleMouseLeave = (e: React.MouseEvent<HTMLDivElement>) => {\n    setIsHovered(false);\n    rotateX.set(0);\n    rotateY.set(0);\n    onMouseLeave?.(e);\n  };\n\n  const activeX = shouldReduceMotion ? mouseX : smoothX;\n  const activeY = shouldReduceMotion ? mouseY : smoothY;\n\n  const surfaceBackground = useMotionTemplate`radial-gradient(${spotlightRadius}px circle at ${activeX}px ${activeY}px, ${spotlightColor}, transparent 80%)`;\n  const borderBackground = useMotionTemplate`radial-gradient(${\n    spotlightRadius * 0.75\n  }px circle at ${activeX}px ${activeY}px, ${borderColor}, transparent 100%)`;\n\n  return (\n    <motion.div\n      ref={cardRef}\n      onMouseMove={handleMouseMove}\n      onMouseEnter={handleMouseEnter}\n      onMouseLeave={handleMouseLeave}\n      style={{\n        rotateX: enableTilt && !shouldReduceMotion ? rotateX : 0,\n        rotateY: enableTilt && !shouldReduceMotion ? rotateY : 0,\n        transformPerspective: 1000,\n      }}\n      className={cn(\n        \"group relative overflow-hidden rounded-2xl border border-neutral-200 bg-white p-6 transition-colors duration-300 hover:border-neutral-400 dark:border-[#222222] dark:bg-[#0A0A0A] dark:hover:border-[#383838]\",\n        className\n      )}\n      {...props}\n    >\n      {/* Dynamic illuminated 1px border overlay */}\n      <motion.div\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute -inset-px rounded-2xl transition-opacity duration-300\"\n        style={{\n          opacity: isHovered ? 1 : 0,\n          background: borderBackground,\n          WebkitMask:\n            \"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)\",\n          WebkitMaskComposite: \"xor\",\n          maskComposite: \"exclude\",\n          padding: \"1px\",\n        }}\n      />\n\n      {/* Ambient surface spotlight */}\n      <motion.div\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute inset-0 rounded-2xl transition-opacity duration-300\"\n        style={{\n          opacity: isHovered ? 1 : 0,\n          background: surfaceBackground,\n        }}\n      />\n\n      <div className=\"relative z-10\">{children}</div>\n    </motion.div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "components/ui/spotlight-card.tsx"
    },
    {
      "path": "lib/utils.ts",
      "content": "import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport async function copyToClipboard(text: string): Promise<boolean> {\n  if (typeof window === \"undefined\") return false;\n\n  try {\n    if (navigator.clipboard && window.isSecureContext) {\n      await navigator.clipboard.writeText(text);\n      return true;\n    }\n\n    const textArea = document.createElement(\"textarea\");\n    textArea.value = text;\n    textArea.style.position = \"fixed\";\n    textArea.style.left = \"-999999px\";\n    textArea.style.top = \"-999999px\";\n    document.body.appendChild(textArea);\n    textArea.focus();\n    textArea.select();\n    const succeeded = document.execCommand(\"copy\");\n    textArea.remove();\n    return succeeded;\n  } catch {\n    return false;\n  }\n}\n",
      "type": "registry:lib",
      "target": "lib/utils.ts"
    }
  ]
}
