{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"glass-card","type":"registry:ui","title":"Glass Card","description":"Frosted glassmorphism card with a refractive edge light, film grain and a pointer-follow sheen.","dependencies":[],"registryDependencies":[],"files":[{"path":"registry/ui/glass-card.tsx","type":"registry:ui","content":"\"use client\";\n\nimport type { PointerEvent, ReactNode } from \"react\";\n\nexport interface GlassCardProps {\n  children?: ReactNode;\n  /** Backdrop blur in px. */\n  blur?: number;\n  /** White tint of the glass, 0-1. */\n  tint?: number;\n  /** Film grain strength, 0-1. */\n  noise?: number;\n  /** Corner radius in px. */\n  radius?: number;\n  /** Pointer-follow sheen and edge light. */\n  highlight?: boolean;\n  className?: string;\n}\n\n// Static grain tile (feTurbulence), tiled over the glass.\nconst grain =\n  \"url(\\\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\\\")\";\n\nconst css = `\n.glass-card{--gx:30%;--gy:0%;--ga:210deg;--gi:.55}\n.glass-card-edge{padding:1px;-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}\n.glass-card-sheen{opacity:0;transition:opacity .5s ease}\n.glass-card:hover .glass-card-sheen{opacity:1}\n.glass-card:hover{--gi:1}\n`;\n\nexport function GlassCard({ children, blur = 18, tint = 0.1, noise = 0.25, radius = 28, highlight = true, className }: GlassCardProps) {\n  const onMove = (e: PointerEvent<HTMLDivElement>) => {\n    if (!highlight) return;\n    const el = e.currentTarget;\n    const r = el.getBoundingClientRect();\n    const x = e.clientX - r.left;\n    const y = e.clientY - r.top;\n    // Edge light points from the card's center toward the pointer.\n    const a = (Math.atan2(y - r.height / 2, x - r.width / 2) * 180) / Math.PI + 90;\n    el.style.setProperty(\"--gx\", `${x}px`);\n    el.style.setProperty(\"--gy\", `${y}px`);\n    el.style.setProperty(\"--ga\", `${a}deg`);\n  };\n\n  return (\n    <div\n      onPointerMove={onMove}\n      className={`glass-card relative isolate overflow-hidden text-white ${className ?? \"\"}`}\n      style={{\n        borderRadius: radius,\n        background: `linear-gradient(145deg, rgba(255,255,255,${tint * 1.6}), rgba(255,255,255,${tint * 0.4}))`,\n        backdropFilter: `blur(${blur}px) saturate(1.7)`,\n        WebkitBackdropFilter: `blur(${blur}px) saturate(1.7)`,\n        boxShadow: [\n          \"inset 0 1px 0 rgba(255,255,255,.45)\",\n          \"inset 0 -1px 0 rgba(255,255,255,.08)\",\n          // Faint chromatic fringe along the sides, like light splitting in thick glass.\n          \"inset 1.5px 0 0 rgba(255,150,220,.18)\",\n          \"inset -1.5px 0 0 rgba(130,210,255,.2)\",\n          \"0 30px 60px -20px rgba(0,0,0,.45)\",\n          \"0 10px 20px -10px rgba(0,0,0,.25)\",\n        ].join(\",\"),\n      }}\n    >\n      <style href=\"glass-card\" precedence=\"default\">\n        {css}\n      </style>\n      {noise > 0 && (\n        <div\n          aria-hidden\n          className=\"pointer-events-none absolute inset-0 -z-10 mix-blend-overlay\"\n          style={{ backgroundImage: grain, opacity: noise }}\n        />\n      )}\n      {highlight && (\n        <>\n          <div\n            aria-hidden\n            className=\"glass-card-sheen pointer-events-none absolute inset-0 -z-10\"\n            style={{\n              background:\n                \"radial-gradient(380px circle at var(--gx) var(--gy), rgba(255,255,255,.22), rgba(255,255,255,.06) 40%, transparent 70%)\",\n            }}\n          />\n          <div\n            aria-hidden\n            className=\"glass-card-edge pointer-events-none absolute inset-0\"\n            style={{\n              borderRadius: radius,\n              background:\n                \"conic-gradient(from var(--ga), rgba(255,255,255,var(--gi)), rgba(255,255,255,.12) 18%, rgba(255,255,255,.04) 50%, rgba(255,255,255,.12) 82%, rgba(255,255,255,var(--gi)))\",\n            }}\n          />\n        </>\n      )}\n      <div className=\"relative\">{children}</div>\n    </div>\n  );\n}\n"}]}