{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "fullscreen-overlay-menu",
  "title": "Fullscreen Overlay Menu",
  "description": "A full-screen menu that grows out of its Menu button in a circle: large serif links rise into a hairline framed grid, the hovered link dims the rest and fills a preview panel, with contact and social cells, focus trap and Escape to close.",
  "dependencies": [
    "motion",
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/fullscreen-overlay-menu/fullscreen-overlay-menu.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { ArrowUpRight } from \"lucide-react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type MenuTheme = \"dark\" | \"light\";\n\nexport interface OverlayMenuLink {\n  /** A stable, unique item identifier. */\n  id: string;\n  label: string;\n  href: string;\n  description?: string;\n  badge?: string;\n}\n\nexport interface OverlayMenuSocial {\n  label: string;\n  href: string;\n}\n\nconst DEFAULT_LINKS: OverlayMenuLink[] = [\n  { id: \"work\", label: \"Work\", href: \"/work\", description: \"A few things, thoughtfully made.\" },\n  { id: \"studio\", label: \"Studio\", href: \"/studio\", description: \"Independent minds. Shared curiosity.\" },\n  { id: \"journal\", label: \"Journal\", href: \"/journal\", description: \"Notes from the in-between.\", badge: \"New\" },\n  { id: \"contact\", label: \"Contact\", href: \"/contact\", description: \"Every good thing starts with a hello.\" },\n];\n\nconst DEFAULT_SOCIALS: OverlayMenuSocial[] = [\n  { label: \"Instagram\", href: \"#\" },\n  { label: \"Are.na\", href: \"#\" },\n  { label: \"LinkedIn\", href: \"#\" },\n];\n\nfunction palette(theme: MenuTheme): React.CSSProperties & Record<`--${string}`, string> {\n  const light = theme === \"light\";\n  return {\n    \"--nav-page\": light ? \"#f5f4f1\" : \"#0e0e0e\",\n    \"--nav-ink\": light ? \"#0a0a0a\" : \"#f5f4f1\",\n    \"--nav-muted\": light ? \"rgba(10,10,10,.52)\" : \"rgba(245,244,241,.52)\",\n    \"--nav-line\": light ? \"rgba(10,10,10,.1)\" : \"rgba(245,244,241,.1)\",\n    \"--nav-soft\": light ? \"rgba(10,10,10,.045)\" : \"rgba(245,244,241,.045)\",\n    \"--nav-panel\": light ? \"rgba(245,244,241,.96)\" : \"rgba(14,14,14,.96)\",\n    \"--nav-serif\": \"var(--navbar-serif, 'Instrument Serif', Georgia, serif)\",\n  };\n}\n\nconst focus = \"outline-none focus-visible:ring-2 focus-visible:ring-[var(--nav-ink)]/40 focus-visible:ring-offset-4 focus-visible:ring-offset-[var(--nav-page)]\";\nconst muted = \"text-[color:var(--nav-muted)]\";\nconst serif = \"font-[family-name:var(--nav-serif)] font-normal tracking-[-.035em]\";\nconst EASE = [0.16, 1, 0.3, 1] as const;\nconst EASE_INOUT = [0.77, 0, 0.175, 1] as const;\n\nfunction subscribeReducedMotion(onChange: () => void) {\n  const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n  query.addEventListener(\"change\", onChange);\n  return () => query.removeEventListener(\"change\", onChange);\n}\nconst reducedMotionSnapshot = () => window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\nconst serverReducedMotionSnapshot = () => false;\nfunction useReducedMotion() {\n  return React.useSyncExternalStore(subscribeReducedMotion, reducedMotionSnapshot, serverReducedMotionSnapshot);\n}\n\nfunction useDisclosure(value: boolean | undefined, defaultValue: boolean, onChange?: (open: boolean) => void) {\n  const [internal, setInternal] = React.useState(defaultValue);\n  const open = value ?? internal;\n  const setOpen = React.useCallback(\n    (next: boolean) => {\n      if (value === undefined) setInternal(next);\n      onChange?.(next);\n    },\n    [value, onChange],\n  );\n  return [open, setOpen] as const;\n}\n\nexport interface FullscreenOverlayMenuProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  theme?: MenuTheme;\n  logo?: React.ReactNode;\n  logoHref?: string;\n  items?: OverlayMenuLink[];\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  /** Cover the nearest positioned ancestor instead of the whole window (for previews and embedded layouts). */\n  contained?: boolean;\n  email?: string;\n  socials?: OverlayMenuSocial[];\n  address?: string;\n  tagline?: string;\n  ctaLabel?: string;\n  ctaHref?: string;\n  showNumbers?: boolean;\n  onNavigate?: (item: OverlayMenuLink, event: React.MouseEvent<HTMLAnchorElement>) => void;\n}\n\nexport function FullscreenOverlayMenu({\n  theme = \"dark\",\n  logo = \"Forme.\",\n  logoHref = \"/\",\n  items = DEFAULT_LINKS,\n  open: controlledOpen,\n  defaultOpen = false,\n  onOpenChange,\n  contained = false,\n  email = \"hello@forme.studio\",\n  socials = DEFAULT_SOCIALS,\n  address = \"Studio 4, 12 Rua das Flores, Lisbon\",\n  tagline = \"Independent minds. Considered work.\",\n  ctaLabel = \"Let's talk\",\n  ctaHref = \"/contact\",\n  showNumbers = true,\n  onNavigate,\n  className,\n  style,\n  ...props\n}: FullscreenOverlayMenuProps) {\n  const [open, setOpen] = useDisclosure(controlledOpen, defaultOpen, onOpenChange);\n  const reduce = useReducedMotion();\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const overlayRef = React.useRef<HTMLDivElement>(null);\n  const id = React.useId();\n  const [hovered, setHovered] = React.useState<number | null>(null);\n  // Where the circle grows from (the trigger's centre) and how big it must get to cover everything.\n  const [origin, setOrigin] = React.useState({ x: 0, y: 0, r: 2000 });\n\n  const measure = React.useCallback(() => {\n    const t = triggerRef.current?.getBoundingClientRect();\n    const parent = (contained ? rootRef.current?.offsetParent : null) as HTMLElement | null;\n    const box = parent ? parent.getBoundingClientRect() : new DOMRect(0, 0, window.innerWidth, window.innerHeight);\n    if (!t) return;\n    // Rects are in screen pixels; clip-path is in the element's own CSS pixels (they differ under CSS zoom).\n    const k = parent && parent.offsetWidth ? box.width / parent.offsetWidth : 1;\n    const x = (t.left + t.width / 2 - box.left) / k;\n    const y = (t.top + t.height / 2 - box.top) / k;\n    const w = box.width / k;\n    const h = box.height / k;\n    const r = Math.hypot(Math.max(x, w - x), Math.max(y, h - y)) + 8;\n    setOrigin({ x, y, r });\n  }, [contained]);\n\n  const toggle = () => {\n    if (!open) measure();\n    setOpen(!open);\n  };\n\n  // Focus the first link on open, hand focus back to the trigger on close.\n  const wasOpen = React.useRef(open);\n  React.useEffect(() => {\n    if (open && !wasOpen.current) {\n      const id = window.setTimeout(() => overlayRef.current?.querySelector<HTMLElement>(\"[data-menu-link]\")?.focus({ preventScroll: true }), reduce ? 0 : 320);\n      wasOpen.current = open;\n      return () => window.clearTimeout(id);\n    }\n    if (!open && wasOpen.current) triggerRef.current?.focus({ preventScroll: true });\n    wasOpen.current = open;\n  }, [open, reduce]);\n\n  // Escape closes; Tab stays inside the trigger and the overlay; the page doesn't scroll behind a window-wide menu.\n  React.useEffect(() => {\n    if (!open) return;\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        e.preventDefault();\n        setOpen(false);\n        return;\n      }\n      if (e.key !== \"Tab\") return;\n      const nodes = [triggerRef.current, ...Array.from(overlayRef.current?.querySelectorAll<HTMLElement>(\"a[href], button\") ?? [])].filter(Boolean) as HTMLElement[];\n      if (!nodes.length) return;\n      const first = nodes[0];\n      const last = nodes[nodes.length - 1];\n      if (e.shiftKey && document.activeElement === first) {\n        e.preventDefault();\n        last.focus();\n      } else if (!e.shiftKey && document.activeElement === last) {\n        e.preventDefault();\n        first.focus();\n      }\n    };\n    document.addEventListener(\"keydown\", onKey);\n    const prevOverflow = document.documentElement.style.overflow;\n    if (!contained) document.documentElement.style.overflow = \"hidden\";\n    return () => {\n      document.removeEventListener(\"keydown\", onKey);\n      if (!contained) document.documentElement.style.overflow = prevOverflow;\n    };\n  }, [open, contained, setOpen]);\n\n  React.useEffect(() => {\n    if (!open) return;\n    window.addEventListener(\"resize\", measure);\n    return () => window.removeEventListener(\"resize\", measure);\n  }, [open, measure]);\n\n  const shown = hovered !== null ? items[hovered] : null;\n  const circle = (r: number) => `circle(${r}px at ${origin.x.toFixed(1)}px ${origin.y.toFixed(1)}px)`;\n\n  return (\n    <div ref={rootRef} {...props} data-theme={theme} className={cn(\"@container text-[color:var(--nav-ink)]\", !contained && \"relative z-30\", className)} style={{ ...palette(theme), ...style }}>\n      <header className=\"relative z-20 flex min-h-20 items-center justify-between gap-4 px-6 @[700px]:px-10\">\n        <a href={logoHref} className={cn(serif, \"text-[30px] leading-none\", focus)}>\n          {logo}\n        </a>\n        <div className=\"flex items-center gap-2\">\n          {ctaLabel && (\n            <a\n              href={ctaHref}\n              className={cn(\n                \"hidden items-center gap-2 rounded-full bg-[var(--nav-ink)] px-4 py-2.5 text-xs text-[color:var(--nav-page)] transition-opacity duration-300 @[560px]:inline-flex\",\n                open && \"pointer-events-none opacity-0\",\n                focus,\n              )}\n              tabIndex={open ? -1 : undefined}\n            >\n              {ctaLabel}\n              <ArrowUpRight size={13} />\n            </a>\n          )}\n          <button\n            ref={triggerRef}\n            type=\"button\"\n            onClick={toggle}\n            aria-expanded={open}\n            aria-controls={id}\n            aria-label={open ? \"Close menu\" : \"Open menu\"}\n            className={cn(\"group flex cursor-pointer items-center gap-3 rounded-full border border-[var(--nav-line)] bg-[var(--nav-page)] py-2.5 pr-3.5 pl-4 text-xs transition-colors hover:bg-[var(--nav-soft)]\", focus)}\n          >\n            {/* Label rolls between Menu and Close */}\n            <span className=\"relative block h-4 overflow-hidden leading-4\">\n              <motion.span className=\"block\" initial={false} animate={{ y: open ? \"-50%\" : \"0%\" }} transition={{ duration: reduce ? 0 : 0.45, ease: EASE_INOUT }}>\n                <span className=\"block\">Menu</span>\n                <span className=\"block\">Close</span>\n              </motion.span>\n            </span>\n            <span className=\"relative block h-3 w-4\" aria-hidden=\"true\">\n              <motion.span className=\"absolute left-0 h-px w-4 bg-current\" initial={false} animate={open ? { top: 6, rotate: 45 } : { top: 3, rotate: 0 }} transition={{ duration: reduce ? 0 : 0.4, ease: EASE_INOUT }} />\n              <motion.span className=\"absolute left-0 h-px w-4 bg-current\" initial={false} animate={open ? { top: 6, rotate: -45, width: 16 } : { top: 9, rotate: 0, width: 10 }} transition={{ duration: reduce ? 0 : 0.4, ease: EASE_INOUT }} />\n            </span>\n          </button>\n        </div>\n      </header>\n\n      <AnimatePresence>\n        {open && (\n          <motion.div\n            ref={overlayRef}\n            id={id}\n            role=\"dialog\"\n            aria-modal=\"true\"\n            aria-label=\"Site menu\"\n            className={cn(contained ? \"absolute\" : \"fixed\", \"inset-0 z-10 flex flex-col overflow-y-auto bg-[var(--nav-page)] pt-20\")}\n            initial={{ clipPath: circle(0) }}\n            animate={{ clipPath: circle(origin.r) }}\n            exit={{ clipPath: circle(0) }}\n            transition={{ duration: reduce ? 0 : 0.75, ease: EASE_INOUT }}\n          >\n            {/* framed grid: two rails and a hairline under the header */}\n            <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-x-6 top-20 bottom-0 border-x border-[var(--nav-line)] @[700px]:inset-x-10\" />\n            <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-x-0 top-20 h-px bg-[var(--nav-line)]\" />\n\n            <div className=\"relative mx-6 grid flex-1 @[700px]:mx-10 @[760px]:grid-cols-[1.45fr_1fr]\">\n              <nav aria-label=\"Site menu links\" className=\"group/list flex flex-col justify-center py-6 @[760px]:py-8\" onMouseLeave={() => setHovered(null)}>\n                {items.map((item, index) => (\n                  <a\n                    key={item.id}\n                    data-menu-link\n                    href={item.href}\n                    onMouseEnter={() => setHovered(index)}\n                    // Keyboard focus previews a link; the focus we move in on open (after a click) doesn't.\n                    onFocus={(e) => e.currentTarget.matches(\":focus-visible\") && setHovered(index)}\n                    onBlur={() => setHovered(null)}\n                    onClick={(e) => {\n                      onNavigate?.(item, e);\n                      setOpen(false);\n                    }}\n                    className={cn(\n                      \"group/link relative flex items-start gap-4 border-b border-[var(--nav-line)] px-5 py-3 transition-colors duration-300 first:border-t @[700px]:px-8\",\n                      hovered !== null && hovered !== index ? muted : \"\",\n                      focus,\n                      \"focus-visible:ring-offset-0\",\n                    )}\n                  >\n                    {showNumbers && (\n                      <span className={cn(\"mt-2 w-5 shrink-0 text-[10px] tabular-nums @[760px]:mt-3\", muted)}>{String(index + 1).padStart(2, \"0\")}</span>\n                    )}\n                    {/* The mask moves on hover, not the word inside it, so the last letter never gets clipped. */}\n                    <span className=\"block overflow-hidden pr-1 pb-[0.08em] transition-transform duration-500 group-hover/link:translate-x-3\" style={{ transitionTimingFunction: \"cubic-bezier(.16,1,.3,1)\" }}>\n                      <motion.span\n                        className={cn(serif, \"block text-[clamp(36px,7.4cqw,72px)] leading-[0.95]\")}\n                        initial={{ y: \"110%\" }}\n                        animate={{ y: \"0%\" }}\n                        exit={{ y: \"110%\" }}\n                        transition={{ duration: reduce ? 0 : 0.8, ease: EASE, delay: reduce ? 0 : 0.28 + index * 0.06 }}\n                      >\n                        {item.label}\n                      </motion.span>\n                    </span>\n                    {item.badge && <span className=\"mt-2 rounded-full border border-[var(--nav-line)] px-2 py-0.5 text-[9px] @[760px]:mt-4\">{item.badge}</span>}\n                    <ArrowUpRight\n                      size={20}\n                      strokeWidth={1.25}\n                      className=\"ml-auto self-center opacity-0 transition-all duration-300 group-hover/link:translate-x-0 group-hover/link:opacity-100 group-focus-visible/link:opacity-100 -translate-x-2\"\n                    />\n                  </a>\n                ))}\n              </nav>\n\n              <motion.aside\n                className=\"hidden flex-col border-l border-[var(--nav-line)] @[760px]:flex\"\n                initial={{ opacity: 0 }}\n                animate={{ opacity: 1 }}\n                exit={{ opacity: 0 }}\n                transition={{ duration: reduce ? 0 : 0.5, delay: reduce ? 0 : 0.45 }}\n              >\n                {/* preview of the link under the pointer, over slowly turning rings */}\n                <div className=\"relative flex min-h-[230px] flex-1 flex-col justify-end overflow-hidden p-8\">\n                  <motion.div\n                    aria-hidden=\"true\"\n                    className=\"pointer-events-none absolute -top-16 -right-24 size-[360px]\"\n                    animate={{ rotate: (hovered ?? 0) * 38, scale: hovered === null ? 1 : 1.06 }}\n                    transition={{ duration: reduce ? 0 : 1.1, ease: EASE }}\n                  >\n                    <div className=\"absolute inset-0 rounded-full border border-[var(--nav-line)] bg-[radial-gradient(ellipse_at_25%_20%,var(--nav-soft),transparent_65%)]\" />\n                    <div className=\"absolute inset-10 rounded-full border border-[var(--nav-line)]\" />\n                    <div className=\"absolute top-1/2 -left-10 h-12 w-[440px] -rotate-12 rounded-[100%] border border-[var(--nav-line)]\" />\n                  </motion.div>\n                  <p className={cn(\"mb-4 text-[9px] font-medium tracking-[.2em] uppercase\", muted)}>✦ {shown ? `Now / ${shown.label}` : \"A small studio\"}</p>\n                  <AnimatePresence mode=\"wait\" initial={false}>\n                    <motion.p\n                      key={shown?.id ?? \"tagline\"}\n                      className={cn(serif, \"max-w-[18ch] text-[30px] leading-[1.08]\")}\n                      initial={{ opacity: 0, y: 10 }}\n                      animate={{ opacity: 1, y: 0 }}\n                      exit={{ opacity: 0, y: -8 }}\n                      transition={{ duration: reduce ? 0 : 0.3, ease: EASE }}\n                    >\n                      {shown?.description ?? tagline}\n                    </motion.p>\n                  </AnimatePresence>\n                </div>\n                <div className=\"grid grid-cols-2 border-t border-[var(--nav-line)]\">\n                  <div className=\"border-r border-[var(--nav-line)] p-8\">\n                    <p className={cn(\"mb-3 text-[9px] tracking-[.2em] uppercase\", muted)}>Say hello</p>\n                    <a href={`mailto:${email}`} className={cn(\"text-xs underline-offset-4 hover:underline\", focus)}>\n                      {email}\n                    </a>\n                  </div>\n                  <div className=\"p-8\">\n                    <p className={cn(\"mb-3 text-[9px] tracking-[.2em] uppercase\", muted)}>Follow</p>\n                    <ul className=\"space-y-1.5 text-xs\">\n                      {socials.map((s) => (\n                        <li key={s.label}>\n                          <a href={s.href} className={cn(\"inline-flex items-center gap-1.5 underline-offset-4 hover:underline\", focus)}>\n                            {s.label}\n                            <ArrowUpRight size={11} />\n                          </a>\n                        </li>\n                      ))}\n                    </ul>\n                  </div>\n                </div>\n              </motion.aside>\n            </div>\n\n            <motion.div\n              className={cn(\"relative mx-6 flex flex-wrap items-center justify-between gap-3 border-t border-[var(--nav-line)] px-5 py-5 text-[10px] @[700px]:mx-10 @[700px]:px-8\", muted)}\n              initial={{ opacity: 0 }}\n              animate={{ opacity: 1 }}\n              exit={{ opacity: 0 }}\n              transition={{ duration: reduce ? 0 : 0.4, delay: reduce ? 0 : 0.5 }}\n            >\n              <span>{address}</span>\n              <a href={`mailto:${email}`} className={cn(\"@[760px]:hidden\", focus)}>\n                {email}\n              </a>\n              <span className=\"hidden @[760px]:inline\">Good things start with a hello.</span>\n            </motion.div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}