{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-letters",
  "type": "registry:component",
  "title": "Hero Scroll Letters",
  "description": "A giant word cut out of a black plate shows a night sky through its letters, then the camera flies through the O until the whole sky fills the screen. The real headline and booking pill fade in on the other side.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "zoom",
    "mask",
    "typography",
    "travel"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-letters",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-letters.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-letters.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollLettersLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollLettersProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  brand?: string;\n  intro?: string;\n  title?: string;\n  subtitle?: string;\n  detail?: string;\n  cta?: HeroScrollLettersLink | 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 letters =\n  \"M-1500 -1500H2530V1800H-1500Z\" +\n  \"M40 260V40H96L184 170V40H240V260H184L96 130V260Z\" +\n  \"M390 40A110 110 0 1 1 389.9 40ZM390 96A54 54 0 1 0 390.1 96Z\" +\n  \"M520 40H580L630 190L680 40H740L660 260H600Z\" +\n  \"M770 260L850 40H910L990 260H930L915 215H845L830 260ZM862 165H898L880 108Z\";\n\nconst css = `\n.hb-va4 {\n  --hb-va4-accent: #5eead4;\n  --hb-va4-z: 1;\n  --hb-va4-c: 1;\n  --hb-va4-i: 1;\n  --hb-va4-o: 0;\n  --hb-va4-k: 0;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va4-h);\n  color: #ededed;\n  font-family: inherit;\n  background: #040507;\n}\n.hb-va4[data-pinned=\"true\"] { height: calc(var(--hb-va4-h) * var(--hb-va4-len)); }\n.hb-va4 *, .hb-va4 *::before, .hb-va4 *::after { box-sizing: border-box; }\n.hb-va4-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-va4-h);\n  overflow: hidden;\n  container-type: size;\n  isolation: isolate;\n}\n.hb-va4-sky {\n  position: absolute;\n  inset: -10%;\n  transform: scale(calc(1.45 - var(--hb-va4-k) * 0.45));\n  transform-origin: 39% 50%;\n  background:\n    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),\n    radial-gradient(1px 1px at 68% 12%, #fff 50%, transparent 51%),\n    radial-gradient(1.5px 1.5px at 82% 34%, #dff 50%, transparent 51%),\n    radial-gradient(1px 1px at 24% 66%, #fff 50%, transparent 51%),\n    radial-gradient(1.5px 1.5px at 44% 28%, #fff 50%, transparent 51%),\n    radial-gradient(1px 1px at 91% 72%, #fff 50%, transparent 51%),\n    radial-gradient(38% 30% at 62% 38%, rgba(139, 92, 246, 0.42), transparent 70%),\n    radial-gradient(34% 28% at 34% 54%, color-mix(in srgb, var(--hb-va4-accent) 34%, transparent), transparent 70%),\n    linear-gradient(118deg, transparent 30%, rgba(214, 220, 255, 0.16) 46%, rgba(255, 210, 240, 0.12) 52%, transparent 66%),\n    linear-gradient(180deg, #050816, #0a0d24 55%, #120a1f);\n}\n.hb-va4-stars {\n  position: absolute;\n  inset: 0;\n  background:\n    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0.7px, transparent 1.2px) 0 0 / 53px 47px,\n    radial-gradient(circle, rgba(200, 230, 255, 0.7) 0.6px, transparent 1.1px) 21px 13px / 89px 71px,\n    radial-gradient(circle, rgba(255, 255, 255, 0.5) 0.5px, transparent 1px) 7px 31px / 31px 37px;\n  animation: hb-va4-tw 5s ease-in-out infinite alternate;\n}\n@keyframes hb-va4-tw { from { opacity: 0.55; } to { opacity: 1; } }\n.hb-va4-ridge { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 22%; color: #040507; }\n.hb-va4-cover {\n  position: absolute;\n  inset: 0;\n  z-index: 2;\n  display: grid;\n  place-items: center;\n  opacity: var(--hb-va4-c);\n  pointer-events: none;\n}\n.hb-va4-word {\n  width: 82cqw;\n  aspect-ratio: 1030 / 300;\n  overflow: visible;\n  transform: scale(var(--hb-va4-z));\n  transform-origin: 29.9% 50%;\n  will-change: transform;\n}\n.hb-va4-word path { fill: #040507; fill-rule: evenodd; }\n.hb-va4-intro {\n  position: absolute;\n  inset: 0;\n  z-index: 3;\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  padding: 4cqh 4cqw 6cqh;\n  opacity: var(--hb-va4-i);\n  pointer-events: none;\n}\n.hb-va4-bar { display: flex; align-items: center; justify-content: space-between; }\n.hb-va4-brand {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.6em;\n  font-size: clamp(12px, 1.35cqw, 15px);\n  font-weight: 600;\n  letter-spacing: -0.01em;\n}\n.hb-va4-brand::before {\n  content: \"\";\n  width: 0.9em;\n  height: 0.9em;\n  border-radius: 50%;\n  border: 2px solid var(--hb-va4-accent);\n  box-shadow: 0 0 12px color-mix(in srgb, var(--hb-va4-accent) 70%, transparent);\n}\n.hb-va4-mono {\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.1cqw, 12px);\n  letter-spacing: 0.16em;\n  text-transform: uppercase;\n  color: rgba(237, 237, 237, 0.5);\n}\n.hb-va4-lead {\n  display: flex;\n  align-items: flex-end;\n  justify-content: space-between;\n  gap: 2rem;\n}\n.hb-va4-lead p {\n  max-width: 30ch;\n  margin: 0;\n  font-size: clamp(12px, 1.6cqw, 18px);\n  line-height: 1.45;\n  color: #a1a1a1;\n}\n.hb-va4-final {\n  position: absolute;\n  inset: 0;\n  z-index: 4;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  padding: 0 6cqw;\n  text-align: center;\n  opacity: var(--hb-va4-o);\n  transform: scale(calc(0.94 + var(--hb-va4-o) * 0.06));\n  pointer-events: none;\n}\n.hb-va4[data-final=\"true\"] .hb-va4-final { pointer-events: auto; }\n.hb-va4-title {\n  max-width: 14ch;\n  margin: 0;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(2rem, 7cqw, 6.2rem);\n  font-weight: 500;\n  line-height: 0.95;\n  letter-spacing: -0.05em;\n  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);\n}\n.hb-va4-sub {\n  max-width: 44ch;\n  margin: 1em 0 0;\n  font-size: clamp(12px, 1.55cqw, 17px);\n  line-height: 1.55;\n  color: rgba(237, 237, 237, 0.72);\n}\n.hb-va4-ticket {\n  display: flex;\n  align-items: center;\n  gap: 1.2em;\n  margin-top: 2em;\n  padding: 0.45em 0.45em 0.45em 1.2em;\n  border-radius: 999px;\n  border: 1px solid rgba(255, 255, 255, 0.14);\n  background: rgba(6, 8, 18, 0.55);\n  -webkit-backdrop-filter: blur(12px);\n  backdrop-filter: blur(12px);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.15cqw, 13px);\n  color: rgba(237, 237, 237, 0.75);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);\n}\n.hb-va4-ticket b { color: var(--hb-va4-accent); font-weight: 500; }\n.hb-va4-cta {\n  padding: 0.75em 1.3em;\n  border-radius: 999px;\n  background: var(--hb-va4-accent);\n  color: #02130f;\n  font-family: var(--font-sans, system-ui);\n  font-size: 1.08em;\n  font-weight: 600;\n  text-decoration: none;\n  transition: filter 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-va4-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }\n.hb-va4-cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-va4-stars { animation: none; }\n  .hb-va4-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\nexport function HeroScrollLetters({\n  brand = \"Nova Expeditions\",\n  intro = \"Small-group night-sky expeditions to the darkest places left on Earth.\",\n  title = \"The sky, the way it used to look\",\n  subtitle = \"Eight nights under Bortle 1 skies with an astronomer, a 16-inch telescope and nothing else on the horizon.\",\n  detail = \"Atacama · 14 Mar 2027 · 6 seats left\",\n  cta = { label: \"Reserve a seat\", href: \"#\" },\n  accent = \"#5eead4\",\n  progress,\n  autoPlay = false,\n  duration = 5,\n  length = 3,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollLettersProps) {\n  const ref = React.useRef<HTMLElement>(null);\n  const Heading = headingAs;\n  const pinned = progress === undefined && !autoPlay;\n  const [place, rest2] = detail.includes(\"·\") ? [detail.slice(0, detail.indexOf(\"·\")).trim(), detail.slice(detail.indexOf(\"·\") + 1).trim()] : [detail, \"\"];\n\n  useScrollProgress(\n    ref,\n    (p) => {\n      const el = ref.current;\n      if (!el) return;\n      const k = clamp01(p / 0.72);\n      const z = Math.pow(90, Math.pow(k, 1.7));\n      el.style.setProperty(\"--hb-va4-z\", z.toFixed(3));\n      el.style.setProperty(\"--hb-va4-k\", ease(k).toFixed(4));\n      el.style.setProperty(\"--hb-va4-c\", (1 - clamp01((p - 0.6) / 0.12)).toFixed(3));\n      el.style.setProperty(\"--hb-va4-i\", (1 - clamp01(p / 0.14)).toFixed(3));\n      const o = ease(clamp01((p - 0.7) / 0.22));\n      el.style.setProperty(\"--hb-va4-o\", o.toFixed(3));\n      el.dataset.final = o > 0.5 ? \"true\" : \"false\";\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va4\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={{ \"--hb-va4-accent\": accent, \"--hb-va4-h\": height, \"--hb-va4-len\": length, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-letters\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va4-stage\">\n        <div className=\"hb-va4-sky\" aria-hidden=\"true\">\n          <div className=\"hb-va4-stars\" />\n          <svg className=\"hb-va4-ridge\" viewBox=\"0 0 1200 160\" preserveAspectRatio=\"none\" fill=\"currentColor\">\n            <path d=\"M0 160V96l90-34 70 22 110-58 90 40 80-18 120 52 96-46 104 38 90-26 110 44 120-50 120 40V160Z\" />\n          </svg>\n        </div>\n        <div className=\"hb-va4-cover\" aria-hidden=\"true\">\n          <svg className=\"hb-va4-word\" viewBox=\"0 0 1030 300\">\n            <path d={letters} />\n          </svg>\n        </div>\n        <div className=\"hb-va4-intro\">\n          <div className=\"hb-va4-bar\">\n            <span className=\"hb-va4-brand\">{brand}</span>\n            <span className=\"hb-va4-mono\">Season 2027</span>\n          </div>\n          <div className=\"hb-va4-lead\">\n            <p>{intro}</p>\n            <span className=\"hb-va4-mono\" aria-hidden=\"true\">Scroll to enter</span>\n          </div>\n        </div>\n        <div className=\"hb-va4-final\">\n          <Heading className=\"hb-va4-title\">{title}</Heading>\n          {subtitle ? <p className=\"hb-va4-sub\">{subtitle}</p> : null}\n          {cta || detail ? (\n            <div className=\"hb-va4-ticket\">\n              {detail ? (\n                <span>\n                  <b>{place}</b>\n                  {rest2 ? ` · ${rest2}` : \"\"}\n                </span>\n              ) : null}\n              {cta ? (\n                <a className=\"hb-va4-cta\" href={cta.href}>\n                  {cta.label}\n                </a>\n              ) : null}\n            </div>\n          ) : null}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}