{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-mask",
  "type": "registry:component",
  "title": "Hero Scroll Mask",
  "description": "An event name starts so large that only a slice of its painted fill is visible, then shrinks into place while the image inside keeps panning. The top bar, facts row and ticket button assemble around it.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "masked text",
    "scale",
    "conference",
    "event"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-mask",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-mask.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-mask.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollMaskLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollMaskFact {\n  label: string;\n  value: string;\n}\n\nexport interface HeroScrollMaskProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  word?: string;\n  year?: string;\n  price?: string;\n  eyebrow?: string;\n  title?: string;\n  facts?: HeroScrollMaskFact[];\n  cta?: HeroScrollMaskLink | 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 defaultFacts: HeroScrollMaskFact[] = [\n  { label: \"When\", value: \"May 20–22, 2027\" },\n  { label: \"Where\", value: \"LX Factory, Lisbon\" },\n  { label: \"Who\", value: \"38 speakers, 900 seats\" },\n];\n\nconst css = `\n.hb-va7 {\n  --hb-va7-accent: #c6f432;\n  --hb-va7-s: 3.4;\n  --hb-va7-x: 0;\n  --hb-va7-o: 0;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va7-h);\n  color: #ededed;\n  font-family: inherit;\n  background: #0b0c09;\n}\n.hb-va7[data-pinned=\"true\"] { height: calc(var(--hb-va7-h) * var(--hb-va7-len)); }\n.hb-va7 *, .hb-va7 *::before, .hb-va7 *::after { box-sizing: border-box; }\n.hb-va7-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-va7-h);\n  overflow: hidden;\n  container-type: size;\n  isolation: isolate;\n  background:\n    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 100% 12.5cqh,\n    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 12.5cqw 100%,\n    #0b0c09;\n}\n.hb-va7-word {\n  position: absolute;\n  left: 50%;\n  top: 47%;\n  margin: 0;\n  transform: translate(-50%, -50%) scale(var(--hb-va7-s));\n  transform-origin: 50% 50%;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: 15.5cqw;\n  font-weight: 700;\n  line-height: 0.8;\n  letter-spacing: calc(-0.06em + (var(--hb-va7-s) - 1) * 0.02em);\n  text-transform: uppercase;\n  white-space: nowrap;\n  color: transparent;\n  background:\n    repeating-linear-gradient(104deg, rgba(10, 12, 8, 0.0) 0 1.4%, rgba(10, 12, 8, 0.28) 1.4% 1.9%),\n    radial-gradient(30% 50% at 22% 40%, #f8ffd8, transparent 70%),\n    radial-gradient(40% 60% at 70% 64%, #1f8f6a, transparent 72%),\n    conic-gradient(from 210deg at 46% 54%, var(--hb-va7-accent), #3ad19a, #0f5d4a, #f2ff9e, var(--hb-va7-accent));\n  background-size: 100% 100%, 220% 100%, 220% 100%, 220% 100%;\n  background-position: 0 0, calc(var(--hb-va7-x) * 100%) 0, calc(var(--hb-va7-x) * -60% + 60%) 0, calc(var(--hb-va7-x) * 80%) 0;\n  -webkit-background-clip: text;\n  background-clip: text;\n  will-change: transform;\n}\n.hb-va7-word sup {\n  margin-left: 0.04em;\n  font-size: 0.32em;\n  vertical-align: 1.5em;\n  letter-spacing: -0.02em;\n}\n.hb-va7-bar {\n  position: absolute;\n  inset: 0 0 auto;\n  z-index: 2;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  padding: 3.6cqh 4cqw;\n  opacity: var(--hb-va7-o);\n  transform: translateY(calc((1 - var(--hb-va7-o)) * -20px));\n  font-size: clamp(11px, 1.3cqw, 14px);\n}\n.hb-va7-logo { display: inline-flex; align-items: center; gap: 0.5em; font-weight: 700; letter-spacing: -0.02em; }\n.hb-va7-logo::before {\n  content: \"\";\n  width: 1em;\n  height: 1em;\n  border-radius: 0.2em;\n  background: repeating-linear-gradient(104deg, var(--hb-va7-accent) 0 2px, transparent 2px 4px);\n}\n.hb-va7-links { display: flex; gap: 1.6em; color: #8f8f8f; }\n.hb-va7-eyebrow {\n  position: absolute;\n  left: 50%;\n  top: 22cqh;\n  z-index: 2;\n  transform: translate(-50%, calc((1 - var(--hb-va7-o)) * -14px));\n  opacity: var(--hb-va7-o);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.15cqw, 13px);\n  letter-spacing: 0.22em;\n  text-transform: uppercase;\n  white-space: nowrap;\n  color: var(--hb-va7-accent);\n}\n.hb-va7-title {\n  position: absolute;\n  left: 50%;\n  top: 61cqh;\n  z-index: 2;\n  width: min(36rem, 86cqw);\n  margin: 0;\n  transform: translate(-50%, calc((1 - var(--hb-va7-o)) * 18px));\n  opacity: var(--hb-va7-o);\n  text-align: center;\n  font-size: clamp(14px, 2cqw, 22px);\n  font-weight: 500;\n  line-height: 1.35;\n  letter-spacing: -0.015em;\n  color: #d6d6d6;\n}\n.hb-va7-foot {\n  position: absolute;\n  inset: auto 4cqw 5cqh;\n  z-index: 2;\n  display: grid;\n  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;\n  align-items: end;\n  gap: 2cqw;\n  padding-top: 2.4cqh;\n  border-top: 1px solid rgba(255, 255, 255, 0.1);\n}\n.hb-va7-fact {\n  opacity: var(--hb-va7-o);\n  transform: translateY(calc((1 - var(--hb-va7-o)) * (14px + var(--hb-va7-i) * 10px)));\n  font-size: clamp(11px, 1.35cqw, 15px);\n}\n.hb-va7-fact small {\n  display: block;\n  margin-bottom: 0.35em;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 0.75em;\n  letter-spacing: 0.14em;\n  text-transform: uppercase;\n  color: #6f6f6f;\n}\n.hb-va7-cta {\n  display: inline-flex;\n  align-items: center;\n  gap: 0.6em;\n  padding: 0.75em 1.3em;\n  border-radius: 999px;\n  background: var(--hb-va7-accent);\n  color: #10140a;\n  font-size: clamp(12px, 1.35cqw, 15px);\n  font-weight: 700;\n  text-decoration: none;\n  white-space: nowrap;\n  opacity: var(--hb-va7-o);\n  transform: scale(calc(0.9 + var(--hb-va7-o) * 0.1));\n  box-shadow: 0 0 0 0 transparent, 0 12px 36px -12px var(--hb-va7-accent);\n  transition: box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-va7-cta:hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-va7-accent) 25%, transparent), 0 12px 36px -12px var(--hb-va7-accent); }\n.hb-va7-cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }\n.hb-va7-cta b { padding-left: 0.6em; border-left: 1px solid rgba(16, 20, 10, 0.25); font-weight: 600; }\n.hb-va7-hint {\n  position: absolute;\n  left: 50%;\n  bottom: 5cqh;\n  z-index: 1;\n  transform: translateX(-50%);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(9px, 1cqw, 11px);\n  letter-spacing: 0.22em;\n  text-transform: uppercase;\n  color: rgba(237, 237, 237, 0.55);\n  opacity: calc(1 - var(--hb-va7-o) * 4);\n}\n@media (max-width: 640px) {\n  .hb-va7-foot { grid-template-columns: 1fr 1fr; }\n  .hb-va7-links { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-va7-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 HeroScrollMask({\n  word = \"Fieldwork\",\n  year = \"27\",\n  price = \"€390\",\n  eyebrow = \"A design conference · Lisbon\",\n  title = \"Three days of talks, studio visits and long dinners with people who make things for a living.\",\n  facts = defaultFacts,\n  cta = { label: \"Get your ticket\", href: \"#\" },\n  accent = \"#c6f432\",\n  progress,\n  autoPlay = false,\n  duration = 5,\n  length = 3,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollMaskProps) {\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      const k = ease(clamp01(p / 0.66));\n      el.style.setProperty(\"--hb-va7-s\", (3.4 - k * 2.4).toFixed(4));\n      el.style.setProperty(\"--hb-va7-x\", p.toFixed(4));\n      el.style.setProperty(\"--hb-va7-o\", ease(clamp01((p - 0.56) / 0.34)).toFixed(4));\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va7\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={{ \"--hb-va7-accent\": accent, \"--hb-va7-h\": height, \"--hb-va7-len\": length, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-mask\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va7-stage\">\n        <div className=\"hb-va7-bar\">\n          <span className=\"hb-va7-logo\">{word}</span>\n          <span className=\"hb-va7-links\" aria-hidden=\"true\">\n            <span>Speakers</span>\n            <span>Program</span>\n            <span>Venue</span>\n          </span>\n        </div>\n        <span className=\"hb-va7-eyebrow\">{eyebrow}</span>\n        <Heading className=\"hb-va7-word\" aria-label={year ? `${word} ${year}` : word}>\n          {word}\n          {year ? <sup>{year}</sup> : null}\n        </Heading>\n        {title ? <p className=\"hb-va7-title\">{title}</p> : null}\n        <div className=\"hb-va7-foot\">\n          {facts.map((f, i) => (\n            <div key={f.label} className=\"hb-va7-fact\" style={{ \"--hb-va7-i\": i } as React.CSSProperties}>\n              <small>{f.label}</small>\n              {f.value}\n            </div>\n          ))}\n          {cta ? (\n            <a className=\"hb-va7-cta\" href={cta.href}>\n              {cta.label}\n              {price ? <b>{price}</b> : null}\n            </a>\n          ) : null}\n        </div>\n        <span className=\"hb-va7-hint\" aria-hidden=\"true\">Scroll</span>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}