{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "parallax-depth-cards",
  "type": "registry:component",
  "title": "Parallax Depth Cards",
  "description": "A headline surrounded by floating interface cards on several depth planes. As you scroll, near cards travel further and stay sharp while far cards drift slowly, blurred and dimmed.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "parallax",
    "scroll",
    "depth",
    "cards",
    "hero",
    "dashboard"
  ],
  "docs": "https://hyperblur.dev/effects/parallax-depth-cards",
  "files": [
    {
      "path": "registry/hyperblur/parallax-depth-cards.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/parallax-depth-cards.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface DepthCard {\n  label: string;\n  value: string;\n  detail?: string;\n  tone?: \"stat\" | \"chip\" | \"note\" | \"chart\";\n  depth?: number;\n  x?: number;\n  y?: number;\n  rotate?: number;\n}\n\nexport interface ParallaxDepthCardsProps extends React.HTMLAttributes<HTMLDivElement> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  cards?: DepthCard[];\n  mode?: \"inner\" | \"page\";\n  height?: number;\n  length?: number;\n  range?: number;\n  progress?: number;\n  autoPlay?: boolean;\n  duration?: number;\n  accent?: string;\n}\n\nconst defaultCards: DepthCard[] = [\n  { label: \"Monthly revenue\", value: \"$84,210\", detail: \"+12.4% vs Oct\", tone: \"stat\", depth: 0.7, x: 6, y: 16, rotate: -4 },\n  { label: \"Active seats\", value: \"1,284\", tone: \"chip\", depth: 0.35, x: 72, y: 8, rotate: 3 },\n  { label: \"api-gateway\", value: \"Deploy succeeded\", detail: \"2m 14s / main\", tone: \"note\", depth: 1, x: 66, y: 66, rotate: 4 },\n  { label: \"Weekly signups\", value: \"312\", tone: \"chart\", depth: 0.9, x: 4, y: 64, rotate: -3 },\n  { label: \"Churn\", value: \"1.8%\", tone: \"chip\", depth: 0.25, x: 40, y: 84, rotate: -2 },\n  { label: \"NPS\", value: \"62\", tone: \"chip\", depth: 0.5, x: 84, y: 40, rotate: 6 },\n];\n\nconst bars = [0.42, 0.55, 0.48, 0.7, 0.62, 0.86, 0.78];\n\nfunction clamp(n: number) {\n  return Math.min(1, Math.max(0, n));\n}\n\nfunction ease(t: number) {\n  return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;\n}\n\nfunction scrollParent(node: HTMLElement | null): HTMLElement | null {\n  let el = node?.parentElement ?? null;\n  while (el) {\n    const oy = getComputedStyle(el).overflowY;\n    if ((oy === \"auto\" || oy === \"scroll\") && el.scrollHeight > el.clientHeight) return el;\n    el = el.parentElement;\n  }\n  return null;\n}\n\nfunction useParallaxProgress(\n  root: React.RefObject<HTMLDivElement | null>,\n  viewport: React.RefObject<HTMLDivElement | null>,\n  variable: string,\n  options: { mode: \"inner\" | \"page\"; progress?: number; autoPlay: boolean; duration: number },\n) {\n  const { mode, progress, autoPlay, duration } = options;\n  React.useEffect(() => {\n    const el = root.current;\n    const vp = viewport.current;\n    if (!el || !vp) return;\n    let current = 0;\n    const set = (p: number) => {\n      current = clamp(p);\n      el.style.setProperty(variable, current.toFixed(4));\n    };\n    if (progress !== undefined) {\n      set(progress);\n      return;\n    }\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      set(1);\n      return;\n    }\n    const pageScroller = mode === \"page\" ? scrollParent(el) : null;\n    const fromScroll = () => {\n      if (mode === \"inner\") {\n        const max = vp.scrollHeight - vp.clientHeight;\n        set(max > 0 ? vp.scrollTop / max : 0);\n        return;\n      }\n      const rect = el.getBoundingClientRect();\n      const top = pageScroller ? pageScroller.getBoundingClientRect().top : 0;\n      const view = pageScroller ? pageScroller.clientHeight : window.innerHeight;\n      const travel = rect.height - view;\n      set(travel > 0 ? (top - rect.top) / travel : top >= rect.top ? 1 : 0);\n    };\n    let raf = 0;\n    let visible = true;\n    let held = false;\n    let phase = 0;\n    let last = 0;\n    const target: HTMLElement | Window = mode === \"inner\" ? vp : pageScroller ?? window;\n    const onScroll = () => {\n      if (!autoPlay || held) fromScroll();\n    };\n    const loop = (t: number) => {\n      raf = requestAnimationFrame(loop);\n      const dt = last ? Math.min(t - last, 64) : 0;\n      last = t;\n      if (held || !visible) return;\n      phase = (phase + dt / duration) % 1;\n      set(ease(phase < 0.5 ? phase * 2 : 2 - phase * 2));\n    };\n    const onEnter = () => {\n      if (mode !== \"inner\") return;\n      held = true;\n      const max = vp.scrollHeight - vp.clientHeight;\n      vp.scrollTop = current * max;\n    };\n    const onLeave = () => {\n      if (!held) return;\n      held = false;\n      phase = current * 0.5;\n    };\n    const io = new IntersectionObserver(([entry]) => {\n      visible = entry.isIntersecting;\n    });\n    io.observe(el);\n    target.addEventListener(\"scroll\", onScroll, { passive: true });\n    window.addEventListener(\"resize\", onScroll);\n    if (autoPlay) {\n      el.addEventListener(\"pointerenter\", onEnter);\n      el.addEventListener(\"pointerleave\", onLeave);\n      el.addEventListener(\"focusin\", onEnter);\n      el.addEventListener(\"focusout\", onLeave);\n      raf = requestAnimationFrame(loop);\n    } else {\n      fromScroll();\n    }\n    return () => {\n      cancelAnimationFrame(raf);\n      io.disconnect();\n      target.removeEventListener(\"scroll\", onScroll);\n      window.removeEventListener(\"resize\", onScroll);\n      el.removeEventListener(\"pointerenter\", onEnter);\n      el.removeEventListener(\"pointerleave\", onLeave);\n      el.removeEventListener(\"focusin\", onEnter);\n      el.removeEventListener(\"focusout\", onLeave);\n    };\n  }, [root, viewport, variable, mode, progress, autoPlay, duration]);\n}\n\nconst css = `\n.hb-vl4 {\n  --hb-vl4-p: 0;\n  position: relative;\n  width: 100%;\n  color: #ededed;\n  font-family: inherit;\n  box-sizing: border-box;\n}\n.hb-vl4 *, .hb-vl4 *::before, .hb-vl4 *::after { box-sizing: border-box; }\n.hb-vl4-vp { position: relative; width: 100%; }\n.hb-vl4[data-mode=\"inner\"] .hb-vl4-vp {\n  height: var(--hb-vl4-h);\n  overflow-y: auto;\n  overscroll-behavior: contain;\n  scrollbar-width: none;\n  border-radius: 20px;\n}\n.hb-vl4[data-mode=\"inner\"] .hb-vl4-vp::-webkit-scrollbar { display: none; }\n.hb-vl4-track { position: relative; height: calc(var(--hb-vl4-h) * var(--hb-vl4-len)); }\n.hb-vl4-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-vl4-h);\n  overflow: hidden;\n  border-radius: 20px;\n  background:\n    radial-gradient(60% 50% at 50% 50%, color-mix(in srgb, var(--hb-vl4-a) 18%, transparent), transparent 70%),\n    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 22px 22px,\n    #0b0b0d;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);\n  container-type: size;\n  perspective: 900px;\n}\n.hb-vl4-copy {\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  z-index: 2;\n  width: min(86%, 520px);\n  text-align: center;\n  transform: translate(-50%, -50%) scale(calc(0.94 + var(--hb-vl4-p) * 0.08));\n}\n.hb-vl4-eye {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  margin: 0 0 8px;\n  padding: 3px 9px;\n  border-radius: 999px;\n  background: rgba(255, 255, 255, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(9px, 2.4cqh, 11px);\n  letter-spacing: 0.1em;\n  text-transform: uppercase;\n  color: #a1a1a1;\n}\n.hb-vl4-eye::before { content: \"\"; width: 5px; height: 5px; border-radius: 50%; background: var(--hb-vl4-a); }\n.hb-vl4-title {\n  margin: 0;\n  font-size: clamp(18px, 9cqh, 46px);\n  font-weight: 600;\n  line-height: 1.04;\n  letter-spacing: -0.035em;\n  text-wrap: balance;\n}\n.hb-vl4-sub {\n  margin: 8px auto 0;\n  max-width: 40ch;\n  font-size: clamp(11px, 3.4cqh, 15px);\n  line-height: 1.45;\n  color: #a1a1a1;\n}\n.hb-vl4-c {\n  position: absolute;\n  left: var(--hb-vl4-x);\n  top: var(--hb-vl4-y);\n  display: flex;\n  flex-direction: column;\n  gap: 2px;\n  padding: 8px 10px;\n  border-radius: 12px;\n  background: linear-gradient(180deg, rgba(34, 34, 38, 0.92), rgba(20, 20, 23, 0.92));\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 18px 32px -16px rgba(0, 0, 0, 0.9);\n  white-space: nowrap;\n  font-size: clamp(9px, 2.6cqh, 12px);\n  transform:\n    translate3d(0, calc((0.5 - var(--hb-vl4-p)) * var(--hb-vl4-d) * var(--hb-vl4-r)), 0)\n    scale(calc(0.7 + var(--hb-vl4-d) * 0.3))\n    rotate(calc((0.5 - var(--hb-vl4-p)) * var(--hb-vl4-rot) * 2deg));\n  filter: blur(calc((1 - var(--hb-vl4-d)) * 1.6px)) brightness(calc(0.55 + var(--hb-vl4-d) * 0.45));\n  will-change: transform;\n}\n.hb-vl4-lab { color: #8f8f8f; }\n.hb-vl4-val { font-size: 1.5em; font-weight: 600; letter-spacing: -0.02em; color: #ededed; }\n.hb-vl4-det { color: #7fd99a; font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.9em; }\n.hb-vl4-c[data-tone=\"chip\"] { flex-direction: row; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 999px; }\n.hb-vl4-c[data-tone=\"chip\"] .hb-vl4-val { font-size: 1.15em; }\n.hb-vl4-c[data-tone=\"note\"] { flex-direction: row; align-items: center; gap: 8px; }\n.hb-vl4-ok {\n  display: grid;\n  place-items: center;\n  width: 2.2em;\n  height: 2.2em;\n  border-radius: 8px;\n  background: color-mix(in srgb, #3ccf7a 18%, transparent);\n  color: #5fe39a;\n}\n.hb-vl4-note { display: flex; flex-direction: column; gap: 1px; }\n.hb-vl4-note .hb-vl4-val { font-size: 1.1em; }\n.hb-vl4-note .hb-vl4-det { color: #8f8f8f; }\n.hb-vl4-bars { display: flex; align-items: flex-end; gap: 3px; height: 2.6em; margin-top: 4px; }\n.hb-vl4-bars span {\n  width: 0.7em;\n  height: calc(var(--hb-vl4-b) * 100%);\n  border-radius: 2px 2px 1px 1px;\n  background: linear-gradient(180deg, var(--hb-vl4-a), color-mix(in srgb, var(--hb-vl4-a) 35%, transparent));\n}\n.hb-vl4-bars span:last-child { background: #ededed; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vl4-c { will-change: auto; }\n}\n`;\n\nexport function ParallaxDepthCards({\n  eyebrow = \"Live workspace\",\n  title = \"Every number your team watches, in one place.\",\n  subtitle = \"Revenue, deploys and signups update the moment they change.\",\n  cards = defaultCards,\n  mode = \"inner\",\n  height = 440,\n  length = 2.4,\n  range = 260,\n  progress,\n  autoPlay = false,\n  duration = 9000,\n  accent = \"#2f7bff\",\n  className,\n  style,\n  ...rest\n}: ParallaxDepthCardsProps) {\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const vpRef = React.useRef<HTMLDivElement>(null);\n  useParallaxProgress(rootRef, vpRef, \"--hb-vl4-p\", { mode, progress, autoPlay, duration });\n  const trackLength = mode === \"page\" && autoPlay ? 1 : length;\n\n  return (\n    <div\n      ref={rootRef}\n      className={[\"hb-vl4\", className].filter(Boolean).join(\" \")}\n      data-mode={mode}\n      style={\n        {\n          \"--hb-vl4-a\": accent,\n          \"--hb-vl4-h\": `${height}px`,\n          \"--hb-vl4-len\": trackLength,\n          \"--hb-vl4-r\": `${range}px`,\n          ...style,\n        } as React.CSSProperties\n      }\n      {...rest}\n    >\n      <style href=\"hb-parallax-depth-cards\" precedence=\"default\">{css}</style>\n      <div ref={vpRef} className=\"hb-vl4-vp\" tabIndex={mode === \"inner\" ? 0 : undefined} aria-label={mode === \"inner\" ? title : undefined} role={mode === \"inner\" ? \"region\" : undefined}>\n        <div className=\"hb-vl4-track\">\n          <div className=\"hb-vl4-stage\">\n            {cards.map((card, i) => (\n              <div\n                key={card.label + i}\n                className=\"hb-vl4-c\"\n                data-tone={card.tone ?? \"stat\"}\n                aria-hidden=\"true\"\n                style={\n                  {\n                    \"--hb-vl4-x\": `${card.x ?? 10}%`,\n                    \"--hb-vl4-y\": `${card.y ?? 10}%`,\n                    \"--hb-vl4-d\": card.depth ?? 0.6,\n                    \"--hb-vl4-rot\": card.rotate ?? 0,\n                    zIndex: (card.depth ?? 0.6) >= 0.75 ? 3 : 1,\n                  } as React.CSSProperties\n                }\n              >\n                {card.tone === \"note\" ? (\n                  <>\n                    <span className=\"hb-vl4-ok\">\n                      <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\n                        <path d=\"M2.5 6.2l2.3 2.3 4.7-5\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                      </svg>\n                    </span>\n                    <span className=\"hb-vl4-note\">\n                      <span className=\"hb-vl4-val\">{card.value}</span>\n                      <span className=\"hb-vl4-det\">\n                        {card.label}\n                        {card.detail ? ` / ${card.detail}` : \"\"}\n                      </span>\n                    </span>\n                  </>\n                ) : (\n                  <>\n                    <span className=\"hb-vl4-lab\">{card.label}</span>\n                    <span className=\"hb-vl4-val\">{card.value}</span>\n                    {card.detail && <span className=\"hb-vl4-det\">{card.detail}</span>}\n                    {card.tone === \"chart\" && (\n                      <span className=\"hb-vl4-bars\">\n                        {bars.map((b, j) => (\n                          <span key={j} style={{ \"--hb-vl4-b\": b } as React.CSSProperties} />\n                        ))}\n                      </span>\n                    )}\n                  </>\n                )}\n              </div>\n            ))}\n            <div className=\"hb-vl4-copy\">\n              {eyebrow && <p className=\"hb-vl4-eye\">{eyebrow}</p>}\n              <h2 className=\"hb-vl4-title\">{title}</h2>\n              {subtitle && <p className=\"hb-vl4-sub\">{subtitle}</p>}\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}