{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"faq-section","type":"registry:block","title":"FAQ section","description":"Two-column FAQ with an animated accordion, contact prompt and FAQPage JSON-LD for rich results.","dependencies":["lucide-react","motion"],"registryDependencies":["utils"],"files":[{"path":"registry/items/faq-section/faq-section.tsx","type":"registry:block","target":"components/facade/faq-section.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { ArrowRight, Mail, Phone, Plus } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface FaqItem {\n  question: string;\n  /** Plain-text answer. Also used verbatim for the JSON-LD output. */\n  answer: string;\n}\n\nexport interface FaqSectionProps {\n  eyebrow?: string;\n  heading?: string;\n  description?: string;\n  items?: FaqItem[];\n  contactHeading?: string;\n  contactText?: string;\n  phone?: string;\n  email?: string;\n  ctaLabel?: string;\n  ctaHref?: string;\n  /** Index of the item open on first render. Use -1 for none. */\n  defaultOpen?: number;\n  /** Allow several answers to be open at the same time. */\n  multiple?: boolean;\n  /** Render a schema.org FAQPage JSON-LD script tag. */\n  jsonLd?: boolean;\n  className?: string;\n}\n\nconst DEFAULT_ITEMS: FaqItem[] = [\n  {\n    question: \"How quickly can you get someone out to my house?\",\n    answer:\n      \"Most Denver metro calls get a technician the same day if you reach us before 2 PM. For no-heat or no-cooling emergencies we run a 24/7 on-call crew, and the average arrival time last winter was 74 minutes.\",\n  },\n  {\n    question: \"Do you charge for estimates?\",\n    answer:\n      \"Estimates for new system installs and replacements are always free. Diagnostic visits for repairs are a flat $89, and that fee is waived if you approve the repair while the technician is on site.\",\n  },\n  {\n    question: \"Which brands do you install and service?\",\n    answer:\n      \"We are a Carrier Factory Authorized Dealer and also install Trane, Lennox and Mitsubishi ductless systems. Our technicians service every major brand, including older units that are no longer in production.\",\n  },\n  {\n    question: \"Is financing available for a new furnace or AC?\",\n    answer:\n      \"Yes. We offer 0% APR for 18 months and low monthly payment plans up to 120 months through our lending partners, subject to credit approval. Most customers get a decision in under five minutes.\",\n  },\n  {\n    question: \"Are your technicians licensed and insured?\",\n    answer:\n      \"Every technician is NATE certified, background checked and drug tested. We are fully licensed in the City and County of Denver and carry $2M in general liability insurance.\",\n  },\n  {\n    question: \"What does your warranty cover?\",\n    answer:\n      \"New installations include a 10-year parts and labor warranty and our 1-year no-questions satisfaction guarantee. Repairs are covered for 12 months on both parts and workmanship.\",\n  },\n];\n\nexport function FaqSection({\n  eyebrow = \"FAQ\",\n  heading = \"Questions Denver homeowners ask us\",\n  description = \"Straight answers about pricing, scheduling and warranties. Can't find what you need? Our team is one call away.\",\n  items = DEFAULT_ITEMS,\n  contactHeading = \"Still have questions?\",\n  contactText = \"Talk to a real person at our Englewood office, Monday to Saturday.\",\n  phone = \"(303) 555-0148\",\n  email = \"hello@frontrangeair.com\",\n  ctaLabel = \"Schedule a visit\",\n  ctaHref = \"#\",\n  defaultOpen = 0,\n  multiple = false,\n  jsonLd = true,\n  className,\n}: FaqSectionProps) {\n  const reduce = useReducedMotion() ?? false;\n  const baseId = React.useId();\n  const [open, setOpen] = React.useState<number[]>(defaultOpen >= 0 ? [defaultOpen] : []);\n  const buttonRefs = React.useRef<Array<HTMLButtonElement | null>>([]);\n\n  const toggle = (i: number) => {\n    setOpen((prev) => {\n      const isOpen = prev.includes(i);\n      if (multiple) return isOpen ? prev.filter((x) => x !== i) : [...prev, i];\n      return isOpen ? [] : [i];\n    });\n  };\n\n  const onKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>, i: number) => {\n    let next = -1;\n    if (e.key === \"ArrowDown\") next = (i + 1) % items.length;\n    else if (e.key === \"ArrowUp\") next = (i - 1 + items.length) % items.length;\n    else if (e.key === \"Home\") next = 0;\n    else if (e.key === \"End\") next = items.length - 1;\n    if (next >= 0) {\n      e.preventDefault();\n      buttonRefs.current[next]?.focus();\n    }\n  };\n\n  const schema = React.useMemo(\n    () =>\n      JSON.stringify({\n        \"@context\": \"https://schema.org\",\n        \"@type\": \"FAQPage\",\n        mainEntity: items.map((it) => ({\n          \"@type\": \"Question\",\n          name: it.question,\n          acceptedAnswer: { \"@type\": \"Answer\", text: it.answer },\n        })),\n      }).replace(/</g, \"\\\\u003c\"),\n    [items],\n  );\n\n  const telHref = `tel:${phone.replace(/[^\\d+]/g, \"\")}`;\n\n  return (\n    <section className={cn(\"relative bg-background py-20 sm:py-28\", className)}>\n      {jsonLd && <script type=\"application/ld+json\" dangerouslySetInnerHTML={{ __html: schema }} />}\n      <div className=\"mx-auto grid max-w-[1120px] gap-12 px-6 lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)] lg:gap-20\">\n        <div className=\"lg:sticky lg:top-24 lg:self-start\">\n          <p className=\"text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground\">{eyebrow}</p>\n          <h2 className=\"mt-4 text-[34px] font-semibold leading-[1.05] tracking-[-0.03em] text-foreground sm:text-[48px]\">\n            {heading}\n          </h2>\n          <p className=\"mt-5 text-[17px] leading-relaxed text-muted-foreground sm:text-lg\">{description}</p>\n\n          <div className=\"mt-10 rounded-[28px] bg-muted p-6 sm:p-7\">\n            <h3 className=\"text-lg font-semibold tracking-[-0.01em] text-foreground\">{contactHeading}</h3>\n            <p className=\"mt-1 text-[15px] leading-relaxed text-muted-foreground\">{contactText}</p>\n            <div className=\"mt-5 grid gap-1 text-[15px]\">\n              {phone && (\n                <a\n                  href={telHref}\n                  className=\"-mx-2 flex items-center gap-3 rounded-xl px-2 py-2 text-foreground transition-colors hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:hover:bg-foreground/[0.06]\"\n                >\n                  <Phone className=\"size-4 text-muted-foreground\" aria-hidden />\n                  <span className=\"tabular-nums\">{phone}</span>\n                </a>\n              )}\n              {email && (\n                <a\n                  href={`mailto:${email}`}\n                  className=\"-mx-2 flex items-center gap-3 rounded-xl px-2 py-2 text-foreground transition-colors hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:hover:bg-foreground/[0.06]\"\n                >\n                  <Mail className=\"size-4 text-muted-foreground\" aria-hidden />\n                  <span className=\"truncate\">{email}</span>\n                </a>\n              )}\n            </div>\n            {ctaLabel && (\n              <a\n                href={ctaHref}\n                className=\"group mt-6 inline-flex h-11 w-full items-center justify-center gap-2 rounded-full bg-brand px-5 text-[15px] font-medium text-brand-foreground transition-colors hover:bg-brand/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-muted\"\n              >\n                {ctaLabel}\n                <ArrowRight className=\"size-4 transition-transform group-hover:translate-x-0.5\" aria-hidden />\n              </a>\n            )}\n          </div>\n        </div>\n\n        <div className=\"flex flex-col gap-2\">\n          {items.map((item, i) => {\n            const isOpen = open.includes(i);\n            const btnId = `${baseId}-q-${i}`;\n            const panelId = `${baseId}-a-${i}`;\n            return (\n              <div\n                key={item.question}\n                className={cn(\n                  \"rounded-[20px] px-5 transition-colors sm:px-6\",\n                  isOpen ? \"bg-muted\" : \"hover:bg-muted/60\",\n                )}\n              >\n                <h3>\n                  <button\n                    ref={(el) => {\n                      buttonRefs.current[i] = el;\n                    }}\n                    id={btnId}\n                    type=\"button\"\n                    aria-expanded={isOpen}\n                    aria-controls={panelId}\n                    onClick={() => toggle(i)}\n                    onKeyDown={(e) => onKeyDown(e, i)}\n                    className=\"group flex w-full items-start justify-between gap-6 py-5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background rounded-[20px]\"\n                  >\n                    <span\n                      className={cn(\n                        \"text-[17px] font-medium tracking-[-0.01em] transition-colors\",\n                        isOpen ? \"text-foreground\" : \"text-foreground/80 group-hover:text-foreground\",\n                      )}\n                    >\n                      {item.question}\n                    </span>\n                    <span\n                      className={cn(\n                        \"mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full transition-colors\",\n                        isOpen ? \"text-foreground\" : \"text-muted-foreground group-hover:text-foreground\",\n                      )}\n                    >\n                      <motion.span\n                        animate={{ rotate: isOpen ? 45 : 0 }}\n                        transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 380, damping: 34 }}\n                        className=\"flex\"\n                      >\n                        <Plus className=\"size-4\" aria-hidden />\n                      </motion.span>\n                    </span>\n                  </button>\n                </h3>\n                <AnimatePresence initial={false}>\n                  {isOpen && (\n                    <motion.div\n                      id={panelId}\n                      role=\"region\"\n                      aria-labelledby={btnId}\n                      initial={reduce ? { opacity: 0 } : { height: 0, opacity: 0 }}\n                      animate={reduce ? { opacity: 1 } : { height: \"auto\", opacity: 1 }}\n                      exit={reduce ? { opacity: 0 } : { height: 0, opacity: 0 }}\n                      transition={{ duration: 0.5, ease: [0.16, 1, 0.3, 1] }}\n                      className=\"overflow-hidden\"\n                    >\n                      <p className=\"max-w-[640px] pb-6 pr-10 text-[15px] leading-relaxed text-muted-foreground\">\n                        {item.answer}\n                      </p>\n                    </motion.div>\n                  )}\n                </AnimatePresence>\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default FaqSection;\n"}],"categories":["sections"],"meta":{"tier":"free","demo":"import { FaqSection } from \"./faq-section\";\n\nexport default function Demo() {\n  return <FaqSection />;\n}\n"}}