{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar",
  "title": "Navbar",
  "author": "AlgorizeTech",
  "description": "Ask the user to pick one of 7 navbar variants: https://avaraui.com/view/navbar. This item holds 7 of them as looks of one component (default, centered, minimal, glass, floating, spotlight, ecommerce-mega-nav). Skip the question if the user already named one. A responsive marketing navbar with logo, links, mobile menu and GSAP entrance animation. Use it as the top bar of a landing page.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://avaraui.com/r/button.json",
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/NavbarBlock.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport {\n  ArrowRight,\n  BadgePercent,\n  ChevronDown,\n  Command,\n  Heart,\n  Menu,\n  Plus,\n  Search,\n  ShoppingBag,\n  Star,\n  Truck,\n  User,\n  X,\n} from \"lucide-react\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport Button from \"./Button\";\nimport { getThemeStyles } from \"./navbar-theme\";\n\nexport type NavbarColor =\n  | \"primary\"\n  | \"indigo\"\n  | \"rose\"\n  | \"emerald\"\n  | \"zinc\"\n  | (string & {});\n\nexport type NavbarVariant =\n  | \"default\"\n  | \"floating\"\n  | \"centered\"\n  | \"minimal\"\n  | \"glass\"\n  | \"spotlight\"\n  | \"ecommerce-mega-nav\";\n\nexport interface NavbarProps {\n  variant?: NavbarVariant;\n  color?: NavbarColor;\n  logoText?: string;\n  /**\n   * The element used for links. Defaults to a plain `a`, so this component works\n   * in any React app with no adaptation. In Next.js, pass `next/link` to keep\n   * client-side navigation and prefetching: `linkComponent={Link}`.\n   */\n  linkComponent?: React.ElementType;\n}\n\nconst NAV_LINKS = [\n  { name: \"Products\", href: \"#\", hasDropdown: true },\n  { name: \"Solutions\", href: \"#\", hasDropdown: false },\n  { name: \"Resources\", href: \"#\", hasDropdown: true },\n  { name: \"Pricing\", href: \"#\", hasDropdown: false },\n];\n\n// Mobile menu motion. Opening fades the overlay in (0.3s power2.out) and\n// slides the menu in from the right (0.4s power3.out); closing reverses both in\n// 0.3s (power2.in / power3.in). A transition takes its timing from the state it\n// is heading to, so each state carries its own; @starting-style is where the\n// layer starts when it stops being display:none.\nconst POWER3_OUT =\n  \"linear(0, .1268, .2412, .3439, .4358, .5177, .5904, .6545, .7108, .7599, .8025, .8391, .8704, .8969, .9191, .9375, .9526, .9647, .9744, .9819, .9877, .9919, .9949, .997, .9984, .9992, .9997, .9999, 1, 1, 1)\";\nconst POWER3_IN =\n  \"linear(0, 0, 0, .0001, .0003, .0008, .0016, .003, .0051, .0081, .0123, .0181, .0256, .0353, .0474, .0625, .0809, .1031, .1296, .1609, .1975, .2401, .2892, .3455, .4096, .4823, .5642, .6561, .7588, .8732, 1)\";\n\nconst MOBILE_MENU_CSS = `\n.navbar-mobile-overlay {\n  opacity: 0;\n  transition: opacity 0.3s cubic-bezier(0.3333, 0, 0.6667, 0);\n}\n.navbar-mobile-overlay[data-open=\"true\"] {\n  opacity: 1;\n  transition: opacity 0.3s cubic-bezier(0.3333, 1, 0.6667, 1);\n}\n.navbar-mobile-menu {\n  transform: translateX(100%);\n  transition: transform 0.3s ${POWER3_IN};\n}\n.navbar-mobile-menu[data-open=\"true\"] {\n  transform: none;\n  transition: transform 0.4s ${POWER3_OUT};\n}\n@starting-style {\n  .navbar-mobile-overlay[data-open=\"true\"] { opacity: 0; }\n  .navbar-mobile-menu[data-open=\"true\"] { transform: translateX(100%); }\n}\n`;\n\n/**\n * These three are defined at module scope on purpose. Declaring them inside\n * NavbarBlock would make each a new component type on every render, remounting\n * the header and dropping any open dropdown or focus.\n */\nfunction Logo({\n  themeBg,\n  logoText,\n  linkComponent: Link,\n}: {\n  themeBg: string;\n  logoText: string;\n  linkComponent: React.ElementType;\n}) {\n  return (\n    <Link href=\"#\" className=\"flex items-center gap-2 group\">\n      <div\n        className={cn(\n          \"w-8 h-8 rounded-lg flex items-center justify-center transition-transform group-hover:scale-105\",\n          themeBg,\n        )}\n      >\n        {/* No hardcoded colour: theme.bg above already carries the correct\n            contrasting foreground for every theme, including a white pick. */}\n        <Command className=\"w-4 h-4\" />\n      </div>\n      <span className=\"font-bold text-xl tracking-tight text-foreground\">\n        {logoText}\n      </span>\n    </Link>\n  );\n\n}\n\nfunction DesktopLinks({\n  isGlass,\n  linkComponent: Link,\n}: {\n  isGlass: boolean;\n  linkComponent: React.ElementType;\n}) {\n  return (\n    <ul className=\"hidden lg:flex items-center gap-1\">\n      {NAV_LINKS.map((link) => (\n        <li key={link.name} className=\"relative group\">\n          <Link\n            href={link.href}\n            className={cn(\n              \"flex items-center gap-1 px-4 py-2 text-sm font-semibold text-muted-foreground hover:text-foreground rounded-full transition-colors\",\n              isGlass\n                ? \"hover:bg-foreground/5\"\n                : \"hover:bg-[color-mix(in_oklab,var(--navbar-accent)_8%,transparent)]\",\n            )}\n          >\n            {link.name}\n            {link.hasDropdown && (\n              <ChevronDown className=\"w-3.5 h-3.5 opacity-50 group-hover:rotate-180 transition-transform\" />\n            )}\n          </Link>\n          {link.hasDropdown && (\n            <div className=\"absolute top-full left-0 pt-2 opacity-0 translate-y-2 pointer-events-none group-hover:opacity-100 group-hover:translate-y-0 group-hover:pointer-events-auto transition-all duration-200\">\n              {/* A plain popover is the same white as the page behind it; the\n                  panel wears a whisper of the accent, a tinted edge and a\n                  layered shadow so it lifts off (glass keeps its blur). */}\n              <div\n                className={cn(\n                  \"w-48 rounded-xl p-2 flex flex-col gap-1 text-popover-foreground\",\n                  isGlass\n                    ? \"bg-popover/60 backdrop-blur-2xl border border-foreground/10 shadow-[0_2px_4px_rgb(0_0_0/0.05),0_24px_48px_-16px_rgb(0_0_0/0.28)]\"\n                    : \"border bg-[oklch(from_var(--navbar-accent)_0.978_calc(c*0.1)_h)] border-[oklch(from_var(--navbar-accent)_0.9_calc(c*0.22)_h)] dark:bg-[oklch(from_var(--navbar-accent)_0.21_calc(c*0.1)_h)] dark:border-foreground/10 shadow-[0_2px_4px_rgb(0_0_0/0.04),0_20px_40px_-14px_rgb(0_0_0/0.22)]\",\n                )}\n              >\n                {[\"Overview\", \"Features\", \"Integrations\"].map((sub) => (\n                  <Link\n                    key={sub}\n                    href=\"#\"\n                    className={cn(\n                      \"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground rounded-lg transition-colors\",\n                      isGlass\n                        ? \"hover:bg-foreground/5\"\n                        : \"hover:bg-[color-mix(in_oklab,var(--navbar-accent)_10%,transparent)]\",\n                    )}\n                  >\n                    {sub}\n                  </Link>\n                ))}\n              </div>\n            </div>\n          )}\n        </li>\n      ))}\n    </ul>\n  );\n\n}\n\nfunction DesktopActions({\n  themeBg,\n  linkComponent: Link,\n}: {\n  themeBg: string;\n  linkComponent: React.ElementType;\n}) {\n  return (\n    <div className=\"hidden lg:flex items-center gap-3\">\n      <Link\n        href=\"#\"\n        className=\"px-4 py-2 text-sm font-semibold text-muted-foreground hover:text-foreground transition-colors\"\n      >\n        Sign In\n      </Link>\n      <Link\n        href=\"#\"\n        className={cn(\n          \"px-5 py-2 text-sm font-semibold rounded-full transition-transform active:scale-95 shadow-sm\",\n          themeBg,\n        )}\n      >\n        Get Started\n      </Link>\n    </div>\n  );\n}\n\n// ==========================================\n// E-COMMERCE MEGA NAV DATA & COMPONENT\n// ==========================================\ninterface MegaMenuLink {\n  name: string;\n  href: string;\n}\n\ninterface MegaMenuProduct {\n  id: string;\n  name: string;\n  subtitle: string;\n  price: string;\n  originalPrice?: string;\n  tag?: string;\n  rating: number;\n  image: string;\n  href: string;\n}\n\ninterface MegaMenuPromo {\n  tag: string;\n  title: string;\n  subtitle: string;\n  cta: string;\n  image: string;\n  href: string;\n}\n\ninterface MegaCategory {\n  id: string;\n  name: string;\n  productsTitle: string;\n  products: MegaMenuProduct[];\n  column1Title: string;\n  column1Links: MegaMenuLink[];\n  column2Title: string;\n  column2Links: MegaMenuLink[];\n  promo: MegaMenuPromo;\n}\n\nconst CLD = \"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto\";\n\nconst IMG_CHOCOLATE = `${CLD}/v1790509367/flavour-chocolate-1790509374070.webp`;\nconst IMG_COOKIE = `${CLD}/v1790509368/flavour-cookie-1790509374071.webp`;\nconst IMG_BERRY = `${CLD}/v1790509367/flavour-berry-1790509374070.webp`;\nconst IMG_MANGO = `${CLD}/v1790509367/flavour-mango-1790509374071.webp`;\n\nconst ECOM_CATEGORIES: MegaCategory[] = [\n  {\n    id: \"protein\",\n    name: \"Protein\",\n    productsTitle: \"Our Protein\",\n    products: [\n      { id: \"p-1\", name: \"Isoclear Clear Whey\", subtitle: \"Chocolate · 900g\", price: \"$39.90\", tag: \"Bestseller\", rating: 4.9, image: IMG_CHOCOLATE, href: \"#\" },\n      { id: \"p-2\", name: \"Designer Whey Protein\", subtitle: \"Cookie · 1kg\", price: \"$34.90\", rating: 4.8, image: IMG_COOKIE, href: \"#\" },\n      { id: \"p-3\", name: \"Vegan Protein Blend\", subtitle: \"Mixed berry · 750g\", price: \"$29.90\", originalPrice: \"$36.90\", tag: \"-20%\", rating: 4.7, image: IMG_BERRY, href: \"#\" },\n      { id: \"p-4\", name: \"Clear Whey Isolate\", subtitle: \"Mango · 500g\", price: \"$24.90\", tag: \"New\", rating: 4.8, image: IMG_MANGO, href: \"#\" },\n    ],\n    column1Title: \"Overview\",\n    column1Links: [\n      { name: \"Whey Protein\", href: \"#\" },\n      { name: \"Vegan Protein\", href: \"#\" },\n      { name: \"Clear Whey Isolate\", href: \"#\" },\n    ],\n    column2Title: \"Shop by goal\",\n    column2Links: [\n      { name: \"Muscle Building\", href: \"#\" },\n      { name: \"Weight Management\", href: \"#\" },\n    ],\n    promo: {\n      tag: \"Top rated\",\n      title: \"Protein Bestsellers\",\n      subtitle: \"Save up to 25% on our highest-rated whey & plant blends.\",\n      cta: \"Discover now\",\n      image: IMG_CHOCOLATE,\n      href: \"#\",\n    },\n  },\n  {\n    id: \"bars\",\n    name: \"Bars & Snacks\",\n    productsTitle: \"Bars & Snacks\",\n    products: [\n      { id: \"b-1\", name: \"Crunchy Protein Bar\", subtitle: \"Chocolate · 12 pack\", price: \"$27.90\", tag: \"Bestseller\", rating: 4.9, image: IMG_CHOCOLATE, href: \"#\" },\n      { id: \"b-2\", name: \"Cookie Dough Bites\", subtitle: \"Cookie · 10 pack\", price: \"$19.90\", rating: 4.7, image: IMG_COOKIE, href: \"#\" },\n      { id: \"b-3\", name: \"Berry Protein Crisps\", subtitle: \"Mixed berry · 8 pack\", price: \"$16.90\", tag: \"New\", rating: 4.6, image: IMG_BERRY, href: \"#\" },\n      { id: \"b-4\", name: \"Mango Fruit Bar\", subtitle: \"Mango · 12 pack\", price: \"$18.90\", originalPrice: \"$22.90\", tag: \"-15%\", rating: 4.6, image: IMG_MANGO, href: \"#\" },\n    ],\n    column1Title: \"Overview\",\n    column1Links: [\n      { name: \"Protein Bars\", href: \"#\" },\n      { name: \"Protein Crisps\", href: \"#\" },\n      { name: \"Nut Butters\", href: \"#\" },\n    ],\n    column2Title: \"Shop by need\",\n    column2Links: [\n      { name: \"On-the-go\", href: \"#\" },\n      { name: \"Low Sugar\", href: \"#\" },\n    ],\n    promo: {\n      tag: \"Just landed\",\n      title: \"New Flavours\",\n      subtitle: \"Freshly baked protein bars & bites with zero added sugar.\",\n      cta: \"Taste them all\",\n      image: IMG_BERRY,\n      href: \"#\",\n    },\n  },\n  {\n    id: \"vitamins\",\n    name: \"Vitamins & Health\",\n    productsTitle: \"Vitamins & Health\",\n    products: [\n      { id: \"v-1\", name: \"Daily Multivitamin\", subtitle: \"Mixed berry · 60 caps\", price: \"$21.90\", tag: \"Bestseller\", rating: 4.8, image: IMG_BERRY, href: \"#\" },\n      { id: \"v-2\", name: \"Omega-3 Softgels\", subtitle: \"Mango · 90 caps\", price: \"$24.90\", rating: 4.7, image: IMG_MANGO, href: \"#\" },\n      { id: \"v-3\", name: \"Vitamin D3 + K2\", subtitle: \"Chocolate · 120 caps\", price: \"$17.90\", tag: \"New\", rating: 4.8, image: IMG_CHOCOLATE, href: \"#\" },\n      { id: \"v-4\", name: \"Greens Superfood\", subtitle: \"Cookie · 300g\", price: \"$32.90\", originalPrice: \"$39.90\", tag: \"-18%\", rating: 4.6, image: IMG_COOKIE, href: \"#\" },\n    ],\n    column1Title: \"Overview\",\n    column1Links: [\n      { name: \"Multivitamins\", href: \"#\" },\n      { name: \"Omega-3\", href: \"#\" },\n      { name: \"Minerals\", href: \"#\" },\n    ],\n    column2Title: \"Shop by goal\",\n    column2Links: [\n      { name: \"Immunity\", href: \"#\" },\n      { name: \"Sleep & Recovery\", href: \"#\" },\n    ],\n    promo: {\n      tag: \"Daily routine\",\n      title: \"Health Essentials\",\n      subtitle: \"Daily micronutrients formulated for immunity & recovery.\",\n      cta: \"Discover now\",\n      image: IMG_MANGO,\n      href: \"#\",\n    },\n  },\n  {\n    id: \"creatine\",\n    name: \"Creatine\",\n    productsTitle: \"Our Creatine\",\n    products: [\n      { id: \"c-1\", name: \"Creatine Monohydrate\", subtitle: \"Mango · 500g\", price: \"$22.90\", tag: \"Bestseller\", rating: 4.9, image: IMG_MANGO, href: \"#\" },\n      { id: \"c-2\", name: \"Creatine Gummies\", subtitle: \"Mixed berry · 90 pcs\", price: \"$26.90\", tag: \"New\", rating: 4.7, image: IMG_BERRY, href: \"#\" },\n      { id: \"c-3\", name: \"Pre-Workout Pump\", subtitle: \"Chocolate · 300g\", price: \"$29.90\", rating: 4.6, image: IMG_CHOCOLATE, href: \"#\" },\n      { id: \"c-4\", name: \"Creatine Chewables\", subtitle: \"Cookie · 150 tabs\", price: \"$19.90\", originalPrice: \"$24.90\", tag: \"-20%\", rating: 4.7, image: IMG_COOKIE, href: \"#\" },\n    ],\n    column1Title: \"Overview\",\n    column1Links: [\n      { name: \"Creatine Powder\", href: \"#\" },\n      { name: \"Creatine Gummies\", href: \"#\" },\n      { name: \"Pre-Workout\", href: \"#\" },\n    ],\n    column2Title: \"Shop by goal\",\n    column2Links: [\n      { name: \"Strength\", href: \"#\" },\n      { name: \"Power Output\", href: \"#\" },\n    ],\n    promo: {\n      tag: \"Athlete pick\",\n      title: \"Strength Stack\",\n      subtitle: \"Ultra-pure micronized creatine for peak strength output.\",\n      cta: \"Build your stack\",\n      image: IMG_COOKIE,\n      href: \"#\",\n    },\n  },\n];\n\nconst ECOM_STATIC_LINKS = [\"Hydration\", \"Bundles\"];\n\nconst CART_PREVIEW_ITEMS = [\n  { name: \"Crunchy Protein Bar\", variant: \"Chocolate · 12 pack\", qty: 1, price: \"$27.90\", image: IMG_CHOCOLATE },\n  { name: \"Mango Fruit Bar\", variant: \"Mango · 12 pack\", qty: 2, price: \"$37.80\", image: IMG_MANGO },\n];\n\nconst SEARCH_CATALOG = [\n  { title: \"Vitamin D3 + K2\", path: \"/products/vitamin-d3-k2\" },\n  { title: \"Omega 3 Softgels\", path: \"/products/omega-3-softgels\" },\n  { title: \"Isoclear Clear Whey\", path: \"/products/isoclear-clear-whey\" },\n  { title: \"Designer Whey Protein\", path: \"/products/designer-whey-protein\" },\n  { title: \"Crunchy Protein Bar\", path: \"/products/crunchy-protein-bar\" },\n  { title: \"Cookie Dough Bites\", path: \"/products/cookie-dough-bites\" },\n  { title: \"Berry Protein Crisps\", path: \"/products/berry-protein-crisps\" },\n  { title: \"Mango Fruit Bar\", path: \"/products/mango-fruit-bar\" },\n  { title: \"Creatine Monohydrate\", path: \"/products/creatine-monohydrate\" },\n];\n\n// The panel is mounted once and never unmounted while you move between\n// categories — only its content swaps (with a short cross-fade). Opening\n// eases the height in via grid-template-rows 0fr → 1fr.\nconst MEGA_NAV_CSS = `\n@keyframes mega-nav-content-in {\n  from { opacity: 0; transform: translateY(6px); }\n  to { opacity: 1; transform: none; }\n}\n.mega-nav-content { animation: mega-nav-content-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both; }\n@keyframes mega-nav-drawer-in {\n  from { transform: translateX(-100%); }\n  to { transform: none; }\n}\n.mega-nav-drawer { animation: mega-nav-drawer-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }\n@keyframes mega-nav-fade-in { from { opacity: 0; } to { opacity: 1; } }\n.mega-nav-overlay { animation: mega-nav-fade-in 0.3s ease-out both; }\n@media (prefers-reduced-motion: reduce) {\n  .mega-nav-content, .mega-nav-drawer, .mega-nav-overlay { animation: none; }\n}\n`;\n\nfunction StarRating({ value }: { value: number }) {\n  return (\n    <span className=\"inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground\">\n      <Star className=\"w-3 h-3 fill-amber-400 text-amber-400\" />\n      {value.toFixed(1)}\n    </span>\n  );\n}\n\nfunction EcommerceMegaNav({\n  color = \"primary\",\n  logoText = \"NUTRIFY\",\n  linkComponent: Link = \"a\",\n}: {\n  color?: NavbarColor;\n  logoText?: string;\n  linkComponent?: React.ElementType;\n}) {\n  const { theme, style } = getThemeStyles(color);\n  const [activeMenuId, setActiveMenuId] = useState<string | null>(null);\n  // Remembers the last category so the panel keeps its content while it\n  // eases closed instead of going blank mid-animation.\n  const [lastMenuId, setLastMenuId] = useState<string>(ECOM_CATEGORIES[0].id);\n  const [mobileOpen, setMobileOpen] = useState(false);\n  const [expandedMobileCategory, setExpandedMobileCategory] = useState<string | null>(ECOM_CATEGORIES[0].id);\n  const [cartOpen, setCartOpen] = useState(false);\n  const [searchOpen, setSearchOpen] = useState(false);\n  const [searchQuery, setSearchQuery] = useState(\"\");\n  const closeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  const filteredSearchItems = (() => {\n    const q = searchQuery.trim().toLowerCase();\n    if (!q) return SEARCH_CATALOG.slice(0, 4);\n    const matches = SEARCH_CATALOG.filter(\n      (item) => item.title.toLowerCase().includes(q) || item.path.toLowerCase().includes(q),\n    );\n    return matches.length > 0 ? matches : SEARCH_CATALOG.slice(0, 2);\n  })();\n\n  const isOpen = activeMenuId !== null;\n  const shownCategory =\n    ECOM_CATEGORIES.find((c) => c.id === (activeMenuId ?? lastMenuId)) ?? ECOM_CATEGORIES[0];\n\n  const cancelClose = () => {\n    if (closeTimeoutRef.current) {\n      clearTimeout(closeTimeoutRef.current);\n      closeTimeoutRef.current = null;\n    }\n  };\n\n  const openMenu = (id: string) => {\n    cancelClose();\n    setActiveMenuId(id);\n    setLastMenuId(id);\n  };\n\n  const scheduleClose = () => {\n    cancelClose();\n    closeTimeoutRef.current = setTimeout(() => setActiveMenuId(null), 200);\n  };\n\n  useEffect(() => () => cancelClose(), []);\n\n  useEffect(() => {\n    if (!isOpen && !searchOpen) return;\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        setActiveMenuId(null);\n        setSearchOpen(false);\n      }\n    };\n    window.addEventListener(\"keydown\", onKey);\n    return () => window.removeEventListener(\"keydown\", onKey);\n  }, [isOpen, searchOpen]);\n\n  return (\n    <div className=\"relative w-full z-50 font-sans bg-background rounded-t-[inherit]\" style={style}>\n      <style>{MEGA_NAV_CSS}</style>\n\n      {/* ── Announcement bar ── */}\n      <div className={cn(\"w-full rounded-t-[inherit] text-[11px] sm:text-xs py-2 px-4 flex items-center justify-center gap-2 font-medium transition-colors\", theme.bg)}>\n        <Truck className=\"w-3.5 h-3.5 opacity-85\" />\n        <span>Free delivery from $80</span>\n      </div>\n\n      {/* ── Row 1: logo · search · actions ── */}\n      <div className=\"w-full border-b border-border lg:border-b-0\">\n        <div className=\"max-w-6xl mx-auto px-4 sm:px-6 xl:px-10 h-16 lg:h-[72px] flex items-center justify-between gap-4\">\n          <div className=\"flex items-center gap-2\">\n            <button\n              type=\"button\"\n              aria-label=\"Open menu\"\n              onClick={() => setMobileOpen(true)}\n              className=\"lg:hidden p-2 -ml-2 rounded-full text-foreground hover:bg-muted transition-colors\"\n            >\n              <Menu className=\"w-5 h-5\" />\n            </button>\n            <Link href=\"#\" className=\"shrink-0\">\n              <span className={cn(\"font-bold text-xl sm:text-[22px] tracking-tight select-none transition-colors\", theme.text)}>\n                {logoText}\n              </span>\n            </Link>\n          </div>\n\n          <div className=\"hidden lg:block flex-1 max-w-md\">\n            <button\n              type=\"button\"\n              onClick={() => {\n                setActiveMenuId(null);\n                setSearchOpen(true);\n              }}\n              className=\"relative w-full h-10 pl-11 pr-4 text-left text-sm rounded-full bg-[color-mix(in_oklab,var(--navbar-accent)_6%,var(--muted))] border border-[color-mix(in_oklab,var(--navbar-accent)_18%,transparent)] hover:border-[color-mix(in_oklab,var(--navbar-accent)_40%,transparent)] transition-colors flex items-center text-muted-foreground cursor-text\"\n            >\n              <Search className={cn(\"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 pointer-events-none\", theme.text)} />\n              <span className=\"truncate\">{searchQuery || \"Search for protein, creatine, ...\"}</span>\n            </button>\n          </div>\n\n          <div className=\"flex items-center gap-0.5 sm:gap-1\">\n            <button\n              type=\"button\"\n              aria-label=\"Search\"\n              onClick={() => {\n                setActiveMenuId(null);\n                setSearchOpen(true);\n              }}\n              className=\"lg:hidden p-2 rounded-full text-foreground hover:bg-muted transition-colors\"\n            >\n              <Search className=\"w-5 h-5\" />\n            </button>\n            <button type=\"button\" aria-label=\"Account\" className=\"hidden sm:inline-flex p-2 rounded-full text-foreground hover:bg-muted transition-colors\">\n              <User className=\"w-5 h-5\" />\n            </button>\n            <button type=\"button\" aria-label=\"Wishlist\" className=\"hidden sm:inline-flex p-2 rounded-full text-foreground hover:bg-muted transition-colors\">\n              <Heart className=\"w-5 h-5\" />\n            </button>\n            <div className=\"relative\">\n              <button\n                type=\"button\"\n                onClick={() => setCartOpen((v) => !v)}\n                aria-label=\"Cart (3 items)\"\n                className=\"relative p-2 rounded-full text-foreground hover:bg-muted transition-colors\"\n              >\n                <ShoppingBag className=\"w-5 h-5\" />\n                <span className={cn(\"absolute top-0.5 right-0.5 min-w-4 h-4 px-1 rounded-full text-[9px] font-bold flex items-center justify-center leading-none\", theme.bg)}>\n                  3\n                </span>\n              </button>\n\n              {cartOpen && (\n                <>\n                  <div className=\"fixed inset-0 z-40\" onClick={() => setCartOpen(false)} />\n                  <div className=\"absolute right-0 top-full mt-2 w-[min(22rem,calc(100vw-2rem))] rounded-2xl p-4 bg-background border border-border shadow-2xl z-50 flex flex-col gap-3\">\n                    <div className=\"flex items-center justify-between pb-2 border-b border-border\">\n                      <span className=\"font-semibold text-sm text-foreground\">Your cart (3)</span>\n                      <button type=\"button\" onClick={() => setCartOpen(false)} aria-label=\"Close cart\" className=\"p-1 rounded-full text-muted-foreground hover:text-foreground hover:bg-muted\">\n                        <X className=\"w-4 h-4\" />\n                      </button>\n                    </div>\n                    {CART_PREVIEW_ITEMS.map((item) => (\n                      <div key={item.name} className=\"flex items-center gap-3\">\n                        <div className=\"w-14 h-14 rounded-xl bg-muted overflow-hidden shrink-0\">\n                          <img src={item.image} alt={item.name} className=\"w-full h-full object-cover\" />\n                        </div>\n                        <div className=\"flex-1 min-w-0\">\n                          <p className=\"text-sm font-medium text-foreground truncate\">{item.name}</p>\n                          <p className=\"text-xs text-muted-foreground\">{item.variant} · Qty {item.qty}</p>\n                        </div>\n                        <span className=\"text-sm font-semibold text-foreground\">{item.price}</span>\n                      </div>\n                    ))}\n                    <div className=\"pt-3 border-t border-border flex items-center justify-between text-sm\">\n                      <span className=\"text-muted-foreground\">Subtotal</span>\n                      <span className=\"font-bold text-foreground\">$85.70</span>\n                    </div>\n                    <Link\n                      href=\"#\"\n                      onClick={() => setCartOpen(false)}\n                      className={cn(\"w-full py-3 text-center text-sm font-semibold rounded-full transition-opacity\", theme.bg)}\n                    >\n                      Checkout\n                    </Link>\n                  </div>\n                </>\n              )}\n            </div>\n          </div>\n        </div>\n      </div>\n\n      {/* ── Row 2: category links + persistent mega panel (desktop) ── */}\n      <nav\n        aria-label=\"Shop categories\"\n        className=\"relative hidden lg:block w-full border-b border-border\"\n        onMouseLeave={scheduleClose}\n      >\n        <ul className=\"flex items-center justify-center gap-1 h-12 pb-1\">\n          <li>\n            <Link\n              href=\"#\"\n              onMouseEnter={scheduleClose}\n              className=\"flex items-center gap-1.5 px-3.5 py-1.5 text-sm font-semibold text-foreground rounded-full hover:bg-[color-mix(in_oklab,var(--navbar-accent)_10%,transparent)] transition-colors\"\n            >\n              <BadgePercent className={cn(\"w-4 h-4\", theme.text)} />\n              Deals\n            </Link>\n          </li>\n          {ECOM_CATEGORIES.map((cat) => {\n            const isActive = activeMenuId === cat.id;\n            return (\n              <li key={cat.id} onMouseEnter={() => openMenu(cat.id)}>\n                <button\n                  type=\"button\"\n                  aria-expanded={isActive}\n                  aria-controls=\"mega-nav-panel\"\n                  onClick={() => (isActive ? setActiveMenuId(null) : openMenu(cat.id))}\n                  onFocus={() => openMenu(cat.id)}\n                  className={cn(\n                    \"flex items-center gap-1 px-3.5 py-1.5 text-sm font-medium rounded-full transition-colors duration-200\",\n                    isActive\n                      ? theme.bg\n                      : \"text-foreground hover:bg-[color-mix(in_oklab,var(--navbar-accent)_10%,transparent)] hover:text-[var(--navbar-accent)]\",\n                  )}\n                >\n                  {cat.name}\n                  <ChevronDown\n                    className={cn(\n                      \"w-3.5 h-3.5 opacity-60 transition-transform duration-300\",\n                      isActive && \"rotate-180 opacity-100\",\n                    )}\n                  />\n                </button>\n              </li>\n            );\n          })}\n          {ECOM_STATIC_LINKS.map((name) => (\n            <li key={name}>\n              <Link\n                href=\"#\"\n                onMouseEnter={scheduleClose}\n                className=\"block px-3.5 py-1.5 text-sm font-medium text-foreground rounded-full hover:bg-[color-mix(in_oklab,var(--navbar-accent)_10%,transparent)] hover:text-[var(--navbar-accent)] transition-colors\"\n              >\n                {name}\n              </Link>\n            </li>\n          ))}\n        </ul>\n\n        {/* Mounted once. Height eases 0fr → 1fr; only the inner content swaps. */}\n        <div\n          id=\"mega-nav-panel\"\n          aria-hidden={!isOpen}\n          onMouseEnter={cancelClose}\n          className={cn(\n            \"absolute top-full left-0 right-0 z-50 grid transition-[grid-template-rows,opacity] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]\",\n            isOpen ? \"grid-rows-[1fr] opacity-100\" : \"grid-rows-[0fr] opacity-0 pointer-events-none\",\n          )}\n        >\n          <div className=\"min-h-0 overflow-hidden\">\n            <div className=\"bg-background border-b border-border shadow-[0_32px_64px_-32px_rgb(0_0_0/0.35)]\">\n              <div key={shownCategory.id} className=\"mega-nav-content max-w-6xl mx-auto px-6 xl:px-10 py-8 grid grid-cols-[minmax(0,1fr)_17rem] gap-8\">\n                {/* Left: header, products, link columns */}\n                <div className=\"flex flex-col gap-6 min-w-0\">\n                  <div className=\"flex items-end justify-between\">\n                    <div>\n                      <h3 className=\"text-lg font-bold tracking-tight text-foreground\">{shownCategory.productsTitle}</h3>\n                      <p className=\"text-xs text-muted-foreground mt-0.5\">Hand-picked favourites from our community</p>\n                    </div>\n                    <Link\n                      href=\"#\"\n                      tabIndex={isOpen ? 0 : -1}\n                      className={cn(\"group inline-flex items-center gap-1.5 text-sm font-semibold hover:opacity-80 transition-opacity\", theme.text)}\n                    >\n                      View all products\n                      <ArrowRight className=\"w-4 h-4 transition-transform group-hover:translate-x-0.5\" />\n                    </Link>\n                  </div>\n\n                  <div className=\"grid grid-cols-4 gap-4\">\n                    {shownCategory.products.map((prod) => (\n                      <Link key={prod.id} href={prod.href} tabIndex={isOpen ? 0 : -1} className=\"group flex flex-col gap-3\">\n                        <div className=\"relative aspect-square w-full rounded-2xl overflow-hidden bg-muted ring-1 ring-transparent group-hover:ring-[color-mix(in_oklab,var(--navbar-accent)_45%,transparent)] transition-all\">\n                          <img\n                            src={prod.image}\n                            alt={prod.name}\n                            loading=\"lazy\"\n                            className=\"w-full h-full object-cover transition-transform duration-500 ease-out group-hover:scale-105\"\n                          />\n                          {prod.tag && (\n                            <span\n                              className={cn(\n                                \"absolute top-2.5 left-2.5 px-2 py-0.5 rounded-full text-[10px] font-semibold shadow-xs\",\n                                prod.tag.startsWith(\"-\")\n                                  ? \"bg-rose-500 text-white\"\n                                  : theme.bg,\n                              )}\n                            >\n                              {prod.tag}\n                            </span>\n                          )}\n                          <span className={cn(\"absolute bottom-2.5 right-2.5 w-8 h-8 rounded-full flex items-center justify-center opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-300 shadow-lg\", theme.bg)}>\n                            <Plus className=\"w-4 h-4\" />\n                          </span>\n                        </div>\n                        <div className=\"flex flex-col gap-1\">\n                          <div className=\"flex items-center justify-between gap-2\">\n                            <span className=\"text-sm font-semibold text-foreground group-hover:text-[var(--navbar-accent)] transition-colors truncate\">{prod.name}</span>\n                          </div>\n                          <span className=\"text-xs text-muted-foreground truncate\">{prod.subtitle}</span>\n                          <div className=\"flex items-center justify-between mt-0.5\">\n                            <div className=\"flex items-baseline gap-1.5\">\n                              <span className=\"text-sm font-bold text-foreground\">{prod.price}</span>\n                              {prod.originalPrice && (\n                                <span className=\"text-xs text-muted-foreground line-through\">{prod.originalPrice}</span>\n                              )}\n                            </div>\n                            <StarRating value={prod.rating} />\n                          </div>\n                        </div>\n                      </Link>\n                    ))}\n                  </div>\n\n                  <div className=\"grid grid-cols-4 gap-4 pt-5 border-t border-border\">\n                    {[\n                      { title: shownCategory.column1Title, links: shownCategory.column1Links },\n                      { title: shownCategory.column2Title, links: shownCategory.column2Links },\n                    ].map((col) => (\n                      <div key={col.title} className=\"col-span-2 flex flex-col gap-2.5\">\n                        <span className={cn(\"text-[11px] font-bold uppercase tracking-[0.12em]\", theme.text)}>\n                          {col.title}\n                        </span>\n                        <div className=\"flex flex-wrap gap-2\">\n                          {col.links.map((link) => (\n                            <Link\n                              key={link.name}\n                              href={link.href}\n                              tabIndex={isOpen ? 0 : -1}\n                              className=\"px-3 py-1.5 rounded-full border border-[color-mix(in_oklab,var(--navbar-accent)_25%,var(--border))] bg-[color-mix(in_oklab,var(--navbar-accent)_6%,transparent)] text-xs font-medium text-foreground hover:bg-[var(--navbar-accent)] hover:text-white hover:border-[var(--navbar-accent)] transition-colors\"\n                            >\n                              {link.name}\n                            </Link>\n                          ))}\n                        </div>\n                      </div>\n                    ))}\n                  </div>\n                </div>\n\n                {/* Right: themed promo card */}\n                <Link\n                  href={shownCategory.promo.href}\n                  tabIndex={isOpen ? 0 : -1}\n                  className=\"group relative rounded-3xl p-4 flex flex-col justify-between gap-4 overflow-hidden border border-[color-mix(in_oklab,var(--navbar-accent)_22%,var(--border))] bg-gradient-to-b from-[color-mix(in_oklab,var(--navbar-accent)_8%,var(--background))] to-[color-mix(in_oklab,var(--navbar-accent)_16%,var(--background))] shadow-xs\"\n                >\n                  <div className=\"relative aspect-[4/3] w-full rounded-2xl overflow-hidden bg-background/90 border border-[color-mix(in_oklab,var(--navbar-accent)_15%,var(--border))] flex items-center justify-center p-4\">\n                    <div className=\"absolute inset-0 bg-[radial-gradient(circle_at_center,color-mix(in_oklab,var(--navbar-accent)_14%,transparent),transparent_70%)] pointer-events-none\" />\n                    <img\n                      src={shownCategory.promo.image}\n                      alt={shownCategory.promo.title}\n                      loading=\"lazy\"\n                      className=\"relative z-10 w-full h-full object-contain drop-shadow-sm transition-transform duration-500 ease-out group-hover:scale-105\"\n                    />\n                    <span className={cn(\"absolute top-2.5 left-2.5 z-20 px-2.5 py-1 rounded-full text-[10px] font-semibold tracking-wide not-italic shadow-xs\", theme.bg)}>\n                      {shownCategory.promo.tag}\n                    </span>\n                  </div>\n\n                  <div className=\"flex flex-col gap-1 px-0.5\">\n                    <h4 className=\"text-base font-bold leading-snug tracking-tight text-foreground not-italic\">\n                      {shownCategory.promo.title}\n                    </h4>\n                    <p className=\"text-xs text-muted-foreground leading-relaxed line-clamp-2 not-italic\">\n                      {shownCategory.promo.subtitle}\n                    </p>\n                  </div>\n\n                  <span className={cn(\"inline-flex items-center justify-center gap-2 w-full py-2.5 rounded-xl text-xs font-semibold not-italic transition-all shadow-xs\", theme.bg)}>\n                    {shownCategory.promo.cta}\n                    <ArrowRight className=\"w-3.5 h-3.5 transition-transform group-hover:translate-x-0.5\" />\n                  </span>\n                </Link>\n              </div>\n            </div>\n          </div>\n        </div>\n      </nav>\n\n      {/* ── Mobile / tablet sidebar ── */}\n      {mobileOpen && (\n        <div className=\"fixed inset-0 z-[100] lg:hidden\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Menu\">\n          <div className=\"mega-nav-overlay absolute inset-0 bg-black/50 backdrop-blur-sm\" onClick={() => setMobileOpen(false)} />\n          <div className=\"mega-nav-drawer absolute left-0 top-0 bottom-0 w-[88%] max-w-sm bg-background shadow-2xl flex flex-col\">\n            <div className=\"px-5 h-16 border-b border-border flex items-center justify-between shrink-0\">\n              <span className={cn(\"font-bold not-italic text-xl tracking-tight select-none\", theme.text)}>{logoText}</span>\n              <button\n                type=\"button\"\n                aria-label=\"Close menu\"\n                onClick={() => setMobileOpen(false)}\n                className=\"p-2 -mr-2 rounded-full text-muted-foreground hover:text-foreground hover:bg-muted transition-colors\"\n              >\n                <X className=\"w-5 h-5\" />\n              </button>\n            </div>\n\n            <div className=\"px-5 py-3 shrink-0\">\n              <button\n                type=\"button\"\n                onClick={() => {\n                  setMobileOpen(false);\n                  setSearchOpen(true);\n                }}\n                className=\"relative w-full h-10 pl-10 pr-4 text-left text-sm rounded-full bg-[color-mix(in_oklab,var(--navbar-accent)_6%,var(--muted))] border border-[color-mix(in_oklab,var(--navbar-accent)_18%,transparent)] flex items-center text-muted-foreground\"\n              >\n                <Search className={cn(\"w-4 h-4 absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none\", theme.text)} />\n                <span className=\"truncate\">{searchQuery || \"Search for protein, creatine, ...\"}</span>\n              </button>\n            </div>\n\n            <div className=\"flex-1 overflow-y-auto overscroll-contain px-3 pb-4\">\n              <Link\n                href=\"#\"\n                onClick={() => setMobileOpen(false)}\n                className=\"flex items-center gap-2 px-3 py-3.5 text-[15px] font-semibold text-foreground rounded-xl hover:bg-muted transition-colors\"\n              >\n                <BadgePercent className={cn(\"w-4 h-4\", theme.text)} />\n                Deals\n              </Link>\n\n              {ECOM_CATEGORIES.map((cat) => {\n                const isExpanded = expandedMobileCategory === cat.id;\n                return (\n                  <div key={cat.id} className=\"border-t border-border/60\">\n                    <button\n                      type=\"button\"\n                      aria-expanded={isExpanded}\n                      onClick={() => setExpandedMobileCategory(isExpanded ? null : cat.id)}\n                      className=\"w-full flex items-center justify-between px-3 py-3.5 text-left text-[15px] font-medium text-foreground\"\n                    >\n                      {cat.name}\n                      <ChevronDown\n                        className={cn(\"w-4 h-4 text-muted-foreground transition-transform duration-300\", isExpanded && \"rotate-180\")}\n                      />\n                    </button>\n\n                    <div\n                      className={cn(\n                        \"grid transition-[grid-template-rows] duration-400 ease-[cubic-bezier(0.22,1,0.36,1)]\",\n                        isExpanded ? \"grid-rows-[1fr]\" : \"grid-rows-[0fr]\",\n                      )}\n                    >\n                      <div className=\"min-h-0 overflow-hidden\">\n                        <div className=\"px-3 pb-5 flex flex-col gap-5\">\n                          <div className=\"grid grid-cols-2 gap-3\">\n                            {cat.products.map((prod) => (\n                              <Link\n                                key={prod.id}\n                                href={prod.href}\n                                onClick={() => setMobileOpen(false)}\n                                tabIndex={isExpanded ? 0 : -1}\n                                className=\"group flex flex-col gap-1.5 min-w-0\"\n                              >\n                                <div className=\"relative aspect-square w-full rounded-xl overflow-hidden bg-muted ring-1 ring-border/50\">\n                                  <img\n                                    src={prod.image}\n                                    alt={prod.name}\n                                    loading=\"lazy\"\n                                    className=\"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105\"\n                                  />\n                                  {prod.tag && (\n                                    <span\n                                      className={cn(\n                                        \"absolute top-2 left-2 px-1.5 py-0.5 rounded-full text-[9px] font-semibold leading-none shadow-xs\",\n                                        prod.tag.startsWith(\"-\") ? \"bg-rose-500 text-white\" : theme.bg,\n                                      )}\n                                    >\n                                      {prod.tag}\n                                    </span>\n                                  )}\n                                </div>\n                                <span className=\"text-xs font-semibold text-foreground truncate\">{prod.name}</span>\n                                <div className=\"flex items-baseline gap-1.5 -mt-0.5\">\n                                  <span className=\"text-xs font-bold text-foreground\">{prod.price}</span>\n                                  {prod.originalPrice && (\n                                    <span className=\"text-[10px] text-muted-foreground line-through\">{prod.originalPrice}</span>\n                                  )}\n                                </div>\n                              </Link>\n                            ))}\n                          </div>\n\n                          {[\n                            { title: cat.column1Title, links: cat.column1Links },\n                            { title: cat.column2Title, links: cat.column2Links },\n                          ].map((col) => (\n                            <div key={col.title} className=\"flex flex-col gap-2\">\n                              <span className={cn(\"text-[10px] font-bold uppercase tracking-[0.12em]\", theme.text)}>\n                                {col.title}\n                              </span>\n                              <div className=\"flex flex-wrap gap-2\">\n                                {col.links.map((link) => (\n                                  <Link\n                                    key={link.name}\n                                    href={link.href}\n                                    onClick={() => setMobileOpen(false)}\n                                    tabIndex={isExpanded ? 0 : -1}\n                                    className=\"px-3 py-1.5 rounded-full border border-[color-mix(in_oklab,var(--navbar-accent)_25%,var(--border))] bg-[color-mix(in_oklab,var(--navbar-accent)_6%,transparent)] text-xs font-medium text-foreground\"\n                                  >\n                                    {link.name}\n                                  </Link>\n                                ))}\n                              </div>\n                            </div>\n                          ))}\n\n                          <Link\n                            href={cat.promo.href}\n                            onClick={() => setMobileOpen(false)}\n                            tabIndex={isExpanded ? 0 : -1}\n                            className=\"flex items-center gap-3.5 p-3 rounded-2xl border border-[color-mix(in_oklab,var(--navbar-accent)_22%,var(--border))] bg-[color-mix(in_oklab,var(--navbar-accent)_10%,var(--background))]\"\n                          >\n                            <div className=\"w-16 h-16 rounded-xl overflow-hidden shrink-0 bg-background/90 border border-border/60 p-1.5 flex items-center justify-center\">\n                              <img src={cat.promo.image} alt={cat.promo.title} loading=\"lazy\" className=\"w-full h-full object-contain\" />\n                            </div>\n                            <div className=\"flex-1 min-w-0\">\n                              <span className={cn(\"inline-block px-2 py-0.5 rounded-full text-[9px] font-semibold not-italic mb-1\", theme.bg)}>\n                                {cat.promo.tag}\n                              </span>\n                              <span className=\"block text-sm font-bold text-foreground not-italic leading-tight truncate\">{cat.promo.title}</span>\n                              <span className=\"block text-[11px] text-muted-foreground not-italic truncate mt-0.5\">{cat.promo.cta}</span>\n                            </div>\n                            <span className={cn(\"w-8 h-8 rounded-full flex items-center justify-center shrink-0\", theme.bg)}>\n                              <ArrowRight className=\"w-4 h-4\" />\n                            </span>\n                          </Link>\n                        </div>\n                      </div>\n                    </div>\n                  </div>\n                );\n              })}\n\n              {ECOM_STATIC_LINKS.map((name) => (\n                <Link\n                  key={name}\n                  href=\"#\"\n                  onClick={() => setMobileOpen(false)}\n                  className=\"flex items-center justify-between px-3 py-3.5 text-[15px] font-medium text-foreground border-t border-border/60\"\n                >\n                  {name}\n                  <ArrowRight className=\"w-4 h-4 text-muted-foreground\" />\n                </Link>\n              ))}\n            </div>\n\n            <div className=\"p-4 border-t border-border flex flex-col gap-2.5 shrink-0 bg-background\">\n              <Link\n                href=\"#\"\n                onClick={() => setMobileOpen(false)}\n                className={cn(\"w-full h-12 text-sm font-semibold rounded-full flex items-center justify-center gap-2 active:scale-[0.98] transition-transform\", theme.bg)}\n              >\n                <ShoppingBag className=\"w-4 h-4\" />\n                View cart · $85.70\n              </Link>\n              <div className=\"grid grid-cols-2 gap-2\">\n                <Link\n                  href=\"#\"\n                  onClick={() => setMobileOpen(false)}\n                  className=\"h-10 text-xs font-medium text-foreground border border-border rounded-full flex items-center justify-center gap-1.5 hover:bg-muted transition-colors\"\n                >\n                  <User className=\"w-4 h-4\" />\n                  Account\n                </Link>\n                <Link\n                  href=\"#\"\n                  onClick={() => setMobileOpen(false)}\n                  className=\"h-10 text-xs font-medium text-foreground border border-border rounded-full flex items-center justify-center gap-1.5 hover:bg-muted transition-colors\"\n                >\n                  <Heart className=\"w-4 h-4\" />\n                  Wishlist\n                </Link>\n              </div>\n            </div>\n          </div>\n        </div>\n      )}\n\n      {/* ── Centered Search Modal (Framer Command Search) ── */}\n      {searchOpen && (\n        <div\n          className=\"fixed inset-0 z-[110] flex items-start justify-center pt-28 sm:pt-36 px-4\"\n          role=\"dialog\"\n          aria-modal=\"true\"\n          aria-label=\"Search products\"\n        >\n          <div\n            className=\"mega-nav-overlay absolute inset-0 bg-black/60 backdrop-blur-[1px]\"\n            onClick={() => setSearchOpen(false)}\n          />\n          <div className=\"mega-nav-content relative z-10 w-full max-w-[440px] rounded-2xl bg-background border border-[color-mix(in_oklab,var(--navbar-accent)_28%,var(--border))] shadow-[0_24px_48px_-12px_color-mix(in_oklab,var(--navbar-accent)_22%,rgb(0_0_0/0.45))] overflow-hidden\">\n            <div className=\"flex items-center gap-3 px-4 h-12 bg-[color-mix(in_oklab,var(--navbar-accent)_5%,transparent)]\">\n              <Search className={cn(\"w-4 h-4 shrink-0\", theme.text)} />\n              <input\n                autoFocus\n                type=\"text\"\n                value={searchQuery}\n                onChange={(e) => setSearchQuery(e.target.value)}\n                placeholder=\"Search for protein, creatine, ...\"\n                className=\"flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus:outline-none\"\n              />\n              <button\n                type=\"button\"\n                aria-label={searchQuery ? \"Clear search\" : \"Close search\"}\n                onClick={() => {\n                  if (searchQuery) setSearchQuery(\"\");\n                  else setSearchOpen(false);\n                }}\n                className={cn(\n                  \"w-5 h-5 rounded-full flex items-center justify-center transition-opacity shrink-0 opacity-85 hover:opacity-100\",\n                  theme.bg,\n                )}\n              >\n                <X className=\"w-3 h-3 stroke-[2.5]\" />\n              </button>\n            </div>\n\n            <div className=\"border-t border-[color-mix(in_oklab,var(--navbar-accent)_18%,var(--border))] max-h-64 overflow-y-auto\">\n              {filteredSearchItems.map((item, idx) => (\n                <Link\n                  key={item.path}\n                  href=\"#\"\n                  onClick={() => setSearchOpen(false)}\n                  className={cn(\n                    \"group flex flex-col gap-0.5 px-4 py-3 transition-colors hover:bg-[color-mix(in_oklab,var(--navbar-accent)_10%,transparent)]\",\n                    idx === 0 && \"bg-[color-mix(in_oklab,var(--navbar-accent)_8%,transparent)]\",\n                  )}\n                >\n                  <span\n                    className={cn(\n                      \"text-sm font-medium text-foreground leading-snug transition-colors group-hover:text-[var(--navbar-accent)]\",\n                      idx === 0 && theme.text,\n                    )}\n                  >\n                    {item.title}\n                  </span>\n                  <span className=\"text-xs text-muted-foreground\">{item.path}</span>\n                </Link>\n              ))}\n            </div>\n          </div>\n        </div>\n      )}\n    </div>\n  );\n}\n\nfunction StandardNavbar({\n  variant = \"default\",\n  color = \"primary\",\n  logoText = \"Nexus\",\n  linkComponent: Link = \"a\",\n}: NavbarProps) {\n  const [mobileMenuOpen, setMobileMenuOpen] = useState(false);\n  // Keeps the layer mounted for the 0.4s slide-out after closing.\n  const [closing, setClosing] = useState(false);\n  const { theme, style } = getThemeStyles(color);\n\n  const isGlass = variant === \"glass\";\n\n  // Visibility is derived, not synced: the layer shows whenever the menu is\n  // open, and `closing` only extends that through the exit animation. It used\n  // to be a separate `renderLayer` flag set during render when `mobileMenuOpen`\n  // flipped — under StrictMode that update was dropped a frame after commit,\n  // so the layer went back to display:none and a tap looked like it did nothing.\n  const showLayer = mobileMenuOpen || closing;\n\n  const closeMenu = () => {\n    setMobileMenuOpen(false);\n    setClosing(true);\n  };\n\n  useEffect(() => {\n    if (!closing) return;\n    const t = setTimeout(() => setClosing(false), 400);\n    return () => clearTimeout(t);\n  }, [closing]);\n\n  const getContainerStyles = () => {\n    switch (variant) {\n      case \"floating\":\n        return \"max-w-5xl mx-auto top-6 rounded-full bg-background/80 backdrop-blur-lg border border-border shadow-lg px-6\";\n      case \"glass\":\n        return \"w-full bg-background/40 backdrop-blur-xl border-b border-foreground/10 shadow-sm px-6 lg:px-12\";\n      case \"minimal\":\n        return \"w-full bg-transparent px-6 lg:px-12 pt-6\";\n      case \"centered\":\n      case \"default\":\n      default:\n        return \"w-full bg-background border-b border-border px-6 lg:px-12\";\n    }\n  };\n\n  return (\n    <div className=\"relative w-full z-50\" style={style}>\n      <style>{MOBILE_MENU_CSS}</style>\n      <nav\n        className={cn(\n          \"absolute left-0 right-0 h-16 flex items-center transition-all duration-300\",\n          getContainerStyles(),\n        )}\n      >\n        {variant === \"centered\" ? (\n          // Not grid-cols-3: equal thirds give the links only a third of the\n          // width, which the four of them overflow long before the viewport\n          // runs out. Letting the logo size to its content and splitting the\n          // remainder keeps it centred while giving the links real room.\n          <div className=\"w-full grid grid-cols-[1fr_auto_1fr] items-center gap-4\">\n            <div className=\"flex justify-start\">\n              <DesktopLinks isGlass={isGlass} linkComponent={Link} />\n            </div>\n            <div className=\"flex justify-center\">\n              <Logo themeBg={theme.bg} logoText={logoText} linkComponent={Link} />\n            </div>\n            <div className=\"flex justify-end gap-4\">\n              <DesktopActions themeBg={theme.bg} linkComponent={Link} />\n              <Button\n                variant=\"ghost\"\n                size=\"sm\"\n                aria-label=\"Open menu\"\n                iconLeft={<Menu className=\"w-6 h-6 text-foreground\" />}\n                className=\"lg:hidden shadow-none\"\n                onClick={() => setMobileMenuOpen(true)}\n              />\n            </div>\n          </div>\n        ) : (\n          <div className=\"w-full flex items-center justify-between\">\n            <div className=\"flex items-center gap-8\">\n              <Logo themeBg={theme.bg} logoText={logoText} linkComponent={Link} />\n              <DesktopLinks isGlass={isGlass} linkComponent={Link} />\n            </div>\n            <div className=\"flex items-center gap-4\">\n              <DesktopActions themeBg={theme.bg} linkComponent={Link} />\n              <Button\n                variant=\"ghost\"\n                size=\"sm\"\n                aria-label=\"Open menu\"\n                iconLeft={<Menu className=\"w-6 h-6\" />}\n                className=\"lg:hidden -mr-2 text-muted-foreground shadow-none\"\n                onClick={() => setMobileMenuOpen(true)}\n              />\n            </div>\n          </div>\n        )}\n      </nav>\n      <div\n        className={cn(\n          \"fixed inset-0 z-[100] pointer-events-none lg:hidden\",\n          !showLayer && \"hidden\",\n        )}\n      >\n        <div\n          onClick={closeMenu}\n          data-open={mobileMenuOpen}\n          className=\"navbar-mobile-overlay absolute inset-0 bg-black/40 backdrop-blur-sm pointer-events-auto\"\n        />\n        <div\n          data-open={mobileMenuOpen}\n          className={cn(\n            \"navbar-mobile-menu absolute right-0 top-0 bottom-0 w-full max-w-sm shadow-2xl pointer-events-auto flex flex-col\",\n            isGlass\n              ? \"bg-background/70 backdrop-blur-2xl border-l border-foreground/10\"\n              : \"bg-background border-l border-border\",\n          )}\n        >\n          <div\n            className={cn(\n              \"flex items-center justify-between p-6 border-b\",\n              isGlass\n                ? \"border-foreground/10\"\n                : \"border-border\",\n            )}\n          >\n            <Logo themeBg={theme.bg} logoText={logoText} linkComponent={Link} />\n            <Button\n              variant=\"ghost\"\n              size=\"sm\"\n              aria-label=\"Close menu\"\n              iconLeft={<X className=\"w-5 h-5\" />}\n              onClick={closeMenu}\n              className={cn(\n                \"-mr-2 rounded-full text-muted-foreground shadow-none hover:text-foreground\",\n                isGlass\n                  ? \"hover:bg-foreground/5\"\n                  : \"bg-muted\",\n              )}\n            />\n          </div>\n          <div className=\"flex-1 overflow-y-auto p-6 flex flex-col gap-6\">\n            {NAV_LINKS.map((link) => (\n              <div key={link.name} className=\"flex flex-col gap-3\">\n                <Link\n                  href={link.href}\n                  onClick={closeMenu}\n                  className=\"text-xl font-semibold text-foreground flex items-center justify-between\"\n                >\n                  {link.name}{\" \"}\n                  {link.hasDropdown && (\n                    <ArrowRight className=\"w-5 h-5 opacity-30\" />\n                  )}\n                </Link>\n                {link.hasDropdown && (\n                  <div\n                    className={cn(\n                      \"flex flex-col gap-3 pl-4 border-l-2\",\n                      isGlass\n                        ? \"border-foreground/10\"\n                        : \"border-border\",\n                    )}\n                  >\n                    {[\"Overview\", \"Features\", \"Integrations\"].map((sub) => (\n                      <Link\n                        key={sub}\n                        href=\"#\"\n                        onClick={closeMenu}\n                        className=\"text-base font-medium text-muted-foreground hover:text-foreground transition-colors\"\n                      >\n                        {sub}\n                      </Link>\n                    ))}\n                  </div>\n                )}\n              </div>\n            ))}\n          </div>\n          <div\n            className={cn(\n              \"p-6 flex flex-col gap-3 border-t\",\n              isGlass\n                ? \"bg-foreground/5 border-foreground/10\"\n                : \"bg-muted border-border\",\n            )}\n          >\n            <Link\n              href=\"#\"\n              onClick={closeMenu}\n              className={cn(\n                \"w-full py-3 px-4 text-center font-semibold text-foreground border rounded-xl transition-colors\",\n                isGlass\n                  ? \"border-foreground/10 hover:bg-foreground/5\"\n                  : \"border-border hover:bg-muted\",\n              )}\n            >\n              Sign In\n            </Link>\n            <Link\n              href=\"#\"\n              onClick={closeMenu}\n              className={cn(\n                \"w-full py-3 px-4 text-center font-semibold rounded-xl transition-transform active:scale-95\",\n                theme.bg,\n              )}\n            >\n              Get Started\n            </Link>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n\nfunction SpotlightRollupButton({\n  themeBg,\n  label = \"Get Started\",\n  href = \"#\",\n  className,\n  onClick,\n  linkComponent: Link,\n}: {\n  themeBg: string;\n  label?: string;\n  href?: string;\n  className?: string;\n  onClick?: () => void;\n  linkComponent: React.ElementType;\n}) {\n  return (\n    <Link\n      href={href}\n      onClick={onClick}\n      className={cn(\n        \"relative inline-flex items-center justify-center px-6 py-3 text-sm font-medium rounded-full overflow-hidden group border border-[var(--navbar-accent)] transition-shadow duration-300 hover:shadow-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--navbar-accent)]\",\n        themeBg,\n        className,\n      )}\n    >\n      <span className=\"absolute inset-0 bg-[#282828] translate-y-full transition-transform duration-300 ease-out group-hover:translate-y-0\" />\n      <span className=\"relative block overflow-hidden h-[1em] leading-none\">\n        <span className=\"flex justify-center items-center transition-transform duration-300 ease-out group-hover:-translate-y-full leading-none\">\n          {label}\n        </span>\n        <span className=\"absolute left-0 right-0 top-full flex justify-center items-center text-gray-200 transition-transform duration-300 ease-out group-hover:-translate-y-full leading-none\">\n          {label}\n        </span>\n      </span>\n    </Link>\n  );\n}\n\nfunction SpotlightNavbar({\n  color = \"primary\",\n  logoText = \"Nexus\",\n  linkComponent: Link = \"a\",\n}: {\n  color?: NavbarColor;\n  logoText?: string;\n  linkComponent?: React.ElementType;\n}) {\n  const { theme, style } = getThemeStyles(color);\n  const [scrolled, setScrolled] = useState(false);\n  const [mobileMenuOpen, setMobileMenuOpen] = useState(false);\n  const navRef = useRef<HTMLElement>(null);\n  const linksContainerRef = useRef<HTMLDivElement>(null);\n  const [pillRect, setPillRect] = useState<{\n    x: number;\n    y: number;\n    width: number;\n    height: number;\n    visible: boolean;\n  }>({ x: 0, y: 0, width: 0, height: 0, visible: false });\n\n  useEffect(() => {\n    const handleScroll = (e?: Event) => {\n      const target = e?.target;\n      if (\n        target instanceof HTMLElement &&\n        navRef.current &&\n        target.contains(navRef.current)\n      ) {\n        setScrolled(target.scrollTop > 40);\n        return;\n      }\n      setScrolled(window.scrollY > 40);\n    };\n    window.addEventListener(\"scroll\", handleScroll, {\n      capture: true,\n      passive: true,\n    });\n    handleScroll();\n    return () =>\n      window.removeEventListener(\"scroll\", handleScroll, { capture: true });\n  }, []);\n\n  const handleLinkEnter = (e: React.MouseEvent<HTMLElement>) => {\n    const container = linksContainerRef.current;\n    if (!container) return;\n    const itemRect = e.currentTarget.getBoundingClientRect();\n    const containerRect = container.getBoundingClientRect();\n    setPillRect({\n      x: itemRect.left - containerRect.left,\n      y: itemRect.top - containerRect.top,\n      width: itemRect.width,\n      height: itemRect.height,\n      visible: true,\n    });\n  };\n\n  const handleContainerLeave = () => {\n    setPillRect((prev) => ({ ...prev, visible: false }));\n  };\n\n  return (\n    <nav\n      ref={navRef}\n      style={style}\n      className={cn(\n        \"sticky top-0 z-50 w-full px-6 py-3 transition-all duration-300\",\n        !scrolled && \"bg-transparent\",\n      )}\n    >\n      <div\n        className={cn(\n          \"relative mx-auto flex items-center justify-between rounded-full px-4 py-1.5 transition-all duration-300\",\n          scrolled\n            ? \"max-w-3xl bg-foreground/[0.08] dark:bg-black/35 backdrop-blur-[10px] border border-foreground/10 shadow-sm\"\n            : \"max-w-4xl bg-transparent border border-transparent\",\n        )}\n      >\n        {/* Left: Our Logo (shrinks smoothly on scroll) */}\n        <div className=\"flex items-center gap-2\">\n          <Link href=\"#\" className=\"flex items-center gap-2 group py-1\">\n            <div\n              className={cn(\n                \"rounded-lg flex items-center justify-center transition-all duration-300 group-hover:scale-105\",\n                scrolled ? \"w-7 h-7\" : \"w-9 h-9\",\n                theme.bg,\n              )}\n            >\n              <Command\n                className={cn(\n                  \"transition-all duration-300\",\n                  scrolled ? \"w-3.5 h-3.5\" : \"w-4 h-4\",\n                )}\n              />\n            </div>\n            <span\n              className={cn(\n                \"font-bold tracking-tight text-foreground transition-all duration-300\",\n                scrolled ? \"text-lg\" : \"text-xl\",\n              )}\n            >\n              {logoText}\n            </span>\n          </Link>\n        </div>\n\n        {/* Center: Desktop Nav Links with Sliding Hover Pill */}\n        <div\n          ref={linksContainerRef}\n          onMouseLeave={handleContainerLeave}\n          className=\"relative hidden md:flex items-center gap-2 ml-7\"\n        >\n          <div\n            aria-hidden\n            className=\"absolute left-0 top-0 rounded-full bg-foreground/10 dark:bg-[#262626] z-0 pointer-events-none\"\n            style={{\n              width: pillRect.width,\n              height: pillRect.height,\n              transform: `translate3d(${pillRect.x}px, ${pillRect.y}px, 0) scale(${pillRect.visible ? 1 : 0.95})`,\n              opacity: pillRect.visible ? 1 : 0,\n              transition:\n                \"transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), width 0.3s cubic-bezier(0.22, 1, 0.36, 1), height 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease-out\",\n            }}\n          />\n          {NAV_LINKS.map((link) => (\n            <Link\n              key={link.name}\n              href={link.href}\n              onMouseEnter={handleLinkEnter}\n              className=\"nav-item relative z-10 px-4 py-2 text-sm rounded-full text-foreground\"\n            >\n              {link.name}\n            </Link>\n          ))}\n        </div>\n\n        {/* Right: Animated Roll-Up Pill CTA Button */}\n        <div className=\"hidden md:block\">\n          <SpotlightRollupButton\n            themeBg={theme.bg}\n            label=\"Get Started\"\n            linkComponent={Link}\n          />\n        </div>\n\n        {/* Mobile Hamburger Button */}\n        <button\n          type=\"button\"\n          onClick={() => setMobileMenuOpen((prev) => !prev)}\n          aria-label=\"Toggle menu\"\n          className=\"md:hidden w-9 h-9 flex items-center justify-center rounded-full cursor-pointer bg-foreground/10 dark:bg-white/10\"\n        >\n          {mobileMenuOpen ? (\n            <X className=\"w-5 h-5 text-foreground\" />\n          ) : (\n            <span className=\"block w-5 h-[2px] bg-foreground relative\">\n              <span className=\"absolute left-0 top-[-6px] w-5 h-[2px] bg-foreground\" />\n              <span className=\"absolute left-0 top-[6px] w-5 h-[2px] bg-foreground\" />\n            </span>\n          )}\n        </button>\n      </div>\n\n      {/* Mobile Dropdown Menu Card */}\n      {mobileMenuOpen && (\n        <div className=\"md:hidden absolute left-6 right-6 top-full mt-1 mx-auto max-w-4xl rounded-2xl bg-background/40 dark:bg-black/35 backdrop-blur-[12px] border border-foreground/10 p-6 space-y-2 flex flex-col shadow-lg animate-in fade-in slide-in-from-top-2 duration-200 z-50\">\n          {NAV_LINKS.map((link) => (\n            <Link\n              key={link.name}\n              href={link.href}\n              onClick={() => setMobileMenuOpen(false)}\n              className=\"block text-foreground text-sm font-medium px-4 py-3 rounded-lg hover:bg-foreground/10 dark:hover:bg-white/10 transition\"\n            >\n              {link.name}\n            </Link>\n          ))}\n          <SpotlightRollupButton\n            themeBg={theme.bg}\n            label=\"Get Started\"\n            className=\"w-full mt-4\"\n            onClick={() => setMobileMenuOpen(false)}\n            linkComponent={Link}\n          />\n        </div>\n      )}\n    </nav>\n  );\n}\n\nexport function NavbarBlock({\n  variant = \"default\",\n  color = \"primary\",\n  logoText,\n  linkComponent = \"a\",\n}: NavbarProps) {\n  if (variant === \"ecommerce-mega-nav\") {\n    return (\n      <EcommerceMegaNav\n        color={color}\n        logoText={logoText ?? \"NUTRIFY\"}\n        linkComponent={linkComponent}\n      />\n    );\n  }\n\n  if (variant === \"spotlight\") {\n    return (\n      <SpotlightNavbar\n        color={color}\n        logoText={logoText ?? \"Nexus\"}\n        linkComponent={linkComponent}\n      />\n    );\n  }\n\n  return (\n    <StandardNavbar\n      variant={variant}\n      color={color}\n      logoText={logoText ?? \"Nexus\"}\n      linkComponent={linkComponent}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/custom/blocks/NavbarBlock.tsx"
    },
    {
      "path": "src/components/custom/blocks/navbar-theme.ts",
      "content": "\"use client\";\n\nimport React from \"react\";\n\nconst colorThemes: Record<string, Record<string, string>> = {\n  lavender: {\n    text: \"text-[#9b8afb]\",\n    bg: \"bg-[#9b8afb] hover:bg-[#8b78f6] text-[#09090b]\",\n    bgSoft: \"bg-[#9b8afb]/10 text-[#9b8afb]\",\n  },\n  indigo: {\n    text: \"text-indigo-600 dark:text-indigo-400\",\n    bg: \"bg-indigo-600 hover:bg-indigo-700 text-white\",\n    bgSoft:\n      \"bg-indigo-50 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400\",\n  },\n  rose: {\n    text: \"text-rose-600 dark:text-rose-400\",\n    bg: \"bg-rose-600 hover:bg-rose-700 text-white\",\n    bgSoft: \"bg-rose-50 dark:bg-rose-500/10 text-rose-600 dark:text-rose-400\",\n  },\n  emerald: {\n    text: \"text-emerald-600 dark:text-emerald-400\",\n    bg: \"bg-emerald-600 hover:bg-emerald-700 text-white\",\n    bgSoft:\n      \"bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400\",\n  },\n  zinc: {\n    text: \"text-zinc-900 dark:text-zinc-100\",\n    bg: \"bg-zinc-900 hover:bg-zinc-800 dark:bg-zinc-100 dark:hover:bg-zinc-200 text-white dark:text-zinc-900\",\n    bgSoft: \"bg-zinc-100 dark:bg-zinc-800/50 text-zinc-900 dark:text-zinc-100\",\n  },\n};\n\nconst hexToRgb = (hex: string) => {\n  let cleanHex = hex.replace(/^#/, \"\");\n  if (cleanHex.length === 3)\n    cleanHex = cleanHex\n      .split(\"\")\n      .map((x) => x + x)\n      .join(\"\");\n  const result = /^([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(cleanHex);\n  return result\n    ? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}`\n    : \"99, 102, 241\";\n};\n\nconst contrastingForeground = (rgb: string) => {\n  const [r, g, b] = rgb.split(\",\").map((v) => parseInt(v.trim(), 10));\n  const channel = (v: number) => {\n    const c = v / 255;\n    return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n  };\n  const luminance =\n    0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);\n  return luminance > 0.45 ? \"#09090b\" : \"#ffffff\";\n};\n\n// One CSS colour per theme key, exposed as `--navbar-accent` so surfaces (the\n// dropdown panel, hover washes) can be tinted from it whatever the source.\nconst accentColors: Record<string, string> = {\n  lavender: \"#9b8afb\",\n  indigo: \"#4f46e5\",\n  rose: \"#e11d48\",\n  emerald: \"#059669\",\n  zinc: \"#52525b\",\n};\n\nexport const getThemeStyles = (color: string) => {\n  if (color === \"primary\" || color === \"default\" || !colorThemes[color]) {\n    if (color && color.startsWith(\"#\")) {\n      const rgb = hexToRgb(color);\n      return {\n        theme: {\n          text: \"text-[var(--theme-color)]\",\n          bg: \"bg-[var(--theme-color)] text-[var(--theme-on-color)] hover:opacity-90\",\n          bgSoft:\n            \"bg-[rgba(var(--theme-color-rgb),0.1)] text-[var(--theme-color)]\",\n        },\n        style: {\n          \"--theme-color\": color,\n          \"--theme-color-rgb\": rgb,\n          \"--theme-on-color\": contrastingForeground(rgb),\n          \"--navbar-accent\": color,\n        } as React.CSSProperties,\n      };\n    }\n    return {\n      theme: {\n        text: \"text-primary\",\n        bg: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n        bgSoft: \"bg-primary/10 text-primary\",\n      },\n      style: { \"--navbar-accent\": \"var(--primary)\" } as React.CSSProperties,\n    };\n  }\n  return {\n    theme: colorThemes[color],\n    style: { \"--navbar-accent\": accentColors[color] } as React.CSSProperties,\n  };\n};\n",
      "type": "registry:component",
      "target": "components/custom/blocks/navbar-theme.ts"
    }
  ],
  "docs": "Named exports: NavbarBlock, getThemeStyles (from navbar-theme.ts, which installs alongside). Variants: default | floating | centered | minimal | glass | spotlight | ecommerce-mega-nav. Links render through `linkComponent` (a plain `a` by default; pass next/link in Next.js). The mobile menu toggles are the `button` item, which installs alongside. For app chrome with dropdown panels, use `navigation-menu`.",
  "categories": [
    "navigation",
    "marketing"
  ],
  "type": "registry:component"
}
