{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-split",
  "type": "registry:component",
  "title": "Hero Scroll Split",
  "description": "A two-line headline on warm paper pulls apart while a slit between the lines opens into a wide view through whitewashed arches. Location, price and a booking button settle at the bottom.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "split text",
    "image reveal",
    "hotel",
    "light"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-split",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-split.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-split.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollSplitLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollSplitProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  brand?: string;\n  place?: string;\n  lineTop?: string;\n  lineBottom?: string;\n  location?: string;\n  price?: string;\n  cta?: HeroScrollSplitLink | 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-va11 {\n  --hb-va11-accent: #c4623a;\n  --hb-va11-e: 0;\n  --hb-va11-o: 0;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va11-h);\n  color: #1b1814;\n  font-family: inherit;\n  background: #efe9df;\n}\n.hb-va11[data-pinned=\"true\"] { height: calc(var(--hb-va11-h) * var(--hb-va11-len)); }\n.hb-va11 *, .hb-va11 *::before, .hb-va11 *::after { box-sizing: border-box; }\n.hb-va11-stage {\n  position: sticky;\n  top: 0;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  height: var(--hb-va11-h);\n  overflow: hidden;\n  container-type: size;\n  background:\n    radial-gradient(60% 50% at 50% 50%, #f6f1e8, transparent 70%),\n    #efe9df;\n}\n.hb-va11-bar {\n  position: absolute;\n  inset: 0 0 auto;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  padding: 3.6cqh 4cqw;\n  font-size: clamp(11px, 1.3cqw, 14px);\n}\n.hb-va11-brand { font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.92em; }\n.hb-va11-nav { display: flex; gap: 1.8em; color: #6d655a; }\n.hb-va11-head {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  margin: 0;\n  font-size: clamp(2.2rem, 9.6cqw, 9rem);\n  font-weight: 700;\n  line-height: 0.86;\n  letter-spacing: -0.06em;\n  text-align: center;\n}\n.hb-va11-line { display: block; white-space: nowrap; will-change: transform; }\n.hb-va11-line:first-child { transform: translateX(calc(var(--hb-va11-e) * -9cqw)); }\n.hb-va11-line:last-child { transform: translateX(calc(var(--hb-va11-e) * 9cqw)); color: var(--hb-va11-accent); }\n.hb-va11-band {\n  position: relative;\n  display: block;\n  width: calc(26cqw + var(--hb-va11-e) * 64cqw);\n  height: calc(0.6cqh + var(--hb-va11-e) * 44cqh);\n  margin: calc(1cqh + var(--hb-va11-e) * 2cqh) 0;\n  border-radius: calc(999px - var(--hb-va11-e) * 980px);\n  overflow: hidden;\n  background: #1b1814;\n  box-shadow: 0 30px 60px -30px rgba(60, 40, 20, 0.45);\n}\n.hb-va11-view {\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  width: 90cqw;\n  height: 46cqh;\n  transform: translate(-50%, -50%) scale(calc(1.35 - var(--hb-va11-e) * 0.35));\n  background:\n    radial-gradient(14% 22% at 68% 30%, rgba(255, 244, 214, 0.95), transparent 70%),\n    linear-gradient(180deg, #9cc3d6 0%, #cfe0e4 46%, #6b9fb4 47%, #3f7690 70%, #2f5c72 100%);\n}\n.hb-va11-view svg { position: absolute; inset: 0; width: 100%; height: 100%; }\n.hb-va11-meta {\n  position: absolute;\n  inset: auto 4cqw 5cqh;\n  display: flex;\n  align-items: flex-end;\n  justify-content: space-between;\n  gap: 1.5rem;\n  opacity: var(--hb-va11-o);\n  transform: translateY(calc((1 - var(--hb-va11-o)) * 16px));\n}\n.hb-va11-meta p { margin: 0; font-size: clamp(11px, 1.35cqw, 15px); line-height: 1.5; color: #6d655a; }\n.hb-va11-meta b { display: block; font-size: 1.15em; font-weight: 600; color: #1b1814; }\n.hb-va11-right { display: flex; align-items: center; gap: 1.4em; }\n.hb-va11-right p { text-align: right; }\n.hb-va11-cta {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.6em;\n  padding: 0.8em 1.35em;\n  border-radius: 999px;\n  background: #1b1814;\n  color: #f6f1e8;\n  font-size: clamp(12px, 1.35cqw, 15px);\n  font-weight: 600;\n  text-decoration: none;\n  box-shadow: 0 12px 30px -14px rgba(27, 24, 20, 0.7);\n  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;\n}\n.hb-va11-cta:hover { transform: translateY(-1px); background: var(--hb-va11-accent); }\n.hb-va11-cta:focus-visible { outline: 2px solid var(--hb-va11-accent); outline-offset: 3px; }\n.hb-va11-hint {\n  position: absolute;\n  left: 50%;\n  bottom: 5cqh;\n  transform: translateX(-50%);\n  font-size: clamp(10px, 1.1cqw, 12px);\n  letter-spacing: 0.2em;\n  text-transform: uppercase;\n  color: #8a8174;\n  opacity: calc(1 - var(--hb-va11-e) * 3);\n}\n@media (max-width: 640px) {\n  .hb-va11-nav { display: none; }\n  .hb-va11-meta { flex-direction: column; align-items: flex-start; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-va11-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\nconst arches =\n  \"M0 0H1000V560H0Z\" +\n  \"M90 560V250A110 110 0 0 1 310 250V560Z\" +\n  \"M390 560V210A110 110 0 0 1 610 210V560Z\" +\n  \"M690 560V250A110 110 0 0 1 910 250V560Z\";\n\nexport function HeroScrollSplit({\n  brand = \"Casa Larga\",\n  place = \"Alentejo, Portugal\",\n  lineTop = \"A long house\",\n  lineBottom = \"by the sea\",\n  location = \"Fourteen rooms on the Alentejo coast, two hours south of Lisbon.\",\n  price = \"€280\",\n  cta = { label: \"Check availability\", href: \"#\" },\n  accent = \"#c4623a\",\n  progress,\n  autoPlay = false,\n  duration = 5,\n  length = 3,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollSplitProps) {\n  const ref = React.useRef<HTMLElement>(null);\n  const uid = React.useId().replace(/[^a-zA-Z0-9]/g, \"\");\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      el.style.setProperty(\"--hb-va11-e\", ease(clamp01(p / 0.75)).toFixed(4));\n      el.style.setProperty(\"--hb-va11-o\", ease(clamp01((p - 0.62) / 0.3)).toFixed(4));\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va11\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={{ \"--hb-va11-accent\": accent, \"--hb-va11-h\": height, \"--hb-va11-len\": length, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-split\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va11-stage\">\n        <div className=\"hb-va11-bar\">\n          <span className=\"hb-va11-brand\">{brand}</span>\n          <span className=\"hb-va11-nav\" aria-hidden=\"true\">\n            <span>Rooms</span>\n            <span>Table</span>\n            <span>Journal</span>\n          </span>\n        </div>\n        <Heading className=\"hb-va11-head\">\n          <span className=\"hb-va11-line\">{lineTop}</span>\n          <span className=\"hb-va11-band\" aria-hidden=\"true\">\n            <span className=\"hb-va11-view\">\n              <svg viewBox=\"0 0 1000 560\" preserveAspectRatio=\"xMidYMid slice\">\n                <defs>\n                  <linearGradient id={`${uid}w`} x1=\"0\" x2=\"1\">\n                    <stop offset=\"0\" stopColor=\"#efe6d6\" />\n                    <stop offset=\"0.5\" stopColor=\"#f7f1e6\" />\n                    <stop offset=\"1\" stopColor=\"#e3d7c3\" />\n                  </linearGradient>\n                </defs>\n                <path d=\"M0 470H1000V560H0Z\" fill=\"#d9c7aa\" />\n                <path d=\"M0 470H1000\" stroke=\"#c9b493\" strokeWidth=\"3\" />\n                <path d={arches} fill={`url(#${uid}w)`} fillRule=\"evenodd\" />\n                <path d=\"M90 560V250A110 110 0 0 1 120 175\" stroke=\"#cbbba1\" strokeWidth=\"14\" fill=\"none\" opacity=\"0.6\" />\n                <path d=\"M390 560V210A110 110 0 0 1 420 135\" stroke=\"#cbbba1\" strokeWidth=\"14\" fill=\"none\" opacity=\"0.6\" />\n                <path d=\"M690 560V250A110 110 0 0 1 720 175\" stroke=\"#cbbba1\" strokeWidth=\"14\" fill=\"none\" opacity=\"0.6\" />\n                <ellipse cx=\"200\" cy=\"520\" rx=\"70\" ry=\"10\" fill=\"#b49a76\" opacity=\"0.5\" />\n                <path d=\"M172 520c-4-40 8-62 28-74 20 12 32 34 28 74z\" fill=\"#5f6b45\" />\n                <ellipse cx=\"800\" cy=\"520\" rx=\"70\" ry=\"10\" fill=\"#b49a76\" opacity=\"0.5\" />\n                <path d=\"M776 520c-2-30 6-48 24-58 18 10 26 28 24 58z\" fill=\"#6f7a52\" />\n              </svg>\n            </span>\n          </span>\n          <span className=\"hb-va11-line\">{lineBottom}</span>\n        </Heading>\n        <div className=\"hb-va11-meta\">\n          <p>\n            {place ? <b>{place}</b> : null}\n            {location}\n          </p>\n          <div className=\"hb-va11-right\">\n            {price ? (\n              <p>\n                <b>From {price}</b>\n                per night, breakfast included\n              </p>\n            ) : null}\n            {cta ? (\n              <a className=\"hb-va11-cta\" href={cta.href}>\n                {cta.label}\n              </a>\n            ) : null}\n          </div>\n        </div>\n        <span className=\"hb-va11-hint\" aria-hidden=\"true\">Scroll to open</span>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}