{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-stack",
  "type": "registry:component",
  "title": "Hero Scroll Stack",
  "description": "A split hero where product panels slide up one over another and the ones underneath tilt back, shrink and dim into a deck. The step list on the left follows the panel on top.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "sticky stack",
    "fintech",
    "product",
    "steps"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-stack",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-stack.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-stack.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollStackLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollStackStep {\n  title: string;\n  text: string;\n}\n\nexport interface HeroScrollStackProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  steps?: [HeroScrollStackStep, HeroScrollStackStep, HeroScrollStackStep, HeroScrollStackStep];\n  cta?: HeroScrollStackLink | 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 defaultSteps: [HeroScrollStackStep, HeroScrollStackStep, HeroScrollStackStep, HeroScrollStackStep] = [\n  { title: \"Issue cards\", text: \"Virtual cards with limits per team, merchant and month.\" },\n  { title: \"Approve spend\", text: \"Routing by amount and department, right from Slack or email.\" },\n  { title: \"Reconcile\", text: \"Receipts matched to bank lines the moment they land.\" },\n  { title: \"Close the month\", text: \"A clean ledger and an audit trail, ready for your accountant.\" },\n];\n\nconst css = `\n.hb-va6 {\n  --hb-va6-accent: #2f7bff;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va6-h);\n  color: #ededed;\n  font-family: inherit;\n  background: #0a0a0a;\n}\n.hb-va6[data-pinned=\"true\"] { height: calc(var(--hb-va6-h) * var(--hb-va6-len)); }\n.hb-va6 *, .hb-va6 *::before, .hb-va6 *::after { box-sizing: border-box; }\n.hb-va6-stage {\n  position: sticky;\n  top: 0;\n  display: grid;\n  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);\n  align-items: center;\n  gap: 4cqw;\n  height: var(--hb-va6-h);\n  padding: 0 5cqw;\n  overflow: hidden;\n  container-type: size;\n  background:\n    radial-gradient(45% 60% at 78% 50%, color-mix(in srgb, var(--hb-va6-accent) 14%, transparent), transparent 70%),\n    linear-gradient(180deg, #0a0a0a, #0c0d10);\n}\n.hb-va6-eyebrow {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.5em;\n  font-size: clamp(11px, 1.2cqw, 13px);\n  font-weight: 500;\n  color: color-mix(in srgb, var(--hb-va6-accent) 60%, #fff);\n}\n.hb-va6-eyebrow::before {\n  content: \"\";\n  width: 0.5em;\n  height: 0.5em;\n  border-radius: 2px;\n  background: var(--hb-va6-accent);\n  transform: rotate(45deg);\n}\n.hb-va6-title {\n  margin: 0.5em 0 0;\n  font-size: clamp(1.8rem, 5cqw, 4.4rem);\n  font-weight: 600;\n  line-height: 1;\n  letter-spacing: -0.045em;\n}\n.hb-va6-sub {\n  max-width: 38ch;\n  margin: 0.9em 0 0;\n  font-size: clamp(12px, 1.4cqw, 16px);\n  line-height: 1.55;\n  color: #a1a1a1;\n}\n.hb-va6-steps { margin: 1.6em 0 0; padding: 0; list-style: none; display: grid; gap: 0.15em; }\n.hb-va6-step {\n  position: relative;\n  display: grid;\n  grid-template-columns: 1.9em 1fr;\n  gap: 0.3em 0.6em;\n  padding: 0.55em 0.7em;\n  border-radius: 0.7em;\n  font-size: clamp(11px, 1.25cqw, 14px);\n  color: #6f6f6f;\n  transition: color 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.45s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-va6-step b { font-weight: 600; }\n.hb-va6-step span:last-child {\n  grid-column: 2;\n  display: none;\n  font-size: 0.9em;\n  line-height: 1.45;\n  color: #a1a1a1;\n}\n.hb-va6-step[data-on=\"true\"] { color: #ededed; background: rgba(255, 255, 255, 0.04); }\n.hb-va6-step[data-on=\"true\"] span:last-child { display: block; }\n.hb-va6-num {\n  display: grid;\n  place-items: center;\n  width: 1.7em;\n  height: 1.7em;\n  border-radius: 50%;\n  border: 1px solid #2a2a2a;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 0.82em;\n  transition: background 0.45s ease, border-color 0.45s ease, color 0.45s ease;\n}\n.hb-va6-step[data-on=\"true\"] .hb-va6-num { background: var(--hb-va6-accent); border-color: var(--hb-va6-accent); color: #fff; }\n.hb-va6-cta {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.5em;\n  margin-top: 1.4em;\n  padding: 0.7em 1.25em;\n  border-radius: 999px;\n  background: #ededed;\n  color: #0a0a0a;\n  font-size: clamp(12px, 1.35cqw, 15px);\n  font-weight: 600;\n  text-decoration: none;\n  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;\n}\n.hb-va6-cta:hover { background: #fff; transform: translateY(-1px); }\n.hb-va6-cta:focus-visible { outline: 2px solid var(--hb-va6-accent); outline-offset: 3px; }\n.hb-va6-deck {\n  position: relative;\n  height: 62cqh;\n  perspective: 1400px;\n  perspective-origin: 50% -20%;\n}\n.hb-va6-panel {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  flex-direction: column;\n  padding: 2.2cqw;\n  border-radius: 1.6cqw;\n  border: 1px solid rgba(255, 255, 255, 0.09);\n  background: linear-gradient(180deg, #17181b, #111214);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 -1.4cqw 3cqw -1cqw rgba(0, 0, 0, 0.75);\n  transform-origin: 50% 0%;\n  font-size: clamp(9px, 1.15cqw, 13px);\n  will-change: transform, filter;\n}\n.hb-va6-ph {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  margin-bottom: 1.2em;\n  font-weight: 600;\n}\n.hb-va6-ph small {\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 0.82em;\n  font-weight: 400;\n  color: #8f8f8f;\n}\n.hb-va6-card {\n  position: relative;\n  width: 58%;\n  aspect-ratio: 1.6;\n  padding: 1em;\n  border-radius: 0.9em;\n  background:\n    radial-gradient(80% 90% at 85% 10%, rgba(255, 255, 255, 0.35), transparent 50%),\n    linear-gradient(135deg, var(--hb-va6-accent), color-mix(in srgb, var(--hb-va6-accent) 40%, #0a0a0a));\n  box-shadow: 0 1em 2em -0.8em color-mix(in srgb, var(--hb-va6-accent) 70%, transparent);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  color: #fff;\n}\n.hb-va6-card span { position: absolute; left: 1em; bottom: 0.9em; letter-spacing: 0.12em; font-size: 0.9em; }\n.hb-va6-card i { position: absolute; right: 1em; top: 0.9em; font-style: normal; font-weight: 700; }\n.hb-va6-limit { margin-top: auto; }\n.hb-va6-limit div {\n  display: flex;\n  justify-content: space-between;\n  margin-bottom: 0.5em;\n  color: #a1a1a1;\n}\n.hb-va6-limit div b { color: #ededed; font-weight: 600; }\n.hb-va6-track { height: 0.5em; border-radius: 1em; background: #222; overflow: hidden; }\n.hb-va6-track span { display: block; width: 64%; height: 100%; border-radius: inherit; background: var(--hb-va6-accent); }\n.hb-va6-row {\n  display: grid;\n  grid-template-columns: 2.2em 1fr auto auto;\n  align-items: center;\n  gap: 0.8em;\n  padding: 0.7em 0;\n  border-top: 1px solid #222;\n}\n.hb-va6-av {\n  display: grid;\n  place-items: center;\n  width: 2.2em;\n  height: 2.2em;\n  border-radius: 50%;\n  font-size: 0.8em;\n  font-weight: 700;\n  color: #0a0a0a;\n}\n.hb-va6-row small { display: block; color: #8f8f8f; }\n.hb-va6-amt { font-family: var(--font-mono, ui-monospace, monospace); }\n.hb-va6-chip {\n  padding: 0.3em 0.75em;\n  border-radius: 999px;\n  font-size: 0.85em;\n  font-weight: 600;\n  background: color-mix(in srgb, var(--hb-va6-accent) 18%, transparent);\n  color: color-mix(in srgb, var(--hb-va6-accent) 60%, #fff);\n}\n.hb-va6-chip[data-k=\"ok\"] { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }\n.hb-va6-ring {\n  display: flex;\n  align-items: center;\n  gap: 1.2em;\n  margin-bottom: 1em;\n}\n.hb-va6-ring svg { width: 4.4em; height: 4.4em; }\n.hb-va6-ring b { display: block; font-size: 1.6em; letter-spacing: -0.02em; }\n.hb-va6-ring small { color: #8f8f8f; }\n.hb-va6-match {\n  display: flex;\n  justify-content: space-between;\n  padding: 0.5em 0;\n  border-top: 1px solid #222;\n  color: #a1a1a1;\n}\n.hb-va6-match b { color: #6ee7b7; font-weight: 500; }\n.hb-va6-bars {\n  display: flex;\n  align-items: flex-end;\n  gap: 0.6em;\n  height: 44%;\n  margin-top: auto;\n  padding-top: 1em;\n}\n.hb-va6-bars span {\n  flex: 1;\n  border-radius: 0.35em 0.35em 0.1em 0.1em;\n  background: linear-gradient(180deg, color-mix(in srgb, var(--hb-va6-accent) 85%, #fff), color-mix(in srgb, var(--hb-va6-accent) 30%, #111));\n}\n.hb-va6-bars span:nth-child(odd) { opacity: 0.55; }\n.hb-va6-big { font-size: 2.6em; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }\n.hb-va6-big small { margin-left: 0.3em; font-size: 0.35em; font-weight: 500; letter-spacing: 0; color: #6ee7b7; }\n@media (max-width: 640px) {\n  .hb-va6-stage { grid-template-columns: 1fr; align-content: center; gap: 4cqh; }\n  .hb-va6-steps { display: none; }\n  .hb-va6-deck { height: 40cqh; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-va6-step, .hb-va6-num, .hb-va6-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 approvals = [\n  { who: \"Maya Chen\", what: \"Figma · annual\", amt: \"$1,440\", c: \"#7fb3ff\", k: \"ok\" },\n  { who: \"Jonah Reyes\", what: \"Offsite · Lisbon\", amt: \"$8,920\", c: \"#f9a8d4\", k: \"wait\" },\n  { who: \"Priya Nair\", what: \"AWS · October\", amt: \"$3,215\", c: \"#fcd34d\", k: \"ok\" },\n];\n\nfunction Panels() {\n  return [\n    <React.Fragment key=\"cards\">\n      <div className=\"hb-va6-ph\">\n        Marketing team card <small>Virtual · USD</small>\n      </div>\n      <div className=\"hb-va6-card\">\n        <i>LEDGERLY</i>\n        <span>•••• 4021 · 09/29</span>\n      </div>\n      <div className=\"hb-va6-limit\">\n        <div>\n          <span>Monthly limit</span>\n          <span>\n            <b>$6,400</b> of $10,000\n          </span>\n        </div>\n        <div className=\"hb-va6-track\">\n          <span />\n        </div>\n      </div>\n    </React.Fragment>,\n    <React.Fragment key=\"approve\">\n      <div className=\"hb-va6-ph\">\n        Waiting for approval <small>3 requests</small>\n      </div>\n      {approvals.map((a) => (\n        <div key={a.who} className=\"hb-va6-row\">\n          <span className=\"hb-va6-av\" style={{ background: a.c }}>\n            {a.who\n              .split(\" \")\n              .map((w) => w[0])\n              .join(\"\")}\n          </span>\n          <span>\n            {a.who}\n            <small>{a.what}</small>\n          </span>\n          <span className=\"hb-va6-amt\">{a.amt}</span>\n          <span className=\"hb-va6-chip\" data-k={a.k}>\n            {a.k === \"ok\" ? \"Approved\" : \"Review\"}\n          </span>\n        </div>\n      ))}\n    </React.Fragment>,\n    <React.Fragment key=\"rec\">\n      <div className=\"hb-va6-ph\">\n        Bank reconciliation <small>October</small>\n      </div>\n      <div className=\"hb-va6-ring\">\n        <svg viewBox=\"0 0 44 44\">\n          <circle cx=\"22\" cy=\"22\" r=\"18\" fill=\"none\" stroke=\"#222\" strokeWidth=\"5\" />\n          <circle cx=\"22\" cy=\"22\" r=\"18\" fill=\"none\" stroke=\"#34d399\" strokeWidth=\"5\" strokeLinecap=\"round\" strokeDasharray=\"112.4 113.1\" transform=\"rotate(-90 22 22)\" />\n        </svg>\n        <span>\n          <b>1,284 / 1,290</b>\n          <small>lines matched automatically</small>\n        </span>\n      </div>\n      <div className=\"hb-va6-match\">\n        <span>Stripe payout · Oct 28</span>\n        <b>Matched</b>\n      </div>\n      <div className=\"hb-va6-match\">\n        <span>Gusto payroll · Oct 31</span>\n        <b>Matched</b>\n      </div>\n    </React.Fragment>,\n    <React.Fragment key=\"close\">\n      <div className=\"hb-va6-ph\">\n        Month-end close <small>Last 8 months</small>\n      </div>\n      <div className=\"hb-va6-big\">\n        2.4 days<small>↓ 71% faster</small>\n      </div>\n      <div className=\"hb-va6-bars\">\n        {[92, 84, 77, 61, 48, 36, 29, 22].map((h, i) => (\n          <span key={i} style={{ height: `${h}%` }} />\n        ))}\n      </div>\n    </React.Fragment>,\n  ];\n}\n\nexport function HeroScrollStack({\n  eyebrow = \"Ledgerly for finance teams\",\n  title = \"Close the books before lunch\",\n  subtitle = \"Cards, approvals and reconciliation in one ledger, so month-end stops eating the first week of the month.\",\n  steps = defaultSteps,\n  cta = { label: \"Book a 20-minute demo\", href: \"#\" },\n  accent = \"#2f7bff\",\n  progress,\n  autoPlay = false,\n  duration = 6,\n  length = 4,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollStackProps) {\n  const ref = React.useRef<HTMLElement>(null);\n  const panels = React.useRef<(HTMLDivElement | null)[]>([]);\n  const items = React.useRef<(HTMLLIElement | null)[]>([]);\n  const Heading = headingAs;\n  const pinned = progress === undefined && !autoPlay;\n  const content = Panels();\n  const n = content.length;\n\n  useScrollProgress(\n    ref,\n    (p) => {\n      const s = p * (n - 1);\n      panels.current.forEach((node, i) => {\n        if (!node) return;\n        const enter = i === 0 ? 1 : ease(clamp01((s - (i - 1) - 0.08) / 0.84));\n        const depth = Math.max(0, s - i);\n        const y = (1 - enter) * 118 - depth * 7;\n        const scale = 1 - depth * 0.07;\n        const rx = (1 - enter) * -14 + depth * 5;\n        node.style.transform = `translate3d(0, ${y.toFixed(2)}%, 0) rotateX(${rx.toFixed(2)}deg) scale(${scale.toFixed(4)})`;\n        node.style.filter = `brightness(${(1 - Math.min(depth, 3) * 0.22).toFixed(3)})`;\n      });\n      const active = Math.min(n - 1, Math.round(s));\n      items.current.forEach((node, k) => {\n        if (node) node.dataset.on = k === active ? \"true\" : \"false\";\n      });\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va6\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={{ \"--hb-va6-accent\": accent, \"--hb-va6-h\": height, \"--hb-va6-len\": length, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-stack\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va6-stage\">\n        <div>\n          <span className=\"hb-va6-eyebrow\">{eyebrow}</span>\n          <Heading className=\"hb-va6-title\">{title}</Heading>\n          {subtitle ? <p className=\"hb-va6-sub\">{subtitle}</p> : null}\n          <ol className=\"hb-va6-steps\">\n            {steps.map((st, k) => (\n              <li\n                key={st.title}\n                className=\"hb-va6-step\"\n                data-on={k === 0 ? \"true\" : \"false\"}\n                ref={(node) => {\n                  items.current[k] = node;\n                }}\n              >\n                <span className=\"hb-va6-num\">{k + 1}</span>\n                <b>{st.title}</b>\n                <span>{st.text}</span>\n              </li>\n            ))}\n          </ol>\n          {cta ? (\n            <a className=\"hb-va6-cta\" href={cta.href}>\n              {cta.label}\n            </a>\n          ) : null}\n        </div>\n        <div className=\"hb-va6-deck\" aria-hidden=\"true\">\n          {content.map((node, i) => (\n            <div\n              key={i}\n              className=\"hb-va6-panel\"\n              ref={(el) => {\n                panels.current[i] = el;\n              }}\n              style={{ zIndex: i + 1, transform: i === 0 ? undefined : \"translate3d(0, 118%, 0)\" }}\n            >\n              {node}\n            </div>\n          ))}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}