{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "image-accordion-reel",
  "type": "registry:component",
  "title": "Image Accordion Reel",
  "description": "Landscape panels that open one at a time on a story-style timer, with segmented progress at the top. The ridges of each scene slide into place as its panel widens, and hovering pauses the reel.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "accordion",
    "gallery",
    "autoplay",
    "stories",
    "panels",
    "landscape"
  ],
  "docs": "https://hyperblur.dev/effects/image-accordion-reel",
  "files": [
    {
      "path": "registry/hyperblur/image-accordion-reel.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/image-accordion-reel.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ReelPanel {\n  title: string;\n  place: string;\n  caption: string;\n  colors?: [string, string, string, string];\n}\n\nexport interface ImageAccordionReelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n  items?: ReelPanel[];\n  value?: number;\n  defaultValue?: number;\n  onChange?: (index: number) => void;\n  autoPlay?: boolean;\n  interval?: number;\n  height?: number;\n  accent?: string;\n}\n\nconst defaultItems: ReelPanel[] = [\n  {\n    title: \"Lofoten\",\n    place: \"Norway / 68.2 N\",\n    caption: \"Fishing villages under granite walls, and a June sun that never quite sets.\",\n    colors: [\"#1b2847\", \"#f2a46f\", \"#22314f\", \"#ffe1b0\"],\n  },\n  {\n    title: \"Atacama\",\n    place: \"Chile / 23.6 S\",\n    caption: \"The driest desert on Earth, salt flats glowing pink an hour after dusk.\",\n    colors: [\"#3a1838\", \"#ff8a6b\", \"#5a2433\", \"#ffd2a8\"],\n  },\n  {\n    title: \"Arashiyama\",\n    place: \"Japan / 35.0 N\",\n    caption: \"Cedar ridges folding into mist above the Hozu river at first light.\",\n    colors: [\"#0f2a2a\", \"#9fd6b8\", \"#16403a\", \"#f4fff0\"],\n  },\n  {\n    title: \"Dolomites\",\n    place: \"Italy / 46.4 N\",\n    caption: \"Limestone towers that blush red at sunset, locals call it enrosadira.\",\n    colors: [\"#24204a\", \"#f6a3b8\", \"#332a5c\", \"#ffe4ec\"],\n  },\n  {\n    title: \"Namib\",\n    place: \"Namibia / 24.7 S\",\n    caption: \"Star dunes taller than towers, shifting a few meters with every storm.\",\n    colors: [\"#2a1606\", \"#ffb35c\", \"#7a3a12\", \"#fff0c8\"],\n  },\n];\n\nfunction hash(n: number) {\n  let x = Math.imul(n ^ 0x9e3779b9, 0x85ebca6b) >>> 0;\n  x = Math.imul(x ^ (x >>> 13), 0xc2b2ae35) >>> 0;\n  return ((x ^ (x >>> 16)) >>> 0) / 4294967295;\n}\n\nfunction mix(a: string, b: string, t: number) {\n  const pa = parseInt(a.slice(1), 16);\n  const pb = parseInt(b.slice(1), 16);\n  const ch = (s: number) => {\n    const ca = (pa >> s) & 255;\n    const cb = (pb >> s) & 255;\n    return Math.round(ca + (cb - ca) * t);\n  };\n  return `#${((1 << 24) | (ch(16) << 16) | (ch(8) << 8) | ch(0)).toString(16).slice(1)}`;\n}\n\nfunction ridge(seed: number, base: number, amp: number, steps: number) {\n  let d = `M-20 320 L-20 ${base.toFixed(1)}`;\n  for (let i = 0; i <= steps; i++) {\n    const x = -20 + (440 / steps) * i;\n    const y = base - amp * (0.35 + hash(seed * 31 + i) * 0.65);\n    d += ` L${x.toFixed(1)} ${y.toFixed(1)}`;\n  }\n  return `${d} L420 320 Z`;\n}\n\nconst css = `\n.hb-vl1 {\n  display: flex;\n  flex-direction: column;\n  gap: 10px;\n  width: 100%;\n  color: #ededed;\n  font-family: inherit;\n  box-sizing: border-box;\n}\n.hb-vl1 *, .hb-vl1 *::before, .hb-vl1 *::after { box-sizing: border-box; }\n.hb-vl1-bar { display: flex; gap: 4px; padding: 0 2px; }\n.hb-vl1-seg {\n  position: relative;\n  flex: 1 1 0;\n  height: 2px;\n  overflow: hidden;\n  border-radius: 2px;\n  background: rgba(255, 255, 255, 0.14);\n}\n.hb-vl1-fill {\n  position: absolute;\n  inset: 0;\n  background: #ededed;\n  transform: scaleX(0);\n  transform-origin: left center;\n}\n.hb-vl1-seg[data-state=\"done\"] .hb-vl1-fill { transform: scaleX(1); background: rgba(237, 237, 237, 0.55); }\n.hb-vl1-seg[data-state=\"still\"] .hb-vl1-fill { transform: scaleX(1); }\n.hb-vl1-seg[data-state=\"live\"] .hb-vl1-fill { animation: hb-vl1-fill var(--hb-vl1-t) linear forwards; }\n.hb-vl1[data-paused=\"true\"] .hb-vl1-fill { animation-play-state: paused; }\n@keyframes hb-vl1-fill { to { transform: scaleX(1); } }\n.hb-vl1-row { display: flex; gap: 6px; height: var(--hb-vl1-h); }\n.hb-vl1-p {\n  position: relative;\n  flex: 1 1 0;\n  min-width: 40px;\n  margin: 0;\n  padding: 0;\n  overflow: hidden;\n  border: 0;\n  border-radius: 16px;\n  background: #111111;\n  color: inherit;\n  font: inherit;\n  text-align: left;\n  cursor: pointer;\n  container-type: inline-size;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);\n  transition: flex-grow 0.85s cubic-bezier(0.65, 0, 0.35, 1);\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-vl1-p[data-active=\"true\"] { flex-grow: 5; }\n.hb-vl1-p:not([data-active=\"true\"]):hover { flex-grow: 1.4; }\n.hb-vl1-p:focus-visible { outline: 2px solid var(--hb-vl1-a); outline-offset: 2px; }\n.hb-vl1-svg {\n  position: absolute;\n  inset: 0;\n  width: 100%;\n  height: 100%;\n  transform: scale(1.18);\n  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-vl1-p[data-active=\"true\"] .hb-vl1-svg { transform: scale(1); }\n.hb-vl1-l { transition: transform 1.3s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-vl1-l1 { transform: translateY(26px); }\n.hb-vl1-l2 { transform: translateY(16px); }\n.hb-vl1-l3 { transform: translateY(8px); }\n.hb-vl1-sun { transform: translateY(40px); transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-vl1-p[data-active=\"true\"] .hb-vl1-l, .hb-vl1-p[data-active=\"true\"] .hb-vl1-sun { transform: none; }\n.hb-vl1-shade {\n  position: absolute;\n  inset: 0;\n  background: linear-gradient(180deg, rgba(6, 6, 10, 0.25) 0%, rgba(6, 6, 10, 0) 30%, rgba(6, 6, 10, 0) 45%, rgba(6, 6, 10, 0.82) 100%);\n  pointer-events: none;\n}\n.hb-vl1-p:not([data-active=\"true\"]) .hb-vl1-shade { background: rgba(6, 6, 10, 0.38); }\n.hb-vl1-num {\n  position: absolute;\n  top: 12px;\n  left: 12px;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 10px;\n  letter-spacing: 0.08em;\n  color: rgba(255, 255, 255, 0.78);\n}\n.hb-vl1-dot {\n  width: 5px;\n  height: 5px;\n  border-radius: 50%;\n  background: var(--hb-vl1-a);\n  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-vl1-a) 25%, transparent);\n  opacity: 0;\n  transform: scale(0.4);\n  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-vl1-p[data-active=\"true\"] .hb-vl1-dot { opacity: 1; transform: none; }\n.hb-vl1-cap {\n  position: absolute;\n  left: 16px;\n  right: 16px;\n  bottom: 14px;\n  display: flex;\n  flex-direction: column;\n  gap: 3px;\n  min-width: 150px;\n}\n.hb-vl1-cap > * {\n  margin: 0;\n  opacity: 0;\n  transform: translateY(14px);\n  transition: opacity 0.3s ease, transform 0.3s ease;\n}\n.hb-vl1-p[data-active=\"true\"] .hb-vl1-cap > * {\n  opacity: 1;\n  transform: none;\n  transition: opacity 0.6s ease, transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-vl1-p[data-active=\"true\"] .hb-vl1-cap > :nth-child(1) { transition-delay: 0.3s; }\n.hb-vl1-p[data-active=\"true\"] .hb-vl1-cap > :nth-child(2) { transition-delay: 0.38s; }\n.hb-vl1-p[data-active=\"true\"] .hb-vl1-cap > :nth-child(3) { transition-delay: 0.46s; }\n.hb-vl1-place {\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 10px;\n  letter-spacing: 0.14em;\n  text-transform: uppercase;\n  color: rgba(255, 255, 255, 0.72);\n  white-space: nowrap;\n}\n.hb-vl1-title {\n  font-size: 26px;\n  font-weight: 600;\n  line-height: 1.05;\n  letter-spacing: -0.025em;\n  white-space: nowrap;\n}\n.hb-vl1-text {\n  max-width: 34ch;\n  font-size: 12.5px;\n  line-height: 1.45;\n  color: rgba(255, 255, 255, 0.78);\n}\n@container (max-width: 240px) {\n  .hb-vl1-text { display: none; }\n  .hb-vl1-title { font-size: 20px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vl1 *, .hb-vl1 *::before, .hb-vl1 *::after { transition: none !important; animation: none !important; }\n}\n`;\n\nexport function ImageAccordionReel({\n  items = defaultItems,\n  value,\n  defaultValue = 0,\n  onChange,\n  autoPlay = true,\n  interval = 5000,\n  height = 360,\n  accent = \"#2f7bff\",\n  className,\n  style,\n  ...rest\n}: ImageAccordionReelProps) {\n  const [inner, setInner] = React.useState(defaultValue);\n  const [paused, setPaused] = React.useState(false);\n  const refs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const uid = React.useId().replace(/:/g, \"\");\n  const count = items.length;\n  const active = Math.min(Math.max(value ?? inner, 0), Math.max(count - 1, 0));\n\n  const select = (index: number) => {\n    const next = ((index % count) + count) % count;\n    if (value === undefined) setInner(next);\n    onChange?.(next);\n  };\n\n  const onKey = (event: React.KeyboardEvent, index: number) => {\n    let next = -1;\n    if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") next = (index + 1) % count;\n    else if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") next = (index - 1 + count) % count;\n    else if (event.key === \"Home\") next = 0;\n    else if (event.key === \"End\") next = count - 1;\n    if (next < 0) return;\n    event.preventDefault();\n    select(next);\n    refs.current[next]?.focus();\n  };\n\n  const rootStyle = {\n    \"--hb-vl1-a\": accent,\n    \"--hb-vl1-h\": `${height}px`,\n    \"--hb-vl1-t\": `${interval}ms`,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <div\n      className={[\"hb-vl1\", className].filter(Boolean).join(\" \")}\n      style={rootStyle}\n      data-paused={paused ? \"true\" : \"false\"}\n      onPointerEnter={() => setPaused(true)}\n      onPointerLeave={() => setPaused(false)}\n      onFocus={() => setPaused(true)}\n      onBlur={(event) => {\n        if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setPaused(false);\n      }}\n      {...rest}\n    >\n      <style href=\"hb-image-accordion-reel\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vl1-bar\" aria-hidden=\"true\">\n        {items.map((item, i) => {\n          const state = i < active ? \"done\" : i === active ? (autoPlay ? \"live\" : \"still\") : \"idle\";\n          return (\n            <span key={item.title + i} className=\"hb-vl1-seg\" data-state={state}>\n              <span\n                key={i === active ? `live-${active}` : \"rest\"}\n                className=\"hb-vl1-fill\"\n                onAnimationEnd={i === active && autoPlay ? () => select(active + 1) : undefined}\n              />\n            </span>\n          );\n        })}\n      </div>\n      <div className=\"hb-vl1-row\" role=\"tablist\" aria-label=\"Destinations\" aria-orientation=\"horizontal\">\n        {items.map((item, i) => {\n          const [skyTop, skyLow, land, sun] = item.colors ?? [\"#1b2847\", \"#f2a46f\", \"#22314f\", \"#ffe1b0\"];\n          const on = i === active;\n          const grad = `${uid}-g${i}`;\n          return (\n            <button\n              key={item.title + i}\n              ref={(node) => {\n                refs.current[i] = node;\n              }}\n              type=\"button\"\n              role=\"tab\"\n              aria-selected={on}\n              aria-label={`${item.title}, ${item.place}`}\n              tabIndex={on ? 0 : -1}\n              className=\"hb-vl1-p\"\n              data-active={on ? \"true\" : \"false\"}\n              onClick={() => select(i)}\n              onKeyDown={(event) => onKey(event, i)}\n            >\n              <svg className=\"hb-vl1-svg\" viewBox=\"0 0 400 300\" preserveAspectRatio=\"xMidYMid slice\" aria-hidden=\"true\">\n                <defs>\n                  <linearGradient id={grad} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n                    <stop offset=\"0\" stopColor={skyTop} />\n                    <stop offset=\"0.72\" stopColor={skyLow} />\n                  </linearGradient>\n                </defs>\n                <rect width=\"400\" height=\"300\" fill={`url(#${grad})`} />\n                <g className=\"hb-vl1-sun\">\n                  <circle cx={(120 + hash(i * 7 + 3) * 160).toFixed(1)} cy=\"150\" r=\"64\" fill={sun} opacity=\"0.18\" />\n                  <circle cx={(120 + hash(i * 7 + 3) * 160).toFixed(1)} cy=\"150\" r=\"34\" fill={sun} />\n                </g>\n                <path className=\"hb-vl1-l hb-vl1-l3\" d={ridge(i * 3 + 1, 205, 70, 7)} fill={mix(land, skyLow, 0.55)} />\n                <path className=\"hb-vl1-l hb-vl1-l2\" d={ridge(i * 3 + 2, 238, 58, 9)} fill={mix(land, skyLow, 0.25)} />\n                <path className=\"hb-vl1-l hb-vl1-l1\" d={ridge(i * 3 + 3, 272, 44, 12)} fill={mix(land, \"#05060a\", 0.35)} />\n              </svg>\n              <span className=\"hb-vl1-shade\" />\n              <span className=\"hb-vl1-num\">\n                <span className=\"hb-vl1-dot\" />\n                {String(i + 1).padStart(2, \"0\")}\n              </span>\n              <span className=\"hb-vl1-cap\" aria-hidden={!on}>\n                <span className=\"hb-vl1-place\">{item.place}</span>\n                <span className=\"hb-vl1-title\">{item.title}</span>\n                <span className=\"hb-vl1-text\">{item.caption}</span>\n              </span>\n            </button>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}