{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-scroll-shrink",
  "type": "registry:component",
  "title": "Navbar Scroll Shrink",
  "description": "An editorial masthead with a utility row, a large centered wordmark and a sections row that folds into a floating compact bar on scroll. The wordmark glides to the left, the sections rise into the same row and a ring around search tracks reading progress.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "navigation",
    "navbar",
    "scroll",
    "shrink",
    "masthead",
    "editorial",
    "progress"
  ],
  "docs": "https://hyperblur.dev/effects/navbar-scroll-shrink",
  "files": [
    {
      "path": "registry/hyperblur/navbar-scroll-shrink.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/navbar-scroll-shrink.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavbarScrollShrinkLink {\n  label: string;\n  href: string;\n}\n\nexport interface NavbarScrollShrinkProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n  brand?: string;\n  edition?: string;\n  links?: NavbarScrollShrinkLink[];\n  active?: number;\n  defaultActive?: number;\n  onActiveChange?: (index: number) => void;\n  utility?: NavbarScrollShrinkLink[];\n  cta?: { label: string; href: string } | null;\n  compact?: boolean;\n  onCompactChange?: (compact: boolean) => void;\n  threshold?: number;\n  progress?: number;\n  sticky?: boolean;\n  accent?: string;\n  showBackdrop?: boolean;\n}\n\nconst css = `\n.hb-xi5 {\n  --hb-xi5-accent: #d4ff3f;\n  --hb-xi5-p: 0;\n  --hb-xi5-ease: cubic-bezier(.22,1,.36,1);\n  position: relative;\n  z-index: 40;\n  box-sizing: border-box;\n  width: 100%;\n  height: 140px;\n  container-type: inline-size;\n  color: #f1f0ea;\n  font-family: inherit;\n  pointer-events: none;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-xi5[data-sticky=\"true\"] { position: sticky; top: 0; }\n.hb-xi5 *, .hb-xi5 *::before, .hb-xi5 *::after { box-sizing: border-box; }\n.hb-xi5-shell {\n  position: relative;\n  height: 140px;\n  margin: 0;\n  border-radius: 0;\n  background: #0e0e0c;\n  box-shadow: 0 1px 0 rgba(241,240,234,.08);\n  pointer-events: auto;\n  transition: height .6s var(--hb-xi5-ease), margin .6s var(--hb-xi5-ease), border-radius .6s var(--hb-xi5-ease), background-color .4s ease, box-shadow .6s ease;\n}\n.hb-xi5[data-compact=\"true\"] .hb-xi5-shell {\n  height: 60px;\n  margin: 10px 16px 0;\n  border-radius: 16px;\n  background: rgba(22,22,19,.86);\n  -webkit-backdrop-filter: blur(16px) saturate(1.4);\n  backdrop-filter: blur(16px) saturate(1.4);\n  box-shadow: 0 0 0 1px rgba(241,240,234,.08) inset, 0 1px 0 rgba(255,255,255,.06) inset, 0 20px 40px -16px rgba(0,0,0,.7);\n}\n.hb-xi5-in { position: relative; max-width: 1160px; height: 100%; margin: 0 auto; }\n.hb-xi5-util {\n  position: absolute;\n  top: 0;\n  left: 24px;\n  right: 24px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  height: 34px;\n  border-bottom: 1px solid rgba(241,240,234,.08);\n  color: rgba(241,240,234,.5);\n  font-size: 12px;\n  transition: opacity .3s ease, transform .5s var(--hb-xi5-ease), visibility 0s linear 0s;\n}\n.hb-xi5-util b { color: var(--hb-xi5-accent); font-weight: 600; }\n.hb-xi5-util nav { display: flex; gap: 18px; }\n.hb-xi5-util a { color: inherit; text-decoration: none; transition: color .2s ease; }\n.hb-xi5-util a:hover { color: #f1f0ea; }\n.hb-xi5[data-compact=\"true\"] .hb-xi5-util { opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity .2s ease, transform .4s var(--hb-xi5-ease), visibility 0s linear .4s; }\n.hb-xi5-word {\n  position: absolute;\n  top: 46px;\n  left: 50%;\n  display: block;\n  color: #f1f0ea;\n  font-family: var(--font-grotesk, var(--font-sans, ui-sans-serif, system-ui, sans-serif));\n  font-size: 44px;\n  font-weight: 700;\n  line-height: 44px;\n  letter-spacing: -.05em;\n  white-space: nowrap;\n  text-decoration: none;\n  transform: translateX(-50%) scale(1);\n  transform-origin: 0 0;\n  transition: top .6s var(--hb-xi5-ease), left .6s var(--hb-xi5-ease), transform .6s var(--hb-xi5-ease);\n  border-radius: 6px;\n}\n.hb-xi5-word span { color: var(--hb-xi5-accent); }\n.hb-xi5[data-compact=\"true\"] .hb-xi5-word { top: 18px; left: 24px; transform: translateX(0) scale(.55); }\n.hb-xi5-side { position: absolute; top: 52px; left: 24px; display: flex; flex-direction: column; gap: 2px; color: rgba(241,240,234,.55); font-size: 12px; line-height: 1.4; transition: opacity .3s ease, transform .5s var(--hb-xi5-ease); }\n.hb-xi5-side strong { color: #f1f0ea; font-size: 13px; font-weight: 600; }\n.hb-xi5[data-compact=\"true\"] .hb-xi5-side { opacity: 0; transform: translateY(-8px); pointer-events: none; }\n.hb-xi5-links { position: absolute; top: 96px; left: 50%; display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; transform: translateX(-50%); transition: top .6s var(--hb-xi5-ease); }\n.hb-xi5[data-compact=\"true\"] .hb-xi5-links { top: 12px; }\n.hb-xi5-link { display: inline-flex; align-items: center; height: 36px; padding: 0 13px; border-radius: 9px; color: rgba(241,240,234,.62); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; transition: color .2s ease, background-color .2s ease; }\n.hb-xi5-link:hover { color: #f1f0ea; background: rgba(241,240,234,.06); }\n.hb-xi5-link[aria-current=\"page\"] { color: #0e0e0c; background: var(--hb-xi5-accent); }\n.hb-xi5-act { position: absolute; top: 48px; right: 24px; display: flex; align-items: center; gap: 8px; transition: top .6s var(--hb-xi5-ease); }\n.hb-xi5[data-compact=\"true\"] .hb-xi5-act { top: 10px; }\n.hb-xi5-icon { display: grid; place-items: center; width: 40px; height: 40px; margin: 0; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #f1f0ea; cursor: pointer; transition: background-color .2s ease; }\n.hb-xi5-icon:hover { background: rgba(241,240,234,.07); }\n.hb-xi5-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }\n.hb-xi5-ring { position: relative; }\n.hb-xi5-ring svg.hb-xi5-prog { position: absolute; inset: 2px; width: 36px; height: 36px; transform: rotate(-90deg); opacity: 0; transition: opacity .4s ease; }\n.hb-xi5-prog circle { fill: none; stroke-width: 2; }\n.hb-xi5-prog circle + circle { stroke: var(--hb-xi5-accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--hb-xi5-p) * 100); transition: stroke-dashoffset .15s linear; }\n.hb-xi5[data-compact=\"true\"] .hb-xi5-ring svg.hb-xi5-prog { opacity: 1; }\n.hb-xi5-cta { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: 999px; background: #f1f0ea; color: #0e0e0c; font-size: 14px; font-weight: 600; text-decoration: none; box-shadow: 0 1px 0 #fff inset; transition: transform .2s var(--hb-xi5-ease), background-color .2s ease; }\n.hb-xi5-cta:hover { background: var(--hb-xi5-accent); }\n.hb-xi5-cta:active { transform: scale(.97); }\n.hb-xi5-burger { position: absolute; top: 32px; left: 12px; display: none; transition: top .6s var(--hb-xi5-ease); }\n.hb-xi5-burger span { position: relative; display: block; width: 18px; height: 12px; }\n.hb-xi5-burger span::before, .hb-xi5-burger span::after, .hb-xi5-burger span i { content: \"\"; position: absolute; left: 0; height: 1.8px; border-radius: 2px; background: currentColor; transition: transform .4s var(--hb-xi5-ease), opacity .2s ease, width .4s var(--hb-xi5-ease); }\n.hb-xi5-burger span::before { top: 0; width: 18px; }\n.hb-xi5-burger span i { top: 5px; width: 12px; font-style: normal; }\n.hb-xi5-burger span::after { top: 10px; width: 15px; }\n.hb-xi5-burger[aria-expanded=\"true\"] span::before { width: 18px; transform: translateY(5px) rotate(45deg); }\n.hb-xi5-burger[aria-expanded=\"true\"] span i { opacity: 0; }\n.hb-xi5-burger[aria-expanded=\"true\"] span::after { width: 18px; transform: translateY(-5px) rotate(-45deg); }\n.hb-xi5-sheet { display: none; }\n.hb-xi5 a:focus-visible, .hb-xi5 button:focus-visible { outline: 2px solid var(--hb-xi5-accent); outline-offset: 2px; }\n.hb-xi5-wrap { position: relative; background: #0e0e0c; }\n.hb-xi5-stage { position: relative; height: 580px; overflow: hidden; background: #0e0e0c; color: #f1f0ea; container-type: inline-size; }\n.hb-xi5-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; max-width: 1160px; margin: 0 auto; padding: 26px 24px 0; }\n.hb-xi5-lead { height: 300px; border-radius: 18px; background: radial-gradient(120% 90% at 20% 10%, #f7c873, transparent 55%), radial-gradient(90% 80% at 90% 90%, #2f6b5a, transparent 60%), linear-gradient(160deg, #a2512f, #1b2b26); }\n.hb-xi5-kick { margin-top: 20px; color: var(--hb-xi5-accent); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }\n.hb-xi5-h { margin: 10px 0 0; font-family: var(--font-grotesk, var(--font-sans, ui-sans-serif, system-ui, sans-serif)); font-size: clamp(26px, 3.6cqi, 40px); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; }\n.hb-xi5-list { display: grid; gap: 18px; align-content: start; }\n.hb-xi5-item { display: grid; grid-template-columns: 84px 1fr; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid rgba(241,240,234,.08); }\n.hb-xi5-item span { height: 64px; border-radius: 10px; }\n.hb-xi5-item b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }\n.hb-xi5-item small { display: block; margin-top: 6px; color: rgba(241,240,234,.45); font-size: 12px; }\n@keyframes hb-xi5-sheet { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }\n@container (max-width: 900px) {\n  .hb-xi5, .hb-xi5-shell { height: 104px; }\n  .hb-xi5[data-compact=\"true\"] .hb-xi5-shell { height: 56px; margin: 8px 10px 0; }\n  .hb-xi5-util, .hb-xi5-side, .hb-xi5-links, .hb-xi5-cta { display: none; }\n  .hb-xi5-burger { display: grid; }\n  .hb-xi5-word { top: 30px; transform: translateX(-50%) scale(.72); transform-origin: 50% 0; }\n  .hb-xi5[data-compact=\"true\"] .hb-xi5-word { top: 13px; left: 50%; transform: translateX(-50%) scale(.5); }\n  .hb-xi5[data-compact=\"true\"] .hb-xi5-burger { top: 8px; }\n  .hb-xi5-act { top: 32px; right: 12px; gap: 0; }\n  .hb-xi5[data-compact=\"true\"] .hb-xi5-act { top: 8px; }\n  .hb-xi5-sheet[data-open=\"true\"] { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 14px 16px; border-top: 1px solid rgba(241,240,234,.08); background: #0e0e0c; box-shadow: 0 24px 40px -20px rgba(0,0,0,.8); animation: hb-xi5-sheet .35s var(--hb-xi5-ease) both; }\n  .hb-xi5[data-compact=\"true\"] .hb-xi5-sheet[data-open=\"true\"] { border-radius: 0 0 16px 16px; background: #161613; }\n  .hb-xi5-sheet a { display: flex; align-items: center; height: 44px; padding: 0 14px; border-radius: 10px; background: rgba(241,240,234,.05); color: #f1f0ea; font-size: 14px; font-weight: 500; text-decoration: none; }\n  .hb-xi5-sheet a[aria-current=\"page\"] { background: var(--hb-xi5-accent); color: #0e0e0c; }\n  .hb-xi5-sheet .hb-xi5-sheet-wide { grid-column: 1 / -1; justify-content: center; background: #f1f0ea; color: #0e0e0c; font-weight: 600; }\n  .hb-xi5-grid { grid-template-columns: 1fr; }\n  .hb-xi5-list { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-xi5 *, .hb-xi5 *::before, .hb-xi5 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst defaultLinks: NavbarScrollShrinkLink[] = [\n  { label: \"Field guides\", href: \"#\" },\n  { label: \"Gear\", href: \"#\" },\n  { label: \"Routes\", href: \"#\" },\n  { label: \"Essays\", href: \"#\" },\n  { label: \"Photo\", href: \"#\" },\n];\n\nconst defaultUtility: NavbarScrollShrinkLink[] = [\n  { label: \"Shop prints\", href: \"#\" },\n  { label: \"Newsletter\", href: \"#\" },\n  { label: \"Log in\", href: \"#\" },\n];\n\nexport function NavbarScrollShrink({\n  brand = \"Northbound\",\n  edition = \"Issue 48 · The winter field guide\",\n  links = defaultLinks,\n  active,\n  defaultActive = 0,\n  onActiveChange,\n  utility = defaultUtility,\n  cta = { label: \"Subscribe\", href: \"#\" },\n  compact,\n  onCompactChange,\n  threshold = 80,\n  progress,\n  sticky = true,\n  accent = \"#d4ff3f\",\n  showBackdrop = true,\n  className = \"\",\n  style,\n  ...rest\n}: NavbarScrollShrinkProps) {\n  const uid = React.useId();\n  const rootRef = React.useRef<HTMLElement>(null);\n  const [inner, setInner] = React.useState(defaultActive);\n  const [scrolled, setScrolled] = React.useState(false);\n  const [open, setOpen] = React.useState(false);\n  const current = active ?? inner;\n  const isCompact = compact ?? scrolled;\n  const notify = React.useRef(onCompactChange);\n\n  React.useEffect(() => {\n    notify.current = onCompactChange;\n  }, [onCompactChange]);\n\n  React.useEffect(() => {\n    if (compact !== undefined && progress !== undefined) return;\n    let frame = 0;\n    let last = window.scrollY > threshold;\n    const update = () => {\n      frame = 0;\n      const y = window.scrollY;\n      const next = last ? y > threshold * 0.5 : y > threshold;\n      if (next !== last) {\n        last = next;\n        if (compact === undefined) setScrolled(next);\n        notify.current?.(next);\n      }\n      if (progress === undefined && rootRef.current) {\n        const max = document.documentElement.scrollHeight - window.innerHeight;\n        rootRef.current.style.setProperty(\"--hb-xi5-p\", (max > 0 ? Math.min(1, y / max) : 0).toFixed(4));\n      }\n    };\n    const onScroll = () => {\n      if (!frame) frame = window.requestAnimationFrame(update);\n    };\n    frame = window.requestAnimationFrame(update);\n    window.addEventListener(\"scroll\", onScroll, { passive: true });\n    return () => {\n      window.cancelAnimationFrame(frame);\n      window.removeEventListener(\"scroll\", onScroll);\n    };\n  }, [compact, progress, threshold]);\n\n  const select = (i: number) => {\n    if (active === undefined) setInner(i);\n    onActiveChange?.(i);\n    setOpen(false);\n  };\n\n  const word = (\n    <>\n      {brand}\n      <span>.</span>\n    </>\n  );\n\n  const header = (\n    <header\n      ref={rootRef}\n      className={`hb-xi5 ${className}`}\n      data-compact={isCompact ? \"true\" : \"false\"}\n      data-sticky={sticky && !showBackdrop ? \"true\" : \"false\"}\n      style={\n        {\n          \"--hb-xi5-accent\": accent,\n          ...(progress !== undefined ? { \"--hb-xi5-p\": Math.min(1, Math.max(0, progress)).toFixed(4) } : {}),\n          ...style,\n        } as React.CSSProperties\n      }\n      onKeyDown={(e) => {\n        if (e.key === \"Escape\" && open) setOpen(false);\n      }}\n      {...rest}\n    >\n      <style href=\"hb-navbar-scroll-shrink\" precedence=\"default\">\n        {css}\n      </style>\n      <div className=\"hb-xi5-shell\">\n        <div className=\"hb-xi5-in\">\n          <div className=\"hb-xi5-util\">\n            <span>\n              <b>New</b> {edition}\n            </span>\n            <nav aria-label=\"Utility\">\n              {utility.map((u) => (\n                <a key={u.label} href={u.href}>\n                  {u.label}\n                </a>\n              ))}\n            </nav>\n          </div>\n          <div className=\"hb-xi5-side\" aria-hidden=\"true\">\n            <strong>Saturday edition</strong>\n            <span>12 new stories this week</span>\n          </div>\n          <a href=\"#\" className=\"hb-xi5-word\" aria-label={`${brand} home`}>\n            {word}\n          </a>\n          <nav aria-label=\"Sections\">\n            <ul className=\"hb-xi5-links\">\n              {links.map((link, i) => (\n                <li key={link.label}>\n                  <a href={link.href} className=\"hb-xi5-link\" aria-current={i === current ? \"page\" : undefined} onClick={() => select(i)}>\n                    {link.label}\n                  </a>\n                </li>\n              ))}\n            </ul>\n          </nav>\n          <button\n            type=\"button\"\n            className=\"hb-xi5-icon hb-xi5-burger\"\n            aria-label={open ? \"Close sections\" : \"Open sections\"}\n            aria-expanded={open}\n            aria-controls={`${uid}-sheet`}\n            onClick={() => setOpen((v) => !v)}\n          >\n            <span aria-hidden=\"true\">\n              <i />\n            </span>\n          </button>\n          <div className=\"hb-xi5-act\">\n            <span className=\"hb-xi5-ring\">\n              <button type=\"button\" className=\"hb-xi5-icon\" aria-label=\"Search stories\">\n                <svg viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n                  <circle cx=\"8\" cy=\"8\" r=\"5\" />\n                  <path d=\"M12 12l3.5 3.5\" />\n                </svg>\n              </button>\n              <svg className=\"hb-xi5-prog\" viewBox=\"0 0 36 36\" aria-hidden=\"true\">\n                <circle cx=\"18\" cy=\"18\" r=\"16\" stroke=\"rgba(241,240,234,.12)\" />\n                <circle cx=\"18\" cy=\"18\" r=\"16\" pathLength={100} />\n              </svg>\n            </span>\n            {cta && (\n              <a href={cta.href} className=\"hb-xi5-cta\">\n                {cta.label}\n              </a>\n            )}\n          </div>\n        </div>\n        <div id={`${uid}-sheet`} className=\"hb-xi5-sheet\" data-open={open ? \"true\" : \"false\"}>\n          {links.map((link, i) => (\n            <a key={link.label} href={link.href} aria-current={i === current ? \"page\" : undefined} onClick={() => select(i)}>\n              {link.label}\n            </a>\n          ))}\n          {utility.map((u) => (\n            <a key={u.label} href={u.href} onClick={() => setOpen(false)}>\n              {u.label}\n            </a>\n          ))}\n          {cta && (\n            <a href={cta.href} className=\"hb-xi5-sheet-wide\" onClick={() => setOpen(false)}>\n              {cta.label}\n            </a>\n          )}\n        </div>\n      </div>\n    </header>\n  );\n\n  if (!showBackdrop) return header;\n\n  return (\n    <div className=\"hb-xi5-wrap\">\n      {header}\n      <div className=\"hb-xi5-stage\" aria-hidden=\"true\">\n        <div className=\"hb-xi5-grid\">\n          <div>\n            <div className=\"hb-xi5-lead\" />\n            <div className=\"hb-xi5-kick\">Routes · 14 min read</div>\n            <h2 className=\"hb-xi5-h\">Four days on the Kungsleden with a 6 kg pack and no regrets</h2>\n          </div>\n          <div className=\"hb-xi5-list\">\n            <div className=\"hb-xi5-item\">\n              <span style={{ background: \"linear-gradient(140deg, #5b7fa6, #1d2a3a)\" }} />\n              <div>\n                <b>The only three layers you need below freezing</b>\n                <small>Gear · 6 min</small>\n              </div>\n            </div>\n            <div className=\"hb-xi5-item\">\n              <span style={{ background: \"linear-gradient(140deg, #c9a46a, #3d2a17)\" }} />\n              <div>\n                <b>Reading the snowpack before you commit to a line</b>\n                <small>Field guides · 9 min</small>\n              </div>\n            </div>\n            <div className=\"hb-xi5-item\">\n              <span style={{ background: \"linear-gradient(140deg, #7aa58a, #1c3328)\" }} />\n              <div>\n                <b>Why we stopped chasing summits in December</b>\n                <small>Essays · 11 min</small>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}