{"slug":"not-found","name":"404 / Not Found","description":"Animated 404 pages in five styles: glitch scramble, magnetic digits, cursor spotlight, a fanning card stack and a typed terminal.","category":"blocks","source_url":"https://beui.dev/r/not-found/raw","detail_url":"https://beui.dev/r/not-found","raw_url":"https://beui.dev/r/not-found/raw","page_url":"https://beui.dev/components/blocks/not-found","markdown_url":"https://beui.dev/components/blocks/not-found.md","published_at":"2026-06-21","updated_at":"2026-11-24","dependencies":["clsx","motion","react","tailwind-merge"],"internal":["./glitch","./magnetic","./shared","./spotlight","./stacked","./terminal","@/components/motion/magnetic","@/components/motion/text-reveal","@/lib/ease","@/lib/hooks/use-hover-capable","@/lib/i18n","@/lib/utils"],"install_slugs":["not-found-glitch","not-found-magnetic","not-found-spotlight","not-found-stacked","not-found-terminal"],"requires_theme":false,"props":[{"displayName":"NotFoundGlitch","props":[{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."},{"name":"code","type":"string","required":false,"defaultValue":"404","description":"The big status code."},{"name":"title","type":"string","required":false,"defaultValue":null,"description":"Heading under the status code. Default: \"Page not found\""},{"name":"description","type":"string","required":false,"defaultValue":null,"description":"Supporting line under the heading."},{"name":"homeHref","type":"string","required":false,"defaultValue":null,"description":"Link for the primary button. Default: \"/\""},{"name":"homeLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the primary button. Default: \"Back home\""},{"name":"browseHref","type":"string","required":false,"defaultValue":null,"description":"Link for the secondary button. Default: \"/components/motion\""},{"name":"browseLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the secondary button. Default: \"Browse components\""},{"name":"labels","type":"Partial<{ title: string; description: string; homeLabel: string; browseLabel: string; stackedCaption: string; terminalError: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string. Explicit `title`, `description`, `homeLabel` and `browseLabel` props still win."}]},{"displayName":"NotFoundMagnetic","props":[{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."},{"name":"code","type":"string","required":false,"defaultValue":"404","description":"The big status code."},{"name":"title","type":"string","required":false,"defaultValue":null,"description":"Heading under the status code. Default: \"Page not found\""},{"name":"description","type":"string","required":false,"defaultValue":null,"description":"Supporting line under the heading."},{"name":"homeHref","type":"string","required":false,"defaultValue":null,"description":"Link for the primary button. Default: \"/\""},{"name":"homeLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the primary button. Default: \"Back home\""},{"name":"browseHref","type":"string","required":false,"defaultValue":null,"description":"Link for the secondary button. Default: \"/components/motion\""},{"name":"browseLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the secondary button. Default: \"Browse components\""},{"name":"labels","type":"Partial<{ title: string; description: string; homeLabel: string; browseLabel: string; stackedCaption: string; terminalError: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string. Explicit `title`, `description`, `homeLabel` and `browseLabel` props still win."}]},{"displayName":"NotFoundActions","props":[{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."},{"name":"labels","type":"Partial<{ title: string; description: string; homeLabel: string; browseLabel: string; stackedCaption: string; terminalError: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string. Explicit `title`, `description`, `homeLabel` and `browseLabel` props still win."},{"name":"homeHref","type":"string","required":false,"defaultValue":"/","description":"Link for the primary button. Default: \"/\""},{"name":"homeLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the primary button. Default: \"Back home\""},{"name":"browseHref","type":"string","required":false,"defaultValue":"/components/motion","description":"Link for the secondary button. Default: \"/components/motion\""},{"name":"browseLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the secondary button. Default: \"Browse components\""}]},{"displayName":"NotFoundStage","props":[{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."}]},{"displayName":"useNotFoundMessages","props":[{"name":"title","type":"string","required":false,"defaultValue":null,"description":""},{"name":"description","type":"string","required":false,"defaultValue":null,"description":""},{"name":"homeLabel","type":"string","required":false,"defaultValue":null,"description":""},{"name":"browseLabel","type":"string","required":false,"defaultValue":null,"description":""},{"name":"stackedCaption","type":"string","required":false,"defaultValue":null,"description":""},{"name":"terminalError","type":"string","required":false,"defaultValue":null,"description":""}]},{"displayName":"NotFoundSpotlight","props":[{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."},{"name":"code","type":"string","required":false,"defaultValue":"404","description":"The big status code."},{"name":"title","type":"string","required":false,"defaultValue":null,"description":"Heading under the status code. Default: \"Page not found\""},{"name":"description","type":"string","required":false,"defaultValue":null,"description":"Supporting line under the heading."},{"name":"homeHref","type":"string","required":false,"defaultValue":null,"description":"Link for the primary button. Default: \"/\""},{"name":"homeLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the primary button. Default: \"Back home\""},{"name":"browseHref","type":"string","required":false,"defaultValue":null,"description":"Link for the secondary button. Default: \"/components/motion\""},{"name":"browseLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the secondary button. Default: \"Browse components\""},{"name":"labels","type":"Partial<{ title: string; description: string; homeLabel: string; browseLabel: string; stackedCaption: string; terminalError: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string. Explicit `title`, `description`, `homeLabel` and `browseLabel` props still win."}]},{"displayName":"NotFoundStacked","props":[{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."},{"name":"code","type":"string","required":false,"defaultValue":"404","description":"The big status code."},{"name":"title","type":"string","required":false,"defaultValue":null,"description":"Heading under the status code. Default: \"Page not found\""},{"name":"description","type":"string","required":false,"defaultValue":null,"description":"Supporting line under the heading."},{"name":"homeHref","type":"string","required":false,"defaultValue":null,"description":"Link for the primary button. Default: \"/\""},{"name":"homeLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the primary button. Default: \"Back home\""},{"name":"browseHref","type":"string","required":false,"defaultValue":null,"description":"Link for the secondary button. Default: \"/components/motion\""},{"name":"browseLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the secondary button. Default: \"Browse components\""},{"name":"labels","type":"Partial<{ title: string; description: string; homeLabel: string; browseLabel: string; stackedCaption: string; terminalError: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string. Explicit `title`, `description`, `homeLabel` and `browseLabel` props still win."}]},{"displayName":"NotFoundTerminal","props":[{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."},{"name":"code","type":"string","required":false,"defaultValue":"404","description":"The big status code."},{"name":"title","type":"string","required":false,"defaultValue":null,"description":"Heading under the status code. Default: \"Page not found\""},{"name":"description","type":"string","required":false,"defaultValue":null,"description":"Supporting line under the heading."},{"name":"homeHref","type":"string","required":false,"defaultValue":null,"description":"Link for the primary button. Default: \"/\""},{"name":"homeLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the primary button. Default: \"Back home\""},{"name":"browseHref","type":"string","required":false,"defaultValue":null,"description":"Link for the secondary button. Default: \"/components/motion\""},{"name":"browseLabel","type":"string","required":false,"defaultValue":null,"description":"Text of the secondary button. Default: \"Browse components\""},{"name":"labels","type":"Partial<{ title: string; description: string; homeLabel: string; browseLabel: string; stackedCaption: string; terminalError: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string. Explicit `title`, `description`, `homeLabel` and `browseLabel` props still win."}]}],"types":[],"files":[{"path":"components/motion/not-found/index.tsx","type":"component","content":"// beui.dev/components/blocks/not-found\nexport { NotFoundGlitch } from \"./glitch\";\nexport { NotFoundMagnetic } from \"./magnetic\";\nexport {\n  NOT_FOUND_DEFAULTS,\n  NotFoundActions,\n  type NotFoundMessages,\n  type NotFoundProps,\n  NotFoundStage,\n  notFoundMessages,\n  useNotFoundMessages,\n} from \"./shared\";\nexport { NotFoundSpotlight } from \"./spotlight\";\nexport { NotFoundStacked } from \"./stacked\";\nexport { NotFoundTerminal } from \"./terminal\";\n"},{"path":"components/motion/not-found/shared.tsx","type":"component","content":"\"use client\";\n// beui.dev/components/blocks/not-found\n\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { SPRING_PRESS } from \"@/lib/ease\";\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\";\nimport { useMessages } from \"@/lib/i18n\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface NotFoundProps {\n  /** Classes merged onto the root element. */\n  className?: string;\n  /** The big status code. */\n  code?: string;\n  /** Heading under the status code. Default: \"Page not found\" */\n  title?: string;\n  /** Supporting line under the heading. */\n  description?: string;\n  /** Link for the primary button. Default: \"/\" */\n  homeHref?: string;\n  /** Text of the primary button. Default: \"Back home\" */\n  homeLabel?: string;\n  /** Link for the secondary button. Default: \"/components/motion\" */\n  browseHref?: string;\n  /** Text of the secondary button. Default: \"Browse components\" */\n  browseLabel?: string;\n  /** Override any built-in string. Explicit `title`, `description`, `homeLabel` and `browseLabel` props still win. */\n  labels?: Partial<NotFoundMessages>;\n}\n\nexport const NOT_FOUND_DEFAULTS = {\n  code: \"404\",\n  homeHref: \"/\",\n  browseHref: \"/components/motion\",\n} as const;\n\n/** English defaults. Override per instance with `labels`, or app-wide with `LocaleProvider`. */\nexport const notFoundMessages = {\n  title: \"Page not found\",\n  description: \"The page you are looking for moved, vanished, or never existed.\",\n  homeLabel: \"Back home\",\n  browseLabel: \"Browse components\",\n  stackedCaption: \"out of the deck\",\n  terminalError: \"cd: no such file or directory: /page\",\n};\n\nexport type NotFoundMessages = typeof notFoundMessages;\n\n/** Resolves a variant's strings: explicit props, then `labels`, the provider and English. */\nexport function useNotFoundMessages(labels?: Partial<NotFoundMessages>) {\n  return useMessages(\"notFound\", notFoundMessages, labels);\n}\n\ntype ActionsProps = Pick<\n  NotFoundProps,\n  \"homeHref\" | \"homeLabel\" | \"browseHref\" | \"browseLabel\" | \"labels\" | \"className\"\n>;\n\n/** The shared dual CTA: a primary \"Back home\" and a secondary \"Browse\". */\nexport function NotFoundActions({\n  homeHref = NOT_FOUND_DEFAULTS.homeHref,\n  homeLabel,\n  browseHref = NOT_FOUND_DEFAULTS.browseHref,\n  browseLabel,\n  labels,\n  className,\n}: ActionsProps) {\n  const t = useNotFoundMessages(labels);\n  const reduce = useReducedMotion();\n  const canHover = useHoverCapable();\n  const whileTap = reduce ? undefined : { scale: 0.96 };\n  const whileHover = reduce || !canHover ? undefined : { scale: 1.02 };\n\n  return (\n    <div\n      className={cn(\n        \"flex flex-wrap items-center justify-center gap-3\",\n        className,\n      )}\n    >\n      <motion.a\n        href={homeHref}\n        whileTap={whileTap}\n        whileHover={whileHover}\n        transition={SPRING_PRESS}\n        className=\"inline-flex h-11 select-none items-center justify-center rounded-full bg-primary px-6 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90\"\n      >\n        {homeLabel ?? t(\"homeLabel\")}\n      </motion.a>\n      <motion.a\n        href={browseHref}\n        whileTap={whileTap}\n        whileHover={whileHover}\n        transition={SPRING_PRESS}\n        className=\"inline-flex h-11 select-none items-center justify-center rounded-full border border-border bg-card px-6 text-sm font-medium text-foreground transition-colors hover:bg-muted/60\"\n      >\n        {browseLabel ?? t(\"browseLabel\")}\n      </motion.a>\n    </div>\n  );\n}\n\n/** Centers a variant and gives it a consistent minimum stage height. */\nexport function NotFoundStage({\n  className,\n  children,\n}: {\n  className?: string;\n  children: React.ReactNode;\n}) {\n  return (\n    <div\n      className={cn(\n        \"flex min-h-[420px] w-full flex-col items-center justify-center gap-8 px-4 text-center\",\n        className,\n      )}\n    >\n      {children}\n    </div>\n  );\n}\n"},{"path":"components/motion/not-found/glitch.tsx","type":"component","content":"\"use client\";\n// beui.dev/components/blocks/not-found\n\nimport { useReducedMotion } from \"motion/react\";\nimport { useEffect, useState } from \"react\";\nimport {\n  NOT_FOUND_DEFAULTS,\n  NotFoundActions,\n  type NotFoundProps,\n  NotFoundStage,\n  useNotFoundMessages,\n} from \"./shared\";\n\nconst GLYPHS = \"ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#%&@$?/\\\\\";\nconst SCRAMBLE_MS = 700;\nconst TICK_MS = 45;\n\n/**\n * Renders the code, scrambling each character on mount before it settles.\n * SSR and the first paint show the real code, so the scramble is a pure\n * client-side enhancement and reduced-motion users see the code immediately.\n */\nfunction Scramble({ text }: { text: string }) {\n  const reduce = useReducedMotion();\n  const [display, setDisplay] = useState(text);\n\n  useEffect(() => {\n    if (reduce) {\n      setDisplay(text);\n      return;\n    }\n    const chars = text.split(\"\");\n    const start = performance.now();\n    let raf = 0;\n    let last = 0;\n\n    const loop = (now: number) => {\n      if (now - last >= TICK_MS) {\n        last = now;\n        const progress = Math.min((now - start) / SCRAMBLE_MS, 1);\n        const settled = Math.floor(progress * chars.length);\n        setDisplay(\n          chars\n            .map((ch, i) =>\n              i < settled || ch === \" \"\n                ? ch\n                : GLYPHS[Math.floor(Math.random() * GLYPHS.length)],\n            )\n            .join(\"\"),\n        );\n      }\n      if (now - start < SCRAMBLE_MS) {\n        raf = requestAnimationFrame(loop);\n      } else {\n        setDisplay(text);\n      }\n    };\n    raf = requestAnimationFrame(loop);\n    return () => cancelAnimationFrame(raf);\n  }, [text, reduce]);\n\n  return <span className=\"tabular-nums\">{display}</span>;\n}\n\nexport function NotFoundGlitch({\n  className,\n  code = NOT_FOUND_DEFAULTS.code,\n  title,\n  description,\n  homeHref,\n  homeLabel,\n  browseHref,\n  browseLabel,\n  labels,\n}: NotFoundProps) {\n  const t = useNotFoundMessages(labels);\n  return (\n    <NotFoundStage className={className}>\n      <div className=\"group relative select-none font-mono font-semibold leading-none tracking-tighter text-foreground [font-size:clamp(5rem,18vw,11rem)]\">\n        {/* Chromatic ghost layers, nudged apart on hover. */}\n        <span\n          aria-hidden\n          className=\"pointer-events-none absolute inset-0 text-[#ff0040] opacity-0 mix-blend-screen transition-[transform,opacity] duration-150 ease-out group-hover:translate-x-[3px] group-hover:opacity-70 motion-reduce:hidden\"\n        >\n          <Scramble text={code} />\n        </span>\n        <span\n          aria-hidden\n          className=\"pointer-events-none absolute inset-0 text-[#00e5ff] opacity-0 mix-blend-screen transition-[transform,opacity] duration-150 ease-out group-hover:-translate-x-[3px] group-hover:opacity-70 motion-reduce:hidden\"\n        >\n          <Scramble text={code} />\n        </span>\n        <h1 className=\"relative\">\n          <Scramble text={code} />\n        </h1>\n      </div>\n\n      <div className=\"flex flex-col items-center gap-2\">\n        <p className=\"text-lg font-medium text-foreground\">{title ?? t(\"title\")}</p>\n        <p className=\"max-w-sm text-sm text-muted-foreground\">{description ?? t(\"description\")}</p>\n      </div>\n\n      <NotFoundActions\n        homeHref={homeHref}\n        homeLabel={homeLabel}\n        browseHref={browseHref}\n        browseLabel={browseLabel}\n        labels={labels}\n      />\n    </NotFoundStage>\n  );\n}\n"},{"path":"components/motion/not-found/magnetic.tsx","type":"component","content":"\"use client\";\n// beui.dev/components/blocks/not-found\n\nimport { Magnetic } from \"@/components/motion/magnetic\";\nimport { cn } from \"@/lib/utils\";\nimport {\n  NOT_FOUND_DEFAULTS,\n  NotFoundActions,\n  type NotFoundProps,\n  NotFoundStage,\n  useNotFoundMessages,\n} from \"./shared\";\n\nexport function NotFoundMagnetic({\n  className,\n  code = NOT_FOUND_DEFAULTS.code,\n  title,\n  description,\n  homeHref,\n  homeLabel,\n  browseHref,\n  browseLabel,\n  labels,\n}: NotFoundProps) {\n  const t = useNotFoundMessages(labels);\n  const chars = code.split(\"\");\n\n  return (\n    <NotFoundStage className={className}>\n      <h1\n        aria-label={code}\n        className=\"flex select-none items-center justify-center font-semibold leading-none tracking-tighter text-foreground [font-size:clamp(5rem,18vw,12rem)]\"\n      >\n        {chars.map((ch, i) => (\n          <Magnetic\n            // biome-ignore lint/suspicious/noArrayIndexKey: fixed positional glyphs\n            key={i}\n            strength={0.6}\n            className={cn(i > 0 && \"-ml-2\")}\n          >\n            <span aria-hidden className=\"inline-block px-1 tabular-nums\">\n              {ch}\n            </span>\n          </Magnetic>\n        ))}\n      </h1>\n\n      <div className=\"flex flex-col items-center gap-2\">\n        <p className=\"text-lg font-medium text-foreground\">{title ?? t(\"title\")}</p>\n        <p className=\"max-w-sm text-sm text-muted-foreground\">{description ?? t(\"description\")}</p>\n      </div>\n\n      <NotFoundActions\n        homeHref={homeHref}\n        homeLabel={homeLabel}\n        browseHref={browseHref}\n        browseLabel={browseLabel}\n        labels={labels}\n      />\n    </NotFoundStage>\n  );\n}\n"},{"path":"components/motion/not-found/spotlight.tsx","type":"component","content":"\"use client\";\n// beui.dev/components/blocks/not-found\n\nimport {\n  motion,\n  useMotionTemplate,\n  useMotionValue,\n  useReducedMotion,\n} from \"motion/react\";\nimport { useRef } from \"react\";\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\";\nimport { cn } from \"@/lib/utils\";\nimport {\n  NOT_FOUND_DEFAULTS,\n  NotFoundActions,\n  type NotFoundProps,\n  NotFoundStage,\n  useNotFoundMessages,\n} from \"./shared\";\n\nexport function NotFoundSpotlight({\n  className,\n  code = NOT_FOUND_DEFAULTS.code,\n  title,\n  description,\n  homeHref,\n  homeLabel,\n  browseHref,\n  browseLabel,\n  labels,\n}: NotFoundProps) {\n  const t = useNotFoundMessages(labels);\n  const ref = useRef<HTMLDivElement>(null);\n  const reduce = useReducedMotion();\n  const canHover = useHoverCapable();\n  const enabled = !reduce && canHover;\n\n  const mx = useMotionValue(50);\n  const my = useMotionValue(50);\n  const mask = useMotionTemplate`radial-gradient(220px circle at ${mx}% ${my}%, #000 25%, transparent 72%)`;\n\n  const onMove = (e: React.MouseEvent<HTMLDivElement>) => {\n    const el = ref.current;\n    if (!el || !enabled) return;\n    const rect = el.getBoundingClientRect();\n    mx.set(((e.clientX - rect.left) / rect.width) * 100);\n    my.set(((e.clientY - rect.top) / rect.height) * 100);\n  };\n\n  return (\n    <NotFoundStage className={className}>\n      <motion.div\n        ref={ref}\n        onMouseMove={onMove}\n        className=\"relative isolate flex aspect-[16/9] w-full max-w-xl items-center justify-center overflow-hidden rounded-3xl border border-border bg-neutral-950\"\n      >\n        {/* Dim base layer. */}\n        <span\n          aria-hidden\n          className=\"select-none font-semibold leading-none tracking-tighter text-white/10 [font-size:clamp(5rem,16vw,10rem)]\"\n        >\n          {code}\n        </span>\n        {/* Bright layer, revealed only under the spotlight. */}\n        <motion.h1\n          aria-label={code}\n          style={enabled ? { WebkitMaskImage: mask, maskImage: mask } : undefined}\n          className={cn(\n            \"absolute select-none font-semibold leading-none tracking-tighter text-white [font-size:clamp(5rem,16vw,10rem)]\",\n            !enabled && \"text-white/90\",\n          )}\n        >\n          <span aria-hidden>{code}</span>\n        </motion.h1>\n      </motion.div>\n\n      <div className=\"flex flex-col items-center gap-2\">\n        <p className=\"text-lg font-medium text-foreground\">{title ?? t(\"title\")}</p>\n        <p className=\"max-w-sm text-sm text-muted-foreground\">{description ?? t(\"description\")}</p>\n      </div>\n\n      <NotFoundActions\n        homeHref={homeHref}\n        homeLabel={homeLabel}\n        browseHref={browseHref}\n        browseLabel={browseLabel}\n        labels={labels}\n      />\n    </NotFoundStage>\n  );\n}\n"},{"path":"components/motion/not-found/stacked.tsx","type":"component","content":"\"use client\";\n// beui.dev/components/blocks/not-found\n\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { SPRING_PANEL } from \"@/lib/ease\";\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\";\nimport {\n  NOT_FOUND_DEFAULTS,\n  NotFoundActions,\n  type NotFoundProps,\n  NotFoundStage,\n  useNotFoundMessages,\n} from \"./shared\";\n\nconst CARD =\n  \"absolute inset-0 rounded-3xl border border-border bg-card shadow-sm\";\n\nexport function NotFoundStacked({\n  className,\n  code = NOT_FOUND_DEFAULTS.code,\n  title,\n  description,\n  homeHref,\n  homeLabel,\n  browseHref,\n  browseLabel,\n  labels,\n}: NotFoundProps) {\n  const t = useNotFoundMessages(labels);\n  const reduce = useReducedMotion();\n  const canHover = useHoverCapable();\n  const interactive = !reduce && canHover;\n\n  return (\n    <NotFoundStage className={className}>\n      <motion.div\n        initial=\"rest\"\n        animate=\"rest\"\n        whileHover={interactive ? \"hover\" : undefined}\n        className=\"relative h-44 w-64\"\n      >\n        <motion.div\n          aria-hidden\n          variants={{ rest: { rotate: 0, x: 0, y: 0 }, hover: { rotate: -9, x: -28, y: 8 } }}\n          transition={SPRING_PANEL}\n          className={CARD}\n        />\n        <motion.div\n          aria-hidden\n          variants={{ rest: { rotate: 0, x: 0, y: 0 }, hover: { rotate: 9, x: 28, y: 8 } }}\n          transition={SPRING_PANEL}\n          className={CARD}\n        />\n        <motion.div\n          variants={{ rest: { y: 0 }, hover: { y: -6 } }}\n          transition={SPRING_PANEL}\n          className=\"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-3xl border border-border bg-card shadow-md\"\n        >\n          <h1 className=\"select-none font-semibold leading-none tracking-tighter text-foreground [font-size:clamp(3.5rem,9vw,5rem)]\">\n            {code}\n          </h1>\n          <span className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n            {t(\"stackedCaption\")}\n          </span>\n        </motion.div>\n      </motion.div>\n\n      <div className=\"flex flex-col items-center gap-2\">\n        <p className=\"text-lg font-medium text-foreground\">{title ?? t(\"title\")}</p>\n        <p className=\"max-w-sm text-sm text-muted-foreground\">{description ?? t(\"description\")}</p>\n      </div>\n\n      <NotFoundActions\n        homeHref={homeHref}\n        homeLabel={homeLabel}\n        browseHref={browseHref}\n        browseLabel={browseLabel}\n        labels={labels}\n      />\n    </NotFoundStage>\n  );\n}\n"},{"path":"components/motion/not-found/terminal.tsx","type":"component","content":"\"use client\";\n// beui.dev/components/blocks/not-found\n\nimport { TextReveal } from \"@/components/motion/text-reveal\";\nimport {\n  NOT_FOUND_DEFAULTS,\n  NotFoundActions,\n  type NotFoundProps,\n  NotFoundStage,\n  useNotFoundMessages,\n} from \"./shared\";\n\n// Each character lands quicker than Text Reveal's slow default, so a terminal\n// line reads as typed rather than faded in.\nconst TYPE_SPRING = { stiffness: 320, damping: 30, mass: 0.6 };\n\nexport function NotFoundTerminal({\n  className,\n  code = NOT_FOUND_DEFAULTS.code,\n  title,\n  description,\n  homeHref,\n  homeLabel,\n  browseHref,\n  browseLabel,\n  labels,\n}: NotFoundProps) {\n  const t = useNotFoundMessages(labels);\n  return (\n    <NotFoundStage className={className}>\n      <div className=\"w-full max-w-md overflow-hidden rounded-xl border border-border bg-neutral-950 text-left shadow-lg\">\n        <div className=\"flex items-center gap-1.5 border-b border-white/10 px-4 py-3\">\n          <span className=\"h-3 w-3 rounded-full bg-[#ff5f57]\" />\n          <span className=\"h-3 w-3 rounded-full bg-[#febc2e]\" />\n          <span className=\"h-3 w-3 rounded-full bg-[#28c840]\" />\n          <span className=\"ml-2 text-xs text-white/40\">~/beui</span>\n        </div>\n        <div className=\"space-y-1.5 p-4 font-mono text-sm leading-relaxed\">\n          <TextReveal\n            as=\"p\"\n            split=\"char\"\n            stagger={0.018}\n            blur={6}\n            yOffset={0}\n            spring={TYPE_SPRING}\n            className=\"text-white/80\"\n            text=\"$ cd /page\"\n          />\n          <TextReveal\n            as=\"p\"\n            split=\"char\"\n            stagger={0.012}\n            delay={0.45}\n            blur={6}\n            yOffset={0}\n            spring={TYPE_SPRING}\n            className=\"text-[#ff5f57]\"\n            text={t(\"terminalError\")}\n          />\n          <p className=\"flex items-center text-white/80\">\n            <TextReveal\n              as=\"span\"\n              split=\"char\"\n              stagger={0.018}\n              delay={1.1}\n              blur={6}\n              yOffset={0}\n              spring={TYPE_SPRING}\n              text={`$ status ${code}`}\n            />\n            <span className=\"ml-1 inline-block h-[1.1em] w-[0.55ch] translate-y-[0.12em] bg-white/80 motion-safe:animate-pulse\" />\n          </p>\n        </div>\n      </div>\n\n      <div className=\"flex flex-col items-center gap-2\">\n        <p className=\"text-lg font-medium text-foreground\">{title ?? t(\"title\")}</p>\n        <p className=\"max-w-sm text-sm text-muted-foreground\">{description ?? t(\"description\")}</p>\n      </div>\n\n      <NotFoundActions\n        homeHref={homeHref}\n        homeLabel={homeLabel}\n        browseHref={browseHref}\n        browseLabel={browseLabel}\n        labels={labels}\n      />\n    </NotFoundStage>\n  );\n}\n"},{"path":"lib/ease.ts","type":"util","content":"// Shared motion tokens. Easing curves mirror the CSS custom properties in\n// globals.css; springs are the canonical physics used across components.\n// Strong custom variants - defaults like `ease-in`/`ease-out` feel weak.\n\nexport const EASE_OUT = [0.16, 1, 0.3, 1] as const;\n/** Accelerating curve for things that fall (a dropped ball, a toppled block). Not for UI entrances. */\nexport const EASE_IN = [0.55, 0, 1, 0.45] as const;\nexport const EASE_IN_OUT = [0.77, 0, 0.175, 1] as const;\nexport const EASE_DRAWER = [0.32, 0.72, 0, 1] as const;\n\n/** CSS string form of EASE_OUT for inline style transitions. */\nexport const EASE_OUT_CSS = \"cubic-bezier(0.16, 1, 0.3, 1)\";\n\n/** Press feedback on buttons and other tappable surfaces. */\nexport const SPRING_PRESS = {\n  type: \"spring\",\n  stiffness: 500,\n  damping: 30,\n  mass: 0.6,\n} as const;\n\n/** Content swaps - label/icon slots trading places inside a control. */\nexport const SPRING_SWAP = {\n  type: \"spring\",\n  stiffness: 460,\n  damping: 30,\n  mass: 0.55,\n} as const;\n\n/** Overlay panel entrances - modals and sheets summoned by pointer. */\nexport const SPRING_PANEL = {\n  type: \"spring\",\n  stiffness: 420,\n  damping: 40,\n  mass: 0.5,\n} as const;\n\n/** Shared-layout glides - pills, indicators and panels morphing between positions. */\nexport const SPRING_LAYOUT = {\n  type: \"spring\",\n  stiffness: 360,\n  damping: 32,\n  mass: 0.6,\n} as const;\n\n/** Cursor-follow physics for decorative mouse tracking (magnetic, tilt, dock). */\nexport const SPRING_MOUSE = {\n  stiffness: 200,\n  damping: 15,\n  mass: 0.3,\n} as const;\n\n/** Dragged handles and fills (sliders) - critically damped `useSpring` config,\n * so the value follows the pointer butterily and never rebounds off an end. */\nexport const SPRING_GLIDE = {\n  stiffness: 700,\n  damping: 50,\n  mass: 0.5,\n} as const;\n\n/** Shared-surface morphs: a trigger growing into its panel and back on one\n * weighted spring, so opening and closing travel the same path. */\nexport const SPRING_MORPH = {\n  type: \"spring\",\n  duration: 0.5,\n  bounce: 0.22,\n} as const;\n"},{"path":"lib/hooks/use-hover-capable.ts","type":"util","content":"\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Returns true only on devices that have a true hover (mouse / trackpad).\n * Touch devices fire phantom `:hover` on tap that sticks until tap-elsewhere\n * - gate hover-only effects (scale lifts, magnetic pulls) behind this.\n */\nexport function useHoverCapable() {\n  const [canHover, setCanHover] = useState(false);\n\n  useEffect(() => {\n    if (typeof window === \"undefined\" || !window.matchMedia) return;\n    const mq = window.matchMedia(\"(hover: hover) and (pointer: fine)\");\n    const update = () => setCanHover(mq.matches);\n    update();\n    mq.addEventListener?.(\"change\", update);\n    return () => mq.removeEventListener?.(\"change\", update);\n  }, []);\n\n  return canHover;\n}\n"},{"path":"lib/i18n.tsx","type":"util","content":"\"use client\";\n\nimport {\n  createContext,\n  type ReactNode,\n  useCallback,\n  useContext,\n  useMemo,\n} from \"react\";\n\n/**\n * A component's messages. Plain strings with `{name}` placeholders, so a\n * dictionary stays JSON-serializable and can be passed from a server layout.\n * There are no plural forms: write messages that read correctly for any count.\n */\nexport type Messages = Record<string, string>;\n\n/** A language file: component namespace → any subset of that component's messages. */\nexport type LocaleMessages = Record<string, Partial<Messages>>;\n\ntype LocaleContextValue = {\n  locale?: string;\n  messages: LocaleMessages;\n};\n\nconst NO_MESSAGES: LocaleMessages = {};\n\nconst LocaleContext = createContext<LocaleContextValue>({ messages: NO_MESSAGES });\n\n/** Without a locale, digits stay plain so server and client render the same text. */\nexport function formatNumber(value: number, locale?: string) {\n  return locale ? new Intl.NumberFormat(locale).format(value) : String(value);\n}\n\nexport interface LocaleProviderProps {\n  /** BCP 47 tag, e.g. `de`, `pt-BR`. Drives `Intl` number formatting. */\n  locale: string;\n  /**\n   * Component namespace → translated strings. Missing keys fall back to English.\n   * Pass a stable object (a module constant, imported JSON or a memoized value):\n   * a new object each render gives every translated component a new `t`.\n   */\n  messages?: LocaleMessages;\n  children: ReactNode;\n}\n\nexport function LocaleProvider({ locale, messages = NO_MESSAGES, children }: LocaleProviderProps) {\n  const value = useMemo(() => ({ locale, messages }), [locale, messages]);\n  return <LocaleContext.Provider value={value}>{children}</LocaleContext.Provider>;\n}\n\nexport function useLocale(): { locale?: string } {\n  return { locale: useContext(LocaleContext).locale };\n}\n\n/**\n * Resolves a component's strings: `labels` prop, then the provider's\n * messages for `namespace`, then the component's English `defaults`.\n * Numbers passed as values are formatted for the provider's locale.\n */\nexport function useMessages<T extends Messages>(\n  namespace: string,\n  defaults: T,\n  labels?: Partial<T>,\n) {\n  const { locale, messages } = useContext(LocaleContext);\n  const provided = messages[namespace];\n  // Inline `labels={{ … }}` is a new object every render. Keying it by content\n  // keeps `t` one identity until a label changes, so effects and memos that\n  // depend on `t` don't re-run per render, and render-time reads never lag.\n  const labelsKey = labels ? JSON.stringify(labels) : \"\";\n  const stableLabels = useMemo(\n    () => (labelsKey ? (JSON.parse(labelsKey) as Partial<T>) : undefined),\n    [labelsKey],\n  );\n\n  return useCallback(\n    (key: keyof T & string, values?: Record<string, string | number>) => {\n      const template = stableLabels?.[key] ?? provided?.[key] ?? defaults[key];\n      if (!values) return template;\n      return template.replace(/\\{(\\w+)\\}/g, (match, name: string) => {\n        const value = values[name];\n        if (value === undefined) return match;\n        return typeof value === \"number\" ? formatNumber(value, locale) : value;\n      });\n    },\n    [defaults, stableLabels, locale, provided],\n  );\n}\n"},{"path":"lib/utils.ts","type":"util","content":"import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n"},{"path":"components/motion/magnetic.tsx","type":"util","content":"\"use client\";\n\nimport { motion, useMotionValue, useReducedMotion, useSpring } from \"motion/react\";\nimport { useRef, type ReactNode } from \"react\";\nimport { SPRING_MOUSE } from \"@/lib/ease\";\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface MagneticProps {\n  children: ReactNode;\n  strength?: number;\n  className?: string;\n}\n\nexport function Magnetic({ children, strength = 0.35, className }: MagneticProps) {\n  const ref = useRef<HTMLDivElement>(null);\n  const reduce = useReducedMotion();\n  const canHover = useHoverCapable();\n  // Decorative cursor-follow: skip on touch (phantom hover) and reduced motion.\n  const enabled = !reduce && canHover;\n  const x = useMotionValue(0);\n  const y = useMotionValue(0);\n  const sx = useSpring(x, SPRING_MOUSE);\n  const sy = useSpring(y, SPRING_MOUSE);\n\n  const onMove = (e: React.MouseEvent<HTMLDivElement>) => {\n    const el = ref.current;\n    if (!el || !enabled) return;\n    const rect = el.getBoundingClientRect();\n    x.set((e.clientX - rect.left - rect.width / 2) * strength);\n    y.set((e.clientY - rect.top - rect.height / 2) * strength);\n  };\n\n  const onLeave = () => {\n    x.set(0);\n    y.set(0);\n  };\n\n  return (\n    <motion.div\n      ref={ref}\n      onMouseMove={onMove}\n      onMouseLeave={onLeave}\n      style={{ x: sx, y: sy }}\n      className={cn(\"inline-block\", className)}\n    >\n      {children}\n    </motion.div>\n  );\n}\n"},{"path":"components/motion/text-reveal.tsx","type":"util","content":"\"use client\";\n\nimport { motion, type Transition, useInView, useReducedMotion } from \"motion/react\";\nimport { useRef, type ElementType, type ReactNode } from \"react\";\nimport { EASE_OUT } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\ntype SplitMode = \"word\" | \"char\";\n\nexport interface TextRevealProps {\n  /** Text to reveal. Pass an array to put each string on its own line. */\n  text: string | string[];\n  /** Element to render as the root. Default: \"span\" */\n  as?: ElementType;\n  /** Classes merged onto the root element. */\n  className?: string;\n  /** Animate word by word or character by character. Default: \"word\" */\n  split?: SplitMode;\n  /** Delay between each word or character, in seconds. Default: 0.09 */\n  stagger?: number;\n  /** Delay before the first word or character, in seconds. Default: 0 */\n  delay?: number;\n  /** Starting blur of each unit, in pixels. Default: 12 */\n  blur?: number;\n  /** How far below each unit starts, as a length or pixels. Default: \"40%\" */\n  yOffset?: string | number;\n  /** Overrides the rise spring. Default: { stiffness: 140, damping: 26, mass: 1.2 } */\n  spring?: { stiffness?: number; damping?: number; mass?: number };\n  /** With `whileInView`, plays only the first time the text scrolls in. Default: true */\n  once?: boolean;\n  /** Waits until the text scrolls into view before playing. Default: false */\n  whileInView?: boolean;\n  children?: ReactNode;\n}\n\n// Slower and heavier than the UI springs on purpose: a headline reveal should\n// drift in over a beat, not snap like a control. `spring` overrides it.\nconst DEFAULT_SPRING = { stiffness: 140, damping: 26, mass: 1.2 };\n\ntype WordGroup = { text: string; trailing: string };\n\n/**\n * One tokenizer for both modes: a line becomes the words it is made of, each\n * carrying the whitespace that follows it. Word mode animates a group at a\n * time, char mode the characters inside one - so the two can't drift apart on\n * what counts as a word or where a space belongs. Runs of whitespace and tabs\n * survive as their own group rather than collapsing.\n */\nfunction toWordGroups(line: string): WordGroup[] {\n  const chunks = line.match(/\\S+\\s*|\\s+/g) ?? [];\n  return chunks.map((chunk) => {\n    const text = chunk.replace(/\\s+$/, \"\");\n    return { text, trailing: chunk.slice(text.length) };\n  });\n}\n\nexport function TextReveal({\n  text,\n  as: Comp = \"span\",\n  className,\n  split = \"word\",\n  stagger = 0.09,\n  delay = 0,\n  blur = 12,\n  yOffset = \"40%\",\n  spring,\n  once = true,\n  whileInView = false,\n  children,\n}: TextRevealProps) {\n  const ref = useRef<HTMLElement>(null);\n  const inView = useInView(ref, { once, amount: 0.4 });\n  const reduce = useReducedMotion();\n  const shouldAnimate = whileInView ? inView : true;\n\n  const lines = Array.isArray(text) ? text : [text];\n  const s = { ...DEFAULT_SPRING, ...spring };\n\n  let unitIndex = 0;\n  const lineCounts = new Map<string, number>();\n\n  return (\n    <Comp ref={ref} className={cn(\"block\", className)}>\n      {lines.map((line) => {\n        const lineCount = lineCounts.get(line) ?? 0;\n        lineCounts.set(line, lineCount + 1);\n        const lineKey = `${line}-${lineCount}`;\n        const unitCounts = new Map<string, number>();\n\n        const renderUnit = (unit: string) => {\n          const d = delay + unitIndex * stagger;\n          unitIndex += 1;\n          const unitCount = unitCounts.get(unit) ?? 0;\n          unitCounts.set(unit, unitCount + 1);\n          const unitKey = `${unit}-${unitCount}`;\n          const initial = reduce\n            ? { opacity: 0 }\n            : { y: yOffset, opacity: 0, filter: `blur(${blur}px)` };\n          const animate = shouldAnimate\n            ? reduce\n              ? { opacity: 1 }\n              : { y: 0, opacity: 1, filter: \"blur(0px)\" }\n            : initial;\n          const transition: Transition = reduce\n            ? { opacity: { duration: 0.25, ease: EASE_OUT, delay: d * 0.3 } }\n            : {\n                y: { type: \"spring\" as const, ...s, delay: d },\n                opacity: { duration: 0.7, ease: EASE_OUT, delay: d },\n                filter: { duration: 0.9, ease: EASE_OUT, delay: d },\n              };\n          return (\n            <motion.span\n              key={unitKey}\n              initial={initial}\n              animate={animate}\n              transition={transition}\n              // `whitespace-pre` is load-bearing: a unit's trailing space is\n              // inside an inline-block and would otherwise collapse to zero\n              // width, running every word together.\n              className=\"inline-block whitespace-pre will-change-transform\"\n            >\n              {unit}\n            </motion.span>\n          );\n        };\n\n        const groups = toWordGroups(line);\n        const groupCounts = new Map<string, number>();\n\n        return (\n          <span key={lineKey} className=\"block\">\n            {groups.map((group) => {\n              const whole = group.text + group.trailing;\n              // Characters animate one at a time, but each word (plus the\n              // space that follows it) sits in its own inline-block so a long\n              // line wraps between words instead of mid-word.\n              if (split !== \"char\") return renderUnit(whole);\n\n              const groupCount = groupCounts.get(whole) ?? 0;\n              groupCounts.set(whole, groupCount + 1);\n              return (\n                <span\n                  key={`${whole}-${groupCount}`}\n                  className=\"inline-block whitespace-pre\"\n                >\n                  {Array.from(whole).map((char) => renderUnit(char))}\n                </span>\n              );\n            })}\n          </span>\n        );\n      })}\n      {children}\n    </Comp>\n  );\n}\n"}]}