{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "article-cards",
  "type": "registry:block",
  "title": "Article Cards",
  "description": "A blog grid led by one large featured post, each card with drawn cover art, tags, reading time and author, lifting gently on hover while its cover drifts closer.",
  "categories": [
    "block",
    "Content"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/devl/article-cards.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { ArrowRightIcon, ArrowUpRightIcon } from \"lucide-react\";\nimport { motion, MotionConfig } from \"motion/react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type ArticleCover = \"rings\" | \"dots\" | \"waves\" | \"pages\" | \"orbit\" | \"glyph\";\nexport type ArticleTone = \"violet\" | \"sky\" | \"emerald\" | \"amber\" | \"rose\" | \"indigo\";\n\nexport interface Article {\n  title: string;\n  excerpt?: string;\n  href: string;\n  tags: string[];\n  minutes: number;\n  date: string;\n  author: { name: string };\n  cover?: ArticleCover;\n  tone?: ArticleTone;\n}\n\nexport interface ArticleCardsProps {\n  eyebrow?: string;\n  title?: ReactNode;\n  articles: Article[];\n  allHref?: string;\n  className?: string;\n}\n\nconst ease = [0.23, 1, 0.32, 1] as const;\n\nconst tones: Record<ArticleTone, { bg: string; ink: string; chip: string; avatar: string }> = {\n  violet: {\n    bg: \"from-violet-100 to-violet-50/40 dark:from-violet-500/20 dark:to-violet-500/5\",\n    ink: \"text-violet-500/45 dark:text-violet-300/30\",\n    chip: \"bg-violet-500/10 text-violet-700 dark:text-violet-300\",\n    avatar: \"bg-violet-100 text-violet-700 dark:bg-violet-950 dark:text-violet-300\",\n  },\n  sky: {\n    bg: \"from-sky-100 to-sky-50/40 dark:from-sky-500/20 dark:to-sky-500/5\",\n    ink: \"text-sky-500/45 dark:text-sky-300/30\",\n    chip: \"bg-sky-500/10 text-sky-700 dark:text-sky-300\",\n    avatar: \"bg-sky-100 text-sky-700 dark:bg-sky-950 dark:text-sky-300\",\n  },\n  emerald: {\n    bg: \"from-emerald-100 to-emerald-50/40 dark:from-emerald-500/20 dark:to-emerald-500/5\",\n    ink: \"text-emerald-500/45 dark:text-emerald-300/30\",\n    chip: \"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300\",\n    avatar: \"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300\",\n  },\n  amber: {\n    bg: \"from-amber-100 to-amber-50/40 dark:from-amber-500/20 dark:to-amber-500/5\",\n    ink: \"text-amber-500/55 dark:text-amber-300/30\",\n    chip: \"bg-amber-500/12 text-amber-800 dark:text-amber-300\",\n    avatar: \"bg-amber-100 text-amber-800 dark:bg-amber-950 dark:text-amber-300\",\n  },\n  rose: {\n    bg: \"from-rose-100 to-rose-50/40 dark:from-rose-500/20 dark:to-rose-500/5\",\n    ink: \"text-rose-500/45 dark:text-rose-300/30\",\n    chip: \"bg-rose-500/10 text-rose-700 dark:text-rose-300\",\n    avatar: \"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300\",\n  },\n  indigo: {\n    bg: \"from-indigo-100 to-indigo-50/40 dark:from-indigo-500/20 dark:to-indigo-500/5\",\n    ink: \"text-indigo-500/45 dark:text-indigo-300/30\",\n    chip: \"bg-indigo-500/10 text-indigo-700 dark:text-indigo-300\",\n    avatar: \"bg-indigo-100 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300\",\n  },\n};\nconst toneOrder = Object.keys(tones) as ArticleTone[];\nconst coverOrder: ArticleCover[] = [\"rings\", \"pages\", \"waves\", \"dots\", \"orbit\", \"glyph\"];\n\nfunction CoverArt({ cover, title }: { cover: ArticleCover; title: string }) {\n  const stroke = { stroke: \"currentColor\", strokeWidth: 1.5, fill: \"none\", vectorEffect: \"non-scaling-stroke\" } as const;\n  switch (cover) {\n    case \"rings\":\n      return (\n        <svg className=\"absolute inset-0 size-full\" preserveAspectRatio=\"xMidYMid slice\" viewBox=\"0 0 400 225\">\n          {[20, 45, 70, 95, 120, 145].map((r) => (\n            <circle cx=\"290\" cy=\"150\" key={r} r={r} {...stroke} />\n          ))}\n          <circle cx=\"290\" cy=\"150\" fill=\"currentColor\" r=\"8\" />\n        </svg>\n      );\n    case \"pages\":\n      return (\n        <svg className=\"absolute inset-0 size-full\" preserveAspectRatio=\"xMidYMid slice\" viewBox=\"0 0 400 225\">\n          {[0, 1, 2].map((i) => (\n            <rect height=\"150\" key={i} rx=\"10\" {...stroke} fill=\"var(--color-card)\" width=\"110\" x={135 + i * 22} y={58 - i * 14} />\n          ))}\n          {[0, 1, 2, 3].map((i) => (\n            <line key={i} {...stroke} x1=\"198\" x2={268 - i * 10} y1={72 + i * 14} y2={72 + i * 14} />\n          ))}\n        </svg>\n      );\n    case \"waves\":\n      return (\n        <svg className=\"absolute inset-0 size-full\" preserveAspectRatio=\"xMidYMid slice\" viewBox=\"0 0 400 225\">\n          {[0, 1, 2, 3, 4, 5, 6].map((i) => (\n            <path d={`M-10 ${70 + i * 18} C 80 ${30 + i * 18}, 140 ${120 + i * 18}, 220 ${80 + i * 18} S 360 ${40 + i * 18}, 420 ${90 + i * 18}`} key={i} {...stroke} />\n          ))}\n        </svg>\n      );\n    case \"dots\":\n      return (\n        <svg className=\"absolute inset-0 size-full\" preserveAspectRatio=\"xMidYMid slice\" viewBox=\"0 0 400 225\">\n          {Array.from({ length: 9 }, (_, r) =>\n            Array.from({ length: 16 }, (_, c) => (\n              <circle cx={20 + c * 24} cy={16 + r * 24} fill=\"currentColor\" key={`${r}-${c}`} r={r === 4 && c >= 6 && c <= 10 ? 5 : 1.6} />\n            )),\n          )}\n        </svg>\n      );\n    case \"orbit\":\n      return (\n        <svg className=\"absolute inset-0 size-full\" preserveAspectRatio=\"xMidYMid slice\" viewBox=\"0 0 400 225\">\n          <ellipse cx=\"200\" cy=\"112\" rx=\"150\" ry=\"52\" {...stroke} transform=\"rotate(-12 200 112)\" />\n          <ellipse cx=\"200\" cy=\"112\" rx=\"96\" ry=\"34\" {...stroke} transform=\"rotate(-12 200 112)\" />\n          <circle cx=\"200\" cy=\"112\" fill=\"currentColor\" r=\"16\" />\n          <circle cx=\"338\" cy=\"84\" fill=\"currentColor\" r=\"6\" />\n        </svg>\n      );\n    default:\n      return (\n        <span\n          aria-hidden\n          className=\"absolute right-3 -bottom-7 select-none font-heading font-semibold text-[7.5rem] leading-none tracking-tighter\"\n        >\n          {title.trim()[0]?.toUpperCase()}\n          {title.trim()[0]?.toLowerCase()}\n        </span>\n      );\n  }\n}\n\nfunction initials(name: string) {\n  return name\n    .split(/\\s+/)\n    .map((p) => p[0])\n    .slice(0, 2)\n    .join(\"\")\n    .toUpperCase();\n}\n\nfunction Card({ article, index, size }: { article: Article; index: number; size: \"feature\" | \"side\" | \"grid\" }) {\n  const tone = tones[article.tone ?? toneOrder[index % toneOrder.length]];\n  const cover = article.cover ?? coverOrder[index % coverOrder.length];\n  const feature = size === \"feature\";\n\n  return (\n    <motion.a\n      className={cn(\n        \"group/card relative flex h-full flex-col overflow-hidden rounded-2xl border bg-card shadow-xs/5 outline-none\",\n        \"transition-[translate,scale,box-shadow,border-color] duration-200 ease-out hover:-translate-y-1 hover:border-foreground/12 hover:shadow-lg/5 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background active:translate-y-0 active:scale-[0.98] motion-reduce:hover:translate-y-0\",\n      )}\n      href={article.href}\n      initial={{ opacity: 0, y: 14 }}\n      transition={{ duration: 0.5, ease, delay: Math.min(index, 5) * 0.05 }}\n      viewport={{ once: true, amount: 0.25 }}\n      whileInView={{ opacity: 1, y: 0 }}\n    >\n      <div\n        className={cn(\n          \"relative m-1.5 mb-0 overflow-hidden rounded-[calc(var(--radius-2xl)-6px)] bg-linear-to-br\",\n          tone.bg,\n          feature ? \"aspect-[16/9] lg:aspect-auto lg:min-h-0 lg:flex-1\" : size === \"side\" ? \"aspect-[2/1]\" : \"aspect-[16/9]\",\n        )}\n      >\n        <div\n          className={cn(\n            \"absolute inset-0 transition-transform duration-500 ease-[cubic-bezier(0.23,1,0.32,1)] group-hover/card:scale-[1.04] motion-reduce:transition-none\",\n            tone.ink,\n          )}\n        >\n          <CoverArt cover={cover} title={article.title} />\n        </div>\n        <span className=\"absolute top-3 right-3 flex size-8 translate-y-1 items-center justify-center rounded-full bg-background/90 text-foreground opacity-0 shadow-xs/5 backdrop-blur-sm transition-[opacity,translate] duration-200 ease-out group-hover/card:translate-y-0 group-hover/card:opacity-100 group-focus-visible/card:translate-y-0 group-focus-visible/card:opacity-100\">\n          <ArrowUpRightIcon className=\"size-4\" />\n        </span>\n      </div>\n\n      <div className={cn(\"flex flex-col\", feature ? \"p-5 sm:p-6\" : \"p-4 sm:p-5\")}>\n        <div className=\"flex flex-wrap items-center gap-1.5\">\n          {article.tags.slice(0, 2).map((tag, i) => (\n            <span\n              className={cn(\n                \"rounded-full px-2 py-0.5 font-medium text-[0.6875rem]\",\n                i === 0 ? tone.chip : \"bg-muted text-muted-foreground\",\n              )}\n              key={tag}\n            >\n              {tag}\n            </span>\n          ))}\n          <span className=\"ms-auto text-muted-foreground text-xs tabular-nums\">{article.minutes} min read</span>\n        </div>\n        <h3\n          className={cn(\n            \"mt-3 text-balance font-heading font-semibold tracking-tight\",\n            feature ? \"text-xl leading-snug sm:text-2xl\" : \"text-base leading-snug\",\n          )}\n        >\n          {article.title}\n        </h3>\n        {article.excerpt && size !== \"side\" && (\n          <p\n            className={cn(\n              \"mt-2 text-pretty text-muted-foreground leading-relaxed\",\n              feature ? \"text-sm sm:text-[0.9375rem]\" : \"line-clamp-2 text-sm\",\n            )}\n          >\n            {article.excerpt}\n          </p>\n        )}\n        <div className={cn(\"flex items-center gap-2 text-muted-foreground text-xs\", size === \"side\" ? \"mt-3\" : \"mt-4\")}>\n          <span className={cn(\"flex size-6 items-center justify-center rounded-full font-semibold text-[0.5625rem]\", tone.avatar)}>\n            {initials(article.author.name)}\n          </span>\n          <span className=\"truncate text-foreground/80\">{article.author.name}</span>\n          <span aria-hidden className=\"size-0.5 shrink-0 rounded-full bg-foreground/30\" />\n          <time className=\"shrink-0 tabular-nums\">{article.date}</time>\n        </div>\n      </div>\n    </motion.a>\n  );\n}\n\nexport function ArticleCards({ eyebrow = \"Journal\", title = \"Latest writing\", articles, allHref, className }: ArticleCardsProps) {\n  const [featured, ...rest] = articles;\n  const side = rest.slice(0, 2);\n  const grid = rest.slice(2);\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <section className={cn(\"mx-auto w-full max-w-[1100px]\", className)}>\n        <header className=\"flex items-end justify-between gap-6\">\n          <div className=\"max-w-xl\">\n            {eyebrow && <p className=\"font-medium text-muted-foreground text-xs uppercase tracking-widest\">{eyebrow}</p>}\n            <h2 className=\"mt-2 text-balance font-heading font-semibold text-3xl tracking-tight sm:text-4xl\">{title}</h2>\n          </div>\n          {allHref && (\n            <a\n              className=\"group/all hidden shrink-0 items-center gap-1 rounded-md font-medium text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring sm:flex\"\n              href={allHref}\n            >\n              All posts\n              <ArrowRightIcon className=\"size-4 transition-transform duration-200 ease-out group-hover/all:translate-x-0.5\" />\n            </a>\n          )}\n        </header>\n\n        <div className=\"mt-10 grid gap-4 lg:grid-cols-3 lg:gap-5\">\n          {featured && (\n            <div className=\"lg:col-span-2 lg:row-span-2\">\n              <Card article={featured} index={0} size=\"feature\" />\n            </div>\n          )}\n          {side.map((article, i) => (\n            <Card article={article} index={i + 1} key={article.href} size=\"side\" />\n          ))}\n        </div>\n        {grid.length > 0 && (\n          <div className=\"mt-4 grid gap-4 sm:grid-cols-2 lg:mt-5 lg:grid-cols-3 lg:gap-5\">\n            {grid.map((article, i) => (\n              <Card article={article} index={i + 3} key={article.href} size=\"grid\" />\n            ))}\n          </div>\n        )}\n        {allHref && (\n          <a className=\"mt-8 flex items-center justify-center gap-1 font-medium text-sm sm:hidden\" href={allHref}>\n            All posts <ArrowRightIcon className=\"size-4\" />\n          </a>\n        )}\n      </section>\n    </MotionConfig>\n  );\n}\n"
    }
  ]
}