{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cinema-countdown-leader",
  "type": "registry:component",
  "title": "Cinema Countdown Leader",
  "description": "A film leader countdown with a sweeping dial, crosshairs and frame labels that ticks down once per second, pops a white frame and gives way to the event details. It can be skipped and replayed.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "cinematic",
    "cinematic",
    "countdown",
    "leader",
    "intro",
    "premiere",
    "event"
  ],
  "docs": "https://hyperblur.dev/effects/cinema-countdown-leader",
  "files": [
    {
      "path": "registry/hyperblur/cinema-countdown-leader.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/cinema-countdown-leader.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CinemaCountdownLeaderAction {\n  label: string;\n  href: string;\n}\n\nexport interface CinemaCountdownLeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  from?: number;\n  to?: number;\n  loop?: boolean;\n  hold?: number;\n  eyebrow?: string;\n  title?: string;\n  details?: string[];\n  cta?: CinemaCountdownLeaderAction | null;\n  accent?: string;\n  onComplete?: () => void;\n  headingAs?: \"h1\" | \"h2\";\n}\n\nconst css = `\n@property --hb-vc9-a {\n  syntax: \"<angle>\";\n  inherits: false;\n  initial-value: 0deg;\n}\n.hb-vc9 {\n  --hb-vc9-accent: #e8ff5a;\n  position: relative;\n  box-sizing: border-box;\n  display: grid;\n  place-items: center;\n  width: 100%;\n  min-height: 580px;\n  overflow: hidden;\n  isolation: isolate;\n  container-type: inline-size;\n  background: #07070a;\n  color: #f2f2ee;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-vc9 *, .hb-vc9 *::before, .hb-vc9 *::after { box-sizing: border-box; }\n.hb-vc9-content {\n  position: relative;\n  z-index: 0;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  max-width: 760px;\n  padding: 80px 24px;\n  text-align: center;\n}\n.hb-vc9-glow {\n  position: absolute;\n  inset: 0;\n  z-index: -1;\n  background: radial-gradient(50% 40% at 50% 50%, color-mix(in srgb, var(--hb-vc9-accent) 14%, transparent), transparent 70%);\n}\n.hb-vc9[data-phase=\"done\"] .hb-vc9-content > * { animation: hb-vc9-up 1s cubic-bezier(.16, .8, .2, 1) both; }\n.hb-vc9[data-phase=\"done\"] .hb-vc9-content > *:nth-child(3) { animation-delay: .12s; }\n.hb-vc9[data-phase=\"done\"] .hb-vc9-content > *:nth-child(4) { animation-delay: .24s; }\n.hb-vc9[data-phase=\"done\"] .hb-vc9-content > *:nth-child(5) { animation-delay: .36s; }\n@keyframes hb-vc9-up {\n  from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.98); }\n  to { opacity: 1; transform: none; }\n}\n.hb-vc9-eyebrow {\n  display: inline-flex;\n  align-items: center;\n  gap: 10px;\n  margin: 0 0 18px;\n  padding: 6px 12px;\n  border: 1px solid color-mix(in srgb, var(--hb-vc9-accent) 40%, transparent);\n  border-radius: 999px;\n  color: var(--hb-vc9-accent);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 11px;\n  letter-spacing: .2em;\n  text-transform: uppercase;\n}\n.hb-vc9-title {\n  margin: 0;\n  font-family: var(--font-grotesk, var(--font-sans, ui-sans-serif, system-ui, sans-serif));\n  font-size: clamp(42px, 9.6cqi, 124px);\n  font-weight: 700;\n  line-height: .9;\n  letter-spacing: -.045em;\n}\n.hb-vc9-details {\n  display: flex;\n  flex-wrap: wrap;\n  justify-content: center;\n  gap: 8px 22px;\n  margin: 22px 0 0;\n  padding: 0;\n  color: rgba(242, 242, 238, .7);\n  font-size: 14px;\n  list-style: none;\n}\n.hb-vc9-details li { display: inline-flex; align-items: center; gap: 22px; }\n.hb-vc9-details li + li::before { content: \"\"; width: 4px; height: 4px; margin-left: -13px; border-radius: 50%; background: rgba(242, 242, 238, .35); }\n.hb-vc9-actions { display: flex; gap: 10px; margin-top: 28px; }\n.hb-vc9-btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  height: 44px;\n  padding: 0 20px;\n  border: 1px solid rgba(242, 242, 238, .18);\n  border-radius: 999px;\n  background: transparent;\n  color: #f2f2ee;\n  font: inherit;\n  font-size: 14px;\n  font-weight: 550;\n  text-decoration: none;\n  cursor: pointer;\n  transition: background .25s ease, border-color .25s ease, transform .2s ease;\n}\n.hb-vc9-btn[data-primary] { border-color: transparent; background: var(--hb-vc9-accent); color: #0a0a06; }\n.hb-vc9-btn:hover { border-color: rgba(242, 242, 238, .4); }\n.hb-vc9-btn[data-primary]:hover { background: color-mix(in srgb, var(--hb-vc9-accent) 85%, #fff); }\n.hb-vc9-btn:active { transform: scale(.97); }\n.hb-vc9-btn:focus-visible { outline: 2px solid var(--hb-vc9-accent); outline-offset: 3px; }\n.hb-vc9-leader {\n  position: absolute;\n  inset: 0;\n  z-index: 2;\n  display: grid;\n  place-items: center;\n  background: radial-gradient(70% 80% at 50% 50%, #8b8a84, #4a4945 70%, #232220);\n  color: #0d0d0c;\n  transition: opacity .5s ease, visibility .5s;\n}\n.hb-vc9[data-phase=\"done\"] .hb-vc9-leader { opacity: 0; visibility: hidden; }\n.hb-vc9-leader::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 3px);\n  animation: hb-vc9-jitter .12s steps(2, end) infinite;\n}\n@keyframes hb-vc9-jitter {\n  0% { transform: translate3d(0, 0, 0); }\n  100% { transform: translate3d(0, 1px, 0); }\n}\n.hb-vc9-cross {\n  position: absolute;\n  inset: 0;\n  background:\n    linear-gradient(90deg, transparent calc(50% - .75px), rgba(13, 13, 12, .75) calc(50% - .75px), rgba(13, 13, 12, .75) calc(50% + .75px), transparent calc(50% + .75px)),\n    linear-gradient(0deg, transparent calc(50% - .75px), rgba(13, 13, 12, .75) calc(50% - .75px), rgba(13, 13, 12, .75) calc(50% + .75px), transparent calc(50% + .75px));\n}\n.hb-vc9-dial {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: min(66cqi, 400px);\n  aspect-ratio: 1;\n  border-radius: 50%;\n}\n.hb-vc9-sweep {\n  position: absolute;\n  inset: 0;\n  border-radius: 50%;\n  background: conic-gradient(from 0deg, rgba(13, 13, 12, .55) 0 var(--hb-vc9-a), rgba(255, 255, 255, .06) var(--hb-vc9-a) 360deg);\n  animation: hb-vc9-sweep 1s linear both;\n}\n@keyframes hb-vc9-sweep {\n  from { --hb-vc9-a: 0deg; }\n  to { --hb-vc9-a: 360deg; }\n}\n.hb-vc9-ring {\n  position: absolute;\n  border: 2px solid rgba(240, 240, 232, .85);\n  border-radius: 50%;\n}\n.hb-vc9-ring[data-r=\"1\"] { inset: 0; }\n.hb-vc9-ring[data-r=\"2\"] { inset: 7%; border-width: 1.5px; }\n.hb-vc9-num {\n  position: relative;\n  color: #0d0d0c;\n  font-family: var(--font-grotesk, var(--font-sans, ui-sans-serif, system-ui, sans-serif));\n  font-size: min(42cqi, 260px);\n  font-weight: 700;\n  line-height: 1;\n  font-variant-numeric: tabular-nums;\n  text-shadow: 0 0 1px rgba(255, 255, 255, .4);\n  animation: hb-vc9-num 1s steps(1, end) both;\n}\n@keyframes hb-vc9-num {\n  0% { transform: translate3d(0, -1px, 0); }\n  50% { transform: translate3d(1px, 0, 0); }\n}\n.hb-vc9-label {\n  position: absolute;\n  z-index: 1;\n  color: rgba(13, 13, 12, .78);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 10.5px;\n  font-weight: 600;\n  letter-spacing: .2em;\n  text-transform: uppercase;\n}\n.hb-vc9-label[data-pos=\"tl\"] { top: 18px; left: 22px; }\n.hb-vc9-label[data-pos=\"tr\"] { top: 18px; right: 22px; }\n.hb-vc9-label[data-pos=\"bl\"] { bottom: 18px; left: 22px; }\n.hb-vc9-label[data-pos=\"br\"] { bottom: 18px; right: 22px; }\n.hb-vc9-pop {\n  position: absolute;\n  inset: 0;\n  z-index: 3;\n  background: #fff;\n  pointer-events: none;\n  animation: hb-vc9-pop .28s steps(1, end) both;\n}\n@keyframes hb-vc9-pop {\n  0% { opacity: 1; }\n  40% { opacity: .2; background: #000; }\n  70% { opacity: 0; }\n  100% { opacity: 0; }\n}\n.hb-vc9-skip {\n  position: absolute;\n  right: 18px;\n  bottom: 48px;\n  z-index: 4;\n  height: 30px;\n  padding: 0 12px;\n  border: 1px solid rgba(13, 13, 12, .4);\n  border-radius: 999px;\n  background: rgba(240, 240, 232, .3);\n  color: #0d0d0c;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 10.5px;\n  letter-spacing: .14em;\n  text-transform: uppercase;\n  cursor: pointer;\n}\n.hb-vc9-skip:focus-visible { outline: 2px solid #0d0d0c; outline-offset: 2px; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vc9-leader, .hb-vc9-pop, .hb-vc9-skip { display: none; }\n  .hb-vc9 .hb-vc9-content > * { animation: none !important; }\n}\n`;\n\nexport function CinemaCountdownLeader({\n  from = 5,\n  to = 2,\n  loop = true,\n  hold = 4200,\n  eyebrow = \"Premiere night\",\n  title = \"Lights down at eight\",\n  details = [\"Thursday, March 12\", \"Rialto Hall, Screen 1\", \"Q&A with the director\"],\n  cta = { label: \"Claim your seat\", href: \"#\" },\n  accent = \"#e8ff5a\",\n  onComplete,\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: CinemaCountdownLeaderProps) {\n  const Heading = headingAs;\n  const start = Math.max(from, to);\n  const end = Math.min(from, to);\n  const [n, setN] = React.useState(start);\n  const [run, setRun] = React.useState(0);\n  const [popped, setPopped] = React.useState(false);\n  const [skipped, setSkipped] = React.useState(false);\n  const done = n < end;\n  const completeRef = React.useRef(onComplete);\n\n  React.useEffect(() => {\n    completeRef.current = onComplete;\n  }, [onComplete]);\n\n  React.useEffect(() => {\n    if (skipped || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    let cur = start;\n    let timer = 0;\n    const tick = () => {\n      cur -= 1;\n      setN(cur);\n      if (cur >= end) {\n        timer = window.setTimeout(tick, 1000);\n        return;\n      }\n      setPopped(true);\n      completeRef.current?.();\n      if (loop) {\n        timer = window.setTimeout(() => {\n          cur = start;\n          setPopped(false);\n          setN(start);\n          timer = window.setTimeout(tick, 1000);\n        }, hold);\n      }\n    };\n    timer = window.setTimeout(tick, 1000);\n    return () => window.clearTimeout(timer);\n  }, [start, end, loop, hold, run, skipped]);\n\n  const replay = () => {\n    setSkipped(false);\n    setPopped(false);\n    setN(start);\n    setRun((r) => r + 1);\n  };\n\n  const skip = () => {\n    setSkipped(true);\n    setN(end - 1);\n    setPopped(false);\n  };\n\n  const vars = { \"--hb-vc9-accent\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <section\n      className={[\"hb-vc9\", className].filter(Boolean).join(\" \")}\n      style={vars}\n      data-phase={done ? \"done\" : \"count\"}\n      {...rest}\n    >\n      <style href=\"hb-cinema-countdown-leader\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vc9-content\" key={`c${run}-${done ? 1 : 0}`}>\n        <span className=\"hb-vc9-glow\" aria-hidden=\"true\" />\n        {eyebrow ? <p className=\"hb-vc9-eyebrow\">{eyebrow}</p> : null}\n        <Heading className=\"hb-vc9-title\">{title}</Heading>\n        {details.length ? (\n          <ul className=\"hb-vc9-details\">\n            {details.map((d) => (\n              <li key={d}>{d}</li>\n            ))}\n          </ul>\n        ) : null}\n        <div className=\"hb-vc9-actions\">\n          {cta ? <a className=\"hb-vc9-btn\" data-primary=\"\" href={cta.href}>{cta.label}</a> : null}\n          <button type=\"button\" className=\"hb-vc9-btn\" onClick={replay}>Replay leader</button>\n        </div>\n      </div>\n      <div className=\"hb-vc9-leader\" aria-hidden={done ? true : undefined} role=\"timer\" aria-label={done ? undefined : `Starting in ${n}`}>\n        <span className=\"hb-vc9-cross\" />\n        <div className=\"hb-vc9-dial\">\n          <span className=\"hb-vc9-sweep\" key={`s${run}-${n}`} />\n          <span className=\"hb-vc9-ring\" data-r=\"1\" />\n          <span className=\"hb-vc9-ring\" data-r=\"2\" />\n          <span className=\"hb-vc9-num\" key={`n${run}-${n}`}>{Math.max(n, end)}</span>\n        </div>\n        <span className=\"hb-vc9-label\" data-pos=\"tl\">Picture start</span>\n        <span className=\"hb-vc9-label\" data-pos=\"tr\">Reel 1</span>\n        <span className=\"hb-vc9-label\" data-pos=\"bl\">35 mm · 24 fps</span>\n        <span className=\"hb-vc9-label\" data-pos=\"br\">Head leader</span>\n        {!done ? (\n          <button type=\"button\" className=\"hb-vc9-skip\" onClick={skip}>Skip</button>\n        ) : null}\n      </div>\n      {popped && done ? <span className=\"hb-vc9-pop\" aria-hidden=\"true\" key={`p${run}`} /> : null}\n    </section>\n  );\n}\n"
    }
  ]
}