{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-expand",
  "type": "registry:component",
  "title": "Hero Scroll Expand",
  "description": "A framed film still grows from a small card to the full viewport while the headline splits apart and blurs out. A timecode, caption and play button settle onto the expanded frame.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "media expansion",
    "pinned",
    "film",
    "showreel"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-expand",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-expand.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-expand.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollExpandLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollExpandProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  titleStart?: string;\n  titleEnd?: string;\n  subtitle?: string;\n  caption?: string;\n  cta?: HeroScrollExpandLink | null;\n  accent?: string;\n  progress?: number;\n  autoPlay?: boolean;\n  duration?: number;\n  length?: number;\n  height?: string;\n  headingAs?: \"h1\" | \"h2\";\n}\n\nconst css = `\n.hb-va1 {\n  --hb-va1-accent: #ff9a3c;\n  --hb-va1-e: 0;\n  --hb-va1-o: 0;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va1-h);\n  color: #ededed;\n  font-family: inherit;\n  background: #0a0a0a;\n}\n.hb-va1[data-pinned=\"true\"] { height: calc(var(--hb-va1-h) * var(--hb-va1-len)); }\n.hb-va1 *, .hb-va1 *::before, .hb-va1 *::after { box-sizing: border-box; }\n.hb-va1-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-va1-h);\n  overflow: hidden;\n  container-type: size;\n  isolation: isolate;\n}\n.hb-va1-top {\n  position: absolute;\n  inset: 0 0 auto;\n  z-index: 4;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  padding: 3.4cqh 4cqw;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.15cqw, 13px);\n  letter-spacing: 0.14em;\n  text-transform: uppercase;\n  color: rgba(237, 237, 237, 0.62);\n}\n.hb-va1-rec { display: inline-flex; align-items: center; gap: 0.7em; }\n.hb-va1-rec::before {\n  content: \"\";\n  width: 0.62em;\n  height: 0.62em;\n  border-radius: 50%;\n  background: var(--hb-va1-accent);\n  box-shadow: 0 0 0 0.3em color-mix(in srgb, var(--hb-va1-accent) 22%, transparent);\n}\n.hb-va1-media {\n  position: absolute;\n  inset: 0;\n  z-index: 1;\n  clip-path: inset(calc((1 - var(--hb-va1-e)) * 27%) calc((1 - var(--hb-va1-e)) * 32%) round calc((1 - var(--hb-va1-e)) * 26px));\n  will-change: clip-path;\n}\n.hb-va1-scene {\n  position: absolute;\n  inset: 0;\n  transform: scale(calc(1.32 - var(--hb-va1-e) * 0.32));\n  transform-origin: 50% 58%;\n  background:\n    radial-gradient(18% 24% at 50% 62%, rgba(255, 214, 160, 0.95), rgba(255, 150, 70, 0.55) 40%, transparent 72%),\n    radial-gradient(60% 50% at 50% 66%, color-mix(in srgb, var(--hb-va1-accent) 55%, transparent), transparent 70%),\n    linear-gradient(180deg, #070b1d 0%, #1b1d3c 28%, #6a3a4d 50%, #e0844a 62%, #2a1b26 63%, #120d17 100%);\n}\n.hb-va1-sun {\n  position: absolute;\n  left: 50%;\n  top: 62.6%;\n  width: 11cqw;\n  aspect-ratio: 1;\n  border-radius: 50%;\n  transform: translate(-50%, -50%);\n  background: radial-gradient(circle at 50% 40%, #fff3df, #ffc27a 55%, #ff8e3c);\n  box-shadow: 0 0 6cqw 2cqw rgba(255, 160, 80, 0.5);\n  clip-path: inset(0 0 50% 0);\n}\n.hb-va1-sea {\n  position: absolute;\n  inset: 62.6% 0 0;\n  background:\n    repeating-linear-gradient(180deg, rgba(255, 196, 130, 0.28) 0 1px, transparent 1px 7px),\n    linear-gradient(180deg, rgba(255, 150, 80, 0.35), transparent 70%);\n  -webkit-mask-image: radial-gradient(40% 90% at 50% 0%, #000, transparent);\n  mask-image: radial-gradient(40% 90% at 50% 0%, #000, transparent);\n}\n.hb-va1-boat { position: absolute; left: 61%; top: 55.5%; width: 4.4cqw; color: #0b0812; }\n.hb-va1-grain {\n  position: absolute;\n  inset: 0;\n  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55));\n}\n.hb-va1-head {\n  position: absolute;\n  inset: 0;\n  z-index: 3;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  gap: 2.4cqw;\n  margin: 0;\n  pointer-events: none;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(2.6rem, 10.2cqw, 9rem);\n  font-weight: 600;\n  line-height: 0.9;\n  letter-spacing: -0.055em;\n  white-space: nowrap;\n}\n.hb-va1-w {\n  display: block;\n  opacity: calc(1 - var(--hb-va1-e) * 1.6);\n  filter: blur(calc(var(--hb-va1-e) * 10px));\n}\n.hb-va1-w:first-child { transform: translateX(calc(var(--hb-va1-e) * -38cqw)); }\n.hb-va1-w:last-child {\n  transform: translateX(calc(var(--hb-va1-e) * 38cqw));\n  color: transparent;\n  -webkit-text-stroke: 1.5px rgba(237, 237, 237, 0.92);\n}\n.hb-va1-sub {\n  position: absolute;\n  left: 50%;\n  bottom: 9cqh;\n  z-index: 3;\n  width: min(30rem, 80cqw);\n  margin: 0;\n  transform: translate(-50%, calc(var(--hb-va1-e) * 30px));\n  opacity: calc(1 - var(--hb-va1-e) * 2.2);\n  text-align: center;\n  font-size: clamp(12px, 1.5cqw, 16px);\n  line-height: 1.55;\n  color: #a1a1a1;\n}\n.hb-va1-hint {\n  display: block;\n  margin-top: 1.1em;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 0.72em;\n  letter-spacing: 0.2em;\n  text-transform: uppercase;\n  color: rgba(237, 237, 237, 0.45);\n}\n.hb-va1-hint::after {\n  content: \"\";\n  display: block;\n  width: 1px;\n  height: 2.4em;\n  margin: 0.8em auto 0;\n  background: linear-gradient(var(--hb-va1-accent), transparent);\n}\n.hb-va1-over {\n  position: absolute;\n  inset: auto 0 0;\n  z-index: 3;\n  display: flex;\n  align-items: flex-end;\n  justify-content: space-between;\n  gap: 2rem;\n  padding: 0 4cqw 6cqh;\n  opacity: var(--hb-va1-o);\n  transform: translateY(calc((1 - var(--hb-va1-o)) * 24px));\n  pointer-events: none;\n}\n.hb-va1[data-over=\"true\"] .hb-va1-over { pointer-events: auto; }\n.hb-va1-cap {\n  max-width: 26ch;\n  margin: 0;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(1.1rem, 3.3cqw, 2.6rem);\n  font-weight: 500;\n  line-height: 1.04;\n  letter-spacing: -0.03em;\n  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.45);\n}\n.hb-va1-tc {\n  display: block;\n  margin-bottom: 0.9rem;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.1cqw, 12px);\n  letter-spacing: 0.16em;\n  color: rgba(255, 230, 200, 0.75);\n}\n.hb-va1-cta {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.75em;\n  flex-shrink: 0;\n  padding: 0.5em 1.25em 0.5em 0.5em;\n  border-radius: 999px;\n  background: rgba(10, 10, 10, 0.5);\n  border: 1px solid rgba(255, 255, 255, 0.18);\n  -webkit-backdrop-filter: blur(14px);\n  backdrop-filter: blur(14px);\n  color: #fff;\n  font-size: clamp(12px, 1.4cqw, 15px);\n  font-weight: 500;\n  text-decoration: none;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 14px 40px -12px rgba(0, 0, 0, 0.7);\n  transition: background 0.3s cubic-bezier(0.22, 1, 0.36, 1), transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-va1-cta:hover { background: rgba(10, 10, 10, 0.72); transform: translateY(-1px); }\n.hb-va1-cta:focus-visible { outline: 2px solid var(--hb-va1-accent); outline-offset: 3px; }\n.hb-va1-play {\n  display: grid;\n  place-items: center;\n  width: 2.3em;\n  height: 2.3em;\n  border-radius: 50%;\n  background: var(--hb-va1-accent);\n  color: #1a0d02;\n}\n.hb-va1-bar {\n  position: absolute;\n  left: 4cqw;\n  right: 4cqw;\n  bottom: 3cqh;\n  z-index: 3;\n  height: 2px;\n  border-radius: 2px;\n  background: rgba(255, 255, 255, 0.14);\n  opacity: var(--hb-va1-o);\n  overflow: hidden;\n}\n.hb-va1-bar::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  transform-origin: 0 50%;\n  transform: scaleX(var(--hb-va1-o));\n  background: var(--hb-va1-accent);\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-va1-cta { transition: none; }\n}\n`;\n\nfunction findScroller(el: HTMLElement): HTMLElement | null {\n  let node = el.parentElement;\n  while (node && node !== document.body && node !== document.documentElement) {\n    const oy = getComputedStyle(node).overflowY;\n    if ((oy === \"auto\" || oy === \"scroll\" || oy === \"overlay\") && node.scrollHeight > node.clientHeight + 1) return node;\n    node = node.parentElement;\n  }\n  return null;\n}\n\nfunction ease(x: number) {\n  return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;\n}\n\nfunction clamp01(x: number) {\n  return Math.min(1, Math.max(0, x));\n}\n\nfunction loopAt(ms: number, duration: number) {\n  const d = Math.max(1, duration) * 1000;\n  const back = d * 0.7;\n  const hold = 1400;\n  const t = ms % (d + hold + back + 700);\n  if (t < d) return ease(t / d);\n  if (t < d + hold) return 1;\n  if (t < d + hold + back) return 1 - ease((t - d - hold) / back);\n  return 0;\n}\n\nfunction useScrollProgress(\n  ref: React.RefObject<HTMLElement | null>,\n  apply: (p: number) => void,\n  progress: number | undefined,\n  autoPlay: boolean,\n  duration: number,\n) {\n  const applyRef = React.useRef(apply);\n  React.useLayoutEffect(() => {\n    applyRef.current = apply;\n  });\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const run = (p: number) => applyRef.current(clamp01(p));\n    if (typeof progress === \"number\") {\n      run(progress);\n      return;\n    }\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      run(1);\n      return;\n    }\n    let raf = 0;\n    if (autoPlay) {\n      let visible = true;\n      let last = 0;\n      let t = 0;\n      const io = new IntersectionObserver((entries) => {\n        visible = entries[0]?.isIntersecting ?? true;\n      });\n      io.observe(el);\n      const loop = (now: number) => {\n        const dt = last ? Math.min(64, now - last) : 0;\n        last = now;\n        if (visible) {\n          t += dt;\n          run(loopAt(t, duration));\n        }\n        raf = requestAnimationFrame(loop);\n      };\n      raf = requestAnimationFrame(loop);\n      return () => {\n        cancelAnimationFrame(raf);\n        io.disconnect();\n      };\n    }\n    const sc = findScroller(el);\n    const measure = () => {\n      raf = 0;\n      const r = el.getBoundingClientRect();\n      const top = sc ? r.top - sc.getBoundingClientRect().top : r.top;\n      const vh = sc ? sc.clientHeight : window.innerHeight;\n      const span = r.height - vh;\n      run(span > 1 ? -top / span : (vh - top) / (vh + r.height));\n    };\n    const onScroll = () => {\n      if (!raf) raf = requestAnimationFrame(measure);\n    };\n    measure();\n    const target: HTMLElement | Window = sc ?? window;\n    target.addEventListener(\"scroll\", onScroll, { passive: true });\n    window.addEventListener(\"resize\", onScroll);\n    return () => {\n      cancelAnimationFrame(raf);\n      target.removeEventListener(\"scroll\", onScroll);\n      window.removeEventListener(\"resize\", onScroll);\n    };\n  }, [ref, progress, autoPlay, duration]);\n}\n\nfunction stamp(seconds: number) {\n  const s = Math.floor(seconds);\n  const f = Math.floor((seconds - s) * 24);\n  return `00:${String(Math.floor(s / 60)).padStart(2, \"0\")}:${String(s % 60).padStart(2, \"0\")}:${String(f).padStart(2, \"0\")}`;\n}\n\nexport function HeroScrollExpand({\n  eyebrow = \"Lumen Pictures · Showreel 2027\",\n  titleStart = \"Stories\",\n  titleEnd = \"in motion\",\n  subtitle = \"An independent studio for brand films, documentaries and the occasional music video.\",\n  caption = \"Forty-two films, nine countries, one reel cut from all of it.\",\n  cta = { label: \"Watch the full reel\", href: \"#\" },\n  accent = \"#ff9a3c\",\n  progress,\n  autoPlay = false,\n  duration = 5,\n  length = 3,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollExpandProps) {\n  const ref = React.useRef<HTMLElement>(null);\n  const tcRef = React.useRef<HTMLSpanElement>(null);\n  const Heading = headingAs;\n  const pinned = progress === undefined && !autoPlay;\n\n  useScrollProgress(\n    ref,\n    (p) => {\n      const el = ref.current;\n      if (!el) return;\n      const e = ease(clamp01(p / 0.74));\n      const o = clamp01((p - 0.7) / 0.24);\n      el.style.setProperty(\"--hb-va1-e\", e.toFixed(4));\n      el.style.setProperty(\"--hb-va1-o\", o.toFixed(4));\n      el.dataset.over = o > 0.5 ? \"true\" : \"false\";\n      if (tcRef.current) tcRef.current.textContent = `REEL 07  ${stamp(p * 134)}`;\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va1\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={{ \"--hb-va1-accent\": accent, \"--hb-va1-h\": height, \"--hb-va1-len\": length, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-expand\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va1-stage\">\n        <div className=\"hb-va1-top\">\n          <span className=\"hb-va1-rec\">{eyebrow}</span>\n          <span>Scroll</span>\n        </div>\n        <div className=\"hb-va1-media\" aria-hidden=\"true\">\n          <div className=\"hb-va1-scene\">\n            <div className=\"hb-va1-sun\" />\n            <div className=\"hb-va1-sea\" />\n            <svg className=\"hb-va1-boat\" viewBox=\"0 0 40 40\" fill=\"currentColor\">\n              <path d=\"M19 4 L19 30 L6 30 Z\" />\n              <path d=\"M21 9 L21 30 L33 30 Z\" opacity=\"0.85\" />\n              <path d=\"M4 32 H36 L32 37 H8 Z\" />\n            </svg>\n          </div>\n          <div className=\"hb-va1-grain\" />\n        </div>\n        <Heading className=\"hb-va1-head\">\n          <span className=\"hb-va1-w\">{titleStart}</span>\n          <span className=\"hb-va1-w\">{titleEnd}</span>\n        </Heading>\n        {subtitle ? (\n          <p className=\"hb-va1-sub\">\n            {subtitle}\n            <span className=\"hb-va1-hint\" aria-hidden=\"true\">Scroll to play</span>\n          </p>\n        ) : null}\n        <div className=\"hb-va1-over\">\n          <p className=\"hb-va1-cap\">\n            <span className=\"hb-va1-tc\" ref={tcRef} aria-hidden=\"true\">REEL 07  00:00:00:00</span>\n            {caption}\n          </p>\n          {cta ? (\n            <a className=\"hb-va1-cta\" href={cta.href}>\n              <span className=\"hb-va1-play\" aria-hidden=\"true\">\n                <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"currentColor\">\n                  <path d=\"M3 1.6v8.8c0 .5.5.8.9.5l6.6-4.4c.4-.3.4-.8 0-1L3.9 1.1c-.4-.3-.9 0-.9.5Z\" />\n                </svg>\n              </span>\n              {cta.label}\n            </a>\n          ) : null}\n        </div>\n        <div className=\"hb-va1-bar\" aria-hidden=\"true\" />\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}