{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "profile-foil",
  "type": "registry:component",
  "title": "Profile Foil",
  "description": "A profile card with a holographic foil: it tilts in 3D with the cursor and the iridescence shifts with the angle.",
  "author": "Marcelo Treviño Velázquez <https://furin.dev>",
  "dependencies": [],
  "categories": [
    "Cards"
  ],
  "docs": "Installed in components/furin/profile-foil/. Docs, live controls and props table: https://furin.dev/components/profile-foil/",
  "files": [
    {
      "path": "registry/profile-foil/ProfileFoil.tsx",
      "content": "\"use client\";\nimport { useEffect, useId, useRef } from \"react\";\nimport type { CSSProperties } from \"react\";\nimport \"./ProfileFoil.css\";\n\nexport interface ProfileFoilStat {\n  label: string;\n  value: string;\n}\n\nexport interface ProfileFoilProps {\n  /** Nombre que va en grande. */\n  name?: string;\n  /** Rol o título debajo del nombre. */\n  role?: string;\n  /** Usuario con arroba. */\n  handle?: string;\n  /** Tres datos de resumen al pie de la tarjeta. */\n  stats?: ProfileFoilStat[];\n  /** Número de serie impreso en el encabezado. */\n  serial?: string;\n  /** Fuerza de la lámina holográfica (0 a 1.5). */\n  intensity?: number;\n  /** Inclinación máxima de la tarjeta, en grados. */\n  maxTilt?: number;\n  /** Giro del tono de la lámina, en grados. */\n  hue?: number;\n  /** Si no hay cursor encima, la tarjeta se mece sola. */\n  autoplay?: boolean;\n  /** Clase extra para el contenedor. */\n  className?: string;\n  /** Estilos extra para el contenedor. */\n  style?: CSSProperties;\n}\n\nconst STATS: ProfileFoilStat[] = [\n  { label: \"Projects\", value: \"48\" },\n  { label: \"Followers\", value: \"12.4k\" },\n  { label: \"Reviews\", value: \"4.9\" },\n];\n\n/** Tarjeta de perfil con lámina holográfica: se inclina en 3D y la iridiscencia cambia con el ángulo. */\nexport function ProfileFoil({\n  name = \"Alex Rivera\",\n  role = \"Product designer\",\n  handle = \"@alexrivera\",\n  stats = STATS,\n  serial = \"No. 0482\",\n  intensity = 1,\n  maxTilt = 14,\n  hue = 0,\n  autoplay = true,\n  className = \"\",\n  style,\n}: ProfileFoilProps) {\n  const root = useRef<HTMLDivElement>(null);\n  const opts = useRef({ maxTilt, autoplay });\n  opts.current = { maxTilt, autoplay };\n  const uid = useId().replace(/:/g, \"\");\n\n  useEffect(() => {\n    const el = root.current;\n    const card = el?.querySelector<HTMLElement>(\".furin-profile-foil__card\");\n    if (!el || !card) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    const s = { x: 0.66, y: 0.3, tx: 0.66, ty: 0.3 };\n    let hover = false;\n    let visible = true;\n    let raf = 0;\n    let last = 0;\n    const t0 = performance.now();\n\n    const pintar = () => {\n      const dx = (s.x - 0.5) * 2;\n      const dy = (s.y - 0.5) * 2;\n      const m = opts.current.maxTilt;\n      const set = (k: string, v: string) => card.style.setProperty(k, v);\n      set(\"--pf-rx\", `${(-dy * m).toFixed(2)}deg`);\n      set(\"--pf-ry\", `${(dx * m).toFixed(2)}deg`);\n      set(\"--pf-shx\", `${(-dx * 22).toFixed(1)}px`);\n      set(\"--pf-shy\", `${(18 - dy * 14).toFixed(1)}px`);\n      set(\"--hf-x\", `${(50 + dx * 50).toFixed(2)}%`);\n      set(\"--hf-y\", `${(50 + dy * 50).toFixed(2)}%`);\n      set(\"--hf-a\", `${(dx * 70 + dy * 40).toFixed(1)}deg`);\n      set(\"--hf-ga\", `${(112 + dx * 16 - dy * 10).toFixed(1)}deg`);\n      set(\"--hf-sx\", `${(dx * 38).toFixed(1)}%`);\n      set(\"--hf-sy\", `${(dy * 38).toFixed(1)}%`);\n      set(\"--hf-hue\", `${(dx * 46 - dy * 30).toFixed(1)}deg`);\n    };\n\n    const tick = (now: number) => {\n      raf = 0;\n      const dt = Math.min(0.05, (now - (last || now)) / 1000);\n      last = now;\n      if (!hover && opts.current.autoplay) {\n        const t = (now - t0) / 1000;\n        s.tx = 0.5 + 0.36 * Math.sin(t * 0.7) + 0.08 * Math.sin(t * 1.7 + 1);\n        s.ty = 0.5 + 0.3 * Math.cos(t * 0.52 + 0.6);\n      }\n      const a = 1 - Math.exp(-dt * 7);\n      s.x += (s.tx - s.x) * a;\n      s.y += (s.ty - s.y) * a;\n      pintar();\n      const quieto = Math.abs(s.tx - s.x) < 0.0008 && Math.abs(s.ty - s.y) < 0.0008;\n      if (visible && !(quieto && !(opts.current.autoplay && !hover))) raf = requestAnimationFrame(tick);\n      else last = 0;\n    };\n    const wake = () => { if (!raf && visible && !reduce) raf = requestAnimationFrame(tick); };\n\n    const onMove = (e: PointerEvent) => {\n      const r = card.getBoundingClientRect();\n      // Se mide contra el centro de la tarjeta, con holgura: la inclinación empieza antes de tocarla.\n      s.tx = Math.min(1, Math.max(0, 0.5 + (e.clientX - (r.left + r.width / 2)) / (r.width * 1.5)));\n      s.ty = Math.min(1, Math.max(0, 0.5 + (e.clientY - (r.top + r.height / 2)) / (r.height * 1.5)));\n      hover = true;\n      wake();\n    };\n    const onLeave = () => { hover = false; wake(); };\n    el.addEventListener(\"pointermove\", onMove);\n    el.addEventListener(\"pointerdown\", onMove);\n    el.addEventListener(\"pointerleave\", onLeave);\n    const io = new IntersectionObserver(([en]) => { visible = en.isIntersecting; if (visible) wake(); }, { threshold: 0.01 });\n    io.observe(el);\n    pintar();\n    wake();\n    return () => {\n      cancelAnimationFrame(raf);\n      io.disconnect();\n      el.removeEventListener(\"pointermove\", onMove);\n      el.removeEventListener(\"pointerdown\", onMove);\n      el.removeEventListener(\"pointerleave\", onLeave);\n    };\n  }, []);\n\n  const vars = { \"--hf-int\": intensity, \"--hf-hue0\": `${hue}deg` } as CSSProperties;\n\n  return (\n    <div ref={root} className={`furin-profile-foil ${className}`} style={{ ...vars, ...style }}>\n      <div className=\"furin-profile-foil__card\">\n        <span className=\"furin-profile-foil__metal\" aria-hidden />\n        <span className=\"furin-profile-foil__crinkle\" aria-hidden />\n        <span className=\"furin-profile-foil__film\" aria-hidden />\n        <span className=\"furin-profile-foil__film furin-profile-foil__film--b\" aria-hidden />\n        <span className=\"furin-profile-foil__grating\" aria-hidden />\n        <span className=\"furin-profile-foil__glint\" aria-hidden />\n        <span className=\"furin-profile-foil__sparkle\" aria-hidden />\n        <span className=\"furin-profile-foil__grain\" aria-hidden />\n\n        <div className=\"furin-profile-foil__body\">\n          <div className=\"furin-profile-foil__top\">\n            <span className=\"furin-profile-foil__serial\">{serial}</span>\n            <span className=\"furin-profile-foil__chip\">PRO</span>\n          </div>\n          <div className=\"furin-profile-foil__window\">\n            <svg viewBox=\"0 0 240 200\" preserveAspectRatio=\"xMidYMax slice\" aria-hidden>\n              <defs>\n                <linearGradient id={`${uid}a`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n                  <stop offset=\"0\" stopColor=\"#1b1d27\" stopOpacity=\"0.15\" />\n                  <stop offset=\"1\" stopColor=\"#07080b\" stopOpacity=\"0.85\" />\n                </linearGradient>\n                <linearGradient id={`${uid}b`} x1=\"0.1\" y1=\"0\" x2=\"0.9\" y2=\"1\">\n                  <stop offset=\"0\" stopColor=\"#4b5063\" />\n                  <stop offset=\"0.45\" stopColor=\"#14151c\" />\n                  <stop offset=\"1\" stopColor=\"#090a0e\" />\n                </linearGradient>\n                <radialGradient id={`${uid}c`} cx=\"0.5\" cy=\"0.38\" r=\"0.5\">\n                  <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.22\" />\n                  <stop offset=\"1\" stopColor=\"#fff\" stopOpacity=\"0\" />\n                </radialGradient>\n              </defs>\n              <rect width=\"240\" height=\"200\" fill={`url(#${uid}a)`} />\n              <ellipse cx=\"120\" cy=\"78\" rx=\"62\" ry=\"62\" fill={`url(#${uid}c)`} />\n              <path d=\"M24 205c0-44 36-68 96-68s96 24 96 68z\" fill={`url(#${uid}b)`} />\n              <circle cx=\"120\" cy=\"80\" r=\"35\" fill={`url(#${uid}b)`} />\n              <path d=\"M85 74a35 35 0 0 1 70 0\" fill=\"none\" stroke=\"#fff\" strokeOpacity=\"0.28\" strokeWidth=\"1.4\" />\n              <path d=\"M24 205c0-44 36-68 96-68s96 24 96 68\" fill=\"none\" stroke=\"#fff\" strokeOpacity=\"0.18\" strokeWidth=\"1.2\" />\n            </svg>\n          </div>\n          <div className=\"furin-profile-foil__id\">\n            <h3 className=\"furin-profile-foil__name\">{name}</h3>\n            <p className=\"furin-profile-foil__role\">{role}</p>\n            <p className=\"furin-profile-foil__handle\">{handle}</p>\n          </div>\n          <ul className=\"furin-profile-foil__stats\">\n            {stats.slice(0, 3).map((st) => (\n              <li key={st.label}>\n                <b>{st.value}</b>\n                <span>{st.label}</span>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </div>\n    </div>\n  );\n}\n\nexport default ProfileFoil;\n",
      "type": "registry:component",
      "target": "components/furin/profile-foil/ProfileFoil.tsx"
    },
    {
      "path": "registry/profile-foil/ProfileFoil.css",
      "content": "/* Tarjeta de perfil con lámina holográfica. Las capas de lámina son las mismas del fondo HoloFoil, recortadas a la tarjeta. */\n.furin-profile-foil {\n  --hf-int: 1; --hf-hue0: 0deg;\n  position: relative;\n  width: 100%;\n  height: 100%;\n  min-height: 460px;\n  display: grid;\n  place-items: center;\n  perspective: 1000px;\n  touch-action: pan-y;\n}\n.furin-profile-foil__card {\n  --pf-rx: 0deg; --pf-ry: 0deg; --pf-shx: 0px; --pf-shy: 18px;\n  --hf-x: 66%; --hf-y: 30%; --hf-a: 20deg; --hf-ga: 112deg; --hf-sx: 10%; --hf-sy: -8%; --hf-hue: 10deg; --hf-den: 2.6px; --hf-base: #13141a;\n  --hf-crinkle: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.007 0.011' numOctaves='5' seed='11'/%3E%3CfeDiffuseLighting lighting-color='%23fff' surfaceScale='14'%3E%3CfeDistantLight azimuth='215' elevation='52'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='640' height='640' filter='url(%23f)'/%3E%3C/svg%3E\");\n  --hf-crinkle-mask: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.009' numOctaves='4' seed='23'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 0.9 0 0 -0.5'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='gamma' amplitude='2.6' exponent='1.7' offset='-0.2'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='640' height='640' filter='url(%23g)'/%3E%3C/svg%3E\");\n  --hf-sparkle: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='s' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 80 -58'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23s)'/%3E%3C/svg%3E\");\n  --hf-grain: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E\");\n  position: relative;\n  isolation: isolate;\n  overflow: hidden;\n  width: min(300px, 82%);\n  aspect-ratio: 5 / 7.1;\n  border-radius: 22px;\n  background: var(--hf-base);\n  transform: rotateX(var(--pf-rx)) rotateY(var(--pf-ry));\n  transform-style: flat;\n  box-shadow:\n    inset 0 0 0 1px rgba(255, 255, 255, 0.16),\n    inset 0 1px 0 rgba(255, 255, 255, 0.3),\n    var(--pf-shx) var(--pf-shy) 46px -8px rgba(0, 0, 0, 0.7),\n    0 2px 6px rgba(0, 0, 0, 0.5);\n  will-change: transform;\n}\n.furin-profile-foil__card > span { position: absolute; inset: 0; pointer-events: none; }\n.furin-profile-foil__metal {\n  background:\n    linear-gradient(var(--hf-ga),\n      color-mix(in srgb, var(--hf-base) 60%, #3a3c46) calc(var(--hf-x) - 70%),\n      color-mix(in srgb, var(--hf-base) 12%, #8a8e9c) calc(var(--hf-x) - 38%),\n      color-mix(in srgb, var(--hf-base) 80%, #1c1d24) calc(var(--hf-x) - 10%),\n      color-mix(in srgb, var(--hf-base) 15%, #7d8190) calc(var(--hf-x) + 22%),\n      color-mix(in srgb, var(--hf-base) 70%, #30323b) calc(var(--hf-x) + 60%));\n}\n.furin-profile-foil__crinkle { background: var(--hf-crinkle) 0 0 / 420px 420px; mix-blend-mode: overlay; filter: contrast(1.15) brightness(0.9); opacity: 0.7; }\n.furin-profile-foil__film {\n  background:\n    conic-gradient(from calc(var(--hf-a) * 1.6 + 200deg) at calc(var(--hf-x) - 85%) calc(var(--hf-y) + 95%),\n      #ff3d9a 0deg, #ff8f5a 40deg, #ffd86b 70deg, #66f2b4 120deg, #3cc3ff 170deg, #6a63ff 225deg, #c04dff 285deg, #ff3d9a 360deg);\n  filter: hue-rotate(calc(var(--hf-hue0) + var(--hf-hue))) saturate(1.05);\n  mix-blend-mode: color;\n  opacity: calc(0.78 * min(var(--hf-int), 1.2));\n}\n.furin-profile-foil__film--b {\n  background:\n    conic-gradient(from calc(var(--hf-a) * -1.9 + 40deg) at calc(var(--hf-x) + 85%) calc(var(--hf-y) - 95%),\n      #35e8d0 0deg, #4f86ff 60deg, #b24dff 125deg, #ff5aa0 190deg, #ffb86b 250deg, #86ec7a 310deg, #35e8d0 360deg);\n  filter: hue-rotate(calc(var(--hf-hue0) - var(--hf-hue) * 0.7)) saturate(1.05) blur(5px);\n  mix-blend-mode: color;\n  opacity: calc(0.62 * min(var(--hf-int), 1.2));\n  -webkit-mask-image: var(--hf-crinkle-mask); mask-image: var(--hf-crinkle-mask);\n  -webkit-mask-size: 380px 380px; mask-size: 380px 380px;\n}\n.furin-profile-foil__grating {\n  background: linear-gradient(var(--hf-ga), #ff3d8b, #ffb347, #e5ff6a, #4dffc4, #4da6ff, #9a6bff, #ff3d8b, #ffb347, #e5ff6a, #4dffc4) calc(50% + var(--hf-sx)) calc(50% + var(--hf-sy)) / 240% 240%;\n  -webkit-mask-image: repeating-linear-gradient(var(--hf-ga), #0000 0 1.2px, #000 1.4px 2.5px, #0000 2.6px);\n  mask-image: repeating-linear-gradient(var(--hf-ga), #0000 0 1.2px, #000 1.4px 2.5px, #0000 2.6px);\n  mix-blend-mode: color-dodge;\n  opacity: calc(0.34 * var(--hf-int));\n  filter: hue-rotate(var(--hf-hue0));\n}\n.furin-profile-foil__glint {\n  background:\n    radial-gradient(34% 26% at var(--hf-x) var(--hf-y), rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 100%),\n    radial-gradient(90% 70% at var(--hf-x) var(--hf-y), rgba(255, 238, 225, 0.2), rgba(255, 255, 255, 0) 100%);\n  mix-blend-mode: overlay;\n  opacity: calc(0.45 + 0.4 * var(--hf-int));\n}\n.furin-profile-foil__sparkle {\n  background: var(--hf-sparkle) 0 0 / 300px 300px;\n  mix-blend-mode: plus-lighter;\n  opacity: calc(0.3 * var(--hf-int));\n  -webkit-mask-image: radial-gradient(34% 26% at var(--hf-x) var(--hf-y), #000 15%, transparent 100%);\n  mask-image: radial-gradient(34% 26% at var(--hf-x) var(--hf-y), #000 15%, transparent 100%);\n}\n.furin-profile-foil__grain { background: var(--hf-grain) 0 0 / 200px 200px; mix-blend-mode: overlay; opacity: 0.2; }\n\n/* Contenido impreso encima de la lámina. */\n.furin-profile-foil__body {\n  position: absolute;\n  inset: 0;\n  z-index: 2;\n  padding: 14px;\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n  color: #fff;\n  font-family: Geist, \"Inter\", system-ui, sans-serif;\n}\n.furin-profile-foil__top { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }\n.furin-profile-foil__serial { font: 500 10.5px/1 \"JetBrains Mono\", ui-monospace, monospace; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.78); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }\n.furin-profile-foil__chip { font: 700 9.5px/1 Geist, system-ui, sans-serif; letter-spacing: 0.18em; padding: 5px 8px 5px 10px; border-radius: 99px; background: rgba(8, 9, 12, 0.5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); backdrop-filter: blur(6px); }\n.furin-profile-foil__window {\n  position: relative;\n  flex: 1 1 auto;\n  min-height: 0;\n  border-radius: 14px;\n  overflow: hidden;\n  background: rgba(10, 11, 15, 0.28);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), inset 0 -30px 40px -20px rgba(0, 0, 0, 0.55), 0 8px 24px -10px rgba(0, 0, 0, 0.6);\n  backdrop-filter: blur(1.5px) saturate(1.2);\n}\n.furin-profile-foil__window svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }\n.furin-profile-foil__id { padding: 0 4px; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55); }\n.furin-profile-foil__name { margin: 0; font-weight: 650; font-size: 22px; line-height: 1.1; letter-spacing: -0.02em; }\n.furin-profile-foil__role { margin: 4px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.82); }\n.furin-profile-foil__handle { margin: 3px 0 0; font: 500 11px/1.2 \"JetBrains Mono\", ui-monospace, monospace; color: rgba(255, 255, 255, 0.62); }\n.furin-profile-foil__stats {\n  list-style: none;\n  margin: 0;\n  padding: 10px 0;\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  border-radius: 14px;\n  background: rgba(8, 9, 12, 0.46);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);\n  backdrop-filter: blur(8px);\n}\n.furin-profile-foil__stats li { display: grid; gap: 3px; justify-items: center; }\n.furin-profile-foil__stats li + li { border-left: 1px solid rgba(255, 255, 255, 0.14); }\n.furin-profile-foil__stats b { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }\n.furin-profile-foil__stats span { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }\n",
      "type": "registry:file",
      "target": "components/furin/profile-foil/ProfileFoil.css"
    }
  ]
}
