{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "blog-magazine",
  "type": "registry:block",
  "title": "Blog Magazine",
  "description": "A magazine-cover grid of photo tiles and solid ink covers.",
  "files": [
    {
      "path": "src/registry/blocks/blog/blog-magazine.tsx",
      "type": "registry:block",
      "content": "import { useId, type CSSProperties, type ComponentProps } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type MagazineInk = \"blue\" | \"black\" | \"navy\" | \"tint\";\nexport type MagazineShape = \"half-circle\" | \"dots\" | \"bars\" | \"circle\";\n\ntype TileBase = {\n  /** Issue number, shown as \"No. 14\". */\n  issue: number;\n  /** Small mono label, e.g. \"Autumn 2026\". */\n  label: string;\n  title: string;\n  href: string;\n  /** \"feature\" spans 2×2, \"wide\" spans 2×1, default is 1×1. */\n  size?: \"feature\" | \"wide\";\n};\n\nexport type MagazineTile =\n  | (TileBase & { kind: \"photo\"; image: { src: string; alt: string }; dek?: string })\n  | (TileBase & { kind: \"cover\"; ink: MagazineInk; shape?: MagazineShape; numeral?: string });\n\nexport type BlogMagazineProps = {\n  eyebrow?: string;\n  title?: string;\n  note?: string;\n  tiles?: MagazineTile[];\n  /** Override any of the four cover inks. */\n  inks?: Partial<Record<MagazineInk, string>>;\n} & ComponentProps<\"section\">;\n\nconst unsplash = (id: string, w: number) =>\n  `https://images.unsplash.com/${id}?w=${w}&q=80&auto=format&fit=crop`;\n\nconst DEFAULT_INKS: Record<MagazineInk, string> = {\n  blue: \"#0A6EFF\",\n  black: \"#0A0A0A\",\n  navy: \"#0B2A66\",\n  tint: \"#E8F0FF\",\n};\n\n/** Text colour per ink, chosen for contrast (white on Devsloka blue keeps small labels above 4.5:1). */\nconst INK_TEXT: Record<MagazineInk, string> = {\n  blue: \"#FFFFFF\",\n  black: \"#FFFFFF\",\n  navy: \"#FFFFFF\",\n  tint: \"#0A0A0A\",\n};\n\nconst DEFAULT_TILES: MagazineTile[] = [\n  {\n    kind: \"photo\",\n    size: \"feature\",\n    issue: 14,\n    label: \"Autumn 2026 · 64 pages\",\n    title: \"The quiet season\",\n    dek: \"Eleven owners on what they actually do between the last hikers and the first snow. Mostly: fix the boiler.\",\n    href: \"#\",\n    image: {\n      src: unsplash(\"photo-1506905925346-21bda4d32df4\", 1400),\n      alt: \"Mountains above the clouds at dawn\",\n    },\n  },\n  {\n    kind: \"cover\",\n    ink: \"blue\",\n    shape: \"half-circle\",\n    issue: 13,\n    label: \"Summer 2026\",\n    title: \"Full house, empty fridge\",\n    href: \"#\",\n  },\n  {\n    kind: \"photo\",\n    issue: 12,\n    label: \"Spring 2026\",\n    title: \"Open until the last guest leaves\",\n    href: \"#\",\n    image: { src: unsplash(\"photo-1472851294608-062f824d29cc\", 800), alt: \"An “Open” sign on a shop door\" },\n  },\n  {\n    kind: \"photo\",\n    issue: 11,\n    label: \"Winter 2025\",\n    title: \"The spare room economy\",\n    href: \"#\",\n    image: { src: unsplash(\"photo-1583847268964-b28dc8f51f92\", 800), alt: \"A cosy living room interior\" },\n  },\n  {\n    kind: \"cover\",\n    ink: \"black\",\n    shape: \"dots\",\n    issue: 10,\n    label: \"Autumn 2025\",\n    title: \"Fewer rooms, better ones\",\n    href: \"#\",\n  },\n  {\n    kind: \"cover\",\n    ink: \"navy\",\n    size: \"wide\",\n    numeral: \"40\",\n    issue: 9,\n    label: \"Summer 2025 · The staffing issue\",\n    title: \"Forty rooms, one desk, no night shift\",\n    href: \"#\",\n  },\n  {\n    kind: \"photo\",\n    issue: 8,\n    label: \"Spring 2025\",\n    title: \"Walks the guests found first\",\n    href: \"#\",\n    image: { src: unsplash(\"photo-1441974231531-c6227db76b6e\", 800), alt: \"A sunlit forest path\" },\n  },\n  {\n    kind: \"cover\",\n    ink: \"tint\",\n    shape: \"bars\",\n    issue: 7,\n    label: \"Winter 2024\",\n    title: \"Notes on charging more\",\n    href: \"#\",\n  },\n];\n\nconst DEFAULTS = {\n  eyebrow: \"Saltbox Quarterly · In print since 2023\",\n  title: \"A small magazine for people who run small places\",\n  note: \"Posted free to every Saltbox owner who asks. Back issues while they last.\",\n};\n\nconst focusRing =\n  \"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\";\n\nconst SIZE: Record<NonNullable<TileBase[\"size\"]> | \"default\", string> = {\n  feature: \"col-span-2 row-span-2\",\n  wide: \"col-span-2\",\n  default: \"\",\n};\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\nfunction Shape({ shape }: { shape: MagazineShape }) {\n  return (\n    <svg\n      aria-hidden\n      viewBox=\"0 0 100 100\"\n      className=\"absolute top-5 right-5 size-24 md:size-28\"\n      fill=\"currentColor\"\n    >\n      {shape === \"circle\" && <circle cx=\"50\" cy=\"50\" r=\"46\" />}\n      {shape === \"half-circle\" && <path d=\"M4 50a46 46 0 0 1 92 0Z\" />}\n      {shape === \"dots\" &&\n        Array.from({ length: 25 }, (_, i) => (\n          <circle key={i} cx={10 + (i % 5) * 20} cy={10 + Math.floor(i / 5) * 20} r=\"4\" />\n        ))}\n      {shape === \"bars\" &&\n        [92, 70, 50, 30].map((w, i) => <rect key={i} x={100 - w} y={8 + i * 24} width={w} height=\"12\" />)}\n    </svg>\n  );\n}\n\nexport function BlogMagazine({\n  eyebrow = DEFAULTS.eyebrow,\n  title = DEFAULTS.title,\n  note = DEFAULTS.note,\n  tiles = DEFAULT_TILES,\n  inks,\n  className,\n  style,\n  ...props\n}: BlogMagazineProps) {\n  const headingId = useId();\n  const palette = { ...DEFAULT_INKS, ...inks };\n\n  return (\n    <section\n      data-slot=\"blog-magazine\"\n      aria-labelledby={headingId}\n      className={cn(\"w-full bg-background text-foreground\", className)}\n      style={\n        {\n          \"--ink-blue\": palette.blue,\n          \"--ink-black\": palette.black,\n          \"--ink-navy\": palette.navy,\n          \"--ink-tint\": palette.tint,\n          ...style,\n        } as CSSProperties\n      }\n      {...props}\n    >\n      <div className=\"mx-auto max-w-6xl px-6 py-20 md:py-28\">\n        <div className=\"grid gap-6 md:grid-cols-12 md:items-end\">\n          <div className=\"md:col-span-8\">\n            <p className=\"font-mono text-xs uppercase tracking-wider text-muted-foreground\">\n              {eyebrow}\n            </p>\n            <h2\n              id={headingId}\n              className=\"mt-5 max-w-2xl text-4xl font-semibold leading-[1.02] tracking-[-0.03em] text-balance md:text-5xl\"\n            >\n              {title}\n            </h2>\n          </div>\n          <p className=\"max-w-xs font-mono text-xs leading-relaxed text-muted-foreground md:col-span-4 md:justify-self-end md:text-right\">\n            {note}\n          </p>\n        </div>\n\n        <ul className=\"mt-12 grid auto-rows-[15rem] grid-cols-2 gap-3 md:auto-rows-[17rem] md:grid-cols-4\">\n          {tiles.map((tile) => (\n            <li key={tile.issue} className={SIZE[tile.size ?? \"default\"]}>\n              {tile.kind === \"photo\" ? (\n                <a\n                  href={tile.href}\n                  className={cn(\"group relative block size-full overflow-hidden bg-muted\", focusRing)}\n                >\n                  {/* Plain <img> keeps the block portable outside Next.js. */}\n                  {/* eslint-disable-next-line @next/next/no-img-element */}\n                  <img\n                    src={tile.image.src}\n                    alt={tile.image.alt}\n                    width={tile.size === \"feature\" ? 1400 : 800}\n                    height={tile.size === \"feature\" ? 1400 : 800}\n                    loading=\"lazy\"\n                    className=\"absolute inset-0 size-full object-cover\"\n                  />\n                  <div\n                    className={cn(\n                      \"absolute bottom-0 left-0 bg-background text-foreground\",\n                      tile.size === \"feature\" ? \"max-w-md p-5 pr-8 md:p-7\" : \"max-w-[88%] p-3 pr-5\"\n                    )}\n                  >\n                    <p className=\"flex gap-3 font-mono text-[10px] uppercase tracking-wider text-muted-foreground md:text-[11px]\">\n                      <span className=\"tabular-nums\">No. {pad(tile.issue)}</span>\n                      <span>{tile.label}</span>\n                    </p>\n                    <h3\n                      className={cn(\n                        \"mt-2 font-semibold tracking-[-0.025em] text-balance decoration-1 underline-offset-4 group-hover:underline\",\n                        tile.size === \"feature\"\n                          ? \"text-3xl leading-[1.02] md:text-5xl\"\n                          : \"text-base leading-snug md:text-lg\"\n                      )}\n                    >\n                      {tile.title}\n                    </h3>\n                    {tile.dek && tile.size === \"feature\" && (\n                      <p className=\"mt-3 hidden text-sm leading-relaxed text-muted-foreground sm:block\">\n                        {tile.dek}\n                      </p>\n                    )}\n                  </div>\n                </a>\n              ) : (\n                <a\n                  href={tile.href}\n                  className={cn(\n                    \"group relative flex size-full flex-col justify-between overflow-hidden p-4 md:p-5\",\n                    focusRing\n                  )}\n                  style={{ backgroundColor: `var(--ink-${tile.ink})`, color: INK_TEXT[tile.ink] }}\n                >\n                  {tile.shape && <Shape shape={tile.shape} />}\n                  {tile.numeral && (\n                    <span\n                      aria-hidden\n                      className=\"absolute -top-4 right-3 text-[9rem] font-semibold leading-none tracking-[-0.06em] tabular-nums md:-top-6 md:text-[13rem]\"\n                    >\n                      {tile.numeral}\n                    </span>\n                  )}\n                  <p className=\"relative font-mono text-[10px] uppercase tracking-wider md:text-[11px]\">\n                    <span className=\"tabular-nums\">No. {pad(tile.issue)}</span>\n                  </p>\n                  <div className=\"relative\">\n                    <h3 className=\"max-w-[14ch] text-2xl font-semibold leading-[1.02] tracking-[-0.03em] text-balance decoration-2 underline-offset-4 group-hover:underline md:text-3xl\">\n                      {tile.title}\n                    </h3>\n                    <p className=\"mt-3 border-t border-current pt-2 font-mono text-[10px] uppercase tracking-wider md:text-[11px]\">\n                      {tile.label}\n                    </p>\n                  </div>\n                </a>\n              )}\n            </li>\n          ))}\n        </ul>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}
