{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "content-section",
  "title": "Content Section",
  "description": "A long-form content section: a sticky side column with the title, read time, a scroll-linked progress bar and chapter links that follow your reading, next to chapters built from paragraphs, numbered lists, images with captions, pull quotes and stat rows that reveal as you scroll.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/content-section/content-section.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useMotionValue, useReducedMotion, useSpring } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type ContentBlock =\n  | { type: \"paragraph\"; text: string }\n  | { type: \"image\"; src: string; alt: string; caption?: string }\n  | { type: \"quote\"; text: string; author?: string; role?: string }\n  | { type: \"list\"; items: string[] }\n  | { type: \"stats\"; items: { value: string; label: string }[] };\n\nexport interface ContentChapter {\n  id: string;\n  title: string;\n  blocks: ContentBlock[];\n}\n\nexport interface ContentSectionProps {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  chapters?: ContentChapter[];\n  /** Sticky side column with a reading progress bar and links to each chapter. */\n  toc?: boolean;\n  /** A primary action under the side column, e.g. a sign-up link. Pass null to hide it. */\n  action?: { label: string; href: string } | null;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", body: \"rgba(245,244,241,0.72)\", muted: \"rgba(245,244,241,0.55)\", faint: \"rgba(245,244,241,0.36)\", border: \"rgba(255,255,255,0.1)\", card: \"#111111\", track: \"rgba(255,255,255,0.1)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", ok: \"#4ADE80\", ring: \"rgba(245,244,241,0.6)\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", body: \"rgba(10,10,10,0.75)\", muted: \"rgba(10,10,10,0.55)\", faint: \"rgba(10,10,10,0.38)\", border: \"rgba(10,10,10,0.1)\", card: \"#FFFFFF\", track: \"rgba(10,10,10,0.1)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", ok: \"#16A34A\", ring: \"rgba(10,10,10,0.5)\" },\n};\n\nconst DEFAULT_CHAPTERS: ContentChapter[] = [\n  {\n    id: \"problem\",\n    title: \"The problem with status meetings\",\n    blocks: [\n      { type: \"paragraph\", text: \"Every Monday, forty people spent an hour telling each other what was already written somewhere. Nobody disagreed that the meeting was too long. Everybody disagreed about what to cut.\" },\n      { type: \"paragraph\", text: \"We measured it for a month. The average person spoke for ninety seconds and listened for fifty-eight minutes. Most of what they heard did not affect their week.\" },\n      { type: \"stats\", items: [{ value: \"58 min\", label: \"spent listening, per person\" }, { value: \"40\", label: \"people in the room\" }, { value: \"6%\", label: \"of updates needed a decision\" }] },\n    ],\n  },\n  {\n    id: \"change\",\n    title: \"What we changed\",\n    blocks: [\n      { type: \"paragraph\", text: \"We replaced the meeting with a written update that takes two minutes to fill in and two minutes to read. Three questions, always the same, posted by Monday at ten.\" },\n      { type: \"list\", items: [\"What shipped last week, with links\", \"What ships this week, and who owns it\", \"What is blocked, and what you need from whom\"] },\n      { type: \"image\", src: \"/demo/6.webp\", alt: \"A calm studio with a long table and a staircase.\", caption: \"Monday mornings got a lot quieter.\" },\n    ],\n  },\n  {\n    id: \"results\",\n    title: \"What happened next\",\n    blocks: [\n      { type: \"paragraph\", text: \"The first two weeks were awkward. Updates were too long, then too short. By week four they had settled at about five lines, and the blocked section had become the most-read part.\" },\n      { type: \"quote\", text: \"I used to dread Mondays. Now I read the updates with my coffee and I know exactly where to help.\", author: \"Leyla Aksoy\", role: \"Head of Product\" },\n      { type: \"paragraph\", text: \"We kept one meeting: thirty minutes on Thursday, only for the items marked blocked. Most weeks it ends in fifteen.\" },\n    ],\n  },\n];\n\nfunction Block({ b, p, reduce }: { b: ContentBlock; p: (typeof PALETTES)[\"dark\"]; reduce: boolean }) {\n  const rise = reduce ? {} : { initial: { opacity: 0, y: 16 }, whileInView: { opacity: 1, y: 0 }, viewport: { once: true, amount: 0.4 }, transition: { duration: 0.5, ease: [0.2, 0.7, 0.2, 1] as const } };\n  if (b.type === \"paragraph\")\n    return (\n      <motion.p {...rise} className=\"m-0 text-[17px] leading-[1.75]\" style={{ color: p.body }}>\n        {b.text}\n      </motion.p>\n    );\n  if (b.type === \"list\")\n    return (\n      <ul className=\"m-0 flex list-none flex-col gap-3 p-0\">\n        {b.items.map((it, i) => (\n          <motion.li key={it} initial={reduce ? false : { opacity: 0, x: -10 }} whileInView={{ opacity: 1, x: 0 }} viewport={{ once: true }} transition={{ delay: reduce ? 0 : i * 0.08 }} className=\"flex gap-3 text-[16.5px] leading-[1.6]\" style={{ color: p.text }}>\n            <span className=\"mt-[3px] flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold tabular-nums\" style={{ background: p.on, color: p.onText }} aria-hidden=\"true\">\n              {i + 1}\n            </span>\n            {it}\n          </motion.li>\n        ))}\n      </ul>\n    );\n  if (b.type === \"image\")\n    return (\n      <motion.figure {...rise} className=\"m-0\">\n        <div className=\"overflow-hidden rounded-2xl\" style={{ background: p.card }}>\n          {/* eslint-disable-next-line @next/next/no-img-element */}\n          <img src={b.src} alt={b.alt} loading=\"lazy\" className=\"block aspect-[16/9] w-full object-cover\" />\n        </div>\n        {b.caption && (\n          <figcaption className=\"mt-3 text-[13.5px]\" style={{ color: p.faint }}>\n            {b.caption}\n          </figcaption>\n        )}\n      </motion.figure>\n    );\n  if (b.type === \"quote\")\n    return (\n      <motion.figure {...rise} className=\"m-0 border-l-2 py-1 pl-6\" style={{ borderColor: p.on }}>\n        <blockquote className=\"m-0\">\n          <p className=\"m-0 text-[22px] leading-[1.45] font-medium tracking-[-0.01em]\" style={{ color: p.text }}>\n            “{b.text}”\n          </p>\n        </blockquote>\n        {b.author && (\n          <figcaption className=\"mt-3 text-[14px]\" style={{ color: p.muted }}>\n            {b.author}\n            {b.role ? `, ${b.role}` : \"\"}\n          </figcaption>\n        )}\n      </motion.figure>\n    );\n  return (\n    <div className=\"grid grid-cols-1 gap-px overflow-hidden rounded-2xl border @[520px]:grid-cols-3\" style={{ borderColor: p.border, background: p.border }}>\n      {b.items.map((s, i) => (\n        <motion.div key={s.label} initial={reduce ? false : { opacity: 0 }} whileInView={{ opacity: 1 }} viewport={{ once: true }} transition={{ delay: reduce ? 0 : i * 0.1 }} className=\"p-5\" style={{ background: p.card }}>\n          <p className=\"m-0 text-[30px] leading-none font-semibold tracking-[-0.03em] tabular-nums\" style={{ color: p.text }}>\n            {s.value}\n          </p>\n          <p className=\"m-0 mt-2 text-[13px]\" style={{ color: p.muted }}>\n            {s.label}\n          </p>\n        </motion.div>\n      ))}\n    </div>\n  );\n}\n\nexport function ContentSection({\n  eyebrow = \"Case study\",\n  title = \"How one team replaced its Monday meeting\",\n  description = \"A short story about writing things down, told in three parts.\",\n  chapters = DEFAULT_CHAPTERS,\n  toc = true,\n  action = { label: \"Get the update template\", href: \"#\" },\n  theme = \"dark\",\n  className,\n}: ContentSectionProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const bodyRef = React.useRef<HTMLDivElement>(null);\n  const raw = useMotionValue(0);\n  const progress = useSpring(raw, { stiffness: 140, damping: 30 });\n  const [active, setActive] = React.useState(chapters[0]?.id ?? \"\");\n  const lock = React.useRef(0);\n\n  React.useEffect(() => {\n    // Measured from positions, and listening to every scroll in the page (capture phase), so it\n    // works inside any scrolling container, not only the window.\n    const onScroll = () => {\n      const body = bodyRef.current?.getBoundingClientRect();\n      if (body) raw.set(Math.min(1, Math.max(0, (window.innerHeight * 0.3 - body.top) / Math.max(1, body.height - window.innerHeight * 0.4))));\n      if (Date.now() < lock.current) return;\n      const line = window.innerHeight * 0.35;\n      let cur = chapters[0]?.id ?? \"\";\n      for (const c of chapters) {\n        const el = document.getElementById(c.id);\n        if (el && el.getBoundingClientRect().top < line) cur = c.id;\n      }\n      setActive(cur);\n    };\n    onScroll();\n    document.addEventListener(\"scroll\", onScroll, { passive: true, capture: true });\n    window.addEventListener(\"resize\", onScroll);\n    return () => {\n      document.removeEventListener(\"scroll\", onScroll, { capture: true });\n      window.removeEventListener(\"resize\", onScroll);\n    };\n  }, [chapters, raw]);\n\n  const words = chapters.reduce((t, c) => t + c.blocks.reduce((n, b) => n + (b.type === \"paragraph\" || b.type === \"quote\" ? b.text.split(/\\s+/).length : b.type === \"list\" ? b.items.join(\" \").split(/\\s+/).length : 0), 0), 0);\n  const minutes = Math.max(1, Math.round(words / 220));\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.bg } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className={cn(\"mx-auto grid max-w-6xl grid-cols-1 gap-10 px-6 py-20 @[640px]:py-24\", toc && \"@[900px]:grid-cols-[300px_1fr] @[900px]:gap-16\")}>\n        <aside className={cn(toc && \"@[900px]:sticky @[900px]:top-8 @[900px]:self-start\")}>\n          {eyebrow && <p className=\"m-0 text-[13px] font-medium tracking-[0.12em] uppercase\" style={{ color: p.faint }}>{eyebrow}</p>}\n          <h2 className=\"mt-3 mb-0 text-[30px] leading-[1.12] font-semibold tracking-[-0.03em] @[640px]:text-[38px]\">{title}</h2>\n          {description && <p className=\"mt-4 mb-0 text-[15.5px] leading-[1.6]\" style={{ color: p.muted }}>{description}</p>}\n          <p className=\"m-0 mt-4 text-[13px] tabular-nums\" style={{ color: p.faint }}>\n            {minutes} min read · {chapters.length} parts\n          </p>\n          {toc && chapters.length > 1 && (\n            <nav aria-label=\"Contents\" className=\"mt-8 hidden @[900px]:block\">\n              <div className=\"h-1 overflow-hidden rounded-full\" style={{ background: p.track }} aria-hidden=\"true\">\n                <motion.div className=\"h-full origin-left rounded-full\" style={{ background: p.on, scaleX: reduce ? raw : progress }} />\n              </div>\n              <ol className=\"m-0 mt-5 flex list-none flex-col gap-1 p-0\">\n                {chapters.map((c, i) => {\n                  const on = active === c.id;\n                  return (\n                    <li key={c.id}>\n                      <a\n                        href={`#${c.id}`}\n                        aria-current={on ? \"location\" : undefined}\n                        onClick={(e) => {\n                          e.preventDefault();\n                          setActive(c.id);\n                          lock.current = Date.now() + 900;\n                          document.getElementById(c.id)?.scrollIntoView({ behavior: reduce ? \"auto\" : \"smooth\", block: \"start\" });\n                        }}\n                        className={cn(\"flex items-baseline gap-3 rounded-md py-1.5 text-[14px] no-underline transition-colors\", focus)}\n                        style={{ color: on ? p.text : p.faint, ...ring }}\n                      >\n                        <span className=\"w-5 shrink-0 text-[12px] tabular-nums\">{String(i + 1).padStart(2, \"0\")}</span>\n                        <span>{c.title}</span>\n                      </a>\n                    </li>\n                  );\n                })}\n              </ol>\n            </nav>\n          )}\n          {action && (\n            <a href={action.href} className={cn(\"mt-8 inline-flex h-11 items-center gap-2 rounded-full px-5 text-[14.5px] font-medium no-underline transition-opacity hover:opacity-90\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n              {action.label}\n              <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M3 8h10M9 4l4 4-4 4\" />\n              </svg>\n            </a>\n          )}\n        </aside>\n\n        <div ref={bodyRef} className=\"flex min-w-0 flex-col gap-14\">\n          {chapters.map((c, i) => (\n            <article key={c.id} id={c.id} aria-labelledby={`${c.id}-t`} className=\"scroll-mt-8\">\n              <p className=\"m-0 text-[12.5px] font-medium tracking-[0.1em] uppercase tabular-nums\" style={{ color: p.faint }}>\n                Part {i + 1}\n              </p>\n              <h3 id={`${c.id}-t`} className=\"mt-2 mb-6 text-[24px] leading-[1.25] font-semibold tracking-[-0.02em] @[640px]:text-[28px]\">\n                {c.title}\n              </h3>\n              <div className=\"flex flex-col gap-6\">\n                {c.blocks.map((b, j) => (\n                  <Block key={j} b={b} p={p} reduce={reduce} />\n                ))}\n              </div>\n            </article>\n          ))}\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default ContentSection;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}