{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "parallax-floating-gallery",
  "type": "registry:component",
  "title": "Parallax Floating Gallery",
  "description": "A tilted wall of photographs in columns that drift in opposite directions at different speeds as you scroll, around a pinned title and call to action. Tiles lift and show their caption on hover.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "parallax",
    "gallery",
    "scroll",
    "columns",
    "photography",
    "drift"
  ],
  "docs": "https://hyperblur.dev/effects/parallax-floating-gallery",
  "files": [
    {
      "path": "registry/hyperblur/parallax-floating-gallery.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/parallax-floating-gallery.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface FloatingTile {\n  title: string;\n  colors?: [string, string, string];\n  shape?: \"sun\" | \"dune\" | \"tide\" | \"orb\";\n  tall?: boolean;\n}\n\nexport interface ParallaxFloatingGalleryProps extends React.HTMLAttributes<HTMLDivElement> {\n  tiles?: FloatingTile[];\n  eyebrow?: string;\n  title?: string;\n  cta?: string;\n  onCtaClick?: () => void;\n  onTileClick?: (tile: FloatingTile, index: number) => void;\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 defaultTiles: FloatingTile[] = [\n  { title: \"Low tide, Cornwall\", colors: [\"#1e3a5f\", \"#f0a37a\", \"#ffe2b8\"], shape: \"tide\", tall: true },\n  { title: \"Dune 45, 6:12 am\", colors: [\"#3b1a2e\", \"#ff9466\", \"#ffd9a0\"], shape: \"dune\" },\n  { title: \"Harbour light\", colors: [\"#0f2633\", \"#4fa3b8\", \"#e8fbff\"], shape: \"orb\" },\n  { title: \"Salt pans\", colors: [\"#2b2350\", \"#e7a0c4\", \"#fff1f7\"], shape: \"sun\", tall: true },\n  { title: \"Fog bank\", colors: [\"#1c2a2a\", \"#8fb5a8\", \"#f2fff9\"], shape: \"tide\" },\n  { title: \"Last ferry\", colors: [\"#2a160c\", \"#e0773b\", \"#ffe6c2\"], shape: \"sun\" },\n  { title: \"Kelp forest\", colors: [\"#0c2a22\", \"#3fae86\", \"#d6ffef\"], shape: \"orb\", tall: true },\n  { title: \"Blue hour pier\", colors: [\"#141a3d\", \"#5b6fd6\", \"#dfe4ff\"], shape: \"dune\" },\n];\n\nconst speeds = [-1, 0.55, -0.35, 0.85, -0.6];\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-vl6 {\n  --hb-vl6-p: 0;\n  position: relative;\n  width: 100%;\n  color: #ededed;\n  font-family: inherit;\n  box-sizing: border-box;\n}\n.hb-vl6 *, .hb-vl6 *::before, .hb-vl6 *::after { box-sizing: border-box; }\n.hb-vl6[data-mode=\"inner\"] .hb-vl6-vp {\n  height: var(--hb-vl6-h);\n  overflow-y: auto;\n  overscroll-behavior: contain;\n  scrollbar-width: none;\n  border-radius: 20px;\n}\n.hb-vl6[data-mode=\"inner\"] .hb-vl6-vp::-webkit-scrollbar { display: none; }\n.hb-vl6-vp:focus-visible { outline: 2px solid var(--hb-vl6-a); outline-offset: 2px; }\n.hb-vl6-track { height: calc(var(--hb-vl6-h) * var(--hb-vl6-len)); }\n.hb-vl6-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-vl6-h);\n  overflow: hidden;\n  border-radius: 20px;\n  background: #09090b;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);\n  container-type: size;\n}\n.hb-vl6-cols {\n  position: absolute;\n  inset: 0 -4%;\n  display: grid;\n  grid-template-columns: repeat(4, minmax(0, 1fr));\n  gap: clamp(6px, 2.4cqw, 14px);\n  transform: rotate(-6deg) scale(1.12);\n}\n.hb-vl6-col {\n  display: flex;\n  flex-direction: column;\n  gap: clamp(6px, 2.4cqw, 14px);\n  margin-top: calc(var(--hb-vl6-r) * -1);\n  transform: translate3d(0, calc((var(--hb-vl6-p) - 0.5) * var(--hb-vl6-s) * var(--hb-vl6-r)), 0);\n  will-change: transform;\n}\n.hb-vl6-col:nth-child(5) { display: none; }\n@container (min-width: 620px) {\n  .hb-vl6-cols { grid-template-columns: repeat(5, minmax(0, 1fr)); }\n  .hb-vl6-col:nth-child(5) { display: flex; }\n}\n.hb-vl6-t {\n  position: relative;\n  flex: none;\n  width: 100%;\n  aspect-ratio: 4 / 5;\n  margin: 0;\n  padding: 0;\n  overflow: hidden;\n  border: 0;\n  border-radius: clamp(8px, 2.6cqw, 14px);\n  background:\n    linear-gradient(180deg, var(--hb-vl6-c0) 0%, var(--hb-vl6-c1) 100%);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 30px -18px rgba(0, 0, 0, 0.9);\n  color: inherit;\n  font: inherit;\n  cursor: pointer;\n  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;\n}\n.hb-vl6-t[data-tall=\"true\"] { aspect-ratio: 3 / 5; }\n.hb-vl6-t:hover, .hb-vl6-t:focus-visible { transform: translateY(-4px) scale(1.03); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 24px 40px -18px rgba(0, 0, 0, 1); }\n.hb-vl6-t:focus-visible { outline: 2px solid var(--hb-vl6-a); outline-offset: 2px; }\n.hb-vl6-t::before, .hb-vl6-t::after { content: \"\"; position: absolute; pointer-events: none; }\n.hb-vl6-t[data-shape=\"sun\"]::before {\n  left: 50%;\n  top: 40%;\n  width: 46%;\n  aspect-ratio: 1;\n  border-radius: 50%;\n  background: var(--hb-vl6-c2);\n  box-shadow: 0 0 40px 10px color-mix(in srgb, var(--hb-vl6-c2) 45%, transparent);\n  transform: translate(-50%, -50%);\n}\n.hb-vl6-t[data-shape=\"sun\"]::after {\n  inset: 58% 0 0 0;\n  background: repeating-linear-gradient(180deg, color-mix(in srgb, var(--hb-vl6-c0) 85%, #000000) 0 6px, color-mix(in srgb, var(--hb-vl6-c1) 70%, #000000) 6px 8px);\n}\n.hb-vl6-t[data-shape=\"dune\"]::before {\n  inset: 50% -30% -40% -10%;\n  border-radius: 50% 50% 0 0;\n  background: linear-gradient(160deg, var(--hb-vl6-c1), color-mix(in srgb, var(--hb-vl6-c0) 70%, #000000));\n  transform: rotate(-8deg);\n}\n.hb-vl6-t[data-shape=\"dune\"]::after {\n  inset: 66% -20% -40% -40%;\n  border-radius: 50% 50% 0 0;\n  background: color-mix(in srgb, var(--hb-vl6-c0) 75%, #000000);\n  transform: rotate(10deg);\n}\n.hb-vl6-t[data-shape=\"tide\"]::before {\n  inset: 0;\n  background:\n    radial-gradient(120% 40% at 50% 62%, color-mix(in srgb, var(--hb-vl6-c2) 70%, transparent), transparent 60%),\n    repeating-linear-gradient(176deg, transparent 0 9px, color-mix(in srgb, var(--hb-vl6-c2) 30%, transparent) 9px 10px);\n  mask-image: linear-gradient(180deg, transparent 50%, #000000 62%);\n  -webkit-mask-image: linear-gradient(180deg, transparent 50%, #000000 62%);\n}\n.hb-vl6-t[data-shape=\"orb\"]::before {\n  left: 18%;\n  top: 22%;\n  width: 64%;\n  aspect-ratio: 1;\n  border-radius: 50%;\n  background: radial-gradient(circle at 35% 30%, var(--hb-vl6-c2), var(--hb-vl6-c1) 45%, color-mix(in srgb, var(--hb-vl6-c0) 70%, #000000) 80%);\n  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.6);\n}\n.hb-vl6-t[data-shape=\"orb\"]::after {\n  left: 10%;\n  right: 10%;\n  bottom: 12%;\n  height: 6%;\n  border-radius: 50%;\n  background: rgba(0, 0, 0, 0.45);\n  filter: blur(4px);\n}\n.hb-vl6-cap {\n  position: absolute;\n  left: 8px;\n  right: 8px;\n  bottom: 8px;\n  z-index: 1;\n  overflow: hidden;\n  font-size: clamp(9px, 2.2cqw, 11px);\n  text-align: left;\n  white-space: nowrap;\n  text-overflow: ellipsis;\n  color: rgba(255, 255, 255, 0.92);\n  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);\n  opacity: 0;\n  transform: translateY(4px);\n  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-vl6-t:hover .hb-vl6-cap, .hb-vl6-t:focus-visible .hb-vl6-cap { opacity: 1; transform: none; }\n.hb-vl6-veil {\n  position: absolute;\n  inset: 0;\n  background: radial-gradient(48% 46% at 50% 50%, rgba(9, 9, 11, 0.92), rgba(9, 9, 11, 0.55) 60%, rgba(9, 9, 11, 0) 100%);\n  pointer-events: none;\n}\n.hb-vl6-copy {\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: clamp(4px, 2cqh, 10px);\n  width: min(80%, 440px);\n  text-align: center;\n  transform: translate(-50%, -50%);\n}\n.hb-vl6-eye {\n  margin: 0;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(9px, 2.6cqh, 11px);\n  letter-spacing: 0.14em;\n  text-transform: uppercase;\n  color: #a1a1a1;\n}\n.hb-vl6-title {\n  margin: 0;\n  font-family: var(--font-grotesk, inherit);\n  font-size: clamp(17px, 8cqh, 44px);\n  font-weight: 600;\n  line-height: 1.05;\n  letter-spacing: -0.03em;\n  text-wrap: balance;\n}\n.hb-vl6-cta {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  margin-top: 2px;\n  padding: clamp(5px, 1.8cqh, 9px) clamp(10px, 3.4cqh, 16px);\n  border: 0;\n  border-radius: 999px;\n  background: #ededed;\n  color: #0a0a0a;\n  font: inherit;\n  font-size: clamp(10px, 3cqh, 13px);\n  font-weight: 600;\n  cursor: pointer;\n  box-shadow: 0 8px 24px -8px rgba(255, 255, 255, 0.35);\n  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;\n}\n.hb-vl6-cta:hover { transform: translateY(-1px); background: #ffffff; }\n.hb-vl6-cta:active { transform: scale(0.97); }\n.hb-vl6-cta:focus-visible { outline: 2px solid var(--hb-vl6-a); outline-offset: 3px; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vl6 *, .hb-vl6 *::before, .hb-vl6 *::after { transition: none !important; }\n  .hb-vl6-col { will-change: auto; }\n}\n`;\n\nexport function ParallaxFloatingGallery({\n  tiles = defaultTiles,\n  eyebrow = \"Field notes / 48 photographs\",\n  title = \"The coast at the edges of the day\",\n  cta = \"Open the gallery\",\n  onCtaClick,\n  onTileClick,\n  mode = \"inner\",\n  height = 460,\n  length = 2.6,\n  range = 220,\n  progress,\n  autoPlay = false,\n  duration = 14000,\n  accent = \"#2f7bff\",\n  className,\n  style,\n  ...rest\n}: ParallaxFloatingGalleryProps) {\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const vpRef = React.useRef<HTMLDivElement>(null);\n  useParallaxProgress(rootRef, vpRef, \"--hb-vl6-p\", { mode, progress, autoPlay, duration });\n  const trackLength = mode === \"page\" && autoPlay ? 1 : length;\n  const columns = 5;\n  const perColumn = 4;\n  const count = Math.max(tiles.length, 1);\n\n  return (\n    <div\n      ref={rootRef}\n      className={[\"hb-vl6\", className].filter(Boolean).join(\" \")}\n      data-mode={mode}\n      style={\n        {\n          \"--hb-vl6-a\": accent,\n          \"--hb-vl6-h\": `${height}px`,\n          \"--hb-vl6-len\": trackLength,\n          \"--hb-vl6-r\": `${range}px`,\n          ...style,\n        } as React.CSSProperties\n      }\n      {...rest}\n    >\n      <style href=\"hb-parallax-floating-gallery\" precedence=\"default\">{css}</style>\n      <div\n        ref={vpRef}\n        className=\"hb-vl6-vp\"\n        tabIndex={mode === \"inner\" ? 0 : undefined}\n        role={mode === \"inner\" ? \"region\" : undefined}\n        aria-label={mode === \"inner\" ? title : undefined}\n      >\n        <div className=\"hb-vl6-track\">\n          <div className=\"hb-vl6-stage\">\n            <div className=\"hb-vl6-cols\">\n              {Array.from({ length: columns }, (_, c) => (\n                <div key={c} className=\"hb-vl6-col\" style={{ \"--hb-vl6-s\": speeds[c % speeds.length] } as React.CSSProperties}>\n                  {Array.from({ length: perColumn }, (_, r) => {\n                    const index = (c * 3 + r * 5) % count;\n                    const tile = tiles[index];\n                    const [c0, c1, c2] = tile.colors ?? [\"#1e3a5f\", \"#f0a37a\", \"#ffe2b8\"];\n                    return (\n                      <button\n                        key={r}\n                        type=\"button\"\n                        className=\"hb-vl6-t\"\n                        data-shape={tile.shape ?? \"sun\"}\n                        data-tall={tile.tall ? \"true\" : \"false\"}\n                        aria-label={tile.title}\n                        tabIndex={r === 1 ? 0 : -1}\n                        style={{ \"--hb-vl6-c0\": c0, \"--hb-vl6-c1\": c1, \"--hb-vl6-c2\": c2 } as React.CSSProperties}\n                        onClick={() => onTileClick?.(tile, index)}\n                      >\n                        <span className=\"hb-vl6-cap\">{tile.title}</span>\n                      </button>\n                    );\n                  })}\n                </div>\n              ))}\n            </div>\n            <div className=\"hb-vl6-veil\" />\n            <div className=\"hb-vl6-copy\">\n              {eyebrow && <p className=\"hb-vl6-eye\">{eyebrow}</p>}\n              <h2 className=\"hb-vl6-title\">{title}</h2>\n              {cta && (\n                <button type=\"button\" className=\"hb-vl6-cta\" onClick={onCtaClick}>\n                  {cta}\n                  <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\">\n                    <path d=\"M2.5 6h7M6.5 3l3 3-3 3\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                  </svg>\n                </button>\n              )}\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}