{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button-parallax-layers",
  "type": "registry:component",
  "title": "Button Parallax Layers",
  "description": "A magnetic download button built from stacked layers: the plate, the text and the icon chip each follow the pointer by a different amount, and the shadow shifts the other way. It snaps home with a soft overshoot when the pointer leaves.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "buttons",
    "button",
    "magnetic",
    "parallax",
    "depth",
    "download",
    "pointer"
  ],
  "docs": "https://hyperblur.dev/effects/button-parallax-layers",
  "files": [
    {
      "path": "registry/hyperblur/button-parallax-layers.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/button-parallax-layers.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ButtonParallaxLayersProps\n  extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"color\"> {\n  accent?: string;\n  depth?: number;\n  reach?: number;\n  hint?: string;\n  size?: \"sm\" | \"md\" | \"lg\";\n}\n\nconst css = `\n.hb-xa9 {\n  --hb-xa9-c: #2f7bff;\n  --hb-xa9-x: 0;\n  --hb-xa9-y: 0;\n  --hb-xa9-r: 22px;\n  position: relative;\n  display: inline-block;\n  box-sizing: border-box;\n  padding: var(--hb-xa9-r);\n  margin: calc(var(--hb-xa9-r) * -1);\n  touch-action: manipulation;\n}\n.hb-xa9 *, .hb-xa9 *::before, .hb-xa9 *::after { box-sizing: border-box; }\n.hb-xa9-btn {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 0.85em;\n  margin: 0;\n  padding: 0.42em 1.3em 0.42em 0.42em;\n  font: inherit;\n  font-size: 15px;\n  font-weight: 600;\n  line-height: 1;\n  color: #f5f5f5;\n  background: transparent;\n  border: 0;\n  border-radius: 999px;\n  cursor: pointer;\n  isolation: isolate;\n  user-select: none;\n  -webkit-tap-highlight-color: transparent;\n  transform: translate(calc(var(--hb-xa9-x) * 0.22px), calc(var(--hb-xa9-y) * 0.22px));\n  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-xa9[data-active=\"true\"] .hb-xa9-btn,\n.hb-xa9[data-active=\"true\"] .hb-xa9-l { transition-duration: 0.18s; transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }\n.hb-xa9-btn[data-size=\"sm\"] { font-size: 13px; }\n.hb-xa9-btn[data-size=\"lg\"] { font-size: 17px; }\n.hb-xa9-btn:focus-visible { outline: 2px solid var(--hb-xa9-c); outline-offset: 4px; }\n.hb-xa9-btn:disabled { opacity: 0.45; cursor: not-allowed; }\n.hb-xa9-plate {\n  position: absolute;\n  inset: 0;\n  z-index: -2;\n  border-radius: inherit;\n  background:\n    radial-gradient(90% 140% at calc(50% + var(--hb-xa9-x) * 1%) 0%, rgba(255, 255, 255, 0.12), transparent 60%),\n    linear-gradient(180deg, #1b1b1d, #0e0e10);\n  box-shadow:\n    inset 0 1px 0 rgba(255, 255, 255, 0.1),\n    inset 0 0 0 1px #2a2a2e,\n    calc(var(--hb-xa9-x) * -0.25px) calc(10px + var(--hb-xa9-y) * -0.25px) 26px -12px rgba(0, 0, 0, 0.95);\n}\n.hb-xa9-glow {\n  position: absolute;\n  left: 0;\n  top: 50%;\n  width: 3.4em;\n  height: 3.4em;\n  margin-top: -1.7em;\n  z-index: -1;\n  border-radius: 50%;\n  background: radial-gradient(circle, color-mix(in srgb, var(--hb-xa9-c) 55%, transparent), transparent 70%);\n  filter: blur(6px);\n  opacity: 0.6;\n  pointer-events: none;\n}\n.hb-xa9-l {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-xa9-l[data-d=\"1\"] { transform: translate(calc(var(--hb-xa9-x) * 0.14px), calc(var(--hb-xa9-y) * 0.14px)); }\n.hb-xa9-l[data-d=\"2\"] { transform: translate(calc(var(--hb-xa9-x) * 0.3px), calc(var(--hb-xa9-y) * 0.3px)); }\n.hb-xa9-chip {\n  display: grid;\n  place-items: center;\n  width: 2.4em;\n  height: 2.4em;\n  color: #fff;\n  border-radius: 50%;\n  background: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--hb-xa9-c) 55%, #fff), var(--hb-xa9-c) 65%);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.25), 0 6px 14px -6px var(--hb-xa9-c);\n}\n.hb-xa9-chip svg { width: 1.05em; height: 1.05em; }\n.hb-xa9-txt { display: flex; flex-direction: column; gap: 0.28em; white-space: nowrap; text-align: left; }\n.hb-xa9-sub { font-size: 0.72em; font-weight: 500; color: #8f8f8f; letter-spacing: 0.01em; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xa9-btn, .hb-xa9-l, .hb-xa9[data-active=\"true\"] .hb-xa9-btn, .hb-xa9[data-active=\"true\"] .hb-xa9-l { transition: none; transform: none; }\n}\n`;\n\nexport function ButtonParallaxLayers({\n  children = \"Download for macOS\",\n  accent = \"#2f7bff\",\n  depth = 1,\n  reach = 22,\n  size = \"md\",\n  hint = \"Apple silicon · 48 MB\",\n  type = \"button\",\n  className = \"\",\n  style,\n  ...rest\n}: ButtonParallaxLayersProps) {\n  const ref = React.useRef<HTMLSpanElement>(null);\n  const [active, setActive] = React.useState(false);\n\n  function move(e: React.PointerEvent<HTMLSpanElement>) {\n    const el = ref.current;\n    if (!el || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const r = el.getBoundingClientRect();\n    const k = Math.max(0, depth);\n    const x = ((e.clientX - (r.left + r.width / 2)) / (r.width / 2)) * 60 * k;\n    const y = ((e.clientY - (r.top + r.height / 2)) / (r.height / 2)) * 40 * k;\n    el.style.setProperty(\"--hb-xa9-x\", x.toFixed(2));\n    el.style.setProperty(\"--hb-xa9-y\", y.toFixed(2));\n    if (!active) setActive(true);\n  }\n\n  function leave() {\n    const el = ref.current;\n    if (el) {\n      el.style.setProperty(\"--hb-xa9-x\", \"0\");\n      el.style.setProperty(\"--hb-xa9-y\", \"0\");\n    }\n    setActive(false);\n  }\n\n  const vars = { \"--hb-xa9-c\": accent, \"--hb-xa9-r\": `${Math.max(0, reach).toFixed(0)}px` } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-button-parallax-layers\" precedence=\"default\">{css}</style>\n      <span\n        ref={ref}\n        className={`hb-xa9 ${className}`}\n        style={vars}\n        data-active={active || undefined}\n        onPointerMove={move}\n        onPointerLeave={leave}\n      >\n        <button type={type} className=\"hb-xa9-btn\" style={style} data-size={size} {...rest}>\n          <span className=\"hb-xa9-plate\" aria-hidden=\"true\" />\n          <span className=\"hb-xa9-glow\" aria-hidden=\"true\" />\n          <span className=\"hb-xa9-l\" data-d=\"2\">\n            <span className=\"hb-xa9-chip\" aria-hidden=\"true\">\n              <svg viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.9\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                <path d=\"M10 3.5v9\" />\n                <path d=\"M6 8.8l4 4 4-4\" />\n                <path d=\"M4.5 16h11\" />\n              </svg>\n            </span>\n          </span>\n          <span className=\"hb-xa9-l\" data-d=\"1\">\n            <span className=\"hb-xa9-txt\">\n              <span>{children}</span>\n              {hint ? <span className=\"hb-xa9-sub\">{hint}</span> : null}\n            </span>\n          </span>\n        </button>\n      </span>\n    </>\n  );\n}\n"
    }
  ]
}