{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-faq",
  "title": "Animated Faq",
  "author": "AlgorizeTech",
  "description": "An FAQ section pairing an accordion of questions with a picture canvas that resizes and crossfades to each open answer. Use it for landing-page FAQs that should feel editorial rather than list-like.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://avaraui.com/r/animated-faq-visuals.json",
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/AnimatedFAQBlock.tsx",
      "content": "\"use client\";\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport { ChevronDown, MapPin, Compass } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport { FAQ_ITEMS, type FAQItem } from \"./animated-faq-data\";\nimport {\n  CLIInstallationVisual,\n  ThemingVisual,\n  LicensingVisual,\n  PerformanceVisual,\n} from \"./AnimatedFAQVisuals\";\n\nexport type { FAQItem };\n\nfunction renderItemVisual(item: FAQItem) {\n  if (item.visual) return item.visual;\n  switch (item.id) {\n    case \"installation\":\n      return <CLIInstallationVisual />;\n    case \"theming\":\n      return <ThemingVisual />;\n    case \"licensing\":\n      return <LicensingVisual />;\n    case \"performance\":\n      return <PerformanceVisual />;\n    default:\n      return (\n        <img\n          src={item.image}\n          alt={item.question}\n          className=\"w-full h-full object-cover object-center filter brightness-[0.97] contrast-[1.03]\"\n        />\n      );\n  }\n}\n\n// ==========================================\n// MOTION\n// The canvas eases to each item's size; the photos crossfade, the new one\n// settling from a touch larger while the old one shrinks away; the answer\n// panels open and close to their own height; the chevron turns over.\n// ==========================================\nconst EASE = \"cubic-bezier(0.16, 1, 0.3, 1)\";\n\nconst STYLES = `\n@keyframes animated-faq-photo-in { from { opacity: 0; transform: scale(1.04); } }\n@keyframes animated-faq-photo-out { to { opacity: 0; transform: scale(0.98); } }\n.animated-faq-photo-in { animation: animated-faq-photo-in 0.4s ${EASE} backwards; }\n.animated-faq-photo-out { animation: animated-faq-photo-out 0.4s ${EASE} forwards; }\n`;\n\ninterface PhotoLayer {\n  key: number;\n  item: FAQItem;\n  leaving: boolean;\n}\n\n/**\n * The photos on the canvas: the active item's on top, coming in, over any\n * still fading out. Each leaving photo keeps the item it showed.\n */\nfunction usePhotoLayers(item: FAQItem) {\n  const [layers, setLayers] = useState<PhotoLayer[]>(() => [{ key: 0, item, leaving: false }]);\n\n  // A new item: every photo showing starts to leave, and the new one comes in on top.\n  const top = layers[layers.length - 1];\n  if (top.item.id !== item.id) {\n    setLayers([\n      ...layers.map((layer) => (layer.leaving ? layer : { ...layer, leaving: true })),\n      { key: top.key + 1, item, leaving: false },\n    ]);\n  } else if (top.item !== item) {\n    setLayers([...layers.slice(0, -1), { ...top, item }]);\n  }\n\n  const drop = useCallback((key: number) => {\n    setLayers((current) => current.filter((layer) => layer.key !== key));\n  }, []);\n\n  // In case a photo's animation never ends (a hidden tab, `display: none`).\n  const leavingKeys = layers.filter((layer) => layer.leaving).map((layer) => layer.key).join();\n  useEffect(() => {\n    if (!leavingKeys) return;\n    const t = window.setTimeout(() => {\n      setLayers((current) => current.filter((layer) => !layer.leaving || !leavingKeys.split(\",\").includes(String(layer.key))));\n    }, 500);\n    return () => window.clearTimeout(t);\n  }, [leavingKeys]);\n\n  return { layers, drop };\n}\n\n// ==========================================\n// MAIN ANIMATED FAQ COMPONENT\n// ==========================================\n\nexport interface AnimatedFAQBlockProps {\n  items?: FAQItem[];\n  className?: string;\n  defaultActiveId?: string;\n  showTags?: boolean;\n  showLocation?: boolean;\n  showDimensions?: boolean;\n}\n\nexport function AnimatedFAQBlock({\n  items = FAQ_ITEMS,\n  className,\n  defaultActiveId = FAQ_ITEMS[0].id,\n  showTags = true,\n  showLocation = true,\n  showDimensions = true,\n}: AnimatedFAQBlockProps) {\n  const [activeId, setActiveId] = useState<string>(defaultActiveId);\n  const activeItem = items.find((i) => i.id === activeId) || items[0];\n  const photos = usePhotoLayers(activeItem);\n\n  const handleToggle = (id: string) => {\n    setActiveId(id);\n  };\n\n  return (\n    <div\n      className={cn(\n        \"grid grid-cols-1 lg:grid-cols-12 gap-10 lg:gap-14 items-center\",\n        className,\n      )}\n    >\n      <style>{STYLES}</style>\n      {/* ───────────────────────────────────────────────────────────\n          LEFT COLUMN: VERTICALLY CENTERED UNISERVE NATURE CANVAS\n          ─────────────────────────────────────────────────────────── */}\n      <div className=\"lg:col-span-6 w-full lg:sticky lg:top-24 self-center flex flex-col items-center justify-center min-h-[480px] py-6\">\n        {/* Dynamic morphing canvas container — fast & snappy width and height animation */}\n        <div\n          style={{\n            height: activeItem.height,\n            maxWidth: activeItem.maxWidth,\n            transition: `height 0.45s ${EASE}, max-width 0.45s ${EASE}`,\n          }}\n          className=\"relative w-full flex items-center justify-center\"\n        >\n          {/* ═══════════════════════════════════════════════════════════\n              ARCHITECTURAL CROSSHAIR GUIDES & CORNER REGISTRATION DOTS\n              (As seen in uniservecorp.com & user reference image)\n              ═══════════════════════════════════════════════════════════ */}\n\n          {/* Extended Horizontal Guide: Top */}\n          <div className=\"pointer-events-none absolute -top-[1px] -left-10 -right-10 h-[1px] bg-border\" />\n\n          {/* Extended Horizontal Guide: Bottom */}\n          <div className=\"pointer-events-none absolute -bottom-[1px] -left-10 -right-10 h-[1px] bg-border\" />\n\n          {/* Extended Vertical Guide: Left */}\n          <div className=\"pointer-events-none absolute -left-[1px] -top-10 -bottom-10 w-[1px] bg-border\" />\n\n          {/* Extended Vertical Guide: Right */}\n          <div className=\"pointer-events-none absolute -right-[1px] -top-10 -bottom-10 w-[1px] bg-border\" />\n\n          {/* 4 Corner Square Dots / Registration Markers */}\n          <div\n            className=\"pointer-events-none absolute -top-1 -left-1 size-2 bg-muted-foreground border border-border rounded-[1px] shadow-xs z-20\"\n            title=\"Top Left Anchor\"\n          />\n          <div\n            className=\"pointer-events-none absolute -top-1 -right-1 size-2 bg-muted-foreground border border-border rounded-[1px] shadow-xs z-20\"\n            title=\"Top Right Anchor\"\n          />\n          <div\n            className=\"pointer-events-none absolute -bottom-1 -left-1 size-2 bg-muted-foreground border border-border rounded-[1px] shadow-xs z-20\"\n            title=\"Bottom Left Anchor\"\n          />\n          <div\n            className=\"pointer-events-none absolute -bottom-1 -right-1 size-2 bg-muted-foreground border border-border rounded-[1px] shadow-xs z-20\"\n            title=\"Bottom Right Anchor\"\n          />\n\n          {/* Subtle Ambient Radial Backlight */}\n          <div className=\"pointer-events-none absolute -inset-6 rounded-3xl bg-primary/8 dark:bg-primary/5 blur-2xl opacity-60\" />\n\n          {/* ═══════════════════════════════════════════════════════════\n              CHAMFERED CONTAINER (Cut Top-Left & Bottom-Right)\n              Exact 1px Inset Border technique to ensure 100% clean single border\n              ═══════════════════════════════════════════════════════════ */}\n          <div\n            className=\"relative w-full h-full shadow-lg dark:shadow-2xl bg-border transition-all\"\n            style={{\n              clipPath: `polygon(${activeItem.clipCut} 0%, 100% 0%, 100% calc(100% - ${activeItem.clipCut}), calc(100% - ${activeItem.clipCut}) 100%, 0% 100%, 0% ${activeItem.clipCut})`,\n            }}\n          >\n            {/* Inner background layer with exact 1px inset so the cut corners have a crisp 1px border with no double lines */}\n            <div\n              className=\"absolute inset-[1px] overflow-hidden bg-card dark:bg-neutral-950\"\n              style={{\n                clipPath: `polygon(${activeItem.clipCut} 0%, 100% 0%, 100% calc(100% - ${activeItem.clipCut}), calc(100% - ${activeItem.clipCut}) 100%, 0% 100%, 0% ${activeItem.clipCut})`,\n              }}\n            >\n              {/* Instant Simultaneous Crossfade Visual Preview */}\n              {photos.layers.map(({ key, item: photo, leaving }) => (\n                <div\n                  key={key}\n                  onAnimationEnd={(e) => {\n                    if (leaving && e.target === e.currentTarget) photos.drop(key);\n                  }}\n                  className={cn(\n                    \"absolute inset-0 w-full h-full overflow-hidden\",\n                    leaving ? \"animated-faq-photo-out\" : \"animated-faq-photo-in\",\n                  )}\n                >\n                  {renderItemVisual(photo)}\n\n                  {/* Top Corner Watermark Tag */}\n                  {showTags && (\n                    <div className=\"absolute top-4 left-5 right-5 flex items-center justify-between text-xs pointer-events-none\">\n                      <div className=\"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-background/85 backdrop-blur-md border border-border/70 text-[11px] font-mono tracking-wider text-foreground shadow-xs\">\n                        <Compass className=\"size-3 text-primary\" />\n                        <span>{photo.category}</span>\n                      </div>\n\n                      <span className=\"font-mono text-[10px] text-muted-foreground tracking-widest uppercase bg-background/75 border border-border/50 px-2 py-0.5 rounded backdrop-blur-xs shadow-xs\">\n                        {photo.coordinates}\n                      </span>\n                    </div>\n                  )}\n\n                  {/* Bottom Nature Caption & Location */}\n                  {showLocation && (\n                    <div className=\"absolute bottom-4 left-5 right-5 pointer-events-none\">\n                      <div className=\"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-background/90 backdrop-blur-md border border-border/80 text-xs text-foreground font-medium shadow-sm\">\n                        <MapPin className=\"size-3.5 text-primary shrink-0\" />\n                        <span className=\"truncate\">{photo.location}</span>\n                      </div>\n                    </div>\n                  )}\n                </div>\n              ))}\n            </div>\n          </div>\n        </div>\n\n        {/* Dimension indicator tag below */}\n        {showDimensions && (\n          <div className=\"mt-6 flex items-center gap-4 text-[11px] font-mono text-muted-foreground/80\">\n            <span>\n              W: <strong className=\"text-foreground\">{activeItem.maxWidth}px</strong>\n            </span>\n            <span>•</span>\n            <span>\n              H: <strong className=\"text-foreground\">{activeItem.height}px</strong>\n            </span>\n            <span>•</span>\n            <span className=\"text-foreground/70 font-medium\">Uniserve Dynamic Canvas</span>\n          </div>\n        )}\n      </div>\n\n      {/* ───────────────────────────────────────────────────────────\n          RIGHT COLUMN: ACCORDION QUESTIONS LIST\n          ─────────────────────────────────────────────────────────── */}\n      <div className=\"lg:col-span-6 w-full space-y-3 sm:space-y-4\">\n        {items.map((item, idx) => {\n          const isActive = item.id === activeId;\n          const num = String(idx + 1).padStart(2, \"0\");\n\n          return (\n            <div\n              key={item.id}\n              className={cn(\n                \"rounded-2xl border transition-all duration-300 overflow-hidden\",\n                isActive\n                  ? \"border-primary/50 bg-card shadow-lg ring-1 ring-primary/20\"\n                  : \"border-border/60 bg-card/40 hover:border-border hover:bg-card/80\",\n              )}\n            >\n              <button\n                type=\"button\"\n                onClick={() => handleToggle(item.id)}\n                aria-expanded={isActive}\n                className=\"w-full text-left p-4 sm:p-5 flex items-start justify-between gap-4 cursor-pointer select-none transition-colors group\"\n              >\n                <div className=\"flex items-start gap-3.5 sm:gap-4 min-w-0\">\n                  {/* Number Badge */}\n                  <span\n                    className={cn(\n                      \"shrink-0 font-mono text-xs font-semibold px-2 py-1 rounded-md border transition-colors mt-0.5\",\n                      isActive\n                        ? \"bg-primary text-primary-foreground border-primary shadow-sm\"\n                        : \"bg-muted/80 text-muted-foreground border-border/50 group-hover:text-foreground group-hover:border-primary/30\",\n                    )}\n                  >\n                    {num}\n                  </span>\n\n                  <div className=\"min-w-0\">\n                    {/* Category Tag */}\n                    <div className=\"flex items-center gap-2 mb-1\">\n                      <span\n                        className={cn(\n                          \"text-[10px] font-medium uppercase tracking-wider\",\n                          isActive\n                            ? \"text-primary font-semibold\"\n                            : \"text-muted-foreground/70\",\n                        )}\n                      >\n                        {item.category}\n                      </span>\n                    </div>\n\n                    {/* Question Title */}\n                    <h3\n                      className={cn(\n                        \"text-sm sm:text-base font-semibold leading-snug transition-colors\",\n                        isActive\n                          ? \"text-foreground\"\n                          : \"text-foreground/80 group-hover:text-foreground\",\n                      )}\n                    >\n                      {item.question}\n                    </h3>\n                  </div>\n                </div>\n\n                {/* Animated Expand Chevron — turns over alongside its colour change. */}\n                <div\n                  style={{\n                    rotate: isActive ? \"180deg\" : \"0deg\",\n                    transition:\n                      \"rotate 0.25s cubic-bezier(0.42, 0, 0.58, 1), color 150ms cubic-bezier(0.4, 0, 0.2, 1), background-color 150ms cubic-bezier(0.4, 0, 0.2, 1), border-color 150ms cubic-bezier(0.4, 0, 0.2, 1)\",\n                  }}\n                  className={cn(\n                    \"shrink-0 size-7 rounded-full flex items-center justify-center border transition-colors mt-0.5\",\n                    isActive\n                      ? \"bg-primary/10 border-primary/30 text-primary\"\n                      : \"bg-muted/50 border-border/50 text-muted-foreground group-hover:text-foreground group-hover:border-primary/20\",\n                  )}\n                >\n                  <ChevronDown className=\"size-4\" />\n                </div>\n              </button>\n\n              {/* Accordion Expandable Answer — opens to its own height; closed,\n                  it is out of the way of the keyboard and screen readers too. */}\n              <div\n                inert={!isActive}\n                style={{\n                  display: \"grid\",\n                  gridTemplateRows: isActive ? \"1fr\" : \"0fr\",\n                  opacity: isActive ? 1 : 0,\n                  transition: `grid-template-rows 0.25s ${EASE}, opacity 0.25s ${EASE}`,\n                }}\n              >\n                <div className=\"min-h-0 overflow-hidden\">\n                  <div className=\"px-4 pb-4 sm:px-5 sm:pb-5 pt-0 border-t border-border/40 text-sm text-muted-foreground leading-relaxed\">\n                    <p className=\"pt-3 text-[13px] sm:text-sm text-foreground/80\">\n                      {item.answer}\n                    </p>\n\n                    {(showLocation || showDimensions) && (\n                      <div className=\"mt-3.5 flex items-center justify-between gap-2 pt-3 border-t border-border/30 text-xs\">\n                        {showLocation ? (\n                          <span className=\"text-xs text-muted-foreground/80 flex items-center gap-1.5\">\n                            <MapPin className=\"size-3 text-primary\" />\n                            <span>{item.location}</span>\n                          </span>\n                        ) : <span />}\n                        {showDimensions && (\n                          <span className=\"font-mono text-[11px] text-primary/90\">\n                            {item.maxWidth}×{item.height}px\n                          </span>\n                        )}\n                      </div>\n                    )}\n                  </div>\n                </div>\n              </div>\n            </div>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n\nexport default AnimatedFAQBlock;\n",
      "type": "registry:component",
      "target": "components/custom/blocks/AnimatedFAQBlock.tsx"
    },
    {
      "path": "src/components/custom/blocks/animated-faq-data.ts",
      "content": "// Sample data and item shape for AnimatedFAQBlock. Kept out of the component\n// file so it stays a components-only module (React Fast Refresh).\n\nimport type { ReactNode } from \"react\";\n\nexport interface FAQItem {\n  id: string;\n  question: string;\n  category: string;\n  answer: string;\n  /** Topic-matching 3D tech & abstract aesthetic photography */\n  image: string;\n  location: string;\n  coordinates: string;\n  /** Dynamic morphing dimensions for Uniserve-style slow transition */\n  height: number;\n  maxWidth: number;\n  clipCut: string;\n  /** Replaces the built-in visual (or the photo) shown on the canvas for this item. */\n  visual?: ReactNode;\n}\n\nexport const FAQ_ITEMS: FAQItem[] = [\n  {\n    id: \"installation\",\n    category: \"CLI & Setup\",\n    question: \"How do I install and use components in my project?\",\n    answer:\n      \"Installing components takes seconds using the official shadcn CLI. The code drops straight into your repository as pure TypeScript and Tailwind CSS — with zero third-party wrapper dependencies or build configuration headaches.\",\n    image:\n      \"https://images.unsplash.com/photo-1634017839464-5c339ebe3cb4?q=80&w=1200&auto=format&fit=crop\",\n    location: \"Modular Architecture Hub\",\n    coordinates: \"CLI • NPM • PNPM\",\n    height: 420,\n    maxWidth: 460,\n    clipCut: \"2.5rem\",\n  },\n  {\n    id: \"theming\",\n    category: \"Tailwind & Theming\",\n    question: \"Can I customize the colors, dark mode, and border radiuses?\",\n    answer:\n      \"Yes, absolutely. All components are architected around standard Tailwind CSS variables and OKLCH design tokens. Modifying your primary color, font family, or container radius automatically updates every component across both light and dark themes.\",\n    image:\n      \"https://images.unsplash.com/photo-1550684848-fac1c5b4e853?q=80&w=1200&auto=format&fit=crop\",\n    location: \"Dynamic Design Tokens\",\n    coordinates: \"OKLCH • CSS Variables\",\n    height: 340,\n    maxWidth: 530,\n    clipCut: \"2rem\",\n  },\n  {\n    id: \"licensing\",\n    category: \"MIT Licensing\",\n    question: \"Is Docs UI free to use for commercial client projects and SaaS?\",\n    answer:\n      \"Docs UI is 100% free and open-source under the permissive MIT license. You can use it in personal side projects, client portals, venture-backed SaaS applications, or commercial products with zero royalty fees or attribution requirements.\",\n    image:\n      \"https://images.unsplash.com/photo-1635776062127-d379bfcba9f8?q=80&w=1200&auto=format&fit=crop\",\n    location: \"Open Source Collective\",\n    coordinates: \"MIT License • Free Forever\",\n    height: 390,\n    maxWidth: 480,\n    clipCut: \"2.75rem\",\n  },\n  {\n    id: \"performance\",\n    category: \"Performance & FPS\",\n    question: \"How do you achieve 60fps animations with zero layout shift?\",\n    answer:\n      \"Our motion components rely exclusively on GPU-accelerated CSS properties (translate3d, scale, opacity) and spring curves rendered as native CSS easing. We avoid animating height or layout reflow properties whenever possible, guaranteeing zero CLS and a 100% Lighthouse score.\",\n    image:\n      \"https://images.unsplash.com/photo-1618005198919-d3d4b5a92ead?q=80&w=1200&auto=format&fit=crop\",\n    location: \"GPU Motion Engine\",\n    coordinates: \"60 FPS • Zero CLS\",\n    height: 330,\n    maxWidth: 540,\n    clipCut: \"2rem\",\n  },\n];\n",
      "type": "registry:component",
      "target": "components/custom/blocks/animated-faq-data.ts"
    }
  ],
  "docs": "Named export: AnimatedFAQBlock (also the default export); the sample data `FAQ_ITEMS` lives in animated-faq-data.ts, which installs alongside. All motion is CSS — no animation library.",
  "categories": [
    "marketing",
    "layout"
  ],
  "type": "registry:component"
}
