{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "steps-scroll-ruler",
  "type": "registry:component",
  "title": "Steps Scroll Ruler",
  "description": "A vertical plan along a measuring ruler whose ticks light up as you scroll, next to a sticky meter where the percentage rolls like an odometer. Cards brighten as the playhead reaches them.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "how-it-works",
    "how it works",
    "timeline",
    "scroll",
    "progress",
    "onboarding",
    "sticky"
  ],
  "docs": "https://hyperblur.dev/effects/steps-scroll-ruler",
  "files": [
    {
      "path": "registry/hyperblur/steps-scroll-ruler.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/steps-scroll-ruler.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface RulerStep {\n  when: string;\n  title: string;\n  body: string;\n  owner: string;\n  deliverables: string[];\n}\n\nexport interface StepsScrollRulerProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  steps?: RulerStep[];\n  progress?: number;\n  autoPlay?: boolean;\n  duration?: number;\n  accent?: string;\n  onStepReach?: (index: number) => void;\n}\n\nconst defaultSteps: RulerStep[] = [\n  { when: \"Day 1\", title: \"Kickoff and access\", body: \"A 45 minute call to agree on scope, then SSO, roles and a sandbox workspace set up before you hang up.\", owner: \"Solutions lead\", deliverables: [\"SSO live\", \"Sandbox\"] },\n  { when: \"Week 1\", title: \"Import your history\", body: \"We move three years of tickets, contacts and attachments from your current tool, with a field map you sign off.\", owner: \"Migration engineer\", deliverables: [\"Field map\", \"Test import\"] },\n  { when: \"Week 2\", title: \"Rebuild the workflows\", body: \"Routing rules, SLAs and macros recreated and tested against last month's real tickets, not demo data.\", owner: \"Workflow specialist\", deliverables: [\"31 rules\", \"SLA report\"] },\n  { when: \"Week 3\", title: \"Train the team\", body: \"Two live sessions per shift plus a recorded walkthrough. Agents work a shadow queue for three days.\", owner: \"Enablement\", deliverables: [\"4 sessions\", \"Shadow queue\"] },\n  { when: \"Week 4\", title: \"Go live\", body: \"We switch the inbound address at the quietest hour you choose and stay on a shared channel for the first week.\", owner: \"Solutions lead\", deliverables: [\"Cutover\", \"Hypercare\"] },\n  { when: \"Day 60\", title: \"Review and tune\", body: \"A report on response times before and after, with the five changes we would make next, in priority order.\", owner: \"Account manager\", deliverables: [\"Impact report\"] },\n];\n\nconst css = `\n.hb-we6 {\n  --hb-we6-accent: #f5b83d;\n  --hb-we6-p: 0;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-we6 *, .hb-we6 *::before, .hb-we6 *::after { box-sizing: border-box; }\n.hb-we6-inner { display: grid; gap: clamp(28px, 5cqi, 64px); max-width: 1120px; margin: 0 auto; padding: clamp(56px, 8cqi, 104px) clamp(18px, 4cqi, 40px); }\n.hb-we6-aside { position: sticky; top: 0; z-index: 2; align-self: start; display: grid; gap: 18px; padding: 16px 0; background: linear-gradient(#0a0a0a 80%, transparent); }\n.hb-we6-eyebrow { margin: 0; color: #8f8f8f; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }\n.hb-we6-title { margin: 0; font-family: var(--font-grotesk, inherit); font-size: clamp(26px, 4cqi, 44px); font-weight: 600; line-height: 1.05; letter-spacing: -.035em; text-wrap: balance; }\n.hb-we6-sub { margin: 0; color: #a1a1a1; font-size: 15px; line-height: 1.6; max-width: 40ch; }\n.hb-we6-meter { display: flex; align-items: flex-end; gap: 16px; padding: 18px 20px; border-radius: 18px; background: linear-gradient(180deg, #141414, #0f0f0f); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), inset 0 1px 0 rgba(255,255,255,.05); }\n.hb-we6-num { display: flex; align-items: flex-start; font-family: var(--font-grotesk, inherit); font-size: clamp(48px, 7cqi, 76px); font-weight: 600; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }\n.hb-we6-digit { position: relative; display: block; width: .62em; transition: width .3s ease; height: 1em; overflow: hidden; }\n.hb-we6-strip { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; transform: translateY(calc(var(--hb-we6-d) * -1em)); }\n.hb-we6-strip span { display: block; height: 1em; text-align: center; }\n.hb-we6-digit:first-child { width: var(--hb-we6-w2, 0em); }\n.hb-we6-pct { margin-top: .12em; font-size: .4em; color: var(--hb-we6-accent); letter-spacing: 0; }\n.hb-we6-ml { display: grid; gap: 4px; padding-bottom: 8px; min-width: 0; }\n.hb-we6-ml span { color: #8f8f8f; font-size: 12px; }\n.hb-we6-ml b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-we6-mini { display: flex; gap: 4px; }\n.hb-we6-mini i { flex: 1; height: 4px; border-radius: 4px; background: #262626; font-style: normal; position: relative; overflow: hidden; }\n.hb-we6-mini i::after { content: \"\"; position: absolute; inset: 0; background: var(--hb-we6-accent); transform-origin: left; transform: scaleX(clamp(0, calc((var(--hb-we6-p) - var(--hb-we6-a)) / var(--hb-we6-s)), 1)); }\n.hb-we6-track { position: relative; min-width: 0; }\n.hb-we6-list { position: relative; margin: 0; padding: 8px 0 8px 64px; list-style: none; display: grid; gap: clamp(28px, 4cqi, 48px); }\n.hb-we6-rule { position: absolute; left: 14px; top: 0; bottom: 0; width: 28px; }\n.hb-we6-ticks, .hb-we6-ticks-on { position: absolute; inset: 0; background: repeating-linear-gradient(180deg, currentColor 0 1px, transparent 1px 12px), repeating-linear-gradient(180deg, currentColor 0 2px, transparent 2px 60px); background-size: 12px 100%, 26px 100%; background-repeat: no-repeat; background-position: 0 0, 0 0; }\n.hb-we6-ticks { color: #2e2e2e; }\n.hb-we6-ticks-on { color: var(--hb-we6-accent); clip-path: inset(0 0 calc((1 - var(--hb-we6-p)) * 100%) 0); }\n.hb-we6-spine { position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: #262626; }\n.hb-we6-spine::after { content: \"\"; position: absolute; inset: 0; background: var(--hb-we6-accent); transform-origin: top; transform: scaleY(var(--hb-we6-p)); box-shadow: 0 0 12px var(--hb-we6-accent); }\n.hb-we6-head { position: absolute; left: -7px; top: calc(var(--hb-we6-p) * 100%); width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: #0a0a0a; box-shadow: 0 0 0 2px var(--hb-we6-accent), 0 0 18px var(--hb-we6-accent); }\n.hb-we6-item {\n  --hb-we6-on: clamp(0, calc((var(--hb-we6-p) - var(--hb-we6-t)) * 14 + 1), 1);\n  position: relative; opacity: calc(.18 + var(--hb-we6-on) * .82); transform: translateY(calc((1 - var(--hb-we6-on)) * 18px));\n}\n.hb-we6-card { display: grid; gap: 10px; padding: clamp(16px, 2.4cqi, 22px); border-radius: 18px; background: linear-gradient(180deg, #131313, #0f0f0f); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), inset 0 1px 0 rgba(255,255,255,.04); }\n.hb-we6-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.hb-we6-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 11.5px; color: #0a0a0a; background: var(--hb-we6-accent); }\n.hb-we6-owner { display: inline-flex; align-items: center; gap: 8px; color: #8f8f8f; font-size: 12px; white-space: nowrap; }\n.hb-we6-owner i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 9px; font-weight: 700; color: #0a0a0a; background: hsl(var(--hb-we6-h) 60% 70%); }\n.hb-we6-ct { margin: 0; font-size: clamp(17px, 2cqi, 20px); font-weight: 600; letter-spacing: -.015em; }\n.hb-we6-cb { margin: 0; color: #a1a1a1; font-size: 14px; line-height: 1.6; }\n.hb-we6-del { display: flex; flex-wrap: wrap; gap: 6px; }\n.hb-we6-del span { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); color: #cfcfcf; font-size: 12px; }\n.hb-we6-del svg { width: 12px; height: 12px; color: var(--hb-we6-accent); }\n.hb-we6-node { position: absolute; left: -57px; top: 22px; width: 12px; height: 12px; border-radius: 4px; transform: rotate(45deg); background: #0a0a0a; box-shadow: 0 0 0 2px color-mix(in srgb, var(--hb-we6-accent) calc(var(--hb-we6-on) * 100%), #333); }\n@container (min-width: 860px) {\n  .hb-we6-inner { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); align-items: start; }\n  .hb-we6-aside { top: 24px; padding: 0; background: none; }\n}\n@container (max-width: 859px) {\n  .hb-we6-sub { display: none; }\n  .hb-we6-num { font-size: 44px; }\n  .hb-we6-meter { padding: 12px 16px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-we6 { --hb-we6-p: 1 !important; }\n  .hb-we6 *, .hb-we6 *::before, .hb-we6 *::after { transition: none !important; animation: none !important; }\n}\n`;\n\nfunction clamp01(x: number) {\n  return Math.min(1, Math.max(0, x));\n}\n\nfunction ease(x: number) {\n  return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2;\n}\n\nfunction findScroller(el: HTMLElement | null): HTMLElement | null {\n  let n = el?.parentElement ?? null;\n  while (n && n !== document.body) {\n    const s = getComputedStyle(n);\n    if (/(auto|scroll)/.test(s.overflowY) && n.scrollHeight > n.clientHeight + 1) return n;\n    n = n.parentElement;\n  }\n  return null;\n}\n\nconst digits = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\"];\n\nexport function StepsScrollRuler({\n  eyebrow = \"Onboarding plan\",\n  title = \"Sixty days from signed to settled\",\n  subtitle = \"Every customer gets the same measured plan, with a named owner for each stage. Scroll to follow it.\",\n  steps = defaultSteps,\n  progress,\n  autoPlay = false,\n  duration = 9,\n  accent = \"#f5b83d\",\n  onStepReach,\n  className,\n  style,\n  ...rest\n}: StepsScrollRulerProps) {\n  const rootRef = React.useRef<HTMLElement | null>(null);\n  const listRef = React.useRef<HTMLOListElement | null>(null);\n  const [reached, setReached] = React.useState(0);\n  const reachRef = React.useRef(onStepReach);\n  const lastRef = React.useRef(0);\n  React.useLayoutEffect(() => {\n    reachRef.current = onStepReach;\n  });\n  const n = steps.length;\n\n  const apply = React.useCallback(\n    (raw: number) => {\n      const root = rootRef.current;\n      if (!root) return;\n      const p = clamp01(raw);\n      root.style.setProperty(\"--hb-we6-p\", p.toFixed(4));\n      const v = Math.round(p * 1000) / 10;\n      const hundreds = Math.floor(v / 100);\n      const tens = Math.floor((v % 100) / 10);\n      const ones = v % 10;\n      const roll = (base: number, frac: number) => base + (frac > 9 ? frac - 9 : 0);\n      root.style.setProperty(\"--hb-we6-d2\", String(hundreds));\n      root.style.setProperty(\"--hb-we6-d1\", roll(tens, ones).toFixed(3));\n      root.style.setProperty(\"--hb-we6-d0\", ones.toFixed(3));\n      root.style.setProperty(\"--hb-we6-w2\", hundreds ? \".62em\" : \"0em\");\n      const idx = Math.min(n - 1, Math.max(0, Math.floor(p * n)));\n      if (lastRef.current !== idx) {\n        lastRef.current = idx;\n        setReached(idx);\n        reachRef.current?.(idx);\n      }\n    },\n    [n],\n  );\n\n  React.useEffect(() => {\n    const el = listRef.current;\n    if (!el) return;\n    if (typeof progress === \"number\") {\n      apply(progress);\n      return;\n    }\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      apply(1);\n      return;\n    }\n    let raf = 0;\n    if (autoPlay) {\n      let last = 0;\n      let t = 0;\n      let visible = true;\n      const io = new IntersectionObserver((e) => {\n        visible = e[0]?.isIntersecting ?? true;\n      });\n      io.observe(el);\n      const d = Math.max(1, duration) * 1000;\n      const loop = (now: number) => {\n        const dt = last ? Math.min(64, now - last) : 0;\n        last = now;\n        if (visible) {\n          t = (t + dt) % (d + 1800);\n          apply(t < d ? ease(t / d) : 1);\n        }\n        raf = requestAnimationFrame(loop);\n      };\n      raf = requestAnimationFrame(loop);\n      return () => {\n        cancelAnimationFrame(raf);\n        io.disconnect();\n      };\n    }\n    const sc = findScroller(el);\n    const measure = () => {\n      raf = 0;\n      const r = el.getBoundingClientRect();\n      const top = sc ? r.top - sc.getBoundingClientRect().top : r.top;\n      const vh = sc ? sc.clientHeight : window.innerHeight;\n      apply((vh * 0.6 - top) / Math.max(1, r.height));\n    };\n    const on = () => {\n      if (!raf) raf = requestAnimationFrame(measure);\n    };\n    measure();\n    const target: HTMLElement | Window = sc ?? window;\n    target.addEventListener(\"scroll\", on, { passive: true });\n    window.addEventListener(\"resize\", on);\n    return () => {\n      cancelAnimationFrame(raf);\n      target.removeEventListener(\"scroll\", on);\n      window.removeEventListener(\"resize\", on);\n    };\n  }, [apply, progress, autoPlay, duration]);\n\n  const strip = (name: string, list: string[]) => (\n    <span className=\"hb-we6-digit\">\n      <span className=\"hb-we6-strip\" style={{ \"--hb-we6-d\": `var(${name}, 0)` } as React.CSSProperties}>\n        {list.map((d, i) => (\n          <span key={i}>{d}</span>\n        ))}\n      </span>\n    </span>\n  );\n\n  const pct = Math.round(((reached + 1) / n) * 100);\n\n  return (\n    <section\n      ref={rootRef}\n      className={[\"hb-we6\", className].filter(Boolean).join(\" \")}\n      style={{ \"--hb-we6-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-steps-scroll-ruler\" precedence=\"default\">{css}</style>\n      <div className=\"hb-we6-inner\">\n        <div className=\"hb-we6-aside\">\n          {eyebrow ? <p className=\"hb-we6-eyebrow\">{eyebrow}</p> : null}\n          <h2 className=\"hb-we6-title\">{title}</h2>\n          {subtitle ? <p className=\"hb-we6-sub\">{subtitle}</p> : null}\n          <div className=\"hb-we6-meter\" role=\"progressbar\" aria-valuemin={0} aria-valuemax={100} aria-valuenow={pct} aria-label=\"Plan progress\">\n            <span className=\"hb-we6-num\" aria-hidden=\"true\">\n              {strip(\"--hb-we6-d2\", [\"0\", \"1\"])}\n              {strip(\"--hb-we6-d1\", digits)}\n              {strip(\"--hb-we6-d0\", digits)}\n              <span className=\"hb-we6-pct\">%</span>\n            </span>\n            <span className=\"hb-we6-ml\">\n              <span>{steps[reached]?.when} · step {reached + 1} of {n}</span>\n              <b>{steps[reached]?.title}</b>\n            </span>\n          </div>\n          <div className=\"hb-we6-mini\" aria-hidden=\"true\">\n            {steps.map((s, i) => (\n              <i key={s.title} style={{ \"--hb-we6-a\": (i / n).toFixed(4), \"--hb-we6-s\": (1 / n).toFixed(4) } as React.CSSProperties} />\n            ))}\n          </div>\n        </div>\n        <div className=\"hb-we6-track\">\n        <span className=\"hb-we6-rule\" aria-hidden=\"true\">\n          <span className=\"hb-we6-ticks\" />\n          <span className=\"hb-we6-ticks-on\" />\n          <span className=\"hb-we6-spine\" />\n          <span className=\"hb-we6-head\" />\n        </span>\n        <ol ref={listRef} className=\"hb-we6-list\">\n          {steps.map((s, i) => (\n            <li key={s.title} className=\"hb-we6-item\" style={{ \"--hb-we6-t\": ((i + 0.15) / n).toFixed(4), \"--hb-we6-h\": (i * 57) % 360 } as React.CSSProperties}>\n              <span className=\"hb-we6-node\" aria-hidden=\"true\" />\n              <div className=\"hb-we6-card\">\n                <div className=\"hb-we6-top\">\n                  <span className=\"hb-we6-badge\">{s.when}</span>\n                  <span className=\"hb-we6-owner\">\n                    <i aria-hidden=\"true\">{s.owner.split(\" \").map((w) => w[0]).join(\"\").slice(0, 2)}</i>\n                    {s.owner}\n                  </span>\n                </div>\n                <h3 className=\"hb-we6-ct\">{s.title}</h3>\n                <p className=\"hb-we6-cb\">{s.body}</p>\n                <div className=\"hb-we6-del\">\n                  {s.deliverables.map((d) => (\n                    <span key={d}>\n                      <svg viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\"><path d=\"M2.5 6.2l2.2 2.2L9.5 3.6\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" /></svg>\n                      {d}\n                    </span>\n                  ))}\n                </div>\n              </div>\n            </li>\n          ))}\n        </ol>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}