{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-horizontal",
  "type": "registry:component",
  "title": "Hero Scroll Horizontal",
  "description": "A pinned hero that turns vertical scroll into a sideways story, from an intro panel through illustrated chapters with parallax numerals. A chapter rail at the bottom fills as you travel.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "horizontal",
    "story",
    "parallax",
    "pinned"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-horizontal",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-horizontal.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-horizontal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollHorizontalLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollHorizontalChapter {\n  title: string;\n  text: string;\n  stat: string;\n  statLabel: string;\n}\n\nexport interface HeroScrollHorizontalProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  cta?: HeroScrollHorizontalLink | null;\n  chapters?: HeroScrollHorizontalChapter[];\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 defaultChapters: HeroScrollHorizontalChapter[] = [\n  { title: \"Harvest\", text: \"Only the ripest cherries, picked by hand over six passes of the same trees.\", stat: \"1,740 m\", statLabel: \"altitude\" },\n  { title: \"Wash\", text: \"Pulped the same afternoon, then fermented for 36 hours in spring water.\", stat: \"36 h\", statLabel: \"ferment\" },\n  { title: \"Dry\", text: \"Turned every hour on raised beds until the beans settle at eleven percent.\", stat: \"18 days\", statLabel: \"on the beds\" },\n  { title: \"Roast\", text: \"Small batches in Lisbon, light enough to keep the panela and plum.\", stat: \"212 °C\", statLabel: \"first crack\" },\n  { title: \"Brew\", text: \"Fifteen grams, two hundred and fifty of water, and four quiet minutes.\", stat: \"1:16\", statLabel: \"ratio\" },\n];\n\nconst art = [\n  <g key=\"a\">\n    <path d=\"M60 18c-6 14-6 26 0 38\" stroke=\"#7aa35a\" strokeWidth=\"3\" fill=\"none\" strokeLinecap=\"round\" />\n    <path d=\"M60 30c10-8 22-8 30-2-8 8-20 9-30 2z\" fill=\"#4f7a3a\" />\n    <circle cx=\"44\" cy=\"70\" r=\"15\" fill=\"#c2342c\" />\n    <circle cx=\"70\" cy=\"76\" r=\"17\" fill=\"#a3221d\" />\n    <circle cx=\"56\" cy=\"94\" r=\"14\" fill=\"#d9463a\" />\n    <circle cx=\"40\" cy=\"65\" r=\"4\" fill=\"#fff\" opacity=\"0.35\" />\n    <circle cx=\"65\" cy=\"70\" r=\"4.5\" fill=\"#fff\" opacity=\"0.3\" />\n  </g>,\n  <g key=\"b\" fill=\"none\" strokeLinecap=\"round\">\n    <path d=\"M14 46c12-8 24 8 36 0s24 8 36 0 18 4 20 2\" stroke=\"#6fb7d6\" strokeWidth=\"3\" />\n    <path d=\"M14 64c12-8 24 8 36 0s24 8 36 0 18 4 20 2\" stroke=\"#4d93b3\" strokeWidth=\"3\" />\n    <path d=\"M14 82c12-8 24 8 36 0s24 8 36 0 18 4 20 2\" stroke=\"#356f8a\" strokeWidth=\"3\" />\n    <ellipse cx=\"46\" cy=\"56\" rx=\"6\" ry=\"8\" fill=\"#e9d5a8\" />\n    <ellipse cx=\"76\" cy=\"73\" rx=\"6\" ry=\"8\" fill=\"#d8bf8a\" />\n  </g>,\n  <g key=\"c\">\n    <rect x=\"12\" y=\"62\" width=\"96\" height=\"10\" rx=\"3\" fill=\"#6b4a2f\" />\n    <path d=\"M18 72v26M102 72v26\" stroke=\"#4a3220\" strokeWidth=\"4\" />\n    {Array.from({ length: 14 }, (_, i) => (\n      <ellipse key={i} cx={20 + i * 6.2} cy={58 - (i % 3)} rx=\"3.2\" ry=\"4.2\" fill={i % 2 ? \"#c9a46a\" : \"#b38b52\"} />\n    ))}\n    <circle cx=\"88\" cy=\"26\" r=\"11\" fill=\"#f5c46b\" />\n  </g>,\n  <g key=\"d\">\n    <circle cx=\"60\" cy=\"62\" r=\"34\" fill=\"#2b1b12\" stroke=\"#8a5a3a\" strokeWidth=\"4\" />\n    <circle cx=\"60\" cy=\"62\" r=\"22\" fill=\"none\" stroke=\"#5a3a24\" strokeWidth=\"2\" strokeDasharray=\"4 5\" />\n    {Array.from({ length: 9 }, (_, i) => (\n      <ellipse\n        key={i}\n        cx={(60 + Math.cos(i * 0.7) * (8 + i * 1.6)).toFixed(2)}\n        cy={(62 + Math.sin(i * 0.7) * (8 + i * 1.6)).toFixed(2)}\n        rx=\"3\"\n        ry=\"4\"\n        fill=\"#6e3f1f\"\n      />\n    ))}\n    <path d=\"M60 22c-4-6 4-10 0-16M72 24c-4-6 4-10 0-16\" stroke=\"#a1a1a1\" strokeWidth=\"2\" fill=\"none\" opacity=\"0.5\" />\n  </g>,\n  <g key=\"e\">\n    <path d=\"M26 48h60v20a30 30 0 0 1-60 0z\" fill=\"#efe6d8\" />\n    <path d=\"M86 54h6a10 10 0 0 1 0 20h-8\" stroke=\"#efe6d8\" strokeWidth=\"5\" fill=\"none\" />\n    <ellipse cx=\"56\" cy=\"50\" rx=\"28\" ry=\"5\" fill=\"#5a3418\" />\n    <path d=\"M18 104h76\" stroke=\"#3a2a1d\" strokeWidth=\"4\" strokeLinecap=\"round\" />\n    <path d=\"M46 36c-4-6 4-10 0-16M60 36c-4-6 4-10 0-16\" stroke=\"#a1a1a1\" strokeWidth=\"2\" fill=\"none\" opacity=\"0.5\" />\n  </g>,\n];\n\nconst tones = [\"#1d1210\", \"#0f1619\", \"#1a150d\", \"#170f0b\", \"#14110f\"];\n\nconst css = `\n.hb-va3 {\n  --hb-va3-accent: #e8875a;\n  --hb-va3-p: 0;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va3-h);\n  color: #efe6d8;\n  font-family: inherit;\n  background: #0d0a08;\n}\n.hb-va3[data-pinned=\"true\"] { height: calc(var(--hb-va3-h) * var(--hb-va3-len)); }\n.hb-va3 *, .hb-va3 *::before, .hb-va3 *::after { box-sizing: border-box; }\n.hb-va3-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-va3-h);\n  overflow: hidden;\n  container-type: size;\n  background: #0d0a08;\n}\n.hb-va3-track {\n  display: flex;\n  width: max-content;\n  height: 100%;\n  transform: translateX(calc((100cqw - 100%) * var(--hb-va3-p)));\n  will-change: transform;\n}\n.hb-va3-intro {\n  position: relative;\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n  width: 74cqw;\n  height: 100%;\n  padding: 0 6cqw 0 6cqw;\n  background:\n    radial-gradient(70% 70% at 90% 50%, color-mix(in srgb, var(--hb-va3-accent) 18%, transparent), transparent 70%),\n    #0d0a08;\n}\n.hb-va3-eyebrow {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.7em;\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: var(--hb-va3-accent);\n}\n.hb-va3-eyebrow::before { content: \"\"; width: 2.4em; height: 1px; background: currentColor; }\n.hb-va3-title {\n  max-width: 13ch;\n  margin: 0.45em 0 0;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(2.2rem, 6.6cqw, 6rem);\n  font-weight: 600;\n  line-height: 0.95;\n  letter-spacing: -0.045em;\n}\n.hb-va3-sub {\n  max-width: 40ch;\n  margin: 1.2em 0 0;\n  font-size: clamp(12px, 1.5cqw, 17px);\n  line-height: 1.55;\n  color: rgba(239, 230, 216, 0.62);\n}\n.hb-va3-row { display: flex; align-items: center; gap: 1.6em; margin-top: 2em; }\n.hb-va3-cta {\n  display: inline-flex;\n  align-items: center;\n  padding: 0.75em 1.4em;\n  border-radius: 999px;\n  background: var(--hb-va3-accent);\n  color: #1d0f07;\n  font-size: clamp(12px, 1.4cqw, 15px);\n  font-weight: 600;\n  text-decoration: none;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 12px 30px -12px var(--hb-va3-accent);\n  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s ease;\n}\n.hb-va3-cta:hover { transform: translateY(-1px); filter: brightness(1.06); }\n.hb-va3-cta:focus-visible { outline: 2px solid #efe6d8; outline-offset: 3px; }\n.hb-va3-hint {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.6em;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.1cqw, 12px);\n  letter-spacing: 0.14em;\n  text-transform: uppercase;\n  color: rgba(239, 230, 216, 0.5);\n}\n.hb-va3-hint svg { animation: hb-va3-nudge 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite; }\n@keyframes hb-va3-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }\n.hb-va3-panel {\n  position: relative;\n  display: grid;\n  grid-template-rows: auto 1fr auto;\n  width: 46cqw;\n  height: 100%;\n  padding: 9cqh 4cqw 15cqh;\n  border-left: 1px solid rgba(239, 230, 216, 0.08);\n  background: var(--hb-va3-tone);\n  overflow: hidden;\n}\n.hb-va3-num {\n  position: absolute;\n  right: -2cqw;\n  top: 4cqh;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: 30cqh;\n  font-weight: 700;\n  line-height: 1;\n  letter-spacing: -0.06em;\n  color: transparent;\n  -webkit-text-stroke: 1px rgba(239, 230, 216, 0.14);\n  transform: translateX(calc((var(--hb-va3-p) * var(--hb-va3-n) - var(--hb-va3-i)) * -7cqw));\n  pointer-events: none;\n}\n.hb-va3-kicker {\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.05cqw, 12px);\n  letter-spacing: 0.16em;\n  text-transform: uppercase;\n  color: var(--hb-va3-accent);\n}\n.hb-va3-art {\n  align-self: center;\n  justify-self: center;\n  width: min(30cqh, 22cqw);\n  aspect-ratio: 1;\n  transform: translateX(calc((var(--hb-va3-p) * var(--hb-va3-n) - var(--hb-va3-i)) * -3cqw));\n}\n.hb-va3-art svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45)); }\n.hb-va3-h3 {\n  margin: 0;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(1.3rem, 3.6cqw, 3rem);\n  font-weight: 600;\n  letter-spacing: -0.035em;\n}\n.hb-va3-text {\n  max-width: 34ch;\n  margin: 0.5em 0 0;\n  font-size: clamp(11px, 1.3cqw, 15px);\n  line-height: 1.5;\n  color: rgba(239, 230, 216, 0.6);\n}\n.hb-va3-stat {\n  display: inline-flex;\n  align-items: baseline;\n  gap: 0.5em;\n  margin-top: 1em;\n  padding-top: 0.8em;\n  border-top: 1px solid rgba(239, 230, 216, 0.12);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.15cqw, 13px);\n  color: rgba(239, 230, 216, 0.5);\n}\n.hb-va3-stat b { font-weight: 500; font-size: 1.35em; color: #efe6d8; }\n.hb-va3-rail {\n  position: absolute;\n  inset: auto 6cqw 5cqh;\n  display: grid;\n  grid-template-columns: repeat(var(--hb-va3-n), 1fr);\n  gap: 0.6rem;\n  pointer-events: none;\n}\n.hb-va3-tick {\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(9px, 1cqw, 11px);\n  letter-spacing: 0.12em;\n  text-transform: uppercase;\n  color: rgba(239, 230, 216, 0.45);\n}\n.hb-va3-tick::before {\n  content: \"\";\n  display: block;\n  height: 2px;\n  margin-bottom: 0.7em;\n  border-radius: 2px;\n  background:\n    linear-gradient(var(--hb-va3-accent), var(--hb-va3-accent)) 0 0 / calc(clamp(0, var(--hb-va3-p) * var(--hb-va3-n) - var(--hb-va3-i), 1) * 100%) 100% no-repeat,\n    rgba(239, 230, 216, 0.14);\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-va3-hint svg { animation: none; }\n  .hb-va3-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 HeroScrollHorizontal({\n  eyebrow = \"Finca La Esperanza · Huila\",\n  title = \"From a hillside in Huila to your morning cup\",\n  subtitle = \"Single-origin coffee we buy direct, roast in small batches and ship within 48 hours of the roast.\",\n  cta = { label: \"Shop the harvest\", href: \"#\" },\n  chapters = defaultChapters,\n  accent = \"#e8875a\",\n  progress,\n  autoPlay = false,\n  duration = 8,\n  length = 5,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollHorizontalProps) {\n  const ref = React.useRef<HTMLElement>(null);\n  const Heading = headingAs;\n  const pinned = progress === undefined && !autoPlay;\n\n  useScrollProgress(\n    ref,\n    (p) => {\n      ref.current?.style.setProperty(\"--hb-va3-p\", p.toFixed(4));\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va3\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={\n        {\n          \"--hb-va3-accent\": accent,\n          \"--hb-va3-h\": height,\n          \"--hb-va3-len\": length,\n          \"--hb-va3-n\": chapters.length,\n          ...style,\n        } as React.CSSProperties\n      }\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-horizontal\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va3-stage\">\n        <div className=\"hb-va3-track\">\n          <div className=\"hb-va3-intro\">\n            <span className=\"hb-va3-eyebrow\">{eyebrow}</span>\n            <Heading className=\"hb-va3-title\">{title}</Heading>\n            {subtitle ? <p className=\"hb-va3-sub\">{subtitle}</p> : null}\n            <div className=\"hb-va3-row\">\n              {cta ? (\n                <a className=\"hb-va3-cta\" href={cta.href}>\n                  {cta.label}\n                </a>\n              ) : null}\n              <span className=\"hb-va3-hint\" aria-hidden=\"true\">\n                The journey\n                <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                  <path d=\"M2 8h12M10 4l4 4-4 4\" />\n                </svg>\n              </span>\n            </div>\n          </div>\n          {chapters.map((c, i) => (\n            <article\n              key={c.title}\n              className=\"hb-va3-panel\"\n              style={{ \"--hb-va3-tone\": tones[i % tones.length], \"--hb-va3-i\": i + 0.5 } as React.CSSProperties}\n            >\n              <span className=\"hb-va3-num\" aria-hidden=\"true\">{String(i + 1).padStart(2, \"0\")}</span>\n              <span className=\"hb-va3-kicker\">Chapter {String(i + 1).padStart(2, \"0\")}</span>\n              <div className=\"hb-va3-art\" aria-hidden=\"true\">\n                <svg viewBox=\"0 0 120 120\">{art[i % art.length]}</svg>\n              </div>\n              <div>\n                <h3 className=\"hb-va3-h3\">{c.title}</h3>\n                <p className=\"hb-va3-text\">{c.text}</p>\n                <span className=\"hb-va3-stat\">\n                  <b>{c.stat}</b>\n                  {c.statLabel}\n                </span>\n              </div>\n            </article>\n          ))}\n        </div>\n        <div className=\"hb-va3-rail\" aria-hidden=\"true\">\n          {chapters.map((c, i) => (\n            <span key={c.title} className=\"hb-va3-tick\" style={{ \"--hb-va3-i\": i } as React.CSSProperties}>\n              {c.title}\n            </span>\n          ))}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}