{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "parley",
  "type": "registry:block",
  "title": "Parley",
  "description": "Contact section that routes before it asks: topic chips (Sales / Support / Press / Other) reshape the form with layout animation — fields glide in and out, the submit label and expected-reply line change. Blur validation with a shake, async pending → drawn-check success or an inline error that keeps every value, plus channel cards with copy-to-clipboard and an office card with an abstract SVG street plate and pulsing pin.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://crucibleui.com/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/default/sections/parley/parley.tsx",
      "type": "registry:block",
      "target": "components/crucible/parley.tsx",
      "content": "\"use client\";\n\nimport { AnimatePresence, motion, useAnimate, type Transition } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { useReducedMotion } from \"@/hooks/use-reduced-motion\";\n\n/* ---------------------------------------------------------------- types */\n\n/** Input kind of a form field. */\nexport type ParleyFieldType = \"text\" | \"email\" | \"tel\" | \"number\" | \"textarea\" | \"select\" | \"segmented\";\n\nexport interface ParleyOption {\n  /** Submitted value. */\n  value: string;\n  /** Visible label. */\n  label: string;\n}\n\nexport interface ParleyField {\n  /**\n   * Key in the submitted values. Fields that share a `name` across topics\n   * keep their value and glide to their new position when the topic changes.\n   */\n  name: string;\n  /** Visible label. */\n  label: string;\n  /** Input kind. @default \"text\" */\n  type?: ParleyFieldType;\n  /** Placeholder text (text-like inputs and textarea). */\n  placeholder?: string;\n  /** Choices for `select` and `segmented` fields (strings use the same value and label). */\n  options?: (ParleyOption | string)[];\n  /** Initial value (e.g. the preselected segmented choice). */\n  defaultValue?: string;\n  /** Must be filled before submit. @default false */\n  required?: boolean;\n  /** Message shown when a required field is empty. @default \"{label} is required.\" */\n  requiredMessage?: string;\n  /** Format check applied to non-empty values. */\n  pattern?: RegExp;\n  /** Message shown when `pattern` fails. @default \"Check the format of this field.\" */\n  patternMessage?: string;\n  /** Custom validator; return a message to flag the field. Runs after the built-in checks. */\n  validate?: (value: string, values: Record<string, string>) => string | undefined | null;\n  /** Half width beside its neighbour when the form is wide enough. @default false */\n  half?: boolean;\n  /** Small helper line under the input. */\n  hint?: string;\n  /** `autocomplete` attribute for text-like inputs. */\n  autoComplete?: string;\n  /** Visible rows for a textarea. @default 4 */\n  rows?: number;\n}\n\n/** Built-in topic glyphs. Pass a node for your own icon. */\nexport type ParleyTopicGlyph = \"sales\" | \"support\" | \"press\" | \"other\";\n\nexport interface ParleyTopic {\n  /** Stable id, passed back to `onSubmit`. */\n  id: string;\n  /** Chip label. */\n  label: string;\n  /** Built-in glyph name or your own icon node. @default \"other\" */\n  icon?: ParleyTopicGlyph | React.ReactNode;\n  /** Fields shown, in order, while this topic is selected. */\n  fields: ParleyField[];\n  /** Submit button label. @default \"Send message\" */\n  submitLabel?: string;\n  /** Expected-reply line under the form (e.g. \"Replies within 2 hours\"). */\n  replyLine?: string;\n  /** Body of the success card. @default \"Your message is in. {replyLine}.\" */\n  successMessage?: string;\n}\n\n/** Built-in channel glyphs. */\nexport type ParleyChannelKind = \"email\" | \"chat\" | \"phone\" | \"other\";\n\nexport interface ParleyChannel {\n  /** Glyph and default link scheme. @default \"other\" */\n  kind?: ParleyChannelKind;\n  /** Card heading (e.g. \"Email us\"). */\n  label: string;\n  /** The visible contact value (address, handle, number). */\n  value: string;\n  /** Muted supporting line (hours, response time). */\n  detail?: string;\n  /** Link for the value. Email/phone default to `mailto:` / `tel:`. */\n  href?: string;\n  /** Text written to the clipboard. @default value */\n  copyValue?: string;\n}\n\nexport interface ParleyOffice {\n  /** Card heading. @default \"Visit the studio\" */\n  label?: string;\n  /** Address lines. */\n  lines: string[];\n  /** Muted supporting line (opening hours). */\n  detail?: string;\n  /** Directions link. */\n  href?: string;\n  /** Text written to the clipboard. @default lines joined with \", \" */\n  copyValue?: string;\n}\n\n/** Imperative verbs exposed through the `ref` prop. */\nexport interface ParleyHandle {\n  /** Clear every field, drop errors and the success card, and return to the default topic. */\n  reset: () => void;\n  /** Re-run the designed intro. */\n  replay: () => void;\n  /** Switch topic programmatically. */\n  setTopic: (id: string) => void;\n  /** Focus the first field of the form. */\n  focus: () => void;\n}\n\nexport interface ParleyProps extends Omit<React.ComponentPropsWithoutRef<\"section\">, \"children\" | \"title\" | \"onSubmit\"> {\n  /** Small label above the title. @default \"Contact\" */\n  eyebrow?: React.ReactNode;\n  /** Section heading. @default \"Talk to the right person\" */\n  title?: React.ReactNode;\n  /** Line under the heading. */\n  subtitle?: React.ReactNode;\n  /** Topic chips and the form each one routes to. Omit for Sales / Support / Press / Other. */\n  topics?: ParleyTopic[];\n  /** Uncontrolled initial topic id. @default first topic */\n  defaultTopic?: string;\n  /** Controlled topic id. */\n  topic?: string;\n  /** Called when the visitor picks a topic. */\n  onTopicChange?: (id: string) => void;\n  /**\n   * Called with the current topic's values. Return a Promise to hold the\n   * button in its pending state — resolve shows the success card, reject\n   * keeps every value and shows the rejection's message inline.\n   */\n  onSubmit?: (values: Record<string, string>, topic: string) => void | Promise<unknown>;\n  /** Side-column channel cards with copy-to-clipboard. Omit for a sample set; `[]` hides them. */\n  channels?: ParleyChannel[];\n  /** Office card with an abstract location plate, or `false` to hide it. */\n  office?: ParleyOffice | false;\n  /** Accent hex for the active chip, submit button, focus rings and pin. @default \"#60a5fa\" */\n  accentColor?: string;\n  /** Imperative handle (`reset()`, `replay()`, `setTopic()`, `focus()`). React 19 ref-as-prop. */\n  ref?: React.Ref<ParleyHandle>;\n  /** Extra classes for the `<section>` root. */\n  className?: string;\n}\n\n/* ---------------------------------------------------------------- defaults */\n\nconst DEFAULT_ACCENT = \"#60a5fa\";\nconst EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];\nconst SPRING: Transition = { type: \"spring\", duration: 0.45, bounce: 0 };\nconst INSTANT: Transition = { duration: 0 };\nconst EMAIL_RE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\n\nconst NAME: ParleyField = {\n  name: \"name\",\n  label: \"Full name\",\n  placeholder: \"Ada Moreno\",\n  required: true,\n  requiredMessage: \"Tell us who we're talking to.\",\n  autoComplete: \"name\",\n  half: true,\n};\nconst EMAIL: ParleyField = {\n  name: \"email\",\n  label: \"Work email\",\n  type: \"email\",\n  placeholder: \"ada@company.com\",\n  required: true,\n  requiredMessage: \"We need an email to reply to.\",\n  autoComplete: \"email\",\n  half: true,\n};\nconst MESSAGE: ParleyField = {\n  name: \"message\",\n  label: \"How can we help?\",\n  type: \"textarea\",\n  placeholder: \"A few lines of context goes a long way.\",\n  required: true,\n  requiredMessage: \"Add a short message.\",\n  validate: (v) => (v.trim().length < 12 ? \"Add a little more detail (12+ characters).\" : undefined),\n  rows: 4,\n};\n\nconst DEFAULT_TOPICS: ParleyTopic[] = [\n  {\n    id: \"sales\",\n    label: \"Sales\",\n    icon: \"sales\",\n    submitLabel: \"Talk to sales\",\n    replyLine: \"Replies within 4 hours\",\n    fields: [\n      NAME,\n      EMAIL,\n      {\n        name: \"companySize\",\n        label: \"Company size\",\n        type: \"select\",\n        required: true,\n        requiredMessage: \"Pick a company size.\",\n        options: [\n          { value: \"\", label: \"Select a range\" },\n          { value: \"1-10\", label: \"1–10 people\" },\n          { value: \"11-50\", label: \"11–50 people\" },\n          { value: \"51-200\", label: \"51–200 people\" },\n          { value: \"201-1000\", label: \"201–1,000 people\" },\n          { value: \"1000+\", label: \"1,000+ people\" },\n        ],\n        half: true,\n      },\n      {\n        name: \"teamSize\",\n        label: \"Seats needed\",\n        type: \"number\",\n        placeholder: \"12\",\n        required: true,\n        requiredMessage: \"Roughly how many seats?\",\n        validate: (v) => (!/^\\d+$/.test(v.trim()) || Number(v) < 1 ? \"Use a whole number, 1 or more.\" : undefined),\n        half: true,\n      },\n      { ...MESSAGE, label: \"What are you hoping to solve?\", placeholder: \"Current setup, timeline, must-haves…\" },\n    ],\n  },\n  {\n    id: \"support\",\n    label: \"Support\",\n    icon: \"support\",\n    submitLabel: \"Open a ticket\",\n    replyLine: \"Replies within 2 hours\",\n    fields: [\n      NAME,\n      EMAIL,\n      {\n        name: \"accountId\",\n        label: \"Account ID\",\n        placeholder: \"AC-104238\",\n        pattern: /^[A-Za-z]{2}-\\d{4,8}$/,\n        patternMessage: \"Account IDs look like AC-104238.\",\n        hint: \"Settings → Billing. Optional, but it speeds things up.\",\n      },\n      {\n        name: \"severity\",\n        label: \"Severity\",\n        type: \"segmented\",\n        options: [\n          { value: \"low\", label: \"Low\" },\n          { value: \"normal\", label: \"Normal\" },\n          { value: \"high\", label: \"High\" },\n          { value: \"urgent\", label: \"Urgent\" },\n        ],\n        defaultValue: \"normal\",\n      },\n      { ...MESSAGE, label: \"What's going on?\", placeholder: \"What you expected, what happened, and when it started.\" },\n    ],\n  },\n  {\n    id: \"press\",\n    label: \"Press\",\n    icon: \"press\",\n    submitLabel: \"Send press inquiry\",\n    replyLine: \"Replies within 1 business day\",\n    fields: [\n      NAME,\n      EMAIL,\n      { name: \"outlet\", label: \"Publication\", placeholder: \"The Weekly Ledger\", required: true, requiredMessage: \"Which outlet are you writing for?\", half: true },\n      {\n        name: \"deadline\",\n        label: \"Deadline\",\n        type: \"select\",\n        options: [\"No fixed deadline\", \"Within 48 hours\", \"This week\", \"This month\"],\n        defaultValue: \"No fixed deadline\",\n        half: true,\n      },\n      { ...MESSAGE, label: \"Your questions\", placeholder: \"Angle, questions, and who you'd like to speak with.\" },\n    ],\n  },\n  {\n    id: \"other\",\n    label: \"Other\",\n    icon: \"other\",\n    submitLabel: \"Send message\",\n    replyLine: \"Replies within 2 business days\",\n    fields: [NAME, EMAIL, { name: \"subject\", label: \"Subject\", placeholder: \"Partnership, feedback, hello…\" }, MESSAGE],\n  },\n];\n\nconst DEFAULT_CHANNELS: ParleyChannel[] = [\n  { kind: \"email\", label: \"Email\", value: \"hi@halden.example\", detail: \"Answered by a person, never a bot\" },\n  { kind: \"chat\", label: \"Live chat\", value: \"halden.example/chat\", href: \"#\", detail: \"Weekdays 8:00–18:00 PT\" },\n  { kind: \"phone\", label: \"Phone\", value: \"+1 (415) 555-0142\", detail: \"Priority line for Business plans\" },\n];\n\nconst DEFAULT_OFFICE: ParleyOffice = {\n  label: \"Visit the studio\",\n  lines: [\"418 Alder Street, Floor 3\", \"Portland, OR 97204\"],\n  detail: \"Tue–Thu, 10:00–17:00 · by appointment\",\n  href: \"#\",\n};\n\n/* ---------------------------------------------------------------- helpers */\n\n/** Black or white text, whichever reads against the accent fill. */\nfunction readableOn(hex: string): string {\n  const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());\n  if (!m) return \"#0a0a0a\";\n  let s = m[1];\n  if (s.length === 3) s = s.replace(/./g, (c) => c + c);\n  const n = parseInt(s, 16);\n  const lum = 0.2126 * ((n >> 16) & 255) + 0.7152 * ((n >> 8) & 255) + 0.0722 * (n & 255);\n  return lum > 140 ? \"#0a0a0a\" : \"#ffffff\";\n}\n\nfunction normOptions(options: ParleyField[\"options\"]): ParleyOption[] {\n  return (options ?? []).map((o) => (typeof o === \"string\" ? { value: o, label: o } : o));\n}\n\nfunction initialValue(f: ParleyField): string {\n  if (f.defaultValue != null) return f.defaultValue;\n  if (f.type === \"segmented\") return normOptions(f.options)[0]?.value ?? \"\";\n  return \"\";\n}\n\nfunction validateField(f: ParleyField, raw: string | undefined, values: Record<string, string>): string | undefined {\n  const value = (raw ?? \"\").trim();\n  if (!value) return f.required ? f.requiredMessage ?? `${f.label} is required.` : undefined;\n  if (f.type === \"email\" && !EMAIL_RE.test(value)) return \"That doesn't look like an email address.\";\n  if (f.pattern && !f.pattern.test(value)) return f.patternMessage ?? \"Check the format of this field.\";\n  return f.validate?.(value, values) ?? undefined;\n}\n\nasync function writeClipboard(text: string): Promise<boolean> {\n  try {\n    if (navigator.clipboard?.writeText) {\n      await navigator.clipboard.writeText(text);\n      return true;\n    }\n  } catch {\n    /* fall through to the legacy path */\n  }\n  try {\n    const ta = document.createElement(\"textarea\");\n    ta.value = text;\n    ta.setAttribute(\"readonly\", \"\");\n    ta.style.position = \"fixed\";\n    ta.style.opacity = \"0\";\n    document.body.appendChild(ta);\n    ta.select();\n    const ok = document.execCommand(\"copy\");\n    ta.remove();\n    return ok;\n  } catch {\n    return false;\n  }\n}\n\n/* ---------------------------------------------------------------- glyphs */\n\nconst stroke = {\n  fill: \"none\",\n  stroke: \"currentColor\",\n  strokeWidth: 1.7,\n  strokeLinecap: \"round\" as const,\n  strokeLinejoin: \"round\" as const,\n};\n\nconst TOPIC_GLYPHS: Record<ParleyTopicGlyph, React.ReactNode> = {\n  sales: <path d=\"M4 17.5 9.5 12l3.5 3.5L20 8.5M15 8.5h5v5\" />,\n  support: (\n    <>\n      <circle cx=\"12\" cy=\"12\" r=\"8\" />\n      <circle cx=\"12\" cy=\"12\" r=\"3.4\" />\n      <path d=\"m6.4 6.4 3.2 3.2M14.4 14.4l3.2 3.2M17.6 6.4l-3.2 3.2M9.6 14.4l-3.2 3.2\" />\n    </>\n  ),\n  press: (\n    <>\n      <path d=\"M5.5 5h10A1.5 1.5 0 0 1 17 6.5V18a1.5 1.5 0 0 0 1.5 1.5H6A2.5 2.5 0 0 1 3.5 17V7A2 2 0 0 1 5.5 5Z\" />\n      <path d=\"M17 9.5h2A1.5 1.5 0 0 1 20.5 11v7a1.5 1.5 0 0 1-3 0M7 9h6M7 12.5h6M7 16h3.5\" />\n    </>\n  ),\n  other: (\n    <path d=\"M5 5.5h14a1.5 1.5 0 0 1 1.5 1.5v8.5A1.5 1.5 0 0 1 19 17h-8l-4.5 3.5V17H5a1.5 1.5 0 0 1-1.5-1.5V7A1.5 1.5 0 0 1 5 5.5Z\" />\n  ),\n};\n\nconst CHANNEL_GLYPHS: Record<ParleyChannelKind, React.ReactNode> = {\n  email: (\n    <>\n      <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"2\" />\n      <path d=\"m4 7 8 6 8-6\" />\n    </>\n  ),\n  chat: (\n    <>\n      <path d=\"M4.5 6.5A2 2 0 0 1 6.5 4.5h11a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H11l-4 3.5v-3.5h-.5a2 2 0 0 1-2-2Z\" />\n      <path d=\"M8.5 10h.01M12 10h.01M15.5 10h.01\" strokeWidth=\"2.4\" />\n    </>\n  ),\n  phone: (\n    <path d=\"M6.5 3.8h2.6l1.4 4-2 1.3a10.5 10.5 0 0 0 6.4 6.4l1.3-2 4 1.4v2.6a2 2 0 0 1-2.2 2A16 16 0 0 1 4.5 6a2 2 0 0 1 2-2.2Z\" />\n  ),\n  other: (\n    <>\n      <circle cx=\"12\" cy=\"12\" r=\"8.5\" />\n      <path d=\"M3.5 12h17M12 3.5c2.4 2.4 3.5 5.2 3.5 8.5s-1.1 6.1-3.5 8.5c-2.4-2.4-3.5-5.2-3.5-8.5S9.6 5.9 12 3.5Z\" />\n    </>\n  ),\n};\n\nfunction Glyph({ children, className }: { children: React.ReactNode; className?: string }) {\n  return (\n    <svg aria-hidden viewBox=\"0 0 24 24\" className={cn(\"size-4 shrink-0\", className)} {...stroke}>\n      {children}\n    </svg>\n  );\n}\n\nfunction Spinner() {\n  return (\n    <svg aria-hidden viewBox=\"0 0 24 24\" className=\"size-4 motion-safe:animate-spin\" fill=\"none\">\n      <circle cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" strokeOpacity=\"0.25\" strokeWidth=\"3\" />\n      <path d=\"M21 12a9 9 0 0 0-9-9\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n    </svg>\n  );\n}\n\n/* ---------------------------------------------------------------- auto height */\n\n/** Animates its own height to match its content (field enter/leave, form ↔ success). */\nfunction AutoHeight({ children, instant }: { children: React.ReactNode; instant: boolean }) {\n  const innerRef = React.useRef<HTMLDivElement>(null);\n  const [height, setHeight] = React.useState<number | \"auto\">(\"auto\");\n\n  React.useEffect(() => {\n    const el = innerRef.current;\n    if (!el || typeof ResizeObserver === \"undefined\") return;\n    const ro = new ResizeObserver(() => setHeight(el.offsetHeight));\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n\n  return (\n    <motion.div\n      initial={false}\n      animate={{ height }}\n      transition={instant ? INSTANT : SPRING}\n      className=\"overflow-hidden\"\n    >\n      <div ref={innerRef} className=\"flow-root\">\n        {children}\n      </div>\n    </motion.div>\n  );\n}\n\n/* ---------------------------------------------------------------- copy button */\n\nfunction CopyButton({\n  text,\n  label,\n  reducedMotion,\n  onCopied,\n}: {\n  text: string;\n  label: string;\n  reducedMotion: boolean;\n  onCopied: (label: string, ok: boolean) => void;\n}) {\n  const [copied, setCopied] = React.useState(false);\n  const timer = React.useRef<number | undefined>(undefined);\n  React.useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  const swap: Transition = reducedMotion ? { duration: 0.12 } : { duration: 0.22, ease: EASE };\n\n  return (\n    <button\n      type=\"button\"\n      aria-label={copied ? `${label} copied` : `Copy ${label}`}\n      title={copied ? \"Copied\" : \"Copy\"}\n      onClick={async () => {\n        const ok = await writeClipboard(text);\n        onCopied(label, ok);\n        if (!ok) return;\n        setCopied(true);\n        window.clearTimeout(timer.current);\n        timer.current = window.setTimeout(() => setCopied(false), 1800);\n      }}\n      className={cn(\n        \"relative grid size-8 shrink-0 place-items-center rounded-lg border transition-colors duration-200\",\n        \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--parley-accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-neutral-950\",\n        copied\n          ? \"border-[color-mix(in_srgb,var(--parley-accent)_45%,transparent)] bg-[color-mix(in_srgb,var(--parley-accent)_14%,transparent)] text-[var(--parley-accent)]\"\n          : \"border-white/[0.08] bg-white/[0.03] text-white/55 hover:border-white/15 hover:text-white\"\n      )}\n    >\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        {copied ? (\n          <motion.svg\n            key=\"check\"\n            aria-hidden\n            viewBox=\"0 0 24 24\"\n            className=\"size-4\"\n            {...stroke}\n            strokeWidth={2.1}\n            initial={reducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6, rotate: -20 }}\n            animate={{ opacity: 1, scale: 1, rotate: 0 }}\n            exit={reducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6 }}\n            transition={swap}\n          >\n            <motion.path\n              d=\"M5 12.5l4.5 4.5L19 7.5\"\n              initial={reducedMotion ? false : { pathLength: 0 }}\n              animate={{ pathLength: 1 }}\n              transition={reducedMotion ? INSTANT : { duration: 0.32, ease: EASE, delay: 0.05 }}\n            />\n          </motion.svg>\n        ) : (\n          <motion.svg\n            key=\"copy\"\n            aria-hidden\n            viewBox=\"0 0 24 24\"\n            className=\"size-4\"\n            {...stroke}\n            initial={reducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6, rotate: 20 }}\n            animate={{ opacity: 1, scale: 1, rotate: 0 }}\n            exit={reducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6 }}\n            transition={swap}\n          >\n            <rect x=\"8.5\" y=\"8.5\" width=\"11\" height=\"11\" rx=\"2.2\" />\n            <path d=\"M15.5 8.5V6.2a1.7 1.7 0 0 0-1.7-1.7H6.2a1.7 1.7 0 0 0-1.7 1.7v7.6a1.7 1.7 0 0 0 1.7 1.7h2.3\" />\n          </motion.svg>\n        )}\n      </AnimatePresence>\n    </button>\n  );\n}\n\n/* ---------------------------------------------------------------- location plate */\n\n/** Abstract street grid + pulsing pin. Pure SVG, no map library. */\nfunction LocationPlate({ accent, reducedMotion, shown }: { accent: string; reducedMotion: boolean; shown: boolean }) {\n  const streets = \"rgba(255,255,255,0.075)\";\n  const major = \"rgba(255,255,255,0.13)\";\n  return (\n    <svg aria-hidden viewBox=\"0 0 320 132\" preserveAspectRatio=\"xMidYMid slice\" className=\"block h-full w-full\">\n      <defs>\n        <radialGradient id=\"parley-plate-glow\" cx=\"58%\" cy=\"52%\" r=\"50%\">\n          <stop offset=\"0%\" stopColor={accent} stopOpacity=\"0.16\" />\n          <stop offset=\"100%\" stopColor={accent} stopOpacity=\"0\" />\n        </radialGradient>\n        <linearGradient id=\"parley-plate-fade\" x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n          <stop offset=\"0.55\" stopColor=\"#0a0a0a\" stopOpacity=\"0\" />\n          <stop offset=\"1\" stopColor=\"#0a0a0a\" stopOpacity=\"0.75\" />\n        </linearGradient>\n      </defs>\n      <rect width=\"320\" height=\"132\" fill=\"#0d0d0f\" />\n      <rect width=\"320\" height=\"132\" fill=\"url(#parley-plate-glow)\" />\n      {/* River */}\n      <path d=\"M-10 112 C 60 96, 92 128, 160 116 S 270 92, 330 104\" fill=\"none\" stroke={accent} strokeOpacity=\"0.13\" strokeWidth=\"11\" />\n      {/* Park block */}\n      <rect x=\"104\" y=\"30\" width=\"44\" height=\"30\" rx=\"3\" fill={accent} fillOpacity=\"0.07\" />\n      {/* Minor grid */}\n      <g stroke={streets} strokeWidth=\"1.2\">\n        {[16, 44, 70, 98].map((y) => (\n          <line key={`h${y}`} x1=\"0\" x2=\"320\" y1={y} y2={y} />\n        ))}\n        {[28, 64, 100, 152, 196, 236, 280].map((x) => (\n          <line key={`v${x}`} x1={x} x2={x} y1=\"0\" y2=\"132\" />\n        ))}\n      </g>\n      {/* Arterials */}\n      <g stroke={major} strokeLinecap=\"round\">\n        <line x1=\"0\" x2=\"320\" y1=\"70\" y2=\"70\" strokeWidth=\"2.6\" />\n        <line x1=\"152\" x2=\"152\" y1=\"0\" y2=\"132\" strokeWidth=\"2.6\" />\n        <line x1=\"-6\" x2=\"326\" y1=\"126\" y2=\"-6\" strokeWidth=\"4\" />\n      </g>\n      <rect width=\"320\" height=\"132\" fill=\"url(#parley-plate-fade)\" />\n      {/* Pin */}\n      <g transform=\"translate(188 64)\">\n        {!reducedMotion ? (\n          <>\n            <circle r=\"5\" fill={accent} className=\"parley-ping\" />\n            <circle r=\"5\" fill={accent} className=\"parley-ping [animation-delay:1.1s]\" />\n          </>\n        ) : null}\n        <ellipse cx=\"0\" cy=\"1\" rx=\"5\" ry=\"2\" fill=\"#000\" opacity=\"0.5\" />\n        <motion.g\n          initial={false}\n          animate={shown ? { y: 0, opacity: 1 } : { y: -14, opacity: 0 }}\n          transition={reducedMotion ? INSTANT : { type: \"spring\", duration: 0.6, bounce: 0, delay: 0.55 }}\n        >\n          <path\n            d=\"M0 0 C -1.2 -4, -8 -8.5, -8 -15 a 8 8 0 0 1 16 0 C 8 -8.5, 1.2 -4, 0 0 Z\"\n            fill={accent}\n            stroke=\"rgba(0,0,0,0.35)\"\n            strokeWidth=\"0.8\"\n          />\n          <circle cy=\"-15\" r=\"3\" fill={readableOn(accent)} fillOpacity=\"0.85\" />\n        </motion.g>\n      </g>\n    </svg>\n  );\n}\n\n/* ---------------------------------------------------------------- field */\n\ninterface FieldProps {\n  field: ParleyField;\n  id: string;\n  value: string;\n  error?: string;\n  shake: number;\n  reducedMotion: boolean;\n  registerFocus: (name: string, el: HTMLElement | null) => void;\n  onChange: (name: string, value: string) => void;\n  onBlur: (name: string) => void;\n}\n\nconst inputBase =\n  \"w-full rounded-xl border bg-white/[0.03] px-3.5 text-sm text-white placeholder:text-white/30 transition-[border-color,background-color,box-shadow] duration-200 focus:outline-none focus:bg-white/[0.05] focus:border-[var(--parley-accent)] focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--parley-accent)_18%,transparent)]\";\n\nfunction Field({ field, id, value, error, shake, reducedMotion, registerFocus, onChange, onBlur }: FieldProps) {\n  const [scope, animate] = useAnimate<HTMLDivElement>();\n  const errorId = `${id}-error`;\n  const hintId = `${id}-hint`;\n  const type = field.type ?? \"text\";\n  const describedBy = [error ? errorId : null, field.hint ? hintId : null].filter(Boolean).join(\" \") || undefined;\n  const borderTone = error ? \"border-red-400/55\" : \"border-white/[0.09] hover:border-white/[0.16]\";\n\n  React.useEffect(() => {\n    if (!shake || reducedMotion || !scope.current) return;\n    animate(scope.current, { x: [0, -7, 6, -4, 3, -1, 0] }, { duration: 0.42, ease: \"easeOut\" });\n  }, [shake, reducedMotion, animate, scope]);\n\n  const options = normOptions(field.options);\n  const segRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const selectedIndex = Math.max(\n    0,\n    options.findIndex((o) => o.value === value)\n  );\n\n  let control: React.ReactNode;\n  if (type === \"textarea\") {\n    control = (\n      <textarea\n        ref={(el) => registerFocus(field.name, el)}\n        id={id}\n        name={field.name}\n        rows={field.rows ?? 4}\n        placeholder={field.placeholder}\n        value={value}\n        onChange={(e) => onChange(field.name, e.target.value)}\n        onBlur={() => onBlur(field.name)}\n        aria-invalid={error ? true : undefined}\n        aria-required={field.required || undefined}\n        aria-describedby={describedBy}\n        className={cn(inputBase, borderTone, \"block min-h-24 resize-y py-2.5 leading-relaxed\")}\n      />\n    );\n  } else if (type === \"select\") {\n    control = (\n      <div className=\"relative\">\n        <select\n          ref={(el) => registerFocus(field.name, el)}\n          id={id}\n          name={field.name}\n          value={value}\n          onChange={(e) => onChange(field.name, e.target.value)}\n          onBlur={() => onBlur(field.name)}\n          aria-invalid={error ? true : undefined}\n          aria-required={field.required || undefined}\n          aria-describedby={describedBy}\n          className={cn(inputBase, borderTone, \"h-11 cursor-pointer appearance-none pr-9\", !value && \"text-white/40\")}\n        >\n          {options.map((o) => (\n            <option key={o.value} value={o.value} disabled={o.value === \"\" && field.required} className=\"bg-neutral-900 text-white\">\n              {o.label}\n            </option>\n          ))}\n        </select>\n        <svg\n          aria-hidden\n          viewBox=\"0 0 24 24\"\n          className=\"pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 text-white/40\"\n          {...stroke}\n        >\n          <path d=\"m7 10 5 5 5-5\" />\n        </svg>\n      </div>\n    );\n  } else if (type === \"segmented\") {\n    const move = (to: number) => {\n      const i = (to + options.length) % options.length;\n      onChange(field.name, options[i].value);\n      segRefs.current[i]?.focus();\n    };\n    control = (\n      <div\n        role=\"radiogroup\"\n        aria-labelledby={`${id}-label`}\n        aria-describedby={describedBy}\n        className=\"grid gap-1 rounded-xl border border-white/[0.09] bg-white/[0.03] p-1\"\n        style={{ gridTemplateColumns: `repeat(${options.length}, minmax(0, 1fr))` }}\n      >\n        {options.map((o, i) => {\n          const checked = i === selectedIndex;\n          return (\n            <button\n              key={o.value}\n              ref={(el) => {\n                segRefs.current[i] = el;\n                if (checked) registerFocus(field.name, el);\n              }}\n              type=\"button\"\n              role=\"radio\"\n              aria-checked={checked}\n              tabIndex={checked ? 0 : -1}\n              onClick={() => onChange(field.name, o.value)}\n              onBlur={() => onBlur(field.name)}\n              onKeyDown={(e) => {\n                if (e.key === \"ArrowRight\" || e.key === \"ArrowDown\") {\n                  e.preventDefault();\n                  move(i + 1);\n                } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowUp\") {\n                  e.preventDefault();\n                  move(i - 1);\n                } else if (e.key === \"Home\") {\n                  e.preventDefault();\n                  move(0);\n                } else if (e.key === \"End\") {\n                  e.preventDefault();\n                  move(options.length - 1);\n                }\n              }}\n              className={cn(\n                \"relative isolate flex h-9 min-w-0 items-center justify-center gap-1.5 rounded-lg px-1 text-[13px] font-medium transition-colors duration-200\",\n                \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--parley-accent)]\",\n                checked ? \"text-white\" : \"text-white/50 hover:text-white/80\"\n              )}\n            >\n              {checked ? (\n                <motion.span\n                  layoutId={`${id}-seg`}\n                  transition={reducedMotion ? INSTANT : SPRING}\n                  className=\"absolute inset-0 -z-10 rounded-lg border border-white/[0.1] bg-white/[0.08]\"\n                />\n              ) : null}\n              {o.value === \"urgent\" || o.value === \"high\" ? (\n                <span\n                  aria-hidden\n                  className={cn(\"size-1.5 shrink-0 rounded-full\", o.value === \"urgent\" ? \"bg-rose-400\" : \"bg-amber-300\")}\n                />\n              ) : null}\n              <span className=\"truncate\">{o.label}</span>\n            </button>\n          );\n        })}\n      </div>\n    );\n  } else {\n    control = (\n      <input\n        ref={(el) => registerFocus(field.name, el)}\n        id={id}\n        name={field.name}\n        type={type === \"number\" ? \"text\" : type}\n        inputMode={type === \"number\" ? \"numeric\" : type === \"email\" ? \"email\" : type === \"tel\" ? \"tel\" : undefined}\n        autoComplete={field.autoComplete ?? \"off\"}\n        placeholder={field.placeholder}\n        value={value}\n        onChange={(e) => onChange(field.name, e.target.value)}\n        onBlur={() => onBlur(field.name)}\n        aria-invalid={error ? true : undefined}\n        aria-required={field.required || undefined}\n        aria-describedby={describedBy}\n        className={cn(inputBase, borderTone, \"h-11\", type === \"number\" && \"tabular-nums\")}\n      />\n    );\n  }\n\n  return (\n    <div ref={scope} className=\"flex flex-col gap-1.5\">\n      <div className=\"flex items-baseline justify-between gap-3\">\n        {type === \"segmented\" ? (\n          <span id={`${id}-label`} className=\"text-[13px] font-medium text-white/75\">\n            {field.label}\n          </span>\n        ) : (\n          <label id={`${id}-label`} htmlFor={id} className=\"text-[13px] font-medium text-white/75\">\n            {field.label}\n          </label>\n        )}\n        {!field.required && type !== \"segmented\" && type !== \"select\" ? (\n          <span className=\"text-[11px] text-white/30\">Optional</span>\n        ) : null}\n      </div>\n      {control}\n      <AnimatePresence initial={false}>\n        {error ? (\n          <motion.p\n            key=\"err\"\n            id={errorId}\n            initial={reducedMotion ? { opacity: 0 } : { opacity: 0, y: -4 }}\n            animate={{ opacity: 1, y: 0 }}\n            exit={{ opacity: 0 }}\n            transition={{ duration: 0.18 }}\n            className=\"flex items-center gap-1.5 text-xs text-red-300\"\n          >\n            <svg aria-hidden viewBox=\"0 0 24 24\" className=\"size-3.5 shrink-0\" {...stroke} strokeWidth={2}>\n              <circle cx=\"12\" cy=\"12\" r=\"8.5\" />\n              <path d=\"M12 7.8v5M12 16.2h.01\" />\n            </svg>\n            {error}\n          </motion.p>\n        ) : field.hint ? (\n          <p id={hintId} className=\"text-xs text-white/35\">\n            {field.hint}\n          </p>\n        ) : null}\n      </AnimatePresence>\n    </div>\n  );\n}\n\n/* ---------------------------------------------------------------- main */\n\ntype Phase = \"idle\" | \"pending\" | \"error\" | \"success\";\n\n/**\n * Parley — a contact section that routes before it asks. A radiogroup of\n * topic chips sits atop the form; picking one reshapes it — fields glide in\n * and out with layout animation, values carry across topics by field name,\n * and the submit label and expected-reply line change with the route.\n * Validation runs on blur with a short shake and inline messages; an async\n * `onSubmit` drives pending → success (a drawn check with \"Send another\") or\n * an inline error that keeps every value. A side column holds channel cards\n * with copy-to-clipboard (the icon morphs to a check) and an office card with\n * an abstract SVG street plate and pulsing pin. Reduced motion: crossfades\n * only, no shake, no pulse.\n */\nexport function Parley({\n  eyebrow = \"Contact\",\n  title = \"Talk to the right person\",\n  subtitle = \"Pick a topic and we'll route you straight to the team that can help — no ticket mazes, no bots.\",\n  topics = DEFAULT_TOPICS,\n  defaultTopic,\n  topic: topicProp,\n  onTopicChange,\n  onSubmit,\n  channels = DEFAULT_CHANNELS,\n  office = DEFAULT_OFFICE,\n  accentColor = DEFAULT_ACCENT,\n  ref,\n  className,\n  style,\n  ...props\n}: ParleyProps) {\n  const reducedMotion = useReducedMotion();\n  const uid = React.useId().replace(/[:]/g, \"\");\n  const rootRef = React.useRef<HTMLElement>(null);\n  const successRef = React.useRef<HTMLHeadingElement>(null);\n  const focusMap = React.useRef(new Map<string, HTMLElement>());\n  const chipRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n  const fallbackTopic = defaultTopic ?? topics[0]?.id ?? \"\";\n  const [innerTopic, setInnerTopic] = React.useState(fallbackTopic);\n  const topicId = topicProp ?? innerTopic;\n  const current = topics.find((t) => t.id === topicId) ?? topics[0];\n  const fields = React.useMemo(() => current?.fields ?? [], [current]);\n\n  const seedValues = React.useCallback(() => {\n    const v: Record<string, string> = {};\n    for (const t of topics) for (const f of t.fields) if (!(f.name in v)) v[f.name] = initialValue(f);\n    return v;\n  }, [topics]);\n\n  const [values, setValues] = React.useState<Record<string, string>>(seedValues);\n  const [touched, setTouched] = React.useState<Record<string, boolean>>({});\n  const [shakes, setShakes] = React.useState<Record<string, number>>({});\n  const [phase, setPhase] = React.useState<Phase>(\"idle\");\n  const [submitError, setSubmitError] = React.useState<string | null>(null);\n  const [announce, setAnnounce] = React.useState(\"\");\n  const [sentTopic, setSentTopic] = React.useState<ParleyTopic | null>(null);\n  const pendingRef = React.useRef(false);\n  const focusAfter = React.useRef<\"success\" | \"first\" | null>(null);\n\n  // Designed intro: once, the first time the section is in view.\n  const [seen, setSeen] = React.useState(false);\n  const [run, setRun] = React.useState(0);\n  React.useEffect(() => {\n    const el = rootRef.current;\n    if (!el) return;\n    const io = new IntersectionObserver(\n      (entries) => {\n        if (entries.some((e) => e.isIntersecting)) {\n          setSeen(true);\n          io.disconnect();\n        }\n      },\n      { threshold: 0.15 }\n    );\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n  const shown = reducedMotion || seen;\n\n  const accentInk = readableOn(accentColor);\n  const pending = phase === \"pending\";\n\n  const errors = React.useMemo(() => {\n    const out: Record<string, string | undefined> = {};\n    for (const f of fields) if (touched[f.name]) out[f.name] = validateField(f, values[f.name], values);\n    return out;\n  }, [fields, touched, values]);\n\n  const selectTopic = React.useCallback(\n    (id: string) => {\n      if (id === topicId) return;\n      const next = topics.find((t) => t.id === id);\n      if (!next) return;\n      if (topicProp == null) setInnerTopic(id);\n      onTopicChange?.(id);\n      setSubmitError(null);\n      if (phase === \"error\") setPhase(\"idle\");\n      const added = next.fields.filter((f) => !fields.some((g) => g.name === f.name)).length;\n      setAnnounce(`${next.label} form${added ? `, ${added} new field${added === 1 ? \"\" : \"s\"}` : \"\"}. ${next.replyLine ?? \"\"}`);\n    },\n    [topicId, topics, topicProp, onTopicChange, phase, fields]\n  );\n\n  const registerFocus = React.useCallback((name: string, el: HTMLElement | null) => {\n    if (el) focusMap.current.set(name, el);\n  }, []);\n\n  const focusFirst = React.useCallback(() => {\n    const first = fields[0];\n    if (first) focusMap.current.get(first.name)?.focus({ preventScroll: false });\n  }, [fields]);\n\n  const handleChange = React.useCallback((name: string, value: string) => {\n    setValues((v) => ({ ...v, [name]: value }));\n  }, []);\n\n  const handleBlur = React.useCallback(\n    (name: string) => {\n      const f = fields.find((x) => x.name === name);\n      if (!f) return;\n      // Don't flag untouched empty fields just for tabbing through — submit catches those.\n      const value = values[name] ?? \"\";\n      if (!touched[name] && !value.trim()) return;\n      setTouched((t) => ({ ...t, [name]: true }));\n      const err = validateField(f, value, values);\n      // Shake when a new problem appears, not on every blur of an already-flagged field.\n      if (err && err !== errors[name]) setShakes((s) => ({ ...s, [name]: (s[name] ?? 0) + 1 }));\n    },\n    [fields, values, touched, errors]\n  );\n\n  const reset = React.useCallback(() => {\n    pendingRef.current = false;\n    setValues(seedValues());\n    setTouched({});\n    setShakes({});\n    setSubmitError(null);\n    setPhase(\"idle\");\n    setSentTopic(null);\n    if (topicProp == null) setInnerTopic(fallbackTopic);\n    else if (topicProp !== fallbackTopic) onTopicChange?.(fallbackTopic);\n  }, [seedValues, topicProp, fallbackTopic, onTopicChange]);\n\n  const sendAnother = () => {\n    // Keep who they are; clear what they said.\n    const seeded = seedValues();\n    setValues((v) => ({ ...seeded, name: v.name ?? \"\", email: v.email ?? \"\" }));\n    setTouched({});\n    setSubmitError(null);\n    setPhase(\"idle\");\n    focusAfter.current = \"first\";\n  };\n\n  const replay = React.useCallback(() => {\n    setSeen(true);\n    setRun((r) => r + 1);\n  }, []);\n\n  React.useImperativeHandle(ref, () => ({ reset, replay, setTopic: selectTopic, focus: focusFirst }), [\n    reset,\n    replay,\n    selectTopic,\n    focusFirst,\n  ]);\n\n  React.useEffect(() => {\n    if (focusAfter.current === \"success\" && phase === \"success\") {\n      successRef.current?.focus({ preventScroll: true });\n      focusAfter.current = null;\n    }\n  }, [phase]);\n\n  // \"Send another\": the form mounts only after the success card exits, so focus from its ref.\n  const formRef = React.useCallback(\n    (el: HTMLFormElement | null) => {\n      if (!el || focusAfter.current !== \"first\") return;\n      focusAfter.current = null;\n      requestAnimationFrame(() => focusFirst());\n    },\n    [focusFirst]\n  );\n\n  const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    if (pendingRef.current || !current) return;\n    const invalid = fields.filter((f) => validateField(f, values[f.name], values));\n    if (invalid.length) {\n      setTouched((t) => {\n        const next = { ...t };\n        for (const f of fields) next[f.name] = true;\n        return next;\n      });\n      setShakes((s) => {\n        const next = { ...s };\n        for (const f of invalid) next[f.name] = (next[f.name] ?? 0) + 1;\n        return next;\n      });\n      setAnnounce(`${invalid.length} field${invalid.length === 1 ? \" needs\" : \"s need\"} attention.`);\n      focusMap.current.get(invalid[0].name)?.focus();\n      return;\n    }\n    const payload: Record<string, string> = {};\n    for (const f of fields) payload[f.name] = (values[f.name] ?? \"\").trim();\n    pendingRef.current = true;\n    setSubmitError(null);\n    setPhase(\"pending\");\n    setAnnounce(\"Sending…\");\n    try {\n      await onSubmit?.(payload, current.id);\n      pendingRef.current = false;\n      setSentTopic(current);\n      focusAfter.current = \"success\";\n      setPhase(\"success\");\n      setAnnounce(`Message sent. ${current.replyLine ?? \"\"}`);\n    } catch (err) {\n      pendingRef.current = false;\n      const msg = err instanceof Error && err.message ? err.message : \"Something went wrong. Your message is still here — try again.\";\n      setSubmitError(msg);\n      setPhase(\"error\");\n      setAnnounce(\"\");\n    }\n  };\n\n  const onCopied = React.useCallback((label: string, ok: boolean) => {\n    setAnnounce(ok ? `${label} copied to clipboard.` : `Couldn't copy ${label}.`);\n  }, []);\n\n  /* ---- chip radiogroup keyboard ---- */\n  const topicIndex = Math.max(0, topics.findIndex((t) => t.id === current?.id));\n  const moveChip = (to: number) => {\n    const i = (to + topics.length) % topics.length;\n    selectTopic(topics[i].id);\n    chipRefs.current[i]?.focus();\n  };\n\n  /* ---- intro choreography ---- */\n  const enter = (delay: number) =>\n    reducedMotion\n      ? { initial: false as const, animate: { opacity: 1, y: 0 } }\n      : {\n          initial: { opacity: 0, y: 14 },\n          animate: shown ? { opacity: 1, y: 0 } : { opacity: 0, y: 14 },\n          transition: { duration: 0.55, ease: EASE, delay },\n        };\n\n  const fieldT: Transition = reducedMotion ? { duration: 0.15 } : SPRING;\n  const focusRing =\n    \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--parley-accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-neutral-950\";\n\n  const hasSide = channels.length > 0 || office !== false;\n  const officeCopy = office ? office.copyValue ?? office.lines.join(\", \") : \"\";\n  const firstName = (values.name ?? \"\").trim().split(/\\s+/)[0];\n\n  return (\n    <section\n      ref={rootRef}\n      data-crucible=\"parley\"\n      aria-labelledby={`${uid}-title`}\n      className={cn(\"@container relative isolate w-full text-white\", className)}\n      style={{ [\"--parley-accent\" as string]: accentColor, ...style }}\n      {...props}\n    >\n      <style>{`@keyframes parley-ping{0%{transform:scale(1);opacity:.55}100%{transform:scale(4.2);opacity:0}}.parley-ping{transform-box:fill-box;transform-origin:center;animation:parley-ping 2.2s cubic-bezier(0,0,.2,1) infinite}`}</style>\n\n      <div key={run} className=\"mx-auto w-full max-w-6xl px-4 py-10 @xl:px-8 @xl:py-14\">\n        {/* Header */}\n        <motion.header {...enter(0)} className=\"max-w-xl\">\n          <p className=\"inline-flex items-center gap-2 text-xs font-medium tracking-[0.16em] text-[var(--parley-accent)] uppercase\">\n            <span aria-hidden className=\"h-px w-5 bg-[var(--parley-accent)] opacity-70\" />\n            {eyebrow}\n          </p>\n          <h2 id={`${uid}-title`} className=\"mt-3 text-3xl font-semibold tracking-tight text-balance text-white @xl:text-4xl\">\n            {title}\n          </h2>\n          {subtitle ? <p className=\"mt-3 max-w-lg text-[15px] leading-relaxed text-pretty text-white/50\">{subtitle}</p> : null}\n        </motion.header>\n\n        <div className={cn(\"mt-10 grid gap-5\", hasSide && \"@3xl:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] @3xl:gap-6\")}>\n          {/* Form card */}\n          <motion.div\n            {...enter(0.08)}\n            className=\"@container/form relative rounded-2xl border border-white/[0.08] bg-white/[0.025] shadow-[0_1px_0_0_rgba(255,255,255,0.04)_inset,0_24px_60px_-30px_rgba(0,0,0,0.8)]\"\n          >\n            {/* top hairline glow */}\n            <div\n              aria-hidden\n              className=\"pointer-events-none absolute inset-x-8 top-0 h-px\"\n              style={{ background: `linear-gradient(90deg, transparent, color-mix(in srgb, ${accentColor} 55%, transparent), transparent)` }}\n            />\n            <AutoHeight instant={reducedMotion}>\n              <AnimatePresence initial={false} mode=\"wait\">\n                {phase === \"success\" ? (\n                  <motion.div\n                    key=\"success\"\n                    initial={reducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0.98 }}\n                    animate={{ opacity: 1, scale: 1 }}\n                    exit={{ opacity: 0 }}\n                    transition={reducedMotion ? { duration: 0.15 } : { duration: 0.35, ease: EASE }}\n                    className=\"flex min-h-[420px] flex-col items-center justify-center px-6 py-14 text-center\"\n                  >\n                    <svg aria-hidden viewBox=\"0 0 64 64\" className=\"size-16\" fill=\"none\">\n                      <circle cx=\"32\" cy=\"32\" r=\"30\" fill={accentColor} fillOpacity=\"0.08\" />\n                      <motion.circle\n                        cx=\"32\"\n                        cy=\"32\"\n                        r=\"27\"\n                        stroke={accentColor}\n                        strokeWidth=\"2\"\n                        strokeLinecap=\"round\"\n                        transform=\"rotate(-90 32 32)\"\n                        initial={reducedMotion ? false : { pathLength: 0 }}\n                        animate={{ pathLength: 1 }}\n                        transition={reducedMotion ? INSTANT : { duration: 0.55, ease: EASE }}\n                      />\n                      <motion.path\n                        d=\"M21 33l7.5 7.5L44 25\"\n                        stroke={accentColor}\n                        strokeWidth=\"3\"\n                        strokeLinecap=\"round\"\n                        strokeLinejoin=\"round\"\n                        initial={reducedMotion ? false : { pathLength: 0 }}\n                        animate={{ pathLength: 1 }}\n                        transition={reducedMotion ? INSTANT : { duration: 0.35, ease: EASE, delay: 0.38 }}\n                      />\n                    </svg>\n                    <h3\n                      ref={successRef}\n                      tabIndex={-1}\n                      className=\"mt-6 text-xl font-semibold tracking-tight text-white focus:outline-none\"\n                    >\n                      {firstName ? `Thanks, ${firstName} — message sent` : \"Message sent\"}\n                    </h3>\n                    <p className=\"mt-2 max-w-xs text-sm leading-relaxed text-white/50\">\n                      {sentTopic?.successMessage ??\n                        `It's with our ${sentTopic?.label.toLowerCase() ?? \"\"} team. ${sentTopic?.replyLine ? `${sentTopic.replyLine}.` : \"\"}`}\n                    </p>\n                    {values.email ? (\n                      <p className=\"mt-4 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-1 text-xs text-white/55\">\n                        Reply goes to <span className=\"text-white/80\">{values.email}</span>\n                      </p>\n                    ) : null}\n                    <button\n                      type=\"button\"\n                      onClick={sendAnother}\n                      className={cn(\n                        \"mt-7 inline-flex items-center gap-1.5 rounded-md text-sm font-medium text-[var(--parley-accent)] underline-offset-4 hover:underline\",\n                        focusRing\n                      )}\n                    >\n                      Send another\n                      <Glyph className=\"size-3.5\">\n                        <path d=\"M5 12h14m-5-5 5 5-5 5\" />\n                      </Glyph>\n                    </button>\n                  </motion.div>\n                ) : (\n                  <motion.form\n                    key=\"form\"\n                    ref={formRef}\n                    noValidate\n                    onSubmit={handleSubmit}\n                    aria-labelledby={`${uid}-title`}\n                    initial={reducedMotion ? { opacity: 0 } : { opacity: 0, y: 8 }}\n                    animate={{ opacity: 1, y: 0 }}\n                    exit={{ opacity: 0 }}\n                    transition={reducedMotion ? { duration: 0.15 } : { duration: 0.3, ease: EASE }}\n                    className=\"p-4 @md:p-6\"\n                  >\n                    {/* Topic chips */}\n                    <div id={`${uid}-topic-label`} className=\"mb-2.5 text-[13px] font-medium text-white/75\">\n                      What&apos;s this about?\n                    </div>\n                    <div\n                      role=\"radiogroup\"\n                      aria-labelledby={`${uid}-topic-label`}\n                      className=\"grid grid-cols-2 gap-1 rounded-xl border border-white/[0.08] bg-black/30 p-1 @sm/form:grid-cols-4\"\n                      style={topics.length !== 4 ? { gridTemplateColumns: `repeat(${Math.min(topics.length, 4)}, minmax(0, 1fr))` } : undefined}\n                    >\n                      {topics.map((t, i) => {\n                        const checked = i === topicIndex;\n                        const icon =\n                          t.icon != null && typeof t.icon !== \"string\" ? (\n                            t.icon\n                          ) : (\n                            <Glyph>{TOPIC_GLYPHS[(t.icon as ParleyTopicGlyph) ?? \"other\"] ?? TOPIC_GLYPHS.other}</Glyph>\n                          );\n                        return (\n                          <button\n                            key={t.id}\n                            ref={(el) => {\n                              chipRefs.current[i] = el;\n                            }}\n                            type=\"button\"\n                            role=\"radio\"\n                            aria-checked={checked}\n                            tabIndex={checked ? 0 : -1}\n                            disabled={pending}\n                            onClick={() => selectTopic(t.id)}\n                            onKeyDown={(e) => {\n                              if (e.key === \"ArrowRight\" || e.key === \"ArrowDown\") {\n                                e.preventDefault();\n                                moveChip(i + 1);\n                              } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowUp\") {\n                                e.preventDefault();\n                                moveChip(i - 1);\n                              } else if (e.key === \"Home\") {\n                                e.preventDefault();\n                                moveChip(0);\n                              } else if (e.key === \"End\") {\n                                e.preventDefault();\n                                moveChip(topics.length - 1);\n                              }\n                            }}\n                            className={cn(\n                              \"relative isolate flex h-10 min-w-0 items-center justify-center gap-2 rounded-lg px-2 text-sm font-medium transition-colors duration-200 disabled:cursor-not-allowed\",\n                              \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--parley-accent)]\",\n                              checked ? \"\" : \"text-white/50 hover:bg-white/[0.04] hover:text-white/85\"\n                            )}\n                            style={checked ? { color: accentInk } : undefined}\n                          >\n                            {checked ? (\n                              <motion.span\n                                layoutId={`${uid}-chip`}\n                                transition={reducedMotion ? INSTANT : SPRING}\n                                className=\"absolute inset-0 -z-10 rounded-lg\"\n                                style={{\n                                  backgroundColor: accentColor,\n                                  boxShadow: `0 6px 20px -8px ${accentColor}, inset 0 1px 0 rgba(255,255,255,0.25)`,\n                                }}\n                              />\n                            ) : null}\n                            {icon}\n                            <span className=\"truncate\">{t.label}</span>\n                          </button>\n                        );\n                      })}\n                    </div>\n\n                    {/* Fields */}\n                    <fieldset disabled={pending} className=\"relative mt-6 grid min-w-0 grid-cols-1 gap-x-4 gap-y-5 @sm/form:grid-cols-2\">\n                      <legend className=\"sr-only\">{current?.label} details</legend>\n                      <AnimatePresence initial={false} mode=\"popLayout\">\n                        {fields.map((f) => (\n                          <motion.div\n                            key={f.name}\n                            layout={reducedMotion ? false : \"position\"}\n                            initial={reducedMotion ? { opacity: 0 } : { opacity: 0, y: 10, filter: \"blur(4px)\" }}\n                            animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n                            exit={reducedMotion ? { opacity: 0 } : { opacity: 0, scale: 0.97, filter: \"blur(4px)\" }}\n                            transition={fieldT}\n                            className={cn(\"min-w-0\", f.half ? \"@sm/form:col-span-1\" : \"@sm/form:col-span-2\")}\n                          >\n                            <Field\n                              field={f}\n                              id={`${uid}-${f.name}`}\n                              value={values[f.name] ?? \"\"}\n                              error={errors[f.name]}\n                              shake={shakes[f.name] ?? 0}\n                              reducedMotion={reducedMotion}\n                              registerFocus={registerFocus}\n                              onChange={handleChange}\n                              onBlur={handleBlur}\n                            />\n                          </motion.div>\n                        ))}\n                      </AnimatePresence>\n                    </fieldset>\n\n                    {/* Submit error */}\n                    <AnimatePresence initial={false}>\n                      {phase === \"error\" && submitError ? (\n                        <motion.div\n                          key=\"submit-error\"\n                          role=\"alert\"\n                          initial={{ opacity: 0 }}\n                          animate={{ opacity: 1 }}\n                          exit={{ opacity: 0 }}\n                          className=\"mt-5 flex items-start gap-2.5 rounded-xl border border-red-400/25 bg-red-500/[0.07] px-3.5 py-3 text-sm text-red-200\"\n                        >\n                          <Glyph className=\"mt-0.5 text-red-300\">\n                            <path d=\"M12 4 21 19.5H3Z\" />\n                            <path d=\"M12 10v4M12 17h.01\" />\n                          </Glyph>\n                          <span>{submitError}</span>\n                        </motion.div>\n                      ) : null}\n                    </AnimatePresence>\n\n                    {/* Footer: reply line + submit */}\n                    <div className=\"mt-6 flex flex-col-reverse gap-4 border-t border-white/[0.07] pt-5 @sm/form:flex-row @sm/form:items-center @sm/form:justify-between\">\n                      <p className=\"flex items-center gap-2 text-xs text-white/45\">\n                        <span aria-hidden className=\"relative flex size-2\">\n                          {!reducedMotion ? (\n                            <span className=\"absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-50 [animation-duration:2.4s]\" />\n                          ) : null}\n                          <span className=\"relative inline-flex size-2 rounded-full bg-emerald-400\" />\n                        </span>\n                        <AnimatePresence initial={false} mode=\"popLayout\">\n                          <motion.span\n                            key={current?.replyLine ?? \"none\"}\n                            initial={reducedMotion ? { opacity: 0 } : { opacity: 0, y: 6 }}\n                            animate={{ opacity: 1, y: 0 }}\n                            exit={reducedMotion ? { opacity: 0 } : { opacity: 0, y: -6 }}\n                            transition={{ duration: 0.25, ease: EASE }}\n                            className=\"tabular-nums\"\n                          >\n                            {current?.replyLine ?? \"We read every message\"}\n                          </motion.span>\n                        </AnimatePresence>\n                      </p>\n                      <motion.button\n                        type=\"submit\"\n                        layout={reducedMotion ? false : true}\n                        transition={reducedMotion ? INSTANT : SPRING}\n                        aria-disabled={pending || undefined}\n                        aria-busy={pending || undefined}\n                        className={cn(\n                          \"inline-flex h-11 shrink-0 items-center justify-center gap-2 overflow-hidden rounded-xl px-5 text-sm font-semibold whitespace-nowrap transition-[filter] hover:brightness-110 active:brightness-95\",\n                          focusRing\n                        )}\n                        style={{\n                          backgroundColor: accentColor,\n                          color: accentInk,\n                          boxShadow: `0 10px 30px -12px ${accentColor}, inset 0 1px 0 rgba(255,255,255,0.3)`,\n                        }}\n                      >\n                        <AnimatePresence initial={false} mode=\"popLayout\">\n                          <motion.span\n                            key={pending ? \"pending\" : current?.submitLabel ?? \"Send message\"}\n                            layout={reducedMotion ? false : \"position\"}\n                            initial={reducedMotion ? { opacity: 0 } : { opacity: 0, y: 10 }}\n                            animate={{ opacity: 1, y: 0 }}\n                            exit={reducedMotion ? { opacity: 0 } : { opacity: 0, y: -10 }}\n                            transition={{ duration: 0.22, ease: EASE }}\n                            className=\"inline-flex items-center gap-2\"\n                          >\n                            {pending ? <Spinner /> : null}\n                            {pending ? \"Sending…\" : current?.submitLabel ?? \"Send message\"}\n                            {!pending ? (\n                              <Glyph className=\"size-3.5\">\n                                <path d=\"M5 12h14m-5-5 5 5-5 5\" />\n                              </Glyph>\n                            ) : null}\n                          </motion.span>\n                        </AnimatePresence>\n                      </motion.button>\n                    </div>\n                  </motion.form>\n                )}\n              </AnimatePresence>\n            </AutoHeight>\n          </motion.div>\n\n          {/* Side column */}\n          {hasSide ? (\n            <div className=\"grid content-start gap-3 @xl:grid-cols-2 @3xl:grid-cols-1\">\n              {channels.map((c, i) => {\n                const kind = c.kind ?? \"other\";\n                const href = c.href ?? (kind === \"email\" ? `mailto:${c.value}` : kind === \"phone\" ? `tel:${c.value.replace(/[^\\d+]/g, \"\")}` : undefined);\n                return (\n                  <motion.div\n                    key={`${c.label}-${c.value}`}\n                    {...enter(0.16 + i * 0.06)}\n                    className=\"group flex items-center gap-3.5 rounded-2xl @xl:col-start-1 @3xl:col-start-auto border border-white/[0.07] bg-white/[0.02] p-3.5 transition-colors duration-200 hover:border-white/[0.12] hover:bg-white/[0.035]\"\n                  >\n                    <span\n                      aria-hidden\n                      className=\"grid size-10 shrink-0 place-items-center rounded-xl border border-white/[0.08] bg-white/[0.03] text-white/70 transition-colors duration-200 group-hover:text-[var(--parley-accent)]\"\n                    >\n                      <Glyph className=\"size-[18px]\">{CHANNEL_GLYPHS[kind]}</Glyph>\n                    </span>\n                    <div className=\"min-w-0 flex-1\">\n                      <p className=\"text-[13px] font-medium text-white/85\">{c.label}</p>\n                      {href ? (\n                        <a\n                          href={href}\n                          className={cn(\n                            \"block truncate rounded-sm text-sm text-white/55 tabular-nums transition-colors hover:text-[var(--parley-accent)]\",\n                            focusRing\n                          )}\n                        >\n                          {c.value}\n                        </a>\n                      ) : (\n                        <p className=\"truncate text-sm text-white/55 tabular-nums\">{c.value}</p>\n                      )}\n                      {c.detail ? <p className=\"mt-0.5 text-xs leading-snug text-pretty text-white/30\">{c.detail}</p> : null}\n                    </div>\n                    <CopyButton\n                      text={c.copyValue ?? c.value}\n                      label={c.label}\n                      reducedMotion={reducedMotion}\n                      onCopied={onCopied}\n                    />\n                  </motion.div>\n                );\n              })}\n\n              {office ? (\n                <motion.div\n                  {...enter(0.16 + channels.length * 0.06)}\n                  className=\"flex flex-col overflow-hidden rounded-2xl border border-white/[0.07] bg-white/[0.02] @xl:col-start-2 @xl:row-start-1 @xl:row-span-3 @3xl:col-start-auto @3xl:row-start-auto @3xl:row-span-1\"\n                >\n                  <div className=\"relative h-28 flex-1 border-b border-white/[0.06] @3xl:flex-none\">\n                    <LocationPlate accent={accentColor} reducedMotion={reducedMotion} shown={shown} />\n                  </div>\n                  <div className=\"flex items-start gap-3.5 p-3.5\">\n                    <div className=\"min-w-0 flex-1\">\n                      <p className=\"text-[13px] font-medium text-white/85\">{office.label ?? \"Visit the studio\"}</p>\n                      <address className=\"mt-0.5 text-sm leading-snug text-white/55 not-italic\">\n                        {office.lines.map((l) => (\n                          <span key={l} className=\"block\">\n                            {l}\n                          </span>\n                        ))}\n                      </address>\n                      {office.detail ? <p className=\"mt-1 text-xs text-white/30\">{office.detail}</p> : null}\n                      {office.href ? (\n                        <a\n                          href={office.href}\n                          className={cn(\n                            \"mt-2 inline-flex items-center gap-1 rounded-sm text-xs font-medium text-[var(--parley-accent)] underline-offset-4 hover:underline\",\n                            focusRing\n                          )}\n                        >\n                          Get directions\n                          <Glyph className=\"size-3\">\n                            <path d=\"M7 17 17 7M9 7h8v8\" />\n                          </Glyph>\n                        </a>\n                      ) : null}\n                    </div>\n                    <CopyButton\n                      text={officeCopy}\n                      label={office.label ? `${office.label} address` : \"Address\"}\n                      reducedMotion={reducedMotion}\n                      onCopied={onCopied}\n                    />\n                  </div>\n                </motion.div>\n              ) : null}\n            </div>\n          ) : null}\n        </div>\n      </div>\n\n      <p role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n        {announce}\n      </p>\n    </section>\n  );\n}\n"
    }
  ]
}