{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "holo-card",
  "title": "Holo Card",
  "author": "VenusUI",
  "description": "A payment card with a holographic foil that follows the pointer, and a flip to the back on click.",
  "files": [
    {
      "path": "registry/default/ui/holo-card.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface HoloCardProps extends Omit<React.ComponentProps<\"button\">, \"children\"> {\n  /** Card holder's name. */\n  name: string\n  /** The last four digits; the rest are shown as dots. */\n  last4: string\n  /** Expiry, e.g. \"08/29\". */\n  expires: string\n  /** Wordmark in the top corner. */\n  brand?: string\n  /** Security code on the back. Use a placeholder; never a real one. */\n  cvc?: string\n  /** Largest tilt in degrees. */\n  max?: number\n}\n\nfunction Chip() {\n  return (\n    <span\n      aria-hidden=\"true\"\n      className=\"relative block h-[9.5cqw] w-[13cqw] overflow-hidden rounded-[18%] bg-linear-to-br from-amber-200 via-yellow-400 to-amber-600 shadow-[inset_0_0_0_1px_rgb(120_80_0/0.35)]\"\n    >\n      <span className=\"absolute inset-x-0 top-1/3 h-px bg-amber-800/40\" />\n      <span className=\"absolute inset-x-0 top-2/3 h-px bg-amber-800/40\" />\n      <span className=\"absolute inset-y-0 left-1/2 w-px bg-amber-800/40\" />\n      <span className=\"absolute inset-[30%] rounded-sm border border-amber-800/40\" />\n    </span>\n  )\n}\n\n/**\n * A payment card with a holographic foil: the rainbow sheen and the glare\n * follow the pointer as the card tilts. Click, tap, Enter or Space flips it\n * over. With reduced motion it neither tilts nor animates the flip.\n */\nfunction HoloCard({ name, last4, expires, brand = \"Aurora\", cvc = \"123\", max = 14, className, style, onClick, ...props }: HoloCardProps) {\n  const ref = React.useRef<HTMLButtonElement>(null)\n  const frame = React.useRef(0)\n  const [flipped, setFlipped] = React.useState(false)\n\n  React.useEffect(() => () => cancelAnimationFrame(frame.current), [])\n\n  const track = (event: React.PointerEvent<HTMLButtonElement>) => {\n    if (event.pointerType === \"touch\" || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return\n    const card = ref.current\n    if (!card) return\n    const { clientX, clientY } = event\n    cancelAnimationFrame(frame.current)\n    frame.current = requestAnimationFrame(() => {\n      const rect = card.getBoundingClientRect()\n      const px = (clientX - rect.left) / rect.width\n      const py = (clientY - rect.top) / rect.height\n      card.style.setProperty(\"--rx\", `${(0.5 - py) * max * 2}deg`)\n      card.style.setProperty(\"--ry\", `${(px - 0.5) * max * 2}deg`)\n      card.style.setProperty(\"--px\", `${px * 100}%`)\n      card.style.setProperty(\"--py\", `${py * 100}%`)\n      card.style.setProperty(\"--shine\", \"1\")\n    })\n  }\n\n  const reset = () => {\n    cancelAnimationFrame(frame.current)\n    const card = ref.current\n    if (!card) return\n    card.style.setProperty(\"--rx\", \"0deg\")\n    card.style.setProperty(\"--ry\", \"0deg\")\n    card.style.setProperty(\"--shine\", \"0\")\n  }\n\n  const face = \"absolute inset-0 overflow-hidden rounded-[4.5%/7%] backface-hidden\"\n\n  return (\n    <div className={cn(\"@container w-full max-w-sm perspective-[1200px]\", className)} style={style}>\n      <button\n        ref={ref}\n        type=\"button\"\n        data-slot=\"holo-card\"\n        aria-pressed={flipped}\n        aria-label={flipped ? `${brand} card back. Show front` : `${brand} card ending ${last4}, ${name}, expires ${expires}. Show back`}\n        onPointerMove={track}\n        onPointerLeave={reset}\n        onClick={(event) => {\n          onClick?.(event)\n          setFlipped((value) => !value)\n        }}\n        className={cn(\n          \"relative block aspect-[1.586] w-full cursor-pointer rounded-[4.5%/7%] text-left outline-none transform-3d focus-visible:ring-3 focus-visible:ring-ring/50\",\n          \"transition-transform duration-300 ease-out will-change-transform motion-reduce:transition-none\",\n          \"[transform:rotateX(var(--rx,0deg))_rotateY(calc(var(--ry,0deg)+var(--flip,0deg)))]\"\n        )}\n        style={{ \"--flip\": flipped ? \"180deg\" : \"0deg\" } as React.CSSProperties}\n        {...props}\n      >\n        {/* Front */}\n        <span\n          className={cn(\n            face,\n            \"bg-[radial-gradient(120%_120%_at_0%_0%,#3b3f4a_0%,#16181d_55%,#0b0c0f_100%)] text-white shadow-[0_30px_50px_-25px_rgb(0_0_0/0.65),inset_0_0_0_1px_rgb(255_255_255/0.08)]\"\n          )}\n        >\n          {/* Holographic foil, strongest under the pointer. */}\n          <span\n            aria-hidden=\"true\"\n            className=\"absolute inset-0 opacity-[calc(0.18+var(--shine,0)*0.32)] mix-blend-color-dodge transition-opacity duration-300\"\n            style={{\n              background:\n                \"linear-gradient(115deg, transparent 25%, rgb(255 0 180 / 0.35) 38%, rgb(0 220 255 / 0.35) 48%, rgb(120 255 120 / 0.3) 58%, rgb(255 230 0 / 0.3) 68%, transparent 80%)\",\n              backgroundSize: \"250% 250%\",\n              backgroundPosition: \"var(--px, 30%) var(--py, 30%)\",\n            }}\n          />\n          <span\n            aria-hidden=\"true\"\n            className=\"absolute inset-0 opacity-(--shine,0) transition-opacity duration-300 motion-reduce:hidden\"\n            style={{ background: \"radial-gradient(circle at var(--px,50%) var(--py,50%), rgb(255 255 255 / 0.28), transparent 45%)\" }}\n          />\n          <span className=\"absolute inset-0 flex flex-col p-[7%]\">\n            <span className=\"flex items-start justify-between\">\n              <span className=\"text-[clamp(0.8rem,4.2cqw,1.1rem)] font-semibold tracking-tight\">{brand}</span>\n              <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-[7cqw] fill-none stroke-white/80\" strokeWidth=\"1.8\" strokeLinecap=\"round\">\n                <path d=\"M8.5 7.5a6.5 6.5 0 0 1 0 9M12 5a10 10 0 0 1 0 14M5 10a3 3 0 0 1 0 4\" />\n              </svg>\n            </span>\n            <span className=\"mt-[5cqw]\">\n              <Chip />\n            </span>\n            <span className=\"mt-auto font-mono text-[clamp(0.85rem,5cqw,1.35rem)] tracking-[0.14em] text-white/95 [text-shadow:0_1px_0_rgb(0_0_0/0.6)]\">\n              •••• •••• •••• {last4}\n            </span>\n            <span className=\"mt-[4%] flex items-end justify-between text-[clamp(0.6rem,2.8cqw,0.8rem)] tracking-wider text-white/75 uppercase\">\n              <span className=\"truncate\">{name}</span>\n              <span className=\"shrink-0\">\n                <span className=\"mr-1.5 text-[0.75em] text-white/50\">Valid thru</span>\n                {expires}\n              </span>\n            </span>\n          </span>\n        </span>\n\n        {/* Back */}\n        <span className={cn(face, \"[transform:rotateY(180deg)] bg-linear-to-br from-[#2a2d35] to-[#0c0d10] text-white\")}>\n          <span aria-hidden=\"true\" className=\"absolute inset-x-0 top-[11%] h-[18%] bg-black\" />\n          <span className=\"absolute inset-x-[7%] top-[38%] flex h-[15%] items-center\">\n            <span\n              aria-hidden=\"true\"\n              className=\"h-full flex-1 rounded-l-sm bg-[repeating-linear-gradient(-45deg,#e7e5e4_0_6px,#d6d3d1_6px_12px)]\"\n            />\n            <span className=\"flex h-full items-center rounded-r-sm bg-white px-3 font-mono text-sm text-neutral-900 italic\">{cvc}</span>\n          </span>\n          <span className=\"absolute inset-x-[7%] bottom-[9%] text-[clamp(0.5rem,2.2cqw,0.65rem)] leading-relaxed text-white/50\">\n            This card is property of {brand}. If found, please return it to any branch. Use is subject to the cardholder agreement.\n          </span>\n        </span>\n      </button>\n    </div>\n  )\n}\n\nexport { HoloCard }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "cards",
    "interactive",
    "3d"
  ],
  "type": "registry:ui"
}