{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "menu-staggered",
  "type": "registry:component",
  "title": "Menu Staggered",
  "description": "A full-frame menu that slides in as three layered panels, then reveals its links one by one. The hamburger morphs into a close icon, Escape closes it and focus stays inside.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "menu",
    "navigation",
    "overlay",
    "stagger",
    "hamburger",
    "fullscreen"
  ],
  "docs": "https://hyperblur.dev/effects/menu-staggered",
  "files": [
    {
      "path": "registry/hyperblur/menu-staggered.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/menu-staggered.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface MenuLink {\n  label: string;\n  href?: string;\n  onClick?: () => void;\n}\n\nexport interface MenuStaggeredProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n  links?: MenuLink[];\n  footer?: MenuLink[];\n  brand?: React.ReactNode;\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  side?: \"right\" | \"left\";\n  accent?: string;\n  menuLabel?: string;\n}\n\nconst defaultLinks: MenuLink[] = [\n  { label: \"Work\", href: \"#work\" },\n  { label: \"Studio\", href: \"#studio\" },\n  { label: \"Journal\", href: \"#journal\" },\n  { label: \"Contact\", href: \"#contact\" },\n];\n\nconst defaultFooter: MenuLink[] = [\n  { label: \"Instagram\", href: \"#instagram\" },\n  { label: \"Dribbble\", href: \"#dribbble\" },\n  { label: \"LinkedIn\", href: \"#linkedin\" },\n];\n\nconst css = `\n.hb-qu4 {\n  --hb-qu4-a: #2f7bff;\n  --hb-qu4-bar: 48px;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  height: 100%;\n  min-height: 180px;\n  overflow: hidden;\n  container-type: inline-size;\n  font-family: inherit;\n  color: #ededed;\n  background: #0a0a0a;\n  isolation: isolate;\n}\n.hb-qu4 *, .hb-qu4 *::before, .hb-qu4 *::after { box-sizing: border-box; }\n.hb-qu4-page {\n  position: absolute;\n  inset: 0;\n  padding-top: var(--hb-qu4-bar);\n  transform-origin: 50% 60%;\n  transition: transform 0.8s cubic-bezier(0.76, 0, 0.24, 1), filter 0.8s ease;\n}\n.hb-qu4[data-open=\"true\"] .hb-qu4-page { transform: scale(0.94); filter: brightness(0.55); }\n.hb-qu4-hero {\n  display: flex;\n  height: 100%;\n  flex-direction: column;\n  justify-content: flex-end;\n  padding: 0 20px 18px;\n  background:\n    radial-gradient(circle at 80% 20%, color-mix(in srgb, var(--hb-qu4-a) 35%, transparent), transparent 55%),\n    linear-gradient(180deg, #111111, #0a0a0a);\n}\n.hb-qu4-hero b { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }\n.hb-qu4-hero span { margin-top: 6px; font-size: 12px; color: #8f8f8f; }\n.hb-qu4-bar {\n  position: absolute;\n  left: 0;\n  right: 0;\n  top: 0;\n  z-index: 10;\n  display: flex;\n  height: var(--hb-qu4-bar);\n  align-items: center;\n  justify-content: space-between;\n  padding: 0 8px 0 18px;\n}\n.hb-qu4-brand { font-size: 14px; font-weight: 650; letter-spacing: 0.01em; }\n.hb-qu4-btn {\n  position: relative;\n  width: 40px;\n  height: 40px;\n  margin: 0;\n  padding: 0;\n  color: #ededed;\n  background: rgba(255, 255, 255, 0.06);\n  border: 1px solid rgba(255, 255, 255, 0.12);\n  border-radius: 999px;\n  cursor: pointer;\n  backdrop-filter: blur(6px);\n  transition: background 0.2s ease, border-color 0.2s ease;\n}\n.hb-qu4-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); }\n.hb-qu4-btn:focus-visible, .hb-qu4-link:focus-visible, .hb-qu4-foot a:focus-visible {\n  outline: 2px solid var(--hb-qu4-a);\n  outline-offset: 3px;\n}\n.hb-qu4-bar-line {\n  position: absolute;\n  left: 12px;\n  top: 50%;\n  width: 14px;\n  height: 2px;\n  margin-top: -1px;\n  border-radius: 2px;\n  background: currentColor;\n  transition: transform 0.5s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.2s ease;\n}\n.hb-qu4-bar-line:nth-child(1) { transform: translateY(-4px); }\n.hb-qu4-bar-line:nth-child(2) { opacity: 1; }\n.hb-qu4-bar-line:nth-child(3) { transform: translateY(4px); }\n.hb-qu4-btn[aria-expanded=\"true\"] .hb-qu4-bar-line:nth-child(1) { transform: rotate(45deg); }\n.hb-qu4-btn[aria-expanded=\"true\"] .hb-qu4-bar-line:nth-child(2) { opacity: 0; }\n.hb-qu4-btn[aria-expanded=\"true\"] .hb-qu4-bar-line:nth-child(3) { transform: rotate(-45deg); }\n.hb-qu4-layer {\n  position: absolute;\n  inset: 0;\n  z-index: 5;\n  visibility: hidden;\n  transition: visibility 0s linear 1s;\n}\n.hb-qu4[data-open=\"true\"] .hb-qu4-layer { visibility: visible; transition-delay: 0s; }\n.hb-qu4-pn {\n  position: absolute;\n  inset: 0;\n  transform: translateX(100%);\n  transition: transform 0.8s cubic-bezier(0.76, 0, 0.24, 1);\n}\n.hb-qu4[data-side=\"left\"] .hb-qu4-pn { transform: translateX(-100%); }\n.hb-qu4[data-open=\"true\"] .hb-qu4-pn { transform: translateX(0); }\n.hb-qu4-pn[data-n=\"1\"] { background: var(--hb-qu4-a); transition-delay: 0.14s; }\n.hb-qu4-pn[data-n=\"2\"] { background: color-mix(in srgb, var(--hb-qu4-a) 30%, #111111); transition-delay: 0.07s; }\n.hb-qu4-pn[data-n=\"3\"] {\n  display: flex;\n  flex-direction: column;\n  padding: var(--hb-qu4-bar) 22px 16px;\n  background: #101010;\n  transition-delay: 0s;\n}\n.hb-qu4[data-open=\"true\"] .hb-qu4-pn[data-n=\"1\"] { transition-delay: 0s; }\n.hb-qu4[data-open=\"true\"] .hb-qu4-pn[data-n=\"2\"] { transition-delay: 0.08s; }\n.hb-qu4[data-open=\"true\"] .hb-qu4-pn[data-n=\"3\"] { transition-delay: 0.16s; }\n.hb-qu4-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }\n.hb-qu4-item { overflow: hidden; }\n.hb-qu4-link {\n  position: relative;\n  display: inline-flex;\n  align-items: baseline;\n  gap: 10px;\n  padding: 3px 0 4px;\n  color: #ededed;\n  text-decoration: none;\n  font-size: clamp(18px, 6.2cqw, 40px);\n  font-weight: 600;\n  letter-spacing: -0.02em;\n  line-height: 1.12;\n  transition: color 0.25s ease;\n}\n.hb-qu4-link:hover { color: #7fb3ff; }\n.hb-qu4-clip { display: block; overflow: hidden; padding-bottom: 2px; }\n.hb-qu4-txt {\n  display: block;\n  transform: translateY(115%);\n  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);\n}\n.hb-qu4[data-open=\"true\"] .hb-qu4-txt { transform: translateY(0); transition-delay: calc(0.42s + var(--hb-qu4-i) * 0.07s); }\n.hb-qu4-num {\n  font-size: 10px;\n  font-weight: 500;\n  letter-spacing: 0.08em;\n  color: #6b6b6b;\n  font-variant-numeric: tabular-nums;\n  opacity: 0;\n  transition: opacity 0.4s ease, color 0.25s ease;\n}\n.hb-qu4[data-open=\"true\"] .hb-qu4-num { opacity: 1; transition-delay: calc(0.5s + var(--hb-qu4-i) * 0.07s); }\n.hb-qu4-link:hover .hb-qu4-num { color: var(--hb-qu4-a); }\n.hb-qu4-ar {\n  margin-left: 2px;\n  align-self: center;\n  color: #7fb3ff;\n  opacity: 0;\n  transform: translateX(-8px);\n  transition: opacity 0.25s ease, transform 0.25s ease;\n}\n.hb-qu4-link:hover .hb-qu4-ar, .hb-qu4-link:focus-visible .hb-qu4-ar { opacity: 1; transform: none; }\n.hb-qu4-foot {\n  position: absolute;\n  right: 22px;\n  bottom: 16px;\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n  gap: 4px;\n  opacity: 0;\n  transition: opacity 0.4s ease;\n}\n.hb-qu4[data-open=\"true\"] .hb-qu4-foot { opacity: 1; transition-delay: 0.85s; }\n.hb-qu4-foot a { font-size: 11px; color: #8f8f8f; text-decoration: none; transition: color 0.2s ease; }\n.hb-qu4-foot a:hover { color: #ededed; }\n@container (max-width: 299px) {\n  .hb-qu4-foot { position: static; flex-direction: row; align-items: center; gap: 12px; margin-top: auto; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qu4-page, .hb-qu4-pn, .hb-qu4-txt, .hb-qu4-num, .hb-qu4-foot, .hb-qu4-bar-line, .hb-qu4-layer {\n    transition: none !important;\n  }\n}\n`;\n\nexport function MenuStaggered({\n  links = defaultLinks,\n  footer = defaultFooter,\n  brand = \"Atelier\",\n  open,\n  defaultOpen = false,\n  onOpenChange,\n  side = \"right\",\n  accent = \"#2f7bff\",\n  menuLabel = \"Main menu\",\n  children,\n  className = \"\",\n  style,\n  onKeyDown,\n  ...rest\n}: MenuStaggeredProps) {\n  const controlled = open !== undefined;\n  const [inner, setInner] = React.useState(defaultOpen);\n  const isOpen = controlled ? open : inner;\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const btnRef = React.useRef<HTMLButtonElement>(null);\n  const timer = React.useRef(0);\n  const menuId = React.useId();\n\n  React.useEffect(() => {\n    return () => window.clearTimeout(timer.current);\n  }, []);\n\n  function setOpen(next: boolean) {\n    if (!controlled) setInner(next);\n    onOpenChange?.(next);\n    window.clearTimeout(timer.current);\n    if (next) {\n      const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n      timer.current = window.setTimeout(\n        () => {\n          const first = rootRef.current?.querySelector<HTMLElement>(\".hb-qu4-link\");\n          first?.focus({ preventScroll: true });\n        },\n        reduce ? 0 : 520,\n      );\n    } else {\n      btnRef.current?.focus({ preventScroll: true });\n    }\n  }\n\n  function handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {\n    onKeyDown?.(e);\n    if (e.defaultPrevented || !isOpen) return;\n    if (e.key === \"Escape\") {\n      e.preventDefault();\n      setOpen(false);\n      return;\n    }\n    if (e.key !== \"Tab\") return;\n    const root = rootRef.current;\n    if (!root) return;\n    const nodes = Array.from(\n      root.querySelectorAll<HTMLElement>(\"button, a[href]\"),\n    ).filter((el) => !el.closest(\"[inert]\"));\n    if (nodes.length === 0) return;\n    const first = nodes[0];\n    const last = nodes[nodes.length - 1];\n    const active = document.activeElement;\n    if (e.shiftKey && (active === first || !root.contains(active))) {\n      e.preventDefault();\n      last.focus({ preventScroll: true });\n    } else if (!e.shiftKey && (active === last || !root.contains(active))) {\n      e.preventDefault();\n      first.focus({ preventScroll: true });\n    }\n  }\n\n  function renderLink(link: MenuLink, extra?: React.ReactNode, props?: React.AnchorHTMLAttributes<HTMLAnchorElement>) {\n    const href = link.href ?? \"#\";\n    return (\n      <a\n        href={href}\n        {...props}\n        onClick={(e) => {\n          if (href === \"#\") e.preventDefault();\n          link.onClick?.();\n          setOpen(false);\n        }}\n      >\n        {extra}\n      </a>\n    );\n  }\n\n  const vars = { \"--hb-qu4-a\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-menu-staggered\" precedence=\"default\">{css}</style>\n      <div\n        ref={rootRef}\n        data-open={isOpen}\n        data-side={side}\n        className={`hb-qu4 ${className}`}\n        style={vars}\n        onKeyDown={handleKeyDown}\n        {...rest}\n      >\n        <header className=\"hb-qu4-bar\">\n          <span className=\"hb-qu4-brand\">{brand}</span>\n          <button\n            ref={btnRef}\n            type=\"button\"\n            className=\"hb-qu4-btn\"\n            aria-expanded={isOpen}\n            aria-controls={menuId}\n            aria-label={isOpen ? \"Close menu\" : \"Open menu\"}\n            onClick={() => setOpen(!isOpen)}\n          >\n            <span className=\"hb-qu4-bar-line\" />\n            <span className=\"hb-qu4-bar-line\" />\n            <span className=\"hb-qu4-bar-line\" />\n          </button>\n        </header>\n        <div className=\"hb-qu4-page\" inert={isOpen}>\n          {children ?? (\n            <div className=\"hb-qu4-hero\">\n              <b>Spaces that feel lived in.</b>\n              <span>Interior studio, Copenhagen</span>\n            </div>\n          )}\n        </div>\n        <div className=\"hb-qu4-layer\" inert={!isOpen}>\n          <div className=\"hb-qu4-pn\" data-n=\"1\" aria-hidden=\"true\" />\n          <div className=\"hb-qu4-pn\" data-n=\"2\" aria-hidden=\"true\" />\n          <nav id={menuId} className=\"hb-qu4-pn\" data-n=\"3\" aria-label={menuLabel}>\n            <ul className=\"hb-qu4-list\">\n              {links.map((link, i) => (\n                <li key={`${link.label}-${i}`} className=\"hb-qu4-item\">\n                  {renderLink(\n                    link,\n                    <>\n                      <span className=\"hb-qu4-num\" style={{ \"--hb-qu4-i\": i } as React.CSSProperties}>\n                        {String(i + 1).padStart(2, \"0\")}\n                      </span>\n                      <span className=\"hb-qu4-clip\">\n                        <span className=\"hb-qu4-txt\" style={{ \"--hb-qu4-i\": i } as React.CSSProperties}>\n                          {link.label}\n                        </span>\n                      </span>\n                      <svg className=\"hb-qu4-ar\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <path d=\"M5 12h14M13 6l6 6-6 6\" />\n                      </svg>\n                    </>,\n                    { className: \"hb-qu4-link\" },\n                  )}\n                </li>\n              ))}\n            </ul>\n            {footer.length > 0 ? (\n              <div className=\"hb-qu4-foot\">\n                {footer.map((f, i) => (\n                  <React.Fragment key={`${f.label}-${i}`}>{renderLink(f, f.label)}</React.Fragment>\n                ))}\n              </div>\n            ) : null}\n          </nav>\n        </div>\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}