{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nav-card-expand",
  "type": "registry:component",
  "title": "Nav Card Expand",
  "description": "A compact top bar that unfolds downward into a card with three link cards and a call to action. The panel floats over the page, so nothing below it moves.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "components",
    "navbar",
    "menu",
    "expand",
    "card",
    "header",
    "navigation"
  ],
  "docs": "https://hyperblur.dev/effects/nav-card-expand",
  "files": [
    {
      "path": "registry/hyperblur/nav-card-expand.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/nav-card-expand.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavCardLink {\n  title: string;\n  description?: string;\n  href?: string;\n  icon?: React.ReactNode;\n}\n\nexport interface NavCardCta {\n  label: string;\n  href?: string;\n  onClick?: () => void;\n}\n\nexport interface NavCardExpandProps\n  extends Omit<React.HTMLAttributes<HTMLElement>, \"onChange\" | \"children\"> {\n  links?: NavCardLink[];\n  brand?: React.ReactNode;\n  cta?: NavCardCta;\n  note?: string;\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  accent?: string;\n  menuLabel?: string;\n}\n\nconst iconProps = {\n  width: 16,\n  height: 16,\n  viewBox: \"0 0 24 24\",\n  fill: \"none\",\n  stroke: \"currentColor\",\n  strokeWidth: 1.9,\n  strokeLinecap: \"round\" as const,\n  strokeLinejoin: \"round\" as const,\n  \"aria-hidden\": true,\n};\n\nconst defaultLinks: NavCardLink[] = [\n  {\n    title: \"Components\",\n    description: \"Buttons, menus and charts\",\n    href: \"#components\",\n    icon: (\n      <svg {...iconProps}>\n        <rect x=\"4\" y=\"4\" width=\"7\" height=\"7\" rx=\"1.5\" />\n        <rect x=\"13\" y=\"4\" width=\"7\" height=\"7\" rx=\"1.5\" />\n        <rect x=\"4\" y=\"13\" width=\"7\" height=\"7\" rx=\"1.5\" />\n        <rect x=\"13\" y=\"13\" width=\"7\" height=\"7\" rx=\"1.5\" />\n      </svg>\n    ),\n  },\n  {\n    title: \"Guides\",\n    description: \"Setup and theming\",\n    href: \"#guides\",\n    icon: (\n      <svg {...iconProps}>\n        <path d=\"M5 4h10a4 4 0 0 1 4 4v12H9a4 4 0 0 1-4-4V4z\" />\n        <path d=\"M9 9h6M9 13h4\" />\n      </svg>\n    ),\n  },\n  {\n    title: \"Templates\",\n    description: \"Full pages to start from\",\n    href: \"#templates\",\n    icon: (\n      <svg {...iconProps}>\n        <rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2.5\" />\n        <path d=\"M3 9h18M9 9v11\" />\n      </svg>\n    ),\n  },\n];\n\nconst css = `\n.hb-qu5 {\n  --hb-qu5-a: #2f7bff;\n  --hb-qu5-bar: 46px;\n  position: relative;\n  box-sizing: border-box;\n  display: block;\n  width: 100%;\n  height: var(--hb-qu5-bar);\n  font-family: inherit;\n  color: #ededed;\n  container-type: inline-size;\n  z-index: 20;\n}\n.hb-qu5 *, .hb-qu5 *::before, .hb-qu5 *::after { box-sizing: border-box; }\n.hb-qu5-card {\n  position: absolute;\n  left: 0;\n  right: 0;\n  top: 0;\n  overflow: hidden;\n  background: rgba(17, 17, 17, 0.88);\n  border: 1px solid #262626;\n  border-radius: 16px;\n  backdrop-filter: blur(14px);\n  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px rgba(0, 0, 0, 0.35);\n  transition: border-color 0.3s ease, box-shadow 0.4s ease;\n}\n.hb-qu5[data-open=\"true\"] .hb-qu5-card {\n  border-color: #333333;\n  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 24px 60px rgba(0, 0, 0, 0.55);\n}\n.hb-qu5-bar {\n  display: flex;\n  height: calc(var(--hb-qu5-bar) - 2px);\n  align-items: center;\n  justify-content: space-between;\n  padding: 0 7px 0 14px;\n}\n.hb-qu5-brand {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  font-size: 14px;\n  font-weight: 650;\n  letter-spacing: 0.005em;\n}\n.hb-qu5-mark {\n  display: block;\n  width: 16px;\n  height: 16px;\n  border-radius: 5px;\n  background: linear-gradient(135deg, #7fb3ff, var(--hb-qu5-a));\n  transform: rotate(-12deg);\n}\n.hb-qu5-btn {\n  display: inline-flex;\n  height: 32px;\n  align-items: center;\n  gap: 8px;\n  margin: 0;\n  padding: 0 12px 0 14px;\n  font: inherit;\n  font-size: 12px;\n  font-weight: 600;\n  color: #ededed;\n  background: rgba(255, 255, 255, 0.06);\n  border: 1px solid rgba(255, 255, 255, 0.1);\n  border-radius: 999px;\n  cursor: pointer;\n  transition: background 0.2s ease, border-color 0.2s ease;\n}\n.hb-qu5-btn:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.24); }\n.hb-qu5-btn:focus-visible, .hb-qu5-link:focus-visible, .hb-qu5-cta:focus-visible {\n  outline: 2px solid var(--hb-qu5-a);\n  outline-offset: 2px;\n}\n.hb-qu5-lbl { display: grid; }\n.hb-qu5-lbl > span { grid-area: 1 / 1; transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }\n.hb-qu5-lbl > span:last-child { opacity: 0; transform: translateY(6px); }\n.hb-qu5[data-open=\"true\"] .hb-qu5-lbl > span:first-child { opacity: 0; transform: translateY(-6px); }\n.hb-qu5[data-open=\"true\"] .hb-qu5-lbl > span:last-child { opacity: 1; transform: none; }\n.hb-qu5-ico { position: relative; display: block; width: 14px; height: 14px; }\n.hb-qu5-ico i {\n  position: absolute;\n  left: 0;\n  top: 50%;\n  width: 14px;\n  height: 1.8px;\n  margin-top: -0.9px;\n  border-radius: 2px;\n  background: currentColor;\n  transition: transform 0.4s cubic-bezier(0.76, 0, 0.24, 1);\n}\n.hb-qu5-ico i:first-child { transform: translateY(-3px); }\n.hb-qu5-ico i:last-child { transform: translateY(3px); }\n.hb-qu5[data-open=\"true\"] .hb-qu5-ico i:first-child { transform: rotate(45deg); }\n.hb-qu5[data-open=\"true\"] .hb-qu5-ico i:last-child { transform: rotate(-45deg); }\n.hb-qu5-wrap {\n  display: grid;\n  grid-template-rows: 0fr;\n  transition: grid-template-rows 0.55s cubic-bezier(0.32, 0.72, 0, 1);\n}\n.hb-qu5[data-open=\"true\"] .hb-qu5-wrap { grid-template-rows: 1fr; }\n.hb-qu5-inner { min-height: 0; overflow: hidden; }\n.hb-qu5-body { padding: 2px 8px 8px; }\n.hb-qu5-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }\n.hb-qu5-li {\n  opacity: 0;\n  transform: translateY(10px);\n  transition: opacity 0.3s ease, transform 0.3s ease;\n}\n.hb-qu5[data-open=\"true\"] .hb-qu5-li {\n  opacity: 1;\n  transform: none;\n  transition: opacity 0.5s ease calc(0.14s + var(--hb-qu5-i) * 0.06s), transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) calc(0.14s + var(--hb-qu5-i) * 0.06s);\n}\n.hb-qu5-link {\n  position: relative;\n  display: flex;\n  height: 100%;\n  min-height: 70px;\n  flex-direction: column;\n  gap: 2px;\n  padding: 8px 8px 7px;\n  color: inherit;\n  text-decoration: none;\n  background: #171717;\n  border: 1px solid #232323;\n  border-radius: 12px;\n  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;\n}\n.hb-qu5-link:hover { background: #1c1c1c; border-color: color-mix(in srgb, var(--hb-qu5-a) 60%, #232323); transform: translateY(-1px); }\n.hb-qu5-tile {\n  display: grid;\n  width: 22px;\n  height: 22px;\n  place-items: center;\n  margin-bottom: 4px;\n  color: #7fb3ff;\n  background: color-mix(in srgb, var(--hb-qu5-a) 16%, transparent);\n  border-radius: 8px;\n}\n.hb-qu5-t { font-size: 12px; font-weight: 600; line-height: 1.2; }\n.hb-qu5-d {\n  display: -webkit-box;\n  overflow: hidden;\n  -webkit-box-orient: vertical;\n  -webkit-line-clamp: 2;\n  font-size: 10.5px;\n  line-height: 1.3;\n  color: #8f8f8f;\n}\n.hb-qu5-ar {\n  position: absolute;\n  right: 7px;\n  top: 8px;\n  color: #7fb3ff;\n  opacity: 0;\n  transform: translate(-4px, 4px);\n  transition: opacity 0.2s ease, transform 0.2s ease;\n}\n.hb-qu5-link:hover .hb-qu5-ar, .hb-qu5-link:focus-visible .hb-qu5-ar { opacity: 1; transform: none; }\n.hb-qu5-foot {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 10px;\n  margin-top: 8px;\n  padding: 0 2px 0 4px;\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n.hb-qu5[data-open=\"true\"] .hb-qu5-foot { opacity: 1; transition: opacity 0.5s ease 0.34s; }\n.hb-qu5-note { min-width: 0; overflow: hidden; font-size: 11px; color: #8f8f8f; text-overflow: ellipsis; white-space: nowrap; }\n.hb-qu5-cta {\n  display: inline-flex;\n  flex: none;\n  height: 28px;\n  align-items: center;\n  padding: 0 14px;\n  font-size: 12px;\n  font-weight: 650;\n  color: #0a0a0a;\n  text-decoration: none;\n  background: #ededed;\n  border-radius: 999px;\n  transition: background 0.2s ease, transform 0.2s ease;\n}\n.hb-qu5-cta:hover { background: #ffffff; }\n.hb-qu5-cta:active { transform: scale(0.96); }\n@container (max-width: 279px) {\n  .hb-qu5-grid { grid-template-columns: minmax(0, 1fr); }\n  .hb-qu5-link { min-height: 0; flex-direction: row; align-items: center; gap: 10px; }\n  .hb-qu5-tile { flex: none; margin-bottom: 0; }\n  .hb-qu5-d { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qu5-wrap, .hb-qu5-li, .hb-qu5-lbl > span, .hb-qu5-ico i, .hb-qu5-foot, .hb-qu5-link, .hb-qu5-card {\n    transition: none !important;\n  }\n}\n`;\n\nexport function NavCardExpand({\n  links = defaultLinks,\n  brand = \"Northlight\",\n  cta = { label: \"Get started\", href: \"#start\" },\n  note = \"New: dark mode tokens\",\n  open,\n  defaultOpen = false,\n  onOpenChange,\n  accent = \"#2f7bff\",\n  menuLabel = \"Primary\",\n  className = \"\",\n  style,\n  onKeyDown,\n  ...rest\n}: NavCardExpandProps) {\n  const controlled = open !== undefined;\n  const [inner, setInner] = React.useState(defaultOpen);\n  const isOpen = controlled ? open : inner;\n  const rootRef = React.useRef<HTMLElement>(null);\n  const btnRef = React.useRef<HTMLButtonElement>(null);\n  const panelId = React.useId();\n  const closeRef = React.useRef<() => void>(() => undefined);\n\n  function setOpen(next: boolean) {\n    if (!controlled) setInner(next);\n    onOpenChange?.(next);\n  }\n\n  React.useEffect(() => {\n    closeRef.current = () => setOpen(false);\n  });\n\n  React.useEffect(() => {\n    if (!isOpen) return;\n    function onDown(e: PointerEvent) {\n      const root = rootRef.current;\n      if (root && !root.contains(e.target as Node)) closeRef.current();\n    }\n    document.addEventListener(\"pointerdown\", onDown);\n    return () => document.removeEventListener(\"pointerdown\", onDown);\n  }, [isOpen]);\n\n  function handleKeyDown(e: React.KeyboardEvent<HTMLElement>) {\n    onKeyDown?.(e);\n    if (e.defaultPrevented || !isOpen) return;\n    if (e.key === \"Escape\") {\n      e.preventDefault();\n      setOpen(false);\n      btnRef.current?.focus({ preventScroll: true });\n      return;\n    }\n    const keys = [\"ArrowRight\", \"ArrowDown\", \"ArrowLeft\", \"ArrowUp\"];\n    if (!keys.includes(e.key)) return;\n    const root = rootRef.current;\n    if (!root) return;\n    const nodes = Array.from(root.querySelectorAll<HTMLElement>(\".hb-qu5-link, .hb-qu5-cta\"));\n    const at = nodes.indexOf(document.activeElement as HTMLElement);\n    if (at < 0) return;\n    e.preventDefault();\n    const dir = e.key === \"ArrowRight\" || e.key === \"ArrowDown\" ? 1 : -1;\n    nodes[(at + dir + nodes.length) % nodes.length].focus({ preventScroll: true });\n  }\n\n  const vars = { \"--hb-qu5-a\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-nav-card-expand\" precedence=\"default\">{css}</style>\n      <nav\n        ref={rootRef}\n        aria-label={menuLabel}\n        data-open={isOpen}\n        className={`hb-qu5 ${className}`}\n        style={vars}\n        onKeyDown={handleKeyDown}\n        {...rest}\n      >\n        <div className=\"hb-qu5-card\">\n          <div className=\"hb-qu5-bar\">\n            <span className=\"hb-qu5-brand\">\n              <span className=\"hb-qu5-mark\" aria-hidden=\"true\" />\n              {brand}\n            </span>\n            <button\n              ref={btnRef}\n              type=\"button\"\n              className=\"hb-qu5-btn\"\n              aria-expanded={isOpen}\n              aria-controls={panelId}\n              aria-label={isOpen ? \"Close menu\" : \"Open menu\"}\n              onClick={() => setOpen(!isOpen)}\n            >\n              <span className=\"hb-qu5-lbl\" aria-hidden=\"true\">\n                <span>Menu</span>\n                <span>Close</span>\n              </span>\n              <span className=\"hb-qu5-ico\" aria-hidden=\"true\">\n                <i />\n                <i />\n              </span>\n            </button>\n          </div>\n          <div id={panelId} className=\"hb-qu5-wrap\" inert={!isOpen}>\n            <div className=\"hb-qu5-inner\">\n              <div className=\"hb-qu5-body\">\n                <ul className=\"hb-qu5-grid\">\n                  {links.map((link, i) => (\n                    <li\n                      key={`${link.title}-${i}`}\n                      className=\"hb-qu5-li\"\n                      style={{ \"--hb-qu5-i\": i } as React.CSSProperties}\n                    >\n                      <a\n                        href={link.href ?? \"#\"}\n                        className=\"hb-qu5-link\"\n                        onClick={(e) => {\n                          if (!link.href || link.href === \"#\") e.preventDefault();\n                          setOpen(false);\n                        }}\n                      >\n                        {link.icon ? <span className=\"hb-qu5-tile\">{link.icon}</span> : null}\n                        <span className=\"hb-qu5-t\">{link.title}</span>\n                        {link.description ? <span className=\"hb-qu5-d\">{link.description}</span> : null}\n                        <svg className=\"hb-qu5-ar\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                          <path d=\"M7 17L17 7M9 7h8v8\" />\n                        </svg>\n                      </a>\n                    </li>\n                  ))}\n                </ul>\n                <div className=\"hb-qu5-foot\">\n                  <span className=\"hb-qu5-note\">{note}</span>\n                  {cta ? (\n                    <a\n                      className=\"hb-qu5-cta\"\n                      href={cta.href ?? \"#\"}\n                      onClick={(e) => {\n                        if (!cta.href || cta.href === \"#\") e.preventDefault();\n                        cta.onClick?.();\n                        setOpen(false);\n                      }}\n                    >\n                      {cta.label}\n                    </a>\n                  ) : null}\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </nav>\n    </>\n  );\n}\n"
    }
  ]
}