{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cta-media",
  "type": "registry:block",
  "title": "Call to action, over an image",
  "description": "A wide image with a solid panel laid over its lower left corner holding the headline, a sentence and two actions (stacked under the image on narrow screens). Lets a photograph carry the mood: a place, a product, a crowd, with text that never depends on the image colours.",
  "categories": [
    "cta"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/cta-media/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/cta-media/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, req, t } from '../_shared/schema';\n\n// Limits (KB-178): description raised to 900 for the longest real text, 780 chars (tetris-flytt); blank lines draw as paragraph gaps. The buttons are optional (a section may carry only copy).\nconst schema = z.object({\n  title: req(100),\n  description: t(900),\n  primary: link.optional(),\n  secondary: link.optional(),\n  details: z.array(link).max(4).optional(), // mail and phone lines under the buttons: label is the visible text, href the mailto: or tel:\n  // panel: 'light' draws the text panel as a white card with a shadow, ordinary heading size and a filled main button, instead of the dark panel.\n  panel: z.enum(['dark', 'light']).optional(),\n  // overlap: true lets the panel hang half below the picture's lower edge instead of sitting inside it.\n  overlap: z.boolean().optional(),\n  // bleed: true draws the picture as the section's background, edge to edge, with the panel on it at the page's left edge and centred in its height (with panel 'light', a white card on a band of picture). Off by default.\n  bleed: z.boolean().optional(),\n  media,\n});\n\nexport const spec = defineSpec({\n  type: 'cta-media',\n  aliases: ['cta/media'],\n  sourceRuns: ['rmwj0z3zle89196', 'rmwj1vfop04b484', 'rmwj1c3h9cbac94'],\n  name: 'Call to action, over an image',\n  category: 'cta',\n  role: 'body',\n  description: 'A wide image with a solid panel laid over its lower left corner holding the headline, a sentence and two actions (stacked under the image on narrow screens). Lets a photograph carry the mood: a place, a product, a crowd, with text that never depends on the image colours.',\n  schema,\n  defaults: {\n    title: 'Say what the visitor can do next',\n    description: 'Say in two sentences what the offer is and what the visitor gets from taking it up.',\n    primary: { label: 'Main action', href: '#book' },\n    secondary: { label: 'Second action', href: '#rooms' },\n    media: { src: '', alt: 'Show the offer in use, in a wide shot' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/cta-media/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/cta-media/index.tsx",
      "content": "import { useId } from 'react';\nimport { Media, Text, withHeadingLevel } from '../../editing';\nimport { ActionLink, Container, Opt, Section } from '../_shared/kit';\nimport { spec } from './spec';\nimport { cn } from '../../lib/utils';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\nfunction CtaMedia({ props }: BlockProps<Props>) {\n  const id = useId();\n  const light = props.panel === 'light';\n  const overlap = props.overlap === true;\n  const inset = overlap ? ' relative z-10 -mt-16 mx-4 rounded-kh-lg @3xl:mx-0 @3xl:mt-0' : '';\n  const bottom = overlap ? '@3xl:bottom-0 @3xl:translate-y-1/2' : '@3xl:bottom-8';\n  const panelClass = light\n    ? `border border-kh-line bg-kh-surface p-6 text-kh-ink shadow-kh-3${inset} @3xl:absolute ${bottom} @3xl:left-8 @3xl:max-w-xl @3xl:rounded-kh-lg @3xl:p-8`\n    : `@3xl:absolute ${bottom} @3xl:left-8 @3xl:max-w-xl @3xl:rounded-kh-lg bg-kh-ink p-6 text-kh-canvas @3xl:p-8`;\n  const buttons = (props.primary || props.secondary) && (\n    <div className=\"mt-6 flex flex-wrap gap-3\">\n      {props.primary && <ActionLink path={['primary']} value={props.primary} variant={light ? 'primary' : 'secondary'} />}\n      {props.secondary && <ActionLink path={['secondary']} value={props.secondary} variant={light ? 'secondary' : 'ghost'} className={light ? undefined : 'text-kh-canvas hover:bg-kh-canvas/15 hover:text-kh-canvas'} />}\n    </div>\n  );\n  const details = props.details?.some((d) => d.label) && (\n    <ul className=\"mt-4 space-y-1 text-kh-small\">\n      {props.details.map((d, i) => d.label && (\n        <li key={i}><a href={d.href} className=\"underline underline-offset-4\">{d.label}</a></li>\n      ))}\n    </ul>\n  );\n  if (props.bleed) {\n    // The picture is the section's background edge to edge; the panel sits on it at the page's left edge, centred in its height.\n    return (\n      <Section labelledBy={id} bare className=\"py-0\">\n        <div className=\"relative isolate overflow-hidden\">\n          <Media path={['media']} value={props.media} ratio=\"16/7\" className=\"absolute inset-0 h-full w-full !rounded-none\" />\n          <div className=\"relative mx-auto flex w-full max-w-kh-page items-center px-kh-gutter py-12 @3xl:min-h-[34rem]\">\n            <div className={cn('w-full rounded-kh-lg p-6 @3xl:max-w-xl @3xl:p-8', light ? 'border border-kh-line bg-kh-surface text-kh-ink shadow-kh-3' : 'bg-kh-ink text-kh-canvas')}>\n              <div id={id}>\n                <Text path={['title']} value={props.title} as=\"h2\" className={light ? 'text-kh-heading font-semibold' : 'text-kh-heading font-semibold @3xl:text-kh-title'} />\n              </div>\n              <Opt path={['description']} value={props.description} multiline className=\"mt-3 whitespace-pre-line text-kh-body\" placeholder=\"Description\" />\n              {buttons}\n              {details}\n            </div>\n          </div>\n        </div>\n      </Section>\n    );\n  }\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <div className={overlap ? 'relative rounded-kh-xl @3xl:mb-24' : 'relative overflow-hidden rounded-kh-xl border border-kh-line'}>\n          <Media path={['media']} value={props.media} ratio=\"16/7\" className={overlap ? 'min-h-52 overflow-hidden rounded-kh-xl @3xl:min-h-96' : 'min-h-96'} />\n          <div className={panelClass}>\n            <div id={id}>\n              <Text path={['title']} value={props.title} as=\"h2\" className={light ? 'text-kh-heading font-semibold' : 'text-kh-heading font-semibold @3xl:text-kh-title'} />\n            </div>\n            <Opt path={['description']} value={props.description} multiline className=\"mt-3 whitespace-pre-line text-kh-body\" placeholder=\"Description\" />\n            {(props.primary || props.secondary) && (\n            <div className=\"mt-6 flex flex-wrap gap-3\">\n              {props.primary && <ActionLink path={['primary']} value={props.primary} variant={light ? 'primary' : 'secondary'} />}\n              {props.secondary && <ActionLink path={['secondary']} value={props.secondary} variant={light ? 'secondary' : 'ghost'} className={light ? undefined : 'text-kh-canvas hover:bg-kh-canvas/15 hover:text-kh-canvas'} />}\n            </div>\n          )}\n            {props.details?.some((d) => d.label) && (\n              <ul className=\"mt-4 space-y-1 text-kh-small\">\n                {props.details.map((d, i) => d.label && (\n                  <li key={i}><a href={d.href} className=\"underline underline-offset-4\">{d.label}</a></li>\n                ))}\n              </ul>\n            )}\n          </div>\n        </div>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(CtaMedia);\n"
    }
  ]
}
