{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stats-band",
  "type": "registry:block",
  "title": "Stats Band",
  "description": "A band of big figures that count up once when it scrolls into view, sitting on a hairline ruler that draws itself in, with labels and captions on a steady divider rhythm.",
  "categories": [
    "block",
    "Marketing"
  ],
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/devl/stats-band.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { animate, motion, MotionConfig, useInView, useReducedMotion } from \"motion/react\";\nimport { type CSSProperties, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nfunction useReducedMotionSafe() {\n  const prefers = useReducedMotion();\n  const [mounted, setMounted] = useState(false);\n  useEffect(() => setMounted(true), []);\n  return mounted && Boolean(prefers);\n}\n\nexport interface Stat {\n  value: number;\n  decimals?: number;\n  prefix?: string;\n  suffix?: string;\n  label: string;\n  caption?: string;\n}\n\nexport interface StatsBandProps {\n  eyebrow?: string;\n  title?: ReactNode;\n  description?: ReactNode;\n  stats: Stat[];\n  duration?: number;\n  className?: string;\n}\n\nconst ease = [0.23, 1, 0.32, 1] as const;\n\nfunction format(value: number, decimals = 0) {\n  return value.toLocaleString(\"en-US\", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });\n}\n\nfunction CountUp({ stat, start, delay, duration }: { stat: Stat; start: boolean; delay: number; duration: number }) {\n  const reduce = useReducedMotionSafe();\n  const ref = useRef<HTMLSpanElement>(null);\n  const final = format(stat.value, stat.decimals);\n\n  useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    if (reduce) {\n      el.textContent = final;\n      return;\n    }\n    if (!start) {\n      el.textContent = format(0, stat.decimals);\n      return;\n    }\n    // Write straight to the node so a running count never re-renders React.\n    const controls = animate(0, stat.value, {\n      duration,\n      delay,\n      ease: [0.16, 1, 0.3, 1],\n      onUpdate: (v) => {\n        el.textContent = format(v, stat.decimals);\n      },\n    });\n    return () => controls.stop();\n  }, [start, reduce, stat.value, stat.decimals, final, delay, duration]);\n\n  return (\n    <span className=\"relative inline-grid tabular-nums\">\n      <span aria-hidden className=\"invisible col-start-1 row-start-1\">\n        {final}\n      </span>\n      <span aria-hidden className=\"col-start-1 row-start-1\" ref={ref}>\n        {reduce ? final : format(0, stat.decimals)}\n      </span>\n    </span>\n  );\n}\n\nexport function StatsBand({ eyebrow, title, description, stats, duration = 1.8, className }: StatsBandProps) {\n  const ref = useRef<HTMLDivElement>(null);\n  const inView = useInView(ref, { once: true, amount: 0.5 });\n  const columns = stats.length;\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <section className={cn(\"mx-auto w-full max-w-[1100px]\", className)}>\n        {(eyebrow || title || description) && (\n          <header className=\"flex flex-col gap-4 md:flex-row md:items-end md:justify-between\">\n            <div className=\"max-w-xl\">\n              {eyebrow && <p className=\"font-medium text-muted-foreground text-xs uppercase tracking-widest\">{eyebrow}</p>}\n              {title && (\n                <h2 className=\"mt-2 text-balance font-heading font-semibold text-3xl tracking-tight sm:text-4xl\">{title}</h2>\n              )}\n            </div>\n            {description && (\n              <p className=\"max-w-sm text-pretty text-muted-foreground text-sm leading-relaxed md:text-end\">{description}</p>\n            )}\n          </header>\n        )}\n\n        <div className=\"mt-12 sm:mt-14\" ref={ref}>\n          <motion.div\n            animate={inView ? { clipPath: \"inset(0 0% 0 0)\" } : undefined}\n            aria-hidden\n            className=\"relative h-3 text-foreground/15\"\n            initial={{ clipPath: \"inset(0 100% 0 0)\" }}\n            transition={{ duration: 1.2, ease }}\n          >\n            <div className=\"absolute inset-x-0 bottom-0 h-px bg-border\" />\n            <div className=\"absolute inset-x-0 bottom-0 h-1.5 bg-[repeating-linear-gradient(to_right,currentColor_0_1px,transparent_1px_8px)] [mask-image:linear-gradient(to_right,transparent,black_6%,black_94%,transparent)]\" />\n            <div\n              className=\"absolute inset-0 hidden lg:grid\"\n              style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n            >\n              {stats.map((stat) => (\n                <span className=\"relative\" key={stat.label}>\n                  <span className=\"absolute bottom-0 left-0 h-3 w-px bg-foreground/40\" />\n                </span>\n              ))}\n            </div>\n          </motion.div>\n\n          <dl\n            className=\"grid grid-cols-2 lg:grid-cols-[repeat(var(--cols),minmax(0,1fr))]\"\n            style={{ \"--cols\": columns } as CSSProperties}\n          >\n            {stats.map((stat, i) => (\n              <motion.div\n                animate={inView ? { opacity: 1, y: 0 } : undefined}\n                className={cn(\n                  \"flex flex-col py-7 ps-4 pe-3 sm:py-9 sm:ps-6\",\n                  i % 2 === 1 && \"border-l\",\n                  i % 2 === 0 && i > 0 && \"lg:border-l\",\n                  i >= 2 && \"max-lg:border-t\",\n                  i === 0 && \"lg:ps-0\",\n                  i % 2 === 0 && \"max-lg:ps-0\",\n                )}\n                initial={{ opacity: 0, y: 8 }}\n                key={stat.label}\n                transition={{ duration: 0.6, ease, delay: 0.15 + i * 0.08 }}\n              >\n                <dt className=\"order-2 mt-3 font-medium text-sm\">{stat.label}</dt>\n                <dd className=\"order-1 flex items-baseline font-heading font-semibold text-[2.5rem] leading-none tracking-[-0.04em] sm:text-6xl lg:text-[4.25rem]\">\n                  <span className=\"sr-only\">\n                    {stat.prefix}\n                    {format(stat.value, stat.decimals)}\n                    {stat.suffix}\n                  </span>\n                  {stat.prefix && (\n                    <span aria-hidden className=\"me-0.5 text-[0.55em] text-muted-foreground tracking-tight\">\n                      {stat.prefix}\n                    </span>\n                  )}\n                  <CountUp delay={0.15 + i * 0.12} duration={duration} start={inView} stat={stat} />\n                  {stat.suffix && (\n                    <span\n                      aria-hidden\n                      className={cn(\n                        \"text-[0.55em] text-muted-foreground tracking-tight\",\n                        /^[a-z]/i.test(stat.suffix) ? \"ms-[0.08em]\" : \"-ms-[0.02em]\",\n                      )}\n                    >\n                      {stat.suffix}\n                    </span>\n                  )}\n                </dd>\n                {stat.caption && (\n                  <dd className=\"order-3 mt-1 text-pretty text-muted-foreground text-xs leading-relaxed\">{stat.caption}</dd>\n                )}\n              </motion.div>\n            ))}\n          </dl>\n          <div aria-hidden className=\"h-px bg-border\" />\n        </div>\n      </section>\n    </MotionConfig>\n  );\n}\n"
    }
  ]
}