{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "card-foil-pass",
  "type": "registry:component",
  "title": "Card Foil Pass",
  "description": "An event pass with a holographic foil pattern, a rainbow seal and engraved lines that catch the light as the card tilts toward the pointer. Click or press Enter to flip it to a scannable back.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "card",
    "holographic",
    "tilt",
    "glare",
    "3d",
    "flip"
  ],
  "docs": "https://hyperblur.dev/effects/card-foil-pass",
  "files": [
    {
      "path": "registry/hyperblur/card-foil-pass.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/card-foil-pass.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CardFoilPassProps extends React.HTMLAttributes<HTMLDivElement> {\n  event?: string;\n  edition?: string;\n  name?: string;\n  detail?: string;\n  access?: string;\n  code?: string;\n  maxTilt?: number;\n  idle?: boolean;\n  flippable?: boolean;\n  accent?: string;\n  onFlip?: (flipped: boolean) => void;\n}\n\nfunction hash(n: number) {\n  let x = Math.imul(n ^ 0x5bd1e995, 0x27d4eb2d) >>> 0;\n  x = Math.imul(x ^ (x >>> 15), 0x85ebca6b) >>> 0;\n  return ((x ^ (x >>> 13)) >>> 0) / 4294967295;\n}\n\nconst bars = Array.from({ length: 44 }, (_, i) => 1 + Math.floor(hash(i + 11) * 3));\nconst cells = Array.from({ length: 121 }, (_, i) => {\n  const r = Math.floor(i / 11);\n  const c = i % 11;\n  const finder = (r < 3 && c < 3) || (r < 3 && c > 7) || (r > 7 && c < 3);\n  return finder || hash(i * 7 + 3) > 0.52;\n});\n\nconst css = `\n.hb-vl10 {\n  --hb-vl10-rx: 0deg;\n  --hb-vl10-ry: 0deg;\n  --hb-vl10-mx: 50%;\n  --hb-vl10-my: 50%;\n  --hb-vl10-e: 0;\n  position: relative;\n  width: 100%;\n  max-width: 400px;\n  aspect-ratio: 1.586;\n  perspective: 900px;\n  color: #ededed;\n  font-family: inherit;\n  box-sizing: border-box;\n  container-type: inline-size;\n  outline: none;\n  cursor: pointer;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-vl10 *, .hb-vl10 *::before, .hb-vl10 *::after { box-sizing: border-box; }\n.hb-vl10-tilt {\n  position: absolute;\n  inset: 0;\n  transform-style: preserve-3d;\n  transform: rotateX(var(--hb-vl10-rx)) rotateY(var(--hb-vl10-ry));\n}\n.hb-vl10-flip {\n  position: absolute;\n  inset: 0;\n  transform-style: preserve-3d;\n  transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1), scale 0.25s ease;\n}\n.hb-vl10[data-flipped=\"true\"] .hb-vl10-flip { transform: rotateY(180deg); }\n.hb-vl10:active .hb-vl10-flip { scale: 0.985; }\n.hb-vl10:focus-visible .hb-vl10-face { box-shadow: 0 0 0 2px #0a0a0a, 0 0 0 4px var(--hb-vl10-a), 0 30px 50px -24px rgba(0, 0, 0, 0.9); }\n.hb-vl10-face {\n  position: absolute;\n  inset: 0;\n  overflow: hidden;\n  border-radius: 4.6cqw;\n  backface-visibility: hidden;\n  -webkit-backface-visibility: hidden;\n  transform-style: preserve-3d;\n  background:\n    radial-gradient(120% 90% at 0% 0%, #23262f 0%, transparent 60%),\n    linear-gradient(150deg, #181a21 0%, #0d0e12 100%);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 30px 50px -24px rgba(0, 0, 0, 0.9);\n}\n.hb-vl10-back { transform: rotateY(180deg); }\n.hb-vl10-guil {\n  position: absolute;\n  inset: 0;\n  width: 100%;\n  height: 100%;\n  opacity: 0.22;\n}\n.hb-vl10-foil {\n  position: absolute;\n  inset: 0;\n  background:\n    repeating-linear-gradient(115deg, #ff6b9d 0%, #ffd36b 7%, #7dffb2 14%, #6bd5ff 21%, #a98bff 28%, #ff6b9d 35%);\n  background-size: 300% 300%;\n  background-position: var(--hb-vl10-mx) var(--hb-vl10-my);\n  mix-blend-mode: color-dodge;\n  opacity: calc(0.18 + var(--hb-vl10-e) * 0.5);\n  mask-image:\n    repeating-linear-gradient(60deg, #000000 0 1px, transparent 1px 5px),\n    radial-gradient(70% 90% at 82% 30%, #000000 0%, transparent 70%);\n  mask-composite: intersect;\n  -webkit-mask-image:\n    repeating-linear-gradient(60deg, #000000 0 1px, transparent 1px 5px),\n    radial-gradient(70% 90% at 82% 30%, #000000 0%, transparent 70%);\n  -webkit-mask-composite: source-in;\n}\n.hb-vl10-seal {\n  position: absolute;\n  right: 6cqw;\n  top: 7cqw;\n  width: 17cqw;\n  aspect-ratio: 1;\n  border-radius: 50%;\n  background:\n    conic-gradient(from calc(var(--hb-vl10-ry) * 6) at 50% 50%, #ff8ab8, #ffe08a, #8affc4, #8ad8ff, #b89aff, #ff8ab8);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);\n  transform: translateZ(28px);\n  opacity: 0.92;\n}\n.hb-vl10-seal::before {\n  content: \"\";\n  position: absolute;\n  inset: 18%;\n  border-radius: 50%;\n  background: repeating-conic-gradient(rgba(255, 255, 255, 0.55) 0 6deg, transparent 6deg 18deg);\n  mix-blend-mode: overlay;\n}\n.hb-vl10-seal::after {\n  content: \"\";\n  position: absolute;\n  inset: 36%;\n  border-radius: 50%;\n  background: #14161c;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);\n}\n.hb-vl10-glare {\n  position: absolute;\n  inset: 0;\n  background: radial-gradient(55% 70% at var(--hb-vl10-mx) var(--hb-vl10-my), rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.06) 40%, transparent 70%);\n  mix-blend-mode: overlay;\n  opacity: calc(0.35 + var(--hb-vl10-e) * 0.65);\n  pointer-events: none;\n}\n.hb-vl10-edge {\n  position: absolute;\n  inset: 0;\n  border-radius: inherit;\n  padding: 1px;\n  background: radial-gradient(60% 60% at var(--hb-vl10-mx) var(--hb-vl10-my), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.08) 60%);\n  mask: linear-gradient(#000000 0 0) content-box, linear-gradient(#000000 0 0);\n  mask-composite: exclude;\n  -webkit-mask: linear-gradient(#000000 0 0) content-box, linear-gradient(#000000 0 0);\n  -webkit-mask-composite: xor;\n  pointer-events: none;\n}\n.hb-vl10-in {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  flex-direction: column;\n  padding: 6cqw 6.5cqw;\n  transform: translateZ(18px);\n  transform-style: preserve-3d;\n}\n.hb-vl10-top { display: flex; align-items: center; gap: 2cqw; }\n.hb-vl10-logo {\n  display: grid;\n  place-items: center;\n  width: 7.5cqw;\n  aspect-ratio: 1;\n  border-radius: 2cqw;\n  background: var(--hb-vl10-a);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);\n}\n.hb-vl10-ev { display: flex; flex-direction: column; line-height: 1.1; }\n.hb-vl10-evn { font-family: var(--font-grotesk, inherit); font-size: 3.9cqw; font-weight: 600; letter-spacing: -0.01em; }\n.hb-vl10-evd { font-family: var(--font-mono, ui-monospace, monospace); font-size: 2.5cqw; letter-spacing: 0.12em; text-transform: uppercase; color: #8f8f8f; }\n.hb-vl10-mid { margin-top: auto; transform: translateZ(10px); }\n.hb-vl10-acc {\n  display: inline-block;\n  margin-bottom: 1.6cqw;\n  padding: 0.6cqw 2cqw;\n  border-radius: 99px;\n  background: rgba(255, 255, 255, 0.08);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 2.4cqw;\n  letter-spacing: 0.16em;\n  text-transform: uppercase;\n}\n.hb-vl10-name { margin: 0; font-size: 7.2cqw; font-weight: 600; line-height: 1; letter-spacing: -0.03em; white-space: nowrap; }\n.hb-vl10-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 4cqw; margin-top: 3cqw; }\n.hb-vl10-role { font-size: 2.9cqw; color: #a1a1a1; white-space: nowrap; }\n.hb-vl10-code { margin-top: 0.6cqw; font-family: var(--font-mono, ui-monospace, monospace); font-size: 2.4cqw; letter-spacing: 0.1em; color: #6f6f75; }\n.hb-vl10-bars { display: flex; align-items: stretch; gap: 0.45cqw; height: 6.5cqw; opacity: 0.85; }\n.hb-vl10-bars span { background: #ededed; border-radius: 0.2cqw; }\n.hb-vl10-bk { position: absolute; inset: 0; display: flex; align-items: center; gap: 6cqw; padding: 7cqw; }\n.hb-vl10-qr {\n  display: grid;\n  flex: none;\n  grid-template-columns: repeat(11, 1fr);\n  gap: 0.5cqw;\n  width: 34cqw;\n  padding: 2.4cqw;\n  border-radius: 2.4cqw;\n  background: #f4f4f5;\n}\n.hb-vl10-qr span { aspect-ratio: 1; border-radius: 0.3cqw; }\n.hb-vl10-qr span[data-on=\"true\"] { background: #0d0e12; }\n.hb-vl10-bt { display: flex; flex-direction: column; gap: 1.6cqw; }\n.hb-vl10-bt strong { font-size: 4.6cqw; font-weight: 600; letter-spacing: -0.02em; }\n.hb-vl10-bt span { font-size: 2.9cqw; line-height: 1.45; color: #a1a1a1; }\n.hb-vl10-hint {\n  position: absolute;\n  right: 5cqw;\n  bottom: 4.6cqw;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 2.2cqw;\n  letter-spacing: 0.12em;\n  text-transform: uppercase;\n  color: #6f6f75;\n  transform: translateZ(12px);\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vl10-flip { transition: none; }\n}\n`;\n\nexport function CardFoilPass({\n  event = \"Northwind Summit\",\n  edition = \"Lisbon / 14-16 May 2027\",\n  name = \"Maya Lindqvist\",\n  detail = \"Speaker, Hall B\",\n  access = \"All access\",\n  code = \"NWS-0427-118\",\n  maxTilt = 14,\n  idle = true,\n  flippable = true,\n  accent = \"#2f7bff\",\n  onFlip,\n  className,\n  style,\n  onPointerMove,\n  onPointerLeave,\n  onKeyDown,\n  onClick,\n  ...rest\n}: CardFoilPassProps) {\n  const ref = React.useRef<HTMLDivElement>(null);\n  const target = React.useRef({ rx: 0, ry: 0, mx: 50, my: 50, e: 0 });\n  const over = React.useRef(false);\n  const [flipped, setFlipped] = React.useState(false);\n  const uid = React.useId().replace(/:/g, \"\");\n\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const cur = { rx: 0, ry: 0, mx: 50, my: 50, e: 0 };\n    let raf = 0;\n    let visible = true;\n    const io = new IntersectionObserver(([entry]) => {\n      visible = entry.isIntersecting;\n    });\n    io.observe(el);\n    const loop = (t: number) => {\n      raf = requestAnimationFrame(loop);\n      if (!visible) return;\n      if (!over.current) {\n        if (idle) {\n          const ry = Math.sin(t * 0.0006) * maxTilt * 0.55;\n          const rx = Math.sin(t * 0.0009 + 1.2) * maxTilt * 0.35;\n          target.current = { rx, ry, mx: 50 + (ry / maxTilt) * 45, my: 50 - (rx / maxTilt) * 45, e: 0.35 };\n        } else target.current = { rx: 0, ry: 0, mx: 50, my: 50, e: 0 };\n      }\n      const k = over.current ? 0.14 : 0.06;\n      const tg = target.current;\n      cur.rx += (tg.rx - cur.rx) * k;\n      cur.ry += (tg.ry - cur.ry) * k;\n      cur.mx += (tg.mx - cur.mx) * k;\n      cur.my += (tg.my - cur.my) * k;\n      cur.e += (tg.e - cur.e) * k;\n      el.style.setProperty(\"--hb-vl10-rx\", `${cur.rx.toFixed(2)}deg`);\n      el.style.setProperty(\"--hb-vl10-ry\", `${cur.ry.toFixed(2)}deg`);\n      el.style.setProperty(\"--hb-vl10-mx\", `${cur.mx.toFixed(1)}%`);\n      el.style.setProperty(\"--hb-vl10-my\", `${cur.my.toFixed(1)}%`);\n      el.style.setProperty(\"--hb-vl10-e\", cur.e.toFixed(3));\n    };\n    raf = requestAnimationFrame(loop);\n    return () => {\n      cancelAnimationFrame(raf);\n      io.disconnect();\n    };\n  }, [idle, maxTilt]);\n\n  const aim = (px: number, py: number) => {\n    target.current = {\n      ry: (px - 0.5) * 2 * maxTilt,\n      rx: -(py - 0.5) * 2 * maxTilt,\n      mx: px * 100,\n      my: py * 100,\n      e: Math.min(1, 0.5 + Math.hypot(px - 0.5, py - 0.5)),\n    };\n  };\n\n  const flip = () => {\n    if (!flippable) return;\n    const next = !flipped;\n    setFlipped(next);\n    onFlip?.(next);\n  };\n\n  return (\n    <div\n      ref={ref}\n      className={[\"hb-vl10\", className].filter(Boolean).join(\" \")}\n      style={{ \"--hb-vl10-a\": accent, ...style } as React.CSSProperties}\n      data-flipped={flipped ? \"true\" : \"false\"}\n      tabIndex={0}\n      role={flippable ? \"button\" : \"img\"}\n      aria-pressed={flippable ? flipped : undefined}\n      aria-label={`${event} pass for ${name}, ${access}${flippable ? \". Press to flip\" : \"\"}`}\n      onPointerMove={(e) => {\n        onPointerMove?.(e);\n        const r = e.currentTarget.getBoundingClientRect();\n        over.current = true;\n        const px = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width));\n        const py = Math.min(1, Math.max(0, (e.clientY - r.top) / r.height));\n        aim(flipped ? 1 - px : px, py);\n      }}\n      onPointerLeave={(e) => {\n        onPointerLeave?.(e);\n        over.current = false;\n      }}\n      onClick={(e) => {\n        onClick?.(e);\n        flip();\n      }}\n      onKeyDown={(e) => {\n        onKeyDown?.(e);\n        if (e.key === \"Enter\" || e.key === \" \") {\n          e.preventDefault();\n          flip();\n          return;\n        }\n        const step: Record<string, [number, number]> = { ArrowLeft: [0.15, 0.5], ArrowRight: [0.85, 0.5], ArrowUp: [0.5, 0.15], ArrowDown: [0.5, 0.85] };\n        const s = step[e.key];\n        if (!s) return;\n        e.preventDefault();\n        over.current = true;\n        aim(s[0], s[1]);\n      }}\n      onBlur={() => {\n        over.current = false;\n      }}\n      {...rest}\n    >\n      <style href=\"hb-card-foil-pass\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vl10-tilt\">\n        <div className=\"hb-vl10-flip\">\n          <div className=\"hb-vl10-face\">\n            <svg className=\"hb-vl10-guil\" viewBox=\"0 0 400 252\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n              {Array.from({ length: 14 }, (_, i) => (\n                <path\n                  key={i}\n                  d={`M-10 ${(40 + i * 14).toFixed(0)} C 90 ${(10 + i * 14).toFixed(0)}, 170 ${(80 + i * 14).toFixed(0)}, 260 ${(36 + i * 14).toFixed(0)} S 380 ${(20 + i * 14).toFixed(0)}, 420 ${(52 + i * 14).toFixed(0)}`}\n                  fill=\"none\"\n                  stroke=\"#8aa4ff\"\n                  strokeWidth=\"0.6\"\n                />\n              ))}\n            </svg>\n            <span className=\"hb-vl10-foil\" aria-hidden=\"true\" />\n            <span className=\"hb-vl10-seal\" aria-hidden=\"true\" />\n            <div className=\"hb-vl10-in\">\n              <div className=\"hb-vl10-top\">\n                <span className=\"hb-vl10-logo\" aria-hidden=\"true\">\n                  <svg viewBox=\"0 0 20 20\" width=\"60%\" height=\"60%\" fill=\"none\">\n                    <path d=\"M4 15V5l12 10V5\" stroke=\"#ffffff\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                  </svg>\n                </span>\n                <span className=\"hb-vl10-ev\">\n                  <span className=\"hb-vl10-evn\">{event}</span>\n                  <span className=\"hb-vl10-evd\">{edition}</span>\n                </span>\n              </div>\n              <div className=\"hb-vl10-mid\">\n                <span className=\"hb-vl10-acc\">{access}</span>\n                <p className=\"hb-vl10-name\">{name}</p>\n                <div className=\"hb-vl10-row\">\n                  <div>\n                    <div className=\"hb-vl10-role\">{detail}</div>\n                    <div className=\"hb-vl10-code\">{code}</div>\n                  </div>\n                  <div className=\"hb-vl10-bars\" aria-hidden=\"true\">\n                    {bars.map((w, i) => (\n                      <span key={i} style={{ width: `${(w * 0.28).toFixed(2)}cqw` }} />\n                    ))}\n                  </div>\n                </div>\n              </div>\n            </div>\n            <span className=\"hb-vl10-glare\" aria-hidden=\"true\" />\n            <span className=\"hb-vl10-edge\" aria-hidden=\"true\" />\n          </div>\n          <div className=\"hb-vl10-face hb-vl10-back\" aria-hidden={!flipped}>\n            <div className=\"hb-vl10-bk\">\n              <div className=\"hb-vl10-qr\" aria-hidden=\"true\">\n                {cells.map((on, i) => (\n                  <span key={`${uid}-${i}`} data-on={on ? \"true\" : \"false\"} />\n                ))}\n              </div>\n              <div className=\"hb-vl10-bt\">\n                <strong>Scan at the entrance</strong>\n                <span>\n                  Valid for all three days. Keep this pass visible inside the venue. Badge pickup opens at 08:00 in the Atrium.\n                </span>\n              </div>\n            </div>\n            <span className=\"hb-vl10-hint\">{code}</span>\n            <span className=\"hb-vl10-glare\" aria-hidden=\"true\" />\n            <span className=\"hb-vl10-edge\" aria-hidden=\"true\" />\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}