{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "mega-footer",
  "type": "registry:block",
  "title": "Mega Footer",
  "description": "A full site footer: link columns with little badges, a one-field digest signup, a live status pill, language and theme switches, a legal row, and an oversized wordmark fading into the floor.",
  "categories": [
    "block",
    "Marketing"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/select.json"
  ],
  "files": [
    {
      "path": "registry/devl/mega-footer.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { ArrowRightIcon, CheckIcon, GlobeIcon, MonitorIcon, MoonIcon, SunIcon } from \"lucide-react\";\nimport { AnimatePresence, motion, MotionConfig, useInView, useReducedMotion } from \"motion/react\";\nimport { type FormEvent, type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { cn } from \"@/lib/utils\";\n\nfunction useReducedMotionSafe() {\n  const prefers = useReducedMotion();\n  const [mounted, setMounted] = useState(false);\n  useEffect(() => setMounted(true), []);\n  return mounted && Boolean(prefers);\n}\n\nexport interface FooterLink {\n  label: string;\n  href: string;\n  badge?: string;\n}\n\nexport interface FooterColumn {\n  title: string;\n  links: FooterLink[];\n}\n\nexport type FooterTheme = \"system\" | \"light\" | \"dark\";\nexport type FooterStatus = \"operational\" | \"degraded\" | \"outage\";\n\nexport interface MegaFooterProps {\n  brand: { name: string; mark?: ReactNode; tagline?: string; href?: string };\n  columns: FooterColumn[];\n  socials?: { label: string; href: string; icon: ReactNode }[];\n  status?: { state: FooterStatus; label?: string; href: string };\n  locales?: { value: string; label: string }[];\n  defaultLocale?: string;\n  onLocaleChange?: (value: string) => void;\n  theme?: FooterTheme;\n  onThemeChange?: (theme: FooterTheme) => void;\n  legal?: FooterLink[];\n  copyright?: string;\n  newsletter?: { title: string; placeholder?: string; onSubscribe?: (email: string) => void };\n  className?: string;\n}\n\nconst statusStyle: Record<FooterStatus, { dot: string; ring: string; label: string }> = {\n  operational: { dot: \"bg-emerald-500\", ring: \"bg-emerald-500/40\", label: \"All systems normal\" },\n  degraded: { dot: \"bg-amber-500\", ring: \"bg-amber-500/40\", label: \"Some systems degraded\" },\n  outage: { dot: \"bg-red-500\", ring: \"bg-red-500/40\", label: \"Ongoing incident\" },\n};\n\nconst themes: { value: FooterTheme; label: string; icon: typeof SunIcon }[] = [\n  { value: \"system\", label: \"System\", icon: MonitorIcon },\n  { value: \"light\", label: \"Light\", icon: SunIcon },\n  { value: \"dark\", label: \"Dark\", icon: MoonIcon },\n];\n\nconst linkClass =\n  \"relative rounded-sm text-muted-foreground after:absolute after:-inset-x-1 after:-inset-y-1.5 after:content-['']  text-sm outline-none transition-colors duration-150 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\";\n\nfunction ThemeSwitch({ value, onChange }: { value: FooterTheme; onChange: (t: FooterTheme) => void }) {\n  const reduce = useReducedMotionSafe();\n  const id = useId();\n  return (\n    <div aria-label=\"Theme\" className=\"flex rounded-full border bg-muted p-0.5\" role=\"radiogroup\">\n      {themes.map((t) => {\n        const on = value === t.value;\n        return (\n          <button\n            aria-checked={on}\n            aria-label={t.label}\n            className={cn(\n              \"relative flex size-6.5 cursor-pointer items-center justify-center rounded-full outline-none after:absolute after:-inset-[3px] after:content-[''] transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-ring\",\n              on ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n            )}\n            key={t.value}\n            onClick={() => onChange(t.value)}\n            onKeyDown={(e) => {\n              if (e.key !== \"ArrowRight\" && e.key !== \"ArrowLeft\") return;\n              e.preventDefault();\n              const i = themes.findIndex((x) => x.value === value);\n              const next = themes[(i + (e.key === \"ArrowRight\" ? 1 : themes.length - 1)) % themes.length];\n              onChange(next.value);\n              (e.currentTarget.parentElement?.children[themes.indexOf(next)] as HTMLElement | undefined)?.focus();\n            }}\n            role=\"radio\"\n            tabIndex={on ? 0 : -1}\n            title={t.label}\n            type=\"button\"\n          >\n            {on && (\n              <motion.span\n                className=\"absolute inset-0 rounded-full bg-background shadow-xs/5 dark:bg-input\"\n                layoutId={id}\n                transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 38 }}\n              />\n            )}\n            <t.icon className=\"relative size-3.5\" />\n          </button>\n        );\n      })}\n    </div>\n  );\n}\n\nfunction FooterNewsletter({ title, placeholder, onSubscribe }: NonNullable<MegaFooterProps[\"newsletter\"]>) {\n  const fieldId = useId();\n  const [email, setEmail] = useState(\"\");\n  const [state, setState] = useState<\"idle\" | \"error\" | \"done\">(\"idle\");\n  const submit = (e: FormEvent) => {\n    e.preventDefault();\n    if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/.test(email.trim())) return setState(\"error\");\n    onSubscribe?.(email.trim());\n    setState(\"done\");\n  };\n  return (\n    <form className=\"mt-8 max-w-xs\" noValidate onSubmit={submit}>\n      <label className=\"font-medium text-sm\" htmlFor={fieldId}>\n        {title}\n      </label>\n      <div\n        className={cn(\n          \"mt-2.5 flex h-10 items-center rounded-lg border bg-background p-1 shadow-xs/5 transition-[border-color,box-shadow] duration-150 has-focus-visible:border-ring has-focus-visible:ring-[3px] has-focus-visible:ring-ring/24 sm:h-9 dark:bg-input/32\",\n          state === \"error\" && \"border-destructive/40\",\n        )}\n      >\n        <input\n          aria-describedby={`${fieldId}-msg`}\n          aria-invalid={state === \"error\"}\n          autoComplete=\"email\"\n          className=\"h-full min-w-0 flex-1 bg-transparent px-2 text-base outline-none placeholder:text-muted-foreground/70 sm:text-sm\"\n          disabled={state === \"done\"}\n          id={fieldId}\n          onChange={(e) => {\n            setEmail(e.target.value);\n            if (state === \"error\") setState(\"idle\");\n          }}\n          placeholder={placeholder ?? \"you@company.com\"}\n          type=\"email\"\n          value={email}\n        />\n        <button\n          aria-label=\"Subscribe\"\n          className={cn(\n            \"flex aspect-square h-full shrink-0 cursor-pointer items-center justify-center rounded-sm outline-none transition-[background-color,translate,scale,rotate] duration-150 ease-out focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.94]\",\n            state === \"done\" ? \"bg-success text-white\" : \"bg-primary text-primary-foreground hover:bg-primary/90\",\n          )}\n          disabled={state === \"done\"}\n          type=\"submit\"\n        >\n          <AnimatePresence initial={false} mode=\"popLayout\">\n            <motion.span\n              animate={{ opacity: 1, scale: 1 }}\n              exit={{ opacity: 0, scale: 0.6 }}\n              initial={{ opacity: 0, scale: 0.6 }}\n              key={state === \"done\" ? \"done\" : \"go\"}\n              transition={{ duration: 0.18 }}\n            >\n              {state === \"done\" ? <CheckIcon className=\"size-3.5\" strokeWidth={3} /> : <ArrowRightIcon className=\"size-3.5\" />}\n            </motion.span>\n          </AnimatePresence>\n        </button>\n      </div>\n      <p\n        className={cn(\"mt-1.5 min-h-4 text-xs\", state === \"error\" ? \"text-destructive-foreground\" : \"text-muted-foreground\")}\n        id={`${fieldId}-msg`}\n        role={state === \"error\" ? \"alert\" : undefined}\n      >\n        {state === \"error\"\n          ? \"Check the address and try again.\"\n          : state === \"done\"\n            ? \"Thanks. The next digest lands on the 1st.\"\n            : \"One email a month. No tracking pixels.\"}\n      </p>\n    </form>\n  );\n}\n\nexport function MegaFooter({\n  brand,\n  columns,\n  socials = [],\n  status,\n  locales = [],\n  defaultLocale,\n  onLocaleChange,\n  theme: themeProp,\n  onThemeChange,\n  legal = [],\n  copyright,\n  newsletter,\n  className,\n}: MegaFooterProps) {\n  const reduce = useReducedMotionSafe();\n  const statusRef = useRef<HTMLAnchorElement>(null);\n  const statusVisible = useInView(statusRef);\n  const [themeState, setThemeState] = useState<FooterTheme>(themeProp ?? \"system\");\n  const theme = themeProp ?? themeState;\n  const [locale, setLocale] = useState(defaultLocale ?? locales[0]?.value);\n  const s = status ? statusStyle[status.state] : null;\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <footer className={cn(\"relative mx-auto w-full max-w-[1100px] overflow-hidden\", className)}>\n        <div className=\"grid gap-12 border-t pt-12 sm:pt-16 lg:grid-cols-[minmax(0,1.1fr)_minmax(0,2fr)] lg:gap-16\">\n          <div>\n            <a className=\"inline-flex items-center gap-2 rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring\" href={brand.href ?? \"#\"}>\n              {brand.mark}\n              <span className=\"font-heading font-semibold text-base tracking-tight\">{brand.name}</span>\n            </a>\n            {brand.tagline && (\n              <p className=\"mt-3 max-w-xs text-pretty text-muted-foreground text-sm leading-relaxed\">{brand.tagline}</p>\n            )}\n            {newsletter && <FooterNewsletter {...newsletter} />}\n            {socials.length > 0 && (\n              <ul className=\"mt-6 flex gap-1\">\n                {socials.map((social) => (\n                  <li key={social.label}>\n                    <a\n                      aria-label={social.label}\n                      className=\"flex size-9 items-center justify-center rounded-lg text-muted-foreground outline-none transition-[background-color,color,translate,scale,rotate] duration-150 ease-out hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.94] [&_svg]:size-4\"\n                      href={social.href}\n                    >\n                      {social.icon}\n                    </a>\n                  </li>\n                ))}\n              </ul>\n            )}\n          </div>\n\n          <nav aria-label=\"Footer\" className=\"grid grid-cols-2 gap-x-6 gap-y-10 sm:grid-cols-4\">\n            {columns.map((column) => (\n              <div key={column.title}>\n                <h3 className=\"font-medium text-sm\">{column.title}</h3>\n                <ul className=\"mt-4 space-y-3\">\n                  {column.links.map((link) => (\n                    <li className=\"flex items-center gap-2\" key={link.label}>\n                      <a className={linkClass} href={link.href}>\n                        {link.label}\n                      </a>\n                      {link.badge && (\n                        <span className=\"rounded-full bg-success/10 px-1.5 py-px font-medium text-[0.625rem] text-success-foreground tabular-nums\">\n                          {link.badge}\n                        </span>\n                      )}\n                    </li>\n                  ))}\n                </ul>\n              </div>\n            ))}\n          </nav>\n        </div>\n\n        <div aria-hidden className=\"pointer-events-none mt-10 select-none overflow-hidden sm:mt-14\">\n          <motion.p\n            className=\"bg-linear-to-b from-foreground/14 via-foreground/6 to-foreground/0 bg-clip-text text-center font-heading font-semibold text-[clamp(4rem,19vw,13.5rem)] text-transparent leading-[0.8] tracking-[-0.06em]\"\n            initial={{ opacity: 0, y: \"16%\" }}\n            transition={{ duration: 0.9, ease: [0.23, 1, 0.32, 1] }}\n            viewport={{ once: true, amount: 0.4 }}\n            whileInView={{ opacity: 1, y: \"0%\" }}\n          >\n            {brand.name.toLowerCase()}\n          </motion.p>\n        </div>\n\n        <div className=\"relative flex flex-col gap-5 border-t py-6 lg:flex-row lg:items-center lg:justify-between\">\n          <div className=\"flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:gap-x-5\">\n            {status && s && (\n              <a\n                className=\"inline-flex w-fit items-center gap-2 rounded-full border bg-background py-1 ps-2.5 pe-3 text-xs outline-none transition-colors duration-150 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring\"\n                href={status.href}\n                ref={statusRef}\n              >\n                <span className=\"relative flex size-2\">\n                  {!reduce && statusVisible && <span className={cn(\"absolute inset-0 animate-ping rounded-full [animation-duration:2.4s]\", s.ring)} />}\n                  <span className={cn(\"relative size-2 rounded-full\", s.dot)} />\n                </span>\n                {status.label ?? s.label}\n              </a>\n            )}\n            <p className=\"text-muted-foreground text-xs\">{copyright ?? `© ${new Date().getFullYear()} ${brand.name}`}</p>\n            {legal.length > 0 && (\n              <ul className=\"flex flex-wrap gap-x-4 gap-y-2\">\n                {legal.map((link) => (\n                  <li key={link.label}>\n                    <a className={cn(linkClass, \"text-xs\")} href={link.href}>\n                      {link.label}\n                    </a>\n                  </li>\n                ))}\n              </ul>\n            )}\n          </div>\n          <div className=\"flex items-center gap-2\">\n            {locales.length > 0 && (\n              <Select\n                items={locales}\n                onValueChange={(v) => {\n                  if (!v) return;\n                  setLocale(v as string);\n                  onLocaleChange?.(v as string);\n                }}\n                value={locale}\n              >\n                <SelectTrigger aria-label=\"Language\" className=\"h-8 w-auto min-w-0 gap-1.5 rounded-full ps-2.5 text-xs sm:min-h-8 sm:text-xs\" size=\"sm\">\n                  <GlobeIcon className=\"size-3.5 text-muted-foreground\" />\n                  <SelectValue />\n                </SelectTrigger>\n                <SelectPopup align=\"end\">\n                  {locales.map((l) => (\n                    <SelectItem key={l.value} value={l.value}>\n                      {l.label}\n                    </SelectItem>\n                  ))}\n                </SelectPopup>\n              </Select>\n            )}\n            <ThemeSwitch\n              onChange={(t) => {\n                setThemeState(t);\n                onThemeChange?.(t);\n              }}\n              value={theme}\n            />\n          </div>\n        </div>\n      </footer>\n    </MotionConfig>\n  );\n}\n"
    }
  ]
}