{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-curtain",
  "type": "registry:component",
  "title": "Hero Scroll Curtain",
  "description": "A velvet stage curtain printed with a gold title gathers to both sides as you scroll, its folds bunching and hems lifting. Behind it the spotlight comes up on the season, the buttons and three show cards.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "curtain",
    "theatre",
    "events",
    "reveal"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-curtain",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-curtain.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-curtain.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollCurtainLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollCurtainShow {\n  date: string;\n  title: string;\n  tag: string;\n}\n\nexport interface HeroScrollCurtainProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  marquee?: string;\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  primaryCta?: HeroScrollCurtainLink | null;\n  secondaryCta?: HeroScrollCurtainLink | null;\n  shows?: HeroScrollCurtainShow[];\n  curtainColor?: string;\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 defaultShows: HeroScrollCurtainShow[] = [\n  { date: \"Apr 03\", title: \"The Glass Orchard\", tag: \"Premiere\" },\n  { date: \"Apr 19\", title: \"Nine Small Hours\", tag: \"Drama\" },\n  { date: \"May 08\", title: \"Salt & Brass\", tag: \"Musical\" },\n];\n\nconst css = `\n.hb-va5 {\n  --hb-va5-accent: #e8c27a;\n  --hb-va5-red: #b3122e;\n  --hb-va5-e: 0;\n  --hb-va5-o: 0;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va5-h);\n  color: #f3ece0;\n  font-family: inherit;\n  background: #070505;\n}\n.hb-va5[data-pinned=\"true\"] { height: calc(var(--hb-va5-h) * var(--hb-va5-len)); }\n.hb-va5 *, .hb-va5 *::before, .hb-va5 *::after { box-sizing: border-box; }\n.hb-va5-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-va5-h);\n  overflow: hidden;\n  container-type: size;\n  isolation: isolate;\n  background:\n    radial-gradient(60% 40% at 50% 104%, rgba(232, 194, 122, 0.16), transparent 70%),\n    linear-gradient(180deg, #0b0707, #120a09 70%, #1a0f0b);\n}\n.hb-va5-spot {\n  position: absolute;\n  left: 50%;\n  top: -10%;\n  width: 70cqw;\n  height: 120%;\n  transform: translateX(-50%);\n  background: conic-gradient(from 168deg at 50% 0%, transparent 0deg, rgba(255, 236, 200, 0.16) 12deg, rgba(255, 236, 200, 0.07) 20deg, transparent 24deg);\n  opacity: var(--hb-va5-e);\n  filter: blur(6px);\n  pointer-events: none;\n}\n.hb-va5-floor {\n  position: absolute;\n  inset: auto 0 0;\n  height: 16%;\n  background: linear-gradient(180deg, #2a1810, #120a07);\n  box-shadow: inset 0 1px 0 rgba(232, 194, 122, 0.25);\n}\n.hb-va5-floor::before {\n  content: \"\";\n  position: absolute;\n  left: 50%;\n  top: 0;\n  width: 40cqw;\n  height: 70%;\n  transform: translateX(-50%);\n  background: radial-gradient(50% 100% at 50% 0%, rgba(255, 230, 190, 0.28), transparent 70%);\n  opacity: var(--hb-va5-e);\n}\n.hb-va5-show {\n  position: absolute;\n  inset: 0 0 16%;\n  z-index: 1;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  padding: 10cqh 8cqw 0;\n  text-align: center;\n  opacity: calc(0.15 + var(--hb-va5-o) * 0.85);\n  transform: scale(calc(0.94 + var(--hb-va5-o) * 0.06));\n}\n.hb-va5-eyebrow {\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.1cqw, 12px);\n  letter-spacing: 0.22em;\n  text-transform: uppercase;\n  color: var(--hb-va5-accent);\n}\n.hb-va5-title {\n  max-width: 16ch;\n  margin: 0.5em 0 0;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(1.9rem, 5.8cqw, 5.2rem);\n  font-weight: 600;\n  line-height: 0.98;\n  letter-spacing: -0.045em;\n}\n.hb-va5-sub {\n  max-width: 46ch;\n  margin: 0.9em 0 0;\n  font-size: clamp(12px, 1.45cqw, 16px);\n  line-height: 1.55;\n  color: rgba(243, 236, 224, 0.62);\n}\n.hb-va5-actions { display: flex; gap: 0.7rem; margin-top: 1.6em; }\n.hb-va5-btn {\n  display: inline-flex;\n  align-items: center;\n  padding: 0.75em 1.35em;\n  border-radius: 999px;\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, border-color 0.3s ease;\n}\n.hb-va5-btn:hover { transform: translateY(-1px); }\n.hb-va5-btn:focus-visible { outline: 2px solid var(--hb-va5-accent); outline-offset: 3px; }\n.hb-va5-solid {\n  background: linear-gradient(180deg, #f4d697, var(--hb-va5-accent));\n  color: #2a1606;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 12px 34px -12px rgba(232, 194, 122, 0.7);\n}\n.hb-va5-ghost { border: 1px solid rgba(243, 236, 224, 0.22); color: #f3ece0; }\n.hb-va5-ghost:hover { border-color: rgba(243, 236, 224, 0.45); background: rgba(243, 236, 224, 0.05); }\n.hb-va5-cards { display: flex; gap: 0.7rem; margin-top: 2.2em; }\n.hb-va5-card {\n  min-width: 13em;\n  padding: 0.75em 0.9em;\n  border: 1px solid rgba(232, 194, 122, 0.18);\n  border-radius: 0.8em;\n  background: linear-gradient(180deg, rgba(40, 24, 16, 0.75), rgba(20, 12, 9, 0.75));\n  text-align: left;\n  font-size: clamp(10px, 1.15cqw, 13px);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);\n}\n.hb-va5-card b { display: block; margin-top: 0.25em; font-size: 1.12em; font-weight: 600; color: #f3ece0; }\n.hb-va5-meta {\n  display: flex;\n  justify-content: space-between;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 0.85em;\n  letter-spacing: 0.08em;\n  text-transform: uppercase;\n  color: rgba(243, 236, 224, 0.5);\n}\n.hb-va5-meta span:last-child { color: var(--hb-va5-accent); }\n.hb-va5-half {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  z-index: 2;\n  width: calc(50% * (1 - var(--hb-va5-e) * 0.86) + 1px);\n  overflow: hidden;\n  background:\n    linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 22%, transparent 70%, rgba(0, 0, 0, 0.55)),\n    repeating-linear-gradient(90deg,\n      color-mix(in srgb, var(--hb-va5-red) 45%, #000) 0%,\n      var(--hb-va5-red) 2.4%,\n      color-mix(in srgb, var(--hb-va5-red) 80%, #fff) 3.4%,\n      color-mix(in srgb, var(--hb-va5-red) 70%, #000) 5.2%,\n      color-mix(in srgb, var(--hb-va5-red) 45%, #000) 6.4%);\n  will-change: width, clip-path;\n}\n.hb-va5-left {\n  left: 0;\n  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--hb-va5-e) * 22%), 0 100%);\n  box-shadow: inset -24px 0 40px -20px rgba(0, 0, 0, 0.7);\n}\n.hb-va5-right {\n  right: 0;\n  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 calc(100% - var(--hb-va5-e) * 22%));\n  box-shadow: inset 24px 0 40px -20px rgba(0, 0, 0, 0.7);\n}\n.hb-va5-word {\n  position: absolute;\n  top: 50%;\n  width: 100cqw;\n  transform: translateY(-50%);\n  text-align: center;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(2rem, 9.4cqw, 8.4rem);\n  font-weight: 700;\n  line-height: 1;\n  letter-spacing: 0.02em;\n  text-transform: uppercase;\n  white-space: nowrap;\n  color: transparent;\n  background: linear-gradient(180deg, #fff1cf, var(--hb-va5-accent) 55%, #9c7637);\n  -webkit-background-clip: text;\n  background-clip: text;\n  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5));\n  pointer-events: none;\n}\n.hb-va5-word small {\n  display: block;\n  margin-top: 0.7em;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 0.13em;\n  font-weight: 500;\n  letter-spacing: 0.4em;\n}\n.hb-va5-left .hb-va5-word { right: -50cqw; }\n.hb-va5-right .hb-va5-word { left: -50cqw; }\n.hb-va5-valance {\n  position: absolute;\n  inset: 0 0 auto;\n  z-index: 3;\n  height: 9cqh;\n  background:\n    linear-gradient(180deg, transparent 78%, var(--hb-va5-accent) 78%, var(--hb-va5-accent) 84%, transparent 84%),\n    linear-gradient(180deg, color-mix(in srgb, var(--hb-va5-red) 55%, #000), var(--hb-va5-red));\n  -webkit-mask: radial-gradient(3.2cqw 2.2cqh at 50% 100%, transparent 98%, #000 100%) 0 0 / 6.4cqw 100% repeat-x;\n  mask: radial-gradient(3.2cqw 2.2cqh at 50% 100%, transparent 98%, #000 100%) 0 0 / 6.4cqw 100% repeat-x;\n  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);\n}\n.hb-va5-hint {\n  position: absolute;\n  left: 50%;\n  bottom: 4cqh;\n  z-index: 3;\n  transform: translateX(-50%);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(9px, 1cqw, 11px);\n  letter-spacing: 0.24em;\n  text-transform: uppercase;\n  color: rgba(243, 236, 224, 0.55);\n  opacity: calc(1 - var(--hb-va5-e) * 3);\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-va5-btn { 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 HeroScrollCurtain({\n  marquee = \"Opening night\",\n  eyebrow = \"The Aldridge Theatre · Spring Season 2027\",\n  title = \"The house lights are going down\",\n  subtitle = \"Twelve productions, three world premieres and a season pass that pays for itself by the fourth show.\",\n  primaryCta = { label: \"Get a season pass\", href: \"#\" },\n  secondaryCta = { label: \"See the program\", href: \"#\" },\n  shows = defaultShows,\n  curtainColor = \"#b3122e\",\n  accent = \"#e8c27a\",\n  progress,\n  autoPlay = false,\n  duration = 5,\n  length = 3,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollCurtainProps) {\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      const el = ref.current;\n      if (!el) return;\n      el.style.setProperty(\"--hb-va5-e\", ease(clamp01(p / 0.8)).toFixed(4));\n      el.style.setProperty(\"--hb-va5-o\", ease(clamp01((p - 0.3) / 0.55)).toFixed(4));\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  const word = (\n    <span className=\"hb-va5-word\">\n      {marquee}\n      <small>Spring season · 2027</small>\n    </span>\n  );\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va5\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={\n        {\n          \"--hb-va5-accent\": accent,\n          \"--hb-va5-red\": curtainColor,\n          \"--hb-va5-h\": height,\n          \"--hb-va5-len\": length,\n          ...style,\n        } as React.CSSProperties\n      }\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-curtain\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va5-stage\">\n        <div className=\"hb-va5-spot\" aria-hidden=\"true\" />\n        <div className=\"hb-va5-floor\" aria-hidden=\"true\" />\n        <div className=\"hb-va5-show\">\n          <span className=\"hb-va5-eyebrow\">{eyebrow}</span>\n          <Heading className=\"hb-va5-title\">{title}</Heading>\n          {subtitle ? <p className=\"hb-va5-sub\">{subtitle}</p> : null}\n          {primaryCta || secondaryCta ? (\n            <div className=\"hb-va5-actions\">\n              {primaryCta ? (\n                <a className=\"hb-va5-btn hb-va5-solid\" href={primaryCta.href}>\n                  {primaryCta.label}\n                </a>\n              ) : null}\n              {secondaryCta ? (\n                <a className=\"hb-va5-btn hb-va5-ghost\" href={secondaryCta.href}>\n                  {secondaryCta.label}\n                </a>\n              ) : null}\n            </div>\n          ) : null}\n          {shows.length ? (\n            <div className=\"hb-va5-cards\">\n              {shows.map((s) => (\n                <div key={s.title} className=\"hb-va5-card\">\n                  <span className=\"hb-va5-meta\">\n                    <span>{s.date}</span>\n                    <span>{s.tag}</span>\n                  </span>\n                  <b>{s.title}</b>\n                </div>\n              ))}\n            </div>\n          ) : null}\n        </div>\n        <div className=\"hb-va5-half hb-va5-left\" aria-hidden=\"true\">{word}</div>\n        <div className=\"hb-va5-half hb-va5-right\" aria-hidden=\"true\">{word}</div>\n        <div className=\"hb-va5-valance\" aria-hidden=\"true\" />\n        <span className=\"hb-va5-hint\" aria-hidden=\"true\">Scroll to open the curtain</span>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}