{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cta-split-photo",
  "type": "registry:block",
  "title": "CTA Split Photo",
  "description": "A photo split call to action with numbered reasons and bookable demo times.",
  "files": [
    {
      "path": "src/registry/blocks/cta/cta-split-photo.tsx",
      "type": "registry:block",
      "content": "\"use client\";\n\nimport { useId, useState, type ComponentProps, type CSSProperties } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\ntype Action = { label: string; href: string };\n\nexport type CtaSlot = {\n  id: string;\n  /** Short day label, e.g. \"Tue 13 Oct\". */\n  day: string;\n  /** Time label, e.g. \"10:30\". */\n  time: string;\n};\n\nexport type CtaSplitPhotoProps = {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  /** Up to three or four short, concrete reasons. Rendered as a numbered list. */\n  reasons?: string[];\n  image?: { src: string; alt: string; caption?: string };\n  /** Which side the photograph sits on from the `lg` breakpoint. */\n  photoSide?: \"left\" | \"right\";\n  /** The primary action. When a slot is selected, its label reads \"Book <day>, <time>\". */\n  primaryAction?: Action;\n  secondaryAction?: Action;\n  /** Optional bookable times. Pass an empty array to hide the list. */\n  slots?: CtaSlot[];\n  slot?: string;\n  defaultSlot?: string;\n  onSlotChange?: (slotId: string) => void;\n  timezoneNote?: string;\n  /** Background of the offer panel. Defaults to a pale blue tint. */\n  surface?: string;\n  /** Text colour on the offer panel. Must pass contrast against `surface`. */\n  surfaceForeground?: string;\n  /** Second ink for numbers, selected slot and primary button. Defaults to Devsloka blue. */\n  accent?: string;\n  /** Text colour on `accent`. */\n  accentForeground?: string;\n} & ComponentProps<\"section\">;\n\nconst DEFAULTS = {\n  eyebrow: \"Wickham · Software for small holiday lets\",\n  title: \"Talk to someone who has cleaned a room between guests.\",\n  description:\n    \"Book a 20-minute walkthrough with Ana or Tomás. Both ran guesthouses before joining Wickham. Bring your current calendar and we will import it while you watch.\",\n  reasons: [\n    \"One calendar for Airbnb, Booking and your own site, synced every 5 minutes.\",\n    \"Cleaning rotas that text your cleaner the moment a checkout is confirmed.\",\n    \"Tourist tax and invoices filed per property, ready for your accountant in April.\",\n  ],\n  image: {\n    src: \"https://images.unsplash.com/photo-1583847268964-b28dc8f51f92?w=1200&q=80\",\n    alt: \"A cosy living room interior with a sofa, cushions and soft daylight\",\n    caption: \"Casa Ribeira, Porto. Four rooms, run on Wickham since 2024.\",\n  },\n  primaryAction: { label: \"Book a walkthrough\", href: \"#\" },\n  secondaryAction: { label: \"Watch the 6-minute tour\", href: \"#\" },\n  slots: [\n    { id: \"tue-1030\", day: \"Tue 13 Oct\", time: \"10:30\" },\n    { id: \"tue-1600\", day: \"Tue 13 Oct\", time: \"16:00\" },\n    { id: \"wed-0930\", day: \"Wed 14 Oct\", time: \"09:30\" },\n    { id: \"thu-1400\", day: \"Thu 15 Oct\", time: \"14:00\" },\n  ],\n  timezoneNote: \"Times in Lisbon (WEST). Calls run on Google Meet or phone.\",\n  surface: \"#E8F0FF\",\n  surfaceForeground: \"#0A0A0A\",\n  accent: \"#0A6EFF\",\n  accentForeground: \"#FFFFFF\",\n};\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\nexport function CtaSplitPhoto({\n  eyebrow = DEFAULTS.eyebrow,\n  title = DEFAULTS.title,\n  description = DEFAULTS.description,\n  reasons = DEFAULTS.reasons,\n  image = DEFAULTS.image,\n  photoSide = \"left\",\n  primaryAction = DEFAULTS.primaryAction,\n  secondaryAction = DEFAULTS.secondaryAction,\n  slots = DEFAULTS.slots,\n  slot,\n  defaultSlot,\n  onSlotChange,\n  timezoneNote = DEFAULTS.timezoneNote,\n  surface = DEFAULTS.surface,\n  surfaceForeground = DEFAULTS.surfaceForeground,\n  accent = DEFAULTS.accent,\n  accentForeground = DEFAULTS.accentForeground,\n  className,\n  style,\n  ...props\n}: CtaSplitPhotoProps) {\n  const headingId = useId();\n  const slotsLabelId = useId();\n  const [uncontrolledSlot, setUncontrolledSlot] = useState(defaultSlot);\n  const currentSlotId = slot ?? uncontrolledSlot;\n  const currentSlot = slots.find((s) => s.id === currentSlotId);\n\n  const selectSlot = (id: string) => {\n    if (slot === undefined) setUncontrolledSlot(id);\n    onSlotChange?.(id);\n  };\n\n  const primaryHref = currentSlot\n    ? `${primaryAction.href}${primaryAction.href.includes(\"?\") ? \"&\" : \"?\"}slot=${encodeURIComponent(currentSlot.id)}`\n    : primaryAction.href;\n\n  return (\n    <section\n      data-slot=\"cta-split-photo\"\n      aria-labelledby={headingId}\n      style={\n        {\n          \"--block-surface\": surface,\n          \"--block-surface-fg\": surfaceForeground,\n          \"--block-accent\": accent,\n          \"--block-accent-fg\": accentForeground,\n          ...style,\n        } as CSSProperties\n      }\n      className={cn(\"w-full bg-background text-foreground\", className)}\n      {...props}\n    >\n      <div className=\"mx-auto max-w-6xl px-6 py-20 md:py-28\">\n        <div className=\"grid lg:grid-cols-12\">\n          <figure className={cn(\"flex flex-col lg:col-span-5\", photoSide === \"right\" && \"lg:order-last\")}>\n            {/* eslint-disable-next-line @next/next/no-img-element -- plain <img> keeps the block portable outside Next.js */}\n            <img\n              src={image.src}\n              alt={image.alt}\n              width={1200}\n              height={1500}\n              loading=\"lazy\"\n              className=\"aspect-[4/3] w-full flex-1 object-cover sm:aspect-[16/10] lg:aspect-auto\"\n            />\n            {image.caption && (\n              <figcaption className=\"border-x border-b px-4 py-3 font-mono text-[11px] leading-relaxed text-muted-foreground lg:border-x-0 lg:px-0\">\n                {image.caption}\n              </figcaption>\n            )}\n          </figure>\n\n          <div className=\"bg-[var(--block-surface)] px-6 py-10 text-[var(--block-surface-fg)] sm:px-10 md:py-14 lg:col-span-7 lg:px-14\">\n            <p className=\"font-mono text-xs uppercase tracking-wider\">{eyebrow}</p>\n            <h2\n              id={headingId}\n              className=\"mt-6 max-w-xl text-3xl font-semibold leading-[1.05] tracking-[-0.03em] text-balance md:text-5xl\"\n            >\n              {title}\n            </h2>\n            <p className=\"mt-6 max-w-lg text-base leading-relaxed\">{description}</p>\n\n            {reasons.length > 0 && (\n              <ol className=\"mt-8 max-w-lg divide-y divide-[var(--block-surface-fg)]/25 border-y border-[var(--block-surface-fg)]/25\">\n                {reasons.map((reason, i) => (\n                  <li key={reason} className=\"grid grid-cols-[2.5rem_1fr] gap-x-2 py-3 text-sm leading-relaxed\">\n                    <span aria-hidden className=\"font-mono text-xs font-semibold tabular-nums leading-6 text-[var(--block-accent)]\">\n                      {pad(i + 1)}\n                    </span>\n                    <span>{reason}</span>\n                  </li>\n                ))}\n              </ol>\n            )}\n\n            {slots.length > 0 && (\n              <div className=\"mt-8\">\n                <p id={slotsLabelId} className=\"font-mono text-[11px] uppercase tracking-wider\">\n                  Next available\n                </p>\n                <div role=\"group\" aria-labelledby={slotsLabelId} className=\"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4\">\n                  {slots.map((s) => {\n                    const selected = s.id === currentSlotId;\n                    return (\n                      <button\n                        key={s.id}\n                        type=\"button\"\n                        aria-pressed={selected}\n                        onClick={() => selectSlot(s.id)}\n                        className={cn(\n                          \"flex flex-col items-start border border-[var(--block-accent)] px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--block-accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--block-surface)]\",\n                          selected\n                            ? \"bg-[var(--block-accent)] text-[var(--block-accent-fg)]\"\n                            : \"hover:bg-[var(--block-surface-fg)]/10\"\n                        )}\n                      >\n                        <span className=\"font-mono text-[11px] uppercase tracking-wider\">{s.day}</span>\n                        <span className=\"text-base font-semibold tabular-nums\">{s.time}</span>\n                      </button>\n                    );\n                  })}\n                </div>\n                {timezoneNote && <p className=\"mt-3 text-xs leading-relaxed\">{timezoneNote}</p>}\n              </div>\n            )}\n\n            <div className=\"mt-10 flex flex-wrap items-center gap-x-6 gap-y-3\">\n              <Button\n                asChild\n                size=\"lg\"\n                className=\"rounded-none bg-[var(--block-accent)] text-[var(--block-accent-fg)] shadow-none hover:bg-[var(--block-accent)] hover:underline hover:underline-offset-4 focus-visible:ring-[var(--block-accent)]\"\n              >\n                <a href={primaryHref}>\n                  {currentSlot ? `Book ${currentSlot.day}, ${currentSlot.time}` : primaryAction.label}\n                </a>\n              </Button>\n              <a\n                href={secondaryAction.href}\n                className=\"text-sm font-medium underline decoration-1 underline-offset-[6px] outline-none hover:decoration-2 focus-visible:ring-2 focus-visible:ring-[var(--block-accent)]\"\n              >\n                {secondaryAction.label}\n              </a>\n            </div>\n            <p aria-live=\"polite\" className=\"sr-only\">\n              {currentSlot ? `Selected ${currentSlot.day} at ${currentSlot.time}.` : \"\"}\n            </p>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ],
  "registryDependencies": [
    "button"
  ]
}
