{
  "$schema": "https://ui.shadcn.com/schema/registry.json",
  "name": "frictionborn",
  "homepage": "https://github.com/hunainx/frictionborn",
  "items": [
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "ambient-hero",
      "type": "registry:block",
      "title": "AmbientHero",
      "description": "Hero composition: ambient canvas (mesh/noise/particles) + TextReveal + MagneticButton (DOM+WebGL, reduced motion -> static, mobile -> T2)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [
        "@frictionborn/noise-field",
        "@frictionborn/mesh-gradient",
        "@frictionborn/particle-field",
        "@frictionborn/text-reveal",
        "@frictionborn/magnetic-button"
      ],
      "files": [
        {
          "path": "registry/items/ambient-hero/ambient-hero.tsx",
          "content": "// Original — Frictionborn Motion AmbientHero composition\n\"use client\";\n\nimport React, { useState, useEffect } from \"react\";\nimport { useCapability, usePaused, type PaletteName } from \"@frictionborn/runtime\";\nimport { NoiseField } from \"@/components/ui/noise-field\";\nimport { MeshGradient } from \"@/components/ui/mesh-gradient\";\nimport { ParticleField } from \"@/components/ui/particle-field\";\nimport { TextReveal } from \"@/components/ui/text-reveal\";\nimport { MagneticButton } from \"@/components/ui/magnetic-button\";\n\nexport type AmbientHeroVariant = \"mesh\" | \"noise\" | \"particles\";\n\nexport interface AmbientHeroCta {\n  label: string;\n  href?: string;\n  onClick?: () => void;\n}\n\nexport interface AmbientHeroProps extends React.HTMLAttributes<HTMLElement> {\n  /** Primary headline rendered with TextReveal as an h1 (required in TypeScript). */\n  headline: string;\n  /** Descriptive body copy under the headline (required in TypeScript). */\n  body: string;\n  /** Primary call-to-action button/link with magnetic pull (required in TypeScript). */\n  primaryCta: AmbientHeroCta;\n  /** Ambient background generator variant (exactly 1 WebGL context). */\n  variant?: AmbientHeroVariant;\n  /** Colours of the background variant from a palette (DESIGN.md A8): `fire` | `ice` | `neon` | `mono` | `custom`. Leave it out to keep the host's tokens. */\n  palette?: PaletteName;\n  /** Custom background slot overriding variant if provided. */\n  background?: React.ReactNode;\n  /** Eyebrow label above the primary headline. */\n  eyebrow?: string;\n  /** Secondary call-to-action button/link. */\n  secondaryCta?: AmbientHeroCta;\n  /** Show WCAG 2.2.2 compliant pause button for ambient animation. */\n  showPauseButton?: boolean;\n  /** Universal paused prop. */\n  paused?: boolean;\n  /** CSP nonce, forwarded to the `<style>` element of the headline reveal. */\n  nonce?: string;\n}\n\nexport const AmbientHero = React.forwardRef<HTMLElement, AmbientHeroProps>(\n  function AmbientHero(\n    {\n      headline,\n      body,\n      primaryCta,\n      secondaryCta,\n      eyebrow,\n      variant = \"mesh\",\n      palette,\n      background,\n      showPauseButton = true,\n      paused: propPaused = false,\n      nonce,\n      className,\n      style,\n      ...rest\n    },\n    ref\n  ) {\n    const cap = useCapability(); // @frictionborn-guard\n    const isGlobalPaused = usePaused();\n    const [internalPaused, setInternalPaused] = useState(false);\n    const [leaseReady, setLeaseReady] = useState(false);\n\n    // Defer GL lease until after initial paint / LCP so typography renders first without GPU contention\n    useEffect(() => {\n      if (typeof window === \"undefined\") return;\n\n      let activated = false;\n      const activate = () => {\n        if (activated) return;\n        activated = true;\n        setLeaseReady(true);\n      };\n\n      // If the page already finished loading (client-side navigation, a re-mount), activate immediately\n      if (document.readyState === \"complete\") {\n        activate();\n        return;\n      }\n\n      let po: PerformanceObserver | null = null;\n      try {\n        if (\n          typeof PerformanceObserver !== \"undefined\" &&\n          PerformanceObserver.supportedEntryTypes?.includes(\"largest-contentful-paint\")\n        ) {\n          po = new PerformanceObserver(() => {\n            if (\"requestIdleCallback\" in window) {\n              (window as unknown as { requestIdleCallback: (cb: () => void, opt: { timeout: number }) => number }).requestIdleCallback(\n                activate,\n                { timeout: 600 }\n              );\n            } else {\n              setTimeout(activate, 100);\n            }\n          });\n          po.observe({ type: \"largest-contentful-paint\", buffered: true });\n        }\n      } catch {\n        // Fallback if PO throws\n      }\n\n      const fallbackTimer = setTimeout(activate, 1500);\n\n      return () => {\n        po?.disconnect();\n        clearTimeout(fallbackTimer);\n      };\n    }, []);\n\n    const paused = isGlobalPaused || internalPaused || propPaused;\n\n    // The button stops the hero's own background (the `paused` prop of the variant). It used to call the global pauseAll(),\n    // which stops the shared frame loop for the whole page, including SmoothScroll's Lenis stepping.\n    const togglePause = () => {\n      if (paused) {\n\n        setInternalPaused(false);\n      } else {\n        setInternalPaused(true);\n      }\n    };\n\n    const renderBackground = () => {\n      if (background) return background;\n      if (!leaseReady) return null;\n\n      // Only one background component is ever rendered (at most 1 WebGL context)\n      if (variant === \"noise\") {\n        return (\n          <NoiseField\n            speed={0.4}\n            scale={1.8}\n            paused={paused}\n            palette={palette}\n            style={{ width: \"100%\", height: \"100%\" }}\n          />\n        );\n      }\n      if (variant === \"particles\") {\n        return (\n          <ParticleField\n            count={2500}\n            speed={0.4}\n            paused={paused}\n            palette={palette}\n            style={{ width: \"100%\", height: \"100%\" }}\n          />\n        );\n      }\n      // Default: \"mesh\"\n      return (\n        <MeshGradient\n          speed={0.85}\n          paused={paused}\n          palette={palette}\n          style={{ width: \"100%\", height: \"100%\" }}\n        />\n      );\n    };\n\n    return (\n      <header\n        ref={ref}\n        data-frictionborn-item=\"ambient-hero\"\n        data-tier={cap.tier}\n        className={className}\n        style={{\n          position: \"relative\",\n          width: \"100%\",\n          minHeight: \"560px\",\n          height: \"calc(100vh - 4rem)\",\n          maxHeight: \"840px\",\n          overflow: \"hidden\",\n          display: \"flex\",\n          alignItems: \"center\",\n          justifyContent: \"center\",\n          padding: \"2rem 1.5rem\",\n          boxSizing: \"border-box\",\n          background: \"var(--background, Canvas)\",\n          color: \"var(--foreground, CanvasText)\",\n          ...style,\n        }}\n        {...rest}\n      >\n        {/* 1. Ambient Background (at most 1 WebGL context above the fold) */}\n        <div\n          aria-hidden=\"true\"\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            zIndex: 0,\n            pointerEvents: \"none\",\n          }}\n        >\n          {renderBackground()}\n        </div>\n\n        {/* 2. Contrast Scrim (ensures contrast >= 4.5:1 across dark and light without over-muting background) */}\n        <div\n          aria-hidden=\"true\"\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            zIndex: 1,\n            pointerEvents: \"none\",\n            background:\n              \"radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--background, Canvas) 32%, transparent) 0%, color-mix(in srgb, var(--background, Canvas) 72%, transparent) 100%)\",\n          }}\n        />\n\n        {/* 3. WCAG 2.2.2 Accessible Pause Control */}\n        {showPauseButton && (\n          <button\n            type=\"button\"\n            onClick={togglePause}\n            aria-label={paused ? \"Resume ambient background motion\" : \"Pause ambient background motion\"}\n            aria-pressed={paused}\n            style={{\n              position: \"absolute\",\n              top: \"1.25rem\",\n              right: \"1.25rem\",\n              zIndex: 10,\n              display: \"inline-flex\",\n              alignItems: \"center\",\n              gap: \"0.5rem\",\n              padding: \"0.4rem 0.75rem\",\n              fontSize: \"0.75rem\",\n              fontFamily: \"var(--font-mono, monospace)\",\n              color: \"var(--foreground, currentColor)\",\n              background: \"color-mix(in srgb, var(--background, Canvas) 65%, transparent)\",\n              border: \"1px solid var(--border, color-mix(in srgb, currentColor 20%, transparent))\",\n              borderRadius: \"999px\",\n              backdropFilter: \"blur(8px)\",\n              cursor: \"pointer\",\n              transition: \"all 150ms ease\",\n            }}\n          >\n            <span\n              aria-hidden=\"true\"\n              style={{\n                width: \"7px\",\n                height: \"7px\",\n                borderRadius: \"50%\",\n                background: paused ? \"var(--muted-foreground, GrayText)\" : \"var(--primary, Highlight)\",\n                boxShadow: paused ? \"0 0 6px var(--muted-foreground, GrayText)\" : \"0 0 6px var(--primary, Highlight)\",\n              }}\n            />\n            <span>{paused ? \"Paused\" : \"Motion\"}</span>\n          </button>\n        )}\n\n        {/* 4. Semantic Content (Single <h1>, fully accessible, keyboard reachable) */}\n        <div\n          style={{\n            position: \"relative\",\n            zIndex: 2,\n            maxWidth: \"800px\",\n            width: \"100%\",\n            margin: \"0 auto\",\n            textAlign: \"center\",\n            display: \"flex\",\n            flexDirection: \"column\",\n            alignItems: \"center\",\n            gap: \"1.25rem\",\n          }}\n        >\n          {eyebrow && (\n            <div\n              style={{\n                display: \"inline-flex\",\n                alignItems: \"center\",\n                padding: \"0.3rem 0.85rem\",\n                borderRadius: \"999px\",\n                fontSize: \"0.8rem\",\n                fontWeight: 500,\n                letterSpacing: \"0.04em\",\n                textTransform: \"uppercase\",\n                fontFamily: \"var(--font-mono, monospace)\",\n                color: \"var(--primary, currentColor)\",\n                background: \"color-mix(in srgb, var(--background, Canvas) 82%, transparent)\",\n                border: \"1px solid color-mix(in srgb, var(--primary, currentColor) 28%, transparent)\",\n              }}\n            >\n              {eyebrow}\n            </div>\n          )}\n\n          <TextReveal\n            as=\"h1\"\n            by=\"word\"\n            nonce={nonce}\n            style={{\n              margin: 0,\n              fontSize: \"clamp(2rem, 5vw, 3.75rem)\",\n              fontWeight: 600,\n              lineHeight: 1.15,\n              letterSpacing: \"-0.03em\",\n              color: \"var(--foreground, currentColor)\",\n              textShadow: \"0 2px 20px color-mix(in srgb, var(--background, Canvas) 60%, transparent)\",\n            }}\n          >\n            {headline}\n          </TextReveal>\n\n          {body && (\n            <p\n              style={{\n                margin: 0,\n                maxWidth: \"600px\",\n                fontSize: \"clamp(0.95rem, 1.8vw, 1.15rem)\",\n                lineHeight: 1.6,\n                // Full foreground, not muted: over a live canvas the muted token measured 3.3-3.9:1 in the light theme (mesh, noise)\n                color: \"var(--foreground, CanvasText)\",\n                textShadow: \"0 1px 8px color-mix(in srgb, var(--background, Canvas) 50%, transparent)\",\n              }}\n            >\n              {body}\n            </p>\n          )}\n\n          {/* Action CTAs with MagneticButton */}\n          <div\n            style={{\n              display: \"flex\",\n              flexWrap: \"wrap\",\n              gap: \"1rem\",\n              justifyContent: \"center\",\n              alignItems: \"center\",\n              marginTop: \"0.75rem\",\n            }}\n          >\n            {primaryCta && (\n              <MagneticButton pullDistance={18}>\n                <a\n                  href={primaryCta.href || \"#\"}\n                  onClick={primaryCta.onClick}\n                  style={{\n                    display: \"inline-flex\",\n                    alignItems: \"center\",\n                    justifyContent: \"center\",\n                    minHeight: \"44px\",\n                    padding: \"0 1.5rem\",\n                    borderRadius: \"8px\",\n                    fontSize: \"0.95rem\",\n                    fontWeight: 500,\n                    textDecoration: \"none\",\n                    color: \"var(--primary-foreground, HighlightText)\",\n                    background: \"var(--primary, Highlight)\",\n                    boxShadow: \"0 4px 14px color-mix(in srgb, var(--background, Canvas) 35%, transparent)\",\n                    transition: \"background 150ms ease, transform 150ms ease\",\n                  }}\n                >\n                  {primaryCta.label}\n                </a>\n              </MagneticButton>\n            )}\n\n            {secondaryCta && (\n              <MagneticButton pullDistance={14}>\n                <a\n                  href={secondaryCta.href || \"#\"}\n                  onClick={secondaryCta.onClick}\n                  style={{\n                    display: \"inline-flex\",\n                    alignItems: \"center\",\n                    justifyContent: \"center\",\n                    minHeight: \"44px\",\n                    padding: \"0 1.35rem\",\n                    borderRadius: \"8px\",\n                    fontSize: \"0.95rem\",\n                    fontWeight: 500,\n                    textDecoration: \"none\",\n                    color: \"var(--foreground, CanvasText)\",\n                    background: \"var(--secondary, color-mix(in srgb, currentColor 8%, transparent))\",\n                    border: \"1px solid var(--border, color-mix(in srgb, currentColor 22%, transparent))\",\n                    backdropFilter: \"blur(6px)\",\n                    transition: \"background 150ms ease, border-color 150ms ease\",\n                  }}\n                >\n                  {secondaryCta.label}\n                </a>\n              </MagneticButton>\n            )}\n          </div>\n        </div>\n      </header>\n    );\n  }\n);\n\nAmbientHero.displayName = \"AmbientHero\";\n\nexport default AmbientHero;\n\n",
          "type": "registry:block",
          "target": "components/ui/ambient-hero.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "ambient-hero",
          "version": "0.1.0",
          "summary": "Hero composition: ambient canvas (mesh/noise/particles) + TextReveal + MagneticButton (DOM+WebGL, reduced motion -> static, mobile -> T2)",
          "slot": "composition",
          "kind": "composition"
        },
        "intent": {
          "useWhen": [
            "Primary landing page hero section requiring an ambient signature moment",
            "Marketing page header with animated headline text reveal and magnetic action buttons",
            "Showcasing a flagship product release with accessible ambient background motion"
          ],
          "avoidWhen": [
            "Secondary pages or documentation headers where ambient motion distracts from content",
            "Dense data dashboards or form-heavy internal tools",
            "Pages already containing another full-viewport WebGL context above the fold"
          ],
          "alternatives": [
            {
              "name": "noise-field",
              "when": "When you only need a standalone background canvas without integrated typography or CTAs"
            },
            {
              "name": "text-reveal",
              "when": "When you only need headline text reveal animation without ambient background or CTAs"
            }
          ]
        },
        "runtime": {
          "serverOutput": "poster",
          "clientOnly": false,
          "lazyLoaded": "no",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": [
            "@frictionborn/noise-field",
            "@frictionborn/mesh-gradient",
            "@frictionborn/particle-field",
            "@frictionborn/text-reveal",
            "@frictionborn/magnetic-button"
          ]
        },
        "behavior": {
          "loop": "while-visible",
          "webglContexts": 1,
          "tiers": {
            "0": "CSS gradient poster background (no WebGL), headline as plain static text, CTAs without magnetic pull (server render, prefers-reduced-motion, Save-Data, no WebGL2)",
            "1": "Poster background; no magnetic pull; the headline animates by word with a 40 ms stagger only if the component mounts on the client (coarse pointer with low-end hints)",
            "2": "WebGL background at DPR <= 1.5; magnetic pull only with a fine pointer; headline animates by word (60 ms stagger) only if the component mounts on the client",
            "3": "WebGL background at DPR <= 2; fine-pointer magnetic pull; headline animates by word only if the component mounts on the client"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Renders the static CSS gradient poster background with 0 WebGL canvases and 0 animation frames; headline renders as plain text without splitting or keyframes; buttons remain static"
          },
          "input": {
            "pointer": "Fine pointer activates magnetic CTA attraction; the pause button stops only the hero's own background (its variant's `paused` prop)",
            "touch": "Touch devices (coarse pointer) get no magnetic pull; CTA links and the pause button respond to direct tap",
            "keyboard": "Tab reaches the pause button (when shown), then the CTA links, with default browser focus rings; Enter activates links, Enter or Space activates the pause button"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "built-in",
          "wcag": [
            "2.1.1",
            "2.2.2",
            "2.3.1"
          ],
          "notes": "Single h1 heading (rendered by TextReveal). A scrim built from the host --background token sits between the canvas and the text, so it follows the light or dark theme; it is a contrast aid, not a guarantee, and contrast over the live canvas is not computed at runtime: verify it for your content in both themes. Measured on real pixels over the live canvas in a fresh Next 16 app with shadcn's default tokens (3 variants x light/dark x 1440/390 px, sample copy): every text element at least 10:1. The scrim is strong, so a bolder background needs mesh-gradient (or another background item) directly instead of this composition. Every colour is a host token (--background, --foreground, --primary, --primary-foreground, --muted-foreground, --secondary, --border) with a system-colour fallback. The pause button stops only the hero background; it does not touch the page's other motion or SmoothScroll's scrolling. All text stays in the accessibility tree."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": true,
          "conflictsWith": [
            "noise-field",
            "mesh-gradient",
            "particle-field"
          ],
          "pairsWith": [
            "scroll-showcase",
            "scroll-reveal"
          ]
        },
        "props": [
          {
            "name": "headline",
            "type": "string",
            "default": null,
            "effect": "Required. Primary document h1 heading rendered by TextReveal by word."
          },
          {
            "name": "body",
            "type": "string",
            "default": null,
            "effect": "Required. Supporting description copy below the headline."
          },
          {
            "name": "primaryCta",
            "type": "AmbientHeroCta = { label: string; href?: string; onClick?: () => void }",
            "default": null,
            "effect": "Required. Primary action link with magnetic pull. Rendered as an <a>; href falls back to '#'."
          },
          {
            "name": "variant",
            "type": "\"mesh\" | \"noise\" | \"particles\"",
            "default": "mesh",
            "effect": "Selects which ambient background to mount (exactly one WebGL context). Its settings are fixed: mesh speed 0.3, noise speed 0.4 scale 1.8, particles count 2500 speed 0.4."
          },
          {
            "name": "background",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Optional. Custom background slot overriding the ambient generator variant."
          },
          {
            "name": "eyebrow",
            "type": "string",
            "default": null,
            "effect": "Optional. Small pill tag displayed above the headline."
          },
          {
            "name": "secondaryCta",
            "type": "AmbientHeroCta = { label: string; href?: string; onClick?: () => void }",
            "default": null,
            "effect": "Optional. Secondary action link with magnetic pull. Rendered as an <a>; href falls back to '#'."
          },
          {
            "name": "showPauseButton",
            "type": "boolean",
            "default": true,
            "effect": "Renders a pause/resume button that stops and restarts the hero background only."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Freezes the ambient background variant only (not a custom background slot, the headline or the buttons)."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "Optional CSP nonce forwarded to the <style> element of the headline reveal."
          },
          {
            "name": "className",
            "type": "string",
            "default": null,
            "effect": "Optional. No default. Additional CSS class names on the root header element. Any other HTML attribute (id, data-*, aria-*, event handlers) is spread on the root element; handlers the item uses itself are composed, not replaced."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the root header element, merged last (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLElement>",
            "default": null,
            "effect": "Receives the root <header> element."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": null,
            "effect": "Colours of the background variant from a palette (DESIGN.md A8): fire, ice, neon, mono, or custom. Leave it out to keep the host's tokens."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/ambient-hero",
          "usage": "// Installing ambient-hero also installs noise-field, mesh-gradient, particle-field, text-reveal and magnetic-button; only the selected variant renders.\nimport { AmbientHero } from '@/components/ui/ambient-hero';\n\nexport default function Hero() {\n  return (\n    <AmbientHero\n      headline=\"Your headline\"\n      body=\"One or two plain sentences about what you offer.\"\n      primaryCta={{ label: 'Start now', href: '/signup' }}\n    />\n  );\n}",
          "mistakes": [
            "Do not place a second WebGL item above the fold alongside AmbientHero (violates single signature moment rule).",
            "headline, body and primaryCta are required and there is no default copy: TypeScript fails without them. Pass your own text; never ship the demo's.",
            "The scrim is built from your --background token. It lowers background luminance but is not a contrast guarantee: verify contrast for your content in light and dark.",
            "paused (and the built-in Pause button) reaches the ambient variant only; a custom background slot, the headline reveal and the buttons are not paused by it.",
            "On a server-rendered page the headline is painted as final static text first (TextReveal does not replay on first paint), so do not expect a word-by-word entrance on load.",
            "Reveal styles only apply when <html> has data-motion=\"ok\" (MotionReadyScript in Next, initMotionReady() in Vite).",
            "Under a nonce-based CSP pass nonce: AmbientHero forwards it to the <style> element of its headline reveal.",
            "The pause button pauses the hero background only. Motion elsewhere on the page (other items, Marquee) needs its own pause control or the runtime pauseAll().",
            "The scrim keeps the text readable by muting the background (about 45-85% of --background); the animated background is subtle by design. If the background should be the star, compose your own hero around mesh-gradient, noise-field or particle-field."
          ],
          "verify": [
            "Verify that exactly one <h1> element exists in the rendered DOM.",
            "Verify that the pause button toggles motion and has valid aria-label.",
            "Verify that reduced-motion preferences render a static poster with 0 canvases."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "2a6b805c7c44bc800a95ce456acbfff07f04d4692bbb2b222f37c4985156c4cd",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.64,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "19 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed, 1 flaky (passed on retry)"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "ash-text",
      "type": "registry:ui",
      "title": "AshText",
      "description": "headline: One line of real text drawn as grains of ash; a click or its button blows it away with glowing edges and it gathers back (canvas 2D, server-safe text)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/ash-text/ash-text.tsx",
          "content": "// Original — Frictionborn Motion AshText (ported from the component lab, c1 · Ash Disintegrate Text)\n\"use client\";\n\nimport React, { useCallback, useRef } from \"react\";\nimport { paletteVars, readPalette, resolveCssColor, useDrawLoop, useItemEnv, useItemRef, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { heat, markDrawn, noise, offscreen, paletteRamp, rand, relBox, trackPointer, stage } from \"@frictionborn/runtime/canvas\";\n\ntype TextTag = \"h1\" | \"h2\" | \"h3\" | \"p\" | \"span\";\n\nexport interface AshTextProps extends React.HTMLAttributes<HTMLDivElement>, CanvasItemProps {\n  /** The text (one line). It stays in the DOM as real text; the grains are drawn over it. */\n  children: string;\n  /** The element the text is rendered as. */\n  as?: TextTag;\n  /** Offer a button that blows the word away (and pointer clicks on the word). `false` keeps it as a still texture. */\n  interactive?: boolean;\n  /** Accessible name of that button. */\n  actionLabel?: string;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface Grain { hx: number; hy: number; x: number; y: number; vx: number; vy: number; h: number; d: number }\n\n/** sample points of `text` drawn in `el`'s own font at its own size, centred in the text's box `b` on a w × h canvas (step px apart, jittered like the lab) */\nfunction grainsOf(el: HTMLElement, text: string, w: number, h: number, b: { x: number; y: number; w: number; h: number }, step: number): Grain[] {\n  const cs = getComputedStyle(el), px = parseFloat(cs.fontSize) || 48;\n  const [, x] = offscreen(w, h);\n  x.font = `${cs.fontStyle} ${cs.fontWeight} ${px}px ${cs.fontFamily}`;\n  try {\n    (x as CanvasRenderingContext2D & { letterSpacing: string }).letterSpacing = cs.letterSpacing === \"normal\" ? \"0px\" : cs.letterSpacing;\n  } catch {\n    /* older engines: no letter spacing */\n  }\n  x.textAlign = \"center\";\n  x.textBaseline = \"alphabetic\";\n  const m = x.measureText(text), asc = m.fontBoundingBoxAscent ?? px * 0.8, desc = m.fontBoundingBoxDescent ?? px * 0.2;\n  x.fillStyle = \"#fff\";\n  x.fillText(text, b.x + b.w / 2, b.y + (b.h - (asc + desc)) / 2 + asc);\n  const d = x.getImageData(0, 0, w, h).data, out: Grain[] = [];\n  for (let y = 0; y < h; y += step)\n    for (let X = 0; X < w; X += step)\n      if (d[(y * w + X) * 4 + 3] > 127) {\n        const gx = X + rand(-1, 1), gy = y + rand(-1, 1);\n        out.push({ hx: gx, hy: gy, x: gx, y: gy, vx: 0, vy: 0, h: 0, d: Math.random() });\n      }\n  return out;\n}\n\nexport function AshText({ children, as: Tag = \"h2\", interactive = true, actionLabel, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: AshTextProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const textRef = useRef<HTMLElement>(null);\n  const blowRef = useRef<((x?: number) => void) | null>(null);\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n\n  // the grains: the lab's c1 drawing, in the text's own font, colour and place\n  const wake = useDrawLoop(\n    fxRef,\n    (fx, wakeUp) => {\n      const root = rootRef.current, el = textRef.current;\n      if (!root || !el) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const pal = paletteRamp(palette, readPalette(root, palette));\n      const ink = resolveCssColor(el, getComputedStyle(el).color) ?? [0.93, 0.9, 0.86];\n      const inkCss = `rgb(${ink.map((v) => Math.round(v * 255)).join(\",\")})`;\n      // the pointer is tracked on the text itself (the canvas around it never takes pointer events), then moved into canvas space\n      const p = trackPointer(el, d, { move: () => wakeUp() });\n      let P: Grain[] = [], gone = -1, ox = 0, box = relBox(el, fx);\n      const step = tier >= 3 ? 3 : 4;\n      const build = () => { box = relBox(el, fx); P = grainsOf(el, children, c.w, c.h, box, step); };\n      /*\n       * A web font that is still loading would sample as its fallback face, so the word is sampled once its own face is there (the lab\n       * also waits for its fonts); until then the DOM text shows as it is.\n       */\n      let alive = true, ready = false;\n      c.onResize(() => { if (ready) { build(); wakeUp(); } });\n      const go = () => {\n        if (!alive || ready) return;\n        ready = true;\n        build();\n        markDrawn(root, d);\n        wakeUp();\n      };\n      const cs = getComputedStyle(el), face = `${cs.fontStyle} ${cs.fontWeight} ${cs.fontSize} ${cs.fontFamily}`;\n      let loading = false;\n      try {\n        loading = !!document.fonts && !document.fonts.check(face, children);\n      } catch {\n        /* an invalid font string: sample with what there is */\n      }\n      if (loading) document.fonts.load(face, children).then(go, go);\n      else go();\n      blowRef.current = (x) => {\n        if (gone >= 0) return;\n        gone = 0;\n        ox = box.x + (x ?? box.w / 2);\n        wakeUp();\n      };\n      return {\n        tick(dt, t) {\n          const g = c.g;\n          g.clearRect(0, 0, c.w, c.h);\n          if (gone >= 0) {\n            gone += dt;\n            if (gone > 4.2) gone = -1;\n          }\n          const blowing = gone >= 0 && gone < 2.6;\n          let moving = gone >= 0 || p.speed > 1;\n          for (const q of P) {\n            if (blowing) {\n              const delay = (Math.abs(q.hx - ox) / box.w) * 0.9 + q.d * 0.25;\n              if (gone > delay) {\n                if (q.h === 0) { q.vx = rand(40, 160) * (q.hx < ox ? -1 : 1) * 0.6 + 60; q.vy = -rand(20, 120); q.h = 1; }\n                q.vx += (noise(q.x * 0.02, t) - 0.45) * 400 * dt;\n                q.vy += (-30 + (noise(q.y * 0.02, t + 9) - 0.5) * 300) * dt;\n                q.x += q.vx * dt;\n                q.y += q.vy * dt;\n                q.h = Math.max(0.05, q.h - dt * 0.7);\n              }\n            } else {\n              q.x += (q.hx - q.x) * Math.min(1, dt * (2.5 + q.d * 2));\n              q.y += (q.hy - q.y) * Math.min(1, dt * (2.5 + q.d * 2));\n              q.h = Math.max(0, q.h - dt);\n              if (p.in) {\n                const dx = q.x - (p.x + box.x), dy = q.y - (p.y + box.y), d2 = dx * dx + dy * dy;\n                if (d2 < 900) { q.x += (dx / 30) * dt * 40; q.y += (dy / 30) * dt * 40; }\n              }\n              if (Math.abs(q.hx - q.x) > 0.05 || Math.abs(q.hy - q.y) > 0.05 || q.h > 0) moving = true;\n            }\n            let col: string;\n            if (q.h > 0.55) col = heat(pal, 0.5 + (q.h - 0.55));\n            else if (q.h > 0.05) col = `rgba(${(140 + q.h * 120) | 0},${(130 + q.h * 30) | 0},125,${0.4 + q.h})`;\n            else col = inkCss;\n            g.fillStyle = col;\n            const s = q.h > 0.05 ? 1.6 : step - 0.4;\n            g.fillRect(q.x, q.y, s, s);\n          }\n          p.decay(dt);\n          return moving;\n        },\n        destroy() {\n          alive = false;\n          blowRef.current = null;\n          d.dispose();\n        },\n      };\n    },\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}:${children}` },\n  );\n\n  const blow = useCallback(\n    (x?: number) => {\n      blowRef.current?.(x);\n      wake();\n    },\n    [wake],\n  );\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"ash-text\" data-tier={tier} className={`fb-ash-text ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        /* the effect paints up to 200 px around the control without widening the page (no sideways scroll on phones) */\n        .fb-ash-text { overflow: clip; overflow-clip-margin: 200px; }\n        .fb-ash-text { position: relative; display: inline-block; }\n        .fb-at-text { margin: 0; white-space: nowrap; font: inherit; letter-spacing: inherit; color: inherit; }\n        .fb-ash-text[data-drawn] .fb-at-text[data-interactive=\"true\"] { cursor: pointer; }\n        .fb-ash-text[data-drawn] .fb-at-text { color: transparent; }\n        .fb-at-fx { position: absolute; inset: -90px -180px -90px -90px; pointer-events: none; }\n        .fb-at-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-at-btn { position: absolute; right: 0; bottom: -2px; transform: translateY(100%); min-height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); background: transparent; color: inherit; font: 12px ui-monospace, \"Geist Mono\", monospace; opacity: 0.7; cursor: pointer; }\n        .fb-at-btn:hover, .fb-at-btn:focus-visible { opacity: 1; }\n        .fb-at-btn:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 2px; }\n        .fb-ash-text:not([data-drawn]) .fb-at-btn { display: none; }\n      `}</style>\n      <Tag\n        ref={textRef as React.Ref<never>}\n        className=\"fb-at-text\"\n        data-interactive={interactive}\n        onClick={interactive ? (e: React.MouseEvent<HTMLElement>) => blow(e.clientX - e.currentTarget.getBoundingClientRect().left) : undefined}\n      >\n        {children}\n      </Tag>\n      <div ref={fxRef} className=\"fb-at-fx\" aria-hidden=\"true\" />\n      {interactive && (\n        <button type=\"button\" className=\"fb-at-btn\" onClick={() => blow()}>\n          {actionLabel ?? `Blow “${children}” away`}\n        </button>\n      )}\n    </div>\n  );\n}\n\nexport default AshText;\n",
          "type": "registry:ui",
          "target": "components/ui/ash-text.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "ash-text",
          "version": "0.1.0",
          "summary": "headline: One line of real text drawn as grains of ash; a click or its button blows it away with glowing edges and it gathers back (canvas 2D, server-safe text)",
          "slot": "headline",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "One short word or line that deserves a moment (a hero word, a 404, a closing line)",
            "Brand pages about fire, time or impermanence"
          ],
          "avoidWhen": [
            "Body copy, long or wrapping text (it is one line)",
            "Text that must stay crisp at all times (labels, navigation)"
          ],
          "alternatives": [
            {
              "name": "text-reveal",
              "when": "When the text should arrive once, word by word"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The control alone (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Effect on a canvas at DPR <= 1.5 with half the particles",
            "3": "Effect on a canvas at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "The real text, as it is in the server HTML: no grains, no canvas, no button."
          },
          "input": {
            "pointer": "Click the word to blow it away from that point; hovering nudges the grains",
            "touch": "Tap the word",
            "keyboard": "A native button under the word (\"Blow … away\") does the same"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.3.1",
            "1.4.3",
            "2.1.1",
            "2.2.2"
          ],
          "notes": "The text stays in the DOM as a real heading or paragraph (`as`), transparent only while the grains are drawn in its own colour. The effect is one gust of about 4 s, started by the visitor. The canvas is aria-hidden."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "flint-button",
            "lantern-sky"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "string",
            "default": null,
            "effect": "Required. The text, one line."
          },
          {
            "name": "as",
            "type": "\"h1\" | \"h2\" | \"h3\" | \"p\" | \"span\"",
            "default": "h2",
            "effect": "The element the text is rendered as."
          },
          {
            "name": "interactive",
            "type": "boolean",
            "default": true,
            "effect": "Offer the click and the button; false keeps it as a still texture."
          },
          {
            "name": "actionLabel",
            "type": "string",
            "default": null,
            "effect": "Name of the button (default: Blow \"<text>\" away)."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/ash-text",
          "usage": "import { AshText } from \"@/components/ui/ash-text\";\n\nexport function Closing() {\n  return (\n    <AshText as=\"h2\" style={{ fontSize: 96, fontWeight: 900 }}>\n      Ephemeral\n    </AshText>\n  );\n}",
          "mistakes": [
            "Pass plain text (a string), one line: it is drawn grain by grain.",
            "Set the font on AshText itself (style or className); the text element inherits it.",
            "The grains fly up to 200 px around the word: do not clip the parent with overflow: hidden."
          ],
          "verify": [
            "Server HTML has the text as a real heading.",
            "The button blows the word away and it gathers back within about 4 s.",
            "Once gathered, nothing runs."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "f9050f6900b4fec69378c41d2e98d6dd1b57a01fc57a984a7af43dc7ba05db54",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.68,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "distortion-image",
      "type": "registry:ui",
      "title": "DistortionImage",
      "description": "media: WebGL2 hover-displacement image overlay (webgl, client-only, reduced motion -> static image, mobile -> plain image / 0 contexts)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/distortion-image/distortion-image.gl.tsx",
          "content": "// Original — Frictionborn Motion\n\"use client\";\n\nimport { useEffect, useRef, useCallback } from \"react\";\nimport { createSurface, type Surface } from \"@frictionborn/runtime/gl\";\nimport { useFrame, useFrameGuard, usePaused } from \"@frictionborn/runtime\";\nimport { vertexShaderSource, fragmentShaderSource } from \"./distortion-image.glsl\";\n\ndeclare const process: { env?: { NODE_ENV?: string } };\n\nexport interface DistortionImageGLProps {\n  imageElement: HTMLImageElement | null;\n  pointerPos: { x: number; y: number }; // Normalized [0, 1] relative to image dimensions\n  isHovered: boolean;\n  strength?: number;\n  speed?: number;\n  tier?: number;\n  onContextLost?: () => void;\n  onContextRestored?: () => void;\n  onDowngrade?: () => void;\n  onTaintedCORS?: () => void;\n  onInitError?: () => void;\n}\n\nexport default function DistortionImageGL({\n  imageElement,\n  pointerPos,\n  isHovered,\n  strength = 0.25,\n  speed = 1.0,\n  tier = 3,\n  onContextLost,\n  onContextRestored,\n  onDowngrade,\n  onTaintedCORS,\n  onInitError,\n}: DistortionImageGLProps) {\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const canvasRef = useRef<HTMLCanvasElement | null>(null);\n  const surfaceRef = useRef<Surface | null>(null);\n  const programRef = useRef<WebGLProgram | null>(null);\n  const textureRef = useRef<WebGLTexture | null>(null);\n  const glRef = useRef<WebGL2RenderingContext | null>(null);\n  const uploadedSrcRef = useRef<string>(\"\");\n\n  const uniformsRef = useRef<{\n    resolution?: WebGLUniformLocation;\n    mouse?: WebGLUniformLocation;\n    time?: WebGLUniformLocation;\n    progress?: WebGLUniformLocation;\n    strength?: WebGLUniformLocation;\n    speed?: WebGLUniformLocation;\n    image?: WebGLUniformLocation;\n  }>({});\n\n  const timeRef = useRef<number>(0);\n  const progressRef = useRef<number>(0);\n  const pointerPosRef = useRef(pointerPos);\n  const isHoveredRef = useRef(isHovered);\n  // Read through refs so changing strength or speed never rebuilds the WebGL context.\n  const strengthRef = useRef(strength);\n  const speedRef = useRef(speed);\n\n  const paused = usePaused(); // @frictionborn-guard\n\n  const maxDpr = tier >= 3 ? 2.0 : 1.5;\n  const renderScale = tier >= 3 ? 1.0 : 0.75;\n  const maxTextureDim = tier >= 3 ? 2048 : 1024;\n\n  const onContextLostRef = useRef(onContextLost);\n  const onContextRestoredRef = useRef(onContextRestored);\n  const onDowngradeRef = useRef(onDowngrade);\n  const onTaintedCORSRef = useRef(onTaintedCORS);\n  const onInitErrorRef = useRef(onInitError);\n\n  useEffect(() => {\n    pointerPosRef.current = pointerPos;\n    isHoveredRef.current = isHovered;\n    strengthRef.current = strength;\n    speedRef.current = speed;\n    onContextLostRef.current = onContextLost;\n    onContextRestoredRef.current = onContextRestored;\n    onDowngradeRef.current = onDowngrade;\n    onTaintedCORSRef.current = onTaintedCORS;\n    onInitErrorRef.current = onInitError;\n  });\n\n  // Frame guard triggers automatic downgrade if p75 frame times exceed budget\n  useFrameGuard({ onDowngrade: () => onDowngradeRef.current?.(), active: !paused }); // @frictionborn-guard\n\n  // Upload texture with tier size cap and CORS taint protection\n  const uploadTexture = useCallback(\n    (gl: WebGL2RenderingContext, img: HTMLImageElement): boolean => {\n      // Clean up any existing texture to prevent memory/texture leaks\n      if (textureRef.current) {\n        gl.deleteTexture(textureRef.current);\n        textureRef.current = null;\n      }\n\n      const texture = gl.createTexture();\n      if (!texture) return false;\n\n      gl.bindTexture(gl.TEXTURE_2D, texture);\n\n      // Determine upload source: scale down to maxTextureDim if required\n      const natW = img.naturalWidth || img.width;\n      const natH = img.naturalHeight || img.height;\n\n      if (!natW || !natH) {\n        gl.deleteTexture(texture);\n        return false;\n      }\n\n      let uploadSource: TexImageSource = img;\n\n      if (natW > maxTextureDim || natH > maxTextureDim) {\n        const scale = Math.min(maxTextureDim / natW, maxTextureDim / natH);\n        const targetW = Math.max(1, Math.round(natW * scale));\n        const targetH = Math.max(1, Math.round(natH * scale));\n\n        const offscreen = document.createElement(\"canvas\");\n        offscreen.width = targetW;\n        offscreen.height = targetH;\n        const ctx2d = offscreen.getContext(\"2d\");\n        if (!ctx2d) {\n          gl.deleteTexture(texture);\n          return false;\n        }\n\n        try {\n          ctx2d.drawImage(img, 0, 0, targetW, targetH);\n          uploadSource = offscreen;\n        } catch (taintErr) {\n          // Canvas drawImage throws SecurityError if tainted\n          if (typeof process !== \"undefined\" && process.env?.NODE_ENV !== \"production\") {\n            console.warn(\n              \"[Frictionborn Motion] DistortionImage: Image is tainted by cross-origin restrictions. Falling back to plain image. Set crossOrigin='anonymous' only if the host server sends Access-Control-Allow-Origin headers.\",\n              taintErr\n            );\n          }\n          gl.deleteTexture(texture);\n          onTaintedCORSRef.current?.();\n          return false;\n        }\n      }\n\n      // Safe texture upload with SecurityError / taint detection\n      try {\n        gl.texImage2D(\n          gl.TEXTURE_2D,\n          0,\n          gl.RGBA,\n          gl.RGBA,\n          gl.UNSIGNED_BYTE,\n          uploadSource\n        );\n      } catch (texErr) {\n        if (typeof process !== \"undefined\" && process.env?.NODE_ENV !== \"production\") {\n          console.warn(\n            \"[Frictionborn Motion] DistortionImage: Image is tainted by cross-origin restrictions. Falling back to plain image. Set crossOrigin='anonymous' to enable WebGL distortion.\",\n            texErr\n          );\n        }\n        gl.deleteTexture(texture);\n        onTaintedCORSRef.current?.();\n        return false;\n      }\n\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n      textureRef.current = texture;\n      uploadedSrcRef.current = img.currentSrc || img.src;\n      return true;\n    },\n    [maxTextureDim]\n  );\n\n  const renderFrame = useCallback(() => {\n    const surface = surfaceRef.current;\n    const program = programRef.current;\n    const texture = textureRef.current;\n    if (!surface || !program || !texture) return;\n\n    const gl = surface.gl;\n    const { resolution, mouse, time, progress, strength: uStrength, speed: uSpeed, image } =\n      uniformsRef.current;\n\n    gl.useProgram(program);\n    if (resolution) gl.uniform2f(resolution, gl.drawingBufferWidth, gl.drawingBufferHeight);\n    if (mouse) gl.uniform2f(mouse, pointerPosRef.current.x, pointerPosRef.current.y);\n    if (time) gl.uniform1f(time, timeRef.current);\n    if (progress) gl.uniform1f(progress, progressRef.current);\n    if (uStrength) gl.uniform1f(uStrength, strengthRef.current);\n    if (uSpeed) gl.uniform1f(uSpeed, speedRef.current);\n    if (image) {\n      gl.activeTexture(gl.TEXTURE0);\n      gl.bindTexture(gl.TEXTURE_2D, texture);\n      gl.uniform1i(image, 0);\n    }\n\n    surface.draw();\n  }, []);\n\n  useEffect(() => {\n    const container = containerRef.current;\n    if (!container || !imageElement) return;\n\n    const canvas = document.createElement(\"canvas\");\n    canvasRef.current = canvas;\n    canvas.setAttribute(\"aria-hidden\", \"true\");\n    Object.assign(canvas.style, {\n      position: \"absolute\",\n      inset: \"0px\",\n      width: \"100%\",\n      height: \"100%\",\n      display: \"block\",\n      pointerEvents: \"none\",\n      zIndex: \"2\",\n    });\n    container.appendChild(canvas);\n\n    function setupProgram(surface: ReturnType<typeof createSurface>) {\n      const gl = surface.gl;\n      glRef.current = gl;\n\n      const program = surface.createProgram(vertexShaderSource, fragmentShaderSource);\n      programRef.current = program;\n\n      uniformsRef.current = {\n        resolution: gl.getUniformLocation(program, \"u_resolution\") || undefined,\n        mouse: gl.getUniformLocation(program, \"u_mouse\") || undefined,\n        time: gl.getUniformLocation(program, \"u_time\") || undefined,\n        progress: gl.getUniformLocation(program, \"u_progress\") || undefined,\n        strength: gl.getUniformLocation(program, \"u_strength\") || undefined,\n        speed: gl.getUniformLocation(program, \"u_speed\") || undefined,\n        image: gl.getUniformLocation(program, \"u_image\") || undefined,\n      };\n\n      if (imageElement) {\n        uploadTexture(gl, imageElement);\n      }\n    }\n\n    try {\n      const surface = createSurface(canvas, {\n        maxDpr,\n        scale: renderScale,\n        onContextLost: () => {\n          canvas.style.display = \"none\";\n          if (textureRef.current && glRef.current) {\n            glRef.current.deleteTexture(textureRef.current);\n            textureRef.current = null;\n          }\n          onContextLostRef.current?.();\n        },\n        onContextRestored: () => {\n          canvas.style.display = \"block\";\n          if (surfaceRef.current) {\n            setupProgram(surfaceRef.current);\n            renderFrame();\n          }\n          onContextRestoredRef.current?.();\n        },\n      }); // @frictionborn-guard\n\n      surfaceRef.current = surface;\n      setupProgram(surface);\n      renderFrame();\n    } catch (err) {\n      console.warn(\"DistortionImage WebGL2 initialization failed; falling back to static image\", err);\n      if (surfaceRef.current) {\n        surfaceRef.current.dispose(); // @frictionborn-guard\n        surfaceRef.current = null;\n      }\n      // No WebGL2 after all (context limit, forced tier, blocked): give the lease back and stop asking, so no\n      // dead canvas stays mounted over the image.\n      onInitErrorRef.current?.();\n    }\n\n    return () => {\n      // Explicitly delete WebGL texture to guarantee 0 texture leaks\n      if (textureRef.current && glRef.current) {\n        glRef.current.deleteTexture(textureRef.current);\n        textureRef.current = null;\n      }\n      if (surfaceRef.current) {\n        surfaceRef.current.dispose(); // @frictionborn-guard\n        surfaceRef.current = null;\n      }\n      canvas.remove();\n      canvasRef.current = null;\n    };\n  }, [maxDpr, renderScale, imageElement, uploadTexture, renderFrame]);\n\n  // The browser may pick another srcset candidate (resize, DPR change) or the src prop may change while the\n  // canvas is live: upload the new pixels so the overlay never shows a stale picture over the real image.\n  useEffect(() => {\n    const img = imageElement;\n    if (!img) return;\n    const onLoad = async () => {\n      try {\n        await img.decode();\n      } catch {\n        // decode can reject for a replaced source; the load event for the new one follows\n      }\n      const gl = glRef.current;\n      if (!gl || gl.isContextLost() || !textureRef.current) return;\n      if ((img.currentSrc || img.src) === uploadedSrcRef.current) return;\n      uploadTexture(gl, img);\n    };\n    img.addEventListener(\"load\", onLoad);\n    return () => img.removeEventListener(\"load\", onLoad);\n  }, [imageElement, uploadTexture]);\n\n  // Frame animation loop managed by runtime useFrame\n  useFrame(\n    ({ dt }) => {\n      const targetProgress = isHoveredRef.current ? 1.0 : 0.0;\n      // Exponential smoothing towards target progress (~180ms rise, ~260ms fall)\n      const smoothing = isHoveredRef.current ? 0.09 : 0.06;\n      progressRef.current += (targetProgress - progressRef.current) * smoothing;\n\n      // Increment animation time while distortion is active\n      if (progressRef.current > 0.005) {\n        timeRef.current += (dt * 0.001) * speedRef.current;\n      }\n\n      renderFrame();\n    },\n    { active: !paused } // @frictionborn-guard\n  );\n\n  return (\n    <div\n      ref={containerRef}\n      aria-hidden=\"true\"\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        width: \"100%\",\n        height: \"100%\",\n        overflow: \"hidden\",\n        pointerEvents: \"none\",\n        zIndex: 2,\n      }}\n    />\n  );\n}\n",
          "type": "registry:ui",
          "target": "components/ui/distortion-image.gl.tsx"
        },
        {
          "path": "registry/items/distortion-image/distortion-image.glsl.ts",
          "content": "// Original — Frictionborn Motion DistortionImage shaders\nexport const vertexShaderSource = `#version 300 es\nin vec2 a_position;\nout vec2 v_uv;\n\nvoid main() {\n  v_uv = (a_position + 1.0) * 0.5;\n  // Flip Y to match standard DOM top-left image orientation\n  v_uv.y = 1.0 - v_uv.y;\n  gl_Position = vec4(a_position, 0.0, 1.0);\n}\n`;\n\nexport const fragmentShaderSource = `#version 300 es\nprecision highp float;\n\n// Original — Frictionborn Motion DistortionImage ripple displacement shader\nuniform sampler2D u_image;\nuniform vec2 u_resolution;\nuniform vec2 u_mouse;\nuniform float u_time;\nuniform float u_progress;\nuniform float u_strength;\nuniform float u_speed;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nvoid main() {\n  vec2 uv = v_uv;\n\n  // Aspect ratio correction for circular radial ripples rather than stretched ovals\n  float aspect = u_resolution.x / max(1.0, u_resolution.y);\n  vec2 aspectVec = vec2(aspect, 1.0);\n\n  // Vector from pointer coordinates to current fragment\n  vec2 delta = (uv - u_mouse) * aspectVec;\n  float dist = length(delta);\n\n  // Radial influence: max impact near pointer, smooth decay to zero\n  float radius = 0.60;\n  float influence = smoothstep(radius, 0.0, dist);\n\n  // Concentric wave equations modulated by progress and time\n  float wave = sin(dist * 26.0 - u_time * u_speed * 4.5) * 0.5 + 0.5;\n  float wave2 = cos(dist * 18.0 - u_time * u_speed * 3.0) * 0.5 + 0.5;\n\n  // Directional displacement vector\n  vec2 dir = dist > 0.0001 ? normalize(delta / aspectVec) : vec2(0.0);\n\n  // Displacement magnitude scaled by strength and interactive progress\n  float dispAmount = wave * wave2 * influence * u_strength * u_progress * 0.07;\n\n  // Subtle chromatic aberration for depth\n  vec2 uvR = uv - dir * (dispAmount * 1.15);\n  vec2 uvG = uv - dir * dispAmount;\n  vec2 uvB = uv - dir * (dispAmount * 0.85);\n\n  // Clamp UVs to avoid edge wrap artifacts\n  uvR = clamp(uvR, 0.001, 0.999);\n  uvG = clamp(uvG, 0.001, 0.999);\n  uvB = clamp(uvB, 0.001, 0.999);\n\n  float r = texture(u_image, uvR).r;\n  float g = texture(u_image, uvG).g;\n  float b = texture(u_image, uvB).b;\n  float a = texture(u_image, uvG).a;\n\n  // Gentle optical highlight along crests\n  float highlight = pow(wave, 3.5) * influence * u_progress * 0.06;\n\n  float alpha = clamp(a * u_progress, 0.0, 1.0);\n  vec3 rgb = (vec3(r, g, b) + highlight) * alpha;\n\n  fragColor = vec4(rgb, alpha);\n}\n`;\n",
          "type": "registry:ui",
          "target": "components/ui/distortion-image.glsl.ts"
        },
        {
          "path": "registry/items/distortion-image/distortion-image.tsx",
          "content": "// Original — Frictionborn Motion\n\"use client\";\n\nimport React, {\n  useState,\n  useEffect,\n  useRef,\n  useCallback,\n  Suspense,\n  lazy,\n  useImperativeHandle,\n  useSyncExternalStore,\n} from \"react\";\nimport {\n  useCapability,\n  useHydrated,\n  useReducedMotion,\n  useInView,\n  glBudget,\n  type Lease,\n} from \"@frictionborn/runtime\";\n\ndeclare const process: { env?: { NODE_ENV?: string } };\n\nfunction subscribeFinePointer(callback: () => void) {\n  if (typeof window === \"undefined\" || !window.matchMedia) return () => {};\n  const media = window.matchMedia(\"(hover: hover) and (pointer: fine)\");\n  media.addEventListener(\"change\", callback);\n  return () => media.removeEventListener(\"change\", callback);\n}\n\nfunction getFinePointerSnapshot() {\n  if (typeof window === \"undefined\" || !window.matchMedia) return false;\n  return window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n}\n\nfunction getFinePointerServerSnapshot() {\n  return false;\n}\n\nconst DistortionImageGL = lazy(() => import(\"./distortion-image.gl\"));\n\n// A pointer or focus that does nothing for this long eases the ripple out, then gives the context back.\nconst IDLE_RELEASE_MS = 3000;\nconst FADE_OUT_MS = 400;\n\n// Focus ring drawn inside the box, above the canvas: an outline outside the box is clipped by any\n// overflow:hidden card around the image. Two tones so it stays visible on any picture. The transparent\n// outline is what forced-colors / high-contrast modes paint instead of the shadows.\nconst FOCUS_RING_STYLE: React.CSSProperties = {\n  position: \"absolute\",\n  inset: 0,\n  zIndex: 4,\n  pointerEvents: \"none\",\n  borderRadius: \"inherit\",\n  outline: \"2px solid transparent\",\n  outlineOffset: \"-2px\",\n  boxShadow:\n    \"inset 0 0 0 3px var(--ring, var(--primary, Highlight)), inset 0 0 0 5px var(--background, Canvas)\",\n};\n\nexport interface DistortionImageProps extends React.HTMLAttributes<HTMLDivElement> {\n  src: string;\n  alt: string;\n  width?: number | string;\n  height?: number | string;\n  strength?: number;\n  speed?: number;\n  maxTier?: number;\n  crossOrigin?: \"anonymous\" | \"use-credentials\" | \"\";\n  loading?: \"eager\" | \"lazy\";\n  decoding?: \"async\" | \"auto\" | \"sync\";\n  fetchPriority?: \"high\" | \"low\" | \"auto\";\n  fetchpriority?: \"high\" | \"low\" | \"auto\";\n  srcSet?: string;\n  sizes?: string;\n  imgClassName?: string;\n  imgStyle?: React.CSSProperties;\n  paused?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n  children?: React.ReactNode;\n}\n\nexport function DistortionImage({\n  src,\n  alt,\n  width,\n  height,\n  strength = 0.25,\n  speed = 1.0,\n  maxTier = 3,\n  crossOrigin,\n  loading = \"lazy\",\n  decoding = \"async\",\n  fetchPriority,\n  fetchpriority,\n  srcSet,\n  sizes,\n  imgClassName = \"\",\n  imgStyle,\n  paused = false,\n  ref,\n  className = \"\",\n  style,\n  children,\n  onPointerEnter,\n  onPointerMove,\n  onPointerLeave,\n  onFocus,\n  onBlur,\n  ...props\n}: DistortionImageProps) {\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const uid = React.useId();\n  const imgRef = useRef<HTMLImageElement | null>(null);\n  const instanceId = useRef(\"distortion-image-\" + uid);\n  const leaseRef = useRef<Lease | null>(null);\n  const idleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  const hydrated = useHydrated(); // @frictionborn-guard\n  const cap = useCapability(); // @frictionborn-guard\n  const prefersReduced = useReducedMotion(); // @frictionborn-guard\n  const inView = useInView(containerRef); // @frictionborn-guard\n\n  const [hasLease, setHasLease] = useState(false);\n  const [needsLease, setNeedsLease] = useState(false);\n  const [isHovered, setIsHovered] = useState(false);\n  const [pointerPos, setPointerPos] = useState({ x: 0.5, y: 0.5 });\n  const [imgLoaded, setImgLoaded] = useState(false);\n  const [taintedCORS, setTaintedCORS] = useState(false);\n  const [glFailed, setGlFailed] = useState(false);\n  const [focusVisible, setFocusVisible] = useState(false);\n  const [imageElement, setImageElement] = useState<HTMLImageElement | null>(null);\n\n  const isFinePointer = useSyncExternalStore(subscribeFinePointer, getFinePointerSnapshot, getFinePointerServerSnapshot);\n\n  // Sync state transitions during render\n  const [prevPaused, setPrevPaused] = useState(paused);\n  const [prevInView, setPrevInView] = useState(inView);\n  if (paused !== prevPaused) {\n    setPrevPaused(paused);\n    if (paused) {\n      if (isHovered) setIsHovered(false);\n      if (needsLease) setNeedsLease(false);\n    }\n  }\n  if (inView !== prevInView) {\n    setPrevInView(inView);\n    if (!inView) {\n      if (isHovered) setIsHovered(false);\n      if (needsLease) setNeedsLease(false);\n    }\n  }\n\n  let clampedStrength = strength;\n  const isOutOfRange = Number.isNaN(strength) || strength < 0 || strength > 1;\n  const warnedStrengthRef = useRef<number | null>(null);\n\n  if (isOutOfRange) {\n    let isDev = false;\n    try {\n      if (typeof process !== \"undefined\" && process.env?.NODE_ENV) {\n        isDev = process.env.NODE_ENV !== \"production\";\n      } else if (typeof import.meta !== \"undefined\") {\n        const meta = import.meta as unknown as { env?: { DEV?: boolean } };\n        if (meta?.env?.DEV !== undefined) {\n          isDev = Boolean(meta.env.DEV);\n        }\n      }\n    } catch {\n      isDev = false;\n    }\n\n    if (isDev && !Object.is(warnedStrengthRef.current, strength)) {\n      warnedStrengthRef.current = strength;\n      console.warn(`[frictionborn/distortion-image] strength must be between 0 and 1, got ${strength}. Clamping.`);\n    }\n    clampedStrength = Number.isNaN(strength) ? 0 : Math.max(0, Math.min(1, strength));\n  }\n\n  const setImgRef = useCallback((node: HTMLImageElement | null) => {\n    imgRef.current = node;\n    setImageElement(node);\n  }, []);\n\n  const effectiveTier = Math.min(cap.tier, maxTier);\n\n  // Compute pointer coordinates normalized [0, 1] relative to the element bounding box\n  const updatePointer = useCallback((e: React.PointerEvent<HTMLDivElement>) => {\n    const el = containerRef.current;\n    if (!el) return;\n    const rect = el.getBoundingClientRect();\n    if (rect.width > 0 && rect.height > 0) {\n      const x = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));\n      const y = Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height));\n      setPointerPos({ x, y });\n    }\n  }, []);\n\n  const clearIdleTimer = useCallback(() => {\n    if (idleTimerRef.current) {\n      clearTimeout(idleTimerRef.current);\n      idleTimerRef.current = null;\n    }\n  }, []);\n\n  // Any interaction restarts the idle clock. After IDLE_RELEASE_MS of nothing the ripple eases out, the\n  // lease is marked evictable straight away, and the context is released once the fade has finished.\n  const armIdleTimer = useCallback(() => {\n    clearIdleTimer();\n    idleTimerRef.current = setTimeout(() => {\n      setIsHovered(false);\n      leaseRef.current?.setOffScreen(true);\n      idleTimerRef.current = setTimeout(() => {\n        idleTimerRef.current = null;\n        setNeedsLease(false);\n      }, FADE_OUT_MS);\n    }, IDLE_RELEASE_MS);\n  }, [clearIdleTimer]);\n\n  const activate = useCallback(() => {\n    if (paused) return;\n    setIsHovered(true);\n    setNeedsLease(true);\n    leaseRef.current?.setOffScreen(false);\n    armIdleTimer();\n  }, [paused, armIdleTimer]);\n\n  useEffect(() => {\n    if (paused) {\n      clearIdleTimer();\n      if (leaseRef.current) {\n        leaseRef.current.release();\n        leaseRef.current = null;\n        setHasLease(false);\n      }\n    }\n  }, [paused, clearIdleTimer]);\n\n  // Pointer left or focus moved away: ease out now, keep the context for a grace period so coming back is\n  // instant, but let another image take the slot if it needs one (the budget evicts idle leases, LRU first).\n  const deactivate = useCallback(() => {\n    setIsHovered(false);\n    leaseRef.current?.setOffScreen(true);\n    clearIdleTimer();\n    idleTimerRef.current = setTimeout(() => {\n      idleTimerRef.current = null;\n      setNeedsLease(false);\n    }, IDLE_RELEASE_MS);\n  }, [clearIdleTimer]);\n\n  const handlePointerEnter = useCallback(\n    (e: React.PointerEvent<HTMLDivElement>) => {\n      onPointerEnter?.(e);\n      if (e.pointerType === \"touch\") return; // Touch pointers fall back to plain image (0 contexts)\n      updatePointer(e);\n      activate();\n    },\n    [onPointerEnter, updatePointer, activate]\n  );\n\n  const handlePointerMove = useCallback(\n    (e: React.PointerEvent<HTMLDivElement>) => {\n      onPointerMove?.(e);\n      if (e.pointerType === \"touch\") return;\n      updatePointer(e);\n      activate();\n    },\n    [onPointerMove, updatePointer, activate]\n  );\n\n  const handlePointerLeave = useCallback(\n    (e: React.PointerEvent<HTMLDivElement>) => {\n      onPointerLeave?.(e);\n      deactivate();\n    },\n    [onPointerLeave, deactivate]\n  );\n\n  const handleFocus = useCallback(\n    (e: React.FocusEvent<HTMLDivElement>) => {\n      onFocus?.(e);\n      let visible = true;\n      try {\n        visible = (e.target as HTMLElement).matches(\":focus-visible\");\n      } catch {\n        // :focus-visible unsupported: show the ring\n      }\n      setFocusVisible(visible);\n      activate();\n    },\n    [onFocus, activate]\n  );\n\n  const handleBlur = useCallback(\n    (e: React.FocusEvent<HTMLDivElement>) => {\n      onBlur?.(e);\n      if (!e.currentTarget.contains(e.relatedTarget as Node | null)) {\n        setFocusVisible(false);\n        deactivate();\n      }\n    },\n    [onBlur, deactivate]\n  );\n\n  // Support wrapped-in-link pattern: when wrapped in <a> or button, focus on parent activates effect\n  useEffect(() => {\n    const el = containerRef.current;\n    if (!el) return;\n    const parentInteractive = el.closest<HTMLElement>(\"a, button\");\n    if (!parentInteractive) return;\n\n    const handleParentFocus = () => {\n      let visible = true;\n      try {\n        visible = parentInteractive.matches(\":focus-visible\");\n      } catch {\n        // fallback\n      }\n      setFocusVisible(visible);\n      activate();\n    };\n\n    const handleParentBlur = (e: FocusEvent) => {\n      if (!parentInteractive.contains(e.relatedTarget as Node | null)) {\n        setFocusVisible(false);\n        deactivate();\n      }\n    };\n\n    parentInteractive.addEventListener(\"focus\", handleParentFocus as EventListener);\n    parentInteractive.addEventListener(\"blur\", handleParentBlur as EventListener);\n    return () => {\n      parentInteractive.removeEventListener(\"focus\", handleParentFocus as EventListener);\n      parentInteractive.removeEventListener(\"blur\", handleParentBlur as EventListener);\n    };\n  }, [activate, deactivate]);\n\n  // When leaving the viewport, immediately release any lease and cancel idle timers\n  useEffect(() => {\n    if (!inView) {\n      clearIdleTimer();\n    }\n  }, [inView, clearIdleTimer]);\n\n  // Context lease management with S8-11 retry subscription\n  useEffect(() => {\n    const shouldAcquire =\n      hydrated &&\n      inView &&\n      needsLease &&\n      effectiveTier >= 2 &&\n      !prefersReduced &&\n      isFinePointer &&\n      !taintedCORS &&\n      !glFailed;\n\n    let unsubscribeBudget: (() => void) | null = null;\n\n    const requestInteractiveLease = () => {\n      if (leaseRef.current) return;\n      const acquired = glBudget.acquire({\n        id: instanceId.current,\n        priority: 2, // Active hover has elevated priority over ambient backgrounds\n        onEvict: () => {\n          // Evicted (idle LRU, or by a higher-priority item). The next pointer move asks again.\n          leaseRef.current = null;\n          setHasLease(false);\n          setNeedsLease(false);\n          setIsHovered(false);\n        },\n      });\n      if (acquired) {\n        leaseRef.current = acquired;\n        setHasLease(true);\n      }\n    };\n\n    if (shouldAcquire) {\n      requestInteractiveLease();\n      // S8-11: Subscribe to budget frees so waiting visible items retry lease acquisition\n      unsubscribeBudget = glBudget.subscribe(() => {\n        if (!leaseRef.current) {\n          requestInteractiveLease();\n        }\n      });\n    } else if (leaseRef.current) {\n      leaseRef.current.release(); // @frictionborn-guard\n      leaseRef.current = null;\n      setHasLease(false);\n    }\n\n    return () => {\n      unsubscribeBudget?.();\n      if (leaseRef.current) {\n        leaseRef.current.release(); // @frictionborn-guard\n        leaseRef.current = null;\n        setHasLease(false);\n      }\n    };\n  }, [hydrated, inView, needsLease, effectiveTier, prefersReduced, isFinePointer, taintedCORS, glFailed]);\n\n  // Cleanup on unmount\n  useEffect(() => {\n    return () => {\n      if (idleTimerRef.current) {\n        clearTimeout(idleTimerRef.current);\n      }\n      if (leaseRef.current) {\n        leaseRef.current.release(); // @frictionborn-guard\n        leaseRef.current = null;\n      }\n    };\n  }, []);\n\n  const markImageReady = useCallback(() => {\n    const img = imgRef.current;\n    if (!img) return;\n    if (typeof img.decode === \"function\") {\n      img.decode().then(\n        () => setImgLoaded(true),\n        () => setImgLoaded(true)\n      );\n    } else {\n      setImgLoaded(true);\n    }\n  }, []);\n\n  useEffect(() => {\n    if (imgRef.current?.complete) {\n      markImageReady();\n    }\n  }, [src, markImageReady]);\n\n  const handleImageLoad = markImageReady;\n\n  const handleTaintedCORS = useCallback(() => {\n    setTaintedCORS(true);\n    if (leaseRef.current) {\n      leaseRef.current.release(); // @frictionborn-guard\n      leaseRef.current = null;\n      setHasLease(false);\n    }\n  }, []);\n\n  const handleInitError = useCallback(() => {\n    setGlFailed(true);\n    if (leaseRef.current) {\n      leaseRef.current.release(); // @frictionborn-guard\n      leaseRef.current = null;\n      setHasLease(false);\n    }\n  }, []);\n\n  const shouldRenderGL =\n    !paused &&\n    hydrated &&\n    hasLease &&\n    imgLoaded &&\n    !taintedCORS &&\n    !glFailed &&\n    !prefersReduced &&\n    isFinePointer &&\n    effectiveTier >= 2;\n\n  useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n  return (\n    <div\n      ref={containerRef}\n      data-frictionborn-item=\"distortion-image\"\n      data-tier={effectiveTier}\n      className={`relative inline-block overflow-hidden ${className}`}\n      style={{\n        position: \"relative\",\n        display: \"inline-block\",\n        overflow: \"hidden\",\n        outline: \"none\", // the ring below replaces the default outline\n        width,\n        height,\n        ...style,\n      }}\n      {...props}\n      onPointerEnter={handlePointerEnter}\n      onPointerMove={handlePointerMove}\n      onPointerLeave={handlePointerLeave}\n      onFocus={handleFocus}\n      onBlur={handleBlur}\n    >\n      {/* Real HTML <img> is always in DOM, defines layout, and provides accessible semantics */}\n      <img\n        ref={setImgRef}\n        data-frictionborn-poster=\"\"\n        src={src}\n        alt={alt}\n        width={width}\n        height={height}\n        loading={loading}\n        decoding={decoding}\n        fetchPriority={fetchPriority ?? fetchpriority}\n        crossOrigin={crossOrigin}\n        srcSet={srcSet}\n        sizes={sizes}\n        onLoad={handleImageLoad}\n        className={`w-full h-full object-cover block select-none ${imgClassName}`}\n        style={{\n          width: \"100%\",\n          height: \"100%\",\n          objectFit: \"cover\",\n          display: \"block\",\n          userSelect: \"none\",\n          ...imgStyle,\n        }}\n      />\n\n      {/* WebGL2 Canvas Overlay: loaded via React.lazy + Suspense only when lease acquired */}\n      {shouldRenderGL && (\n        <Suspense fallback={null}>\n          <DistortionImageGL\n            imageElement={imageElement}\n            pointerPos={pointerPos}\n            isHovered={isHovered}\n            strength={clampedStrength}\n            speed={speed}\n            tier={effectiveTier}\n            onDowngrade={() => {\n              if (leaseRef.current) {\n                leaseRef.current.release(); // @frictionborn-guard\n                leaseRef.current = null;\n                setHasLease(false);\n              }\n            }}\n            onTaintedCORS={handleTaintedCORS}\n            onInitError={handleInitError}\n          />\n        </Suspense>\n      )}\n\n      {children && (\n        <div style={{ position: \"absolute\", inset: 0, zIndex: 3, pointerEvents: \"auto\" }}>\n          {children}\n        </div>\n      )}\n\n      {focusVisible && <span aria-hidden=\"true\" data-frictionborn-focus-ring=\"\" style={FOCUS_RING_STYLE} />}\n    </div>\n  );\n}\n\nexport default DistortionImage;\n",
          "type": "registry:ui",
          "target": "components/ui/distortion-image.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "distortion-image",
          "version": "0.1.0",
          "summary": "media: WebGL2 hover-displacement image overlay (webgl, client-only, reduced motion -> static image, mobile -> plain image / 0 contexts)",
          "slot": "media",
          "kind": "webgl"
        },
        "intent": {
          "useWhen": [
            "Portfolio galleries and editorial features requiring tactile pointer distortion",
            "Product showcases where fine-pointer interaction reveals optical depth",
            "Media elements benefiting from fluid ripple displacement over real images"
          ],
          "avoidWhen": [
            "Long lists of small thumbnails on mobile where static images are optimal",
            "High-frequency rapid scrolling feeds without user hovering",
            "Images lacking CORS headers when hosted on cross-origin domains"
          ],
          "alternatives": [
            {
              "name": "noise-field",
              "when": "When a generative ambient canvas background is needed instead of image distortion"
            }
          ]
        },
        "runtime": {
          "serverOutput": "static-layout",
          "clientOnly": true,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "^4"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 4,
          "tiers": {
            "0": "Plain image, no WebGL (server render, prefers-reduced-motion, Save-Data, no WebGL2, or frame-guard downgrade)",
            "1": "Plain image (coarse pointer with low-end hints)",
            "2": "WebGL2 displacement overlay at DPR <= 1.5, 0.75 render scale, texture <= 1024px, only when the device reports (hover: hover) and (pointer: fine); coarse-pointer devices at this tier get the plain image",
            "3": "WebGL2 displacement overlay at DPR <= 2.0, full render scale, texture <= 2048px (fine pointer with hover)"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Renders the plain static image with no WebGL context and no animation frames."
          },
          "input": {
            "pointer": "Fine-pointer hover acquires a context lease and ripples around the cursor. The lease is released about 3 s after the pointer leaves or stops moving, and the render loop keeps running during that idle period (up to about 3.4 s). At most 4 contexts are live per page, shared by all instances; when the budget is full the least recently used idle image gives its slot up.",
            "touch": "Touch pointers fall back to the plain static image with zero WebGL allocation",
            "keyboard": "The wrapper is not focusable. For linked images (wrapped in <a> or containing a covering <a>), focus on the link triggers the ripple on fine-pointer devices and draws a two-tone inset focus ring above the canvas, inside the image box so parent overflow:hidden cannot clip it; exactly one tab stop is preserved. Purely decorative images have no keyboard activation. The canvas is aria-hidden"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.1.1",
            "2.2.2",
            "2.3.1"
          ],
          "notes": "The underlying HTML img element keeps the full accessible name via alt; the WebGL canvas overlay and focus ring are aria-hidden. A linked image gets exactly one tab stop (the link itself). Keyboard activation is supported whether the image is wrapped in an <a> or contains a covering <a> inside its children."
        },
        "composition": {
          "maxPerPage": 30,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "sticky-scroll-story",
            "text-reveal",
            "scroll-reveal"
          ]
        },
        "props": [
          {
            "name": "src",
            "type": "string",
            "default": null,
            "effect": "Required. URL of the underlying image to display and distort."
          },
          {
            "name": "alt",
            "type": "string",
            "default": null,
            "effect": "Required. Accessible alternative text for the image."
          },
          {
            "name": "width",
            "type": "number | string",
            "default": null,
            "effect": "Optional. No default. Layout width of the wrapper and the img."
          },
          {
            "name": "height",
            "type": "number | string",
            "default": null,
            "effect": "Optional. No default. Layout height of the wrapper and the img."
          },
          {
            "name": "strength",
            "type": "number",
            "default": 0.25,
            "effect": "Displacement ripple magnitude on hover."
          },
          {
            "name": "speed",
            "type": "number",
            "default": 1,
            "effect": "Frequency and wave propagation rate during interaction."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier (0 to 3)."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Releases the WebGL context and shows the plain image; hover or focus does nothing until un-paused."
          },
          {
            "name": "crossOrigin",
            "type": "\"anonymous\" | \"use-credentials\" | \"\"",
            "default": null,
            "effect": "Optional. No default. CORS setting for the image. Only set to 'anonymous' when the host server sends Access-Control-Allow-Origin headers. If set on a host without CORS headers, the browser blocks the image entirely. When omitted, images from non-CORS hosts cleanly fall back to static image display without errors."
          },
          {
            "name": "fetchPriority",
            "type": "\"high\" | \"low\" | \"auto\"",
            "default": null,
            "effect": "Optional. No default. Native fetchpriority attribute forwarded to the underlying img element."
          },
          {
            "name": "fetchpriority",
            "type": "\"high\" | \"low\" | \"auto\"",
            "default": null,
            "effect": "Optional. No default. Lower-case alias of fetchPriority, used only when fetchPriority is not set."
          },
          {
            "name": "loading",
            "type": "\"eager\" | \"lazy\"",
            "default": "lazy",
            "effect": "Native browser image loading attribute."
          },
          {
            "name": "decoding",
            "type": "\"async\" | \"auto\" | \"sync\"",
            "default": "async",
            "effect": "Native browser image decoding behavior."
          },
          {
            "name": "srcSet",
            "type": "string",
            "default": null,
            "effect": "Optional. No default. Native srcset. When the browser picks another candidate (resize, DPR change) the new pixels are uploaded to the texture."
          },
          {
            "name": "sizes",
            "type": "string",
            "default": null,
            "effect": "Optional. No default. Native sizes attribute for srcSet."
          },
          {
            "name": "imgClassName",
            "type": "string",
            "default": "",
            "effect": "Class names for the inner img."
          },
          {
            "name": "imgStyle",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles merged onto the inner img."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the wrapper div. Other HTML div attributes (data-*, aria-*) are passed to the wrapper, not to the img."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the wrapper div, merged after width and height (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the wrapper <div> around the <img> (not the <img> itself)."
          },
          {
            "name": "onPointerEnter",
            "type": "React.PointerEventHandler<HTMLDivElement>",
            "default": null,
            "effect": "Optional. No default. Composed: called first, then the component's own handling. onPointerMove, onPointerLeave, onFocus and onBlur are composed the same way."
          },
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Optional. No default. Content layered above the image and canvas, for example a caption or a link."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/distortion-image",
          "usage": "import { DistortionImage } from \"@/components/ui/distortion-image\";\n\nexport default function GalleryCard() {\n  return (\n    <DistortionImage\n      src=\"/art-1.webp\"\n      alt=\"Field Study in Golden Wheat\"\n      width={600}\n      height={400}\n      strength={0.25}\n    />\n  );\n}",
          "mistakes": [
            "Do not set crossOrigin='anonymous' unless the host server actually sends CORS headers (Access-Control-Allow-Origin); setting it on a non-CORS host causes the browser to block the image entirely. Omit it to let DistortionImage cleanly display the static image without errors.",
            "Do not set position: absolute on the underlying img without specifying container dimensions; let the image define layout to avoid CLS.",
            "Do not attempt to animate strength or pointer coordinates manually with requestAnimationFrame; the component handles internal interaction loops.",
            "The wrapper is display: inline-block, set inline, so a `block` class does not override it: pass style={{ display: 'block' }} for block layout, and `w-full` / `aspect-*` classes to size it in a grid. Numeric width and height props set fixed pixels on the wrapper and the <img>."
          ],
          "verify": [
            "Confirm the real img element is rendered in server HTML before hydration (CLS <= 0.01).",
            "Confirm that when hovering with a fine pointer, a WebGL context lease is acquired and released after about 3s idle.",
            "Confirm that coarse touch pointers and reduced-motion render the plain image with 0 WebGL contexts."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": [
            "Archival plate 01 (Field Study in Golden Wheat) - CC0 1.0 (Public Domain)",
            "Archival plate 02 (Iris Botanical Study) - CC0 1.0 (Public Domain)",
            "Archival plate 03 (Nocturnal Cypresses Study) - CC0 1.0 (Public Domain)",
            "Archival plate 04 (Ocean Wave Crest Study) - CC0 1.0 (Public Domain)",
            "Archival plate 05 (Sunflowers Study) - CC0 1.0 (Public Domain)",
            "Archival plate 06 (Pastoral Shoreline Study) - CC0 1.0 (Public Domain)"
          ]
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "ff23668eb7f8429658192baec0bd7a474f69bede5ff32505496ef3f1a35afd9a",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 4.6,
            "deferred": 4.31,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "29 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "26 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "26 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "24 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "24 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "eclipse-switch",
      "type": "registry:ui",
      "title": "EclipseSwitch",
      "description": "control: Light/dark theme switch: the moon slides across the sun until only the corona remains (canvas 2D, server-safe switch, reduced motion -> still)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/eclipse-switch/eclipse-switch.tsx",
          "content": "// Original — Frictionborn Motion EclipseSwitch (ported from the component lab, t2 · Eclipse Theme Switch)\n\"use client\";\n\nimport React, { useCallback, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, useLatest, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { TAU, fbm, noise, offscreen, paletteRamp, ramp, type Ramp, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface EclipseSwitchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\">, CanvasItemProps {\n  /** Controlled state: true = eclipse (dark). */\n  checked?: boolean;\n  defaultChecked?: boolean;\n  onCheckedChange?: (checked: boolean) => void;\n  /** Visible label of the switch button (also its accessible name). */\n  label?: string;\n  /** Visible, announced status by state. Pass `null` to hide it. */\n  statusText?: { on: string; off: string } | null;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\nconst STATUS = { on: \"Totality\", off: \"Day\" };\n/** the lab's sun ramp (fbSun) for `fire` */\nconst SUN: Ramp = [[0, [70, 8, 2]], [0.4, [210, 60, 8]], [0.75, [255, 150, 40]], [1, [255, 225, 150]]];\n\n/** a granulated sun disc of radius R, pre-rendered once (the lab's fbSun) */\nfunction sunDisc(R: number, pal: Ramp): HTMLCanvasElement {\n  const S = Math.ceil(R * 2);\n  const [o, x] = offscreen(S, S);\n  const id = x.createImageData(S, S);\n  for (let j = 0; j < S; j++)\n    for (let i = 0; i < S; i++) {\n      const u = (i - R) / R, v = (j - R) / R, d = u * u + v * v, q = (j * S + i) * 4;\n      if (d > 1) { id.data[q + 3] = 0; continue; }\n      const z = Math.sqrt(1 - d), n = fbm(i * 0.35, j * 0.35, 3), big = fbm(i * 0.05, j * 0.05, 3);\n      const I = (0.55 + n * 0.45 - Math.max(0, big - 0.62) * 1.8) * Math.pow(z, 0.45);\n      const c = ramp(pal, I);\n      id.data[q] = c[0];\n      id.data[q + 1] = c[1];\n      id.data[q + 2] = c[2];\n      id.data[q + 3] = 255;\n    }\n  x.putImageData(id, 0, 0);\n  return o;\n}\n\nexport function EclipseSwitch({ checked, defaultChecked = false, onCheckedChange, label = \"Eclipse mode\", statusText = STATUS, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: EclipseSwitchProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const [inner, setInner] = useState(defaultChecked);\n  const on = checked ?? inner;\n  const onRef = useLatest(on);\n  const { hydrated, tier, still } = useItemEnv(maxTier);\n\n  // the sky: the lab's t2 drawing. The sun is the content, so every tier draws it; still (reduced motion, tier 0) jumps to the end state\n  const wake = useDrawLoop(\n    fxRef,\n    (fx) => {\n      const root = rootRef.current;\n      if (!root) return null;\n      const s = stage(fx, tier, root);\n      if (!s) return null;\n      const { d, c } = s;\n      const pal = palette === \"fire\" ? SUN : paletteRamp(palette, readPalette(root, palette));\n      const sun = sunDisc(48, pal);\n      let m = onRef.current ? 1 : 0;\n      return {\n        tick(dt, t) {\n          const want = onRef.current ? 1 : 0;\n          m += (want - m) * Math.min(1, dt * (still ? 20 : 1.4));\n          if (still || Math.abs(want - m) < 0.002) m = want;\n          const g = c.g, cx = c.w / 2, cy = c.h / 2 - 14;\n          g.clearRect(0, 0, c.w, c.h);\n          if (m > 0.6) {\n            g.save();\n            g.globalAlpha = (m - 0.6) / 0.4;\n            for (let i = 0; i < 60; i++) {\n              g.fillStyle = \"rgba(255,255,255,.6)\";\n              g.fillRect((i * 97) % c.w, (i * 53) % c.h, 1.2, 1.2);\n            }\n            g.restore();\n          }\n          if (m > 0.85) {\n            g.save();\n            g.globalCompositeOperation = \"lighter\";\n            const a = (m - 0.85) / 0.15;\n            const co = g.createRadialGradient(cx, cy, 46, cx, cy, 140);\n            co.addColorStop(0, `rgba(230,240,255,${0.7 * a})`);\n            co.addColorStop(0.25, `rgba(200,215,255,${0.2 * a})`);\n            co.addColorStop(1, \"rgba(180,200,255,0)\");\n            g.fillStyle = co;\n            g.fillRect(0, 0, c.w, c.h);\n            for (let i = 0; i < 24; i++) {\n              const an = (i / 24) * TAU, l = 60 + 50 * noise(i, t * 0.2);\n              g.strokeStyle = `rgba(220,230,255,${0.15 * a})`;\n              g.beginPath();\n              g.moveTo(cx + Math.cos(an) * 50, cy + Math.sin(an) * 50);\n              g.lineTo(cx + Math.cos(an) * l * 1.4, cy + Math.sin(an) * l * 1.4);\n              g.stroke();\n            }\n            g.restore();\n          } else {\n            const gl = g.createRadialGradient(cx, cy, 40, cx, cy, 120);\n            gl.addColorStop(0, `rgba(255,220,150,${0.45 * (1 - m)})`);\n            gl.addColorStop(1, \"rgba(255,220,150,0)\");\n            g.fillStyle = gl;\n            g.fillRect(0, 0, c.w, c.h);\n          }\n          g.drawImage(sun, cx - 48, cy - 48);\n          const mx = cx + (1 - m) * 150;\n          g.fillStyle = m > 0.5 ? \"#05060a\" : \"#1b2430\";\n          g.beginPath();\n          g.arc(mx, cy - (1 - m) * 18, 49, 0, TAU);\n          g.fill();\n          if (m > 0.97) {\n            g.save();\n            g.globalCompositeOperation = \"lighter\";\n            const dx = cx - 30, dy = cy - 38;\n            const gr = g.createRadialGradient(dx, dy, 0, dx, dy, 16);\n            gr.addColorStop(0, \"rgba(255,255,255,.9)\");\n            gr.addColorStop(1, \"rgba(255,255,255,0)\");\n            g.fillStyle = gr;\n            g.fillRect(dx - 16, dy - 16, 32, 32);\n            g.restore();\n          }\n          // the moon slides, then the sky holds still (the corona's rays settle with it)\n          return m !== want;\n        },\n        destroy: () => d.dispose(),\n      };\n    },\n    { enabled: hydrated, paused, key: `${tier}:${still ? 1 : 0}:${palette}` },\n  );\n\n  const toggle = useCallback(() => {\n    const next = !onRef.current;\n    if (checked === undefined) setInner(next);\n    onCheckedChange?.(next);\n    wake();\n  }, [checked, onCheckedChange, wake]);\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"eclipse-switch\" data-tier={tier} data-on={on} className={`fb-eclipse-switch ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        .fb-eclipse-switch { position: relative; isolation: isolate; min-height: 250px; border-radius: 16px; overflow: hidden; background: #2a4a6a; color: #E9E5DF; }\n        [data-motion=\"ok\"] .fb-eclipse-switch { transition: background 1s; }\n        .fb-eclipse-switch[data-on=\"true\"] { background: #05060a; }\n        .fb-es-fx { position: absolute; inset: 0; pointer-events: none; z-index: 0; }\n        .fb-es-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-es-sun { position: absolute; left: 50%; top: calc(50% - 14px); width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--fb-heat-4, #FFF4E0), var(--fb-heat-2, #E8590C) 70%, var(--fb-heat-1, #7A1D10)); }\n        .fb-eclipse-switch[data-on=\"true\"] .fb-es-sun { background: #05060a; box-shadow: 0 0 0 2px rgba(230, 240, 255, 0.7), 0 0 40px rgba(200, 215, 255, 0.45); }\n        .fb-eclipse-switch[data-drawn] .fb-es-sun { display: none; }\n        .fb-es-btn { position: absolute; left: 20px; bottom: 18px; z-index: 2; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(233, 229, 223, 0.3); background: rgba(12, 11, 10, 0.55); color: #E9E5DF; font: inherit; font-size: 13px; cursor: pointer; }\n        .fb-es-btn[aria-checked=\"true\"] { border-color: rgba(230, 240, 255, 0.6); }\n        .fb-es-btn:focus-visible { outline: 2px solid var(--ring, #E9E5DF); outline-offset: 2px; }\n        .fb-es-status { position: absolute; right: 20px; bottom: 22px; z-index: 2; font: 11px ui-monospace, \"Geist Mono\", monospace; letter-spacing: 0.12em; text-transform: uppercase; color: #E9E5DF; }\n      `}</style>\n      <div ref={fxRef} className=\"fb-es-fx\" aria-hidden=\"true\" />\n      <div className=\"fb-es-sun\" aria-hidden=\"true\" />\n      <button type=\"button\" role=\"switch\" aria-checked={on} className=\"fb-es-btn\" onClick={toggle}>\n        {label}\n      </button>\n      {statusText && (\n        <span className=\"fb-es-status\" aria-live=\"polite\">\n          {on ? statusText.on : statusText.off}\n        </span>\n      )}\n    </div>\n  );\n}\n\nexport default EclipseSwitch;\n",
          "type": "registry:ui",
          "target": "components/ui/eclipse-switch.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "eclipse-switch",
          "version": "0.1.0",
          "summary": "control: Light/dark theme switch: the moon slides across the sun until only the corona remains (canvas 2D, server-safe switch, reduced motion -> still)",
          "slot": "control",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "The light/dark theme toggle of a site or app, as a feature in a settings card or a hero",
            "A day/night or on/off choice with a sky metaphor"
          ],
          "avoidWhen": [
            "A compact header toggle (it is a 250 px panel)",
            "Pages that already show a lot of motion near it"
          ],
          "alternatives": [
            {
              "name": "flame-switch",
              "when": "When the toggle is not about light and dark"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "One still frame on the canvas (reduced motion, Save-Data, no WebGL2), redrawn only when the value changes",
            "1": "Same as tier 2",
            "2": "Animated at DPR <= 1.5 with half the particles",
            "3": "Animated at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "still-frame",
            "description": "The sky jumps straight to day or totality: one frame per change, no sliding moon."
          },
          "input": {
            "pointer": "Click the switch",
            "touch": "Tap the switch",
            "keyboard": "A native <button role=switch>: Space and Enter toggle"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.4.3",
            "2.1.1",
            "4.1.2",
            "4.1.3"
          ],
          "notes": "A native <button role=\"switch\"> with aria-checked; its visible label is its name. The status (Day / Totality) is aria-live=polite. Before the canvas mounts a CSS sun shows the state. The sky canvas is aria-hidden."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "flame-switch",
            "light-leak-tabs"
          ]
        },
        "props": [
          {
            "name": "checked",
            "type": "boolean",
            "default": null,
            "effect": "Controlled state: true is the eclipse (dark)."
          },
          {
            "name": "defaultChecked",
            "type": "boolean",
            "default": false,
            "effect": "Initial state when uncontrolled."
          },
          {
            "name": "onCheckedChange",
            "type": "(checked: boolean) => void",
            "default": null,
            "effect": "Called with the new state."
          },
          {
            "name": "label",
            "type": "string",
            "default": "Eclipse mode",
            "effect": "Visible label and accessible name of the switch."
          },
          {
            "name": "statusText",
            "type": "{ on: string; off: string } | null",
            "default": "{ on: \"Totality\", off: \"Day\" }",
            "effect": "Visible, announced status; null hides it."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/eclipse-switch",
          "usage": "import { EclipseSwitch } from \"@/components/ui/eclipse-switch\";\n\nexport function ThemeCard({ dark, setDark }: { dark: boolean; setDark: (v: boolean) => void }) {\n  return <EclipseSwitch checked={dark} onCheckedChange={setDark} label=\"Dark mode\" statusText={{ on: \"Dark\", off: \"Light\" }} />;\n}",
          "mistakes": [
            "It switches its own sky only: apply your theme in onCheckedChange.",
            "Give it a full card (at least 250 px tall); it is not a header icon.",
            "Keep the label short; it sits on the sky."
          ],
          "verify": [
            "Server HTML has a switch with aria-checked and a CSS sun.",
            "Space toggles; the status reads Totality or Day.",
            "The moon slides in about 4 s, then nothing runs."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "6078b5d102700fa36b616211f2bb060c37d85dee8183d4f4631ef803cf933af9",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.18,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "ember-badge",
      "type": "registry:ui",
      "title": "EmberBadge",
      "description": "feedback: Unread-count badge that is a live ember: flares on new items, cools to ash at zero (canvas 2D, server-safe, reduced motion -> static badge)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/ember-badge/ember-badge.tsx",
          "content": "// Original — Frictionborn Motion EmberBadge (ported from the component lab, e2 · Ember Notification Badge)\n\"use client\";\n\nimport React, { useEffect, useRef } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { Sparks, heat, paletteRamp, rand, relBox, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface EmberBadgeProps extends React.HTMLAttributes<HTMLDivElement>, CanvasItemProps {\n  /** The unread count. A rise makes the ember flare; 0 lets it cool to ash and hides the number. */\n  count: number;\n  /** Counts above this show as `max+`. */\n  max?: number;\n  /** What the count counts, for screen readers (\"unread messages\" → \"3 unread messages\"). */\n  label?: string;\n  /** The element the badge sits on (an icon button, an avatar). */\n  children: React.ReactNode;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\n/** seconds the ember flickers after a change before it holds steady */\nconst BREATHE = 3;\n\nexport function EmberBadge({ count, max = 99, label = \"unread\", children, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: EmberBadgeProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const numRef = useRef<HTMLSpanElement>(null);\n  const countRef = useRef(count);\n  const flareRef = useRef<(() => void) | null>(null);\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n  const shown = count > max ? `${max}+` : String(count);\n\n  // the ember: the lab's e2 drawing (heat, flicker, rising sparks); the number's colours are written straight to the element\n  const wake = useDrawLoop(\n    fxRef,\n    (fx, wakeUp) => {\n      const root = rootRef.current, num = numRef.current;\n      if (!root || !num) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const pal = paletteRamp(palette, readPalette(root, palette));\n      const sp = new Sparks(tier >= 3 ? 300 : 150, palette === \"fire\" ? null : pal);\n      const level = (n: number) => (n ? Math.min(1, 0.6 + n * 0.06) : 0);\n      // mounted at rest: steady at the count's heat (it flickers after a change, not on arrival)\n      let flare = 0, h0 = level(countRef.current), last = countRef.current, since = BREATHE + 1;\n      const pos = () => { const b = relBox(num, fx); return [b.x + b.w / 2, b.y + b.h / 2]; };\n      flareRef.current = () => {\n        flare = 1;\n        h0 = 1;\n        const [x, y] = pos();\n        sp.burst(x, y, 26, 80, 300);\n        num.style.transform = \"scale(1.3)\";\n        window.setTimeout(() => (num.style.transform = \"\"), 160);\n        wakeUp();\n      };\n      return {\n        tick(dt, t) {\n          const n = countRef.current;\n          if (n !== last) { last = n; since = 0; }\n          since += dt;\n          flare = Math.max(0, flare - dt * 1.5);\n          h0 += (level(n) - h0) * Math.min(1, dt * (n ? 3 : 0.8));\n          // the lab's flicker, for a few seconds after each change; then the ember holds steady (an idle badge costs no frames)\n          const fade = Math.max(0, 1 - Math.max(0, since - BREATHE) / 0.6);\n          const fl = 1 - fade * 0.12 * (1 - Math.sin(t * 7) * Math.sin(t * 2.3));\n          const h = Math.min(1, h0 * fl + flare * 0.4);\n          num.style.opacity = h0 < 0.05 && !n ? \"0\" : \"1\";\n          num.style.background = h > 0.08 ? `radial-gradient(circle at 40% 35%, ${heat(pal, 0.75 + h * 0.25)}, ${heat(pal, 0.35 + h * 0.35)})` : \"#4a4440\";\n          num.style.boxShadow = `0 0 ${8 + h * 26}px ${heat(pal, 0.5, h * 0.9)}`;\n          num.style.color = h > 0.3 ? \"#2a0f04\" : \"#cfc6bd\";\n          const [x, y] = pos();\n          if (h > 0.3 && fade > 0 && Math.random() < dt * 6 * h) sp.add(x, y - 10, rand(-20, 20), -rand(40, 110), rand(0.5, 1), 1, -30, 0.6);\n          sp.step(dt);\n          c.g.clearRect(0, 0, c.w, c.h);\n          sp.draw(c.g);\n          return fade > 0 || sp.n > 0 || flare > 0 || Math.abs(level(n) - h0) > 0.004;\n        },\n        destroy() {\n          flareRef.current = null;\n          num.style.cssText = \"\";\n          d.dispose();\n        },\n      };\n    },\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}` },\n  );\n\n  // a rise in the count flares the ember; any change wakes the loop\n  useEffect(() => {\n    if (count > countRef.current) flareRef.current?.();\n    countRef.current = count;\n    wake();\n  }, [count, wake]);\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"ember-badge\" data-tier={tier} className={`fb-ember-badge ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        /* the effect paints up to 200 px around the control without widening the page (no sideways scroll on phones) */\n        .fb-ember-badge { overflow: clip; overflow-clip-margin: 200px; }\n        .fb-ember-badge { position: relative; display: inline-grid; place-items: center; }\n        .fb-eb-fx { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; transform: translate(-30%, -70%); pointer-events: none; }\n        .fb-eb-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-eb-num { position: absolute; top: -10px; right: -12px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;\n          font: 700 14px ui-monospace, \"Geist Mono\", monospace; color: #2a0f04; pointer-events: none;\n          background: radial-gradient(circle at 40% 35%, var(--fb-heat-3, #FFB15C), var(--fb-heat-2, #E8590C)); box-shadow: 0 0 18px color-mix(in srgb, var(--fb-heat-2, #E8590C) 70%, transparent); }\n        [data-motion=\"ok\"] .fb-eb-num { transition: transform 0.2s; }\n        .fb-eb-num[data-zero=\"true\"] { visibility: hidden; }\n        .fb-eb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }\n      `}</style>\n      {children}\n      <div ref={fxRef} className=\"fb-eb-fx\" aria-hidden=\"true\" />\n      <span ref={numRef} className=\"fb-eb-num\" aria-hidden=\"true\" data-zero={count === 0}>\n        {count ? shown : \"\"}\n      </span>\n      <span className=\"fb-eb-sr\" role=\"status\">\n        {`${shown} ${label}`}\n      </span>\n    </div>\n  );\n}\n\nexport default EmberBadge;\n",
          "type": "registry:ui",
          "target": "components/ui/ember-badge.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "ember-badge",
          "version": "0.1.0",
          "summary": "feedback: Unread-count badge that is a live ember: flares on new items, cools to ash at zero (canvas 2D, server-safe, reduced motion -> static badge)",
          "slot": "feedback",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "An unread or pending count on an icon button, avatar or tab",
            "A notification bell in a header where new items deserve a moment of attention"
          ],
          "avoidWhen": [
            "Many badges in one list (one ember per screen is enough)",
            "Counts that change several times a second (it would flare constantly)"
          ],
          "alternatives": []
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The control alone (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Effect on a canvas at DPR <= 1.5 with half the particles",
            "3": "Effect on a canvas at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "A static ember-coloured badge with the number; no flare, no sparks, no canvas."
          },
          "input": {
            "pointer": "None of its own: the wrapped element keeps its own handlers",
            "touch": "Same",
            "keyboard": "None of its own: the wrapped button or link stays focusable"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.3.1",
            "4.1.3"
          ],
          "notes": "The visible number is aria-hidden; a visually hidden role=status reads \"<count> <label>\" when the count changes. The wrapped element keeps its own name and role."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "flame-switch",
            "fuse-toast"
          ]
        },
        "props": [
          {
            "name": "count",
            "type": "number",
            "default": null,
            "effect": "Required. The unread count; a rise flares the ember, 0 cools it to ash and hides the number."
          },
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Required. The element the badge sits on (an icon button, an avatar)."
          },
          {
            "name": "max",
            "type": "number",
            "default": 99,
            "effect": "Counts above this show as max+."
          },
          {
            "name": "label",
            "type": "string",
            "default": "unread",
            "effect": "What the count counts, read after the number by screen readers."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/ember-badge",
          "usage": "import { EmberBadge } from \"@/components/ui/ember-badge\";\n\nexport function Inbox({ unread }: { unread: number }) {\n  return (\n    <EmberBadge count={unread} label=\"unread messages\">\n      <button type=\"button\" aria-label=\"Inbox\">\n        <span aria-hidden=\"true\">🔔</span>\n      </button>\n    </EmberBadge>\n  );\n}",
          "mistakes": [
            "Put the accessible name on the wrapped button (aria-label=\"Inbox\"); the badge only adds the count.",
            "The sparks rise above the badge: do not clip the parent with overflow: hidden.",
            "Pass the real count (a number), not a string; the badge formats max+ itself."
          ],
          "verify": [
            "Server HTML shows the number on a static ember badge.",
            "Raising count flares the ember and a status message reads the new count.",
            "At count 0 the number disappears and the loop stops."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "190c6602c51606cc21918d71d45eb9d3d4dbf99bfc1284c116f80e7dbd2ea0b4",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.64,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "ember-core",
      "type": "registry:ui",
      "title": "EmberCore",
      "description": "background: 3D ash filament sphere with inner ember glow, vortex stir, shockwave strike and hold-to-charge burst (WebGL2, still under reduced motion)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/ember-core/ember-core.gl.tsx",
          "content": "// Original — Frictionborn Motion \"Ember Core\" WebGL2 engine (ash filaments, inner glow, pointer torch, bloom, gestures, and synthesized sound)\n\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createSurface, type Surface } from \"@frictionborn/runtime/gl\";\nimport { useFrame, useFrameGuard } from \"@frictionborn/runtime\";\nimport {\n  FILAMENT_VERT,\n  FILAMENT_FRAG,\n  GLOW_VERT,\n  GLOW_FRAG,\n  TORCH_VERT,\n  TORCH_FRAG,\n  POST_VERT,\n  BLOOM_THRESHOLD_FRAG,\n  BLOOM_BLUR_FRAG,\n  BLOOM_COMPOSITE_FRAG,\n} from \"./ember-core.glsl\";\n\nexport type RGB = [number, number, number];\n\nexport interface EmberCorePaletteRGB {\n  ash: RGB;\n  ember: RGB;\n  hot: RGB;\n  gA: RGB;\n  gB: RGB;\n}\n\nexport interface EmberCoreGLProps {\n  colors: EmberCorePaletteRGB;\n  interactive: \"full\" | \"hero\" | \"none\";\n  heat: number;\n  swirl: number;\n  spin: number;\n  density: number;\n  bloom: boolean;\n  sound: boolean;\n  paused: boolean;\n  reducedMotion: boolean;\n  tier: number;\n  offsetX?: number;\n  lightTheme?: boolean;\n  suspended?: boolean;\n  strikeTrigger?: number;\n  resetTrigger?: number;\n  ariaLabel?: string;\n  onToast?: (msg: string) => void;\n  onTogglePause?: () => void;\n  onContextLost?: () => void;\n  onContextRestored?: () => void;\n  onDowngrade?: () => void;\n}\n\ntype Quat = [number, number, number, number]; // [x, y, z, w]\n\nconst ZMIN = 0.55;\nconst ZMAX = 1.9;\nconst FOV_RAD = (35 * Math.PI) / 180;\n\nfunction quatFromEulerX(rad: number): Quat {\n  const half = rad * 0.5;\n  return [Math.sin(half), 0, 0, Math.cos(half)];\n}\n\nfunction quatFromAxisAngle(ax: number, ay: number, az: number, angle: number): Quat {\n  const half = angle * 0.5;\n  const s = Math.sin(half);\n  return [ax * s, ay * s, az * s, Math.cos(half)];\n}\n\nfunction quatMultiply(a: Quat, b: Quat): Quat {\n  const [ax, ay, az, aw] = a;\n  const [bx, by, bz, bw] = b;\n  const x = aw * bx + ax * bw + ay * bz - az * by;\n  const y = aw * by - ax * bz + ay * bw + az * bx;\n  const z = aw * bz + ax * by - ay * bx + az * bw;\n  const w = aw * bw - ax * bx - ay * by - az * bz;\n  const len = Math.hypot(x, y, z, w) || 1;\n  return [x / len, y / len, z / len, w / len];\n}\n\nfunction quatRotateOnWorldAxis(q: Quat, ax: number, ay: number, az: number, angle: number): Quat {\n  if (Math.abs(angle) < 1e-7) return q;\n  const rot = quatFromAxisAngle(ax, ay, az, angle);\n  return quatMultiply(rot, q);\n}\n\nfunction mat4FromQuat(q: Quat, out: Float32Array): void {\n  const [x, y, z, w] = q;\n  const x2 = x + x, y2 = y + y, z2 = z + z;\n  const xx = x * x2, xy = x * y2, xz = x * z2;\n  const yy = y * y2, yz = y * z2, zz = z * z2;\n  const wx = w * x2, wy = w * y2, wz = w * z2;\n  out[0] = 1 - (yy + zz); out[1] = xy + wz; out[2] = xz - wy; out[3] = 0;\n  out[4] = xy - wz; out[5] = 1 - (xx + zz); out[6] = yz + wx; out[7] = 0;\n  out[8] = xz + wy; out[9] = yz - wx; out[10] = 1 - (xx + yy); out[11] = 0;\n  out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1;\n}\n\nfunction mat4Translation(tx: number, ty: number, tz: number, out: Float32Array): void {\n  out.fill(0);\n  out[0] = 1; out[5] = 1; out[10] = 1; out[15] = 1;\n  out[12] = tx; out[13] = ty; out[14] = tz;\n}\n\nfunction mat4Perspective(fovRad: number, aspect: number, near: number, far: number, out: Float32Array): void {\n  const f = 1.0 / Math.tan(fovRad * 0.5);\n  const nf = 1.0 / (near - far);\n  out.fill(0);\n  out[0] = f / Math.max(0.01, aspect);\n  out[5] = f;\n  out[10] = (far + near) * nf;\n  out[11] = -1;\n  out[14] = 2 * far * near * nf;\n}\n\nconst envFlare = (dt: number) => (dt < 0 ? 0 : dt < 0.35 ? dt / 0.35 : Math.exp(-(dt - 0.35) * 1.6));\nconst envBurst = (dt: number) => (dt < 0 ? 0 : dt < 0.12 ? dt / 0.12 : Math.exp(-(dt - 0.12) * 2.2));\nconst clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));\n\ninterface BuildGeoResult {\n  fPos: Float32Array;\n  fSeed: Float32Array;\n  strands: number;\n  steps: number;\n  gPos: Float32Array;\n  gSeed: Float32Array;\n  glowCount: number;\n}\n\nlet cachedTier2Geo: BuildGeoResult | null = null;\nlet cachedTier3Geo: BuildGeoResult | null = null;\n\nfunction buildGeometry(isTier2: boolean): BuildGeoResult {\n  if (isTier2 && cachedTier2Geo) return cachedTier2Geo;\n  if (!isTier2 && cachedTier3Geo) return cachedTier3Geo;\n\n  const strands = isTier2 ? 2200 : 4600;\n  const steps = isTier2 ? 48 : 62;\n  const n = strands * steps;\n  const fPos = new Float32Array(n * 3);\n  const fSeed = new Float32Array(n);\n  let rnd = 1337;\n  const rand = () => ((rnd = (rnd * 16807) % 2147483647) / 2147483647);\n  const field = (x: number, y: number, z: number): [number, number, number] => [\n    Math.sin(1.7 * y + Math.cos(2.3 * z)) + 0.6 * Math.sin(3.1 * z + 1.3),\n    Math.sin(1.9 * z + Math.cos(2.1 * x)) + 0.6 * Math.sin(2.7 * x + 0.4),\n    Math.sin(2.2 * x + Math.cos(1.6 * y)) + 0.6 * Math.sin(2.9 * y + 2.1),\n  ];\n  for (let s = 0, k = 0; s < strands; s++) {\n    const u = rand() * 2 - 1;\n    const th = rand() * Math.PI * 2;\n    const r0 = rand() < 0.18 ? 0.25 + rand() * 0.4 : 0.62 + Math.pow(rand(), 0.7) * 0.42;\n    const sq = Math.sqrt(1 - u * u);\n    let x = sq * Math.cos(th) * r0;\n    let y = u * r0;\n    let z = sq * Math.sin(th) * r0;\n    const sd = rand();\n    for (let i = 0; i < steps; i++, k++) {\n      fPos[k * 3] = x;\n      fPos[k * 3 + 1] = y;\n      fPos[k * 3 + 2] = z;\n      fSeed[k] = sd;\n      let [fx, fy, fz] = field(x * 1.6, y * 1.6, z * 1.6);\n      const r = Math.hypot(x, y, z) || 1;\n      const dot = (fx * x + fy * y + fz * z) / r;\n      fx -= (dot * x) / r;\n      fy -= (dot * y) / r;\n      fz -= (dot * z) / r;\n      const len = Math.hypot(fx, fy, fz) || 1;\n      x += (fx / len) * 0.0062;\n      y += (fy / len) * 0.0062;\n      z += (fz / len) * 0.0062;\n    }\n  }\n\n  const glowCount = isTier2 ? 1100 : 2000;\n  const gPos = new Float32Array(glowCount * 3);\n  const gSeed = new Float32Array(glowCount);\n  for (let i = 0; i < glowCount; i++) {\n    const u = rand() * 2 - 1;\n    const th = rand() * Math.PI * 2;\n    const r = Math.pow(rand(), 0.6) * 0.62;\n    const sq = Math.sqrt(1 - u * u);\n    gPos[i * 3] = sq * Math.cos(th) * r;\n    gPos[i * 3 + 1] = u * r - 0.08;\n    gPos[i * 3 + 2] = sq * Math.sin(th) * r;\n    gSeed[i] = rand();\n  }\n\n  const res = { fPos, fSeed, strands, steps, gPos, gSeed, glowCount };\n  if (isTier2) cachedTier2Geo = res;\n  else cachedTier3Geo = res;\n  return res;\n}\n\nexport default function EmberCoreGL({\n  colors,\n  interactive,\n  heat,\n  swirl,\n  spin,\n  density,\n  bloom,\n  sound,\n  paused,\n  reducedMotion,\n  tier,\n  offsetX = 0,\n  lightTheme = false,\n  suspended = false,\n  strikeTrigger = 0,\n  resetTrigger = 0,\n  ariaLabel,\n  onToast,\n  onTogglePause,\n  onContextLost,\n  onContextRestored,\n  onDowngrade,\n}: EmberCoreGLProps) {\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const surfaceRef = useRef<Surface | null>(null);\n  const [tier2BloomOff, setTier2BloomOff] = useState(false);\n  const [isBusy, setIsBusy] = useState(false);\n\n  const isTier2 = tier <= 2;\n  const maxDpr = tier >= 3 ? 2.0 : 1.5;\n  const bloomActive = bloom && !(isTier2 && tier2BloomOff);\n\n  const propsRef = useRef({\n    colors,\n    interactive,\n    heat,\n    swirl,\n    spin,\n    density,\n    bloomActive,\n    sound,\n    paused,\n    reducedMotion,\n    isTier2,\n    offsetX,\n    lightTheme,\n    ariaLabel,\n    onToast,\n    onTogglePause,\n    onContextLost,\n    onContextRestored,\n    onDowngrade,\n  });\n\n  useEffect(() => {\n    propsRef.current = {\n      colors,\n      interactive,\n      heat,\n      swirl,\n      spin,\n      density,\n      bloomActive,\n      sound,\n      paused,\n      reducedMotion,\n      isTier2,\n      offsetX,\n      lightTheme,\n      ariaLabel,\n      onToast,\n      onTogglePause,\n      onContextLost,\n      onContextRestored,\n      onDowngrade,\n    };\n  });\n\n  // Simulation state ref\n  const simRef = useRef({\n    clock: 4,\n    flareT: -99,\n    nextAuto: 17,\n    burstT: -99,\n    burstAmp: 0,\n    charging: false,\n    charge: 0,\n    pointerTarget: 0,\n    uPointerOn: 0,\n    uPointer: [9, 9, 9] as [number, number, number],\n    uWaveO: [0, 0, 0.95] as [number, number, number],\n    uWaveT: 99,\n    uFlare: 0,\n    uBurst: 0,\n    velX: 0,\n    velY: 0,\n    lastInteract: -99,\n    quat: quatFromEulerX(0.35),\n    fitDist: 4,\n    zoom: 1,\n    zoomTarget: 1,\n    camX: 0,\n    camY: 0,\n    camZ: 4,\n    aspect: 1,\n    dpr: 1,\n    dragging: false,\n  });\n\n  // AudioContext ref (created only after a user gesture when sound is true)\n  const audioRef = useRef<AudioContext | null>(null);\n\n  const ensureAudio = useCallback(() => {\n    if (!propsRef.current.sound) return null;\n    if (!audioRef.current) {\n      const AC = window.AudioContext || (window as unknown as { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n      if (AC) {\n        try {\n          audioRef.current = new AC();\n        } catch {\n          return null;\n        }\n      }\n    }\n    if (audioRef.current && audioRef.current.state === \"suspended\") {\n      audioRef.current.resume().catch(() => {});\n    }\n    return audioRef.current;\n  }, []);\n\n  const noiseBurst = useCallback((dur: number, freq: number, gain: number) => {\n    const actx = ensureAudio();\n    if (!actx) return;\n    try {\n      const len = Math.floor(actx.sampleRate * dur);\n      const buf = actx.createBuffer(1, len, actx.sampleRate);\n      const ch = buf.getChannelData(0);\n      for (let i = 0; i < len; i++) {\n        ch[i] = (Math.random() * 2 - 1) * Math.pow(1 - i / len, 3) * (Math.random() < 0.08 ? 1 : 0.35);\n      }\n      const src = actx.createBufferSource();\n      src.buffer = buf;\n      const bp = actx.createBiquadFilter();\n      bp.type = \"bandpass\";\n      bp.frequency.value = freq;\n      bp.Q.value = 0.8;\n      const g = actx.createGain();\n      g.gain.value = gain;\n      src.connect(bp).connect(g).connect(actx.destination);\n      src.start();\n    } catch {\n      // Ignore audio errors\n    }\n  }, [ensureAudio]);\n\n  const thump = useCallback((amp: number) => {\n    const actx = ensureAudio();\n    if (!actx) return;\n    try {\n      const o = actx.createOscillator();\n      const g = actx.createGain();\n      const t = actx.currentTime;\n      o.type = \"sine\";\n      o.frequency.setValueAtTime(110, t);\n      o.frequency.exponentialRampToValueAtTime(38, t + 0.5);\n      g.gain.setValueAtTime(0.35 * amp, t);\n      g.gain.exponentialRampToValueAtTime(0.001, t + 0.7);\n      o.connect(g).connect(actx.destination);\n      o.start();\n      o.stop(t + 0.75);\n    } catch {\n      // Ignore audio errors\n    }\n  }, [ensureAudio]);\n\n  const drawNowRef = useRef<() => void>(() => {});\n  const stepSimRef = useRef<(dt: number) => void>(() => {});\n  const triggerStrikeRef = useRef<(at: [number, number, number] | null, auto?: boolean) => void>(() => {});\n  const prevSoundRef = useRef(sound);\n\n  useEffect(() => {\n    if (sound && !prevSoundRef.current) {\n      noiseBurst(0.3, 2400, 0.3);\n    }\n    prevSoundRef.current = sound;\n  });\n\n  useEffect(() => {\n    if (strikeTrigger > 0) {\n      triggerStrikeRef.current(null, false);\n    }\n  }, [strikeTrigger]);\n\n  useEffect(() => {\n    if (resetTrigger > 0) {\n      const s = simRef.current;\n      s.quat = quatFromEulerX(0.35);\n      s.velX = 0;\n      s.velY = 0;\n      s.zoomTarget = 1;\n      s.zoom = 1;\n      s.flareT = -99;\n      s.burstT = -99;\n      s.uFlare = 0;\n      s.uBurst = 0;\n      s.uWaveT = 99;\n      s.charge = 0;\n      s.charging = false;\n      drawNowRef.current();\n    }\n  }, [resetTrigger]);\n\n  const prevPausedRef = useRef(paused);\n  useEffect(() => {\n    if (!prevPausedRef.current && paused) {\n      const s = simRef.current;\n      s.velX = 0;\n      s.velY = 0;\n      s.zoom = s.zoomTarget;\n      s.charging = false;\n      s.charge = 0;\n      s.pointerTarget = 0;\n      s.uPointerOn = 0;\n      s.uWaveT = 99;\n      s.flareT = -99;\n      s.burstT = -99;\n      s.uFlare = 0;\n      s.uBurst = 0;\n      setIsBusy(false);\n    }\n    prevPausedRef.current = paused;\n  }, [paused]);\n\n  // Redraw when visual props change while paused or in reduced motion\n  useEffect(() => {\n    drawNowRef.current();\n  }, [colors, heat, swirl, spin, density, bloomActive, offsetX, lightTheme]);\n\n  useEffect(() => {\n    const container = containerRef.current;\n    if (!container) return;\n\n    const canvas = document.createElement(\"canvas\");\n    canvas.style.position = \"absolute\";\n    canvas.style.inset = \"0\";\n    canvas.style.width = \"100%\";\n    canvas.style.height = \"100%\";\n    canvas.style.display = \"block\";\n    canvas.style.zIndex = \"1\";\n\n    const applyInteractiveAttrs = () => {\n      const mode = propsRef.current.interactive;\n      if (mode === \"full\") {\n        canvas.tabIndex = 0;\n        canvas.setAttribute(\"role\", \"application\");\n        canvas.setAttribute(\n          \"aria-label\",\n          propsRef.current.ariaLabel ||\n            \"Ember Core: a sphere of ash filaments with fire inside. Drag to spin, scroll or pinch to zoom, click to strike, hold to charge and release to burst. Keyboard: arrow keys spin, Space strikes or charges when held, plus and minus zoom, P pauses.\"\n        );\n        canvas.removeAttribute(\"aria-hidden\");\n        canvas.style.touchAction = \"none\";\n        canvas.style.pointerEvents = \"auto\";\n        canvas.style.cursor = \"grab\";\n      } else if (mode === \"hero\") {\n        canvas.removeAttribute(\"tabindex\");\n        canvas.removeAttribute(\"role\");\n        canvas.removeAttribute(\"aria-label\");\n        canvas.setAttribute(\"aria-hidden\", \"true\");\n        canvas.style.touchAction = \"pan-y\";\n        canvas.style.pointerEvents = \"auto\";\n        canvas.style.cursor = \"grab\";\n      } else {\n        canvas.removeAttribute(\"tabindex\");\n        canvas.removeAttribute(\"role\");\n        canvas.removeAttribute(\"aria-label\");\n        canvas.setAttribute(\"aria-hidden\", \"true\");\n        canvas.style.touchAction = \"auto\";\n        canvas.style.pointerEvents = \"none\";\n        canvas.style.cursor = \"default\";\n      }\n    };\n    applyInteractiveAttrs();\n    container.appendChild(canvas);\n\n    const geo = buildGeometry(isTier2);\n    const modelMat = new Float32Array(16);\n    const viewMat = new Float32Array(16);\n    const projMat = new Float32Array(16);\n\n    let fProg: WebGLProgram | null = null;\n    let gProg: WebGLProgram | null = null;\n    let tProg: WebGLProgram | null = null;\n    let threshProg: WebGLProgram | null = null;\n    let blurProg: WebGLProgram | null = null;\n    let compProg: WebGLProgram | null = null;\n\n    let fVao: WebGLVertexArrayObject | null = null;\n    let fPosBuf: WebGLBuffer | null = null;\n    let fSeedBuf: WebGLBuffer | null = null;\n\n    let gVao: WebGLVertexArrayObject | null = null;\n    let gPosBuf: WebGLBuffer | null = null;\n    let gSeedBuf: WebGLBuffer | null = null;\n\n    let tVao: WebGLVertexArrayObject | null = null;\n    let tPosBuf: WebGLBuffer | null = null;\n\n    let sceneFbo: WebGLFramebuffer | null = null;\n    let sceneTex: WebGLTexture | null = null;\n    let pingFbo: WebGLFramebuffer | null = null;\n    let pingTex: WebGLTexture | null = null;\n    let pongFbo: WebGLFramebuffer | null = null;\n    let pongTex: WebGLTexture | null = null;\n    let fboW = 0;\n    let fboH = 0;\n\n    type LocMap = Record<string, WebGLUniformLocation | null>;\n    let fLoc: LocMap = {};\n    let gLoc: LocMap = {};\n    let tLoc: LocMap = {};\n    let threshLoc: LocMap = {};\n    let blurLoc: LocMap = {};\n    let compLoc: LocMap = {};\n\n    const getLocs = (gl: WebGL2RenderingContext, prog: WebGLProgram, names: string[]): LocMap => {\n      const m: LocMap = {};\n      for (const n of names) m[n] = gl.getUniformLocation(prog, n);\n      return m;\n    };\n\n    const deleteFbos = (gl: WebGL2RenderingContext) => {\n      if (sceneFbo) gl.deleteFramebuffer(sceneFbo);\n      if (sceneTex) gl.deleteTexture(sceneTex);\n      if (pingFbo) gl.deleteFramebuffer(pingFbo);\n      if (pingTex) gl.deleteTexture(pingTex);\n      if (pongFbo) gl.deleteFramebuffer(pongFbo);\n      if (pongTex) gl.deleteTexture(pongTex);\n      sceneFbo = pingFbo = pongFbo = null;\n      sceneTex = pingTex = pongTex = null;\n      fboW = 0;\n      fboH = 0;\n    };\n\n    const ensureFbos = (gl: WebGL2RenderingContext, w: number, h: number): boolean => {\n      if (fboW === w && fboH === h && sceneFbo && pingFbo && pongFbo) return true;\n      deleteFbos(gl);\n\n      const floatExt = gl.getExtension(\"EXT_color_buffer_float\");\n      gl.getExtension(\"OES_texture_float_linear\");\n      const internalFormat = floatExt ? gl.RGBA16F : gl.RGBA8;\n      const type = floatExt ? gl.HALF_FLOAT : gl.UNSIGNED_BYTE;\n\n      const makeTarget = (tw: number, th: number) => {\n        const tex = gl.createTexture();\n        const fbo = gl.createFramebuffer();\n        if (!tex || !fbo) return null;\n        gl.bindTexture(gl.TEXTURE_2D, tex);\n        gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, tw, th, 0, gl.RGBA, type, null);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n        gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);\n        const ok = gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE;\n        gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n        gl.bindTexture(gl.TEXTURE_2D, null);\n        if (!ok) {\n          gl.deleteFramebuffer(fbo);\n          gl.deleteTexture(tex);\n          return null;\n        }\n        return { tex, fbo };\n      };\n\n      const hw = Math.max(1, w >> 1);\n      const hh = Math.max(1, h >> 1);\n      const sTarget = makeTarget(w, h);\n      const aTarget = makeTarget(hw, hh);\n      const bTarget = makeTarget(hw, hh);\n      if (!sTarget || !aTarget || !bTarget) {\n        if (sTarget) { gl.deleteFramebuffer(sTarget.fbo); gl.deleteTexture(sTarget.tex); }\n        if (aTarget) { gl.deleteFramebuffer(aTarget.fbo); gl.deleteTexture(aTarget.tex); }\n        if (bTarget) { gl.deleteFramebuffer(bTarget.fbo); gl.deleteTexture(bTarget.tex); }\n        return false;\n      }\n      sceneFbo = sTarget.fbo; sceneTex = sTarget.tex;\n      pingFbo = aTarget.fbo; pingTex = aTarget.tex;\n      pongFbo = bTarget.fbo; pongTex = bTarget.tex;\n      fboW = w;\n      fboH = h;\n      return true;\n    };\n\n    const setupResources = (surface: Surface) => {\n      const gl = surface.gl;\n      sceneFbo = pingFbo = pongFbo = null;\n      sceneTex = pingTex = pongTex = null;\n      fboW = 0;\n      fboH = 0;\n      fProg = surface.createProgram(FILAMENT_VERT, FILAMENT_FRAG);\n      gProg = surface.createProgram(GLOW_VERT, GLOW_FRAG);\n      tProg = surface.createProgram(TORCH_VERT, TORCH_FRAG);\n      threshProg = surface.createProgram(POST_VERT, BLOOM_THRESHOLD_FRAG);\n      blurProg = surface.createProgram(POST_VERT, BLOOM_BLUR_FRAG);\n      compProg = surface.createProgram(POST_VERT, BLOOM_COMPOSITE_FRAG);\n\n      const commonNames = [\n        \"uModelMatrix\", \"uViewMatrix\", \"uProjMatrix\", \"uCameraPos\",\n        \"uTime\", \"uFlare\", \"uSize\", \"uPR\", \"uHeat\", \"uCharge\", \"uBurst\", \"uLightTheme\",\n        \"uAsh\", \"uEmber\", \"uHot\", \"uGA\", \"uGB\",\n        \"uPointer\", \"uPointerOn\", \"uSwirl\", \"uWaveT\", \"uWaveO\",\n      ];\n      fLoc = getLocs(gl, fProg, commonNames);\n      gLoc = getLocs(gl, gProg, commonNames);\n      tLoc = getLocs(gl, tProg, commonNames);\n      threshLoc = getLocs(gl, threshProg, [\"uTex\", \"uThreshold\"]);\n      blurLoc = getLocs(gl, blurProg, [\"uTex\", \"uDir\", \"uRadius\"]);\n      compLoc = getLocs(gl, compProg, [\"uSceneTex\", \"uBloomTex\", \"uStrength\", \"uLightTheme\", \"uPlateCenter\", \"uAspect\"]);\n\n      // Filaments VAO\n      fVao = gl.createVertexArray();\n      fPosBuf = gl.createBuffer();\n      fSeedBuf = gl.createBuffer();\n      gl.bindVertexArray(fVao);\n      gl.bindBuffer(gl.ARRAY_BUFFER, fPosBuf);\n      gl.bufferData(gl.ARRAY_BUFFER, geo.fPos, gl.STATIC_DRAW);\n      gl.enableVertexAttribArray(0);\n      gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);\n      gl.bindBuffer(gl.ARRAY_BUFFER, fSeedBuf);\n      gl.bufferData(gl.ARRAY_BUFFER, geo.fSeed, gl.STATIC_DRAW);\n      gl.enableVertexAttribArray(1);\n      gl.vertexAttribPointer(1, 1, gl.FLOAT, false, 0, 0);\n\n      // Glow VAO\n      gVao = gl.createVertexArray();\n      gPosBuf = gl.createBuffer();\n      gSeedBuf = gl.createBuffer();\n      gl.bindVertexArray(gVao);\n      gl.bindBuffer(gl.ARRAY_BUFFER, gPosBuf);\n      gl.bufferData(gl.ARRAY_BUFFER, geo.gPos, gl.STATIC_DRAW);\n      gl.enableVertexAttribArray(0);\n      gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);\n      gl.bindBuffer(gl.ARRAY_BUFFER, gSeedBuf);\n      gl.bufferData(gl.ARRAY_BUFFER, geo.gSeed, gl.STATIC_DRAW);\n      gl.enableVertexAttribArray(1);\n      gl.vertexAttribPointer(1, 1, gl.FLOAT, false, 0, 0);\n\n      // Torch VAO\n      tVao = gl.createVertexArray();\n      tPosBuf = gl.createBuffer();\n      gl.bindVertexArray(tVao);\n      gl.bindBuffer(gl.ARRAY_BUFFER, tPosBuf);\n      gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, 0]), gl.STATIC_DRAW);\n      gl.enableVertexAttribArray(0);\n      gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);\n\n      gl.bindVertexArray(null);\n      gl.bindBuffer(gl.ARRAY_BUFFER, null);\n    };\n\n    const updateCameraMetrics = () => {\n      const surface = surfaceRef.current;\n      if (!surface) return;\n      const rect = canvas.getBoundingClientRect();\n      const cw = Math.max(1, rect.width);\n      const ch = Math.max(1, rect.height);\n      const s = simRef.current;\n      s.aspect = cw / ch;\n      const v = FOV_RAD * 0.5;\n      const hz = Math.atan(Math.tan(v) * s.aspect);\n      s.fitDist = Math.max(1.22 / Math.tan(v), 1.18 / Math.tan(hz)) + 0.1;\n      s.camX = cw >= 860 ? propsRef.current.offsetX : 0;\n      s.camY = cw < ch ? 0.18 : 0;\n      s.camZ = s.fitDist * s.zoom;\n      s.dpr = Math.min(window.devicePixelRatio || 1, maxDpr);\n    };\n\n    const renderScene = () => {\n      const surface = surfaceRef.current;\n      if (!surface || !fProg || !gProg || !tProg) return;\n      const gl = surface.gl;\n      if (gl.isContextLost()) return;\n\n      updateCameraMetrics();\n      const s = simRef.current;\n      const p = propsRef.current;\n      const w = gl.drawingBufferWidth;\n      const h = gl.drawingBufferHeight;\n      if (w < 1 || h < 1) return;\n\n      mat4FromQuat(s.quat, modelMat);\n      mat4Translation(-s.camX, -s.camY, -s.camZ, viewMat);\n      mat4Perspective(FOV_RAD, s.aspect, 0.1, 50.0, projMat);\n\n      const useBloom = p.bloomActive && threshProg && blurProg && compProg && ensureFbos(gl, w, h);\n\n      gl.bindFramebuffer(gl.FRAMEBUFFER, useBloom ? sceneFbo : null);\n      gl.viewport(0, 0, w, h);\n      gl.disable(gl.DEPTH_TEST);\n      gl.depthMask(false);\n      gl.clearColor(0, 0, 0, 0);\n      gl.clear(gl.COLOR_BUFFER_BIT);\n\n      gl.enable(gl.BLEND);\n\n      const setCommonUniforms = (loc: LocMap) => {\n        if (loc.uModelMatrix) gl.uniformMatrix4fv(loc.uModelMatrix, false, modelMat);\n        if (loc.uViewMatrix) gl.uniformMatrix4fv(loc.uViewMatrix, false, viewMat);\n        if (loc.uProjMatrix) gl.uniformMatrix4fv(loc.uProjMatrix, false, projMat);\n        if (loc.uCameraPos) gl.uniform3f(loc.uCameraPos, s.camX, s.camY, s.camZ);\n        if (loc.uTime) gl.uniform1f(loc.uTime, s.clock);\n        if (loc.uFlare) gl.uniform1f(loc.uFlare, s.uFlare);\n        if (loc.uSize) gl.uniform1f(loc.uSize, p.isTier2 ? 3.5 : 3.0);\n        if (loc.uPR) gl.uniform1f(loc.uPR, s.dpr);\n        if (loc.uHeat) gl.uniform1f(loc.uHeat, p.heat);\n        if (loc.uCharge) gl.uniform1f(loc.uCharge, s.charge);\n        if (loc.uBurst) gl.uniform1f(loc.uBurst, s.uBurst);\n        if (loc.uLightTheme) gl.uniform1f(loc.uLightTheme, p.lightTheme ? 1.0 : 0.0);\n        if (loc.uSwirl) gl.uniform1f(loc.uSwirl, p.swirl);\n        if (loc.uPointer) gl.uniform3f(loc.uPointer, s.uPointer[0], s.uPointer[1], s.uPointer[2]);\n        if (loc.uPointerOn) gl.uniform1f(loc.uPointerOn, s.uPointerOn);\n        if (loc.uWaveT) gl.uniform1f(loc.uWaveT, s.uWaveT);\n        if (loc.uWaveO) gl.uniform3f(loc.uWaveO, s.uWaveO[0], s.uWaveO[1], s.uWaveO[2]);\n        if (loc.uAsh) gl.uniform3f(loc.uAsh, p.colors.ash[0], p.colors.ash[1], p.colors.ash[2]);\n        if (loc.uEmber) gl.uniform3f(loc.uEmber, p.colors.ember[0], p.colors.ember[1], p.colors.ember[2]);\n        if (loc.uHot) gl.uniform3f(loc.uHot, p.colors.hot[0], p.colors.hot[1], p.colors.hot[2]);\n        if (loc.uGA) gl.uniform3f(loc.uGA, p.colors.gA[0], p.colors.gA[1], p.colors.gA[2]);\n        if (loc.uGB) gl.uniform3f(loc.uGB, p.colors.gB[0], p.colors.gB[1], p.colors.gB[2]);\n      };\n\n      // 1. Filaments (premultiplied normal blending so ash strands build crisp volume without alpha squaring)\n      gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n      gl.useProgram(fProg);\n      setCommonUniforms(fLoc);\n      gl.bindVertexArray(fVao);\n      const drawCount = Math.floor(geo.strands * clamp(p.density, 0.2, 1)) * geo.steps;\n      gl.drawArrays(gl.POINTS, 0, drawCount);\n\n      // 2. Inner glow (additive)\n      gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n      gl.useProgram(gProg);\n      setCommonUniforms(gLoc);\n      gl.bindVertexArray(gVao);\n      gl.drawArrays(gl.POINTS, 0, geo.glowCount);\n\n      // 3. Pointer torch (additive)\n      if (s.uPointerOn > 0.005) {\n        gl.useProgram(tProg);\n        setCommonUniforms(tLoc);\n        gl.bindVertexArray(tVao);\n        gl.drawArrays(gl.POINTS, 0, 1);\n      }\n      gl.bindVertexArray(null);\n\n      // 4. Bloom passes (strength 0.75, radius 0.6, threshold 0.18)\n      if (useBloom && threshProg && blurProg && compProg) {\n        gl.disable(gl.BLEND);\n        const hw = Math.max(1, w >> 1);\n        const hh = Math.max(1, h >> 1);\n\n        // Threshold pass -> pingFbo\n        gl.bindFramebuffer(gl.FRAMEBUFFER, pingFbo);\n        gl.viewport(0, 0, hw, hh);\n        gl.useProgram(threshProg);\n        gl.activeTexture(gl.TEXTURE0);\n        gl.bindTexture(gl.TEXTURE_2D, sceneTex);\n        if (threshLoc.uTex) gl.uniform1i(threshLoc.uTex, 0);\n        if (threshLoc.uThreshold) gl.uniform1f(threshLoc.uThreshold, 0.18);\n        surface.draw();\n\n        // Two separable Gaussian blur passes (radius 0.6)\n        gl.useProgram(blurProg);\n        if (blurLoc.uTex) gl.uniform1i(blurLoc.uTex, 0);\n        if (blurLoc.uRadius) gl.uniform1f(blurLoc.uRadius, 0.6);\n\n        for (const scale of [2.0, 1.0]) {\n          gl.bindFramebuffer(gl.FRAMEBUFFER, pongFbo);\n          gl.bindTexture(gl.TEXTURE_2D, pingTex);\n          if (blurLoc.uDir) gl.uniform2f(blurLoc.uDir, scale / hw, 0);\n          surface.draw();\n\n          gl.bindFramebuffer(gl.FRAMEBUFFER, pingFbo);\n          gl.bindTexture(gl.TEXTURE_2D, pongTex);\n          if (blurLoc.uDir) gl.uniform2f(blurLoc.uDir, 0, scale / hh);\n          surface.draw();\n        }\n\n        // Composite pass -> screen\n        gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n        gl.viewport(0, 0, w, h);\n        gl.clearColor(0, 0, 0, 0);\n        gl.clear(gl.COLOR_BUFFER_BIT);\n        gl.useProgram(compProg);\n        gl.activeTexture(gl.TEXTURE0);\n        gl.bindTexture(gl.TEXTURE_2D, sceneTex);\n        if (compLoc.uSceneTex) gl.uniform1i(compLoc.uSceneTex, 0);\n        gl.activeTexture(gl.TEXTURE1);\n        gl.bindTexture(gl.TEXTURE_2D, pingTex);\n        if (compLoc.uBloomTex) gl.uniform1i(compLoc.uBloomTex, 1);\n        if (compLoc.uStrength) gl.uniform1f(compLoc.uStrength, 0.75);\n        if (compLoc.uLightTheme) gl.uniform1f(compLoc.uLightTheme, p.lightTheme ? 1.0 : 0.0);\n        if (compLoc.uPlateCenter) gl.uniform2f(compLoc.uPlateCenter, s.camX < -0.1 ? 0.58 : 0.5, 0.5);\n        if (compLoc.uAspect) gl.uniform1f(compLoc.uAspect, s.aspect);\n        surface.draw();\n        gl.activeTexture(gl.TEXTURE0);\n        gl.bindTexture(gl.TEXTURE_2D, null);\n      } else {\n        gl.disable(gl.BLEND);\n      }\n    };\n\n    const checkBusy = () => {\n      const s = simRef.current;\n      return (\n        s.dragging ||\n        s.charging ||\n        s.charge > 0.001 ||\n        Math.abs(s.velX) + Math.abs(s.velY) > 0.002 ||\n        Math.abs(s.zoomTarget - s.zoom) > 0.001 ||\n        Math.abs(s.pointerTarget - s.uPointerOn) > 0.01 ||\n        s.uWaveT < 3 ||\n        s.clock - s.burstT < 3 ||\n        s.clock - s.flareT < 3\n      );\n    };\n\n    const stepSim = (dt: number) => {\n      const s = simRef.current;\n      const p = propsRef.current;\n      s.clock += dt;\n      if (!p.paused && !p.reducedMotion && s.clock > s.nextAuto) {\n        if (s.clock - s.lastInteract > 6) {\n          triggerStrike(null, true);\n        }\n        s.nextAuto = s.clock + 13 + Math.random() * 6;\n      }\n      s.charge = s.charging ? Math.min(1, s.charge + dt * 0.55) : Math.max(0, s.charge - dt * 2.5);\n      if (s.charging && Math.random() < dt * 14 * s.charge) {\n        noiseBurst(0.06, 3000, 0.08 + s.charge * 0.12);\n      }\n      s.uFlare = envFlare(s.clock - s.flareT);\n      s.uBurst = envBurst(s.clock - s.burstT) * s.burstAmp;\n      s.uWaveT = Math.min(99, s.uWaveT + dt);\n      s.uPointerOn += (s.pointerTarget - s.uPointerOn) * Math.min(1, dt * 6);\n\n      if (!s.dragging) {\n        s.quat = quatRotateOnWorldAxis(s.quat, 1, 0, 0, s.velX * dt);\n        const idleSpin = p.paused || p.reducedMotion ? 0 : 0.06 * p.spin * dt;\n        s.quat = quatRotateOnWorldAxis(s.quat, 0, 1, 0, s.velY * dt + idleSpin);\n        const damp = Math.exp(-dt * 2.2);\n        s.velX *= damp;\n        s.velY *= damp;\n      }\n      s.zoom += (s.zoomTarget - s.zoom) * Math.min(1, dt * 7);\n      s.camZ = s.fitDist * s.zoom;\n    };\n\n    let reducedMotionFlareTimer = 0;\n\n    const triggerStrike = (at: [number, number, number] | null, auto = false) => {\n      const s = simRef.current;\n      const p = propsRef.current;\n      s.uWaveO = at ? [at[0], at[1], at[2]] : [0, 0, 0.95];\n      if (!auto) noiseBurst(0.45, 2200, 0.5);\n\n      if (p.reducedMotion) {\n        // Reduced motion: mode still-frame. A strike shows one flared frame, then returns.\n        window.clearTimeout(reducedMotionFlareTimer);\n        s.uFlare = 1.0;\n        s.uWaveT = 0.22;\n        renderScene();\n        reducedMotionFlareTimer = window.setTimeout(() => {\n          s.uFlare = 0;\n          s.uWaveT = 99;\n          renderScene();\n        }, 900);\n        return;\n      }\n\n      s.flareT = s.clock;\n      s.uWaveT = 0;\n      if (!auto) {\n        s.lastInteract = s.clock;\n        setIsBusy(true);\n      }\n    };\n\n    const startCharge = () => {\n      const s = simRef.current;\n      const p = propsRef.current;\n      if (p.reducedMotion) return;\n      s.charging = true;\n      s.lastInteract = s.clock;\n      p.onToast?.(\"Charging… release to burst\");\n      setIsBusy(true);\n    };\n\n    const releaseCharge = (at: [number, number, number] | null) => {\n      const s = simRef.current;\n      const p = propsRef.current;\n      if (!s.charging) return;\n      s.charging = false;\n      s.burstT = s.clock;\n      s.burstAmp = 0.25 + s.charge * 0.95;\n      triggerStrike(at, false);\n      thump(0.4 + s.charge);\n      noiseBurst(0.9, 900, 0.4 + s.charge * 0.4);\n      p.onToast?.(s.charge > 0.8 ? \"Full burst\" : \"Burst\");\n      setIsBusy(true);\n    };\n\n    drawNowRef.current = renderScene;\n    stepSimRef.current = (dt: number) => {\n      stepSim(dt);\n      renderScene();\n      const busyNow = checkBusy();\n      setIsBusy((prev) => (prev !== busyNow ? busyNow : prev));\n    };\n    triggerStrikeRef.current = triggerStrike;\n\n    // Raycast pointer onto the sphere (r=1.1) or camera-facing plane through origin\n    const pointerToWorld = (clientX: number, clientY: number, out: [number, number, number]): number => {\n      updateCameraMetrics();\n      const rect = canvas.getBoundingClientRect();\n      if (rect.width < 1 || rect.height < 1) return 0;\n      const ndcX = ((clientX - rect.left) / rect.width) * 2 - 1;\n      const ndcY = -((clientY - rect.top) / rect.height) * 2 + 1;\n      const s = simRef.current;\n      const tanHalf = Math.tan(FOV_RAD * 0.5);\n      let dx = ndcX * s.aspect * tanHalf;\n      let dy = ndcY * tanHalf;\n      let dz = -1;\n      const len = Math.hypot(dx, dy, dz) || 1;\n      dx /= len; dy /= len; dz /= len;\n\n      const ox = s.camX, oy = s.camY, oz = s.camZ;\n      const rBall = 1.1;\n      const b = ox * dx + oy * dy + oz * dz;\n      const c = ox * ox + oy * oy + oz * oz - rBall * rBall;\n      const disc = b * b - c;\n      if (disc >= 0) {\n        const sq = Math.sqrt(disc);\n        const t = -b - sq >= 0 ? -b - sq : -b + sq;\n        if (t >= 0) {\n          out[0] = ox + t * dx;\n          out[1] = oy + t * dy;\n          out[2] = oz + t * dz;\n          return 1;\n        }\n      }\n      if (Math.abs(dz) > 1e-5) {\n        const t = -oz / dz;\n        if (t > 0) {\n          out[0] = ox + t * dx;\n          out[1] = oy + t * dy;\n          out[2] = 0;\n          const d = Math.hypot(out[0], out[1], out[2]);\n          return d < 1.9 ? Math.max(0, 1 - (d - 1.1) / 0.8) : 0;\n        }\n      }\n      return 0;\n    };\n\n    // Pointer gestures\n    const pts = new Map<number, { x: number; y: number }>();\n    let downX = 0;\n    let downY = 0;\n    let downT = 0;\n    let holdTimer = 0;\n    let pinchD = 0;\n    let pinched = false;\n    let lastMoveT = 0;\n    const hit: [number, number, number] = [9, 9, 9];\n\n    const onPointerDown = (e: PointerEvent) => {\n      const mode = propsRef.current.interactive;\n      if (mode === \"none\") return;\n      const s = simRef.current;\n      const isTouch = e.pointerType !== \"mouse\";\n\n      if (mode === \"full\") {\n        canvas.focus({ preventScroll: true });\n      }\n      if (mode === \"full\" || !isTouch) {\n        try {\n          canvas.setPointerCapture(e.pointerId);\n        } catch {\n          // Ignore capture errors on synthetic events\n        }\n      }\n\n      pts.set(e.pointerId, { x: e.clientX, y: e.clientY });\n      if (mode === \"full\" && pts.size === 2) {\n        const [a, b] = [...pts.values()];\n        pinchD = Math.hypot(a.x - b.x, a.y - b.y);\n        pinched = true;\n        window.clearTimeout(holdTimer);\n        s.charging = false;\n        s.dragging = false;\n        return;\n      }\n      if (pts.size > 2) return;\n\n      pinched = false;\n      downX = e.clientX;\n      downY = e.clientY;\n      downT = performance.now();\n      s.dragging = false;\n      s.velX = 0;\n      s.velY = 0;\n      s.pointerTarget = pointerToWorld(e.clientX, e.clientY, hit);\n      s.uPointer = [hit[0], hit[1], hit[2]];\n\n      // In \"hero\" mode, no hold-to-charge on touch\n      if (!(mode === \"hero\" && isTouch)) {\n        holdTimer = window.setTimeout(() => {\n          if (!s.dragging && !pinched) startCharge();\n        }, 280);\n      }\n      setIsBusy(true);\n    };\n\n    const onPointerMove = (e: PointerEvent) => {\n      const mode = propsRef.current.interactive;\n      if (mode === \"none\") return;\n      const s = simRef.current;\n      const isTouch = e.pointerType !== \"mouse\";\n      const prev = pts.get(e.pointerId);\n\n      if (mode === \"full\" && pts.size >= 2 && prev) {\n        prev.x = e.clientX;\n        prev.y = e.clientY;\n        const [a, b] = [...pts.values()];\n        const d = Math.hypot(a.x - b.x, a.y - b.y);\n        if (pinchD && d) {\n          s.zoomTarget = clamp(s.zoomTarget * (pinchD / d), ZMIN, ZMAX);\n          if (propsRef.current.reducedMotion) {\n            s.zoom = s.zoomTarget;\n            renderScene();\n          }\n        }\n        pinchD = d;\n        setIsBusy(true);\n        return;\n      }\n\n      s.pointerTarget = pointerToWorld(e.clientX, e.clientY, hit);\n      s.uPointer = [hit[0], hit[1], hit[2]];\n\n      if (prev && !pinched) {\n        const dx = e.clientX - prev.x;\n        const dy = e.clientY - prev.y;\n        prev.x = e.clientX;\n        prev.y = e.clientY;\n        const totalDx = Math.abs(e.clientX - downX);\n        const totalDy = Math.abs(e.clientY - downY);\n\n        if (!s.dragging && Math.hypot(totalDx, totalDy) > 6) {\n          // In \"hero\" mode, only horizontal touch drags spin\n          if (mode === \"hero\" && isTouch && totalDy > totalDx) {\n            window.clearTimeout(holdTimer);\n            s.charging = false;\n            pts.delete(e.pointerId);\n            return;\n          }\n          s.dragging = true;\n          window.clearTimeout(holdTimer);\n          canvas.style.cursor = \"grabbing\";\n          s.charging = false;\n        }\n        if (s.dragging) {\n          const k = 0.0055;\n          s.quat = quatRotateOnWorldAxis(s.quat, 0, 1, 0, dx * k);\n          if (!(mode === \"hero\" && isTouch)) {\n            s.quat = quatRotateOnWorldAxis(s.quat, 1, 0, 0, dy * k);\n          }\n          const now = performance.now();\n          const dt = Math.max(8, now - lastMoveT) / 1000;\n          lastMoveT = now;\n          const vxTarget = mode === \"hero\" && isTouch ? 0 : (dy * k) / dt;\n          const vyTarget = (dx * k) / dt;\n          s.velX = s.velX + (vxTarget - s.velX) * 0.5;\n          s.velY = s.velY + (vyTarget - s.velY) * 0.5;\n          if (propsRef.current.reducedMotion) {\n            renderScene();\n          }\n        }\n      }\n\n      s.lastInteract = s.clock;\n      if (!propsRef.current.reducedMotion) {\n        setIsBusy(true);\n      }\n    };\n\n    const endPointer = (e: PointerEvent) => {\n      const wasDown = pts.delete(e.pointerId);\n      if (pts.size > 0) {\n        pinchD = 0;\n        return;\n      }\n      window.clearTimeout(holdTimer);\n      canvas.style.cursor = propsRef.current.interactive === \"none\" ? \"default\" : \"grab\";\n      if (!wasDown) return;\n      const s = simRef.current;\n      const at: [number, number, number] | null = s.pointerTarget > 0.2 ? [hit[0], hit[1], hit[2]] : null;\n      if (!pinched) {\n        if (s.charging) releaseCharge(at);\n        else if (!s.dragging && performance.now() - downT < 280 && e.type === \"pointerup\") triggerStrike(at, false);\n      }\n      s.charging = false;\n      if (e.pointerType !== \"mouse\") s.pointerTarget = 0;\n      if (performance.now() - lastMoveT > 90) {\n        s.velX *= 0.2;\n        s.velY *= 0.2;\n      }\n      s.dragging = false;\n      pinched = false;\n      if (!propsRef.current.reducedMotion) {\n        setIsBusy(true);\n      }\n    };\n\n    const onPointerLeave = (e: PointerEvent) => {\n      if (!pts.has(e.pointerId)) {\n        simRef.current.pointerTarget = 0;\n        if (!propsRef.current.reducedMotion) {\n          setIsBusy(true);\n        }\n      }\n    };\n\n    const onWheel = (e: WheelEvent) => {\n      if (propsRef.current.interactive !== \"full\") return;\n      e.preventDefault();\n      const s = simRef.current;\n      s.zoomTarget = clamp(s.zoomTarget * Math.exp(e.deltaY * 0.0012), ZMIN, ZMAX);\n      if (propsRef.current.reducedMotion) {\n        s.zoom = s.zoomTarget;\n        renderScene();\n      } else {\n        setIsBusy(true);\n      }\n    };\n\n    // Keyboard controls on the focused canvas\n    let spaceDown = false;\n    let keyHold = 0;\n    const onKeyDown = (e: KeyboardEvent) => {\n      if (propsRef.current.interactive !== \"full\") return;\n      const s = simRef.current;\n      if (e.key === \"ArrowLeft\") s.velY -= 1.6;\n      else if (e.key === \"ArrowRight\") s.velY += 1.6;\n      else if (e.key === \"ArrowUp\") s.velX -= 1.6;\n      else if (e.key === \"ArrowDown\") s.velX += 1.6;\n      else if (e.key === \"+\" || e.key === \"=\") s.zoomTarget = Math.max(ZMIN, s.zoomTarget - 0.18);\n      else if (e.key === \"-\" || e.key === \"_\") s.zoomTarget = Math.min(ZMAX, s.zoomTarget + 0.18);\n      else if (e.key === \" \" || e.key === \"Enter\") {\n        if (!spaceDown) {\n          spaceDown = true;\n          keyHold = window.setTimeout(startCharge, 280);\n        }\n      } else if (e.key === \"p\" || e.key === \"P\") {\n        e.preventDefault();\n        propsRef.current.onTogglePause?.();\n        return;\n      } else {\n        return;\n      }\n      e.preventDefault();\n      s.lastInteract = s.clock;\n      if (propsRef.current.reducedMotion) {\n        s.quat = quatRotateOnWorldAxis(s.quat, 1, 0, 0, s.velX * 0.12);\n        s.quat = quatRotateOnWorldAxis(s.quat, 0, 1, 0, s.velY * 0.12);\n        s.velX = 0;\n        s.velY = 0;\n        s.zoom = s.zoomTarget;\n        renderScene();\n      } else {\n        setIsBusy(true);\n      }\n    };\n\n    const onKeyUp = (e: KeyboardEvent) => {\n      if ((e.key !== \" \" && e.key !== \"Enter\") || !spaceDown) return;\n      window.clearTimeout(keyHold);\n      spaceDown = false;\n      if (simRef.current.charging) releaseCharge(null);\n      else triggerStrike(null, false);\n    };\n\n    canvas.addEventListener(\"pointerdown\", onPointerDown);\n    canvas.addEventListener(\"pointermove\", onPointerMove);\n    canvas.addEventListener(\"pointerup\", endPointer);\n    canvas.addEventListener(\"pointercancel\", endPointer);\n    canvas.addEventListener(\"pointerleave\", onPointerLeave);\n    if (propsRef.current.interactive === \"full\") {\n      canvas.addEventListener(\"wheel\", onWheel, { passive: false });\n      canvas.addEventListener(\"keydown\", onKeyDown);\n      canvas.addEventListener(\"keyup\", onKeyUp);\n    }\n\n    try {\n      const surface = createSurface(canvas, {\n        maxDpr,\n        scale: 1.0,\n        onContextLost: () => {\n          canvas.style.display = \"none\";\n          propsRef.current.onContextLost?.();\n        },\n        onContextRestored: () => {\n          canvas.style.display = \"block\";\n          if (surfaceRef.current) {\n            setupResources(surfaceRef.current);\n            renderScene();\n          }\n          propsRef.current.onContextRestored?.();\n        },\n      }); // @frictionborn-guard\n\n      surfaceRef.current = surface;\n      setupResources(surface);\n      stepSim(0);\n      renderScene();\n    } catch (err) {\n      console.warn(\"EmberCore WebGL2 initialization failed; falling back to poster\", err);\n      if (surfaceRef.current) {\n        surfaceRef.current.dispose(); // @frictionborn-guard\n        surfaceRef.current = null;\n      }\n      propsRef.current.onContextLost?.();\n    }\n\n    return () => {\n      window.clearTimeout(holdTimer);\n      window.clearTimeout(keyHold);\n      window.clearTimeout(reducedMotionFlareTimer);\n      canvas.removeEventListener(\"pointerdown\", onPointerDown);\n      canvas.removeEventListener(\"pointermove\", onPointerMove);\n      canvas.removeEventListener(\"pointerup\", endPointer);\n      canvas.removeEventListener(\"pointercancel\", endPointer);\n      canvas.removeEventListener(\"pointerleave\", onPointerLeave);\n      canvas.removeEventListener(\"wheel\", onWheel);\n      canvas.removeEventListener(\"keydown\", onKeyDown);\n      canvas.removeEventListener(\"keyup\", onKeyUp);\n\n      if (surfaceRef.current) {\n        const gl = surfaceRef.current.gl;\n        if (!gl.isContextLost()) {\n          deleteFbos(gl);\n          if (fPosBuf) gl.deleteBuffer(fPosBuf);\n          if (fSeedBuf) gl.deleteBuffer(fSeedBuf);\n          if (gPosBuf) gl.deleteBuffer(gPosBuf);\n          if (gSeedBuf) gl.deleteBuffer(gSeedBuf);\n          if (tPosBuf) gl.deleteBuffer(tPosBuf);\n          if (fVao) gl.deleteVertexArray(fVao);\n          if (gVao) gl.deleteVertexArray(gVao);\n          if (tVao) gl.deleteVertexArray(tVao);\n        }\n        surfaceRef.current.dispose(); // @frictionborn-guard\n        surfaceRef.current = null;\n      }\n      if (audioRef.current) {\n        audioRef.current.close().catch(() => {});\n        audioRef.current = null;\n      }\n      canvas.remove();\n    };\n  }, [isTier2, maxDpr, interactive, noiseBurst, thump]);\n\n  const loopActive = !suspended && !reducedMotion && (!paused || isBusy);\n\n  // Frame rate monitoring and automated downgrade (Tier 2 falls back to no bloom first if frame budget fails)\n  useFrameGuard({\n    onDowngrade: () => {\n      if (isTier2 && bloom && !tier2BloomOff) {\n        setTier2BloomOff(true);\n      } else {\n        onDowngrade?.();\n      }\n    },\n    active: loopActive,\n  }); // @frictionborn-guard\n\n  useFrame(\n    ({ dt }) => {\n      const stepDt = Math.min(0.05, dt * 0.001);\n      stepSimRef.current(stepDt);\n    },\n    { active: loopActive } // @frictionborn-guard\n  );\n\n  return (\n    <div\n      ref={containerRef}\n      className=\"fb-ec-gl-wrap\"\n      aria-hidden={interactive === \"full\" ? undefined : \"true\"}\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        width: \"100%\",\n        height: \"100%\",\n        overflow: \"hidden\",\n        pointerEvents: interactive === \"none\" ? \"none\" : \"auto\",\n        zIndex: 1,\n        visibility: suspended ? \"hidden\" : \"visible\",\n      }}\n    />\n  );\n}\n",
          "type": "registry:ui",
          "target": "components/ui/ember-core.gl.tsx"
        },
        {
          "path": "registry/items/ember-core/ember-core.glsl.ts",
          "content": "// Original — Frictionborn Motion \"Ember Core\" GLSL shaders (ash filaments, inner glow, pointer torch, and bloom passes)\n// Source: https://github.com/stegu/webgl-noise — MIT — Copyright (C) 2011 Ashima Arts, Stefan Gustavson\n\nexport const NOISE_GLSL = /* glsl */ `\nvec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}\nvec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}\nvec4 permute(vec4 x){return mod289(((x*34.0)+10.0)*x);}\nvec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}\nfloat snoise(vec3 v){\n  const vec2 C=vec2(1.0/6.0,1.0/3.0); const vec4 D=vec4(0.0,0.5,1.0,2.0);\n  vec3 i=floor(v+dot(v,C.yyy)); vec3 x0=v-i+dot(i,C.xxx);\n  vec3 g=step(x0.yzx,x0.xyz); vec3 l=1.0-g; vec3 i1=min(g.xyz,l.zxy); vec3 i2=max(g.xyz,l.zxy);\n  vec3 x1=x0-i1+C.xxx; vec3 x2=x0-i2+C.yyy; vec3 x3=x0-D.yyy;\n  i=mod289(i);\n  vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));\n  float n_=0.142857142857; vec3 ns=n_*D.wyz-D.xzx;\n  vec4 j=p-49.0*floor(p*ns.z*ns.z); vec4 x_=floor(j*ns.z); vec4 y_=floor(j-7.0*x_);\n  vec4 x=x_*ns.x+ns.yyyy; vec4 y=y_*ns.x+ns.yyyy; vec4 h=1.0-abs(x)-abs(y);\n  vec4 b0=vec4(x.xy,y.xy); vec4 b1=vec4(x.zw,y.zw);\n  vec4 s0=floor(b0)*2.0+1.0; vec4 s1=floor(b1)*2.0+1.0; vec4 sh=-step(h,vec4(0.0));\n  vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy; vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;\n  vec3 p0=vec3(a0.xy,h.x); vec3 p1=vec3(a0.zw,h.y); vec3 p2=vec3(a1.xy,h.z); vec3 p3=vec3(a1.zw,h.w);\n  vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));\n  p0*=norm.x; p1*=norm.y; p2*=norm.z; p3*=norm.w;\n  vec4 m=max(0.5-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0); m=m*m;\n  return 105.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));\n}`;\n\nexport const EFFECTS_GLSL = /* glsl */ `\nuniform vec3 uPointer, uWaveO, uCameraPos;\nuniform float uPointerOn, uSwirl, uWaveT;\n// Moves w in place and returns the extra heat it picked up.\nfloat effects(inout vec3 w, float t){\n  vec3 toP = w - uPointer;\n  float fall = uPointerOn * exp(-dot(toP, toP) * 6.5);\n  // Vortex: rotate around the view axis through the pointer, like a hand through smoke.\n  vec3 axis = normalize(uCameraPos - uPointer);\n  float ang = fall * uSwirl * (1.5 + 0.5 * sin(t * 1.3));\n  float c = cos(ang), s = sin(ang);\n  vec3 rot = toP * c + cross(axis, toP) * s + axis * dot(axis, toP) * (1.0 - c);\n  w = uPointer + rot + normalize(toP + 1e-4) * fall * 0.09 * uSwirl;\n  float heat = fall * 1.3;\n  if (uWaveT < 3.0) {\n    float dw = distance(w, uWaveO);\n    float band = exp(-pow((dw - uWaveT * 1.9) * 6.5, 2.0)) * exp(-uWaveT * 1.1);\n    w += normalize(w + 1e-4) * band * 0.15;\n    heat += band * 1.8;\n  }\n  return heat;\n}`;\n\nexport const FILAMENT_VERT = `#version 300 es\nprecision highp float;\n\nlayout(location = 0) in vec3 position;\nlayout(location = 1) in float aSeed;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjMatrix;\nuniform float uTime, uFlare, uSize, uPR, uHeat, uCharge, uBurst, uLightTheme;\nuniform vec3 uAsh, uEmber, uHot;\n\nout vec3 vColor;\nout float vAlpha;\n\n${NOISE_GLSL}\n${EFFECTS_GLSL}\n\nvoid main(){\n  vec3 p = position;\n  float t = uTime * 0.07;\n  vec3 q = p * 1.25;\n  vec3 disp = vec3(\n    snoise(q + vec3(t, 0.0, 0.0)),\n    snoise(q + vec3(0.0, t + 13.1, 0.0)),\n    snoise(q + vec3(0.0, 0.0, t + 27.3))\n  );\n  p += disp * (0.16 + uFlare * 0.06);\n  p *= 1.0 + 0.025 * sin(uTime * 0.45 + aSeed * 6.2831) + uFlare * 0.07;\n  // Charge: the cloud pulls in and trembles. Burst: it flies out, then springs back.\n  p *= 1.0 - uCharge * 0.14;\n  p += disp * uCharge * 0.05 * sin(uTime * 40.0 + aSeed * 30.0);\n  p += normalize(p + 1e-4) * uBurst * (0.35 + aSeed * 1.1);\n\n  vec3 w = (uModelMatrix * vec4(p, 1.0)).xyz;\n  float extra = effects(w, uTime);\n\n  float r = length(position);\n  float n = snoise(p * 1.15 - vec3(0.0, uTime * 0.11, 0.0)) * 0.5 + 0.5;\n  float heat = smoothstep(0.66, 1.08, n + (1.0 - r) * 0.6 - p.y * 0.28) * uHeat;\n  heat += extra + uFlare * 0.85 * smoothstep(1.25, 0.2, r) + uCharge * 1.1 * smoothstep(1.1, 0.3, r) + uBurst * 0.9;\n\n  vec3 ashTone = mix(uAsh, vec3(0.92, 0.88, 0.84), uLightTheme * 0.44);\n  vec3 c = mix(ashTone, uEmber, clamp(heat, 0.0, 1.0));\n  c = mix(c, uHot, clamp(heat - 1.0, 0.0, 1.0));\n  c *= 1.0 + clamp(heat, 0.0, 1.5) * 0.32;\n  vColor = c;\n  float baseAlpha = mix(0.46, 0.64, uLightTheme);\n  vAlpha = clamp((mix(baseAlpha, 0.86, clamp(heat, 0.0, 1.0)) + uBurst * 0.16) * (0.65 + 0.35 * aSeed), 0.0, 1.0);\n\n  vec4 mv = uViewMatrix * vec4(w, 1.0);\n  gl_Position = uProjMatrix * mv;\n  gl_PointSize = uSize * uPR * (0.55 + aSeed * 0.82) * (3.0 / max(0.1, -mv.z));\n}\n`;\n\nexport const FILAMENT_FRAG = `#version 300 es\nprecision highp float;\n\nin vec3 vColor;\nin float vAlpha;\nout vec4 fragColor;\n\nvoid main(){\n  float a = smoothstep(0.5, 0.0, length(gl_PointCoord - 0.5));\n  fragColor = vec4(vColor * a * vAlpha, a * vAlpha);\n}\n`;\n\nexport const GLOW_VERT = `#version 300 es\nprecision highp float;\n\nlayout(location = 0) in vec3 position;\nlayout(location = 1) in float aSeed;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjMatrix;\nuniform float uTime, uFlare, uPR, uHeat, uCharge, uBurst;\n\nout float vI;\n\n${NOISE_GLSL}\n${EFFECTS_GLSL}\n\nvoid main(){\n  vec3 p = position;\n  p *= 1.0 - uCharge * 0.2;\n  p += normalize(p + 1e-4) * uBurst * (0.2 + aSeed * 0.6);\n  float n = snoise(p * 1.6 - vec3(0.0, uTime * 0.13, 0.0)) * 0.5 + 0.5;\n  vec3 w = (uModelMatrix * vec4(p, 1.0)).xyz;\n  float extra = effects(w, uTime);\n  vI = ((smoothstep(0.35, 1.0, n) * 0.13 + 0.022) * (1.0 - clamp(p.y, -0.5, 0.6) * 0.9)) * uHeat\n     + uFlare * 0.17 + uCharge * 0.22 + uBurst * 0.16 + extra * 0.03;\n  vec4 mv = uViewMatrix * vec4(w, 1.0);\n  gl_Position = uProjMatrix * mv;\n  gl_PointSize = (80.0 + aSeed * 70.0) * uPR * (3.0 / max(0.1, -mv.z)) * (1.0 + uFlare * 0.5 + uCharge * 0.3 + uBurst * 0.35);\n}\n`;\n\nexport const GLOW_FRAG = `#version 300 es\nprecision highp float;\n\nuniform vec3 uGA, uGB;\nin float vI;\nout vec4 fragColor;\n\nvoid main(){\n  float d = length(gl_PointCoord - 0.5);\n  float a = exp(-d * d * 18.0);\n  vec3 c = mix(uGA, uGB, a * a);\n  fragColor = vec4(c * a * vI, a * vI);\n}\n`;\n\nexport const TORCH_VERT = `#version 300 es\nprecision highp float;\n\nlayout(location = 0) in vec3 position;\n\nuniform mat4 uViewMatrix;\nuniform mat4 uProjMatrix;\nuniform vec3 uPointer;\nuniform float uPointerOn, uPR, uTime;\n\nvoid main(){\n  vec4 mv = uViewMatrix * vec4(uPointer + position * 0.0, 1.0);\n  gl_Position = uProjMatrix * mv;\n  gl_PointSize = (110.0 + 14.0 * sin(uTime * 9.0)) * uPR * (3.0 / max(0.1, -mv.z)) * uPointerOn;\n}\n`;\n\nexport const TORCH_FRAG = `#version 300 es\nprecision highp float;\n\nuniform vec3 uGB, uHot;\nuniform float uPointerOn;\nout vec4 fragColor;\n\nvoid main(){\n  float d = length(gl_PointCoord - 0.5);\n  float a = (exp(-d * d * 30.0) * 0.45 + exp(-d * d * 200.0) * 0.5) * uPointerOn;\n  fragColor = vec4(mix(uGB, uHot, exp(-d * d * 120.0)) * a, a);\n}\n`;\n\nexport const POST_VERT = `#version 300 es\nprecision highp float;\n\nlayout(location = 0) in vec2 position;\nout vec2 vUv;\n\nvoid main(){\n  vUv = position * 0.5 + 0.5;\n  gl_Position = vec4(position, 0.0, 1.0);\n}\n`;\n\nexport const BLOOM_THRESHOLD_FRAG = `#version 300 es\nprecision highp float;\n\nuniform sampler2D uTex;\nuniform float uThreshold;\nin vec2 vUv;\nout vec4 fragColor;\n\nvoid main(){\n  vec4 c = texture(uTex, vUv);\n  float lum = dot(c.rgb, vec3(0.299, 0.587, 0.114));\n  float knee = 0.08;\n  float w = smoothstep(uThreshold, uThreshold + knee, lum);\n  fragColor = vec4(c.rgb * w, c.a * w);\n}\n`;\n\nexport const BLOOM_BLUR_FRAG = `#version 300 es\nprecision highp float;\n\nuniform sampler2D uTex;\nuniform vec2 uDir;\nuniform float uRadius;\nin vec2 vUv;\nout vec4 fragColor;\n\nvoid main(){\n  // 5-sample hardware bilinear taps (9-tap 1D Gaussian weights at 1 texel, stretched by uRadius for a wider soft bloom)\n  vec2 stepUv = uDir * (0.5 + uRadius * 1.4);\n  vec4 sum = texture(uTex, vUv) * 0.227027;\n  sum += texture(uTex, vUv + stepUv * 1.384615) * 0.316216;\n  sum += texture(uTex, vUv - stepUv * 1.384615) * 0.316216;\n  sum += texture(uTex, vUv + stepUv * 3.230769) * 0.070270;\n  sum += texture(uTex, vUv - stepUv * 3.230769) * 0.070270;\n  fragColor = sum;\n}\n`;\n\nexport const BLOOM_COMPOSITE_FRAG = `#version 300 es\nprecision highp float;\n\nuniform sampler2D uSceneTex;\nuniform sampler2D uBloomTex;\nuniform float uStrength;\nuniform float uLightTheme;\nuniform vec2 uPlateCenter;\nuniform float uAspect;\nin vec2 vUv;\nout vec4 fragColor;\n\nvoid main(){\n  vec4 scene = texture(uSceneTex, vUv);\n  vec4 bloom = texture(uBloomTex, vUv) * uStrength;\n  vec3 rgb = scene.rgb + bloom.rgb;\n  float bloomA = max(bloom.r, max(bloom.g, bloom.b));\n  float a = clamp(scene.a + bloomA, 0.0, 1.0);\n  if (uLightTheme > 0.5) {\n    vec2 d = (vUv - vec2(0.5)) * 2.0;\n    float dist = length(d);\n    float edgeMask = 1.0 - smoothstep(0.46, 0.82, dist);\n    float plateA = (1.0 - smoothstep(0.32, 0.78, dist)) * 0.94;\n    vec3 plateRgb = mix(vec3(0.045, 0.039, 0.035), vec3(0.095, 0.084, 0.076), smoothstep(0.0, 0.74, dist));\n    rgb = rgb * edgeMask + plateRgb * plateA * (1.0 - clamp(a * edgeMask * 0.88, 0.0, 1.0));\n    a = clamp(a * edgeMask + plateA * (1.0 - a * edgeMask), 0.0, 1.0);\n  }\n  fragColor = vec4(rgb, a);\n}\n`;\n",
          "type": "registry:ui",
          "target": "components/ui/ember-core.glsl.ts"
        },
        {
          "path": "registry/items/ember-core/ember-core.tsx",
          "content": "// Original — Frictionborn Motion EmberCore wrapper (3D ash & ember filament cloud, lazy WebGL2 behind CSS poster)\n\"use client\";\n\nimport React, {\n  Suspense,\n  lazy,\n  useCallback,\n  useEffect,\n  useId,\n  useImperativeHandle,\n  useRef,\n  useState,\n} from \"react\";\nimport {\n  glBudget,\n  paletteVars,\n  resolveCssColor,\n  useCapability,\n  useHydrated,\n  useInView,\n  usePaused,\n  useReducedMotion,\n  type Lease,\n  type PaletteName,\n} from \"@frictionborn/runtime\";\nimport type { EmberCorePaletteRGB, RGB } from \"./ember-core.gl\";\n\nconst EmberCoreGL = lazy(() => import(\"./ember-core.gl\"));\n\nexport type EmberCoreInteractiveMode = \"full\" | \"hero\" | \"none\";\n\nexport interface EmberCoreProps extends React.HTMLAttributes<HTMLDivElement> {\n  /** Interaction mode: `\"hero\"` (default, page-safe with decorative canvas and a real Strike button), `\"full\"` (focusable canvas with all gestures and controls panel), or `\"none\"` (ambient only). */\n  interactive?: EmberCoreInteractiveMode;\n  /** Heat intensity multiplier (`0` to `2`, default `1`). */\n  heat?: number;\n  /** Pointer vortex swirl multiplier (`0` to `2`, default `1`). */\n  swirl?: number;\n  /** Idle rotation speed multiplier (`0` to `2`, default `1`). */\n  spin?: number;\n  /** Ash filament density (`0.2` to `1`, default `1`). */\n  density?: number;\n  /** Post-processing bloom pass (`true` by default; falls back automatically on Tier 2 if frame budget fails). */\n  bloom?: boolean;\n  /** Synthesized WebAudio crackle and thump on strike/burst (`false` by default; starts only after a user gesture). */\n  sound?: boolean;\n  /** Colour palette (`\"fire\"` default, `\"ice\"`, `\"neon\"`, `\"mono\"`, `\"custom\"`). */\n  palette?: PaletteName;\n  /** Universal pause prop: stops idle rotation and auto-strikes while allowing direct visitor gestures to play out. */\n  paused?: boolean;\n  /** Hard ceiling on the capability tier (`0` to `3`, default `3`). */\n  maxTier?: number;\n  /** Override reduced-motion behaviour (`still-frame` mode). */\n  reducedMotion?: boolean;\n  /** Horizontal camera framing offset in world units (for example `-0.32` to centre the cloud slightly right on wide screens). */\n  offsetX?: number;\n  /** CSP nonce for the scoped `<style>` tag. */\n  nonce?: string;\n  /** Root `<div>` ref. */\n  ref?: React.Ref<HTMLDivElement>;\n  /** Optional content layered over the ember cloud. */\n  children?: React.ReactNode;\n}\n\nconst PRESET_RGB: Record<Exclude<PaletteName, \"custom\">, EmberCorePaletteRGB> = {\n  fire: {\n    ash: [0.66, 0.63, 0.61],\n    ember: [1.0, 0.2, 0.04],\n    hot: [1.0, 0.7, 0.32],\n    gA: [0.95, 0.12, 0.02],\n    gB: [1.0, 0.36, 0.08],\n  },\n  ice: {\n    ash: [0.62, 0.67, 0.73],\n    ember: [0.16, 0.5, 1.0],\n    hot: [0.78, 0.93, 1.0],\n    gA: [0.04, 0.2, 0.9],\n    gB: [0.3, 0.68, 1.0],\n  },\n  neon: {\n    ash: [0.64, 0.57, 0.72],\n    ember: [1.0, 0.17, 0.84],\n    hot: [0.36, 0.95, 1.0],\n    gA: [0.72, 0.05, 0.85],\n    gB: [0.2, 0.85, 1.0],\n  },\n  mono: {\n    ash: [0.6, 0.6, 0.6],\n    ember: [0.92, 0.9, 0.88],\n    hot: [1.0, 1.0, 1.0],\n    gA: [0.55, 0.53, 0.52],\n    gB: [0.9, 0.88, 0.86],\n  },\n};\n\nfunction rgbToCss(c: RGB): string {\n  return `color(srgb ${c[0]} ${c[1]} ${c[2]})`;\n}\n\nfunction sameRgb(a: RGB, b: RGB): boolean {\n  return Math.abs(a[0] - b[0]) < 1e-4 && Math.abs(a[1] - b[1]) < 1e-4 && Math.abs(a[2] - b[2]) < 1e-4;\n}\n\nfunction samePalette(a: EmberCorePaletteRGB, b: EmberCorePaletteRGB): boolean {\n  return (\n    sameRgb(a.ash, b.ash) &&\n    sameRgb(a.ember, b.ember) &&\n    sameRgb(a.hot, b.hot) &&\n    sameRgb(a.gA, b.gA) &&\n    sameRgb(a.gB, b.gB)\n  );\n}\n\nconst FULL_ARIA_LABEL =\n  \"Ember Core interactive 3D ember cloud. Drag to spin, scroll or pinch to zoom, click or tap to strike, hold to charge and release to burst. Keyboard: arrow keys spin, Space or Enter strikes (hold to charge), plus and minus zoom, P pauses.\";\n\nexport function EmberCore({\n  interactive = \"hero\",\n  heat = 1,\n  swirl = 1,\n  spin = 1,\n  density = 1,\n  bloom = true,\n  sound = false,\n  palette = \"fire\",\n  paused = false,\n  maxTier = 3,\n  reducedMotion: reducedMotionProp,\n  offsetX = 0,\n  nonce,\n  className = \"\",\n  style,\n  children,\n  ref,\n  ...rest\n}: EmberCoreProps) {\n  const hostRef = useRef<HTMLDivElement | null>(null);\n  const uid = useId();\n  const hydrated = useHydrated();\n  const cap = useCapability();\n  const sysReduced = useReducedMotion();\n  const globalPaused = usePaused();\n  const inView = useInView(hostRef);\n\n  const isReduced = reducedMotionProp !== undefined ? reducedMotionProp : sysReduced;\n\n  // Internal overrides for \"full\" interactive controls panel + strike triggers\n  const propKey = `${heat}:${swirl}:${spin}:${density}:${bloom}:${sound}:${palette}`;\n  const [overrides, setOverrides] = useState<{\n    key: string;\n    heat?: number;\n    swirl?: number;\n    spin?: number;\n    density?: number;\n    bloom?: boolean;\n    sound?: boolean;\n    palette?: PaletteName;\n  }>({ key: propKey });\n\n  const activeOverrides = overrides.key === propKey ? overrides : { key: propKey };\n  const curHeat = activeOverrides.heat ?? heat;\n  const curSwirl = activeOverrides.swirl ?? swirl;\n  const curSpin = activeOverrides.spin ?? spin;\n  const curDensity = activeOverrides.density ?? density;\n  const curBloom = activeOverrides.bloom ?? bloom;\n  const curSound = activeOverrides.sound ?? sound;\n  const curPalette = activeOverrides.palette ?? palette;\n\n  const setCurHeat = useCallback((v: number) => {\n    setOverrides((prev) => ({ ...(prev.key === propKey ? prev : { key: propKey }), heat: v }));\n  }, [propKey]);\n  const setCurSwirl = useCallback((v: number) => {\n    setOverrides((prev) => ({ ...(prev.key === propKey ? prev : { key: propKey }), swirl: v }));\n  }, [propKey]);\n  const setCurSpin = useCallback((v: number) => {\n    setOverrides((prev) => ({ ...(prev.key === propKey ? prev : { key: propKey }), spin: v }));\n  }, [propKey]);\n  const setCurDensity = useCallback((v: number) => {\n    setOverrides((prev) => ({ ...(prev.key === propKey ? prev : { key: propKey }), density: v }));\n  }, [propKey]);\n  const setCurBloom = useCallback((updater: boolean | ((b: boolean) => boolean)) => {\n    setOverrides((prev) => {\n      const base = prev.key === propKey ? prev : { key: propKey };\n      const current = base.bloom ?? bloom;\n      const next = typeof updater === \"function\" ? updater(current) : updater;\n      return { ...base, bloom: next };\n    });\n  }, [propKey, bloom]);\n  const setCurSound = useCallback((updater: boolean | ((s: boolean) => boolean)) => {\n    setOverrides((prev) => {\n      const base = prev.key === propKey ? prev : { key: propKey };\n      const current = base.sound ?? sound;\n      const next = typeof updater === \"function\" ? updater(current) : updater;\n      return { ...base, sound: next };\n    });\n  }, [propKey, sound]);\n  const setCurPalette = useCallback((v: PaletteName) => {\n    setOverrides((prev) => ({ ...(prev.key === propKey ? prev : { key: propKey }), palette: v }));\n  }, [propKey]);\n\n  const [localPaused, setLocalPaused] = useState(false);\n  const [controlsOpen, setControlsOpen] = useState(false);\n  const [strikeTrigger, setStrikeTrigger] = useState(0);\n  const [resetTrigger, setResetTrigger] = useState(0);\n  const [toastMsg, setToastMsg] = useState(\"\");\n  const toastTimerRef = useRef<number>(0);\n\n  const showToast = useCallback((msg: string) => {\n    setToastMsg(msg);\n    if (typeof window !== \"undefined\") {\n      window.clearTimeout(toastTimerRef.current);\n      toastTimerRef.current = window.setTimeout(() => setToastMsg(\"\"), 1400);\n    }\n  }, []);\n\n  useEffect(() => {\n    return () => {\n      if (typeof window !== \"undefined\") window.clearTimeout(toastTimerRef.current);\n    };\n  }, []);\n\n  // Calm mode attribute observer\n  const [calmMode, setCalmMode] = useState(false);\n\n  useEffect(() => {\n    if (typeof document === \"undefined\") return;\n    const syncCalm = () => {\n      setCalmMode(document.documentElement.hasAttribute(\"data-fb-calm\"));\n    };\n    syncCalm();\n    if (typeof MutationObserver === \"undefined\") return;\n    const mo = new MutationObserver(syncCalm);\n    mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"data-fb-calm\"] });\n    return () => mo.disconnect();\n  }, []);\n\n  const [leaseGranted, setLeaseGranted] = useState(false);\n  const leaseHandleRef = useRef<Lease | null>(null);\n  const leaseIdRef = useRef(\"ember-core-\" + uid);\n  const [ctxLost, setCtxLost] = useState(false);\n  const [stepDowns, setStepDowns] = useState(0);\n\n  // Under prefers-reduced-motion, useCapability().tier is 0, but EmberCore's reduced-motion mode is `still-frame`\n  // (renders one static WebGL frame with 0 loop frames when WebGL2 is available and maxTier >= 2).\n  const baseCapTier = isReduced && cap.webgl2 && !cap.saveData ? Math.min(2, maxTier) : Math.min(cap.tier, maxTier);\n  const effectiveTier = hydrated && !calmMode ? Math.max(0, baseCapTier - stepDowns) : 0;\n\n  const [resolvedColors, setResolvedColors] = useState<EmberCorePaletteRGB>(PRESET_RGB.fire);\n  const [isLightTheme, setIsLightTheme] = useState(false);\n\n  const refreshPaletteColors = useCallback(() => {\n    const el = hostRef.current;\n    const rootEl = typeof document !== \"undefined\" ? document.documentElement : null;\n    const dataTheme = rootEl?.getAttribute(\"data-theme\") || rootEl?.getAttribute(\"data-mode\") || \"\";\n    let nextLight = false;\n    if (dataTheme === \"light\" || rootEl?.classList.contains(\"light\")) {\n      nextLight = true;\n    } else if (dataTheme === \"dark\" || rootEl?.classList.contains(\"dark\")) {\n      nextLight = false;\n    } else if (rootEl && typeof getComputedStyle === \"function\") {\n      const csBg =\n        getComputedStyle(el?.parentElement ?? rootEl).backgroundColor ||\n        getComputedStyle(rootEl).backgroundColor ||\n        \"\";\n      const m = /^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)(?:\\s*,\\s*([\\d.]+))?\\s*\\)$/.exec(csBg);\n      if (m && (m[4] === undefined || Number(m[4]) > 0)) {\n        const lum = (0.2126 * Number(m[1]) + 0.7152 * Number(m[2]) + 0.0722 * Number(m[3])) / 255;\n        nextLight = lum > 0.5;\n      } else {\n        const bg =\n          resolveCssColor(el?.parentElement ?? rootEl, \"var(--background, Canvas)\") ??\n          resolveCssColor(rootEl, \"Canvas\");\n        if (bg) {\n          const lum = 0.2126 * bg[0] + 0.7152 * bg[1] + 0.0722 * bg[2];\n          nextLight = lum > 0.5;\n        }\n      }\n    }\n    setIsLightTheme((prev) => (prev === nextLight ? prev : nextLight));\n\n    const fallback = PRESET_RGB[curPalette === \"custom\" ? \"fire\" : curPalette] ?? PRESET_RGB.fire;\n    if (curPalette !== \"custom\") {\n      setResolvedColors((prev) => (samePalette(prev, fallback) ? prev : fallback));\n      return;\n    }\n\n    const next: EmberCorePaletteRGB = {\n      ash: resolveCssColor(el, `var(--fb-heat-0, ${rgbToCss(fallback.ash)})`) ?? fallback.ash,\n      ember: resolveCssColor(el, `var(--fb-heat-2, ${rgbToCss(fallback.ember)})`) ?? fallback.ember,\n      hot: resolveCssColor(el, `var(--fb-heat-4, ${rgbToCss(fallback.hot)})`) ?? fallback.hot,\n      gA: resolveCssColor(el, `var(--fb-heat-1, ${rgbToCss(fallback.gA)})`) ?? fallback.gA,\n      gB: resolveCssColor(el, `var(--fb-heat-3, ${rgbToCss(fallback.gB)})`) ?? fallback.gB,\n    };\n\n    setResolvedColors((prev) => (samePalette(prev, next) ? prev : next));\n  }, [curPalette]);\n\n  useEffect(() => {\n    refreshPaletteColors();\n    if (typeof MutationObserver === \"undefined\") return;\n    const mo = new MutationObserver(refreshPaletteColors);\n    mo.observe(document.documentElement, {\n      attributes: true,\n      attributeFilter: [\"class\", \"data-theme\", \"data-mode\", \"style\"],\n    });\n    return () => mo.disconnect();\n  }, [refreshPaletteColors]);\n\n  const isStopped = paused || localPaused || globalPaused;\n\n  // Release lease when off-screen or low tier so active contexts match budget rules\n  const wantsWebGL = hydrated && inView && !calmMode && effectiveTier >= 2;\n\n  useEffect(() => {\n    if (!wantsWebGL) {\n      if (leaseHandleRef.current) {\n        leaseHandleRef.current.release();\n        leaseHandleRef.current = null;\n        setLeaseGranted(false);\n      }\n      return;\n    }\n\n    const requestLease = () => {\n      if (leaseHandleRef.current) return;\n      const acquired = glBudget.acquire({\n        id: leaseIdRef.current,\n        priority: interactive === \"hero\" ? 2 : 1,\n        onEvict: () => {\n          leaseHandleRef.current = null;\n          setLeaseGranted(false);\n        },\n      });\n      if (acquired) {\n        leaseHandleRef.current = acquired;\n        setLeaseGranted(true);\n        setCtxLost(false);\n      }\n    };\n\n    requestLease();\n    const unsub =\n      typeof glBudget.subscribe === \"function\"\n        ? glBudget.subscribe(() => {\n            if (!leaseHandleRef.current) requestLease();\n          })\n        : () => {};\n\n    return () => {\n      unsub();\n    };\n  }, [wantsWebGL, interactive, ctxLost]);\n\n  useEffect(() => {\n    return () => {\n      if (leaseHandleRef.current) {\n        leaseHandleRef.current.release();\n        leaseHandleRef.current = null;\n      }\n    };\n  }, []);\n\n  const handleDowngrade = useCallback(() => {\n    setStepDowns((d) => d + 1);\n  }, []);\n\n  const handleContextLost = useCallback(() => {\n    setCtxLost(true);\n  }, []);\n\n  const handleContextRestored = useCallback(() => {\n    setCtxLost(false);\n  }, []);\n\n  const handleStrike = useCallback(() => {\n    setStrikeTrigger((n) => n + 1);\n  }, []);\n\n  const handleTogglePause = useCallback(() => {\n    setLocalPaused((prev) => {\n      const next = !(paused || prev);\n      showToast(next ? \"Paused\" : \"Playing\");\n      return next;\n    });\n  }, [paused, showToast]);\n\n  const handleReset = useCallback(() => {\n    setOverrides({\n      key: propKey,\n      heat: 1,\n      swirl: 1,\n      spin: 1,\n      density: 1,\n      bloom: true,\n      palette: \"fire\",\n    });\n    setLocalPaused(false);\n    setResetTrigger((n) => n + 1);\n    showToast(\"Reset\");\n  }, [propKey, showToast]);\n\n  useImperativeHandle(ref, () => hostRef.current as HTMLDivElement);\n\n  const showGL = leaseGranted && effectiveTier >= 2;\n  const emberCss = rgbToCss(resolvedColors.ember);\n  const hotCss = rgbToCss(resolvedColors.hot);\n  const ashCss = rgbToCss(resolvedColors.ash);\n  const gACss = rgbToCss(resolvedColors.gA);\n  const posterGradient = isLightTheme\n    ? [\n        `radial-gradient(28% 26% at var(--ec-px1, 50%) 52%, color-mix(in srgb, ${hotCss} 38%, transparent) 0%, color-mix(in srgb, ${emberCss} 22%, transparent) 44%, transparent 72%)`,\n        `radial-gradient(38% 36% at var(--ec-px2, 50%) 48%, color-mix(in srgb, ${gACss} 28%, transparent) 0%, color-mix(in srgb, ${ashCss} 16%, transparent) 52%, transparent 76%)`,\n        \"radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--fb-heat-0, black) 96%, transparent) 0%, color-mix(in srgb, var(--fb-heat-0, black) 93%, transparent) 34%, color-mix(in srgb, var(--fb-heat-0, black) 82%, transparent) 45%, color-mix(in srgb, var(--fb-heat-0, black) 63%, transparent) 55%, color-mix(in srgb, var(--fb-heat-0, black) 41%, transparent) 64%, color-mix(in srgb, var(--fb-heat-0, black) 21%, transparent) 72%, color-mix(in srgb, var(--fb-heat-0, black) 8%, transparent) 79%, color-mix(in srgb, var(--fb-heat-0, black) 1.5%, transparent) 83%, transparent 86%)\",\n      ].join(\", \")\n    : [\n        `radial-gradient(38% 36% at var(--ec-px1, 50%) 54%, color-mix(in srgb, ${hotCss} 46%, transparent) 0%, color-mix(in srgb, ${emberCss} 32%, transparent) 38%, transparent 74%)`,\n        `radial-gradient(54% 50% at var(--ec-px2, 50%) 48%, color-mix(in srgb, ${gACss} 38%, transparent) 0%, color-mix(in srgb, ${ashCss} 22%, transparent) 54%, transparent 82%)`,\n        \"radial-gradient(90% 80% at 50% 50%, color-mix(in srgb, var(--fb-heat-0, black) 38%, black) 0%, color-mix(in srgb, var(--fb-heat-0, black) 18%, black) 72%, black 100%)\",\n      ].join(\", \");\n\n  const controlsPanelId = `fb-ec-controls-${uid}`;\n\n  return (\n    <div\n      ref={hostRef}\n      data-frictionborn-item=\"ember-core\"\n      data-tier={ isReduced ? 0 : effectiveTier }\n      data-interactive={interactive}\n      data-theme-mode={isLightTheme ? \"light\" : \"dark\"}\n      className={`fb-ember-core ${className}`}\n      style={{\n        ...paletteVars(curPalette),\n        \"--ec-px1\": offsetX < 0 ? \"58%\" : \"50%\",\n        \"--ec-px2\": offsetX < 0 ? \"56%\" : \"50%\",\n        position: \"relative\",\n        width: \"100%\",\n        minHeight: interactive === \"full\" ? \"540px\" : \"360px\",\n        overflow: \"hidden\",\n        backgroundColor: isLightTheme\n          ? \"transparent\"\n          : \"color-mix(in srgb, var(--fb-heat-0, black) 18%, black)\",\n        color: \"color-mix(in srgb, var(--fb-heat-4, white) 92%, silver)\",\n        ...style,\n      } as React.CSSProperties}\n      {...rest}\n    >\n      <style nonce={nonce}>{`\n        .fb-ember-core {\n          --ec-ink: color-mix(in srgb, var(--fb-heat-4, white) 94%, silver);\n          --ec-muted: color-mix(in srgb, var(--fb-heat-4, white) 74%, gray);\n          --ec-ember: var(--fb-heat-2, orange);\n          --ec-glass: color-mix(in srgb, var(--fb-heat-0, black) 82%, transparent);\n          --ec-line: color-mix(in srgb, var(--fb-heat-4, white) 16%, transparent);\n          --text: var(--ec-ink);\n          --text-2: var(--ec-muted);\n          --foreground: var(--ec-ink);\n          --muted-foreground: var(--ec-muted);\n          isolation: isolate;\n          user-select: none;\n          -webkit-user-select: none;\n          font-family: var(--font-geist), ui-sans-serif, system-ui, -apple-system, sans-serif;\n        }\n        @media (max-width: 767px) {\n          .fb-ember-core {\n            --ec-px1: 50% !important;\n            --ec-px2: 50% !important;\n          }\n        }\n        .fb-ember-core[data-theme-mode=\"light\"] {\n          --ec-ink: color-mix(in srgb, var(--fb-heat-0, black) 92%, black);\n          --ec-muted: color-mix(in srgb, var(--fb-heat-0, black) 72%, gray);\n          --ec-glass: color-mix(in srgb, var(--fb-heat-4, white) 90%, transparent);\n          --ec-line: color-mix(in srgb, var(--fb-heat-0, black) 16%, transparent);\n        }\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-brand,\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-caption,\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-hints,\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-hero-hint,\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-panel,\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-toast {\n          background: var(--ec-glass);\n          border-color: var(--ec-line);\n          color: var(--ec-ink);\n        }\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-btn:hover {\n          border-color: color-mix(in srgb, var(--fb-heat-2, orange) 55%, transparent);\n          background: color-mix(in srgb, var(--fb-heat-4, white) 96%, transparent);\n        }\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-btn[aria-pressed=\"true\"],\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-btn[aria-expanded=\"true\"] {\n          border-color: color-mix(in srgb, var(--fb-heat-2, orange) 68%, transparent);\n          background: color-mix(in srgb, var(--fb-heat-2, orange) 14%, var(--ec-glass));\n          color: var(--ec-ink);\n        }\n        .fb-ec-poster {\n          position: absolute;\n          inset: 0;\n          z-index: 0;\n          pointer-events: none;\n        }\n        .fb-ec-gl-wrap {\n          position: absolute;\n          inset: 0;\n          z-index: 1;\n        }\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-gl-wrap {\n          -webkit-mask-image: radial-gradient(\n            50% 50% at 50% 50%,\n            black 0%,\n            black 42%,\n            color-mix(in srgb, black 82%, transparent) 54%,\n            color-mix(in srgb, black 48%, transparent) 65%,\n            color-mix(in srgb, black 16%, transparent) 75%,\n            transparent 82%\n          );\n          mask-image: radial-gradient(\n            50% 50% at 50% 50%,\n            black 0%,\n            black 42%,\n            color-mix(in srgb, black 82%, transparent) 54%,\n            color-mix(in srgb, black 48%, transparent) 65%,\n            color-mix(in srgb, black 16%, transparent) 75%,\n            transparent 82%\n          );\n        }\n        .fb-ember-core[data-interactive=\"hero\"] .fb-ec-gl-wrap {\n          touch-action: pan-y;\n        }\n        .fb-ember-core[data-interactive=\"full\"] .fb-ec-gl-wrap {\n          touch-action: none;\n        }\n        .fb-ember-core[data-interactive=\"none\"] .fb-ec-gl-wrap {\n          pointer-events: none;\n        }\n        .fb-ec-gl-wrap canvas:focus-visible {\n          outline: 2px solid var(--fb-heat-2, orange);\n          outline-offset: -3px;\n        }\n        .fb-ec-vignette {\n          position: absolute;\n          inset: 0;\n          z-index: 1;\n          pointer-events: none;\n          background: radial-gradient(ellipse at center, transparent 44%, color-mix(in srgb, black 52%, transparent) 82%, color-mix(in srgb, black 86%, transparent) 100%);\n        }\n        .fb-ember-core[data-theme-mode=\"light\"] .fb-ec-vignette {\n          background: none;\n        }\n        .fb-ec-stage {\n          position: relative;\n          z-index: 2;\n          width: 100%;\n          height: 100%;\n          min-height: inherit;\n          display: flex;\n          flex-direction: column;\n          justify-content: space-between;\n          padding: clamp(28px, 3.2vw, 36px);\n          box-sizing: border-box;\n          pointer-events: none;\n        }\n        .fb-ec-children {\n          position: relative;\n          z-index: 2;\n          pointer-events: none;\n        }\n        .fb-ec-children a,\n        .fb-ec-children button,\n        .fb-ec-children input,\n        .fb-ec-children select,\n        .fb-ec-children textarea,\n        .fb-ec-children [role=\"button\"],\n        .fb-ec-children [tabindex] {\n          pointer-events: auto;\n        }\n        .fb-ec-hero-bar {\n          display: flex;\n          align-items: center;\n          justify-content: space-between;\n          flex-wrap: wrap;\n          gap: 10px 16px;\n          margin-top: auto;\n          padding-top: 16px;\n          pointer-events: none;\n        }\n        .fb-ec-hero-hint {\n          font-family: var(--font-geist-mono), ui-monospace, monospace;\n          font-size: 12px;\n          letter-spacing: 0.08em;\n          text-transform: uppercase;\n          color: var(--ec-muted);\n          background: color-mix(in srgb, var(--fb-heat-0, black) 76%, transparent);\n          border: 1px solid var(--ec-line);\n          border-radius: 999px;\n          padding: 7px 13px;\n        }\n        .fb-ec-hint-touch { display: none; }\n        @media (pointer: coarse) {\n          .fb-ec-hint-fine { display: none; }\n          .fb-ec-hint-touch { display: inline; }\n        }\n        .fb-ec-btn {\n          pointer-events: auto;\n          appearance: none;\n          border: 1px solid var(--ec-line);\n          background: var(--ec-glass);\n          color: var(--ec-ink);\n          padding: 8px 14px;\n          min-height: 36px;\n          border-radius: 999px;\n          font: 500 12px/1 var(--font-geist), ui-sans-serif, system-ui, sans-serif;\n          letter-spacing: 0.08em;\n          text-transform: uppercase;\n          cursor: pointer;\n          display: inline-flex;\n          align-items: center;\n          gap: 7px;\n          transition: border-color 0.2s, background 0.2s, transform 0.12s;\n        }\n        .fb-ec-btn:hover {\n          border-color: color-mix(in srgb, var(--fb-heat-2, orange) 55%, transparent);\n          background: color-mix(in srgb, var(--fb-heat-1, black) 32%, var(--ec-glass));\n        }\n        .fb-ec-btn:active {\n          transform: scale(0.97);\n        }\n        .fb-ec-btn[aria-pressed=\"true\"],\n        .fb-ec-btn[aria-expanded=\"true\"] {\n          border-color: color-mix(in srgb, var(--fb-heat-2, orange) 72%, transparent);\n          background: color-mix(in srgb, var(--fb-heat-2, orange) 24%, transparent);\n        }\n        .fb-ec-btn:focus-visible {\n          outline: 2px solid var(--fb-heat-2, orange);\n          outline-offset: 2px;\n        }\n        .fb-ec-full-top {\n          display: flex;\n          align-items: flex-start;\n          justify-content: space-between;\n          gap: 16px;\n          flex-wrap: wrap;\n        }\n        .fb-ec-brand {\n          display: inline-flex;\n          align-items: center;\n          gap: 10px;\n          font-size: 12px;\n          font-weight: 500;\n          letter-spacing: 0.16em;\n          text-transform: uppercase;\n          color: var(--ec-ink);\n          background: color-mix(in srgb, var(--fb-heat-0, black) 76%, transparent);\n          border: 1px solid var(--ec-line);\n          border-radius: 999px;\n          padding: 7px 13px;\n        }\n        .fb-ec-dot {\n          width: 7px;\n          height: 7px;\n          border-radius: 999px;\n          background: var(--ec-ember);\n          box-shadow: 0 0 10px var(--ec-ember);\n        }\n        .fb-ec-caption {\n          max-width: 390px;\n          background: color-mix(in srgb, var(--fb-heat-0, black) 78%, transparent);\n          border: 1px solid var(--ec-line);\n          border-radius: 14px;\n          padding: 12px 15px;\n        }\n        .fb-ember-core .fb-ec-kicker {\n          font-size: 11px;\n          letter-spacing: 0.14em;\n          text-transform: uppercase;\n          color: var(--ec-muted);\n          margin: 0 0 5px;\n        }\n        .fb-ember-core .fb-ec-sub {\n          font-size: 13px;\n          line-height: 1.45;\n          color: var(--ec-ink);\n          margin: 0;\n        }\n        .fb-ec-full-bottom {\n          display: flex;\n          align-items: flex-end;\n          justify-content: space-between;\n          gap: 14px;\n          flex-wrap: wrap;\n          margin-top: auto;\n        }\n        .fb-ec-hints {\n          display: flex;\n          flex-wrap: wrap;\n          gap: 6px 12px;\n          font-size: 11px;\n          letter-spacing: 0.06em;\n          text-transform: uppercase;\n          color: var(--ec-ink);\n          background: color-mix(in srgb, var(--fb-heat-0, black) 78%, transparent);\n          border: 1px solid var(--ec-line);\n          border-radius: 12px;\n          padding: 8px 12px;\n        }\n        .fb-ec-hints span {\n          color: var(--ec-muted);\n          margin-left: 3px;\n        }\n        .fb-ec-actions {\n          display: flex;\n          align-items: center;\n          gap: 8px;\n          flex-wrap: wrap;\n          pointer-events: auto;\n        }\n        .fb-ec-panel {\n          pointer-events: auto;\n          width: min(320px, calc(100vw - 40px));\n          background: color-mix(in srgb, var(--fb-heat-0, black) 92%, transparent);\n          border: 1px solid var(--ec-line);\n          border-radius: 16px;\n          padding: 14px 16px;\n          display: grid;\n          gap: 11px;\n          margin-left: auto;\n          margin-block: 12px;\n        }\n        .fb-ec-panel[hidden] {\n          display: none !important;\n        }\n        .fb-ec-row {\n          display: grid;\n          grid-template-columns: 92px 1fr 38px;\n          align-items: center;\n          gap: 10px;\n          font-size: 11px;\n          letter-spacing: 0.08em;\n          text-transform: uppercase;\n          color: var(--ec-muted);\n        }\n        .fb-ec-row output {\n          text-align: right;\n          font-variant-numeric: tabular-nums;\n          color: var(--ec-ink);\n        }\n        .fb-ec-row input[type=\"range\"] {\n          width: 100%;\n          accent-color: var(--ec-ember);\n          cursor: pointer;\n        }\n        .fb-ec-chips {\n          display: flex;\n          gap: 6px;\n          flex-wrap: wrap;\n          padding-top: 2px;\n        }\n        .fb-ec-chip {\n          flex: 1;\n          min-width: 56px;\n          justify-content: center;\n          padding: 7px 10px;\n          font-size: 11px;\n        }\n        .fb-ec-toast {\n          position: absolute;\n          left: 50%;\n          bottom: 72px;\n          transform: translateX(-50%);\n          padding: 6px 12px;\n          border-radius: 999px;\n          background: color-mix(in srgb, var(--fb-heat-0, black) 90%, transparent);\n          border: 1px solid var(--ec-line);\n          color: var(--ec-ink);\n          font-size: 11px;\n          letter-spacing: 0.12em;\n          text-transform: uppercase;\n          pointer-events: none;\n        }\n        .fb-ec-toast[data-show=\"false\"] {\n          display: none;\n        }\n        @media (max-width: 640px) {\n          .fb-ec-hints { display: none; }\n          .fb-ec-caption { max-width: 100%; }\n        }\n      `}</style>\n\n      <div\n        data-frictionborn-poster=\"true\"\n        aria-hidden=\"true\"\n        className=\"fb-ec-poster\"\n        style={{ background: posterGradient }}\n      />\n\n      {showGL && (\n        <Suspense fallback={null}>\n          <EmberCoreGL\n            colors={resolvedColors}\n            interactive={interactive}\n            heat={curHeat}\n            swirl={curSwirl}\n            spin={curSpin}\n            density={curDensity}\n            bloom={curBloom}\n            sound={curSound}\n            paused={isStopped}\n            reducedMotion={isReduced}\n            tier={effectiveTier}\n            offsetX={offsetX}\n            lightTheme={isLightTheme}\n            suspended={ctxLost}\n            strikeTrigger={strikeTrigger}\n            resetTrigger={resetTrigger}\n            ariaLabel={interactive === \"full\" ? FULL_ARIA_LABEL : undefined}\n            onToast={showToast}\n            onTogglePause={handleTogglePause}\n            onDowngrade={handleDowngrade}\n            onContextLost={handleContextLost}\n            onContextRestored={handleContextRestored}\n          />\n        </Suspense>\n      )}\n\n      <div aria-hidden=\"true\" className=\"fb-ec-vignette\" />\n\n      <div className=\"fb-ec-stage\">\n        {interactive === \"full\" ? (\n          <>\n            <div className=\"fb-ec-full-top\">\n              <div className=\"fb-ec-brand\">\n                <span className=\"fb-ec-dot\" aria-hidden=\"true\" />\n                <span>Ember Core</span>\n              </div>\n              {children ? (\n                <div className=\"fb-ec-children\">{children}</div>\n              ) : (\n                <div className=\"fb-ec-caption\">\n                  <p className=\"fb-ec-kicker\">Three-dimensional ash &amp; ember field · real-time WebGL</p>\n                  <p className=\"fb-ec-sub\">\n                    Drag to spin in any direction. Hover to stir a vortex. Click for a shockwave; hold to charge and release to burst.\n                  </p>\n                </div>\n              )}\n            </div>\n\n            <section\n              id={controlsPanelId}\n              className=\"fb-ec-panel\"\n              aria-label=\"Controls\"\n              hidden={!controlsOpen}\n            >\n              <div className=\"fb-ec-row\">\n                <label htmlFor={`${uid}-heat`}>Heat</label>\n                <input\n                  id={`${uid}-heat`}\n                  type=\"range\"\n                  min={0}\n                  max={2}\n                  step={0.02}\n                  value={curHeat}\n                  onChange={(e) => setCurHeat(parseFloat(e.target.value))}\n                />\n                <output htmlFor={`${uid}-heat`}>{curHeat.toFixed(2)}</output>\n              </div>\n              <div className=\"fb-ec-row\">\n                <label htmlFor={`${uid}-swirl`}>Swirl</label>\n                <input\n                  id={`${uid}-swirl`}\n                  type=\"range\"\n                  min={0}\n                  max={2}\n                  step={0.02}\n                  value={curSwirl}\n                  onChange={(e) => setCurSwirl(parseFloat(e.target.value))}\n                />\n                <output htmlFor={`${uid}-swirl`}>{curSwirl.toFixed(2)}</output>\n              </div>\n              <div className=\"fb-ec-row\">\n                <label htmlFor={`${uid}-spin`}>Spin</label>\n                <input\n                  id={`${uid}-spin`}\n                  type=\"range\"\n                  min={0}\n                  max={2}\n                  step={0.02}\n                  value={curSpin}\n                  onChange={(e) => setCurSpin(parseFloat(e.target.value))}\n                />\n                <output htmlFor={`${uid}-spin`}>{curSpin.toFixed(2)}</output>\n              </div>\n              <div className=\"fb-ec-row\">\n                <label htmlFor={`${uid}-density`}>Ash density</label>\n                <input\n                  id={`${uid}-density`}\n                  type=\"range\"\n                  min={0.2}\n                  max={1}\n                  step={0.02}\n                  value={curDensity}\n                  onChange={(e) => setCurDensity(parseFloat(e.target.value))}\n                />\n                <output htmlFor={`${uid}-density`}>{ `${Math.round(curDensity * 100)}%` }</output>\n              </div>\n              <div className=\"fb-ec-chips\" role=\"group\" aria-label=\"Colour palette\">\n                {([\"fire\", \"ice\", \"neon\", \"mono\"] as const).map((pName) => (\n                  <button\n                    key={pName}\n                    type=\"button\"\n                    aria-pressed={curPalette === pName}\n                    className=\"fb-ec-btn fb-ec-chip\"\n                    onClick={() => {\n                      setCurPalette(pName);\n                      showToast(`Palette: ${pName}`);\n                    }}\n                  >\n                    {pName.charAt(0).toUpperCase() + pName.slice(1)}\n                  </button>\n                ))}\n              </div>\n              <div className=\"fb-ec-chips\">\n                <button\n                  type=\"button\"\n                  className=\"fb-ec-btn fb-ec-chip\"\n                  aria-pressed={curSound}\n                  onClick={() => {\n                    setCurSound((s) => {\n                      const next = !s;\n                      showToast(next ? \"Sound on\" : \"Sound off\");\n                      return next;\n                    });\n                  }}\n                >\n                  {curSound ? \"Sound on\" : \"Sound off\"}\n                </button>\n                <button\n                  type=\"button\"\n                  className=\"fb-ec-btn fb-ec-chip\"\n                  aria-pressed={curBloom}\n                  onClick={() => {\n                    setCurBloom((b) => {\n                      const next = !b;\n                      showToast(next ? \"Glow on\" : \"Glow off\");\n                      return next;\n                    });\n                  }}\n                >\n                  {curBloom ? \"Glow on\" : \"Glow off\"}\n                </button>\n                <button type=\"button\" className=\"fb-ec-btn fb-ec-chip\" onClick={handleReset}>\n                  Reset\n                </button>\n              </div>\n            </section>\n\n            <div className=\"fb-ec-full-bottom\">\n              <div className=\"fb-ec-hints\" aria-hidden=\"true\">\n                <div>Drag <span>spin</span></div>\n                <div>Scroll / Pinch <span>zoom</span></div>\n                <div>Click / Tap <span>strike</span></div>\n                <div>Hold <span>charge</span></div>\n                <div>Move <span>stir the ash</span></div>\n              </div>\n              <div className=\"fb-ec-actions\">\n                <button\n                  type=\"button\"\n                  className=\"fb-ec-btn\"\n                  aria-expanded={controlsOpen}\n                  aria-controls={controlsPanelId}\n                  onClick={() => setControlsOpen((o) => !o)}\n                >\n                  Controls\n                </button>\n                <button\n                  type=\"button\"\n                  className=\"fb-ec-btn\"\n                  aria-pressed={isStopped}\n                  onClick={handleTogglePause}\n                >\n                  {isStopped ? \"Play\" : \"Pause\"}\n                </button>\n                <button\n                  type=\"button\"\n                  className=\"fb-ec-btn\"\n                  onClick={handleStrike}\n                >\n                  Strike\n                </button>\n              </div>\n            </div>\n\n            <div\n              className=\"fb-ec-toast\"\n              role=\"status\"\n              aria-live=\"polite\"\n              data-show={toastMsg ? \"true\" : \"false\"}\n            >\n              {toastMsg}\n            </div>\n          </>\n        ) : (\n          <>\n            {children && <div className=\"fb-ec-children\">{children}</div>}\n            {interactive === \"hero\" ? (\n              <div className=\"fb-ec-hero-bar\">\n                <span className=\"fb-ec-hero-hint\" aria-hidden=\"true\">\n                  <span className=\"fb-ec-hint-fine\">Move to stir · Click to strike</span>\n                  <span className=\"fb-ec-hint-touch\">Tap to strike</span>\n                </span>\n                <button\n                  type=\"button\"\n                  className=\"fb-ec-btn fb-ec-strike-btn\"\n                  onClick={handleStrike}\n                >\n                  Strike\n                </button>\n              </div>\n            ) : (\n              !children && <span className=\"sr-only\">Ember Core ambient background</span>\n            )}\n          </>\n        )}\n      </div>\n    </div>\n  );\n}\n\nexport default EmberCore;\n",
          "type": "registry:ui",
          "target": "components/ui/ember-core.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "ember-core",
          "version": "0.1.0",
          "summary": "background: 3D ash filament sphere with inner ember glow, vortex stir, shockwave strike and hold-to-charge burst (WebGL2, still under reduced motion)",
          "slot": "background",
          "kind": "webgl"
        },
        "intent": {
          "useWhen": [
            "Flagship hero backgrounds needing a 3D interactive ember and ash sphere that never traps page scroll",
            "Standalone interactive showcases where visitors can spin, zoom, stir, strike and charge the core",
            "Dark-stage brand surfaces pairing headline typography with a tactile real-time WebGL focal point"
          ],
          "avoidWhen": [
            "Dense data tables or long-form reading sections where a 3D focal point distracts from copy",
            "Pages already running another WebGL background in the same viewport (one signature moment per screen)",
            "Surfaces without a dark ground or contrast backing behind foreground text"
          ],
          "alternatives": [
            {
              "name": "particle-field",
              "when": "When a lighter field of discrete depth points fits better than a 3D filament sphere"
            },
            {
              "name": "lantern-sky",
              "when": "When a calm 2D canvas background of rising lanterns is preferred over WebGL2"
            }
          ]
        },
        "runtime": {
          "serverOutput": "poster",
          "clientOnly": true,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "while-visible",
          "webglContexts": 1,
          "tiers": {
            "0": "CSS radial-gradient poster on dark obsidian ground; under prefers-reduced-motion on a WebGL2 browser, renders one still WebGL frame with 0 loop frames",
            "1": "CSS radial-gradient poster only (coarse pointer with low-end hardware hints)",
            "2": "WebGL2 at DPR <= 1.5 with 2,200 strands x 48 steps and 1,100 inner glow points; bloom falls back automatically if the frame budget fails",
            "3": "WebGL2 at DPR <= 2.0 with 4,600 strands x 62 steps, 2,000 inner glow points and 2-pass Gaussian bloom"
          },
          "reducedMotion": {
            "mode": "still-frame",
            "description": "Renders one still frame of the 3D ember cloud with no animation loop; activating Strike shows one flared frame and returns to the still frame."
          },
          "input": {
            "pointer": "Hover stirs a local vortex and lights a pointer flame; drag spins the sphere on a world-axis quaternion with inertia; click (< 280 ms, < 6 px) fires a strike flare and shockwave ring; hold (>= 280 ms) charges and pulls the cloud inward, releasing into an outward burst; wheel zooms in 'full' mode (never in 'hero' mode).",
            "touch": "In 'hero' mode, touch-action is pan-y so vertical swipes scroll the page normally; only horizontal touch drags spin the sphere and hold-to-charge is disabled on touch. In 'full' mode, single-finger drag spins, two-finger pinch zooms, tap strikes and hold charges.",
            "keyboard": "In 'hero' mode, Tab reaches the real Strike button. In 'full' mode, the canvas has tabIndex=0 (arrow keys spin, Space or Enter strikes or charges when held, + and - zoom, P pauses) and Tab reaches the Controls, Pause and Strike buttons plus native sliders and palette chips."
          }
        },
        "a11y": {
          "role": "decorative",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "built-in",
          "wcag": [
            "1.4.3",
            "2.1.1",
            "2.2.2"
          ],
          "notes": "In 'hero' mode (the default), the canvas is aria-hidden and a real <button>Strike</button> is provided alongside any children. In 'full' mode, the canvas is focusable with an aria-label listing all gestures, accompanied by native range inputs, toggle buttons and a polite status live region."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": false,
          "conflictsWith": [
            "noise-field",
            "mesh-gradient",
            "particle-field",
            "ambient-hero"
          ],
          "pairsWith": [
            "text-reveal",
            "magnetic-button",
            "flint-button"
          ]
        },
        "props": [
          {
            "name": "interactive",
            "type": "\"full\" | \"hero\" | \"none\"",
            "default": "hero",
            "effect": "Selects the interaction mode. 'hero' is page-safe (no wheel zoom, touch-action: pan-y, decorative canvas, real Strike button); 'full' adds focusable canvas keyboard controls, wheel/pinch zoom and the Controls panel; 'none' disables pointer and touch handlers."
          },
          {
            "name": "heat",
            "type": "number",
            "default": 1,
            "effect": "Heat intensity multiplier (0 to 2)."
          },
          {
            "name": "swirl",
            "type": "number",
            "default": 1,
            "effect": "Pointer vortex swirl multiplier (0 to 2)."
          },
          {
            "name": "spin",
            "type": "number",
            "default": 1,
            "effect": "Idle rotation speed multiplier (0 to 2)."
          },
          {
            "name": "density",
            "type": "number",
            "default": 1,
            "effect": "Fraction of ash filaments and inner glow points drawn (0.2 to 1)."
          },
          {
            "name": "bloom",
            "type": "boolean",
            "default": true,
            "effect": "Enables the 2-pass Gaussian bloom (strength 0.75, radius 0.6, threshold 0.18). Falls back automatically on Tier 2 if the frame budget fails."
          },
          {
            "name": "sound",
            "type": "boolean",
            "default": false,
            "effect": "Enables synthesized WebAudio crackle and low thump on user gestures (never plays before a user gesture; no audio files)."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the ash, ember, hot core and inner glow (DESIGN.md A8). 'custom' reads --fb-heat-0..4 via resolveCssColor."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: stops idle rotation and auto-strikes while allowing a visitor's direct gesture to play out and settle."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier (0 to 3)."
          },
          {
            "name": "reducedMotion",
            "type": "boolean",
            "default": null,
            "effect": "Optional override for prefers-reduced-motion (still-frame mode)."
          },
          {
            "name": "offsetX",
            "type": "number",
            "default": 0,
            "effect": "Horizontal camera framing offset in world units (for example -0.32 to place the sphere slightly right of centre on wide screens)."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "Optional CSP nonce forwarded to the scoped <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Additional CSS classes on the root <div>."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root <div>, merged after palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div> element."
          },
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Optional foreground content layered above the ember cloud."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/ember-core",
          "usage": "import { EmberCore } from \"@/components/ui/ember-core\";\n\nexport default function Hero() {\n  return (\n    <EmberCore interactive=\"hero\" style={{ minHeight: \"600px\" }}>\n      <h1 style={{ color: \"#E9E5DF\" }}>We build what others call impossible.</h1>\n    </EmberCore>\n  );\n}",
          "mistakes": [
            "Use interactive=\"hero\" (the default) when placing EmberCore at the top of a scrollable page so wheel events and vertical touch swipes never trap scrolling.",
            "Use interactive=\"full\" only for dedicated interactive stages where wheel and pinch zoom are intended.",
            "Do not place a second WebGL background in the same viewport; EmberCore acquires a glBudget lease while visible.",
            "Keep foreground text in high-contrast light ink (#E9E5DF) with a dark backing over the glowing core so WCAG 4.5:1 contrast holds even during a strike flare."
          ],
          "verify": [
            "Confirm the CSS poster renders in server HTML before hydration with zero layout shift (CLS <= 0.01).",
            "Confirm that in interactive=\"hero\" mode, mouse wheel and vertical touch swipes scroll the page normally.",
            "Confirm that under prefers-reduced-motion, one still frame is drawn with 0 ongoing animation frames."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [
            {
              "what": "3D simplex noise (GLSL)",
              "name": "webgl-noise",
              "author": "Ian McEwan (Ashima Arts), Stefan Gustavson",
              "license": "MIT",
              "url": "https://github.com/stegu/webgl-noise"
            }
          ],
          "notices": [
            "Includes 3D Simplex Noise from stegu/webgl-noise (MIT Copyright 2011 Ashima Arts, Stefan Gustavson)."
          ],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "007a6b9b2f7e172a8053827192681018424fc847fc13f66001d48d7643644cf2",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 8.19,
            "deferred": 13.77,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "26 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "firework-rating",
      "type": "registry:ui",
      "title": "FireworkRating",
      "description": "control: Five-star rating as a real radio group; hover previews, and each chosen star bursts as a firework (canvas 2D, server-safe, reduced motion -> plain)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/firework-rating/firework-rating.tsx",
          "content": "// Original — Frictionborn Motion FireworkRating (ported from the component lab, u3 · Firework Star Rating)\n\"use client\";\n\nimport React, { useCallback, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { Sparks, TAU, css, offscreen, paletteRamp, rand, ramp, relBox, type RGB, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface FireworkRatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\">, CanvasItemProps {\n  /** Controlled rating, 0 (not rated) to 5. */\n  value?: number;\n  defaultValue?: number;\n  onValueChange?: (value: number) => void;\n  /** Accessible name of the radio group. */\n  label?: string;\n  /** Words for 0–5 stars, shown and announced under the stars. Pass `null` to hide them. */\n  words?: [string, string, string, string, string, string] | null;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\nconst WORDS: [string, string, string, string, string, string] = [\"Not rated\", \"Poor\", \"Fair\", \"Good\", \"Great\", \"Spectacular\"];\n/** the lab's firework colours (FB_PAL) */\nconst FIRE_PAL: RGB[] = [[255, 196, 96], [255, 120, 44], [255, 238, 214], [255, 72, 44], [255, 160, 70]];\n\n/** the part of the lab's fireworks engine (fbShow) this item uses: peony bursts with a fading trail and a flash of light */\nfunction createShow(sparks: number) {\n  const o = { st: new Sparks(sparks), trail: null as HTMLCanvasElement | null, tx: null as CanvasRenderingContext2D | null, w: 0, h: 0, lights: [] as Array<{ x: number; y: number; c: RGB; a: number }> };\n  return {\n    size(w: number, h: number, dpr: number) {\n      o.w = w;\n      o.h = h;\n      [o.trail, o.tx] = offscreen(w * dpr, h * dpr);\n      o.tx.scale(dpr, dpr);\n    },\n    burst(x: number, y: number, c: RGB, scale = 1) {\n      const V = rand(120, 170) * scale;\n      for (let i = 0; i < 100; i++) {\n        const a = Math.random() * TAU, z = rand(-1, 1), kk = Math.sqrt(1 - z * z), v = V * rand(0.9, 1.05);\n        o.st.add(x, y, Math.cos(a) * kk * v, Math.sin(a) * kk * v, rand(1.1, 1.6), 1.7, 110, 1.4, c);\n      }\n      o.lights.push({ x, y, c, a: 1 });\n    },\n    step(dt: number) {\n      const tx = o.tx;\n      if (!tx) return;\n      o.st.step(dt);\n      o.lights.forEach((L) => (L.a *= Math.exp(-dt * 3)));\n      o.lights = o.lights.filter((L) => L.a > 0.02);\n      tx.globalCompositeOperation = \"destination-out\";\n      tx.fillStyle = `rgba(0,0,0,${1 - Math.exp(-dt * 7)})`;\n      tx.fillRect(0, 0, o.w, o.h);\n      tx.globalCompositeOperation = \"source-over\";\n      o.st.draw(tx);\n    },\n    draw(g: CanvasRenderingContext2D) {\n      if (!o.trail) return;\n      g.save();\n      g.globalCompositeOperation = \"lighter\";\n      for (const L of o.lights) {\n        const gr = g.createRadialGradient(L.x, L.y, 0, L.x, L.y, 260);\n        gr.addColorStop(0, css(L.c, 0.16 * L.a));\n        gr.addColorStop(1, css(L.c, 0));\n        g.fillStyle = gr;\n        g.fillRect(0, 0, o.w, o.h);\n      }\n      g.drawImage(o.trail, 0, 0, o.w, o.h);\n      g.restore();\n    },\n    /** still glowing: sparks alive or a flash fading (the trail fades within about a second after) */\n    get busy() {\n      return o.st.n > 0 || o.lights.length > 0;\n    },\n  };\n}\n\nexport function FireworkRating({ value, defaultValue = 0, onValueChange, label = \"Rating\", words = WORDS, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: FireworkRatingProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const groupRef = useRef<HTMLDivElement>(null);\n  const [inner, setInner] = useState(defaultValue);\n  const rate = Math.max(0, Math.min(5, value ?? inner));\n  const [preview, setPreview] = useState(0);\n  const celebrate = useRef<((n: number) => void) | null>(null);\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n\n  // the bursts: the lab's u3 drawing (each chosen star bursts in turn, 90 ms apart)\n  const wake = useDrawLoop(\n    fxRef,\n    (fx, wakeUp) => {\n      const root = rootRef.current, group = groupRef.current;\n      if (!root || !group) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const F = createShow(tier >= 3 ? 1600 : 700);\n      c.onResize(() => F.size(c.w, c.h, c.dpr));\n      F.size(c.w, c.h, c.dpr);\n      const cols: RGB[] = palette === \"fire\" ? FIRE_PAL : ((r) => [0.95, 0.6, 1, 0.45, 0.75].map((t) => ramp(r, t)))(paletteRamp(palette, readPalette(root, palette)));\n      const timers: number[] = [];\n      d.add(() => timers.forEach((t) => window.clearTimeout(t)));\n      let fading = 0;\n      celebrate.current = (n) => {\n        const stars = group.querySelectorAll<HTMLElement>(\"[role=radio]\");\n        for (let i = 0; i < n; i++)\n          timers.push(\n            window.setTimeout(() => {\n              const r = relBox(stars[i], fx);\n              F.burst(r.x + r.w / 2, r.y + r.h / 2, cols[i % 5], 0.45 + n * 0.08);\n              wakeUp();\n            }, i * 90),\n          );\n        wakeUp();\n      };\n      return {\n        tick(dt) {\n          F.step(dt);\n          c.g.clearRect(0, 0, c.w, c.h);\n          F.draw(c.g);\n          // keep drawing about a second after the last spark so the trail can fade out\n          fading = F.busy ? 1.2 : Math.max(0, fading - dt);\n          return F.busy || fading > 0;\n        },\n        destroy() {\n          celebrate.current = null;\n          d.dispose();\n        },\n      };\n    },\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}` },\n  );\n\n  const set = useCallback(\n    (n: number) => {\n      if (value === undefined) setInner(n);\n      onValueChange?.(n);\n      setPreview(0);\n      celebrate.current?.(n);\n      wake();\n    },\n    [value, onValueChange, wake],\n  );\n\n  const onKey = (e: React.KeyboardEvent, i: number) => {\n    const dir = e.key === \"ArrowRight\" || e.key === \"ArrowUp\" ? 1 : e.key === \"ArrowLeft\" || e.key === \"ArrowDown\" ? -1 : 0;\n    if (!dir) return;\n    e.preventDefault();\n    const j = Math.max(0, Math.min(4, i + dir));\n    set(j + 1);\n    groupRef.current?.querySelectorAll<HTMLElement>(\"[role=radio]\")[j]?.focus();\n  };\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"firework-rating\" data-tier={tier} className={`fb-firework-rating ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        /* the effect paints up to 200 px around the control without widening the page (no sideways scroll on phones) */\n        .fb-firework-rating { overflow: clip; overflow-clip-margin: 200px; }\n        .fb-firework-rating { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 12px; }\n        .fb-fr-fx { position: absolute; left: 50%; top: 23px; width: 520px; height: 360px; transform: translate(-50%, -50%); pointer-events: none; z-index: 2; }\n        .fb-fr-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-fr-group { display: flex; gap: 8px; }\n        .fb-fr-star { width: 46px; height: 46px; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 38px; line-height: 1; color: #6b645d; }\n        [data-motion=\"ok\"] .fb-fr-star { transition: transform 0.15s, color 0.15s; }\n        .fb-fr-star:hover { transform: scale(1.12); }\n        .fb-fr-star[data-on=\"true\"] { color: var(--fb-heat-3, #ffc46a); text-shadow: 0 0 18px color-mix(in srgb, var(--fb-heat-2, #E8590C) 80%, transparent); }\n        .fb-fr-star[data-preview=\"true\"] { color: color-mix(in srgb, var(--fb-heat-3, #ffc46a) 60%, #6b645d); }\n        .fb-fr-star:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 2px; }\n        .fb-fr-words { font: 11px ui-monospace, \"Geist Mono\", monospace; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground, GrayText); }\n      `}</style>\n      <div ref={fxRef} className=\"fb-fr-fx\" aria-hidden=\"true\" />\n      <div ref={groupRef} role=\"radiogroup\" aria-label={label} className=\"fb-fr-group\" onPointerLeave={() => setPreview(0)}>\n        {[1, 2, 3, 4, 5].map((n, i) => (\n          <button\n            key={n}\n            type=\"button\"\n            role=\"radio\"\n            aria-checked={rate === n}\n            aria-label={`${n} star${n > 1 ? \"s\" : \"\"}`}\n            tabIndex={(rate || 1) === n ? 0 : -1}\n            className=\"fb-fr-star\"\n            data-on={n <= rate}\n            data-preview={preview > 0 && n <= preview && n > rate}\n            onClick={() => set(n)}\n            onPointerEnter={() => setPreview(n)}\n            onKeyDown={(e) => onKey(e, i)}\n          >\n            <span aria-hidden=\"true\">★</span>\n          </button>\n        ))}\n      </div>\n      {words && (\n        <span className=\"fb-fr-words\" aria-live=\"polite\">\n          {words[rate]}\n        </span>\n      )}\n    </div>\n  );\n}\n\nexport default FireworkRating;\n",
          "type": "registry:ui",
          "target": "components/ui/firework-rating.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "firework-rating",
          "version": "0.1.0",
          "summary": "control: Five-star rating as a real radio group; hover previews, and each chosen star bursts as a firework (canvas 2D, server-safe, reduced motion -> plain)",
          "slot": "control",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "Asking for a rating at a moment worth celebrating (after a purchase, a finished task, a demo)",
            "One rating per view"
          ],
          "avoidWhen": [
            "Lists of read-only ratings (show plain stars)",
            "Forms with many ratings in a row"
          ],
          "alternatives": []
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The control alone (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Effect on a canvas at DPR <= 1.5 with half the particles",
            "3": "Effect on a canvas at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "The stars light up without bursts; no canvas."
          },
          "input": {
            "pointer": "Hover previews, click rates",
            "touch": "Tap rates",
            "keyboard": "A radio group with roving focus: arrows move and rate (Right/Up up, Left/Down down)"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.3.1",
            "1.4.11",
            "2.1.1",
            "4.1.2",
            "4.1.3"
          ],
          "notes": "role=radiogroup with a name and five native buttons with role=radio, aria-checked and names (\"3 stars\"); one tab stop. The word for the rating is aria-live=polite. Unlit stars keep 3:1 against the dark ground. The firework canvas is aria-hidden."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "flint-button",
            "fuse-toast"
          ]
        },
        "props": [
          {
            "name": "value",
            "type": "number",
            "default": null,
            "effect": "Controlled rating, 0 (not rated) to 5."
          },
          {
            "name": "defaultValue",
            "type": "number",
            "default": 0,
            "effect": "Initial rating when uncontrolled."
          },
          {
            "name": "onValueChange",
            "type": "(value: number) => void",
            "default": null,
            "effect": "Called with the new rating."
          },
          {
            "name": "label",
            "type": "string",
            "default": "Rating",
            "effect": "Accessible name of the radio group."
          },
          {
            "name": "words",
            "type": "[string, string, string, string, string, string] | null",
            "default": "[\"Not rated\", \"Poor\", \"Fair\", \"Good\", \"Great\", \"Spectacular\"]",
            "effect": "Words for 0-5 stars, shown and announced; null hides them."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/firework-rating",
          "usage": "import { useState } from \"react\";\nimport { FireworkRating } from \"@/components/ui/firework-rating\";\n\nexport function Feedback() {\n  const [stars, setStars] = useState(0);\n  return <FireworkRating label=\"Rate this guide\" value={stars} onValueChange={setStars} />;\n}",
          "mistakes": [
            "The bursts spread about 200 px around the stars: leave room and do not clip the parent.",
            "It sits on a dark ground by design; on a light page put it on a dark card.",
            "Give the group a specific label (what is being rated)."
          ],
          "verify": [
            "Server HTML has a radiogroup with five radios and one tab stop.",
            "ArrowRight rates and moves focus; the word is announced.",
            "The bursts fade and the loop stops within about two seconds."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "d865b413c49d4c30350e8559adcac4ed9abb06128562a039d4231a892aedbc80",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.59,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "flame-switch",
      "type": "registry:ui",
      "title": "FlameSwitch",
      "description": "control: On/off switch with a live pilot flame on its knob (canvas 2D, server-safe switch, reduced motion -> switch only, touch -> same switch)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/flame-switch/flame-switch.tsx",
          "content": "// Original — Frictionborn Motion FlameSwitch (ported from the component lab, b3 · Pilot Flame Switch)\n\"use client\";\n\nimport React, { useCallback, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, useLatest, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { Fire, Smoke, css, paletteRamp, ramp, rand, relBox, trackPointer, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface FlameSwitchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\">, CanvasItemProps {\n  /** Controlled state. Leave undefined to let the switch keep its own state. */\n  checked?: boolean;\n  /** Initial state when uncontrolled. */\n  defaultChecked?: boolean;\n  /** Called with the new state when the switch is pressed. */\n  onCheckedChange?: (checked: boolean) => void;\n  /** Accessible name of the switch (required: it is the only name the control has). */\n  label: string;\n  /** Visible status under the switch, by state. Pass `null` to hide it. */\n  statusText?: { on: string; off: string } | null;\n  disabled?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\nconst STATUS = { on: \"Pilot on\", off: \"Pilot off\" };\n\nexport function FlameSwitch({\n  checked,\n  defaultChecked = false,\n  onCheckedChange,\n  label,\n  statusText = STATUS,\n  disabled = false,\n  palette = \"fire\",\n  paused = false,\n  maxTier = 3,\n  nonce,\n  className = \"\",\n  style,\n  ref,\n  ...rest\n}: FlameSwitchProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const btnRef = useRef<HTMLButtonElement>(null);\n  const [inner, setInner] = useState(defaultChecked);\n  const on = checked ?? inner;\n  const onRef = useLatest(on);\n  const puff = useRef<(() => void) | null>(null);\n\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n\n  // the flame: the lab's b3 drawing, on its own canvas around the switch\n  const wake = useDrawLoop(\n    fxRef,\n    (fx, wakeUp) => {\n      const root = rootRef.current, btn = btnRef.current;\n      const knob = btn?.querySelector(\"i\");\n      if (!root || !btn || !knob) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const pal = paletteRamp(palette, readPalette(root, palette));\n      // the lab's own glow colours for `fire`; other palettes take the same positions on their ramp\n      const fire1 = palette === \"fire\";\n      const glow = fire1 ? [255, 120, 40] : ramp(pal, 0.62);\n      const fire = new Fire(tier >= 3 ? 300 : 150), smoke = new Smoke(60);\n      const p = trackPointer(root, d, { move: () => wakeUp() });\n      let f = onRef.current ? 1 : 0, lean = 0;\n      const at = () => { const k = relBox(knob, fx); return { x: k.x + 16, y: k.y + 10 }; };\n      puff.current = () => {\n        const k = relBox(knob, fx);\n        for (let i = 0; i < 6; i++) smoke.add(k.x + 16, k.y, 8, { vy: -rand(30, 60), a: 0.3 });\n        wakeUp();\n      };\n      return {\n        tick(dt) {\n          const want = onRef.current ? 1 : 0;\n          f += (want - f) * Math.min(1, dt * (want ? 4 : 9));\n          const { x, y } = at();\n          let wind = 0;\n          if (p.in) {\n            const dx = x - p.x, dy = y - p.y, dd = Math.hypot(dx, dy);\n            if (dd < 140) wind = (dx / (dd + 1)) * Math.min(400, p.speed) * (1 - dd / 140);\n          }\n          lean += (wind * 0.25 - lean) * Math.min(1, dt * 6);\n          if (f > 0.05) for (let i = 0; i < 3; i++) fire.add(x + rand(-3, 3), y, rand(5, 9) * f, lean * 0.4 + rand(-6, 6), -rand(40, 80) * f, rand(0.3, 0.55), 1);\n          const g = c.g;\n          g.clearRect(0, 0, c.w, c.h);\n          if (f > 0.02) {\n            const gl = g.createRadialGradient(x, y - 10, 0, x, y - 10, 120 * f);\n            gl.addColorStop(0, css(glow, 0.2 * f));\n            gl.addColorStop(1, css(glow, 0));\n            g.fillStyle = gl;\n            g.fillRect(0, 0, c.w, c.h);\n          }\n          fire.step(dt, -40, lean);\n          fire.draw(g, pal, 0.6);\n          smoke.step(dt, lean * 0.3);\n          smoke.draw(g);\n          p.decay(dt);\n          // keep going while the flame burns (motion allowed), while it is still fading, or while smoke and flame blobs remain\n          const settling = Math.abs(want - f) > 0.002 || Math.abs(lean) > 0.01 || p.speed > 1;\n          return want === 1 || settling || fire.n > 0 || smoke.n > 0;\n        },\n        destroy() {\n          puff.current = null;\n          d.dispose();\n        },\n      };\n    },\n    // reduced motion, Save-Data and tier 0: the switch alone (DESIGN.md A3 `static`)\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}` },\n  );\n\n  const toggle = useCallback(() => {\n    if (disabled) return;\n    const next = !onRef.current;\n    if (checked === undefined) setInner(next);\n    onCheckedChange?.(next);\n    if (!next) puff.current?.();\n    wake();\n  }, [checked, disabled, onCheckedChange, wake]);\n\n  return (\n    <div\n      ref={rootRef}\n      data-frictionborn-item=\"flame-switch\"\n      data-tier={tier}\n      className={`fb-flame-switch ${className}`}\n      style={{ ...paletteVars(palette), ...style }}\n      {...rest}\n    >\n      <style nonce={nonce}>{`\n        /* the effect paints up to 200 px around the control without widening the page (no sideways scroll on phones) */\n        .fb-flame-switch { overflow: clip; overflow-clip-margin: 200px; }\n        .fb-flame-switch { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 12px; }\n        .fb-flame-switch .fb-fs-fx { position: absolute; left: 50%; top: 22px; width: 340px; height: 260px; transform: translate(-50%, -62%); pointer-events: none; }\n        .fb-flame-switch .fb-fs-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-fs-btn { position: relative; width: 96px; height: 44px; padding: 0; border-radius: 999px; border: 1px solid rgba(233, 229, 223, 0.18); background: #191614; cursor: pointer; transition: background 0.3s, border-color 0.3s; }\n        .fb-fs-btn[aria-checked=\"true\"] { background: color-mix(in srgb, var(--fb-heat-1, #7A1D10) 45%, #191614); border-color: color-mix(in srgb, var(--fb-heat-2, #E8590C) 55%, transparent); }\n        .fb-fs-btn:disabled { cursor: not-allowed; opacity: 0.55; }\n        .fb-fs-btn:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 3px; }\n        .fb-fs-btn i { position: absolute; top: 5px; left: 6px; width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f5efe6, #b8b0a6); }\n        [data-motion=\"ok\"] .fb-fs-btn i { transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1); }\n        .fb-fs-btn[aria-checked=\"true\"] i { transform: translateX(50px); }\n        .fb-fs-status { font-family: ui-monospace, \"Geist Mono\", monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground, GrayText); }\n      `}</style>\n      <div ref={fxRef} className=\"fb-fs-fx\" aria-hidden=\"true\" />\n      <button ref={btnRef} type=\"button\" role=\"switch\" aria-checked={on} aria-label={label} disabled={disabled} className=\"fb-fs-btn\" onClick={toggle}>\n        <i />\n      </button>\n      {statusText && <span className=\"fb-fs-status\">{on ? statusText.on : statusText.off}</span>}\n    </div>\n  );\n}\n\nexport default FlameSwitch;\n",
          "type": "registry:ui",
          "target": "components/ui/flame-switch.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "flame-switch",
          "version": "0.1.0",
          "summary": "control: On/off switch with a live pilot flame on its knob (canvas 2D, server-safe switch, reduced motion -> switch only, touch -> same switch)",
          "slot": "control",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "A setting that turns something on or off and deserves a moment of character (a feature flag, a 'live' mode, a heater, a stream)",
            "Brand or product pages built around fire, heat or energy",
            "A single prominent toggle in a hero, a settings card or a demo"
          ],
          "avoidWhen": [
            "Long settings lists with many toggles in a row (use the host's plain switch)",
            "Dense tables or toolbars",
            "Light pages where a dark switch body would look out of place"
          ],
          "alternatives": [
            {
              "name": "eclipse-switch",
              "when": "When the toggle switches between light and dark themes"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The switch only (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Flame on a canvas at DPR ≤ 1.5 with half the flame particles",
            "3": "Flame on a canvas at DPR ≤ 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "The switch alone: no canvas, no flame, the knob moves without a transition. The state and the status text work as usual."
          },
          "input": {
            "pointer": "Click toggles; moving the pointer past a lit flame leans it like a breath",
            "touch": "Tap toggles; no hover effect",
            "keyboard": "A native button with role=switch: Space and Enter toggle, focus ring visible"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.4.11",
            "2.1.1",
            "2.4.7",
            "4.1.2"
          ],
          "notes": "A native <button role=\"switch\"> with aria-checked and the required `label` as its accessible name. The flame canvas is aria-hidden; the visible status text under the switch follows the state."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "eclipse-switch",
            "ember-badge"
          ]
        },
        "props": [
          {
            "name": "label",
            "type": "string",
            "default": null,
            "effect": "Required. The switch's accessible name."
          },
          {
            "name": "checked",
            "type": "boolean",
            "default": null,
            "effect": "Controlled state. Leave undefined for an uncontrolled switch."
          },
          {
            "name": "defaultChecked",
            "type": "boolean",
            "default": false,
            "effect": "Initial state when uncontrolled."
          },
          {
            "name": "onCheckedChange",
            "type": "(checked: boolean) => void",
            "default": null,
            "effect": "Called with the new state on every press."
          },
          {
            "name": "statusText",
            "type": "{ on: string; off: string } | null",
            "default": "{ on: \"Pilot on\", off: \"Pilot off\" }",
            "effect": "Visible status under the switch; null hides it."
          },
          {
            "name": "disabled",
            "type": "boolean",
            "default": false,
            "effect": "Disables the switch."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Flame colours (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the flame stops drawing; the switch still works."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier (0 = switch only)."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root (fb-flame-switch is kept)."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div>."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/flame-switch",
          "usage": "import { useState } from \"react\";\nimport { FlameSwitch } from \"@/components/ui/flame-switch\";\n\nexport function LiveMode() {\n  const [live, setLive] = useState(false);\n  return <FlameSwitch label=\"Live mode\" checked={live} onCheckedChange={setLive} statusText={{ on: \"Live\", off: \"Off\" }} />;\n}",
          "mistakes": [
            "label is required: it is the switch's only accessible name. Do not rely on nearby text.",
            "The flame draws above the switch (about 140 px): leave room above it and do not clip the parent with overflow: hidden.",
            "Use it for one or two important toggles, not for every row of a settings list."
          ],
          "verify": [
            "Server HTML has a <button role=\"switch\"> with aria-checked and the label.",
            "Space toggles the switch when it has focus and the status text follows.",
            "With reduced motion there is no canvas and no frame runs; the switch still toggles."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "6c7edd7e81643e6933a11fa47860a06a5016981b8e0f8c76d9914bf2a1f4b627",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.98,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "flint-button",
      "type": "registry:ui",
      "title": "FlintButton",
      "description": "cta: Button that strikes like flint: a steel rakes the stone and throws sparks; heat builds until it catches (canvas 2D, native button, reduced motion -> plain)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/flint-button/flint-button.tsx",
          "content": "// Original — Frictionborn Motion FlintButton (ported from the component lab, a1 · Flint Strike Button)\n\"use client\";\n\nimport React, { useImperativeHandle, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { Sparks, paletteRamp, rand, relBox, trackPointer, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface FlintButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\">, CanvasItemProps {\n  /** The button's label while cold. */\n  children: React.ReactNode;\n  /** The label once the stone has caught (after enough strikes or a fast rub). */\n  litLabel?: React.ReactNode;\n  /** Visible heat status under the button, announced politely. Pass `null` to hide it. */\n  statusText?: { cold: string; warm: string; hot: string; burning: string } | null;\n  /** Receives the <button>. */\n  ref?: React.Ref<HTMLButtonElement>;\n}\n\nconst STATUS = { cold: \"Cold stone\", warm: \"Warm\", hot: \"Hot\", burning: \"Burning\" };\n\nexport function FlintButton({ children, litLabel = \"Lit\", statusText = STATUS, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, onClick, ref, ...rest }: FlintButtonProps) {\n  const rootRef = useRef<HTMLSpanElement>(null);\n  const fxRef = useRef<HTMLSpanElement>(null);\n  const btnRef = useRef<HTMLButtonElement>(null);\n  const steelRef = useRef<HTMLElement>(null);\n  const strikeRef = useRef<(() => void) | null>(null);\n  /** the heat as words: changes a handful of times per strike, so it is React state (label and status follow it) */\n  const [phase, setPhase] = useState<keyof typeof STATUS>(\"cold\");\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n  useImperativeHandle(ref, () => btnRef.current as HTMLButtonElement);\n\n  // the strike: the lab's a1 drawing (steel rakes the flint, sparks, heat that builds until the stone catches)\n  const wake = useDrawLoop(\n    fxRef,\n    (fx, wakeUp) => {\n      const root = rootRef.current, btn = btnRef.current, steel = steelRef.current;\n      if (!root || !btn || !steel) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const sp = new Sparks(tier >= 3 ? 900 : 400, palette === \"fire\" ? null : paletteRamp(palette, readPalette(root, palette)));\n      const p = trackPointer(btn, d, { move: () => wakeUp() });\n      let heat = 0, strike = -1, lit = 0, shown = \"\";\n      strikeRef.current = () => { strike = 0; wakeUp(); };\n      return {\n        tick(dt) {\n          const b = relBox(btn, fx);\n          if (p.in && p.speed > 260) {\n            heat += (dt * p.speed) / 2600;\n            if (Math.random() < p.speed / 4000) sp.add(b.x + p.x, b.y + p.y, rand(-80, 80), -rand(40, 160), 0.4, 1, 500);\n          }\n          if (strike >= 0) {\n            strike += dt;\n            const u = strike / 0.26;\n            if (u <= 1) {\n              const x = b.w * (0.08 + 0.84 * u);\n              steel.style.visibility = \"visible\";\n              steel.style.transform = `translateX(${x - 23}px) rotate(-14deg)`;\n              sp.burst(b.x + x, b.y + 2, 9, 250, 820, { dir: -Math.PI / 2 + 0.55, spread: 0.75, l0: 0.25, l1: 0.7 });\n              heat = Math.min(1.5, heat + dt * 3.6);\n            } else {\n              strike = -1;\n              steel.style.visibility = \"hidden\";\n            }\n          }\n          if (heat > 1 && !lit) {\n            lit = 2.4;\n            sp.burst(b.x + b.w / 2, b.y + b.h / 2, 60, 150, 600, { l1: 1 });\n          }\n          if (lit > 0) {\n            lit -= dt;\n            heat = Math.max(heat, 0.95);\n            if (Math.random() < dt * 30) sp.add(b.x + rand(10, b.w - 10), b.y + 4, rand(-20, 20), -rand(40, 120), rand(0.6, 1.4), 1, -40, 0.6);\n            if (lit <= 0) { lit = 0; heat = 0.9; }\n          }\n          heat = Math.max(0, heat - dt * (lit ? 0 : 0.32));\n          btn.style.setProperty(\"--fb-fb-h\", Math.min(1, heat).toFixed(3));\n          const key = lit ? \"burning\" : heat > 0.5 ? \"hot\" : heat > 0.15 ? \"warm\" : \"cold\";\n          if (key !== shown) {\n            shown = key;\n            setPhase(key);\n          }\n          p.decay(dt);\n          sp.step(dt);\n          c.g.clearRect(0, 0, c.w, c.h);\n          sp.draw(c.g);\n          return heat > 0.001 || strike >= 0 || lit > 0 || sp.n > 0 || p.speed > 1;\n        },\n        destroy() {\n          strikeRef.current = null;\n          btn.style.removeProperty(\"--fb-fb-h\");\n          setPhase(\"cold\");\n          d.dispose();\n        },\n      };\n    },\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}` },\n  );\n\n  return (\n    <span ref={rootRef} className=\"fb-flint-button\" style={paletteVars(palette)}>\n      <style nonce={nonce}>{`\n        /* the effect paints up to 200 px around the control without widening the page (no sideways scroll on phones) */\n        .fb-flint-button { overflow: clip; overflow-clip-margin: 200px; }\n        .fb-flint-button { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 12px; }\n        .fb-fl-fx { display: block; position: absolute; left: 50%; top: 34px; width: 420px; height: 300px; transform: translate(-50%, -70%); pointer-events: none; z-index: 2; }\n        .fb-fl-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-fl-btn { --fb-fb-h: 0; position: relative; min-width: 210px; height: 68px; padding: 0 28px; border-radius: 18px; border: 0; cursor: pointer; color: #cfc6bd; font-family: inherit; font-weight: 600; font-size: 16px; line-height: 1; letter-spacing: 0.02em;\n          background: radial-gradient(120% 90% at 30% 20%, #57504b, #2c2826 55%, #1a1716);\n          box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -6px 14px rgba(0,0,0,.5), 0 10px 24px rgba(0,0,0,.5),\n            inset 0 0 calc(var(--fb-fb-h) * 46px) color-mix(in srgb, var(--fb-heat-2, #E8590C) calc(var(--fb-fb-h) * 95%), transparent),\n            0 0 calc(var(--fb-fb-h) * 46px) color-mix(in srgb, var(--fb-heat-2, #E8590C) calc(var(--fb-fb-h) * 55%), transparent); }\n        [data-motion=\"ok\"] .fb-fl-btn { transition: transform 0.12s; }\n        .fb-fl-btn:active { transform: translateY(1px) scale(0.985); }\n        .fb-fl-btn:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 3px; }\n        .fb-fl-btn::before { content: \"\"; position: absolute; inset: 0; border-radius: inherit; opacity: 0.35; pointer-events: none;\n          background: repeating-radial-gradient(circle at 70% 60%, transparent 0 3px, rgba(255,255,255,.04) 3px 4px), repeating-linear-gradient(115deg, transparent 0 9px, rgba(0,0,0,.18) 9px 10px); }\n        .fb-fl-text { position: relative; z-index: 1; text-shadow: 0 0 calc(var(--fb-fb-h) * 18px) color-mix(in srgb, var(--fb-heat-3, #FFB15C) calc(var(--fb-fb-h) * 100%), transparent); }\n        .fb-fl-steel { position: absolute; left: 0; top: -12px; width: 46px; height: 12px; border-radius: 3px; background: linear-gradient(#e9edf0, #8d959c 50%, #555c62); transform-origin: left center; visibility: hidden; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.6); }\n        .fb-fl-status { font: 11px ui-monospace, \"Geist Mono\", monospace; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground, GrayText); }\n      `}</style>\n      <span ref={fxRef} className=\"fb-fl-fx\" aria-hidden=\"true\" />\n      <button\n        ref={btnRef}\n        type=\"button\"\n        data-frictionborn-item=\"flint-button\"\n        data-tier={tier}\n        className={`fb-fl-btn ${className}`}\n        style={style}\n        onClick={(e) => {\n          strikeRef.current?.();\n          wake();\n          onClick?.(e);\n        }}\n        {...rest}\n      >\n        <span className=\"fb-fl-text\">{phase === \"burning\" ? litLabel : children}</span>\n        <i ref={steelRef} className=\"fb-fl-steel\" aria-hidden=\"true\" />\n      </button>\n      {statusText && (\n        <span className=\"fb-fl-status\" aria-live=\"polite\">\n          {statusText[phase]}\n        </span>\n      )}\n    </span>\n  );\n}\n\nexport default FlintButton;\n",
          "type": "registry:ui",
          "target": "components/ui/flint-button.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "flint-button",
          "version": "0.1.0",
          "summary": "cta: Button that strikes like flint: a steel rakes the stone and throws sparks; heat builds until it catches (canvas 2D, native button, reduced motion -> plain)",
          "slot": "cta",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "One primary action with a moment of character (start, ignite, launch, generate)",
            "Brand pages about fire, energy or making"
          ],
          "avoidWhen": [
            "Forms with several buttons in a row",
            "Destructive actions (use hold-to-confirm)",
            "Light pages where a dark stone button would look out of place"
          ],
          "alternatives": [
            {
              "name": "magnetic-button",
              "when": "When the button should feel physical without fire"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The control alone (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Effect on a canvas at DPR <= 1.5 with half the particles",
            "3": "Effect on a canvas at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "A plain stone button: no steel, no sparks, no glow, no canvas. Clicks work as usual."
          },
          "input": {
            "pointer": "Click strikes; rubbing fast across the button heats it",
            "touch": "Tap strikes",
            "keyboard": "A native <button>: Enter and Space strike, focus ring visible"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "2.1.1",
            "2.4.7",
            "4.1.2",
            "4.1.3"
          ],
          "notes": "A native <button> with its text label (which becomes litLabel while it burns). The optional heat status under it is aria-live=polite. The spark canvas and the steel are aria-hidden. Sparks last under 3 s per strike."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "flame-switch",
            "hold-to-confirm"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Required. The button's label while cold."
          },
          {
            "name": "litLabel",
            "type": "React.ReactNode",
            "default": "Lit",
            "effect": "The label while the stone burns."
          },
          {
            "name": "statusText",
            "type": "{ cold: string; warm: string; hot: string; burning: string } | null",
            "default": "{ cold: \"Cold stone\", warm: \"Warm\", hot: \"Hot\", burning: \"Burning\" }",
            "effect": "Visible heat status under the button (aria-live polite); null hides it."
          },
          {
            "name": "onClick",
            "type": "React.MouseEventHandler<HTMLButtonElement>",
            "default": null,
            "effect": "Your action; runs on every strike."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLButtonElement>",
            "default": null,
            "effect": "Receives the <button>; className, style and the rest of the props go on the button too."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/flint-button",
          "usage": "import { FlintButton } from \"@/components/ui/flint-button\";\n\nexport function Start({ onStart }: { onStart: () => void }) {\n  return <FlintButton onClick={onStart} litLabel=\"Started\">Start the bench</FlintButton>;\n}",
          "mistakes": [
            "The sparks fly above the button (about 200 px): leave room and do not clip the parent with overflow: hidden.",
            "One per view: it is a primary action, not a toolbar button.",
            "ref, className and style apply to the <button>, not to the wrapper."
          ],
          "verify": [
            "Server HTML has a native <button> with its label.",
            "Enter strikes: the steel sweeps, sparks fly and the status warms.",
            "After the sparks fade and the stone cools, the loop stops."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "64e1e7df6c48e9a8843523a95a83ffca18aac61ef26f4347ffa662b11a0b93de",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.13,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "fuse-toast",
      "type": "registry:ui",
      "title": "FuseToast",
      "description": "feedback: Undo toast whose time runs out as a fuse burning along its edge; it pauses while hovered or focused (canvas 2D, server-safe toast)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/fuse-toast/fuse-toast.tsx",
          "content": "// Original — Frictionborn Motion FuseToast (ported from the component lab, v3 · Undo Fuse Toast)\n\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, useLatest, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { Sparks, paletteRamp, relBox, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface FuseToastProps extends React.HTMLAttributes<HTMLDivElement>, CanvasItemProps {\n  /** Show the toast; the fuse starts burning each time it opens. */\n  open: boolean;\n  /** What happened (\"Message archived.\"). */\n  message: React.ReactNode;\n  /** The action offered while the fuse burns. */\n  actionLabel?: string;\n  /** The visitor pressed the action before the fuse burnt out (undo). */\n  onAction?: () => void;\n  /** The fuse burnt out: commit the action. */\n  onExpire?: () => void;\n  /** Shown for a moment after the fuse burns out, before the toast closes. */\n  expiredMessage?: React.ReactNode;\n  /** Called when the toast should close (after the action, or after the expired message). */\n  onClose?: () => void;\n  /** Fuse length in ms. The fuse stops while the pointer is over the toast or focus is inside it. */\n  duration?: number;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\n/** the lit fuse head: a soft glow and a white-hot bead (the lab's fbFuseHead) */\nfunction drawHead(g: CanvasRenderingContext2D, x: number, y: number, glow: string, glow0: string, bead: string, bead0: string) {\n  g.save();\n  g.globalCompositeOperation = \"lighter\";\n  let gr = g.createRadialGradient(x, y, 0, x, y, 26);\n  gr.addColorStop(0, glow);\n  gr.addColorStop(1, glow0);\n  g.fillStyle = gr;\n  g.fillRect(x - 26, y - 26, 52, 52);\n  gr = g.createRadialGradient(x, y, 0, x, y, 6);\n  gr.addColorStop(0, \"#fff\");\n  gr.addColorStop(0.5, bead);\n  gr.addColorStop(1, bead0);\n  g.fillStyle = gr;\n  g.beginPath();\n  g.arc(x, y, 6, 0, 7);\n  g.fill();\n  g.restore();\n}\n\nexport function FuseToast({ open, message, actionLabel = \"Undo\", onAction, onExpire, expiredMessage, onClose, duration = 5000, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: FuseToastProps) {\n  const rootRef = useItemRef(ref);\n  const cardRef = useRef<HTMLDivElement>(null);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const [expired, setExpired] = useState(false);\n  const hold = useRef(false);\n  /** burnt share of the fuse, 0..1, advanced by the timer below (so it expires at every tier, canvas or not) */\n  const burnt = useRef(0);\n  /** the action was taken: the fuse stops and nothing commits */\n  const acted = useRef(false);\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n  const cb = useLatest({ onExpire, onClose });\n  // a fresh fuse each time the toast opens (state reset when the prop changes, during render: React's documented pattern)\n  const [wasOpen, setWasOpen] = useState(open);\n  if (open !== wasOpen) {\n    setWasOpen(open);\n    if (open) setExpired(false);\n  }\n\n  // the fuse: the lab's v3 drawing along the toast's bottom edge\n  const wake = useDrawLoop(\n    fxRef,\n    (fx) => {\n      const root = rootRef.current, card = cardRef.current;\n      if (!root || !card) return null;\n      const s = stage(fx, tier, root);\n      if (!s) return null;\n      const { d, c } = s;\n      const fire = palette === \"fire\";\n      const pal = paletteRamp(palette, readPalette(root, palette));\n      const sp = new Sparks(tier >= 3 ? 300 : 150, fire ? null : pal);\n      const glow = fire ? \"rgba(255,150,60,.5)\" : `rgba(${pal[3][1].join(\",\")},.5)`;\n      const glow0 = fire ? \"rgba(255,100,30,0)\" : `rgba(${pal[2][1].join(\",\")},0)`;\n      const bead = fire ? \"rgba(255,210,120,.9)\" : `rgba(${pal[3][1].join(\",\")},.9)`;\n      const bead0 = fire ? \"rgba(255,140,40,0)\" : `rgba(${pal[2][1].join(\",\")},0)`;\n      return {\n        tick(dt) {\n          const g = c.g;\n          g.clearRect(0, 0, c.w, c.h);\n          if (!card.isConnected || card.hidden) return sp.n > 0;\n          const r = relBox(card, fx), x0 = r.x + 10, x1 = r.x + r.w - 10, y = r.y + r.h - 5;\n          const u = Math.min(1, burnt.current), hx = x1 - (x1 - x0) * u;\n          g.lineCap = \"round\";\n          g.strokeStyle = \"#7d5d3b\";\n          g.lineWidth = 3.4;\n          g.beginPath();\n          g.moveTo(x0, y);\n          g.lineTo(hx, y);\n          g.stroke();\n          g.strokeStyle = \"#4e3822\";\n          g.setLineDash([2, 3]);\n          g.stroke();\n          g.setLineDash([]);\n          g.strokeStyle = \"#8a7f74\";\n          g.lineWidth = 1.4;\n          g.beginPath();\n          g.moveTo(hx, y);\n          g.lineTo(x1, y);\n          g.stroke();\n          const burning = u < 1 && !hold.current;\n          if (u < 1) drawHead(g, hx, y, glow, glow0, bead, bead0);\n          if (burning) sp.burst(hx, y, 3, 50, 220, { l0: 0.1, l1: 0.35, w0: 0.5, w1: 1, grav: 400 });\n          sp.step(dt);\n          sp.draw(g);\n          return burning || sp.n > 0;\n        },\n        destroy: () => d.dispose(),\n      };\n    },\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}` },\n  );\n\n  // the timer: a fresh fuse each time the toast opens; it stops while hovered or focused; at the end it commits\n  useEffect(() => {\n    if (!open) return;\n    burnt.current = 0;\n    acted.current = false;\n    let last = performance.now(), closeT = 0;\n    const id = window.setInterval(() => {\n      const now = performance.now();\n      if (acted.current) return window.clearInterval(id);\n      if (!hold.current && !paused) burnt.current += (now - last) / duration;\n      last = now;\n      if (burnt.current >= 1) {\n        window.clearInterval(id);\n        setExpired(true);\n        cb.current.onExpire?.();\n        closeT = window.setTimeout(() => cb.current.onClose?.(), 1200);\n      }\n    }, 50);\n    wake();\n    return () => {\n      window.clearInterval(id);\n      window.clearTimeout(closeT);\n    };\n  }, [open, duration, paused, wake, cb]);\n\n  const holdStart = () => {\n    hold.current = true;\n    wake();\n  };\n  const holdEnd = () => {\n    hold.current = false;\n    wake();\n  };\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"fuse-toast\" data-tier={tier} className={`fb-fuse-toast ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        /* the effect paints up to 200 px around the control without widening the page (no sideways scroll on phones) */\n        .fb-fuse-toast { overflow: clip; overflow-clip-margin: 200px; }\n        .fb-fuse-toast { position: relative; }\n        .fb-ft-fx { position: absolute; inset: -30px -20px; pointer-events: none; z-index: 3; }\n        .fb-ft-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-ft-card { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px 16px; border-radius: 12px; background: #efe6d6; color: #2a2018; font-size: 14px; z-index: 2; }\n        .fb-ft-card[hidden] { display: none; }\n        .fb-ft-card > span { flex: 1; }\n        .fb-ft-btn { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid #2a2018; background: #2a2018; color: #efe6d6; font: inherit; font-size: 13px; cursor: pointer; }\n        .fb-ft-btn:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 2px; }\n        .fb-ft-card::after { content: \"\"; position: absolute; left: 10px; right: 10px; bottom: 4px; height: 2px; border-radius: 2px; background: #8a7f74; }\n        .fb-fuse-toast[data-drawn] .fb-ft-card::after { display: none; }\n      `}</style>\n      <div ref={fxRef} className=\"fb-ft-fx\" aria-hidden=\"true\" />\n      <div role=\"status\" aria-live=\"polite\">\n        <div ref={cardRef} className=\"fb-ft-card\" hidden={!open} onPointerEnter={holdStart} onPointerLeave={holdEnd} onFocus={holdStart} onBlur={holdEnd}>\n          <span>{expired && expiredMessage ? expiredMessage : message}</span>\n          {!expired && (\n            <button\n              type=\"button\"\n              className=\"fb-ft-btn\"\n              onClick={() => {\n                acted.current = true;\n                onAction?.();\n                onClose?.();\n              }}\n            >\n              {actionLabel}\n            </button>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n}\n\nexport default FuseToast;\n",
          "type": "registry:ui",
          "target": "components/ui/fuse-toast.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "fuse-toast",
          "version": "0.1.0",
          "summary": "feedback: Undo toast whose time runs out as a fuse burning along its edge; it pauses while hovered or focused (canvas 2D, server-safe toast)",
          "slot": "feedback",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "Undo after a reversible action (archive, delete to trash, move)",
            "A single, important confirmation that commits after a few seconds"
          ],
          "avoidWhen": [
            "Errors or messages that must not disappear on their own",
            "Several toasts stacked at once (one fuse at a time reads best)"
          ],
          "alternatives": []
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The control alone (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Effect on a canvas at DPR <= 1.5 with half the particles",
            "3": "Effect on a canvas at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "The toast works and times out the same; the fuse is a plain line with no flame, sparks or canvas."
          },
          "input": {
            "pointer": "The action button; the fuse stops while the pointer is over the toast",
            "touch": "The action button",
            "keyboard": "The action is a native button; the fuse stops while focus is inside the toast"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "2.2.1",
            "2.1.1",
            "4.1.3"
          ],
          "notes": "The toast sits in a role=status live region, so its message is announced. The time limit stops while the pointer is over it or focus is inside it (WCAG 2.2.1), and `duration` sets its length. The fuse canvas is aria-hidden."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "match-progress",
            "hold-to-confirm"
          ]
        },
        "props": [
          {
            "name": "open",
            "type": "boolean",
            "default": null,
            "effect": "Required. Shows the toast; a fresh fuse starts each time it opens."
          },
          {
            "name": "message",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Required. What happened."
          },
          {
            "name": "actionLabel",
            "type": "string",
            "default": "Undo",
            "effect": "The action offered while the fuse burns."
          },
          {
            "name": "onAction",
            "type": "() => void",
            "default": null,
            "effect": "The action was pressed before the fuse burnt out."
          },
          {
            "name": "onExpire",
            "type": "() => void",
            "default": null,
            "effect": "The fuse burnt out: commit the action."
          },
          {
            "name": "expiredMessage",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Shown for 1.2 s after the fuse burns out."
          },
          {
            "name": "onClose",
            "type": "() => void",
            "default": null,
            "effect": "The toast should close (after the action, or after the expired message)."
          },
          {
            "name": "duration",
            "type": "number",
            "default": 5000,
            "effect": "Fuse length in ms (paused while hovered or focused)."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/fuse-toast",
          "usage": "import { useState } from \"react\";\nimport { FuseToast } from \"@/components/ui/fuse-toast\";\n\nexport function ArchiveRow({ onArchive, onRestore }: { onArchive: () => void; onRestore: () => void }) {\n  const [open, setOpen] = useState(false);\n  return (\n    <>\n      <button type=\"button\" onClick={() => setOpen(true)}>Archive</button>\n      <FuseToast open={open} message=\"Message archived.\" onAction={onRestore} onExpire={onArchive} onClose={() => setOpen(false)} />\n    </>\n  );\n}",
          "mistakes": [
            "Commit the action in onExpire, not when the toast opens: Undo must really undo.",
            "Close it from onClose (set open to false); the toast does not unmount itself.",
            "Do not use it for errors: it disappears on its own."
          ],
          "verify": [
            "Opening it announces the message (role=status).",
            "The action button calls onAction and onClose, and onExpire never fires.",
            "Hovering or focusing the toast stops the fuse."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "c4927be8eb0f474c10d4c7ce9b023c9d8d470a386fdb22696975b9513d80cb2f",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.1,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "hold-to-confirm",
      "type": "registry:ui",
      "title": "HoldToConfirm",
      "description": "control: Press-and-hold button for destructive actions: it fills, then crumbles to ash left to right; Undo rebuilds it (canvas 2D, native button)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/hold-to-confirm/hold-to-confirm.tsx",
          "content": "// Original — Frictionborn Motion HoldToConfirm (ported from the component lab, c2 · Hold-to-Delete Ash Button)\n\"use client\";\n\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, useLatest, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { heat, noise, paletteRamp, rand, relBox, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface HoldToConfirmProps extends React.HTMLAttributes<HTMLDivElement>, CanvasItemProps {\n  /** The button's label (\"Hold to delete ember.fig\"). */\n  children: React.ReactNode;\n  /** How long the press must be held, in ms. */\n  holdMs?: number;\n  /** The hold completed: do the action. */\n  onConfirm?: () => void;\n  /** Shown (and announced) once confirmed. */\n  confirmedText?: React.ReactNode;\n  /** Label of the button that takes it back. Pass `null` for no undo. */\n  undoLabel?: string | null;\n  onUndo?: () => void;\n  disabled?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface Grain { hx: number; hy: number; x: number; y: number; vx: number; vy: number; t: number; on: number }\n\nexport function HoldToConfirm({ children, holdMs = 1000, onConfirm, confirmedText = \"Done.\", undoLabel = \"Undo\", onUndo, disabled = false, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: HoldToConfirmProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const btnRef = useRef<HTMLButtonElement>(null);\n  const undoRef = useRef<HTMLButtonElement>(null);\n  const [holding, setHolding] = useState(false);\n  const [done, setDone] = useState(false);\n  const fxApi = useRef<{ crumble: () => void; rebuild: () => void } | null>(null);\n  const timer = useRef(0);\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n  const cb = useLatest({ onConfirm, onUndo });\n\n  // the ash: the lab's c2 drawing (the button breaks into grains that glow, cool and fall left to right; undo gathers them back)\n  const wake = useDrawLoop(\n    fxRef,\n    (fx, wakeUp) => {\n      const root = rootRef.current, btn = btnRef.current;\n      if (!root || !btn) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const pal = paletteRamp(palette, readPalette(root, palette));\n      const back = palette === \"fire\" ? [194, 65, 12] : pal[2][1];\n      let P: Grain[] = [], state: \"idle\" | \"ash\" | \"back\" = \"idle\", st = 0;\n      const step = tier >= 3 ? 2.5 : 3.5;\n      fxApi.current = {\n        crumble() {\n          const r = relBox(btn, fx);\n          P = [];\n          for (let y = 0; y < r.h; y += step) for (let x = 0; x < r.w; x += step) P.push({ hx: r.x + x, hy: r.y + y, x: r.x + x, y: r.y + y, vx: 0, vy: 0, t: (x / r.w) * 0.7 + Math.random() * 0.15, on: 0 });\n          state = \"ash\";\n          st = 0;\n          wakeUp();\n        },\n        rebuild() {\n          if (!P.length) return;\n          state = \"back\";\n          st = 0;\n          wakeUp();\n        },\n      };\n      return {\n        tick(dt, t) {\n          const g = c.g;\n          g.clearRect(0, 0, c.w, c.h);\n          if (state === \"idle\") return false;\n          st += dt;\n          for (const q of P) {\n            if (state === \"ash\") {\n              if (st > q.t) {\n                if (!q.on) { q.on = 1; q.vx = rand(10, 80); q.vy = rand(-40, 10); }\n                q.vy += 90 * dt;\n                q.vx += (noise(q.x * 0.03, t) - 0.4) * 120 * dt;\n                q.x += q.vx * dt;\n                q.y += q.vy * dt;\n              }\n            } else {\n              q.x += (q.hx - q.x) * Math.min(1, dt * 6);\n              q.y += (q.hy - q.y) * Math.min(1, dt * 6);\n            }\n            const age = state === \"ash\" ? st - q.t : 0;\n            if (state === \"ash\" && age > 0 && age < 0.35) g.fillStyle = heat(pal, 0.9 - age * 1.6);\n            else if (state === \"ash\" && age > 0) g.fillStyle = `rgba(120,112,106,${Math.max(0, 1 - (age - 0.35) / 2)})`;\n            else g.fillStyle = state === \"back\" ? `rgba(${back[0]},${back[1]},${back[2]},${0.5 + 0.5 * Math.min(1, st * 2)})` : \"#3a1712\";\n            g.fillRect(q.x, q.y, 2.4, 2.4);\n          }\n          if (state === \"back\" && st > 0.7) {\n            state = \"idle\";\n            P = [];\n            g.clearRect(0, 0, c.w, c.h);\n            return false;\n          }\n          // the grains have fallen and faded about 3 s after the hold\n          if (state === \"ash\" && st > 3.2) {\n            g.clearRect(0, 0, c.w, c.h);\n            return false;\n          }\n          return true;\n        },\n        destroy() {\n          fxApi.current = null;\n          d.dispose();\n        },\n      };\n    },\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}` },\n  );\n\n  const confirm = useCallback(() => {\n    setHolding(false);\n    setDone(true);\n    fxApi.current?.crumble();\n    cb.current.onConfirm?.();\n  }, []);\n\n  const start = useCallback(() => {\n    if (disabled || done) return;\n    setHolding(true);\n    window.clearTimeout(timer.current);\n    timer.current = window.setTimeout(confirm, holdMs);\n  }, [disabled, done, holdMs, confirm]);\n  const stop = useCallback(() => {\n    window.clearTimeout(timer.current);\n    setHolding(false);\n  }, []);\n  useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  // once confirmed, focus moves to Undo (the button it replaced is gone); after undo it comes back to the button\n  const wasDone = useRef(false);\n  useEffect(() => {\n    if (done) undoRef.current?.focus({ preventScroll: true });\n    else if (wasDone.current) btnRef.current?.focus({ preventScroll: true });\n    wasDone.current = done;\n  }, [done]);\n\n  const undo = () => {\n    setDone(false);\n    fxApi.current?.rebuild();\n    wake();\n    cb.current.onUndo?.();\n  };\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"hold-to-confirm\" data-tier={tier} className={`fb-hold-to-confirm ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        /* the effect paints up to 200 px around the control without widening the page (no sideways scroll on phones) */\n        .fb-hold-to-confirm { overflow: clip; overflow-clip-margin: 200px; }\n        .fb-hold-to-confirm { position: relative; display: inline-grid; justify-items: center; gap: 12px; }\n        .fb-htc-fx { position: absolute; left: 50%; top: 50%; width: calc(100% + 240px); height: 260px; transform: translate(-50%, -40%); pointer-events: none; z-index: 2; }\n        .fb-htc-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-htc-btn { position: relative; min-height: 52px; padding: 0 26px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--fb-heat-2, #E8590C) 45%, transparent); background: #2a1210; color: #ffd9cf;\n          font-family: inherit; font-weight: 600; font-size: 15px; cursor: pointer; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }\n        .fb-htc-btn:disabled { cursor: not-allowed; opacity: 0.55; }\n        .fb-htc-btn:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 3px; }\n        .fb-htc-btn > span { position: relative; }\n        .fb-htc-btn::before { content: \"\"; position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--fb-heat-1, #7A1D10), var(--fb-heat-2, #C2410C)); transition: transform 0.25s ease-out; }\n        .fb-htc-btn[data-holding=\"true\"]::before { transform: scaleX(1); transition: transform var(--fb-htc-ms) linear; }\n        .fb-htc-btn[hidden] { display: none; }\n        .fb-htc-done { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--foreground, #cfc4b9); }\n        .fb-htc-undo { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(233, 229, 223, 0.18); background: #1d1a18; color: #E9E5DF; font: inherit; font-size: 13px; cursor: pointer; }\n        .fb-htc-undo:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 2px; }\n      `}</style>\n      <div ref={fxRef} className=\"fb-htc-fx\" aria-hidden=\"true\" />\n      <button\n        ref={btnRef}\n        type=\"button\"\n        className=\"fb-htc-btn\"\n        hidden={done}\n        disabled={disabled}\n        data-holding={holding}\n        style={{ [\"--fb-htc-ms\" as string]: `${holdMs}ms` }}\n        onPointerDown={start}\n        onPointerUp={stop}\n        onPointerLeave={stop}\n        onPointerCancel={stop}\n        onKeyDown={(e) => {\n          if ((e.key === \"Enter\" || e.key === \" \") && !e.repeat) {\n            e.preventDefault();\n            start();\n          }\n        }}\n        onKeyUp={(e) => {\n          if (e.key === \"Enter\" || e.key === \" \") stop();\n        }}\n        onBlur={stop}\n      >\n        <span>{children}</span>\n      </button>\n      <div role=\"status\" className=\"fb-htc-done\">\n        {done && (\n          <>\n            <span>{confirmedText}</span>\n            {undoLabel && (\n              <button ref={undoRef} type=\"button\" className=\"fb-htc-undo\" onClick={undo}>\n                {undoLabel}\n              </button>\n            )}\n          </>\n        )}\n      </div>\n    </div>\n  );\n}\n\nexport default HoldToConfirm;\n",
          "type": "registry:ui",
          "target": "components/ui/hold-to-confirm.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "hold-to-confirm",
          "version": "0.1.0",
          "summary": "control: Press-and-hold button for destructive actions: it fills, then crumbles to ash left to right; Undo rebuilds it (canvas 2D, native button)",
          "slot": "control",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "A destructive or costly action that deserves a deliberate press (delete, discard, revoke)",
            "Replacing a confirmation dialog with something faster and harder to trigger by accident"
          ],
          "avoidWhen": [
            "Everyday actions (a hold slows people down)",
            "Actions that cannot be undone, unless you pass undoLabel={null} and say so in the label"
          ],
          "alternatives": [
            {
              "name": "fuse-toast",
              "when": "When the action should happen at once and offer undo afterwards"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The control alone (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Effect on a canvas at DPR <= 1.5 with half the particles",
            "3": "Effect on a canvas at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "The hold works the same with a filling bar; the button simply disappears when confirmed (no crumble, no canvas)."
          },
          "input": {
            "pointer": "Press and hold for holdMs; releasing early cancels",
            "touch": "Press and hold (touch-action: none on the button)",
            "keyboard": "Hold Enter or Space; releasing early cancels; focus moves to Undo once confirmed and back after undo"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "2.1.1",
            "2.4.3",
            "2.5.2",
            "4.1.3"
          ],
          "notes": "A native <button>; the label should say it needs a hold. Confirmation is announced in a role=status region, which also holds the Undo button (focus moves there). Releasing before holdMs cancels (WCAG 2.5.2). The ash canvas is aria-hidden."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "fuse-toast",
            "flint-button"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Required. The label, which should say that it needs a hold."
          },
          {
            "name": "holdMs",
            "type": "number",
            "default": 1000,
            "effect": "How long the press must be held, in ms."
          },
          {
            "name": "onConfirm",
            "type": "() => void",
            "default": null,
            "effect": "The hold completed: do the action."
          },
          {
            "name": "confirmedText",
            "type": "React.ReactNode",
            "default": "Done.",
            "effect": "Shown and announced once confirmed."
          },
          {
            "name": "undoLabel",
            "type": "string | null",
            "default": "Undo",
            "effect": "Label of the undo button; null for no undo."
          },
          {
            "name": "onUndo",
            "type": "() => void",
            "default": null,
            "effect": "Undo was pressed."
          },
          {
            "name": "disabled",
            "type": "boolean",
            "default": false,
            "effect": "Disables the button."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/hold-to-confirm",
          "usage": "import { HoldToConfirm } from \"@/components/ui/hold-to-confirm\";\n\nexport function DeleteDraft({ onDelete, onRestore }: { onDelete: () => void; onRestore: () => void }) {\n  return (\n    <HoldToConfirm onConfirm={onDelete} onUndo={onRestore} confirmedText=\"Draft deleted.\">\n      Hold to delete draft\n    </HoldToConfirm>\n  );\n}",
          "mistakes": [
            "Say \"Hold to …\" in the label: nothing else tells people a click is not enough.",
            "If the action cannot be undone, pass undoLabel={null} rather than an Undo that does nothing.",
            "The ash falls below and beside the button: do not clip the parent with overflow: hidden."
          ],
          "verify": [
            "Server HTML has a native <button> with the label and an empty status region.",
            "Holding Enter for holdMs confirms; releasing early does not.",
            "Undo restores the button and moves focus back to it."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "da5601087df42a85e94a1a5074ebbae5ea87431f8f0435301f84827fae42da4d",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.33,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "lantern-sky",
      "type": "registry:ui",
      "title": "LanternSky",
      "description": "background: Night sky of paper lanterns rising at different depths; the pointer is a warm breeze (canvas 2D, server-safe, reduced motion -> still sky)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/lantern-sky/lantern-sky.tsx",
          "content": "// Original — Frictionborn Motion LanternSky (ported from the component lab, s3 · Lantern Sky Background)\n\"use client\";\n\nimport React, { useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, usePaused, useItemEnv, useItemRef, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { paletteRamp, rand, ramp, trackPointer, type Ramp, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface LanternSkyProps extends React.HTMLAttributes<HTMLDivElement>, CanvasItemProps {\n  /** Content shown over the sky (a headline, a call to action). */\n  children?: React.ReactNode;\n  /** Lanterns per 10,000 px² of sky (the lab used about 1.1). */\n  density?: number;\n  /** A visible Pause / Play button (WCAG 2.2.2: the sky moves for longer than 5 s). */\n  showPauseButton?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface Lantern { x: number; y: number; z: number; ph: number; vx: number; lit: number }\n\n/** one paper lantern of height h, lit by k (the lab's fbLantern; `pal` recolours the light for palettes other than fire) */\nfunction drawLantern(g: CanvasRenderingContext2D, x: number, y: number, h: number, lit: number, t: number, ph: number, pal: Ramp | null) {\n  const w1 = h * 0.74, w0 = h * 0.5, k = lit * (0.88 + 0.12 * Math.sin(t * 9 + ph * 3));\n  const at = (q: number, a: number) => { const c = ramp(pal as Ramp, q); return `rgba(${c[0] | 0},${c[1] | 0},${c[2] | 0},${a})`; };\n  if (k > 0.02) {\n    const R = h * 2.4, gr = g.createRadialGradient(x, y + h * 0.2, 0, x, y + h * 0.2, R);\n    gr.addColorStop(0, pal ? at(0.78, 0.3 * k) : `rgba(255,170,80,${0.3 * k})`);\n    gr.addColorStop(1, pal ? at(0.5, 0) : \"rgba(255,100,30,0)\");\n    g.save();\n    g.globalCompositeOperation = \"lighter\";\n    g.fillStyle = gr;\n    g.fillRect(x - R, y - R, R * 2, R * 2.2);\n    g.restore();\n  }\n  g.beginPath();\n  g.moveTo(x - w0 / 2, y + h / 2);\n  g.bezierCurveTo(x - w1 * 0.62, y + h * 0.1, x - w1 * 0.6, y - h * 0.38, x - w1 * 0.3, y - h * 0.5);\n  g.quadraticCurveTo(x, y - h * 0.58, x + w1 * 0.3, y - h * 0.5);\n  g.bezierCurveTo(x + w1 * 0.6, y - h * 0.38, x + w1 * 0.62, y + h * 0.1, x + w0 / 2, y + h / 2);\n  g.closePath();\n  const gr = g.createLinearGradient(0, y - h / 2, 0, y + h / 2);\n  if (k > 0.02) {\n    if (pal) {\n      gr.addColorStop(0, at(0.4, 0.92));\n      gr.addColorStop(0.55, at(0.6 + 0.2 * k, 0.97));\n      gr.addColorStop(1, at(0.8 + 0.15 * k, 1));\n    } else {\n      gr.addColorStop(0, \"rgba(200,70,20,.92)\");\n      gr.addColorStop(0.55, `rgba(${(235 + 20 * k) | 0},${(120 + 70 * k) | 0},${(40 + 40 * k) | 0},.97)`);\n      gr.addColorStop(1, `rgba(255,${(200 + 40 * k) | 0},${(120 + 60 * k) | 0},1)`);\n    }\n  } else {\n    gr.addColorStop(0, \"#2e2422\");\n    gr.addColorStop(1, \"#4a3a30\");\n  }\n  g.fillStyle = gr;\n  g.fill();\n  g.strokeStyle = k > 0.02 ? \"rgba(120,40,10,.35)\" : \"rgba(0,0,0,.35)\";\n  g.lineWidth = Math.max(0.6, h / 50);\n  for (const f of [-0.3, 0, 0.3]) {\n    g.beginPath();\n    g.moveTo(x + f * w1 * 0.9, y - h * 0.48);\n    g.quadraticCurveTo(x + f * w1 * 1.15, y, x + f * w0, y + h * 0.5);\n    g.stroke();\n  }\n}\n\nexport function LanternSky({ children, density = 1.1, showPauseButton = true, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: LanternSkyProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const [held, setHeld] = useState(false);\n  const globalPaused = usePaused();\n  const { hydrated, tier, still } = useItemEnv(maxTier);\n  const stopped = paused || held || globalPaused;\n\n  // the sky: the lab's s3 drawing. It is the picture, so every tier draws it; still (reduced motion, tier 0) draws one frame\n  useDrawLoop(\n    fxRef,\n    (fx, wakeUp) => {\n      const root = rootRef.current;\n      if (!root) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const pal = palette === \"fire\" ? null : paletteRamp(palette, readPalette(root, palette));\n      const p = trackPointer(root, d, { move: () => wakeUp() });\n      let L: Lantern[] = [];\n      const seed = () => {\n        L = Array.from({ length: Math.round(((c.w * c.h) / 10000) * density * (tier === 2 ? 0.6 : 1)) }, () => ({\n          x: rand(0, c.w), y: rand(0, c.h * 1.2), z: 0.2 + 0.8 * Math.random() ** 1.5, ph: rand(0, 6), vx: 0, lit: Math.random() < 0.85 ? 1 : 0,\n        })).sort((a, b) => a.z - b.z);\n      };\n      c.onResize(() => { seed(); wakeUp(); });\n      seed();\n      return {\n        tick(dt, t) {\n          const g = c.g, bg = g.createLinearGradient(0, 0, 0, c.h);\n          bg.addColorStop(0, \"#04050b\");\n          bg.addColorStop(0.7, \"#0d0a14\");\n          bg.addColorStop(1, \"#2a140c\");\n          g.fillStyle = bg;\n          g.fillRect(0, 0, c.w, c.h);\n          for (const l of L) {\n            if (!still) {\n              l.y -= (10 + 26 * l.z) * dt;\n              l.x += (Math.sin(t * 0.4 + l.ph) * 6 * l.z + l.vx) * dt;\n              l.vx *= Math.exp(-dt * 1.4);\n              if (p.in) {\n                const dx = l.x - p.x, dy = l.y - p.y, dd = Math.hypot(dx, dy);\n                if (dd < 120 && dd > 1) l.vx += (dx / dd) * (120 - dd) * 2 * dt * l.z;\n                if (dd < 30 && !l.lit) l.lit = 1;\n              }\n            }\n            if (l.y < -40) { l.y = c.h + 30; l.x = rand(0, c.w); }\n            if (l.x > c.w + 40) l.x = -40;\n            if (l.x < -40) l.x = c.w + 40;\n            g.save();\n            g.globalAlpha = 0.35 + 0.65 * l.z;\n            drawLantern(g, l.x, l.y, 8 + 34 * l.z, l.lit, still ? 0 : t, l.ph, pal);\n            g.restore();\n          }\n          p.decay(dt);\n          return !still;\n        },\n        destroy: () => d.dispose(),\n      };\n    },\n    { enabled: hydrated, paused: stopped, key: `${tier}:${still ? 1 : 0}:${palette}:${density}` },\n  );\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"lantern-sky\" data-tier={tier} className={`fb-lantern-sky ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        .fb-lantern-sky { position: relative; isolation: isolate; min-height: 250px; overflow: hidden; border-radius: inherit; background: linear-gradient(#04050b, #0d0a14 70%, #2a140c); color: #E9E5DF; }\n        .fb-ls-fx { position: absolute; inset: 0; z-index: -1; pointer-events: none; }\n        .fb-ls-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-ls-pause { position: absolute; right: 14px; bottom: 14px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(233, 229, 223, 0.3); background: rgba(4, 5, 11, 0.6); color: #E9E5DF; font: 12px ui-monospace, \"Geist Mono\", monospace; cursor: pointer; }\n        .fb-ls-pause:focus-visible { outline: 2px solid var(--ring, #E9E5DF); outline-offset: 2px; }\n      `}</style>\n      <div ref={fxRef} className=\"fb-ls-fx\" aria-hidden=\"true\" />\n      {children}\n      {showPauseButton && hydrated && !still && (\n        <button\n          type=\"button\"\n          className=\"fb-ls-pause\"\n          onClick={() => {\n            if (stopped) {\n\n              setHeld(false);\n            } else setHeld(true);\n          }}\n        >\n          {stopped ? \"Play the lanterns\" : \"Pause the lanterns\"}\n        </button>\n      )}\n    </div>\n  );\n}\n\nexport default LanternSky;\n",
          "type": "registry:ui",
          "target": "components/ui/lantern-sky.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "lantern-sky",
          "version": "0.1.0",
          "summary": "background: Night sky of paper lanterns rising at different depths; the pointer is a warm breeze (canvas 2D, server-safe, reduced motion -> still sky)",
          "slot": "background",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "A calm closing section, a sign-up or thank-you screen",
            "Behind a short headline and one call to action"
          ],
          "avoidWhen": [
            "Behind long text (it moves for as long as it is on screen)",
            "Two animated backgrounds on one page"
          ],
          "alternatives": [
            {
              "name": "particle-field",
              "when": "When a WebGL background fits better (many more points, GPU)"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "while-visible",
          "webglContexts": 0,
          "tiers": {
            "0": "One still frame of the sky (reduced motion, Save-Data, no WebGL2)",
            "1": "Same as tier 2",
            "2": "Animated at DPR <= 1.5 with 60 % of the lanterns",
            "3": "Animated at DPR <= 2 with every lantern"
          },
          "reducedMotion": {
            "mode": "still-frame",
            "description": "One still frame of the sky with its lanterns; nothing moves and no pause button is needed."
          },
          "input": {
            "pointer": "Moving through the sky pushes nearby lanterns aside and lights unlit ones",
            "touch": "None",
            "keyboard": "The Pause / Play button"
          }
        },
        "a11y": {
          "role": "decorative",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "built-in",
          "wcag": [
            "1.4.3",
            "2.2.2"
          ],
          "notes": "The canvas is aria-hidden; your children stay real content above it on a dark ground. The sky moves while it is visible, so a visible Pause / Play button is built in (showPauseButton) and the runtime's pauseAll stops it too."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "ash-text",
            "flint-button"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Content shown over the sky."
          },
          {
            "name": "density",
            "type": "number",
            "default": 1.1,
            "effect": "Lanterns per 10,000 px² of sky."
          },
          {
            "name": "showPauseButton",
            "type": "boolean",
            "default": true,
            "effect": "A visible Pause / Play button (WCAG 2.2.2)."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/lantern-sky",
          "usage": "import { LanternSky } from \"@/components/ui/lantern-sky\";\n\nexport function Closing() {\n  return (\n    <LanternSky style={{ minHeight: 420 }}>\n      <h2>Let it rise.</h2>\n      <a href=\"/start\">Start a project</a>\n    </LanternSky>\n  );\n}",
          "mistakes": [
            "Keep the content short and on the left or centre; the sky is the point.",
            "Do not hide the pause button unless the page has its own pause for all motion.",
            "One per page: it runs for as long as it is visible."
          ],
          "verify": [
            "Server HTML shows the content on a dark gradient.",
            "The Pause button stops the sky (no frames) and Play resumes it.",
            "With reduced motion one still frame is drawn and nothing runs."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "422503fbfdd7c51c46ed724c8216dac68181dc6b294cc2506553cd2451b07c9f",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.91,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed, 1 flaky (passed on retry)"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed, 1 flaky (passed on retry)"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "light-leak-tabs",
      "type": "registry:ui",
      "title": "LightLeakTabs",
      "description": "navigation: ARIA tabs over a furnace slot: the selected tab lets the firelight through and the light slides as you switch (canvas 2D, server-safe tabs)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/light-leak-tabs/light-leak-tabs.tsx",
          "content": "// Original — Frictionborn Motion LightLeakTabs (ported from the component lab, q4 · Light Leak Tabs)\n\"use client\";\n\nimport React, { useCallback, useId, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, useLatest, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { markDrawn, css, paletteRamp, ramp, relBox, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface LightLeakTab {\n  id: string;\n  label: React.ReactNode;\n  content: React.ReactNode;\n}\n\nexport interface LightLeakTabsProps extends React.HTMLAttributes<HTMLDivElement>, CanvasItemProps {\n  tabs: LightLeakTab[];\n  /** Controlled selected tab id. */\n  value?: string;\n  /** Initial tab id when uncontrolled (default: the first tab). */\n  defaultValue?: string;\n  onValueChange?: (id: string) => void;\n  /** Accessible name of the tab list. */\n  label: string;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\nexport function LightLeakTabs({ tabs, value, defaultValue, onValueChange, label, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: LightLeakTabsProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const listRef = useRef<HTMLDivElement>(null);\n  const [inner, setInner] = useState(defaultValue ?? tabs[0]?.id);\n  const selected = value ?? inner;\n  const selRef = useLatest(selected);\n  const uid = useId().replace(/:/g, \"\");\n  const { hydrated, reduced, tier } = useItemEnv(maxTier);\n\n  // the leak: the lab's q4 drawing (a dark slot; the selected tab lets the firelight through and the light slides after it)\n  const wake = useDrawLoop(\n    fxRef,\n    (fx) => {\n      const root = rootRef.current, list = listRef.current;\n      if (!root || !list) return null;\n      const s = stage(fx, tier);\n      if (!s) return null;\n      const { d, c } = s;\n      // the drawn light marks the selected tab, so the plain underline steps aside\n      markDrawn(root, d);\n      const pal = paletteRamp(palette, readPalette(root, palette));\n      const fire = palette === \"fire\";\n      const a = fire ? [255, 170, 80] : ramp(pal, 0.82), b = fire ? [255, 120, 40] : ramp(pal, 0.6), core = fire ? [255, 230, 170] : ramp(pal, 0.93);\n      let lx = 0, lw = 0, init = false;\n      return {\n        tick(dt) {\n          const btn = list.querySelector<HTMLElement>(`[data-tab=\"${CSS.escape(selRef.current ?? \"\")}\"]`);\n          if (!btn) return false;\n          const r = relBox(btn, fx), tx = r.x, tw = r.w;\n          if (!init) { lx = tx; lw = tw; init = true; }\n          lx += (tx - lx) * Math.min(1, dt * 9);\n          lw += (tw - lw) * Math.min(1, dt * 9);\n          const lb = relBox(list, fx), g = c.g, y = lb.y + lb.h;\n          g.fillStyle = \"#0b0a09\";\n          g.fillRect(0, 0, c.w, c.h);\n          g.save();\n          g.globalCompositeOperation = \"lighter\";\n          const sl = g.createLinearGradient(0, y - 2, 0, y + 120);\n          sl.addColorStop(0, css(a, 0.6));\n          sl.addColorStop(0.2, css(b, 0.18));\n          sl.addColorStop(1, css(b, 0));\n          g.fillStyle = sl;\n          g.beginPath();\n          g.moveTo(lx + 4, y);\n          g.lineTo(lx + lw - 4, y);\n          g.lineTo(lx + lw + 60, y + 150);\n          g.lineTo(lx - 60, y + 150);\n          g.closePath();\n          g.fill();\n          g.fillStyle = css(core, 0.9);\n          g.fillRect(lx + 6, y - 1.5, lw - 12, 3);\n          g.restore();\n          // the light slides after the selected tab, then holds (an idle tab list costs no frames)\n          return Math.abs(tx - lx) > 0.3 || Math.abs(tw - lw) > 0.3;\n        },\n        destroy: () => d.dispose(),\n      };\n    },\n    { enabled: hydrated && tier > 0 && !reduced, paused, key: `${tier}:${palette}` },\n  );\n\n  const select = useCallback(\n    (id: string) => {\n      if (value === undefined) setInner(id);\n      onValueChange?.(id);\n      wake();\n    },\n    [value, onValueChange, wake],\n  );\n\n  const onKey = (e: React.KeyboardEvent, i: number) => {\n    const n = e.key === \"ArrowRight\" ? 1 : e.key === \"ArrowLeft\" ? -1 : 0;\n    const to = e.key === \"Home\" ? 0 : e.key === \"End\" ? tabs.length - 1 : n ? (i + n + tabs.length) % tabs.length : -1;\n    if (to < 0) return;\n    e.preventDefault();\n    select(tabs[to].id);\n    listRef.current?.querySelectorAll<HTMLElement>(\"[role=tab]\")[to]?.focus();\n  };\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"light-leak-tabs\" data-tier={tier} className={`fb-light-leak-tabs ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        .fb-light-leak-tabs { position: relative; isolation: isolate; display: flex; flex-direction: column; padding: 18px; border-radius: 16px; background: #0b0a09; color: #cfc2b6; overflow: hidden; }\n        .fb-llt-fx { position: absolute; inset: 0; z-index: -1; pointer-events: none; }\n        .fb-llt-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-llt-list { display: flex; gap: 4px; }\n        .fb-llt-tab { flex: 1; min-height: 40px; padding: 0 12px; border-radius: 10px 10px 0 0; border: 1px solid rgba(233, 229, 223, 0.08); border-bottom: 0; background: #141210; color: #a39d97; font: inherit; font-size: 13.5px; cursor: pointer; }\n        .fb-llt-tab[aria-selected=\"true\"] { color: #fff3e4; background: #1d1714; box-shadow: inset 0 -3px 0 var(--fb-heat-2, #E8590C); }\n        .fb-light-leak-tabs[data-drawn] .fb-llt-tab[aria-selected=\"true\"] { box-shadow: none; }\n        .fb-llt-tab:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: -2px; }\n        .fb-llt-panel { flex: 1 1 auto; min-height: 120px; border: 1px solid rgba(233, 229, 223, 0.08); border-radius: 0 0 12px 12px; padding: 18px; font-size: 14px; line-height: 1.55; }\n        .fb-llt-panel:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 2px; }\n      `}</style>\n      <div ref={fxRef} className=\"fb-llt-fx\" aria-hidden=\"true\" />\n      <div ref={listRef} role=\"tablist\" aria-label={label} className=\"fb-llt-list\">\n        {tabs.map((t, i) => (\n          <button\n            key={t.id}\n            type=\"button\"\n            role=\"tab\"\n            id={`${uid}-t-${t.id}`}\n            data-tab={t.id}\n            aria-selected={t.id === selected}\n            aria-controls={`${uid}-p`}\n            tabIndex={t.id === selected ? 0 : -1}\n            className=\"fb-llt-tab\"\n            onClick={() => select(t.id)}\n            onKeyDown={(e) => onKey(e, i)}\n          >\n            {t.label}\n          </button>\n        ))}\n      </div>\n      <div role=\"tabpanel\" id={`${uid}-p`} aria-labelledby={`${uid}-t-${selected}`} tabIndex={0} className=\"fb-llt-panel\">\n        {tabs.find((t) => t.id === selected)?.content}\n      </div>\n    </div>\n  );\n}\n\nexport default LightLeakTabs;\n",
          "type": "registry:ui",
          "target": "components/ui/light-leak-tabs.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "light-leak-tabs",
          "version": "0.1.0",
          "summary": "navigation: ARIA tabs over a furnace slot: the selected tab lets the firelight through and the light slides as you switch (canvas 2D, server-safe tabs)",
          "slot": "navigation",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "Three to five sections of related content in one card (features, plans, steps)",
            "A product or brand page where the tabs are a focal element"
          ],
          "avoidWhen": [
            "Navigation between pages (use links)",
            "More than about six tabs, or tabs that must wrap onto two rows"
          ],
          "alternatives": []
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The control alone (server render, reduced motion, Save-Data, no WebGL2): no canvas",
            "1": "Same as tier 2",
            "2": "Effect on a canvas at DPR <= 1.5 with half the particles",
            "3": "Effect on a canvas at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "The tabs alone with a plain underline on the selected tab; no canvas, no sliding light."
          },
          "input": {
            "pointer": "Click a tab to select it; the light slides after it",
            "touch": "Tap a tab",
            "keyboard": "Roving tabindex: ArrowLeft/ArrowRight (wrapping), Home and End move and select; Tab moves into the panel"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.3.1",
            "2.1.1",
            "2.4.3",
            "2.4.7",
            "4.1.2"
          ],
          "notes": "WAI-ARIA tabs: a named tablist of native buttons with role=tab, aria-selected and aria-controls, one tabpanel labelled by the selected tab and focusable. The light canvas is aria-hidden."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "flame-switch",
            "temper-slider"
          ]
        },
        "props": [
          {
            "name": "tabs",
            "type": "{ id: string; label: React.ReactNode; content: React.ReactNode }[]",
            "default": null,
            "effect": "Required. The tabs, in order."
          },
          {
            "name": "label",
            "type": "string",
            "default": null,
            "effect": "Required. Accessible name of the tab list."
          },
          {
            "name": "value",
            "type": "string",
            "default": null,
            "effect": "Controlled selected tab id."
          },
          {
            "name": "defaultValue",
            "type": "string",
            "default": null,
            "effect": "Initial tab id when uncontrolled (the first tab if omitted)."
          },
          {
            "name": "onValueChange",
            "type": "(id: string) => void",
            "default": null,
            "effect": "Called with the newly selected tab id."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/light-leak-tabs",
          "usage": "import { LightLeakTabs } from \"@/components/ui/light-leak-tabs\";\n\nconst tabs = [\n  { id: \"heat\", label: \"Heat\", content: <p>How hot it runs.</p> },\n  { id: \"light\", label: \"Light\", content: <p>What it shows.</p> },\n];\n\nexport function Features() {\n  return <LightLeakTabs label=\"Features\" tabs={tabs} />;\n}",
          "mistakes": [
            "Keep tabs to a handful of short labels: they share one row.",
            "Give every tab a stable, unique id; the selection is tracked by id.",
            "label is required: it names the tab list for screen readers."
          ],
          "verify": [
            "Server HTML has a tablist with one selected tab and its panel.",
            "ArrowRight, ArrowLeft, Home and End move the selection and focus.",
            "The light slides to the new tab and then the loop stops."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "607ab50e80a60f7ebcafd6f494c426006f3c1863d9da851ccdda0e39a11bdbc4",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.59,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "magnetic-button",
      "type": "registry:ui",
      "title": "MagneticButton",
      "description": "cta: Magnetic spring wrapper for buttons and links with fine-pointer gating (dom, server-safe, reduced motion -> static, mobile -> 0 listeners)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/magnetic-button/magnetic-button.tsx",
          "content": "// Original — Frictionborn Motion MagneticButton\n\"use client\";\n\nimport React, { useRef, useState, useCallback, useImperativeHandle, useSyncExternalStore } from \"react\";\nimport { useFrame, useReducedMotion, useCapability, useHydrated } from \"@frictionborn/runtime\";\n\nfunction subscribeFinePointer(callback: () => void) {\n  if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return () => {};\n  const mql = window.matchMedia(\"(hover: hover) and (pointer: fine)\");\n  mql.addEventListener?.(\"change\", callback);\n  return () => mql.removeEventListener?.(\"change\", callback);\n}\n\nfunction getFinePointerSnapshot() {\n  if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return true;\n  return window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n}\n\nfunction getFinePointerServerSnapshot() {\n  return false;\n}\n\nexport interface MagneticButtonProps extends React.HTMLAttributes<HTMLDivElement> {\n  children: React.ReactNode;\n  pullDistance?: number;\n  tension?: number;\n  damping?: number;\n  className?: string;\n  style?: React.CSSProperties;\n  maxTier?: number;\n  paused?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\nexport function MagneticButton({\n  children,\n  pullDistance = 16,\n  tension = 180,\n  damping = 16,\n  className = \"\",\n  style,\n  maxTier = 3,\n  paused = false,\n  ref,\n  onPointerMove,\n  onPointerLeave,\n  onFocus,\n  ...rest\n}: MagneticButtonProps) {\n  const containerRef = useRef<HTMLDivElement>(null);\n  const targetRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n  const currentRef = useRef<{ x: number; y: number; vx: number; vy: number }>({\n    x: 0,\n    y: 0,\n    vx: 0,\n    vy: 0,\n  });\n\n  const hydrated = useHydrated();\n  const prefersReduced = useReducedMotion();\n  const { tier: rawTier } = useCapability();\n  const tier = Math.min(rawTier, maxTier);\n\n  const isFinePointer = useSyncExternalStore(subscribeFinePointer, getFinePointerSnapshot, getFinePointerServerSnapshot);\n  const [isActive, setIsActive] = useState(false);\n\n  const shouldEnable = !paused && hydrated && !prefersReduced && tier > 1 && isFinePointer;\n\n  // Spring animation loop driven by shared useFrame\n  useFrame(\n    ({ dt }) => {\n      const el = containerRef.current;\n      if (!el) return;\n\n      const deltaSec = Math.min(dt / 1000, 0.05);\n      const cur = currentRef.current;\n      const tgt = targetRef.current;\n\n      // Spring physics (Hooke's law with damping)\n      const ax = tension * (tgt.x - cur.x) - damping * cur.vx;\n      const ay = tension * (tgt.y - cur.y) - damping * cur.vy;\n\n      cur.vx += ax * deltaSec;\n      cur.vy += ay * deltaSec;\n      cur.x += cur.vx * deltaSec;\n      cur.y += cur.vy * deltaSec;\n\n      // Check settle condition\n      const dx = Math.abs(tgt.x - cur.x);\n      const dy = Math.abs(tgt.y - cur.y);\n      const dv = Math.sqrt(cur.vx * cur.vx + cur.vy * cur.vy);\n\n      if (dx < 0.01 && dy < 0.01 && dv < 0.01) {\n        cur.x = tgt.x;\n        cur.y = tgt.y;\n        cur.vx = 0;\n        cur.vy = 0;\n        el.style.transform = tgt.x === 0 && tgt.y === 0 ? \"\" : `translate3d(${tgt.x}px, ${tgt.y}px, 0)`;\n        setIsActive(false);\n      } else {\n        el.style.transform = `translate3d(${cur.x.toFixed(2)}px, ${cur.y.toFixed(2)}px, 0)`;\n      }\n    },\n    { active: isActive && shouldEnable }\n  );\n\n  const handlePointerMove = useCallback(\n    (e: React.PointerEvent) => {\n      if (!shouldEnable || !containerRef.current) return;\n      const rect = containerRef.current.getBoundingClientRect();\n      const centerX = rect.left + rect.width / 2;\n      const centerY = rect.top + rect.height / 2;\n\n      const relX = (e.clientX - centerX) / (rect.width / 2);\n      const relY = (e.clientY - centerY) / (rect.height / 2);\n\n      targetRef.current = {\n        x: Math.max(-pullDistance, Math.min(pullDistance, relX * pullDistance)),\n        y: Math.max(-pullDistance, Math.min(pullDistance, relY * pullDistance)),\n      };\n      setIsActive(true);\n    },\n    [shouldEnable, pullDistance]\n  );\n\n  const handlePointerLeave = useCallback(() => {\n    if (!shouldEnable) return;\n    targetRef.current = { x: 0, y: 0 };\n    setIsActive(true);\n  }, [shouldEnable]);\n\n  // Keyboard focus resets position immediately to prevent disorienting keyboard users\n  const handleFocus = useCallback(() => {\n    targetRef.current = { x: 0, y: 0 };\n    currentRef.current = { x: 0, y: 0, vx: 0, vy: 0 };\n    if (containerRef.current) {\n      containerRef.current.style.transform = \"\";\n    }\n    setIsActive(false);\n  }, []);\n\n  useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n  const composedPointerMove = useCallback(\n    (e: React.PointerEvent<HTMLDivElement>) => {\n      onPointerMove?.(e);\n      if (shouldEnable) handlePointerMove(e);\n    },\n    [onPointerMove, shouldEnable, handlePointerMove]\n  );\n\n  const composedPointerLeave = useCallback(\n    (e: React.PointerEvent<HTMLDivElement>) => {\n      onPointerLeave?.(e);\n      if (shouldEnable) handlePointerLeave();\n    },\n    [onPointerLeave, shouldEnable, handlePointerLeave]\n  );\n\n  const composedFocus = useCallback(\n    (e: React.FocusEvent<HTMLDivElement>) => {\n      onFocus?.(e);\n      if (shouldEnable) handleFocus();\n    },\n    [onFocus, shouldEnable, handleFocus]\n  );\n\n  return (\n    <div\n      ref={containerRef}\n      data-frictionborn-item=\"magnetic-button\"\n      data-tier={tier}\n      className={`fb-magnetic-button ${className}`}\n      onPointerMove={composedPointerMove}\n      onPointerLeave={composedPointerLeave}\n      onFocus={composedFocus}\n      style={{\n        display: \"inline-block\",\n        position: \"relative\",\n        overflow: \"visible\", // Focus ring must never be clipped\n        willChange: isActive ? \"transform\" : \"auto\",\n        ...style,\n      }}\n      {...rest}\n    >\n      {children}\n    </div>\n  );\n}\n\nexport default MagneticButton;\n",
          "type": "registry:ui",
          "target": "components/ui/magnetic-button.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "magnetic-button",
          "version": "0.1.0",
          "summary": "cta: Magnetic spring wrapper for buttons and links with fine-pointer gating (dom, server-safe, reduced motion -> static, mobile -> 0 listeners)",
          "slot": "cta",
          "kind": "dom"
        },
        "intent": {
          "useWhen": [
            "High-priority call-to-action buttons in hero and conversion sections",
            "Interactive icon triggers and primary action links",
            "Header navigation actions seeking tactile physical response"
          ],
          "avoidWhen": [
            "Dense lists of repeating table buttons or compact toolbar grids",
            "Touch-first mobile interfaces with coarse pointer navigation",
            "Disabled or read-only interactive elements"
          ],
          "alternatives": [
            {
              "name": "text-reveal",
              "when": "When animating entrance typography rather than interactive hover responses"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "no",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "Static wrapper without pointer handlers or translation (server render, prefers-reduced-motion, Save-Data, or no WebGL2)",
            "1": "Static wrapper without pointer handlers (coarse pointer with low-end hints)",
            "2": "Magnetic pull with the configured strength, only when the device reports (hover: hover) and (pointer: fine)",
            "3": "Same behaviour as tier 2: spring physics on the shared frame loop while the pointer is over the wrapper, settling to zero frames"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Button retains static position without magnetic cursor tracking."
          },
          "input": {
            "pointer": "Cursor attraction with physical spring settling within 0.01px tolerance",
            "touch": "Zero pointer handlers attached on coarse/touch screens",
            "keyboard": "Focus snaps the wrapper to its origin immediately and the child's own onFocus still runs; the wrapper uses overflow: visible"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "not-needed",
          "wcag": [
            "2.1.1",
            "2.4.7",
            "2.5.3"
          ],
          "notes": "The wrapped button or link keeps its native semantics. The wrapper div uses overflow: visible so it does not clip focus rings, and keyboard focus immediately resets translation to origin."
        },
        "composition": {
          "maxPerPage": 10,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "noise-field",
            "text-reveal",
            "ambient-hero"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "React.ReactElement",
            "default": null,
            "effect": "Required. A single interactive element (button or link) wrapped by the magnetic controller."
          },
          {
            "name": "pullDistance",
            "type": "number",
            "default": 16,
            "effect": "Maximum pull translation in pixels (replaces deprecated strength)."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Freezes magnetic displacement calculation."
          },
          {
            "name": "tension",
            "type": "number",
            "default": 180,
            "effect": "Spring stiffness coefficient."
          },
          {
            "name": "damping",
            "type": "number",
            "default": 16,
            "effect": "Spring velocity damping coefficient."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Additional CSS classes applied to the outer wrapper div (the built-in class fb-magnetic-button is kept)."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the wrapper div, merged after display: inline-block and position: relative (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the wrapper <div> (not the child button)."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/magnetic-button",
          "usage": "import { MagneticButton } from \"@/components/ui/magnetic-button\";\n\nexport default function HeroCta() {\n  return (\n    <MagneticButton pullDistance={16}>\n      <button type=\"button\" className=\"rounded-full bg-primary px-6 py-3 text-primary-foreground font-medium\">\n        Get Started\n      </button>\n    </MagneticButton>\n  );\n}",
          "mistakes": [
            "Do not set overflow: hidden on MagneticButton or parent containers, or focus rings will be clipped.",
            "Do not wrap non-interactive static text in MagneticButton; reserve for buttons and action links.",
            "MagneticButton renders a wrapper div (display: inline-block) around the child, so do not place it inside a <p> or another <button>.",
            "Props other than the listed ones (id, data-*, aria-*, onPointerMove, onPointerLeave) are spread on the wrapper <div> (onPointerMove / onPointerLeave are composed with the pull logic). Put aria-* for the control on the child button or link.",
            "ref points at the wrapper <div>, not at the child button. While paused the button stays where it is (it does not spring back until un-paused)."
          ],
          "verify": [
            "Verify button is immediately clickable and focusable in server HTML.",
            "Verify keyboard tabbing triggers focus ring cleanly without clipped edges.",
            "Verify that on touch screens, zero pointer handlers are registered."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "5927340ca33f90d51dac2ffce789973ad1a21d66ccc436404560a277dcca13d0",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 1.88,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "marquee",
      "type": "registry:ui",
      "title": "Marquee",
      "description": "strip: Infinite marquee with inert duplicate, hover/focus pause, and pause button (dom, server-safe, reduced motion -> static, mobile -> animates)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/marquee/marquee.tsx",
          "content": "// Original — Frictionborn Motion Marquee\n\"use client\";\n\nimport React, { useRef, useState, useEffect, useImperativeHandle } from \"react\";\nimport { useInView, useReducedMotion, useCapability, useHydrated, usePaused } from \"@frictionborn/runtime\";\n\nexport interface MarqueeProps extends React.HTMLAttributes<HTMLDivElement> {\n  children: React.ReactNode;\n  /** Transit rate in physical pixels per second (default 40). */\n  pixelsPerSecond?: number;\n  /** Unitless multiplier on `pixelsPerSecond` (1 = as given, 0.5 = half, 2 = double). */\n  speed?: number;\n  direction?: \"left\" | \"right\";\n  pauseOnHover?: boolean;\n  pauseOnFocus?: boolean;\n  showPauseButton?: boolean;\n  gap?: string | number;\n  className?: string;\n  style?: React.CSSProperties;\n  maxTier?: number;\n  paused?: boolean;\n  nonce?: string;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\nexport function Marquee({\n  children,\n  pixelsPerSecond = 40,\n  speed = 1,\n  direction = \"left\",\n  pauseOnHover = true,\n  pauseOnFocus = true,\n  showPauseButton = true,\n  gap = \"2rem\",\n  className = \"\",\n  style,\n  maxTier = 3,\n  paused = false,\n  nonce,\n  ref,\n  ...rest\n}: MarqueeProps) {\n  const containerRef = useRef<HTMLDivElement>(null);\n  const trackRef = useRef<HTMLDivElement>(null);\n\n  const effectivePps = pixelsPerSecond * speed;\n\n  const hydrated = useHydrated();\n  const prefersReduced = useReducedMotion();\n  const globalPaused = usePaused();\n  const { tier: rawTier } = useCapability();\n  const tier = Math.min(rawTier, maxTier);\n\n  const [localPaused, setLocalPaused] = useState(false);\n  const [duration, setDuration] = useState(25);\n\n  const inView = useInView(containerRef as React.RefObject<HTMLElement>, {\n    rootMargin: \"100px\",\n  });\n\n  // Calculate duration from track width and desired pixels/second\n  useEffect(() => {\n    if (!trackRef.current) return;\n    const trackWidth = trackRef.current.scrollWidth;\n    if (trackWidth > 0 && effectivePps > 0) {\n      setDuration(Math.max(5, trackWidth / effectivePps));\n    }\n  }, [children, effectivePps, gap]);\n\n  const formattedGap = typeof gap === \"number\" ? `${gap}px` : gap;\n  const isPaused = !inView || globalPaused || localPaused || paused || prefersReduced || tier === 0;\n\n  useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n  return (\n    <div\n      ref={containerRef}\n      data-frictionborn-item=\"marquee\"\n      data-tier={tier}\n      data-paused={isPaused ? \"true\" : undefined}\n      className={`fb-marquee ${className}`}\n      style={{\n        position: \"relative\",\n        width: \"100%\",\n        overflow: \"hidden\",\n        display: \"flex\",\n        alignItems: \"center\",\n        gap: \"0.75rem\",\n        ...style,\n      }}\n      {...rest}\n    >\n      <style nonce={nonce}>{`\n        @keyframes fb-mq-slide-left {\n          0% { transform: translateX(0%); }\n          100% { transform: translateX(calc(-100% - var(--fb-mq-gap, 2rem))); }\n        }\n\n        @keyframes fb-mq-slide-right {\n          0% { transform: translateX(calc(-100% - var(--fb-mq-gap, 2rem))); }\n          100% { transform: translateX(0%); }\n        }\n\n        .fb-marquee-track {\n          display: flex;\n          flex-shrink: 0;\n          align-items: center;\n          gap: var(--fb-mq-gap, 2rem);\n          will-change: transform;\n        }\n\n        [data-motion=\"ok\"] .fb-marquee-track.anim-left {\n          animation: fb-mq-slide-left var(--fb-mq-dur, 25s) linear infinite;\n        }\n\n        [data-motion=\"ok\"] .fb-marquee-track.anim-right {\n          animation: fb-mq-slide-right var(--fb-mq-dur, 25s) linear infinite;\n        }\n\n        /* Scoped to the viewport, not the root: the Pause/Play button is a sibling of the viewport, and a root-level\n           :hover / :focus-within rule also matched the button, so Play could not resume while it had focus or the pointer */\n        .fb-marquee-viewport:hover [data-pause-hover=\"true\"] .fb-marquee-track {\n          animation-play-state: paused;\n        }\n\n        .fb-marquee-viewport:focus-within [data-pause-focus=\"true\"] .fb-marquee-track {\n          animation-play-state: paused;\n        }\n\n        .fb-marquee[data-paused=\"true\"] .fb-marquee-track {\n          animation-play-state: paused !important;\n        }\n\n        @media (prefers-reduced-motion: reduce) {\n          .fb-marquee-track {\n            animation: none !important;\n          }\n        }\n      `}</style>\n\n      {/* Marquee Viewport with subtle edge fade before pause control */}\n      <div\n        className=\"fb-marquee-viewport\"\n        style={{\n          flex: 1,\n          minWidth: 0,\n          overflow: \"hidden\",\n          display: \"flex\",\n          alignItems: \"center\",\n          WebkitMaskImage: \"linear-gradient(to right, black calc(100% - 24px), transparent 100%)\",\n          maskImage: \"linear-gradient(to right, black calc(100% - 24px), transparent 100%)\",\n        }}\n      >\n        {/* Marquee Content Wrap */}\n        <div\n          data-pause-hover={pauseOnHover ? \"true\" : undefined}\n          data-pause-focus={pauseOnFocus ? \"true\" : undefined}\n          // Under reduced motion this box scrolls by hand (overflow: auto); a scrollable region must be reachable by keyboard (WCAG 2.1.1)\n          tabIndex={prefersReduced ? 0 : undefined}\n          role={prefersReduced ? \"group\" : undefined}\n          aria-label={prefersReduced ? \"Scrollable list\" : undefined}\n          style={\n            {\n              display: \"flex\",\n              width: \"max-content\",\n              overflow: prefersReduced ? \"auto\" : \"visible\",\n              \"--fb-mq-gap\": formattedGap,\n              \"--fb-mq-dur\": `${duration}s`,\n            } as React.CSSProperties\n          }\n        >\n          {/* Original items (interactive, accessible to screen readers) */}\n          <div\n            ref={trackRef}\n            className={`fb-marquee-track ${direction === \"left\" ? \"anim-left\" : \"anim-right\"}`}\n            style={{ paddingRight: formattedGap }}\n          >\n            {children}\n          </div>\n\n          {/* Inert duplicate copy (aria-hidden and inert so screen readers & keyboard only visit items once) */}\n          {(!prefersReduced && hydrated && tier > 0) && (\n            <div\n              aria-hidden=\"true\"\n              inert={true}\n              className={`fb-marquee-track ${direction === \"left\" ? \"anim-left\" : \"anim-right\"}`}\n            >\n              {children}\n            </div>\n          )}\n        </div>\n      </div>\n\n      {/* Accessible Pause/Play Toggle Button (WCAG 2.2.2) - positioned outside scrolling track */}\n      {showPauseButton && hydrated && !prefersReduced && (\n        <button\n          type=\"button\"\n          onClick={() => setLocalPaused((p) => !p)}\n          aria-label={localPaused ? \"Play scrolling ticker\" : \"Pause scrolling ticker\"}\n          style={{\n            flexShrink: 0,\n            padding: \"0.375rem 0.625rem\",\n            fontSize: \"0.75rem\",\n            fontWeight: 500,\n            borderRadius: \"4px\",\n            border: \"1px solid var(--border, currentColor)\",\n            background: \"var(--background, transparent)\",\n            color: \"var(--foreground, inherit)\",\n            cursor: \"pointer\",\n            marginRight: \"0.5rem\",\n          }}\n        >\n          {localPaused ? \"Play\" : \"Pause\"}\n        </button>\n      )}\n    </div>\n  );\n}\n\nexport default Marquee;\n",
          "type": "registry:ui",
          "target": "components/ui/marquee.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "marquee",
          "version": "0.1.0",
          "summary": "strip: Infinite marquee with inert duplicate, hover/focus pause, and pause button (dom, server-safe, reduced motion -> static, mobile -> animates)",
          "slot": "strip",
          "kind": "dom"
        },
        "intent": {
          "useWhen": [
            "Logo clouds, customer testimonials, and partner strips",
            "Continuous market tickers, tech badges, and announcement banners",
            "Visual social proof ribbons requiring smooth continuous transit"
          ],
          "avoidWhen": [
            "Critical action buttons or primary call-to-action links that users must click immediately",
            "Dense paragraphs of essential reading material",
            "Pages where multiple moving strips compete for visual attention"
          ],
          "alternatives": [
            {
              "name": "scroll-reveal",
              "when": "When cards or media should reveal progressively upon scrolling rather than auto-looping"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "while-visible",
          "webglContexts": 0,
          "tiers": {
            "0": "Animation paused and no duplicate copy rendered; the track is a static row, not animated (server render, prefers-reduced-motion, Save-Data, or no WebGL2)",
            "1": "CSS marquee animation; same behaviour as tiers 2 and 3 (speed does not vary by tier)",
            "2": "CSS marquee animation with hover/focus pause, width-based duration calibration and the pause button",
            "3": "Same as tier 2"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "The animation does not run: the track is rendered static (not animated), with no duplicate copy and no pause button."
          },
          "input": {
            "pointer": "Hovering over the marquee pauses the animation when pauseOnHover is true",
            "touch": "No touch-specific behaviour; the animation runs on touch devices unless reduced motion is set",
            "keyboard": "Focus inside the marquee pauses it when pauseOnFocus is true; duplicate items are inert so each item is tabbed once"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "built-in",
          "wcag": [
            "2.2.2"
          ],
          "notes": "The duplicate copy is aria-hidden and inert so screen readers and keyboard users encounter each element once. A built-in pause/play button is shown unless showPauseButton is false or reduced motion is set."
        },
        "composition": {
          "maxPerPage": 4,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "noise-field",
            "text-reveal",
            "scroll-reveal",
            "scroll-showcase"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Required. Content elements repeated across the strip (rendered twice; avoid fixed ids)."
          },
          {
            "name": "pixelsPerSecond",
            "type": "number",
            "default": 40,
            "effect": "Transit rate in physical pixels per second (default 40). speed multiplies it. The cycle is never shorter than 5 s."
          },
          {
            "name": "speed",
            "type": "number",
            "default": 1,
            "effect": "Unitless multiplier on pixelsPerSecond (1 = as given, 0.5 = half, 2 = double)."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Freezes ticker transit."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "Optional CSP nonce forwarded to internal scoped <style> element."
          },
          {
            "name": "direction",
            "type": "\"left\" | \"right\"",
            "default": "left",
            "effect": "Scroll direction of the ticker."
          },
          {
            "name": "pauseOnHover",
            "type": "boolean",
            "default": true,
            "effect": "Freezes scroll transit while the pointer hovers over the strip."
          },
          {
            "name": "pauseOnFocus",
            "type": "boolean",
            "default": true,
            "effect": "Freezes scroll transit while any element inside the strip holds keyboard focus."
          },
          {
            "name": "showPauseButton",
            "type": "boolean",
            "default": true,
            "effect": "Renders a pause/play button (not rendered under reduced motion). Keep it for marquees that run longer than 5 s."
          },
          {
            "name": "gap",
            "type": "string | number",
            "default": "2rem",
            "effect": "Spacing between items (a number is treated as px)."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "CSS classes applied to the outer container (the built-in class fb-marquee is kept)."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the outer container, merged last (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div>."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/marquee",
          "usage": "import { Marquee } from \"@/components/ui/marquee\";\n\nexport default function PartnerStrip() {\n  return (\n    <Marquee pixelsPerSecond={40} gap=\"2rem\">\n      <span>Partner A</span>\n      <span>Partner B</span>\n      <span>Partner C</span>\n    </Marquee>\n  );\n}",
          "mistakes": [
            "Do not remove the inert attribute from duplicate tracks or screen readers will double-read every item.",
            "Do not hide the pause control if the marquee runs continuously for more than 5 seconds (WCAG 2.2.2).",
            "The animation only runs when <html> has data-motion=\"ok\" (MotionReadyScript in Next, initMotionReady() in Vite); without it the strip is static.",
            "Children are rendered twice, so do not give them fixed id attributes. Other props (id, data-*, aria-*, handlers) are spread on the root <div>."
          ],
          "verify": [
            "Verify screen reader encounters each badge/item exactly once.",
            "Verify hovering or focusing an item pauses animation transit.",
            "Verify reduced motion stops the animation and renders a static row without a duplicate copy or pause button.",
            "Confirm Pause then Play resumes the animation while the pointer or keyboard focus is still on the button."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "431349d7a224ef80cdb652956b7dc9d16f44c472eb6d0d8a5297ce8b3ecaf311",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.45,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "19 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "17 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "17 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "match-progress",
      "type": "registry:ui",
      "title": "MatchProgress",
      "description": "feedback: Progress bar drawn as a row of matches, each catching from the last as the job advances (canvas 2D, server-safe bar, reduced motion -> still)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/match-progress/match-progress.tsx",
          "content": "// Original — Frictionborn Motion MatchProgress (ported from the component lab, f4 · Chain Ignition Progress)\n\"use client\";\n\nimport React, { useEffect, useRef } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, useLatest, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { BB, Fire, Sparks, heat, paletteRamp, rand, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface MatchProgressProps extends React.HTMLAttributes<HTMLDivElement>, CanvasItemProps {\n  /** Progress, 0–100. Each match catches from the last as the value passes its share. */\n  value: number;\n  /** Accessible name of the progress bar. */\n  label: string;\n  /** Number of matches in the row. */\n  matches?: number;\n  /** Show the percentage under the row. */\n  showValue?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\n/** seconds a lit match takes to burn down to its last 8 % */\nconst BURN = 7;\n\n/** one match on its side or standing: stick, char along the burnt length, head (the lab's fbMatch) */\nfunction drawMatch(g: CanvasRenderingContext2D, x: number, y: number, ang: number, len: number, burnt: number, headR: number, charHead: boolean) {\n  g.save();\n  g.translate(x, y);\n  g.rotate(ang);\n  const bl = len * burnt;\n  g.fillStyle = \"#d9b37a\";\n  g.fillRect(-len, -2.2, len - bl, 4.4);\n  g.fillStyle = \"#d0a66a\";\n  g.fillRect(-len, 0.6, len - bl, 1.6);\n  if (bl > 0) {\n    const cg = g.createLinearGradient(-bl, 0, 0, 0);\n    cg.addColorStop(0, \"#5a4535\");\n    cg.addColorStop(0.6, \"#2a1d16\");\n    cg.addColorStop(1, \"#14100d\");\n    g.fillStyle = cg;\n    g.beginPath();\n    g.moveTo(-bl, -2);\n    g.quadraticCurveTo(-bl * 0.5, -1.4, 0, -1.5);\n    g.lineTo(0, 1.5);\n    g.quadraticCurveTo(-bl * 0.5, 1.4, -bl, 2);\n    g.fill();\n  }\n  const hg = g.createRadialGradient(-1, -2, 0, 0, 0, headR + 2);\n  hg.addColorStop(0, charHead ? \"#3a2a22\" : \"#e0574a\");\n  hg.addColorStop(1, charHead ? \"#120c0a\" : \"#7a1810\");\n  g.fillStyle = hg;\n  g.beginPath();\n  g.ellipse(1, 0, headR + 1.5, headR, 0, 0, 7);\n  g.fill();\n  g.restore();\n}\n\nexport function MatchProgress({ value, label, matches = 12, showValue = true, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: MatchProgressProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const v = Math.max(0, Math.min(100, Math.round(value)));\n  const vRef = useLatest(v);\n  const { hydrated, tier, still } = useItemEnv(maxTier);\n\n  // the row: the lab's f4 drawing. Animated: a match catches with a burst and burns down over 7 s. Still (reduced motion, tier 0):\n  // the reached matches stand lit with a steady glow, one frame per change\n  const wake = useDrawLoop(\n    fxRef,\n    (fx) => {\n      const root = rootRef.current, s = root && stage(fx, tier, root);\n      if (!root || !s) return null;\n      const { d, c } = s;\n      const pal = paletteRamp(palette, readPalette(root, palette));\n      const fire = new Fire(tier >= 3 ? 500 : 250), sp = new Sparks(tier >= 3 ? 200 : 100, palette === \"fire\" ? null : pal);\n      const M = Array.from({ length: matches }, () => ({ lit: -1 }));\n      // already reached when mounted: lit and burnt as far as a full burn (no burst for history)\n      M.forEach((m, i) => { if (vRef.current >= ((i + 1) / matches) * 100 - 0.01) m.lit = still ? 0 : BURN; });\n      const glowA = palette === \"fire\" ? \"rgba(255,220,150,.9)\" : heat(pal, 0.86, 0.9), glowB = palette === \"fire\" ? \"rgba(255,100,20,0)\" : heat(pal, 0.5, 0);\n      const ember = palette === \"fire\" ? \"rgba(255,130,40,.9)\" : heat(pal, 0.62, 0.9);\n      return {\n        tick(dt) {\n          const prog = vRef.current, g = c.g;\n          g.clearRect(0, 0, c.w, c.h);\n          const n = matches, gap = Math.min(30, (c.w - 60) / n), x0 = c.w / 2 - (gap * (n - 1)) / 2, base = c.h - 18, L = 92;\n          let busy = false;\n          M.forEach((m, i) => {\n            const x = x0 + i * gap, reached = prog >= ((i + 1) / n) * 100 - 0.01;\n            if (!reached) m.lit = -1;\n            else if (m.lit < 0) {\n              m.lit = 0;\n              if (!still) sp.burst(x, base - L, 14, 80, 260);\n            }\n            if (m.lit >= 0 && !still) m.lit += dt;\n            const burnt = m.lit >= 0 && !still ? Math.min(0.92, m.lit / BURN) : 0, top = base - L + L * burnt;\n            if (m.lit >= 0 && burnt < 0.92 && !still) {\n              busy = true;\n              for (let j = 0; j < 2; j++) fire.add(x + rand(-2, 2), top - 4, rand(5, 9), rand(-6, 6), -rand(40, 80), rand(0.25, 0.5), 1);\n            }\n            drawMatch(g, x, base - L, -Math.PI / 2, L, burnt, 5, m.lit > 0.5);\n            if (burnt > 0) {\n              g.fillStyle = ember;\n              g.fillRect(x - 2.3, top - 2, 4.6, 2.5);\n            }\n            if (still && m.lit >= 0) {\n              g.save();\n              g.globalCompositeOperation = \"lighter\";\n              const fg = g.createRadialGradient(x, base - L - 12, 0, x, base - L - 12, 12);\n              fg.addColorStop(0, glowA);\n              fg.addColorStop(1, glowB);\n              g.fillStyle = fg;\n              g.fillRect(x - 14, base - L - 26, 28, 28);\n              g.restore();\n            }\n          });\n          g.fillStyle = \"#2b2421\";\n          g.fillRect(x0 - 20, base, gap * (n - 1) + 40, 6);\n          fire.step(dt);\n          fire.draw(g, palette === \"fire\" ? BB : pal, 0.6);\n          sp.step(dt);\n          sp.draw(g);\n          return !still && (busy || fire.n > 0 || sp.n > 0);\n        },\n        destroy: () => d.dispose(),\n      };\n    },\n    { enabled: hydrated, paused, key: `${tier}:${still ? 1 : 0}:${palette}:${matches}` },\n  );\n\n  useEffect(() => {\n    wake();\n  }, [v, wake]);\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"match-progress\" data-tier={tier} className={`fb-match-progress ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        .fb-match-progress { position: relative; display: grid; justify-items: center; gap: 12px; }\n        .fb-mp-stage { position: relative; width: 100%; min-width: 220px; height: 150px; }\n        .fb-mp-fx { position: absolute; inset: 0; pointer-events: none; }\n        .fb-mp-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-mp-bar { position: absolute; left: 0; right: 0; bottom: 18px; height: 6px; border-radius: 3px; background: #2b2421; overflow: hidden; }\n        .fb-mp-bar > i { display: block; height: 100%; background: var(--fb-heat-2, #E8590C); }\n        .fb-match-progress[data-drawn] .fb-mp-bar { display: none; }\n        .fb-mp-val { font: 13px ui-monospace, \"Geist Mono\", monospace; color: var(--foreground, #E9E5DF); }\n      `}</style>\n      <div className=\"fb-mp-stage\">\n        <div ref={fxRef} className=\"fb-mp-fx\" aria-hidden=\"true\" />\n        {/* before the canvas mounts (server HTML, no JavaScript) a plain bar shows the same value */}\n        <div className=\"fb-mp-bar\" aria-hidden=\"true\">\n          <i style={{ width: `${v}%` }} />\n        </div>\n      </div>\n      <span className=\"fb-mp-val\" role=\"progressbar\" aria-label={label} aria-valuemin={0} aria-valuemax={100} aria-valuenow={v}>\n        {showValue ? `${v}%` : null}\n      </span>\n    </div>\n  );\n}\n\nexport default MatchProgress;\n",
          "type": "registry:ui",
          "target": "components/ui/match-progress.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "match-progress",
          "version": "0.1.0",
          "summary": "feedback: Progress bar drawn as a row of matches, each catching from the last as the job advances (canvas 2D, server-safe bar, reduced motion -> still)",
          "slot": "feedback",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "A job with real progress the visitor waits for (an upload, a build, an import)",
            "A hero or onboarding step where progress is the moment"
          ],
          "avoidWhen": [
            "Indeterminate waits with no real percentage",
            "Many progress bars in a table"
          ],
          "alternatives": []
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "One still frame on the canvas (reduced motion, Save-Data, no WebGL2), redrawn only when the value changes",
            "1": "Same as tier 2",
            "2": "Animated at DPR <= 1.5 with half the particles",
            "3": "Animated at DPR <= 2 with the full particle count"
          },
          "reducedMotion": {
            "mode": "still-frame",
            "description": "The reached matches stand lit with a steady glow; no flame, no sparks, no burning down. One frame per change."
          },
          "input": {
            "pointer": "None (it shows progress)",
            "touch": "None",
            "keyboard": "None (not focusable)"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "not-needed",
          "wcag": [
            "1.1.1",
            "1.3.1",
            "4.1.2"
          ],
          "notes": "role=progressbar with aria-valuenow/min/max and a required accessible name; the visible percentage is its text. The canvas is aria-hidden; before it mounts a plain bar shows the same value. Each burn lasts 7 s and stops."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "fuse-toast",
            "flame-switch"
          ]
        },
        "props": [
          {
            "name": "value",
            "type": "number",
            "default": null,
            "effect": "Required. Progress 0-100; each match catches as the value passes its share."
          },
          {
            "name": "label",
            "type": "string",
            "default": null,
            "effect": "Required. Accessible name of the progress bar."
          },
          {
            "name": "matches",
            "type": "number",
            "default": 12,
            "effect": "Number of matches in the row."
          },
          {
            "name": "showValue",
            "type": "boolean",
            "default": true,
            "effect": "Show the percentage under the row."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/match-progress",
          "usage": "import { MatchProgress } from \"@/components/ui/match-progress\";\n\nexport function Upload({ percent }: { percent: number }) {\n  return <MatchProgress value={percent} label=\"Uploading your files\" />;\n}",
          "mistakes": [
            "Pass real progress (0-100). For an unknown wait, use the host's spinner instead.",
            "label is required: it names the progress bar.",
            "Leave about 150 px of height for the standing matches."
          ],
          "verify": [
            "Server HTML has a progressbar with aria-valuenow and a plain bar.",
            "Raising value lights matches in order with a burst.",
            "Burning stops within 7 s and the loop goes quiet."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "405dd589c2fd6ff72de135a9304893557260ee3ee6797fd657b0844074cf5f3c",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.89,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "mesh-gradient",
      "type": "registry:ui",
      "title": "MeshGradient",
      "description": "background: multi-color organic mesh gradient via WebGL2 (webgl2, client-only, reduced motion -> static poster, DPR <= 1.5 on mobile/Tier 2)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/mesh-gradient/mesh-gradient.gl.tsx",
          "content": "// Original — Frictionborn Motion MeshGradient WebGL2 renderer\n\"use client\";\n\nimport { useEffect, useRef, useCallback } from \"react\";\nimport { createSurface, type Surface } from \"@frictionborn/runtime/gl\";\nimport { useFrame, useFrameGuard, usePaused } from \"@frictionborn/runtime\";\nimport { vertexShaderSource, fragmentShaderSource } from \"./mesh-gradient.glsl\";\n\n/** Shader seconds per real second at `speed` 1: the drift this item has always had by default (DESIGN A2: slow ambient motion). */\nconst TIME_SCALE = 0.35;\n\nexport interface MeshGradientGLProps {\n  colors: [\n    [number, number, number],\n    [number, number, number],\n    [number, number, number],\n    [number, number, number]\n  ];\n  speed?: number;\n  distortion?: number;\n  swirl?: number;\n  grainMixer?: number;\n  grainOverlay?: number;\n  tier?: number;\n  paused?: boolean;\n  reducedMotion?: boolean;\n  suspended?: boolean;\n  onDowngrade?: () => void;\n  onContextLost?: () => void;\n  onContextRestored?: () => void;\n}\n\nexport default function MeshGradientGL({\n  colors,\n  speed = 1,\n  distortion = 0.5,\n  swirl = 0.25,\n  grainMixer = 0.08,\n  grainOverlay = 0.04,\n  tier = 3,\n  paused = false,\n  reducedMotion = false,\n  suspended = false,\n  onDowngrade,\n  onContextLost,\n  onContextRestored,\n}: MeshGradientGLProps) {\n  const hostRef = useRef<HTMLDivElement | null>(null);\n  const glSurface = useRef<Surface | null>(null);\n  const glProgram = useRef<WebGLProgram | null>(null);\n  const uniformMap = useRef<Map<string, WebGLUniformLocation>>(new Map());\n\n  const elapsedClock = useRef(0);\n  const activePalette = useRef(colors);\n  const lostHandler = useRef(onContextLost);\n  const restoredHandler = useRef(onContextRestored);\n\n  useEffect(() => {\n    activePalette.current = colors;\n    lostHandler.current = onContextLost;\n    restoredHandler.current = onContextRestored;\n  });\n\n  const isGlobalPaused = usePaused();\n\n  useFrameGuard({\n    onDowngrade: onDowngrade ?? (() => {}),\n    active: !paused && !isGlobalPaused && !reducedMotion && !suspended,\n  }); // @frictionborn-guard\n\n  const maxDpr = tier >= 3 ? 2.0 : 1.5;\n  const meshScale = tier >= 3 ? 1.0 : 0.75;\n  const meshOctaves = tier >= 3 ? 4 : 2;\n\n  const flushMeshState = useCallback(\n    (timeValue: number) => {\n      const surface = glSurface.current;\n      const prog = glProgram.current;\n      if (!surface || !prog) return;\n\n      const gl = surface.gl;\n      const u = uniformMap.current;\n      gl.useProgram(prog);\n\n      const uRes = u.get(\"u_resolution\");\n      if (uRes) gl.uniform2f(uRes, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n      const uTime = u.get(\"u_time\");\n      if (uTime) gl.uniform1f(uTime, timeValue);\n\n      const uSpeed = u.get(\"u_speed\");\n      if (uSpeed) gl.uniform1f(uSpeed, speed * TIME_SCALE);\n\n      const uDistort = u.get(\"u_distortion\");\n      if (uDistort) gl.uniform1f(uDistort, distortion);\n\n      const uSwirl = u.get(\"u_swirl\");\n      if (uSwirl) gl.uniform1f(uSwirl, swirl);\n\n      const uMixer = u.get(\"u_grain_mixer\");\n      if (uMixer) gl.uniform1f(uMixer, grainMixer);\n\n      const uOverlay = u.get(\"u_grain_overlay\");\n      if (uOverlay) gl.uniform1f(uOverlay, grainOverlay);\n\n      const uOct = u.get(\"u_octaves\");\n      if (uOct) gl.uniform1i(uOct, meshOctaves);\n\n      const pal = activePalette.current;\n      for (let i = 0; i < 4; i++) {\n        const uCol = u.get(`u_color${i}`);\n        if (uCol) {\n          gl.uniform3f(uCol, pal[i][0], pal[i][1], pal[i][2]);\n        }\n      }\n\n      surface.draw();\n    },\n    [speed, distortion, swirl, grainMixer, grainOverlay, meshOctaves]\n  );\n\n  useEffect(() => {\n    const parent = hostRef.current;\n    if (!parent) return;\n\n    const cvs = document.createElement(\"canvas\");\n    cvs.setAttribute(\"aria-hidden\", \"true\");\n    cvs.setAttribute(\"data-frictionborn-gl\", \"mesh-gradient\");\n    Object.assign(cvs.style, {\n      position: \"absolute\",\n      inset: \"0\",\n      width: \"100%\",\n      height: \"100%\",\n      display: \"block\",\n      pointerEvents: \"none\",\n      zIndex: \"2\",\n    });\n    parent.appendChild(cvs);\n\n    const initShaders = (s: Surface) => {\n      const gl = s.gl;\n      const prog = s.createProgram(vertexShaderSource, fragmentShaderSource);\n      glProgram.current = prog;\n\n      const map = new Map<string, WebGLUniformLocation>();\n      const names = [\n        \"u_resolution\",\n        \"u_time\",\n        \"u_speed\",\n        \"u_distortion\",\n        \"u_swirl\",\n        \"u_grain_mixer\",\n        \"u_grain_overlay\",\n        \"u_octaves\",\n        \"u_color0\",\n        \"u_color1\",\n        \"u_color2\",\n        \"u_color3\",\n      ];\n      for (const name of names) {\n        const loc = gl.getUniformLocation(prog, name);\n        if (loc) map.set(name, loc);\n      }\n      uniformMap.current = map;\n    };\n\n    try {\n      const surface = createSurface(cvs, {\n        maxDpr,\n        scale: meshScale,\n        onContextLost: () => {\n          cvs.style.display = \"none\";\n          lostHandler.current?.();\n        },\n        onContextRestored: () => {\n          cvs.style.display = \"block\";\n          if (glSurface.current) {\n            glSurface.current.resize();\n            initShaders(glSurface.current);\n            flushMeshState(elapsedClock.current);\n          }\n          restoredHandler.current?.();\n        },\n      }); // @frictionborn-guard\n\n      glSurface.current = surface;\n      initShaders(surface);\n      flushMeshState(elapsedClock.current);\n    } catch (failure) {\n      console.warn(\"MeshGradient WebGL2 surface failure\", failure);\n      if (glSurface.current) {\n        glSurface.current.dispose(); // @frictionborn-guard\n        glSurface.current = null;\n      }\n      lostHandler.current?.();\n    }\n\n    return () => {\n      if (glSurface.current) {\n        glSurface.current.dispose(); // @frictionborn-guard\n        glSurface.current = null;\n      }\n      cvs.remove();\n    };\n  }, [maxDpr, meshScale, flushMeshState]);\n\n  useFrame(\n    ({ dt }) => {\n      elapsedClock.current += (dt * 0.001) * speed * TIME_SCALE;\n      flushMeshState(elapsedClock.current);\n    },\n    { active: !paused && !isGlobalPaused && !reducedMotion && !suspended } // @frictionborn-guard\n  );\n\n  return (\n    <div\n      ref={hostRef}\n      aria-hidden=\"true\"\n      className=\"fb-mesh-surface\"\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        width: \"100%\",\n        height: \"100%\",\n        overflow: \"hidden\",\n        pointerEvents: \"none\",\n        zIndex: 2,\n        visibility: suspended ? \"hidden\" : \"visible\",\n      }}\n    />\n  );\n}\n",
          "type": "registry:ui",
          "target": "components/ui/mesh-gradient.gl.tsx"
        },
        {
          "path": "registry/items/mesh-gradient/mesh-gradient.glsl.ts",
          "content": "// Source: https://github.com/stegu/webgl-noise — MIT — Copyright (C) 2011 Ashima Arts, Stefan Gustavson\n// Adaptation & composition: Original — Frictionborn Motion\n\nexport const vertexShaderSource = `#version 300 es\nin vec2 position;\nout vec2 v_uv;\n\nvoid main() {\n  v_uv = (position + 1.0) * 0.5;\n  gl_Position = vec4(position, 0.0, 1.0);\n}\n`;\n\nexport const fragmentShaderSource = `#version 300 es\nprecision highp float;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform float u_speed;\nuniform float u_distortion;\nuniform float u_swirl;\nuniform float u_grain_mixer;\nuniform float u_grain_overlay;\nuniform int u_octaves;\n\nuniform vec3 u_color0;\nuniform vec3 u_color1;\nuniform vec3 u_color2;\nuniform vec3 u_color3;\n\n// --- Stefan Gustavson / Ashima Arts 2D Simplex Noise (MIT License) ---\nvec3 mod289(vec3 x) {\n  return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n  return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n  return mod289(((x * 34.0) + 1.0) * x);\n}\n\nfloat snoise(vec2 v) {\n  const vec4 C = vec4(\n    0.211324865405187,   // (3.0 - sqrt(3.0)) / 6.0\n    0.366025403784439,   // 0.5 * (sqrt(3.0) - 1.0)\n   -0.577350269189626,   // -1.0 + 2.0 * C.x\n    0.024390243902439    // 1.0 / 41.0\n  );\n\n  vec2 i  = floor(v + dot(v, C.yy));\n  vec2 x0 = v - i + dot(i, C.xx);\n\n  vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n  vec4 x12 = x0.xyxy + C.xxzz;\n  x12.xy -= i1;\n\n  i = mod289(i);\n  vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n\n  vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n  m = m * m;\n  m = m * m;\n\n  vec3 x = 2.0 * fract(p * C.www) - 1.0;\n  vec3 h = abs(x) - 0.5;\n  vec3 ox = floor(x + 0.5);\n  vec3 a0 = x - ox;\n\n  m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n\n  vec3 g;\n  g.x  = a0.x  * x0.x  + h.x  * x0.y;\n  g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n  return 130.0 * dot(m, g);\n}\n// --- End simplex noise primitive ---\n\n// Original Frictionborn organic mesh-gradient composition\nvoid main() {\n  vec2 p = v_uv;\n\n  // 1. Swirl distortion around center\n  vec2 center = vec2(0.5, 0.5);\n  vec2 d = p - center;\n  float r = length(d);\n  float theta = atan(d.y, d.x);\n  float swirlEffect = u_swirl * sin(r * 4.0 - u_time * 0.4);\n  vec2 pSwirl = center + vec2(cos(theta + swirlEffect), sin(theta + swirlEffect)) * r;\n\n  // 2. Domain-warping with simplex noise\n  vec2 warp = vec2(\n    snoise(pSwirl * 2.2 + vec2(u_time * 0.15, -u_time * 0.10)),\n    snoise(pSwirl * 2.2 + vec2(-u_time * 0.12, u_time * 0.18))\n  );\n  vec2 pWarped = pSwirl + warp * (u_distortion * 0.28);\n\n  if (u_octaves >= 3) {\n    vec2 warpFine = vec2(\n      snoise(pWarped * 4.4 + vec2(-u_time * 0.20, u_time * 0.25)),\n      snoise(pWarped * 4.4 + vec2(u_time * 0.22, -u_time * 0.15))\n    );\n    pWarped += warpFine * (u_distortion * 0.12);\n  }\n\n  // 3. Dynamic color anchor centers (matching CSS poster positions at rest)\n  vec2 a1 = vec2(0.20, 0.30) + vec2(0.08 * sin(u_time * 0.35), 0.06 * cos(u_time * 0.45));\n  vec2 a2 = vec2(0.80, 0.70) + vec2(0.07 * cos(u_time * 0.40), 0.08 * sin(u_time * 0.30));\n  vec2 a3 = vec2(0.50, 0.50) + vec2(0.06 * sin(u_time * 0.50), 0.07 * cos(u_time * 0.35));\n\n  // 4. Weight interpolation\n  float d1 = distance(pWarped, a1);\n  float w1 = smoothstep(0.65, 0.0, d1) * 0.75;\n\n  float d2 = distance(pWarped, a2);\n  float w2 = smoothstep(0.60, 0.0, d2) * 0.70;\n\n  float d3 = distance(pWarped, a3);\n  float w3 = smoothstep(0.70, 0.0, d3) * 0.80;\n\n  // 5. Blending with base color\n  vec3 col = u_color0;\n  col = mix(col, u_color1, w1);\n  col = mix(col, u_color2, w2);\n  col = mix(col, u_color3, w3);\n\n  // 6. Subtle grain overlay / dither to eliminate banding\n  float noise = fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453) - 0.5;\n  float grain = noise * (u_grain_mixer * 0.3 + u_grain_overlay * 0.7);\n  col += grain;\n\n  fragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n}\n`;\n",
          "type": "registry:ui",
          "target": "components/ui/mesh-gradient.glsl.ts"
        },
        {
          "path": "registry/items/mesh-gradient/mesh-gradient.tsx",
          "content": "// Original — Frictionborn Motion MeshGradient\n\"use client\";\n\nimport React, { useState, useEffect, useRef, useCallback, useId, Suspense, lazy, useImperativeHandle } from \"react\";\nimport {\n  paletteVars,\n  type PaletteName,\n  useCapability,\n  useHydrated,\n  useReducedMotion,\n  useInView,\n  resolveCssColor,\n  glBudget,\n  type Lease,\n} from \"@frictionborn/runtime\";\n\nconst MeshGradientGL = lazy(() => import(\"./mesh-gradient.gl\"));\n\nexport interface MeshGradientProps extends React.HTMLAttributes<HTMLDivElement> {\n  colors?: string[];\n  /** Colours from a palette (DESIGN.md A8): `fire` | `ice` | `neon` | `mono` | `custom` (reads `--fb-heat-0..4`). Overrides `colors`; leave it out to keep the host's tokens. */\n  palette?: PaletteName;\n  speed?: number;\n  distortion?: number;\n  swirl?: number;\n  grainMixer?: number;\n  grainOverlay?: number;\n  scrim?: boolean;\n  paused?: boolean;\n  maxTier?: number;\n  reducedMotion?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n  children?: React.ReactNode;\n}\n\n/** round 4: the palette's background, hot, bright and dark-glow colours (DESIGN.md A8); a preset sets them on the root, `custom` reads the page's */\nconst HEAT_COLORS = [\"var(--fb-heat-0)\", \"var(--fb-heat-2)\", \"var(--fb-heat-3)\", \"var(--fb-heat-1)\"];\n\n// Host tokens with CSS system-colour fallbacks; stable module-level constant\nconst DEFAULT_MESH_TOKENS = [\n  \"var(--background, Canvas)\",\n  \"var(--primary, CanvasText)\",\n  \"var(--chart-1, var(--accent, GrayText))\",\n  \"var(--chart-2, var(--muted, ButtonFace))\",\n];\n\ntype RgbTriple = [number, number, number];\nconst DEFAULT_RGB_QUAD: [RgbTriple, RgbTriple, RgbTriple, RgbTriple] = [\n  [0.05, 0.06, 0.08],\n  [0.22, 0.74, 0.97],\n  [0.51, 0.55, 0.97],\n  [0.12, 0.16, 0.23],\n];\n\nexport function MeshGradient({\n  colors: colorsProp = DEFAULT_MESH_TOKENS,\n  palette,\n  speed = 1.0,\n  distortion = 0.5,\n  swirl = 0.25,\n  grainMixer = 0.08,\n  grainOverlay = 0.04,\n  scrim = false,\n  paused = false,\n  maxTier = 3,\n  reducedMotion: propReduced,\n  ref,\n  className = \"\",\n  style,\n  children,\n  ...props\n}: MeshGradientProps) {\n  const colors = palette ? HEAT_COLORS : colorsProp;\n  const hostElementRef = useRef<HTMLDivElement | null>(null);\n  const uid = useId();\n  const isClientHydrated = useHydrated(); // @frictionborn-guard\n  const runtimeCap = useCapability(); // @frictionborn-guard\n  const prefersReduce = useReducedMotion(); // @frictionborn-guard\n  const suppressMotion = propReduced !== undefined ? propReduced : prefersReduce; // @frictionborn-guard\n  const isInViewport = useInView(hostElementRef); // @frictionborn-guard\n\n  const [hasContextLease, setHasContextLease] = useState(false);\n  const leaseHandle = useRef<Lease | null>(null);\n  const instanceTag = useRef(`mesh-${uid}`);\n  const [contextSevered, setContextSevered] = useState(false);\n\n  const [downgrades, setDowngrades] = useState(0);\n  const effectiveTier = isClientHydrated\n    ? Math.max(0, Math.min(runtimeCap.tier, maxTier) - downgrades)\n    : 0;\n  const [activeColors, setActiveColors] = useState<[RgbTriple, RgbTriple, RgbTriple, RgbTriple]>(DEFAULT_RGB_QUAD);\n\n  const refreshColors = useCallback(() => {\n    const el = hostElementRef.current;\n    const resolved: RgbTriple[] = colors.map((c) => {\n      const rgb = resolveCssColor(el, c);\n      return rgb ? (rgb as RgbTriple) : [0.5, 0.5, 0.5];\n    });\n\n    const c0 = resolved[0] ?? DEFAULT_RGB_QUAD[0];\n    const c1 = resolved[1] ?? resolved[0] ?? DEFAULT_RGB_QUAD[1];\n    const c2 = resolved[2] ?? resolved[1] ?? DEFAULT_RGB_QUAD[2];\n    const c3 = resolved[3] ?? resolved[0] ?? DEFAULT_RGB_QUAD[3];\n    const next: [RgbTriple, RgbTriple, RgbTriple, RgbTriple] = [c0, c1, c2, c3];\n\n    setActiveColors((prev) => {\n      const isIdentical =\n        prev.length === 4 &&\n        prev.every(\n          (tuple, i) =>\n            Math.abs(tuple[0] - next[i][0]) < 0.002 &&\n            Math.abs(tuple[1] - next[i][1]) < 0.002 &&\n            Math.abs(tuple[2] - next[i][2]) < 0.002\n        );\n      return isIdentical ? prev : next;\n    });\n  }, [colors]);\n\n  useEffect(() => {\n    refreshColors();\n    if (typeof MutationObserver === \"undefined\") return;\n    const obs = new MutationObserver(refreshColors);\n    obs.observe(document.documentElement, {\n      attributes: true,\n      attributeFilter: [\"class\", \"data-theme\", \"data-mode\", \"style\"],\n    });\n    return () => obs.disconnect();\n  }, [refreshColors]);\n\n  // Context lease lifecycle management (Decision 19: reduced motion = no WebGL)\n  const isQualifiedForWebGL =\n    isClientHydrated && isInViewport && effectiveTier >= 2 && !suppressMotion;\n\n  useEffect(() => {\n    if (!isQualifiedForWebGL) {\n      if (leaseHandle.current) {\n        leaseHandle.current.release(); // @frictionborn-guard\n        leaseHandle.current = null;\n        setHasContextLease(false);\n      }\n      return;\n    }\n\n    const tryAcquire = () => {\n      if (leaseHandle.current) return;\n      const acquired = glBudget.acquire({\n        id: instanceTag.current,\n        priority: 1,\n        onEvict: () => {\n          leaseHandle.current = null;\n          setHasContextLease(false);\n        },\n      }); // @frictionborn-guard\n\n      if (acquired) {\n        leaseHandle.current = acquired;\n        setHasContextLease(true);\n        // A new lease means a new GL instance: a loss that was never restored must not leave it suspended (same fix as NoiseField, 5c74d38)\n        setContextSevered(false);\n      }\n    };\n\n    tryAcquire();\n\n    const unsubscribe = typeof glBudget.subscribe === \"function\"\n      ? glBudget.subscribe(() => {\n          if (!leaseHandle.current) {\n            tryAcquire();\n          }\n        })\n      : () => {};\n\n    return () => {\n      unsubscribe();\n    };\n  }, [isQualifiedForWebGL]);\n\n  useEffect(() => {\n    return () => {\n      leaseHandle.current?.release(); // @frictionborn-guard\n      leaseHandle.current = null;\n    };\n  }, []);\n\n  const handleStepDown = useCallback(() => {\n    setDowngrades((prev) => prev + 1); // @frictionborn-guard\n  }, []);\n\n  const handleContextLost = useCallback(() => {\n    setContextSevered(true); // @frictionborn-guard\n  }, []);\n\n  const handleContextRestored = useCallback(() => {\n    setContextSevered(false); // @frictionborn-guard\n  }, []);\n\n  // Pure CSS poster matching the shader's anchor positions and spatial weighting\n  const bgBase = colors[0];\n  const posterArt = `radial-gradient(circle at 20% 30%, color-mix(in srgb, ${colors[1] ?? colors[0]} 38%, transparent) 0%, transparent 65%), radial-gradient(circle at 80% 70%, color-mix(in srgb, ${colors[2] ?? colors[0]} 34%, transparent) 0%, transparent 60%), radial-gradient(circle at 50% 50%, color-mix(in srgb, ${colors[3] ?? colors[0]} 40%, transparent) 0%, transparent 70%), ${bgBase}`;\n\n  const renderWebGLMesh = hasContextLease && !suppressMotion && effectiveTier >= 2;\n\n  useImperativeHandle(ref, () => hostElementRef.current as HTMLDivElement);\n\n  return (\n    <div\n      ref={hostElementRef}\n      data-frictionborn-item=\"mesh-gradient\"\n      data-tier={effectiveTier}\n      className={`fb-mesh-gradient ${className}`}\n      style={{\n        ...(palette ? paletteVars(palette) : null),\n        position: \"relative\",\n        width: \"100%\",\n        height: \"100%\",\n        minHeight: \"260px\",\n        overflow: \"hidden\",\n        backgroundColor: bgBase,\n        ...style,\n      }}\n      {...props}\n    >\n      {/* 1. Server-rendered CSS gradient poster always present as fallback (CLS 0) */}\n      <div\n        data-frictionborn-poster=\"true\"\n        aria-hidden=\"true\"\n        style={{\n          position: \"absolute\",\n          inset: 0,\n          background: posterArt,\n          pointerEvents: \"none\",\n        }}\n      />\n\n      {/* 2. WebGL canvas rendered client-side only when lease granted and not reduced-motion */}\n      {renderWebGLMesh && (\n        <Suspense fallback={null}>\n          <MeshGradientGL\n            suspended={contextSevered}\n            colors={activeColors}\n            speed={speed}\n            distortion={distortion}\n            swirl={swirl}\n            grainMixer={grainMixer}\n            grainOverlay={grainOverlay}\n            tier={effectiveTier}\n            paused={paused}\n            reducedMotion={suppressMotion}\n            onDowngrade={handleStepDown}\n            onContextLost={handleContextLost}\n            onContextRestored={handleContextRestored}\n          />\n        </Suspense>\n      )}\n\n      {/* 3. Theme-aware scrim preserving WCAG AA contrast >= 4.5:1 for overlaid text */}\n      {scrim && (\n        <div\n          aria-hidden=\"true\"\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            background: `radial-gradient(circle at center, color-mix(in srgb, ${bgBase} 20%, transparent) 0%, color-mix(in srgb, ${bgBase} 80%, transparent) 100%)`,\n            pointerEvents: \"none\",\n            zIndex: 2,\n          }}\n        />\n      )}\n\n      {/* 4. Children slot */}\n      {children && (\n        <div\n          style={{\n            position: \"relative\",\n            zIndex: 3,\n            width: \"100%\",\n            height: \"100%\",\n          }}\n        >\n          {children}\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default MeshGradient;\n",
          "type": "registry:ui",
          "target": "components/ui/mesh-gradient.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "mesh-gradient",
          "version": "0.1.0",
          "summary": "background: multi-color organic mesh gradient via WebGL2 (webgl2, client-only, reduced motion -> static poster, DPR <= 1.5 on mobile/Tier 2)",
          "slot": "background",
          "kind": "webgl"
        },
        "intent": {
          "useWhen": [
            "Hero sections requiring rich, fluid multi-color ambient backgrounds",
            "Telemetry or premium landing surfaces needing organic color transitions",
            "Sections requiring soft chromatic fields with zero server hydration shift"
          ],
          "avoidWhen": [
            "Dense text sections where text contrast over the gradient has not been verified",
            "Surfaces already running another full-screen WebGL shader in the same viewport",
            "Devices with battery-saver or forced reduced motion enabled"
          ],
          "alternatives": [
            {
              "name": "noise-field",
              "when": "When monochromatic procedural simplex flow lines are desired"
            },
            {
              "name": "particle-field",
              "when": "When discrete kinematic points and pointer repulsion are preferred"
            }
          ]
        },
        "runtime": {
          "serverOutput": "poster",
          "clientOnly": true,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "while-visible",
          "webglContexts": 1,
          "tiers": {
            "0": "CSS multi-radial gradient poster only, no WebGL (server render, prefers-reduced-motion, Save-Data, no WebGL2, or frame-guard downgrade)",
            "1": "CSS multi-radial gradient poster only (coarse pointer with low-end hints: deviceMemory <= 2 or <= 4 cores)",
            "2": "WebGL2 at DPR <= 1.5, 0.75 render scale, 2 octaves (coarse pointer without low-end hints, or fine pointer with low-end hints or viewport < 480px)",
            "3": "WebGL2 at DPR <= 2.0, full render scale, 4 octaves (fine pointer with hover, no low-end hints)"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Renders the static CSS gradient poster with no WebGL context and no animation frames (Decision 14 D-A). Under prefers-reduced-motion the runtime tier is 0, so WebGL does not start."
          },
          "input": {
            "pointer": "None; ambient background surface",
            "touch": "None; no touch or pointer listeners. Coarse pointers with low-end hints get the tier 1 poster; other coarse-pointer devices run WebGL at tier 2.",
            "keyboard": "None; the component has no interactive elements. Poster, scrim and canvas layers are aria-hidden; children keep their own semantics."
          }
        },
        "a11y": {
          "role": "decorative",
          "hiddenFromAT": true,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "2.2.2"
          ],
          "notes": "The poster, scrim and canvas layers are aria-hidden; the root element and children are not. There is no built-in pause button: pause with the paused prop or the runtime pauseAll()/resumeAll(). The optional scrim lowers background luminance behind children but contrast is not computed; verify text contrast for your colours."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": false,
          "conflictsWith": [
            "noise-field",
            "particle-field"
          ],
          "pairsWith": [
            "text-reveal",
            "magnetic-button",
            "scroll-reveal"
          ]
        },
        "props": [
          {
            "name": "colors",
            "type": "string[]",
            "default": [
              "var(--background, Canvas)",
              "var(--primary, CanvasText)",
              "var(--chart-1, var(--accent, GrayText))",
              "var(--chart-2, var(--muted, ButtonFace))"
            ],
            "effect": "CSS colours resolved from host tokens. Only the first four are used (extra entries are ignored); missing entries reuse earlier ones. The first colour is the background."
          },
          {
            "name": "speed",
            "type": "number",
            "default": 1,
            "effect": "Unitless multiplier of the standard drift. 1 is the standard speed, which is already slow (0.35 shader seconds per second); 0.5 is half and 2 is double."
          },
          {
            "name": "distortion",
            "type": "number",
            "default": 0.5,
            "effect": "Amplitude of organic noise distortion."
          },
          {
            "name": "swirl",
            "type": "number",
            "default": 0.25,
            "effect": "Vortex swirl strength in the gradient field."
          },
          {
            "name": "grainMixer",
            "type": "number",
            "default": 0.08,
            "effect": "Subtle analog grain distortion strength."
          },
          {
            "name": "grainOverlay",
            "type": "number",
            "default": 0.04,
            "effect": "Post-processing fine film grain overlay intensity."
          },
          {
            "name": "scrim",
            "type": "boolean",
            "default": false,
            "effect": "Renders a radial scrim of the first colour (20% centre to 80% edge opacity) over the canvas to lower background luminance behind children. Does not guarantee text contrast; verify for your colours."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Freezes this instance's shader animation loop. The global pauseAll() also stops it."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Upper bound on the capability tier (0 to 3); the tier is the minimum of this and the runtime tier."
          },
          {
            "name": "reducedMotion",
            "type": "boolean",
            "default": null,
            "effect": "Optional. No default (follows prefers-reduced-motion). true forces the static poster. false only skips the prop-level check: under prefers-reduced-motion the runtime tier is still 0, so WebGL still does not start. Leave unset."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root div (the built-in class fb-mesh-gradient is kept)."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the root div, merged after the built-in layout and background colour (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div> that holds the poster and the canvas."
          },
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Optional. No default. Content layered above the poster, canvas and scrim."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": null,
            "effect": "Colours from a palette (DESIGN.md A8): fire, ice, neon, mono, or custom (reads --fb-heat-0..4). Overrides colors; leave it out to keep the host's tokens."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/mesh-gradient",
          "usage": "import { MeshGradient } from \"@/components/ui/mesh-gradient\";\n\nexport default function Hero() {\n  return (\n    <MeshGradient scrim className=\"min-h-[500px] flex items-center justify-center\">\n      <h1 className=\"text-4xl font-bold tracking-tight text-foreground\">Spectral Wavefront</h1>\n    </MeshGradient>\n  );\n}",
          "mistakes": [
            "Do not combine multiple MeshGradient instances in the same viewport.",
            "scrim defaults to false. Turn it on behind text, but it only lowers background luminance and does not guarantee 4.5:1 contrast: verify contrast for your colours and use host foreground tokens for text.",
            "Do not set reducedMotion={false} to try to force WebGL; it does not override the user's preference (the runtime tier stays 0 under prefers-reduced-motion).",
            "Never call requestAnimationFrame directly to animate the mesh."
          ],
          "verify": [
            "Confirm the static CSS multi-radial gradient poster renders in server HTML (CLS <= 0.01).",
            "Confirm that when prefers-reduced-motion is active, the static poster renders with zero WebGL contexts allocated and zero rAF cycles.",
            "Confirm context lease is released when scrolled out of view."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [
            {
              "what": "Simplex noise algorithm (GLSL)",
              "url": "https://github.com/stegu/webgl-noise",
              "license": "MIT"
            }
          ],
          "notices": [
            "Includes 2D Simplex Noise from stegu/webgl-noise (MIT Copyright 2011 Ashima Arts, Stefan Gustavson)."
          ],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "47332832cdbe8eefcabf68d739d7affaae1f81909c15c7bfaf53213d795d0d49",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.01,
            "deferred": 3.5,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "21 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "noise-field",
      "type": "registry:ui",
      "title": "NoiseField",
      "description": "background: WebGL2 domain-warped noise hero background (webgl2, client-only, reduced motion -> static poster, mobile -> tier 2 / tier 1 poster)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/noise-field/noise-field.gl.tsx",
          "content": "// Original — Frictionborn Motion\n\"use client\";\n\nimport { useEffect, useRef, useCallback } from \"react\";\nimport { createSurface, type Surface } from \"@frictionborn/runtime/gl\";\nimport { useFrame, useFrameGuard } from \"@frictionborn/runtime\";\nimport { vertexShaderSource, fragmentShaderSource } from \"./noise-field.glsl\";\n\nexport interface NoiseFieldGLProps {\n  colors: [[number, number, number], [number, number, number], [number, number, number]];\n  speed?: number;\n  scale?: number;\n  intensity?: number;\n  paused?: boolean;\n  time?: number;\n  tier?: number;\n  suspended?: boolean;\n  onContextLost?: () => void;\n  onContextRestored?: () => void;\n  onDowngrade?: () => void;\n}\n\nexport default function NoiseFieldGL({\n  colors,\n  speed = 1.0,\n  scale = 1.8,\n  intensity = 1.0,\n  paused = false,\n  time,\n  tier = 3,\n  suspended = false,\n  onContextLost,\n  onContextRestored,\n  onDowngrade,\n}: NoiseFieldGLProps) {\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const surfaceRef = useRef<Surface | null>(null);\n  const programRef = useRef<WebGLProgram | null>(null);\n  const uniformsRef = useRef<{\n    resolution?: WebGLUniformLocation;\n    time?: WebGLUniformLocation;\n    speed?: WebGLUniformLocation;\n    scale?: WebGLUniformLocation;\n    intensity?: WebGLUniformLocation;\n    octaves?: WebGLUniformLocation;\n    colorBg?: WebGLUniformLocation;\n    colorPrimary?: WebGLUniformLocation;\n    colorAccent?: WebGLUniformLocation;\n  }>({});\n  const timeRef = useRef<number>(time ?? 0);\n  const colorsRef = useRef(colors);\n  const onContextLostRef = useRef(onContextLost);\n  const onContextRestoredRef = useRef(onContextRestored);\n\n  useEffect(() => {\n    colorsRef.current = colors;\n    onContextLostRef.current = onContextLost;\n    onContextRestoredRef.current = onContextRestored;\n  });\n\n  const maxDpr = tier >= 3 ? 2.0 : 1.5;\n  const renderScale = tier >= 3 ? 1.0 : 0.75;\n  const octaves = tier >= 3 ? 4 : 2;\n\n  const renderFrame = useCallback((currentTime: number) => {\n    const surface = surfaceRef.current;\n    const program = programRef.current;\n    if (!surface || !program) return;\n\n    const gl = surface.gl;\n    const u = uniformsRef.current;\n\n    gl.useProgram(program);\n\n    if (u.resolution) {\n      gl.uniform2f(u.resolution, gl.drawingBufferWidth, gl.drawingBufferHeight);\n    }\n    if (u.time) {\n      gl.uniform1f(u.time, currentTime);\n    }\n    if (u.speed) {\n      gl.uniform1f(u.speed, speed);\n    }\n    if (u.scale) {\n      gl.uniform1f(u.scale, scale);\n    }\n    if (u.intensity) {\n      gl.uniform1f(u.intensity, intensity);\n    }\n    if (u.octaves) {\n      gl.uniform1i(u.octaves, octaves);\n    }\n\n    const currentColors = colorsRef.current;\n    if (u.colorBg) {\n      gl.uniform3f(u.colorBg, currentColors[0][0], currentColors[0][1], currentColors[0][2]);\n    }\n    if (u.colorPrimary) {\n      gl.uniform3f(u.colorPrimary, currentColors[1][0], currentColors[1][1], currentColors[1][2]);\n    }\n    if (u.colorAccent) {\n      gl.uniform3f(u.colorAccent, currentColors[2][0], currentColors[2][1], currentColors[2][2]);\n    }\n\n    surface.draw();\n  }, [speed, scale, intensity, octaves]);\n\n  useEffect(() => {\n    const container = containerRef.current;\n    if (!container) return;\n\n    const canvas = document.createElement(\"canvas\");\n    canvas.setAttribute(\"aria-hidden\", \"true\");\n    canvas.style.position = \"absolute\";\n    canvas.style.inset = \"0\";\n    canvas.style.width = \"100%\";\n    canvas.style.height = \"100%\";\n    canvas.style.display = \"block\";\n    canvas.style.pointerEvents = \"none\";\n    canvas.style.zIndex = \"2\"; // Above poster (z: 1), below scrim (z: 3)\n    container.appendChild(canvas);\n\n    function setupProgram(surface: ReturnType<typeof createSurface>) {\n      const gl = surface.gl;\n      const program = surface.createProgram(vertexShaderSource, fragmentShaderSource);\n      programRef.current = program;\n\n      uniformsRef.current = {\n        resolution: gl.getUniformLocation(program, \"u_resolution\") || undefined,\n        time: gl.getUniformLocation(program, \"u_time\") || undefined,\n        speed: gl.getUniformLocation(program, \"u_speed\") || undefined,\n        scale: gl.getUniformLocation(program, \"u_scale\") || undefined,\n        intensity: gl.getUniformLocation(program, \"u_intensity\") || undefined,\n        octaves: gl.getUniformLocation(program, \"u_octaves\") || undefined,\n        colorBg: gl.getUniformLocation(program, \"u_color_bg\") || undefined,\n        colorPrimary: gl.getUniformLocation(program, \"u_color_primary\") || undefined,\n        colorAccent: gl.getUniformLocation(program, \"u_color_accent\") || undefined,\n      };\n    }\n\n    try {\n      const surface = createSurface(canvas, {\n        maxDpr,\n        scale: renderScale,\n        onContextLost: () => {\n          canvas.style.display = \"none\";\n          onContextLostRef.current?.();\n        },\n        onContextRestored: () => {\n          canvas.style.display = \"block\";\n          if (surfaceRef.current) {\n            setupProgram(surfaceRef.current);\n            renderFrame(timeRef.current);\n          }\n          onContextRestoredRef.current?.();\n        },\n      }); // @frictionborn-guard\n\n      surfaceRef.current = surface;\n      setupProgram(surface);\n\n      // Draw initial frame immediately\n      renderFrame(timeRef.current);\n    } catch (err) {\n      console.warn(\"NoiseField WebGL2 initialization failed; falling back to poster\", err);\n      if (surfaceRef.current) {\n        surfaceRef.current.dispose(); // @frictionborn-guard\n        surfaceRef.current = null;\n      }\n      onContextLostRef.current?.();\n    }\n\n    return () => {\n      if (surfaceRef.current) {\n        surfaceRef.current.dispose(); // @frictionborn-guard\n        surfaceRef.current = null;\n      }\n      canvas.remove();\n    };\n  }, [maxDpr, renderScale, renderFrame]);\n\n  // Frame rate monitoring and automated downgrade\n  useFrameGuard({ onDowngrade: () => onDowngrade?.(), active: !paused && !suspended }); // @frictionborn-guard\n\n  // Animation loop subscribed via shared runtime useFrame (never raw rAF)\n  useFrame(\n    ({ dt }) => {\n      if (time !== undefined) {\n        timeRef.current = time;\n      } else {\n        timeRef.current += (dt * 0.001) * speed;\n      }\n      renderFrame(timeRef.current);\n    },\n    { active: !paused && !suspended } // @frictionborn-guard\n  );\n\n  return (\n    <div\n      ref={containerRef}\n      aria-hidden=\"true\"\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        width: \"100%\",\n        height: \"100%\",\n        overflow: \"hidden\",\n        pointerEvents: \"none\",\n        zIndex: 2,\n        visibility: suspended ? \"hidden\" : \"visible\",\n      }}\n    />\n  );\n}\n",
          "type": "registry:ui",
          "target": "components/ui/noise-field.gl.tsx"
        },
        {
          "path": "registry/items/noise-field/noise-field.glsl.ts",
          "content": "// Source: https://github.com/stegu/webgl-noise — MIT — Copyright (C) 2011 Ashima Arts, Stefan Gustavson\n// Adaptation & composition: Original — Frictionborn Motion\nexport const vertexShaderSource = `#version 300 es\nin vec2 position;\nout vec2 v_uv;\n\nvoid main() {\n  v_uv = (position + 1.0) * 0.5;\n  gl_Position = vec4(position, 0.0, 1.0);\n}\n`;\n\nexport const fragmentShaderSource = `#version 300 es\nprecision highp float;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform float u_speed;\nuniform float u_scale;\nuniform float u_intensity;\nuniform int u_octaves;\nuniform vec3 u_color_bg;\nuniform vec3 u_color_primary;\nuniform vec3 u_color_accent;\n\n// --- Stefan Gustavson / Ashima Arts 2D Simplex Noise (MIT License) ---\nvec3 mod289(vec3 x) {\n  return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n  return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n  return mod289(((x * 34.0) + 1.0) * x);\n}\n\nfloat snoise(vec2 v) {\n  const vec4 C = vec4(\n    0.211324865405187,   // (3.0 - sqrt(3.0)) / 6.0\n    0.366025403784439,   // 0.5 * (sqrt(3.0) - 1.0)\n   -0.577350269189626,   // -1.0 + 2.0 * C.x\n    0.024390243902439    // 1.0 / 41.0\n  );\n\n  vec2 i  = floor(v + dot(v, C.yy));\n  vec2 x0 = v - i + dot(i, C.xx);\n\n  vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n  vec4 x12 = x0.xyxy + C.xxzz;\n  x12.xy -= i1;\n\n  i = mod289(i);\n  vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n\n  vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n  m = m * m;\n  m = m * m;\n\n  vec3 x = 2.0 * fract(p * C.www) - 1.0;\n  vec3 h = abs(x) - 0.5;\n  vec3 ox = floor(x + 0.5);\n  vec3 a0 = x - ox;\n\n  m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n\n  vec3 g;\n  g.x  = a0.x  * x0.x  + h.x  * x0.y;\n  g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n  return 130.0 * dot(m, g);\n}\n// --- End simplex noise primitive ---\n\n// Original Frictionborn multi-octave kinetic flow composition\nconst mat2 FLOW_ROT1 = mat2(0.80,  0.60, -0.60,  0.80);\nconst mat2 FLOW_ROT2 = mat2(0.70, -0.71,  0.71,  0.70);\n\nfloat flowField(vec2 p, float t, int octaves) {\n  float val = 0.0;\n  float amp = 0.52;\n  vec2 coord = p;\n\n  // Primary base layer\n  val += amp * (snoise(coord + vec2(t * 0.12, -t * 0.08)) * 0.5 + 0.5);\n  coord = FLOW_ROT1 * coord * 1.95 + vec2(1.4, 2.7);\n  amp *= 0.50;\n\n  // Secondary layer\n  val += amp * (snoise(coord + vec2(-t * 0.15, t * 0.18)) * 0.5 + 0.5);\n  coord = FLOW_ROT2 * coord * 2.05 + vec2(3.1, 1.6);\n  amp *= 0.48;\n\n  // High-detail octaves active in Tier 3\n  if (octaves >= 3) {\n    val += amp * (snoise(coord + vec2(t * 0.22, t * 0.11)) * 0.5 + 0.5);\n    coord = FLOW_ROT1 * coord * 2.10 + vec2(0.9, 4.3);\n    amp *= 0.45;\n  }\n  if (octaves >= 4) {\n    val += amp * (snoise(coord - vec2(t * 0.18, t * 0.25)) * 0.5 + 0.5);\n  }\n\n  return val;\n}\n\nvoid main() {\n  vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n  vec2 aspect = vec2(u_resolution.x / min(u_resolution.x, u_resolution.y),\n                     u_resolution.y / min(u_resolution.x, u_resolution.y));\n  vec2 p = (v_uv - 0.5) * aspect;\n\n  float scale = u_scale > 0.0 ? u_scale : 1.8;\n  p *= scale;\n\n  float t = u_time * (u_speed > 0.0 ? u_speed : 0.4);\n  int octaves = u_octaves > 0 ? u_octaves : 4;\n\n  // Original advective warp: sample flow velocity field to advect sample coordinates\n  vec2 drift = vec2(\n    snoise(p * 0.75 + vec2(t * 0.08, 1.2)),\n    snoise(p * 0.75 + vec2(3.4, t * 0.09))\n  );\n\n  vec2 warpedP = p + drift * 0.38;\n  float intensity = u_intensity > 0.0 ? u_intensity : 1.0;\n  float n = flowField(warpedP, t, octaves) * intensity;\n\n  // Wide contrast remapping curve to eliminate muddy mid-range\n  float tPrimary = smoothstep(0.20, 0.65, n);\n  float tAccent  = smoothstep(0.55, 0.92, n);\n\n  // Blend from background base -> primary -> accent\n  vec3 col = mix(u_color_bg, u_color_primary, tPrimary * 0.85);\n  col = mix(col, u_color_accent, tAccent * 0.90);\n\n  // Soft vignette grounding edges into background token\n  float vignette = smoothstep(1.3, 0.3, length((v_uv - 0.5) * aspect));\n  col = mix(u_color_bg, col, clamp(vignette + 0.15, 0.0, 1.0));\n\n  fragColor = vec4(col, 1.0);\n}\n`;\n",
          "type": "registry:ui",
          "target": "components/ui/noise-field.glsl.ts"
        },
        {
          "path": "registry/items/noise-field/noise-field.tsx",
          "content": "// Original — Frictionborn Motion\n\"use client\";\n\nimport React, { useState, useEffect, useRef, useCallback, useId, Suspense, lazy, useImperativeHandle } from \"react\";\nimport {\n  useCapability,\n  useHydrated,\n  useReducedMotion,\n  useInView,\n  resolveCssColor,\n  paletteVars,\n  type PaletteName,\n  glBudget,\n  type Lease,\n} from \"@frictionborn/runtime\";\n\nconst NoiseFieldGL = lazy(() => import(\"./noise-field.gl\"));\n\nexport interface NoiseFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n  colors?: [string, string, string];\n  /** Colours from a palette (DESIGN.md A8): `fire` | `ice` | `neon` | `mono` | `custom` (reads `--fb-heat-0..4`). Overrides `colors`; leave it out to keep the host's tokens. */\n  palette?: PaletteName;\n  speed?: number;\n  scale?: number;\n  intensity?: number;\n  scrim?: boolean;\n  paused?: boolean;\n  time?: number;\n  maxTier?: number;\n  reducedMotion?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n  children?: React.ReactNode;\n}\n\n/** round 4: the palette's background, hot and bright colours (DESIGN.md A8); a preset sets them on the root, `custom` reads the page's */\nconst HEAT_COLORS: [string, string, string] = [\"var(--fb-heat-0)\", \"var(--fb-heat-2)\", \"var(--fb-heat-3)\"];\n\n// Stable default: a fresh array each render would re-trigger the colour resolver forever\nconst DEFAULT_COLORS: [string, string, string] = [\n  \"var(--background, Canvas)\",\n  \"var(--primary, CanvasText)\",\n  \"var(--accent, GrayText)\",\n];\n\nexport function NoiseField({\n  colors: colorsProp = DEFAULT_COLORS,\n  palette,\n  speed = 1.0,\n  scale = 1.8,\n  intensity = 1.0,\n  scrim = true,\n  paused = false,\n  time,\n  maxTier = 3,\n  reducedMotion: propReduced,\n  ref,\n  className = \"\",\n  style,\n  children,\n  ...props\n}: NoiseFieldProps) {\n  const colors = palette ? HEAT_COLORS : colorsProp;\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const uid = useId();\n  const hydrated = useHydrated(); // @frictionborn-guard\n  const cap = useCapability(); // @frictionborn-guard\n  const systemReduced = useReducedMotion(); // @frictionborn-guard\n  const reduced = propReduced !== undefined ? propReduced : systemReduced; // @frictionborn-guard\n  const inView = useInView(containerRef); // @frictionborn-guard\n\n  const [hasLease, setHasLease] = useState(false);\n  const leaseRef = useRef<Lease | null>(null);\n  const instanceId = useRef(\"noise-field-\" + uid);\n  const [contextLost, setContextLost] = useState(false);\n  const [glKey, setGlKey] = useState(0);\n  const [downgrades, setDowngrades] = useState(0);\n  const computedTier = Math.min(cap.tier, maxTier);\n  const effectiveTier = hydrated ? Math.max(0, computedTier - downgrades) : 0;\n\n  // Resolved RGB arrays for WebGL uniforms\n  const [rgbColors, setRgbColors] = useState<[[number, number, number], [number, number, number], [number, number, number]]>([\n    [0.05, 0.06, 0.08],\n    [0.98, 0.57, 0.24],\n    [0.23, 0.51, 0.96],\n  ]);\n\n  const c0 = colors[0];\n  const c1 = colors[1];\n  const c2 = colors[2];\n  const updateResolvedColors = useCallback(() => {\n    const el = containerRef.current;\n    const r0 = resolveCssColor(el, c0) ?? [0.05, 0.06, 0.08];\n    const r1 = resolveCssColor(el, c1) ?? [0.98, 0.57, 0.24];\n    const r2 = resolveCssColor(el, c2) ?? [0.23, 0.51, 0.96];\n    setRgbColors([r0, r1, r2]);\n  }, [c0, c1, c2]);\n\n  // Resolve colors on mount, prop change, and HTML theme attribute mutations\n  useEffect(() => {\n    updateResolvedColors();\n\n    if (typeof MutationObserver === \"undefined\") return;\n    const observer = new MutationObserver(() => {\n      updateResolvedColors();\n    });\n    observer.observe(document.documentElement, {\n      attributes: true,\n      attributeFilter: [\"class\", \"data-theme\", \"data-mode\", \"style\"],\n    });\n    return () => observer.disconnect();\n  }, [updateResolvedColors]);\n\n  // Context lease acquisition (PRD 6.0 + 6.1 + Decision 19: reduced motion = no WebGL)\n  useEffect(() => {\n    // Decision 19: Reduced motion gets static poster only (no WebGL context)\n    const shouldAcquire = hydrated && inView && effectiveTier >= 2 && !reduced;\n\n    if (!shouldAcquire) {\n      if (leaseRef.current) {\n        leaseRef.current.release(); // @frictionborn-guard\n        leaseRef.current = null;\n        setHasLease(false);\n      }\n      return;\n    }\n\n    const tryAcquire = () => {\n      if (leaseRef.current) return;\n      const newLease = glBudget.acquire({\n        id: instanceId.current,\n        priority: 1,\n        onEvict: () => {\n          leaseRef.current = null;\n          setHasLease(false);\n        },\n      }); // @frictionborn-guard\n      if (newLease) {\n        leaseRef.current = newLease;\n        setHasLease(true);\n        setContextLost(false);\n        setGlKey((k) => k + 1);\n      }\n    };\n\n    tryAcquire();\n    return glBudget.subscribe(() => {\n      if (!leaseRef.current) tryAcquire();\n    });\n  }, [hydrated, inView, effectiveTier, contextLost, reduced]);\n\n  useEffect(() => {\n    return () => {\n      if (leaseRef.current) {\n        leaseRef.current.release(); // @frictionborn-guard\n        leaseRef.current = null;\n      }\n    };\n  }, []);\n\n  const handleDowngrade = useCallback(() => {\n    setDowngrades((prev) => prev + 1); // @frictionborn-guard\n  }, []);\n\n  const handleContextLost = useCallback(() => {\n    setContextLost(true); // @frictionborn-guard\n  }, []);\n\n  const handleContextRestored = useCallback(() => {\n    setContextLost(false); // @frictionborn-guard\n    setGlKey((k) => k + 1);\n  }, []);\n\n  // Poster matching the shader's palette & visual flow (CLS 0)\n  const posterStyle: React.CSSProperties = {\n    position: \"absolute\",\n    inset: 0,\n    width: \"100%\",\n    height: \"100%\",\n    background: `radial-gradient(circle at 35% 25%, color-mix(in srgb, ${colors[1]} 35%, transparent) 0%, transparent 65%), radial-gradient(circle at 75% 70%, color-mix(in srgb, ${colors[2]} 30%, transparent) 0%, transparent 60%), radial-gradient(circle at 50% 50%, color-mix(in srgb, ${colors[1]} 15%, ${colors[2]} 15%) 0%, transparent 75%), ${colors[0]}`,\n    zIndex: 1,\n  };\n\n  // Theme-aware scrim using host background token to guarantee >= 4.5:1 text contrast\n  const scrimStyle: React.CSSProperties = {\n    position: \"absolute\",\n    inset: 0,\n    zIndex: 3,\n    pointerEvents: \"none\",\n    background: `radial-gradient(circle at center, color-mix(in srgb, ${colors[0]} 25%, transparent) 0%, color-mix(in srgb, ${colors[0]} 80%, transparent) 100%)`,\n  };\n\n  useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n  const canRenderWebGL = hasLease && !reduced && effectiveTier >= 2;\n\n  return (\n    <div\n      ref={containerRef}\n      data-frictionborn-item=\"noise-field\"\n      data-tier={effectiveTier}\n      data-in-view={inView}\n      data-reduced-motion={reduced}\n      className={`relative w-full h-full min-h-[300px] overflow-hidden ${className}`}\n      style={{ ...(palette ? paletteVars(palette) : null), backgroundColor: colors[0], ...style }}\n      {...props}\n    >\n      {/* 1. Server-rendered CSS gradient poster always present as fallback (CLS 0) */}\n      <div data-frictionborn-poster=\"true\" style={posterStyle} aria-hidden=\"true\" />\n\n      {/* 2. WebGL canvas rendered client-side only when lease granted and not reduced-motion */}\n      {canRenderWebGL && (\n        <Suspense fallback={null}>\n          <NoiseFieldGL\n            key={glKey}\n            suspended={contextLost}\n            colors={rgbColors}\n            speed={speed}\n            scale={scale}\n            intensity={intensity}\n            paused={paused}\n            time={time}\n            tier={effectiveTier}\n            onContextLost={handleContextLost}\n            onContextRestored={handleContextRestored}\n            onDowngrade={handleDowngrade}\n          />\n        </Suspense>\n      )}\n\n      {/* 3. Theme-aware scrim layer preserving WCAG AA contrast >= 4.5:1 for overlaid text */}\n      {scrim && <div style={scrimStyle} aria-hidden=\"true\" />}\n\n      {/* 4. Children slot */}\n      {children && (\n        <div style={{ position: \"relative\", zIndex: 4, width: \"100%\", height: \"100%\" }}>\n          {children}\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default NoiseField;\n",
          "type": "registry:ui",
          "target": "components/ui/noise-field.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "noise-field",
          "version": "0.1.0",
          "summary": "background: WebGL2 domain-warped noise hero background (webgl2, client-only, reduced motion -> static poster, mobile -> tier 2 / tier 1 poster)",
          "slot": "background",
          "kind": "webgl"
        },
        "intent": {
          "useWhen": [
            "Hero sections requiring a calm, generative ambient backdrop",
            "Modern dark-theme landing pages needing tactile organic motion",
            "Brand surfaces looking for rich visual texture without video overhead"
          ],
          "avoidWhen": [
            "Dense reading passages or documentation tables where text contrast over the canvas has not been verified",
            "Battery-saver mode or low-tier mobile devices where static poster is preferred",
            "Pages already running a background canvas effect (one signature moment per viewport)"
          ],
          "alternatives": [
            {
              "name": "mesh-gradient",
              "when": "When soft blurred liquid color transitions are preferred over domain-warped noise"
            },
            {
              "name": "particle-field",
              "when": "When discrete starry or kinetic depth points are needed instead of a continuous field"
            }
          ]
        },
        "runtime": {
          "serverOutput": "poster",
          "clientOnly": true,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "^4"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "while-visible",
          "webglContexts": 1,
          "tiers": {
            "0": "CSS gradient poster only, no WebGL (server render, prefers-reduced-motion, Save-Data, no WebGL2, or frame-guard downgrade)",
            "1": "CSS gradient poster only (coarse pointer with low-end hints: deviceMemory <= 2 or <= 4 cores)",
            "2": "WebGL2 at DPR <= 1.5, 0.75 render scale, 2 octaves (coarse pointer without low-end hints, or fine pointer with low-end hints or viewport < 480px)",
            "3": "WebGL2 at DPR <= 2.0, full render scale, 4 octaves (fine pointer with hover, no low-end hints)"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Renders the static CSS gradient poster with no WebGL context and no animation frames. Under prefers-reduced-motion the runtime tier is 0, so WebGL does not start."
          },
          "input": {
            "pointer": "None; ambient animation. Optional `time` prop fixes the clock and `paused` freezes the loop.",
            "touch": "No touch listeners. Coarse pointers with low-end hints get the tier 1 poster; other coarse-pointer devices run WebGL at tier 2.",
            "keyboard": "None; the component has no interactive elements. Poster, scrim and canvas layers are aria-hidden; children keep their own semantics."
          }
        },
        "a11y": {
          "role": "decorative",
          "hiddenFromAT": true,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "2.2.2",
            "2.3.1"
          ],
          "notes": "The poster, scrim and canvas layers are aria-hidden; the root element and children are not. There is no built-in pause button: pause with the paused prop or the runtime pauseAll()/resumeAll(). The scrim lowers background luminance behind children but contrast is not computed; verify text contrast for your colours."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": false,
          "conflictsWith": [
            "mesh-gradient",
            "particle-field"
          ],
          "pairsWith": [
            "text-reveal",
            "magnetic-button"
          ]
        },
        "props": [
          {
            "name": "colors",
            "type": "[string, string, string]",
            "default": [
              "var(--background, Canvas)",
              "var(--primary, CanvasText)",
              "var(--accent, GrayText)"
            ],
            "effect": "Three CSS colours: background, primary, accent. Resolved to RGB for the shader and used to build the CSS poster."
          },
          {
            "name": "speed",
            "type": "number",
            "default": 1,
            "effect": "Multiplier on animation time."
          },
          {
            "name": "scale",
            "type": "number",
            "default": 1.8,
            "effect": "Domain frequency scale for the procedural noise octaves."
          },
          {
            "name": "intensity",
            "type": "number",
            "default": 1,
            "effect": "Colour vibrancy and octave blending contrast."
          },
          {
            "name": "scrim",
            "type": "boolean",
            "default": true,
            "effect": "Renders a radial scrim of the first colour (25% centre to 80% edge opacity) over the canvas to lower background luminance behind children. Does not guarantee text contrast; verify for your colours."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Freezes this instance's animation loop. The global pauseAll() also stops it."
          },
          {
            "name": "time",
            "type": "number",
            "default": null,
            "effect": "Optional. No default. Overrides the internal clock with a fixed time value (deterministic screenshots and tests)."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier (0 to 3); the tier is the minimum of this and the runtime tier."
          },
          {
            "name": "reducedMotion",
            "type": "boolean",
            "default": null,
            "effect": "Optional. No default (follows prefers-reduced-motion). true forces the static poster. false only skips the prop-level check: under prefers-reduced-motion the runtime tier is still 0, so WebGL still does not start. Leave unset."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root div, appended after the built-in Tailwind utility classes."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the root div, merged after the built-in background colour (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div> that holds the poster and the canvas."
          },
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Optional. No default. Content layered above the poster, canvas and scrim."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": null,
            "effect": "Colours from a palette (DESIGN.md A8): fire, ice, neon, mono, or custom (reads --fb-heat-0..4). Overrides colors; leave it out to keep the host's tokens."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/noise-field",
          "usage": "import { NoiseField } from \"@/components/ui/noise-field\";\n\nexport default function Hero() {\n  return (\n    <NoiseField className=\"min-h-[600px] flex items-center justify-center\">\n      <h1 className=\"text-5xl font-bold tracking-tight text-foreground\">Engineered Motion</h1>\n    </NoiseField>\n  );\n}",
          "mistakes": [
            "Keep the scrim on when placing text over the canvas, but do not assume it guarantees WCAG 4.5:1 contrast: it only lowers background luminance. Verify contrast for your colours and use host foreground tokens for text.",
            "Do not set reducedMotion={false} to try to force WebGL; it does not override the user's preference (the runtime tier stays 0 under prefers-reduced-motion).",
            "Do not combine multiple NoiseField components in the same viewport; follow the one signature moment principle.",
            "The root element uses Tailwind utility classes (relative, w-full, h-full, min-h-[300px], overflow-hidden); install it in a Tailwind project.",
            "Never call requestAnimationFrame directly to animate NoiseField props; let the runtime handle the loop."
          ],
          "verify": [
            "Confirm the static CSS gradient poster renders in server HTML before hydration (CLS <= 0.01).",
            "Confirm that when prefers-reduced-motion is active, the static poster renders with zero WebGL contexts allocated and zero rAF cycles.",
            "Confirm context lease is properly released when scrolled out of view."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [
            {
              "what": "2D simplex noise (GLSL)",
              "name": "webgl-noise",
              "author": "Ian McEwan (Ashima Arts), Stefan Gustavson",
              "license": "MIT",
              "url": "https://github.com/stegu/webgl-noise"
            }
          ],
          "notices": [
            "Includes 2D Simplex Noise from stegu/webgl-noise (MIT Copyright 2011 Ashima Arts, Stefan Gustavson)."
          ],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "d93e6c45648bc7728507280a20973817c7a0ced471eaaf8bbddf09a123d6c54f",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.76,
            "deferred": 3.45,
            "method": "gzip-9"
          },
          "cls": 0.0017,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "23 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "22 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "particle-field",
      "type": "registry:ui",
      "title": "ParticleField",
      "description": "background: WebGL2 vertex-shader particle drift with pointer repel (webgl2, client-only, reduced motion -> poster, mobile -> tier 2 / tier 1 poster)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/particle-field/particle-field.gl.tsx",
          "content": "// Original — Frictionborn Motion ParticleField WebGL2 engine\n\"use client\";\n\nimport { useRef, useEffect } from \"react\";\nimport { useFrame, useFrameGuard } from \"@frictionborn/runtime\";\n\nexport interface ParticleFieldGLProps {\n  color: [number, number, number];\n  backgroundColor?: [number, number, number];\n  speed?: number;\n  count?: number;\n  interactive?: boolean;\n  tier: number;\n  paused?: boolean;\n  reducedMotion?: boolean;\n  suspended?: boolean;\n  onDowngrade?: (targetTier?: number) => void;\n  onContextLost?: () => void;\n  onContextRestored?: () => void;\n}\n\nconst VS_SOURCE = `#version 300 es\nlayout(location = 0) in float a_index;\n\nuniform float u_time;\nuniform vec2 u_resolution;\nuniform vec2 u_pointer;\nuniform float u_speed;\nuniform float u_dpr;\n\nout float v_alpha;\n\n// Hash generator for stable pseudo-random particle initial conditions\nfloat hash11(float p) {\n  p = fract(p * 0.1031);\n  p *= p + 33.33;\n  p *= p + p;\n  return fract(p);\n}\n\nvoid main() {\n  float seedX = hash11(a_index * 1.61803);\n  float seedY = hash11(a_index * 2.71828);\n  float phase = hash11(a_index * 3.14159) * 6.28318;\n\n  // Gentle deterministic kinematic drift\n  float t = u_time * 0.15 * u_speed;\n  vec2 pos = vec2(\n    fract(seedX + sin(phase + t) * 0.08 + t * 0.04),\n    fract(seedY + cos(phase + t * 0.8) * 0.08 + t * 0.02)\n  );\n\n  vec2 screenPos = pos * u_resolution;\n\n  // Pointer repel (if active and within interaction radius)\n  if (u_pointer.x > -9000.0) {\n    vec2 diff = screenPos - u_pointer;\n    float dist = length(diff);\n    float radius = 140.0;\n    if (dist < radius && dist > 0.001) {\n      float repel = (1.0 - dist / radius);\n      screenPos += normalize(diff) * (repel * repel * 40.0);\n    }\n  }\n\n  // Clip coordinates [-1, 1]\n  vec2 clipPos = (screenPos / u_resolution) * 2.0 - 1.0;\n  gl_Position = vec4(clipPos.x, -clipPos.y, 0.0, 1.0);\n\n  // Twinkle frequency strictly < 3 Hz (WCAG 2.3.1 compliance)\n  float twinkle = 0.5 + 0.5 * sin(phase + u_time * 1.8);\n  v_alpha = 0.25 + 0.65 * twinkle;\n\n  // Size scaling with DPR clamp\n  float baseSize = 2.0 + hash11(a_index * 4.123) * 2.5;\n  gl_PointSize = baseSize * u_dpr;\n}\n`;\n\nconst FS_SOURCE = `#version 300 es\nprecision highp float;\n\nin float v_alpha;\nuniform vec3 u_color;\nout vec4 fragColor;\n\nvoid main() {\n  vec2 coord = gl_PointCoord - vec2(0.5);\n  float dist = length(coord);\n  if (dist > 0.5) {\n    discard;\n  }\n  float circleAlpha = smoothstep(0.5, 0.1, dist) * v_alpha;\n  fragColor = vec4(u_color, circleAlpha);\n}\n`;\n\nfunction createShader(gl: WebGL2RenderingContext, type: number, source: string): WebGLShader | null {\n  if (gl.isContextLost()) return null;\n  const shader = gl.createShader(type);\n  if (!shader) return null;\n  gl.shaderSource(shader, source);\n  gl.compileShader(shader);\n  if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n    if (!gl.isContextLost()) {\n      console.error(\"ParticleField shader compilation error:\", gl.getShaderInfoLog(shader));\n    }\n    gl.deleteShader(shader);\n    return null;\n  }\n  return shader;\n}\n\nexport function ParticleFieldGL({\n  color,\n  speed = 1.0,\n  count = 2000,\n  interactive = true,\n  tier,\n  paused = false,\n  reducedMotion = false,\n  suspended = false,\n  onDowngrade,\n  onContextLost,\n  onContextRestored,\n}: ParticleFieldGLProps) {\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const canvasRef = useRef<HTMLCanvasElement | null>(null);\n  const glRef = useRef<WebGL2RenderingContext | null>(null);\n  const programRef = useRef<WebGLProgram | null>(null);\n  const vaoRef = useRef<WebGLVertexArrayObject | null>(null);\n  const pointerPosRef = useRef<{ x: number; y: number }>({ x: -9999, y: -9999 });\n\n  const uniformsRef = useRef<{\n    time: WebGLUniformLocation | null;\n    resolution: WebGLUniformLocation | null;\n    pointer: WebGLUniformLocation | null;\n    speed: WebGLUniformLocation | null;\n    dpr: WebGLUniformLocation | null;\n    color: WebGLUniformLocation | null;\n  }>({\n    time: null,\n    resolution: null,\n    pointer: null,\n    speed: null,\n    dpr: null,\n    color: null,\n  });\n\n  useFrameGuard({\n    onDowngrade: onDowngrade ?? (() => {}),\n    active: !paused && !reducedMotion && !suspended,\n  }); // @frictionborn-guard\n\n  // Calculate actual particle count clamped by tier\n  // Tier 3: up to count (default ~2000, max 4000)\n  // Tier 2: ~35% count\n  // The index buffer holds 4000 particles, so clamp after the tier scale\n  const effectiveCount = Math.min(4000, Math.round(tier >= 3 ? count : count * 0.35));\n\n  useEffect(() => {\n    const container = containerRef.current;\n    if (!container) return;\n\n    const canvas = document.createElement(\"canvas\");\n    canvas.setAttribute(\"aria-hidden\", \"true\");\n    canvas.className = \"fb-particle-canvas\";\n    canvas.style.cssText =\n      \"position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none;z-index:2;\";\n    container.appendChild(canvas);\n    canvasRef.current = canvas;\n\n    const gl = canvas.getContext(\"webgl2\", {\n      alpha: true,\n      antialias: false,\n      depth: false,\n      stencil: false,\n      powerPreference: \"low-power\",\n    });\n\n    if (!gl) {\n      onDowngrade?.(0);\n      return;\n    }\n\n    glRef.current = gl;\n\n    const initResources = () => {\n      if (!gl || gl.isContextLost()) return;\n\n      const vs = createShader(gl, gl.VERTEX_SHADER, VS_SOURCE);\n      const fs = createShader(gl, gl.FRAGMENT_SHADER, FS_SOURCE);\n      if (!vs || !fs) return;\n\n      const prog = gl.createProgram();\n      if (!prog) return;\n      gl.attachShader(prog, vs);\n      gl.attachShader(prog, fs);\n      gl.linkProgram(prog);\n\n      if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) {\n        if (!gl.isContextLost()) {\n          console.error(\"ParticleField program link error:\", gl.getProgramInfoLog(prog));\n        }\n        return;\n      }\n\n      programRef.current = prog;\n      gl.useProgram(prog);\n\n      uniformsRef.current = {\n        time: gl.getUniformLocation(prog, \"u_time\"),\n        resolution: gl.getUniformLocation(prog, \"u_resolution\"),\n        pointer: gl.getUniformLocation(prog, \"u_pointer\"),\n        speed: gl.getUniformLocation(prog, \"u_speed\"),\n        dpr: gl.getUniformLocation(prog, \"u_dpr\"),\n        color: gl.getUniformLocation(prog, \"u_color\"),\n      };\n\n      // Build particle index buffer\n      const indices = new Float32Array(4000);\n      for (let i = 0; i < 4000; i++) {\n        indices[i] = i;\n      }\n\n      const vao = gl.createVertexArray();\n      gl.bindVertexArray(vao);\n      vaoRef.current = vao;\n\n      const buffer = gl.createBuffer();\n      gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n      gl.bufferData(gl.ARRAY_BUFFER, indices, gl.STATIC_DRAW);\n      gl.enableVertexAttribArray(0);\n      gl.vertexAttribPointer(0, 1, gl.FLOAT, false, 0, 0);\n\n      // Blending: additive translucent particles\n      gl.enable(gl.BLEND);\n      gl.blendFunc(gl.SRC_ALPHA, gl.ONE);\n    };\n\n    initResources();\n\n    // Context loss handlers\n    const handleLost = (e: Event) => {\n      e.preventDefault();\n      canvas.style.display = \"none\";\n      onContextLost?.();\n    };\n\n    const handleRestored = () => {\n      canvas.style.display = \"block\";\n      initResources();\n      onContextRestored?.();\n    };\n\n    canvas.addEventListener(\"webglcontextlost\", handleLost, false);\n    canvas.addEventListener(\"webglcontextrestored\", handleRestored, false);\n\n    return () => {\n      canvas.removeEventListener(\"webglcontextlost\", handleLost);\n      canvas.removeEventListener(\"webglcontextrestored\", handleRestored);\n      if (gl) {\n        if (vaoRef.current) gl.deleteVertexArray(vaoRef.current);\n        if (programRef.current) gl.deleteProgram(programRef.current);\n        const loseExt = gl.getExtension(\"WEBGL_lose_context\");\n        loseExt?.loseContext();\n      }\n      canvas.remove();\n      canvasRef.current = null;\n      glRef.current = null;\n    };\n  }, [onDowngrade, onContextLost, onContextRestored]);\n\n  // Pointer tracking for interactive repel (fine pointer only)\n  useEffect(() => {\n    const canvas = canvasRef.current;\n    if (!canvas || !interactive) return;\n\n    const handlePointerMove = (e: PointerEvent) => {\n      if (e.pointerType !== \"mouse\" && e.pointerType !== \"pen\") return;\n      const rect = canvas.getBoundingClientRect();\n      pointerPosRef.current = {\n        x: e.clientX - rect.left,\n        y: e.clientY - rect.top,\n      };\n    };\n\n    const handlePointerLeave = () => {\n      pointerPosRef.current = { x: -9999, y: -9999 };\n    };\n\n    window.addEventListener(\"pointermove\", handlePointerMove, { passive: true });\n    canvas.addEventListener(\"pointerleave\", handlePointerLeave, { passive: true });\n\n    return () => {\n      window.removeEventListener(\"pointermove\", handlePointerMove);\n      canvas.removeEventListener(\"pointerleave\", handlePointerLeave);\n    };\n  }, [interactive]);\n\n  // Render loop driven by runtime useFrame\n  useFrame(\n    ({ time }) => {\n      const gl = glRef.current;\n      const canvas = canvasRef.current;\n      const prog = programRef.current;\n      const u = uniformsRef.current;\n      if (!gl || !canvas || !prog) return;\n\n      const dpr = Math.min(window.devicePixelRatio || 1, tier >= 3 ? 2.0 : 1.5);\n      const displayWidth = Math.floor(canvas.clientWidth * dpr);\n      const displayHeight = Math.floor(canvas.clientHeight * dpr);\n\n      if (canvas.width !== displayWidth || canvas.height !== displayHeight) {\n        canvas.width = displayWidth;\n        canvas.height = displayHeight;\n        gl.viewport(0, 0, displayWidth, displayHeight);\n      }\n\n      gl.clearColor(0, 0, 0, 0);\n      gl.clear(gl.COLOR_BUFFER_BIT);\n\n      gl.useProgram(prog);\n      gl.bindVertexArray(vaoRef.current);\n\n      const renderTime = reducedMotion ? 0.0 : time / 1000.0;\n      gl.uniform1f(u.time, renderTime);\n      gl.uniform2f(u.resolution, canvas.clientWidth, canvas.clientHeight);\n      gl.uniform2f(u.pointer, pointerPosRef.current.x, pointerPosRef.current.y);\n      gl.uniform1f(u.speed, speed);\n      gl.uniform1f(u.dpr, dpr);\n      gl.uniform3f(u.color, color[0], color[1], color[2]);\n\n      gl.drawArrays(gl.POINTS, 0, effectiveCount);\n    },\n    { active: !paused && !reducedMotion && !suspended }\n  );\n\n  return (\n    <div\n      ref={containerRef}\n      style={{\n        display: suspended ? \"none\" : \"block\",\n        position: \"absolute\",\n        inset: 0,\n        width: \"100%\",\n        height: \"100%\",\n        pointerEvents: \"none\",\n      }}\n    />\n  );\n}\n\nexport default ParticleFieldGL;\n",
          "type": "registry:ui",
          "target": "components/ui/particle-field.gl.tsx"
        },
        {
          "path": "registry/items/particle-field/particle-field.tsx",
          "content": "// Original — Frictionborn Motion ParticleField wrapper\n\"use client\";\n\nimport React, { useState, useEffect, useRef, useCallback, useId, Suspense, lazy, useImperativeHandle } from \"react\";\nimport {\n  useCapability,\n  useHydrated,\n  useReducedMotion,\n  useInView,\n  resolveCssColor,\n  glBudget,\n  type Lease,\n  paletteVars,\n  type PaletteName,\n} from \"@frictionborn/runtime\";\n\nconst ParticleFieldGL = lazy(() => import(\"./particle-field.gl\"));\n\nexport interface ParticleFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n  color?: string;\n  /** Colours from a palette (DESIGN.md A8): `fire` | `ice` | `neon` | `mono` | `custom` (reads `--fb-heat-0..4`). Overrides `color` (the particles take the bright colour); leave it out to keep the host's tokens. */\n  palette?: PaletteName;\n  speed?: number;\n  count?: number;\n  interactive?: boolean;\n  scrim?: boolean;\n  paused?: boolean;\n  maxTier?: number;\n  reducedMotion?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n  children?: React.ReactNode;\n}\n\nconst DEFAULT_COLOR = \"var(--primary, CanvasText)\";\n/** round 4: the palette's bright colour (DESIGN.md A8); a preset sets it on the root, `custom` reads the page's */\nconst HEAT_COLOR = \"var(--fb-heat-3)\";\nconst NEUTRAL_RGB: [number, number, number] = [0.5, 0.5, 0.5];\n\nexport function ParticleField({\n  color: colorProp = DEFAULT_COLOR,\n  palette,\n  speed = 1.0,\n  count = 2000,\n  interactive = true,\n  scrim = false,\n  paused = false,\n  maxTier = 3,\n  reducedMotion: propReduced,\n  ref,\n  className = \"\",\n  style,\n  children,\n  ...props\n}: ParticleFieldProps) {\n  const color = palette ? HEAT_COLOR : colorProp;\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const uid = useId();\n  const isHydrated = useHydrated(); // @frictionborn-guard\n  const capability = useCapability(); // @frictionborn-guard\n  const isReduced = useReducedMotion(); // @frictionborn-guard\n  const motionDisabled = propReduced !== undefined ? propReduced : isReduced; // @frictionborn-guard\n  const isVisible = useInView(containerRef); // @frictionborn-guard\n\n  const [hasLease, setHasLease] = useState(false);\n  const leaseRef = useRef<Lease | null>(null);\n  const instanceId = useRef(\"particle-field-\" + uid);\n  const [contextLost, setContextLost] = useState(false);\n  const [downgrades, setDowngrades] = useState(0);\n  const resolvedTargetTier = Math.min(capability.tier, maxTier);\n  const activeTier = isHydrated ? Math.max(0, resolvedTargetTier - downgrades) : 0;\n\n  const [resolvedRgb, setResolvedRgb] = useState<[number, number, number]>(NEUTRAL_RGB);\n\n  const updateColor = useCallback(() => {\n    const next = resolveCssColor(containerRef.current, color) ?? NEUTRAL_RGB;\n    // Keep the previous array when nothing changed so unrelated <html> mutations do not re-render\n    setResolvedRgb((prev) =>\n      prev[0] === next[0] && prev[1] === next[1] && prev[2] === next[2] ? prev : next\n    );\n  }, [color]);\n\n  useEffect(() => {\n    updateColor();\n    if (typeof MutationObserver === \"undefined\") return;\n    const observer = new MutationObserver(updateColor);\n    observer.observe(document.documentElement, {\n      attributes: true,\n      attributeFilter: [\"class\", \"data-theme\", \"data-mode\", \"style\"],\n    });\n    return () => observer.disconnect();\n  }, [updateColor]);\n\n  // Context lease management (Decision 19: reduced motion = no WebGL)\n  const canRunWebGL = isHydrated && isVisible && activeTier >= 2 && !motionDisabled;\n\n  useEffect(() => {\n    if (!canRunWebGL) {\n      if (leaseRef.current) {\n        leaseRef.current.release(); // @frictionborn-guard\n        leaseRef.current = null;\n        setHasLease(false);\n      }\n      return;\n    }\n\n    const tryAcquire = () => {\n      if (leaseRef.current) return;\n      const lease = glBudget.acquire({\n        id: instanceId.current,\n        priority: 1,\n        onEvict: () => {\n          leaseRef.current = null;\n          setHasLease(false);\n        },\n      }); // @frictionborn-guard\n      if (lease) {\n        leaseRef.current = lease;\n        setHasLease(true);\n        // A new lease means a new GL instance: a loss that was never restored must not leave it suspended (same fix as NoiseField, 5c74d38)\n        setContextLost(false);\n      }\n    };\n\n    tryAcquire();\n\n    const unsubscribe = typeof glBudget.subscribe === \"function\"\n      ? glBudget.subscribe(() => {\n          if (!leaseRef.current) {\n            tryAcquire();\n          }\n        })\n      : () => {};\n\n    return () => {\n      unsubscribe();\n    };\n  }, [canRunWebGL, contextLost]);\n\n  useEffect(() => {\n    return () => {\n      if (leaseRef.current) {\n        leaseRef.current.release(); // @frictionborn-guard\n        leaseRef.current = null;\n      }\n    };\n  }, []);\n\n  const onTierStepDown = useCallback((targetTier?: number) => {\n    setDowngrades((prev) => (targetTier !== undefined ? Math.max(0, resolvedTargetTier - targetTier) : prev + 1)); // @frictionborn-guard\n  }, [resolvedTargetTier]);\n\n  const onContextDrop = useCallback(() => {\n    setContextLost(true); // @frictionborn-guard\n  }, []);\n\n  const onContextRecover = useCallback(() => {\n    setContextLost(false); // @frictionborn-guard\n  }, []);\n\n  const shouldBeInteractive = interactive && capability.pointer === \"fine\";\n\n  // Pure CSS from the same colour prop, so the server poster already matches the host theme\n  const dotColor = `color-mix(in srgb, ${color} 18%, transparent)`;\n  const posterBackground = `radial-gradient(circle at 50% 50%, ${dotColor} 1.2px, transparent 1.2px)`;\n\n  const shouldRenderGL = hasLease && !motionDisabled && activeTier >= 2;\n\n  useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n  return (\n    <div\n      ref={containerRef}\n      data-frictionborn-item=\"particle-field\"\n      data-tier={activeTier}\n      className={`fb-particle-field ${className}`}\n      style={{\n        ...(palette ? paletteVars(palette) : null),\n        position: \"relative\",\n        width: \"100%\",\n        height: \"100%\",\n        minHeight: \"240px\",\n        overflow: \"hidden\",\n        backgroundColor: \"var(--background, Canvas)\",\n        ...style,\n      }}\n      {...props}\n    >\n      <div\n        data-frictionborn-poster=\"true\"\n        aria-hidden=\"true\"\n        style={{\n          position: \"absolute\",\n          inset: 0,\n          backgroundImage: posterBackground,\n          backgroundSize: \"28px 28px\",\n          pointerEvents: \"none\",\n        }}\n      />\n      {shouldRenderGL && (\n        <Suspense fallback={null}>\n          <ParticleFieldGL\n            suspended={contextLost}\n            color={resolvedRgb}\n            speed={speed}\n            count={count}\n            interactive={shouldBeInteractive}\n            tier={activeTier}\n            paused={paused}\n            reducedMotion={motionDisabled}\n            onDowngrade={onTierStepDown}\n            onContextLost={onContextDrop}\n            onContextRestored={onContextRecover}\n          />\n        </Suspense>\n      )}\n\n      {scrim && (\n        <div\n          aria-hidden=\"true\"\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            background:\n              \"linear-gradient(to bottom, color-mix(in srgb, var(--background, Canvas) 40%, transparent) 0%, color-mix(in srgb, var(--background, Canvas) 75%, transparent) 100%)\",\n            pointerEvents: \"none\",\n            zIndex: 1,\n          }}\n        />\n      )}\n\n      {children && (\n        <div\n          style={{\n            position: \"relative\",\n            zIndex: 2,\n            width: \"100%\",\n            height: \"100%\",\n          }}\n        >\n          {children}\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default ParticleField;\n",
          "type": "registry:ui",
          "target": "components/ui/particle-field.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "particle-field",
          "version": "0.1.0",
          "summary": "background: WebGL2 vertex-shader particle drift with pointer repel (webgl2, client-only, reduced motion -> poster, mobile -> tier 2 / tier 1 poster)",
          "slot": "background",
          "kind": "webgl"
        },
        "intent": {
          "useWhen": [
            "Hero sections requiring discrete starry or kinetic depth points",
            "Telemetry or scientific landing pages needing particle drift and fine pointer interaction",
            "Surfaces seeking subtle stellar motion with constant GPU cost"
          ],
          "avoidWhen": [
            "Dense text sections where text contrast over the particles has not been verified",
            "Pages already running a continuous full-screen shader",
            "Low-power mobile devices where the static dot pattern is preferred"
          ],
          "alternatives": [
            {
              "name": "noise-field",
              "when": "When continuous organic liquid waves are preferred over discrete points"
            },
            {
              "name": "mesh-gradient",
              "when": "When soft blurred color transitions are preferred"
            }
          ]
        },
        "runtime": {
          "serverOutput": "poster",
          "clientOnly": true,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "while-visible",
          "webglContexts": 1,
          "tiers": {
            "0": "CSS dot-pattern poster only, no WebGL (server render, prefers-reduced-motion, Save-Data, no WebGL2, or frame-guard downgrade)",
            "1": "CSS dot-pattern poster only (coarse pointer with low-end hints: deviceMemory <= 2 or <= 4 cores)",
            "2": "WebGL2 at DPR <= 1.5 with 35% of `count` particles (coarse pointer without low-end hints, or fine pointer with low-end hints or viewport < 480px)",
            "3": "WebGL2 at DPR <= 2.0 with `count` particles, up to 4,000 (fine pointer with hover, no low-end hints)"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Renders the static CSS dot-pattern poster with no WebGL context and no animation frames. Under prefers-reduced-motion the runtime tier is 0, so WebGL does not start."
          },
          "input": {
            "pointer": "Pointer repulsion within a 140px radius, only when interactive is true and the device reports pointer: fine (window pointermove listener, mouse and pen only)",
            "touch": "No pointer listeners are attached when the device does not report pointer: fine. Coarse pointers with low-end hints get the tier 1 poster; other coarse-pointer devices run the drift at tier 2.",
            "keyboard": "None; the component has no interactive elements. Poster, scrim and canvas layers are aria-hidden; children keep their own semantics."
          }
        },
        "a11y": {
          "role": "decorative",
          "hiddenFromAT": true,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "2.2.2",
            "2.3.1"
          ],
          "notes": "The poster, scrim and canvas layers are aria-hidden; the root element and children are not. Particle twinkle runs at about 0.3 Hz (sin(phase + time * 1.8) in the vertex shader), well below 3 flashes per second. There is no built-in pause button: pause with the paused prop or the runtime pauseAll()/resumeAll(). The optional scrim lowers background luminance but contrast is not computed; verify text contrast for your colours."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": false,
          "conflictsWith": [
            "noise-field",
            "mesh-gradient"
          ],
          "pairsWith": [
            "text-reveal",
            "magnetic-button",
            "scroll-reveal"
          ]
        },
        "props": [
          {
            "name": "color",
            "type": "string",
            "default": "var(--primary, CanvasText)",
            "effect": "Particle CSS colour, resolved from CSS variables or theme tokens and also used for the dot-pattern poster."
          },
          {
            "name": "speed",
            "type": "number",
            "default": 1,
            "effect": "Kinematic drift rate multiplier."
          },
          {
            "name": "count",
            "type": "number",
            "default": 2000,
            "effect": "Target particle count on Tier 3 (clamped to 4,000). Tier 2 renders 35% of it."
          },
          {
            "name": "interactive",
            "type": "boolean",
            "default": true,
            "effect": "Enables pointer repulsion; only active when the device reports pointer: fine."
          },
          {
            "name": "scrim",
            "type": "boolean",
            "default": false,
            "effect": "Renders a vertical gradient of the host --background token (40% to 75% opacity) over the canvas to lower background luminance behind children. Does not guarantee text contrast; verify for your colours."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Freezes this instance's particle loop. The global pauseAll() also stops it."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Upper bound on the capability tier (0 to 3); the tier is the minimum of this and the runtime tier."
          },
          {
            "name": "reducedMotion",
            "type": "boolean",
            "default": null,
            "effect": "Optional. No default (follows prefers-reduced-motion). true forces the static poster. false only skips the prop-level check: under prefers-reduced-motion the runtime tier is still 0, so WebGL still does not start. Leave unset."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root div (the built-in class fb-particle-field is kept)."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the root div, merged after the built-in layout and background (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div> that holds the poster and the canvas."
          },
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Optional. No default. Content layered above the poster, canvas and scrim."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": null,
            "effect": "Colours from a palette (DESIGN.md A8): fire, ice, neon, mono, or custom (reads --fb-heat-0..4). Overrides color; leave it out to keep the host's tokens."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/particle-field",
          "usage": "import { ParticleField } from \"@/components/ui/particle-field\";\n\nexport default function Hero() {\n  return (\n    <ParticleField count={2000} className=\"min-h-[600px] flex items-center justify-center\">\n      <h1 className=\"text-5xl font-bold tracking-tight text-foreground\">Sub-Angstrom Kinematics</h1>\n    </ParticleField>\n  );\n}",
          "mistakes": [
            "Do not attach your own window mouse listeners for repulsion; ParticleField already adds one window pointermove listener, only on devices that report pointer: fine.",
            "Do not combine multiple ParticleField instances in the same viewport.",
            "scrim defaults to false. It only lowers background luminance and does not guarantee 4.5:1 contrast: verify contrast for your colours and use host foreground tokens for text.",
            "Do not set reducedMotion={false} to try to force WebGL; it does not override the user's preference (the runtime tier stays 0 under prefers-reduced-motion).",
            "Never call requestAnimationFrame directly to animate particles."
          ],
          "verify": [
            "Confirm the static CSS dot-pattern poster renders in server HTML (CLS <= 0.01).",
            "Confirm that when prefers-reduced-motion is active, the static poster renders with zero WebGL contexts allocated and zero rAF cycles.",
            "Confirm context lease is released when scrolled out of view."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "c9e3c67fcb97e7bcb96b0dfcef154cbab72920a96bd1d7f5168f72850d23acf3",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.54,
            "deferred": 3.48,
            "method": "gzip-9"
          },
          "cls": 0.0002,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "19 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "17 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "17 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "17 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "scroll-reveal",
      "type": "registry:ui",
      "title": "ScrollReveal",
      "description": "media: Scroll-driven entrance (CSS view() timeline, IntersectionObserver fallback) (dom, server-safe, reduced motion -> static, low-end mobile -> 12px)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/scroll-reveal/scroll-reveal.tsx",
          "content": "// Original — Frictionborn Motion ScrollReveal\n\"use client\";\n\nimport React, { useRef, useState, useImperativeHandle } from \"react\";\nimport { useInView, useReducedMotion, useCapability, useHydrated } from \"@frictionborn/runtime\";\n\nexport interface ScrollRevealProps extends React.HTMLAttributes<HTMLElement> {\n  children: React.ReactNode;\n  as?: React.ElementType;\n  animation?: \"fade-up\" | \"fade\" | \"scale-up\";\n  distance?: number;\n  duration?: number;\n  className?: string;\n  style?: React.CSSProperties;\n  once?: boolean;\n  maxTier?: number;\n  /**\n   * When true, halts animation and locks the component in its final, fully revealed state\n   * (opacity: 1, transform: none) for clean static screenshots, debugging, or paused playback.\n   */\n  paused?: boolean;\n  nonce?: string;\n  ref?: React.Ref<HTMLElement | null>;\n}\n\nconst SCROLL_REVEAL_STYLES = `\n  @supports (animation-timeline: view()) {\n    [data-motion=\"ok\"] .fb-sr-track {\n      animation-timeline: view();\n      animation-range: entry 0% entry 100%;\n      animation-fill-mode: both;\n      will-change: transform, opacity;\n    }\n    [data-motion=\"ok\"] .fb-sr-track[data-anim=\"fade\"] {\n      animation-name: fb-sr-v-fade;\n    }\n    [data-motion=\"ok\"] .fb-sr-track[data-anim=\"fade-up\"] {\n      animation-name: fb-sr-v-fade-up;\n    }\n    [data-motion=\"ok\"] .fb-sr-track[data-anim=\"scale-up\"] {\n      animation-name: fb-sr-v-scale-up;\n    }\n  }\n\n  @keyframes fb-sr-v-fade {\n    from { opacity: 0; }\n    to { opacity: 1; }\n  }\n  @keyframes fb-sr-v-fade-up {\n    from {\n      opacity: 0;\n      transform: translateY(var(--fb-sr-dist, 24px));\n    }\n    to {\n      opacity: 1;\n      transform: translateY(0);\n    }\n  }\n  @keyframes fb-sr-v-scale-up {\n    from {\n      opacity: 0;\n      transform: scale(0.96) translateY(calc(var(--fb-sr-dist, 24px) / 2));\n    }\n    to {\n      opacity: 1;\n      transform: scale(1) translateY(0);\n    }\n  }\n\n  @supports not (animation-timeline: view()) {\n    [data-motion=\"ok\"] .fb-sr-track {\n      opacity: 0;\n      transform: var(--fb-sr-initial-transform, translateY(24px));\n      transition: opacity var(--fb-sr-duration, 400ms) cubic-bezier(0.22, 1, 0.36, 1),\n                  transform var(--fb-sr-duration, 400ms) cubic-bezier(0.22, 1, 0.36, 1);\n      will-change: opacity, transform;\n    }\n    [data-motion=\"ok\"] .fb-sr-track.is-visible {\n      opacity: 1;\n      transform: none;\n      will-change: auto;\n    }\n  }\n\n  /* Paused guard: locks into final revealed state */\n  [data-motion=\"ok\"] .fb-sr-track.is-paused {\n    opacity: 1 !important;\n    transform: none !important;\n    transition: none !important;\n    animation: none !important;\n  }\n\n  /* Focus guard: anything with focus is forced visible */\n  [data-motion=\"ok\"] .fb-sr-track:focus-within,\n  [data-motion=\"ok\"] .fb-sr-track:has(:focus) {\n    opacity: 1 !important;\n    transform: none !important;\n    transition: none !important;\n    animation: none !important;\n  }\n\n  @media (prefers-reduced-motion: reduce) {\n    [data-motion=\"ok\"] .fb-sr-track {\n      opacity: 1 !important;\n      transform: none !important;\n      transition: none !important;\n      animation: none !important;\n    }\n  }\n`;\n\nconst useIsomorphicLayoutEffect =\n  typeof window !== \"undefined\" ? React.useLayoutEffect : React.useEffect;\n\nexport function ScrollReveal({\n  children,\n  as: Component = \"div\",\n  animation = \"fade-up\",\n  distance = 24,\n  duration = 400,\n  className = \"\",\n  style,\n  once = true,\n  maxTier = 3,\n  paused = false,\n  nonce,\n  ref,\n  ...rest\n}: ScrollRevealProps) {\n  const elemRef = useRef<HTMLElement>(null);\n  const isClientHydrated = useHydrated();\n  const reducedMotionActive = useReducedMotion();\n  const capabilityInfo = useCapability();\n  const resolvedTier = Math.min(capabilityInfo.tier, maxTier);\n\n  // Fallback intersection observer for browsers without animation-timeline: view()\n  const inView = useInView(elemRef as React.RefObject<HTMLElement>, {\n    rootMargin: \"0px 0px -10% 0px\",\n    once,\n  });\n\n  const [hasEntered, setHasEntered] = useState(false);\n  if (inView && !hasEntered) {\n    setHasEntered(true);\n  }\n\n  // Above-the-fold content must never dip on hydrate in browsers without CSS scroll-driven animations\n  useIsomorphicLayoutEffect(() => {\n    const el = elemRef.current;\n    if (el) {\n      const rect = el.getBoundingClientRect();\n      if (rect.top < window.innerHeight && rect.bottom > 0) {\n        setHasEntered(true);\n      }\n    }\n  }, []);\n\n  const effectiveDistance = resolvedTier <= 1 ? Math.min(distance, 12) : distance;\n  const isRevealed =\n    reducedMotionActive ||\n    resolvedTier === 0 ||\n    paused ||\n    (once ? (hasEntered || inView) : inView);\n\n  // Transform styles based on animation variant\n  let initialTransform = `translateY(${effectiveDistance}px)`;\n  if (animation === \"fade\") {\n    initialTransform = \"none\";\n  } else if (animation === \"scale-up\") {\n    initialTransform = `scale(0.96) translateY(${effectiveDistance / 2}px)`;\n  }\n\n  useImperativeHandle(ref, () => elemRef.current as HTMLElement, []);\n\n  return (\n    <Component\n      ref={elemRef}\n      data-frictionborn-item=\"scroll-reveal\"\n      data-tier={resolvedTier}\n      className={`fb-scroll-reveal ${className}`}\n      style={{\n        display: \"block\",\n        position: \"relative\",\n        ...style,\n      }}\n      {...rest}\n    >\n      <style nonce={nonce}>\n        {SCROLL_REVEAL_STYLES}\n      </style>\n\n      <div\n        className={\n          isClientHydrated && !reducedMotionActive && resolvedTier > 0\n            ? `fb-sr-track ${isRevealed ? \"is-visible\" : \"\"} ${paused ? \"is-paused\" : \"\"}`\n            : \"\"\n        }\n        data-anim={animation}\n        style={\n          {\n            \"--fb-sr-dist\": `${effectiveDistance}px`,\n            \"--fb-sr-initial-transform\": initialTransform,\n            \"--fb-sr-duration\": `${duration}ms`,\n          } as React.CSSProperties\n        }\n      >\n        {children}\n      </div>\n    </Component>\n  );\n}\n\nexport default ScrollReveal;\n",
          "type": "registry:ui",
          "target": "components/ui/scroll-reveal.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "scroll-reveal",
          "version": "0.1.0",
          "summary": "media: Scroll-driven entrance (CSS view() timeline, IntersectionObserver fallback) (dom, server-safe, reduced motion -> static, low-end mobile -> 12px)",
          "slot": "media",
          "kind": "dom"
        },
        "intent": {
          "useWhen": [
            "Feature cards, images, and marketing content blocks entering the viewport",
            "Staggered grid items revealing progressively during downward scroll",
            "Sections where scroll-triggered visibility enhances progressive narrative"
          ],
          "avoidWhen": [
            "Above-the-fold hero elements that must paint immediately for LCP",
            "Sticky navigation bars or persistent floating controls",
            "Dense data tables and interactive form fields"
          ],
          "alternatives": [
            {
              "name": "text-reveal",
              "when": "When revealing headline text tokens rather than containers or media elements"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "none",
          "webglContexts": 0,
          "tiers": {
            "0": "Content fully visible and static, no reveal classes (server render, prefers-reduced-motion, Save-Data, or no WebGL2)",
            "1": "Reveal with the travel distance capped at 12px (coarse pointer with low-end hints)",
            "2": "Reveal with the configured travel distance (24px by default)",
            "3": "Same as tier 2. At every animated tier, browsers that support animation-timeline use the scroll-linked CSS animation; others use the IntersectionObserver fallback. The observer hook is mounted in both cases."
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Content is rendered in its final visible state without transition delays or scroll triggers."
          },
          "input": {
            "pointer": "Scroll-linked entrance as the container enters the viewport. Where animation-timeline: view() is supported the animation is scroll-linked and reverses when scrolling back up.",
            "touch": "Same scroll trigger; the travel distance is capped at 12px only on tier 1 and tier 0 devices",
            "keyboard": "Focus-within guard forces element visible immediately when tabbed into"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "not-needed",
          "wcag": [
            "1.3.1",
            "1.4.3",
            "2.2.2"
          ],
          "notes": "Focus guard forces any element containing active focus visible immediately, preventing keyboard traps during scroll. Hidden-before-reveal styles exist only under html[data-motion=\"ok\"]; server HTML and reduced-motion users see the content visible."
        },
        "composition": {
          "maxPerPage": 20,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "noise-field",
            "text-reveal",
            "magnetic-button"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Required. Content elements wrapped and revealed on scroll."
          },
          {
            "name": "as",
            "type": "React.ElementType",
            "default": "div",
            "effect": "HTML tag rendered as root container."
          },
          {
            "name": "animation",
            "type": "\"fade-up\" | \"fade\" | \"scale-up\"",
            "default": "fade-up",
            "effect": "Visual entrance variant."
          },
          {
            "name": "distance",
            "type": "number",
            "default": 24,
            "effect": "Vertical travel distance in pixels (half of it for scale-up); capped at 12 when the tier is 1 or lower."
          },
          {
            "name": "duration",
            "type": "number",
            "default": 400,
            "effect": "Transition duration in ms. Applies only to the IntersectionObserver fallback; the native view-timeline animation is scroll-linked and ignores it."
          },
          {
            "name": "once",
            "type": "boolean",
            "default": true,
            "effect": "In the IntersectionObserver fallback, true keeps the content revealed after the first entry. The native view-timeline path is scroll-linked and reverses when scrolling back up regardless of this prop."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root element (the built-in class fb-scroll-reveal is kept)."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the root element, merged after display: block and position: relative (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<any>",
            "default": null,
            "effect": "Receives the root element chosen by `as`."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Forces the content visible and still. Where the browser supports CSS scroll-driven animation the reveal is driven by the scroll position and this prop has no effect."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "Optional CSP nonce forwarded to the internal scoped <style> element (one is rendered per instance)."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/scroll-reveal",
          "usage": "import { ScrollReveal } from \"@/components/ui/scroll-reveal\";\n\nexport default function CardGrid() {\n  return (\n    <ScrollReveal animation=\"fade-up\" distance={24}>\n      <div className=\"rounded-lg border p-6\">\n        <h3>Feature Title</h3>\n        <p>Feature description.</p>\n      </div>\n    </ScrollReveal>\n  );\n}",
          "mistakes": [
            "Do not use ScrollReveal on above-the-fold hero elements; hero text should be visible immediately for LCP.",
            "Do not nest ScrollReveal components inside each other; keep entrance containers flat.",
            "The reveal only runs when <html> has data-motion=\"ok\" (MotionReadyScript in Next, initMotionReady() in Vite); without it the content is static.",
            "Other props (id, data-*, aria-*, handlers) are spread on the root element."
          ],
          "verify": [
            "Verify content is visible in server HTML without JavaScript execution.",
            "Verify tabbing into hidden cards forces them visible immediately via focus guard.",
            "Verify reduced motion renders final visible content with zero animation delays."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "9bc25d10c8c513e394e9407f1d7c54fff98b8e3142a19d93bc666989a6de9507",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 1.98,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "13 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "scroll-showcase",
      "type": "registry:block",
      "title": "ScrollShowcase",
      "description": "Scroll composition: StickyScrollStory + ScrollReveal + optional Marquee; all copy comes from props (DOM, reduced motion -> static/opacity, mobile -> stacked)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [
        "@frictionborn/sticky-scroll-story",
        "@frictionborn/scroll-reveal",
        "@frictionborn/marquee",
        "@frictionborn/smooth-scroll"
      ],
      "files": [
        {
          "path": "registry/items/scroll-showcase/scroll-showcase.tsx",
          "content": "// Original — Frictionborn Motion ScrollShowcase composition\n\"use client\";\n\nimport React, { useId } from \"react\";\nimport { useCapability } from \"@frictionborn/runtime\";\nimport { StickyScrollStory, type StoryStep } from \"@/components/ui/sticky-scroll-story\";\nimport { ScrollReveal } from \"@/components/ui/scroll-reveal\";\nimport { Marquee } from \"@/components/ui/marquee\";\nimport { SmoothScroll } from \"@/components/ui/smooth-scroll\";\n\nexport interface ScrollShowcaseSpec {\n  metric: string;\n  label: string;\n  detail: string;\n}\n\nexport interface ScrollShowcaseProps extends React.HTMLAttributes<HTMLDivElement> {\n  /** Primary headline rendered as an h2 (required in TypeScript). */\n  headline: string;\n  /** Descriptive section narrative under the headline (required in TypeScript). */\n  description: string;\n  /** Narrative steps for StickyScrollStory (required in TypeScript). */\n  steps: StoryStep[];\n  /** Optional eyebrow text above the headline. */\n  eyebrow?: string;\n  /** Optional specifications / highlights grid. */\n  specs?: ScrollShowcaseSpec[];\n  /** Heading above the specifications grid. No default: nothing is rendered unless you pass one. */\n  specsHeading?: string;\n  /** Small label above the specifications heading. No default. */\n  specsEyebrow?: string;\n  /** Show the marquee strip (only rendered when `marqueeItems` is non-empty). Default: true. */\n  showMarquee?: boolean;\n  /** Items to display in the marquee strip. */\n  marqueeItems?: React.ReactNode[];\n  /** Label above the marquee strip, also its accessible name. No default. */\n  marqueeLabel?: string;\n  /** CSP nonce, forwarded to the `<style>` element of every item the section renders. */\n  nonce?: string;\n  /** Enable SmoothScroll provider (off by default per PRD 6.12). */\n  smoothScroll?: boolean;\n  /** Universal paused prop. */\n  paused?: boolean;\n  className?: string;\n  style?: React.CSSProperties;\n}\n\nexport const ScrollShowcase = React.forwardRef<HTMLDivElement, ScrollShowcaseProps>(\n  function ScrollShowcase(\n    {\n      headline,\n      description,\n      steps,\n      eyebrow,\n      specs,\n      specsHeading,\n      specsEyebrow,\n      showMarquee = true,\n      marqueeItems,\n      marqueeLabel,\n      nonce,\n      smoothScroll = false,\n      paused = false,\n      className,\n      style,\n      ...rest\n    },\n    ref\n  ) {\n    const cap = useCapability(); // @frictionborn-guard\n    // Ids are per instance, so two sections on one page never share an id or label each other\n    const uid = useId();\n    const headlineId = `${uid}-headline`;\n    const specsHeadingId = `${uid}-specs`;\n\n    const content = (\n      <div\n        ref={ref}\n        data-frictionborn-item=\"scroll-showcase\"\n        data-tier={cap.tier}\n        className={className}\n        style={{\n          width: \"100%\",\n          boxSizing: \"border-box\",\n          background: \"var(--background, Canvas)\",\n          color: \"var(--foreground, CanvasText)\",\n          ...style,\n        }}\n        {...rest}\n      >\n        {/* 1. Header Section */}\n        <section\n          aria-labelledby={headlineId}\n          style={{\n            maxWidth: \"1000px\",\n            margin: \"0 auto\",\n            padding: \"5rem 1.5rem 3rem 1.5rem\",\n            boxSizing: \"border-box\",\n            textAlign: \"center\",\n          }}\n        >\n          {eyebrow && (\n            <span\n              style={{\n                display: \"inline-block\",\n                fontSize: \"0.8rem\",\n                fontWeight: 500,\n                letterSpacing: \"0.08em\",\n                textTransform: \"uppercase\",\n                fontFamily: \"var(--font-mono, monospace)\",\n                color: \"var(--primary, currentColor)\",\n                marginBottom: \"0.75rem\",\n              }}\n            >\n              {eyebrow}\n            </span>\n          )}\n          <ScrollReveal paused={paused} nonce={nonce}>\n            <h2\n              id={headlineId}\n              style={{\n                margin: \"0 0 1rem 0\",\n                fontSize: \"clamp(1.75rem, 4vw, 2.75rem)\",\n                fontWeight: 600,\n                lineHeight: 1.2,\n                letterSpacing: \"-0.02em\",\n                color: \"var(--foreground, currentColor)\",\n              }}\n            >\n              {headline}\n            </h2>\n          </ScrollReveal>\n          <ScrollReveal paused={paused} nonce={nonce}>\n            <p\n              style={{\n                margin: \"0 auto\",\n                maxWidth: \"680px\",\n                fontSize: \"clamp(1rem, 1.6vw, 1.15rem)\",\n                lineHeight: 1.65,\n                color: \"var(--muted-foreground, color-mix(in srgb, currentColor 80%, transparent))\",\n              }}\n            >\n              {description}\n            </p>\n          </ScrollReveal>\n        </section>\n\n        {/* 2. Sticky Scroll Story (a plain wrapper: a second region labelled by the headline would repeat the landmark name) */}\n        <div style={{ maxWidth: \"1100px\", margin: \"0 auto\", padding: \"0 1.5rem\" }}>\n          <StickyScrollStory steps={steps} paused={paused} nonce={nonce} />\n        </div>\n\n        {/* 3. Feature Specifications Grid with ScrollReveal (if provided) */}\n        {specs && specs.length > 0 && (\n          <section\n            aria-labelledby={specsHeading ? specsHeadingId : undefined}\n            style={{\n              maxWidth: \"1000px\",\n              margin: \"4rem auto 0 auto\",\n              padding: \"4rem 1.5rem\",\n              boxSizing: \"border-box\",\n              borderTop: \"1px solid var(--border, color-mix(in srgb, currentColor 18%, transparent))\",\n            }}\n          >\n            <div style={{ textAlign: \"center\", marginBottom: \"3rem\" }}>\n              {specsEyebrow && (\n                <span\n                  style={{\n                    display: \"inline-block\",\n                    fontSize: \"0.8rem\",\n                    fontWeight: 500,\n                    letterSpacing: \"0.08em\",\n                    textTransform: \"uppercase\",\n                    fontFamily: \"var(--font-mono, monospace)\",\n                    color: \"var(--primary, currentColor)\",\n                    marginBottom: \"0.5rem\",\n                  }}\n                >\n                  {specsEyebrow}\n                </span>\n              )}\n              {specsHeading && (\n              <ScrollReveal paused={paused} nonce={nonce}>\n                <h3\n                  id={specsHeadingId}\n                  style={{\n                    margin: 0,\n                    fontSize: \"clamp(1.5rem, 3vw, 2.25rem)\",\n                    fontWeight: 600,\n                    lineHeight: 1.25,\n                    letterSpacing: \"-0.02em\",\n                    color: \"var(--foreground, currentColor)\",\n                  }}\n                >\n                  {specsHeading}\n                </h3>\n              </ScrollReveal>\n              )}\n            </div>\n\n            <div\n              style={{\n                display: \"grid\",\n                gridTemplateColumns: \"repeat(auto-fit, minmax(min(280px, 100%), 1fr))\",\n                gap: \"1.5rem\",\n              }}\n            >\n              {specs.map((spec, index) => (\n                <ScrollReveal key={`${index}-${spec.label}`} paused={paused} nonce={nonce}>\n                  <div\n                    style={{\n                      padding: \"2rem\",\n                      borderRadius: \"10px\",\n                      background: \"var(--card, color-mix(in srgb, currentColor 5%, transparent))\",\n                      border: \"1px solid var(--border, color-mix(in srgb, currentColor 18%, transparent))\",\n                      height: \"100%\",\n                      boxSizing: \"border-box\",\n                    }}\n                  >\n                    <div\n                      style={{\n                        fontSize: \"2rem\",\n                        fontWeight: 700,\n                        fontFamily: \"var(--font-mono, monospace)\",\n                        color: \"var(--primary, currentColor)\",\n                      }}\n                    >\n                      {spec.metric}\n                    </div>\n                    <h4\n                      style={{\n                        margin: \"0.75rem 0 0.5rem 0\",\n                        fontSize: \"1.1rem\",\n                        fontWeight: 600,\n                        color: \"var(--foreground, currentColor)\",\n                      }}\n                    >\n                      {spec.label}\n                    </h4>\n                    <p\n                      style={{\n                        margin: 0,\n                        fontSize: \"0.9rem\",\n                        lineHeight: 1.6,\n                        color: \"var(--muted-foreground, color-mix(in srgb, currentColor 75%, transparent))\",\n                      }}\n                    >\n                      {spec.detail}\n                    </p>\n                  </div>\n                </ScrollReveal>\n              ))}\n            </div>\n          </section>\n        )}\n\n        {/* 4. Client / Reference Marquee (if items provided and enabled) */}\n        {showMarquee && marqueeItems && marqueeItems.length > 0 && (\n          <section\n            aria-label={marqueeLabel}\n            style={{\n              padding: \"3rem 0 5rem 0\",\n              borderTop: \"1px solid var(--border, color-mix(in srgb, currentColor 18%, transparent))\",\n              overflow: \"hidden\",\n            }}\n          >\n            {marqueeLabel && (\n              <div style={{ textAlign: \"center\", marginBottom: \"1.5rem\", padding: \"0 1.5rem\" }}>\n                <span\n                  style={{\n                    fontSize: \"0.8rem\",\n                    fontWeight: 500,\n                    letterSpacing: \"0.08em\",\n                    textTransform: \"uppercase\",\n                    fontFamily: \"var(--font-mono, monospace)\",\n                    color: \"var(--muted-foreground, color-mix(in srgb, currentColor 75%, transparent))\",\n                  }}\n                >\n                  {marqueeLabel}\n                </span>\n              </div>\n            )}\n            <Marquee pixelsPerSecond={32} paused={paused} nonce={nonce} pauseOnHover={true} pauseOnFocus={true}>\n              {marqueeItems.map((item, idx) => (\n                <span\n                  key={idx}\n                  style={{\n                    display: \"inline-flex\",\n                    alignItems: \"center\",\n                    padding: \"0 2rem\",\n                    fontSize: \"1rem\",\n                    fontWeight: 500,\n                    color: \"var(--muted-foreground, color-mix(in srgb, currentColor 75%, transparent))\",\n                    letterSpacing: \"-0.01em\",\n                  }}\n                >\n                  {item}\n                </span>\n              ))}\n            </Marquee>\n          </section>\n        )}\n      </div>\n    );\n\n    if (smoothScroll) {\n      return <SmoothScroll paused={paused}>{content}</SmoothScroll>;\n    }\n\n    return content;\n  }\n);\n\nScrollShowcase.displayName = \"ScrollShowcase\";\n\nexport default ScrollShowcase;\n",
          "type": "registry:block",
          "target": "components/ui/scroll-showcase.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "scroll-showcase",
          "version": "0.1.0",
          "summary": "Scroll composition: StickyScrollStory + ScrollReveal + optional Marquee; all copy comes from props (DOM, reduced motion -> static/opacity, mobile -> stacked)",
          "slot": "composition",
          "kind": "composition"
        },
        "intent": {
          "useWhen": [
            "Product feature narrative requiring sticky step progression and reveal on scroll",
            "Product or engineering deep-dive with step-by-step media and an optional metrics grid",
            "Multi-section storytelling with accessible scroll-driven reveals"
          ],
          "avoidWhen": [
            "Short single-screen pages without scroll depth",
            "Mobile web apps requiring dense vertical list views",
            "Documentation sites where uninterrupted linear reading is essential"
          ],
          "alternatives": [
            {
              "name": "sticky-scroll-story",
              "when": "When you only need the sticky step column without accompanying feature grids or marquee"
            },
            {
              "name": "scroll-reveal",
              "when": "When you only need basic reveal-on-scroll animations for individual cards"
            }
          ]
        },
        "runtime": {
          "serverOutput": "static-layout",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": [
            "@frictionborn/sticky-scroll-story",
            "@frictionborn/scroll-reveal",
            "@frictionborn/marquee",
            "@frictionborn/smooth-scroll"
          ]
        },
        "behavior": {
          "loop": "none",
          "webglContexts": 0,
          "tiers": {
            "0": "Not gated by tier: layout stacks at viewport width 768px and below; ScrollReveal content is static; Marquee is paused with no duplicate copy",
            "1": "ScrollReveal travel capped at 12px; Marquee still animates; layout depends on viewport width, not tier",
            "2": "Sticky story with CSS crossfades, scroll-linked or IntersectionObserver reveals, animated marquee",
            "3": "Same as tier 2"
          },
          "reducedMotion": {
            "mode": "opacity-only",
            "description": "StickyScrollStory swaps media instantly (no transition, no translation); ScrollReveal elements are immediately visible; Marquee stops animating and renders a static row (no duplicate copy, no pause button)"
          },
          "input": {
            "pointer": "Hovering the marquee pauses it; the sticky story is driven by scroll position",
            "touch": "At viewport width 768px and below the story is stacked without sticky positioning",
            "keyboard": "DOM order matches visual order; the only added focusable element is the marquee pause button, and focus inside the marquee pauses it"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "built-in",
          "wcag": [
            "2.1.1",
            "2.2.2",
            "2.4.1",
            "2.4.6"
          ],
          "notes": "Sections are named through aria-labelledby (the headline, and the specs heading when you pass one) or aria-label (marqueeLabel when you pass one); ids are generated per instance with useId, so two sections on one page never clash. Heading levels run h2 (headline), h2 (each step title, from StickyScrollStory), h3 (specsHeading), h4 (spec labels): place the section under an h1 and check the outline for your page. media.alt applies only to media.type 'image'. Every colour is a host token (--background, --foreground, --primary, --muted-foreground, --card, --border) with a system-colour fallback; contrast follows your theme: measured on real pixels in a fresh Next 16 app with shadcn's default tokens (sample content, light and dark, 1440 and 390 px) every text element was at least 4.7:1 (light) and 6.9:1 (dark); verify your own content."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "ambient-hero"
          ]
        },
        "props": [
          {
            "name": "headline",
            "type": "string",
            "default": null,
            "effect": "Required. Primary section headline rendered as an h2."
          },
          {
            "name": "description",
            "type": "string",
            "default": null,
            "effect": "Required. Section narrative description below the headline."
          },
          {
            "name": "steps",
            "type": "StoryStep[]",
            "default": null,
            "effect": "Required. Narrative steps for StickyScrollStory ({ id, title, description, badge?, media })."
          },
          {
            "name": "eyebrow",
            "type": "string",
            "default": null,
            "effect": "Optional. Eyebrow badge above the headline."
          },
          {
            "name": "specs",
            "type": "ScrollShowcaseSpec[]",
            "default": null,
            "effect": "Optional. Specifications / highlights grid items ({ metric, label, detail })."
          },
          {
            "name": "specsHeading",
            "type": "string",
            "default": null,
            "effect": "Optional. Heading above the specifications grid. Nothing is rendered when omitted."
          },
          {
            "name": "specsEyebrow",
            "type": "string",
            "default": null,
            "effect": "Optional. Small label above the specifications heading. Nothing is rendered when omitted."
          },
          {
            "name": "showMarquee",
            "type": "boolean",
            "default": true,
            "effect": "Shows the marquee ticker when marqueeItems is non-empty."
          },
          {
            "name": "marqueeItems",
            "type": "React.ReactNode[]",
            "default": null,
            "effect": "Optional. Array of items to display in the marquee ticker."
          },
          {
            "name": "marqueeLabel",
            "type": "string",
            "default": null,
            "effect": "Optional. Label above the marquee ticker, also its accessible name. Nothing is rendered when omitted."
          },
          {
            "name": "smoothScroll",
            "type": "boolean",
            "default": false,
            "effect": "Wraps the composition in the SmoothScroll provider (off by default)."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Passed to the reveals, the story, the marquee and SmoothScroll (the reveals only react when the browser lacks CSS scroll-driven animation)."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "Optional CSP nonce forwarded to the <style> element of every item the section renders."
          },
          {
            "name": "className",
            "type": "string",
            "default": null,
            "effect": "Optional. No default. Additional CSS class names on the root container. Any other HTML attribute (id, data-*, aria-*, event handlers) is spread on the root element; handlers the item uses itself are composed, not replaced."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the root container, merged last (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div>."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/scroll-showcase",
          "usage": "// Installing scroll-showcase also installs sticky-scroll-story, scroll-reveal, marquee and smooth-scroll (and therefore lenis@1.3.26), even when smoothScroll stays false.\nimport { ScrollShowcase } from '@/components/ui/scroll-showcase';\n\nconst steps = [\n  { id: 'one', title: 'First step', description: 'What happens first.', media: { content: <div>Illustration</div> } },\n  { id: 'two', title: 'Second step', description: 'What happens next.', media: { content: <div>Illustration</div> } },\n];\n\nexport default function Story() {\n  return <ScrollShowcase headline=\"How it works\" description=\"Three plain sentences.\" steps={steps} />;\n}",
          "mistakes": [
            "headline, description and steps are required and the component contains no copy of its own: nothing is rendered for specsHeading, specsEyebrow or marqueeLabel unless you pass them.",
            "StickyScrollStory renders each step's media.content twice (a sticky column and a stacked mobile copy), so do not put ids inside it.",
            "Do not enable smoothScroll on dashboards or documentation pages, and never when another SmoothScroll is mounted (a second one warns and does nothing).",
            "Do not place multiple sticky scroll sections immediately adjacent to each other without spacing.",
            "Under a nonce-based CSP pass nonce: it is forwarded to every <style> the section renders.",
            "Reveal and marquee animations only run when <html> has data-motion=\"ok\" (MotionReadyScript in Next, initMotionReady() in Vite)."
          ],
          "verify": [
            "Verify that the step sequence is fully accessible in DOM reading order.",
            "Verify that mobile viewports switch to stacked mode without sticky jumping.",
            "Verify that reduced-motion preferences stop the marquee animation and reveals remain static."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "48983bacedb716e0bb8b8f003111acd976177909203bc413236e53452c3a4ca1",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.57,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "19 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "18 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "smooth-scroll",
      "type": "registry:ui",
      "title": "SmoothScroll",
      "description": "page-provider: Lenis provider stepped strictly via useFrame with autoRaf false (dom, server-safe, singleton, reduced motion -> off, mobile -> off)",
      "dependencies": [
        "@frictionborn/runtime",
        "lenis@1.3.26"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/smooth-scroll/smooth-scroll.tsx",
          "content": "// Source: https://github.com/darkroomengineering/lenis — MIT — Darkroom Engineering\n\"use client\";\n\nimport React, { useEffect, useRef, useState, useCallback, useImperativeHandle } from \"react\";\nimport Lenis from \"lenis\";\nimport {\n  useFrame,\n  useReducedMotion,\n  useCapability,\n  useHydrated,\n  usePaused,\n} from \"@frictionborn/runtime\";\n\nexport interface SmoothScrollScrollEvent {\n  scroll: number;\n  limit: number;\n  velocity: number;\n  direction: number;\n  progress: number;\n}\n\ninterface LenisInternalState {\n  animate?: { isRunning?: boolean };\n  time?: number;\n}\n\nexport interface SmoothScrollProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onScroll\"> {\n  children?: React.ReactNode;\n  duration?: number; // duration in milliseconds (e.g. 1200 means 1.2s)\n  easing?: (t: number) => number;\n  orientation?: \"vertical\" | \"horizontal\";\n  gestureOrientation?: \"vertical\" | \"horizontal\" | \"both\";\n  smoothWheel?: boolean;\n  touchMultiplier?: number;\n  infinite?: boolean;\n  enabled?: boolean;\n  paused?: boolean;\n  onScroll?: (e: SmoothScrollScrollEvent) => void;\n  prevent?: (node: HTMLElement) => boolean;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\n// Module-level so its identity is stable: an inline default would change every render and make the\n// Lenis effect below tear down and rebuild the instance (killing the animation it just started)\nconst defaultEasing = (t: number) => Math.min(1, 1.001 - Math.pow(2, -10 * t));\n\nconst DIALOG_SELECTOR = '[role=\"dialog\"], [aria-modal=\"true\"], dialog[open], [data-lenis-prevent]';\n\nlet activeSingleton = false;\n\nexport function SmoothScroll({\n  children,\n  duration = 1200,\n  easing = defaultEasing,\n  orientation = \"vertical\",\n  gestureOrientation = \"vertical\",\n  smoothWheel = true,\n  touchMultiplier = 1,\n  infinite = false,\n  enabled = true,\n  paused = false,\n  onScroll,\n  prevent,\n  ref,\n  style,\n  ...rest\n}: SmoothScrollProps) {\n  const containerRef = useRef<HTMLDivElement | null>(null);\n  const isHydrated = useHydrated(); // @frictionborn-guard\n  const prefersReduced = useReducedMotion(); // @frictionborn-guard\n  const capability = useCapability(); // @frictionborn-guard\n  const isPaused = usePaused(); // @frictionborn-guard\n  // No in-view gate: this wrapper is display:contents (never intersects) and a page-level scroll engine\n  // must run wherever the page is. Idle cost is zero because the loop stops once Lenis reports settled.\n\n  const lenisRef = useRef<Lenis | null>(null);\n  const [isActive, setIsActive] = useState(false);\n  // Starts idle: Lenis has nothing to animate until the first wheel/key/touch/scroll input wakes the loop,\n  // so a freshly hydrated (or off-screen) page requests zero frames\n  const [isScrolling, setIsScrolling] = useState(false);\n  const settleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n  const isMasterRef = useRef(false);\n  // Callbacks may be inline lambdas; read them through refs so they never re-create Lenis\n  const easingRef = useRef(easing);\n  const onScrollRef = useRef(onScroll);\n  const preventRef = useRef(prevent);\n  useEffect(() => {\n    easingRef.current = easing;\n    onScrollRef.current = onScroll;\n    preventRef.current = prevent;\n  });\n\n  // Decision 16: SmoothScroll is disabled on reduced motion and coarse pointers (mobile/touch)\n  const isCoarsePointer = capability.pointer === \"coarse\";\n  const shouldEnable = isHydrated && enabled && !paused && !prefersReduced && !isCoarsePointer;\n\n  // Wake the shared loop on input; it stops again as soon as Lenis reports it is no longer scrolling\n  const idleFramesRef = useRef(0);\n  const needsClockResetRef = useRef(true);\n  const wakeLoop = useCallback(() => {\n    idleFramesRef.current = 0;\n    needsClockResetRef.current = true;\n    setIsScrolling(true);\n    if (settleTimerRef.current) clearTimeout(settleTimerRef.current);\n    settleTimerRef.current = setTimeout(() => {\n      const lenis = lenisRef.current;\n      const lenisInternal = lenis as unknown as LenisInternalState | null;\n      if (!lenis?.isScrolling && !lenisInternal?.animate?.isRunning) {\n        setIsScrolling(false);\n      }\n    }, 150);\n  }, []);\n\n  useEffect(() => {\n    if (!shouldEnable) {\n      if (isMasterRef.current && lenisRef.current) {\n        lenisRef.current.destroy();\n        lenisRef.current = null;\n        activeSingleton = false;\n        isMasterRef.current = false;\n        setIsActive(false);\n      }\n      return;\n    }\n\n    // Singleton guard: warn and no-op if an instance is already active\n    if (activeSingleton && !isMasterRef.current) {\n      console.warn(\n        \"[frictionborn/smooth-scroll] A SmoothScroll instance is already active. Duplicate instance ignored.\"\n      );\n      return;\n    }\n\n    activeSingleton = true;\n    isMasterRef.current = true;\n\n    // Lenis expects duration in seconds (duration in ms / 1000)\n    const lenisDurationSec = duration / 1000;\n\n    const lenis = new Lenis({\n      duration: lenisDurationSec,\n      easing: (t: number) => easingRef.current(t),\n      orientation,\n      gestureOrientation,\n      smoothWheel,\n      touchMultiplier,\n      infinite,\n      autoRaf: false, // strictly driven by runtime useFrame\n      // Nested scrollers and open dialogs keep native wheel scrolling (PRD 6.10)\n      allowNestedScroll: true,\n      prevent: (node: HTMLElement) =>\n        !!preventRef.current?.(node) ||\n        (typeof node.matches === \"function\" && node.matches(DIALOG_SELECTOR)),\n    });\n\n    lenisRef.current = lenis;\n    setIsActive(true);\n\n    lenis.on(\"scroll\", (e: unknown) => onScrollRef.current?.(e as SmoothScrollScrollEvent));\n\n    return () => {\n      if (isMasterRef.current) {\n        lenis.destroy();\n        lenisRef.current = null;\n        activeSingleton = false;\n        isMasterRef.current = false;\n        setIsActive(false);\n      }\n    };\n  }, [\n    shouldEnable,\n    duration,\n    orientation,\n    gestureOrientation,\n    smoothWheel,\n    touchMultiplier,\n    infinite,\n  ]);\n\n  // Wake loop on wheel, scroll or keyboard navigation events\n  useEffect(() => {\n    if (!isActive || typeof window === \"undefined\") return;\n\n    window.addEventListener(\"wheel\", wakeLoop, { passive: true });\n    window.addEventListener(\"keydown\", wakeLoop, { passive: true });\n    window.addEventListener(\"touchmove\", wakeLoop, { passive: true });\n    window.addEventListener(\"scroll\", wakeLoop, { passive: true });\n\n    return () => {\n      window.removeEventListener(\"wheel\", wakeLoop);\n      window.removeEventListener(\"keydown\", wakeLoop);\n      window.removeEventListener(\"touchmove\", wakeLoop);\n      window.removeEventListener(\"scroll\", wakeLoop);\n      if (settleTimerRef.current) clearTimeout(settleTimerRef.current);\n    };\n  }, [isActive, wakeLoop]);\n\n  // Stepped strictly via the shared useFrame loop (zero direct rAF calls, zero idle frames)\n  useFrame(\n    ({ time }) => {\n      const lenis = lenisRef.current;\n      if (lenis && !isPaused) {\n        const lenisInternal = lenis as unknown as LenisInternalState;\n        if (needsClockResetRef.current) {\n          needsClockResetRef.current = false;\n          lenisInternal.time = 0; // next raf() computes delta 0 instead of the idle gap\n        }\n        lenis.raf(time);\n        // Idle only when Lenis is neither scrolling nor animating for several consecutive frames\n        // (browsers differ in when native scroll events flip isScrolling; never stop mid-animation)\n        const busy = !!lenis.isScrolling || !!lenisInternal.animate?.isRunning;\n        idleFramesRef.current = busy ? 0 : idleFramesRef.current + 1;\n        if (idleFramesRef.current >= 3) {\n          idleFramesRef.current = 0;\n          if (settleTimerRef.current) clearTimeout(settleTimerRef.current);\n          setIsScrolling(false);\n        }\n      }\n    },\n    { active: isActive && !isPaused && isScrolling }\n  );\n\n  useImperativeHandle(ref, () => containerRef.current!, []);\n\n  return (\n    <div\n      ref={containerRef}\n      data-frictionborn-item=\"smooth-scroll\"\n      data-active={isActive}\n      data-tier={capability.tier}\n      style={{ display: \"contents\", ...style }}\n      {...rest}\n    >\n      {children}\n    </div>\n  );\n}\n\nexport default SmoothScroll;\n",
          "type": "registry:ui",
          "target": "components/ui/smooth-scroll.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "smooth-scroll",
          "version": "0.1.0",
          "summary": "page-provider: Lenis provider stepped strictly via useFrame with autoRaf false (dom, server-safe, singleton, reduced motion -> off, mobile -> off)",
          "slot": "page-provider",
          "kind": "scroll-provider"
        },
        "intent": {
          "useWhen": [
            "Marketing landing pages requiring unified cinematic scroll feel",
            "Editorial feature stories paired with sticky scroll narratives",
            "Desktop viewports with fine pointers and high-refresh displays"
          ],
          "avoidWhen": [
            "Dashboards and data-dense productivity software",
            "Documentation sites and code-heavy portals",
            "Forms-heavy pages and modal-only checkout flows",
            "Touchscreens and mobile devices (automatically disabled on coarse pointers)"
          ],
          "alternatives": [
            {
              "name": "native-scroll",
              "when": "When standard browser compositor scrolling is sufficient without kinetic interpolation"
            }
          ]
        },
        "runtime": {
          "serverOutput": "static-layout",
          "clientOnly": false,
          "lazyLoaded": "no",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [
            {
              "name": "lenis",
              "version": "1.3.26",
              "license": "MIT"
            }
          ],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "Not gated by tier. Smooth scrolling runs unless reduced motion, enabled={false} or a coarse pointer disables it; Save-Data and no-WebGL2 (tier 0) do not disable it",
            "1": "Coarse pointer: disabled, native touch momentum scrolling preserved",
            "2": "Coarse pointer: disabled. On a fine or absent pointer (low-end hints or viewport < 480px) smooth scrolling runs, stepped via useFrame",
            "3": "Smooth scrolling runs (fine pointer with hover), stepped via useFrame; same behaviour as tier 2 on fine pointers"
          },
          "reducedMotion": {
            "mode": "off",
            "description": "Disabled completely; 100% native platform momentum scrolling."
          },
          "input": {
            "pointer": "Wheel input is interpolated by Lenis (smoothWheel) unless the pointer is coarse, reduced motion is set, or enabled is false",
            "touch": "Native touch momentum scrolling is preserved; Lenis is inactive on coarse pointers",
            "keyboard": "Keys (Space, PageUp, PageDown, arrows, Home, End) scroll natively; Lenis does not intercept them and a keydown only wakes the shared frame loop"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "not-needed",
          "wcag": [
            "2.1.1",
            "2.2.2",
            "2.3.3"
          ],
          "notes": "Native keyboard scrolling is preserved. When reduced motion is preferred, smooth scrolling is turned off completely, delegating all scroll behavior to the native platform compositor."
        },
        "composition": {
          "maxPerPage": 1,
          "singleton": true,
          "conflictsWith": [],
          "pairsWith": [
            "sticky-scroll-story",
            "scroll-reveal",
            "noise-field"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "React.ReactNode",
            "default": null,
            "effect": "Optional. No default. Child components wrapped inside the provider (rendered in a display: contents div)."
          },
          {
            "name": "duration",
            "type": "number",
            "default": 1200,
            "effect": "Scroll easing duration in milliseconds (e.g. 1200 means 1.2 seconds)."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Freezes kinetic smooth scrolling."
          },
          {
            "name": "easing",
            "type": "(t: number) => number",
            "default": "(t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))",
            "effect": "Easing function (default is a module-level function). Read through a ref, so an inline function does not recreate Lenis."
          },
          {
            "name": "orientation",
            "type": "\"vertical\" | \"horizontal\"",
            "default": "vertical",
            "effect": "Primary scroll orientation."
          },
          {
            "name": "gestureOrientation",
            "type": "\"vertical\" | \"horizontal\" | \"both\"",
            "default": "vertical",
            "effect": "Gesture direction Lenis listens to."
          },
          {
            "name": "smoothWheel",
            "type": "boolean",
            "default": true,
            "effect": "Whether to interpolate mouse wheel deltas."
          },
          {
            "name": "touchMultiplier",
            "type": "number",
            "default": 1,
            "effect": "Lenis touch multiplier (touch scrolling is not smoothed on coarse pointers because SmoothScroll is disabled there)."
          },
          {
            "name": "infinite",
            "type": "boolean",
            "default": false,
            "effect": "Lenis infinite scroll option."
          },
          {
            "name": "enabled",
            "type": "boolean",
            "default": true,
            "effect": "Master toggle to enable or disable smooth scrolling."
          },
          {
            "name": "onScroll",
            "type": "(e: any) => void",
            "default": null,
            "effect": "Called with the Lenis scroll event (not the DOM scroll event, even though the root is a <div>)."
          },
          {
            "name": "prevent",
            "type": "(node: HTMLElement) => boolean",
            "default": null,
            "effect": "Optional. No default. Predicate to bypass smooth scrolling for specific DOM nodes. Nested scrollers (allowNestedScroll) and [role=\"dialog\"], [aria-modal=\"true\"], dialog[open], [data-lenis-prevent] are always bypassed."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div>, which is display: contents, so its bounding box is empty (use it for data attributes, not geometry)."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/smooth-scroll",
          "usage": "import { SmoothScroll } from \"@/components/ui/smooth-scroll\";\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n  return (\n    <SmoothScroll>\n      {children}\n    </SmoothScroll>\n  );\n}",
          "mistakes": [
            "Do not mount multiple SmoothScroll instances; SmoothScroll is a singleton provider (a second mount warns and does nothing).",
            "Do not import Lenis directly or create separate requestAnimationFrame loops.",
            "Do not use on dashboards, forms-heavy pages, or data-dense web applications.",
            "The registry installs lenis@1.3.26 and consumers accept lenis@^1.3.26; to pin exactly run: npm install --save-exact lenis@1.3.26 (or the equivalent for your package manager).",
            "SmoothScroll is stepped by the shared useFrame loop. While the runtime pauseAll() is active (the runtime global pause; AmbientHero's own pause button no longer triggers it) that loop, and therefore SmoothScroll's stepping, is stopped; verify wheel scrolling on pages that combine them.",
            "duration is in milliseconds (1200 = 1.2 s). A seconds value such as 1.2 now means 1.2 ms and the scroll looks instant."
          ],
          "verify": [
            "Verify keyboard navigation (Space, PageUp/Down, Arrows) works identically to native scrolling.",
            "Verify hash anchors (#section-id) jump smoothly without layout offsets.",
            "Verify reduced motion disables Lenis and returns 100% control to the platform."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [
            {
              "what": "Lenis smooth scroll engine",
              "url": "https://github.com/darkroomengineering/lenis",
              "license": "MIT"
            }
          ],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "84200ba8f19bd1099b76b84e3d4893510c925d52414af4c7bc9e04a1f96ddefd",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.7,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "21 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "20 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "sticky-scroll-story",
      "type": "registry:ui",
      "title": "StickyScrollStory",
      "description": "scroll-section: Sticky media column with scrolling steps (dom, server-safe, CLS <= 0.01, reduced motion -> opacity-only (instant swap), mobile -> stacked)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/sticky-scroll-story/sticky-scroll-story.tsx",
          "content": "// Original — Frictionborn Motion StickyScrollStory\n\"use client\";\n\nimport React, { useState, useEffect, useRef } from \"react\";\nimport { useReducedMotion, useCapability, useHydrated } from \"@frictionborn/runtime\";\n\nexport interface StoryStep {\n  id: string;\n  title: string;\n  description: string;\n  badge?: string;\n  media: {\n    type?: \"image\" | \"custom\";\n    src?: string;\n    alt?: string;\n    content?: React.ReactNode;\n  };\n}\n\nexport interface StickyScrollStoryProps extends React.HTMLAttributes<HTMLDivElement> {\n  steps: StoryStep[];\n  className?: string;\n  style?: React.CSSProperties;\n  mediaPosition?: \"left\" | \"right\";\n  paused?: boolean;\n  nonce?: string;\n  onStepChange?: (stepId: string) => void;\n}\n\nexport const StickyScrollStory = React.forwardRef<HTMLDivElement, StickyScrollStoryProps>(\n  function StickyScrollStory(\n    {\n      steps,\n      className = \"\",\n      style,\n      mediaPosition = \"right\",\n      paused = false,\n      nonce,\n      onStepChange,\n      ...rest\n    },\n    ref\n  ) {\n    const [activeStep, setActiveStep] = useState(0);\n    const hydrated = useHydrated(); // @frictionborn-guard\n    const prefersReduced = useReducedMotion(); // @frictionborn-guard\n    const capability = useCapability(); // @frictionborn-guard\n    const stepRefs = useRef<(HTMLDivElement | null)[]>([]);\n    const onStepChangeRef = useRef(onStepChange);\n    onStepChangeRef.current = onStepChange;\n\n    // Zero window scroll listeners: use IntersectionObserver to detect active step in viewport\n    useEffect(() => {\n      if (paused || !hydrated || typeof IntersectionObserver === \"undefined\") return;\n\n      const observer = new IntersectionObserver(\n        (entries) => {\n          for (const entry of entries) {\n            if (entry.isIntersecting) {\n              const indexStr = entry.target.getAttribute(\"data-step-index\");\n              if (indexStr !== null) {\n                const idx = parseInt(indexStr, 10);\n                if (!isNaN(idx)) {\n                  setActiveStep(idx);\n                  if (onStepChangeRef.current && steps[idx]) {\n                    onStepChangeRef.current(steps[idx].id);\n                  }\n                }\n              }\n            }\n          }\n        },\n        {\n          root: null,\n          rootMargin: \"-30% 0px -30% 0px\", // active in center 40% band of screen\n          threshold: 0.1,\n        }\n      );\n\n      stepRefs.current.forEach((el) => {\n        if (el) observer.observe(el);\n      });\n\n      return () => observer.disconnect();\n    }, [hydrated, steps, paused]);\n\n    return (\n      <div\n        ref={ref}\n        data-frictionborn-item=\"sticky-scroll-story\"\n        data-tier={capability.tier}\n        className={`fb-sticky-scroll-story ${className}`}\n        style={{\n          position: \"relative\",\n          width: \"100%\",\n          ...style,\n        }}\n        {...rest}\n      >\n        <style nonce={nonce}>{`\n        .fb-sss-container {\n          display: grid;\n          grid-template-columns: 1fr 1fr;\n          gap: 4rem;\n          position: relative;\n          width: 100%;\n          max-width: 1200px;\n          margin: 0 auto;\n        }\n\n        .fb-sss-media-col {\n          position: sticky;\n          top: 15vh;\n          height: 70vh;\n          display: flex;\n          align-items: center;\n          justify-content: center;\n          border-radius: 8px;\n          overflow: hidden;\n        }\n\n        .fb-sss-media-slot {\n          position: absolute;\n          inset: 0;\n          width: 100%;\n          height: 100%;\n          display: flex;\n          align-items: center;\n          justify-content: center;\n          transition: opacity 250ms cubic-bezier(0.22, 1, 0.36, 1);\n        }\n\n        /* Hidden-before-reveal only under data-motion=ok (AGENTS rule 1); reduced motion never gets data-motion=ok,\n           so once hydrated it hides inactive media too (instant swap). Server HTML stays unhidden. */\n        html[data-motion=\"ok\"] .fb-sss-media-slot[data-active=\"false\"],\n        .fb-sss-container[data-hydrated=\"true\"][data-reduced=\"true\"] .fb-sss-media-slot[data-active=\"false\"] {\n          opacity: 0;\n          pointer-events: none;\n        }\n\n        .fb-sss-media-slot[data-active=\"true\"] {\n          opacity: 1;\n          pointer-events: auto;\n          z-index: 2;\n        }\n\n        .fb-sss-step-card {\n          min-height: 70vh;\n          display: flex;\n          flex-direction: column;\n          justify-content: center;\n          padding: 2rem 0;\n          transition: opacity 200ms ease;\n        }\n\n        .fb-sss-step-card:first-child {\n          justify-content: flex-start;\n          padding-top: 1rem;\n        }\n\n        .fb-sss-mobile-media {\n          display: none;\n        }\n\n        @media (max-width: 768px) {\n          .fb-sss-container {\n            display: flex;\n            flex-direction: column;\n            gap: 2.5rem;\n          }\n\n          .fb-sss-media-col {\n            display: none !important;\n          }\n\n          .fb-sss-step-card {\n            min-height: auto;\n            padding: 1.5rem 0;\n          }\n\n          .fb-sss-mobile-media {\n            display: block;\n            margin-top: 1.25rem;\n            width: 100%;\n            border-radius: 6px;\n            overflow: hidden;\n          }\n        }\n\n        @media (prefers-reduced-motion: reduce) {\n          .fb-sss-media-slot {\n            transition: none !important;\n          }\n        }\n      `}</style>\n\n      <div\n        className=\"fb-sss-container\"\n        data-hydrated={hydrated ? \"true\" : \"false\"}\n        data-reduced={prefersReduced ? \"true\" : \"false\"}\n        style={{\n          direction: mediaPosition === \"left\" ? \"rtl\" : \"ltr\",\n        }}\n      >\n        {/* Narrative Scrolling Column (DOM order preserved in reading order) */}\n        <div\n          className=\"fb-sss-steps-col\"\n          style={{\n            direction: \"ltr\",\n            display: \"flex\",\n            flexDirection: \"column\",\n          }}\n        >\n          {steps.map((step, idx) => {\n            const isActive = activeStep === idx;\n            return (\n              <div\n                key={step.id}\n                ref={(el) => {\n                  stepRefs.current[idx] = el;\n                }}\n                data-step-index={idx}\n                aria-current={isActive ? \"step\" : undefined}\n                className=\"fb-sss-step-card\"\n                style={{\n                  opacity: 1,\n                  borderLeft: isActive ? \"3px solid var(--primary, currentColor)\" : \"3px solid transparent\",\n                  paddingLeft: \"1.25rem\",\n                  transition: prefersReduced ? \"none\" : \"border-color 200ms ease\",\n                }}\n              >\n                {step.badge && (\n                  <span\n                    className=\"mono\"\n                    style={{\n                      display: \"inline-block\",\n                      fontSize: \"11px\",\n                      textTransform: \"uppercase\",\n                      letterSpacing: \"0.08em\",\n                      color: isActive ? \"var(--primary, currentColor)\" : \"var(--muted-foreground, color-mix(in srgb, currentColor 72%, transparent))\",\n                      marginBottom: \"0.5rem\",\n                    }}\n                  >\n                    {step.badge}\n                  </span>\n                )}\n                <h2\n                  style={{\n                    fontSize: \"clamp(1.5rem, 3vw, 2.25rem)\",\n                    fontWeight: 600,\n                    letterSpacing: \"-0.02em\",\n                    margin: \"0 0 1rem 0\",\n                  }}\n                >\n                  {step.title}\n                </h2>\n                <p\n                  style={{\n                    fontSize: \"16px\",\n                    lineHeight: 1.6,\n                    color: \"var(--muted-foreground, color-mix(in srgb, currentColor 72%, transparent))\",\n                    margin: 0,\n                    maxWidth: \"520px\",\n                  }}\n                >\n                  {step.description}\n                </p>\n\n                {/* Mobile Inline Media (Rendered below narrative on phones without sticky position jumps) */}\n                <div className=\"fb-sss-mobile-media\">\n                  {step.media?.type === \"image\" && step.media?.src ? (\n                    <img\n                      src={step.media.src}\n                      alt={step.media.alt || step.title}\n                      loading=\"lazy\"\n                      style={{\n                        width: \"100%\",\n                        height: \"auto\",\n                        aspectRatio: \"16/10\",\n                        objectFit: \"cover\",\n                        display: \"block\",\n                        borderRadius: \"6px\",\n                      }}\n                    />\n                  ) : (\n                    step.media?.content ?? null\n                  )}\n                </div>\n              </div>\n            );\n          })}\n        </div>\n\n        {/* Desktop Sticky Media Column (Pure CSS sticky layout) */}\n        <div\n          className=\"fb-sss-media-col\"\n          style={{\n            direction: \"ltr\",\n            border: \"1px solid var(--border, color-mix(in srgb, currentColor 20%, transparent))\",\n            backgroundColor: \"var(--card, transparent)\",\n          }}\n        >\n          {steps.map((step, idx) => {\n            const isVisible = activeStep === idx;\n            return (\n              <div\n                key={step.id}\n                className=\"fb-sss-media-slot\"\n                data-active={isVisible ? \"true\" : \"false\"}\n                style={{\n                  zIndex: isVisible ? 2 : 1,\n                }}\n              >\n                {step.media?.type === \"image\" && step.media?.src ? (\n                  <img\n                    src={step.media.src}\n                    alt={step.media.alt || step.title}\n                    style={{\n                      width: \"100%\",\n                      height: \"100%\",\n                      objectFit: \"cover\",\n                      display: \"block\",\n                    }}\n                  />\n                ) : (\n                  step.media?.content ?? null\n                )}\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </div>\n  );\n});\n\nStickyScrollStory.displayName = \"StickyScrollStory\";\n\nexport default StickyScrollStory;\n",
          "type": "registry:ui",
          "target": "components/ui/sticky-scroll-story.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "sticky-scroll-story",
          "version": "0.1.0",
          "summary": "scroll-section: Sticky media column with scrolling steps (dom, server-safe, CLS <= 0.01, reduced motion -> opacity-only (instant swap), mobile -> stacked)",
          "slot": "scroll-section",
          "kind": "dom"
        },
        "intent": {
          "useWhen": [
            "Editorial feature walk-throughs with accompanying media illustrations",
            "Product showcase stories highlighting sequential capabilities",
            "Multi-step walkthroughs where media changes as user reads through text"
          ],
          "avoidWhen": [
            "Short single-paragraph descriptions without multi-step progression",
            "Galleries where media should scroll freely rather than remain sticky",
            "Dense data tables and forms"
          ],
          "alternatives": [
            {
              "name": "scroll-reveal",
              "when": "When revealing standalone cards or sections without pinned media"
            }
          ]
        },
        "runtime": {
          "serverOutput": "static-layout",
          "clientOnly": false,
          "lazyLoaded": "no",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "none",
          "webglContexts": 0,
          "tiers": {
            "0": "Not gated by tier: sticky two-column layout above 768px, stacked at 768px and below (same at every tier)",
            "1": "Same as tier 0; layout depends on viewport width, not tier",
            "2": "Same as tier 0; layout depends on viewport width, not tier",
            "3": "Same as tier 0; layout depends on viewport width, not tier"
          },
          "reducedMotion": {
            "mode": "opacity-only",
            "description": "Media swaps are instant (inactive media is hidden with opacity 0 and transitions are disabled, so there is no fade); no translation or parallax. Server HTML keeps all media visible."
          },
          "input": {
            "pointer": "None; active step is driven solely by scroll position (IntersectionObserver)",
            "touch": "Stacked layout at viewport width 768px and below, with media shown inline under each step",
            "keyboard": "Native focus order and keyboard scrolling; the component adds no focusable elements"
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "not-needed",
          "wcag": [
            "1.3.1",
            "1.3.2",
            "2.2.2"
          ],
          "notes": "DOM order matches reading order. The active step has aria-current='step'. Image media (media.type 'image') gets alt from media.alt, falling back to the step title. Custom media (media.content) gets no alt: supply accessible text inside the content yourself. Each step's media is rendered twice (sticky column and inline mobile copy); only one is visible at a time."
        },
        "composition": {
          "maxPerPage": 2,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "smooth-scroll",
            "scroll-reveal",
            "text-reveal"
          ]
        },
        "props": [
          {
            "name": "steps",
            "type": "StoryStep[]",
            "default": null,
            "effect": "Required. Array of { id: string; title: string; description: string; badge?: string; media: { type?: \"image\" | \"custom\"; src?: string; alt?: string; content?: React.ReactNode } }."
          },
          {
            "name": "mediaPosition",
            "type": "\"left\" | \"right\"",
            "default": "right",
            "effect": "Alignment of the sticky media column relative to the text narrative."
          },
          {
            "name": "onStepChange",
            "type": "(stepId: string) => void",
            "default": null,
            "effect": "Optional. No default. Called with the step id when a step becomes active."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Stops tracking the scrolled step: the active step stays where it is."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "Optional CSP nonce forwarded to the internal scoped <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Optional CSS class names to apply to root container."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles for the root container."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root <div>."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/sticky-scroll-story",
          "usage": "import { StickyScrollStory, type StoryStep } from \"@/components/ui/sticky-scroll-story\";\n\nconst steps: StoryStep[] = [\n  {\n    id: \"step-1\",\n    title: \"Feature One\",\n    description: \"Detailed description of feature one.\",\n    media: { type: \"image\", src: \"/img1.webp\", alt: \"Feature 1 preview\" },\n  },\n];\n\nexport default function StorySection() {\n  return <StickyScrollStory steps={steps} />;\n}",
          "mistakes": [
            "Do not attach window scroll listeners to calculate sticky step progress; StickyScrollStory uses IntersectionObserver.",
            "Do not invert DOM order; reading order must match step sequence for assistive technology.",
            "media.alt is only used when media.type is 'image'; for custom media put accessible text inside media.content.",
            "The inactive-media hiding only applies under html[data-motion=\"ok\"] (MotionReadyScript in Next, initMotionReady() in Vite) or after hydration with reduced motion.",
            "Each step's media.content is rendered twice (sticky column and stacked mobile copy): no ids inside it. Step titles are h2 elements; put your section heading above them accordingly."
          ],
          "verify": [
            "Verify mobile layout (<= 768px) cleanly stacks steps and media without sticky jumps.",
            "Verify aria-current='step' updates as steps scroll through the viewport center.",
            "Verify CLS <= 0.01 during rapid scrolling."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "a294fec707b9115ffdffc7fecccd8518fcb9403c68744f11773b87677dabc91b",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 2.81,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "temper-slider",
      "type": "registry:ui",
      "title": "TemperSlider",
      "description": "control: Native range input across polished steel; the knob shows the oxide colour that forms at that temperature (canvas 2D, server-safe input)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/temper-slider/temper-slider.tsx",
          "content": "// Original — Frictionborn Motion TemperSlider (ported from the component lab, g2 · Temper Colour Slider)\n\"use client\";\n\nimport React, { useCallback, useRef, useState } from \"react\";\nimport { paletteVars, readPalette, useDrawLoop, useItemEnv, useItemRef, useLatest, type CanvasItemProps } from \"@frictionborn/runtime\";\nimport { markDrawn, css, stage } from \"@frictionborn/runtime/canvas\";\n\nexport interface TemperSliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\">, CanvasItemProps {\n  /** Controlled temperature in °C (180–360). */\n  value?: number;\n  /** Initial temperature when uncontrolled. */\n  defaultValue?: number;\n  onValueChange?: (celsius: number) => void;\n  /** Accessible name of the slider. */\n  label?: string;\n  step?: number;\n  disabled?: boolean;\n  ref?: React.Ref<HTMLDivElement>;\n}\n\nconst MIN = 180, MAX = 360;\n/** the oxide colours of tempered steel by temperature (°C), as in the lab */\nconst T: Array<[number, [number, number, number], string]> = [\n  [180, [196, 200, 206], \"Bright steel\"], [200, [232, 214, 160], \"Pale straw\"], [220, [222, 186, 110], \"Straw\"], [240, [196, 140, 60], \"Dark straw\"],\n  [255, [168, 96, 52], \"Bronze\"], [265, [140, 60, 70], \"Purple\"], [285, [70, 70, 160], \"Dark blue\"], [300, [70, 120, 200], \"Blue\"],\n  [330, [120, 150, 170], \"Grey blue\"], [360, [128, 132, 136], \"Grey\"],\n];\n/** the oxide colour and its name at v °C */\nfunction temperAt(v: number): [number[], string] {\n  for (let i = 1; i < T.length; i++)\n    if (v <= T[i][0]) {\n      const a = T[i - 1], b = T[i], f = (v - a[0]) / (b[0] - a[0]);\n      return [[0, 1, 2].map((j) => a[1][j] + (b[1][j] - a[1][j]) * f), f < 0.5 ? a[2] : b[2]];\n    }\n  return [T[T.length - 1][1], \"Grey\"];\n}\n\n/** the oxide colour, lightened just enough to read at 4.5:1 on the slider's near-black ground (WCAG 1.4.3) */\nfunction readable(c: number[]): number[] {\n  const lum = (x: number[]) => x.map((v) => { v /= 255; return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4; }).reduce((a, v, i) => a + v * [0.2126, 0.7152, 0.0722][i], 0);\n  let out = c;\n  for (let k = 0; k <= 1 && (lum(out) + 0.05) / 0.0545 < 4.5; k += 0.05) out = c.map((v) => v + (255 - v) * k);\n  return out;\n}\n\nexport function TemperSlider({ value, defaultValue = 250, onValueChange, label = \"Tempering temperature in degrees Celsius\", step = 1, disabled = false, palette = \"fire\", paused = false, maxTier = 3, nonce, className = \"\", style, ref, ...rest }: TemperSliderProps) {\n  const rootRef = useItemRef(ref);\n  const fxRef = useRef<HTMLDivElement>(null);\n  const [inner, setInner] = useState(defaultValue);\n  const v = Math.min(MAX, Math.max(MIN, value ?? inner));\n  const vRef = useLatest(v);\n  const focusRef = useRef(false);\n  const { hydrated, tier } = useItemEnv(maxTier);\n  const [col, name] = temperAt(v);\n\n  // the steel: the lab's g2 drawing. Nothing moves on its own, so every tier draws it; one frame per change\n  const wake = useDrawLoop(\n    fxRef,\n    (fx) => {\n      const root = rootRef.current;\n      if (!root) return null;\n      const s = stage(fx, tier >= 2 ? 3 : tier);\n      if (!s) return null;\n      const { d, c } = s;\n      const ring = palette === \"fire\" ? [232, 89, 12] : readPalette(root, palette)[2];\n      markDrawn(root, d);\n      c.onResize(() => draw());\n      function draw() {\n        const g = c!.g, x0 = 34, x1 = c!.w - 34, y = 78, val = vRef.current, focus = focusRef.current;\n        g.clearRect(0, 0, c!.w, c!.h);\n        g.font = \"500 11px 'Geist Mono', ui-monospace, monospace\";\n        for (let x = x0; x < x1; x += 2) {\n          const [cc] = temperAt(MIN + ((x - x0) / (x1 - x0)) * (MAX - MIN));\n          const sh = 0.82 + 0.18 * Math.sin(x * 0.9) * 0.3;\n          g.fillStyle = css(cc.map((q) => q * sh));\n          g.fillRect(x, y - 26, 2.2, 52);\n        }\n        const sh = g.createLinearGradient(0, y - 26, 0, y + 26);\n        sh.addColorStop(0, \"rgba(255,255,255,.35)\");\n        sh.addColorStop(0.3, \"rgba(255,255,255,0)\");\n        sh.addColorStop(0.7, \"rgba(0,0,0,.1)\");\n        sh.addColorStop(1, \"rgba(0,0,0,.45)\");\n        g.fillStyle = sh;\n        g.fillRect(x0, y - 26, x1 - x0, 52);\n        g.fillStyle = \"rgba(0,0,0,.3)\";\n        for (const tv of [200, 240, 280, 320]) {\n          const x = x0 + ((tv - MIN) / (MAX - MIN)) * (x1 - x0);\n          g.fillRect(x, y + 28, 1, 8);\n          g.fillStyle = \"#8a8580\";\n          g.fillText(tv + \"°\", x - 10, y + 50);\n          g.fillStyle = \"rgba(0,0,0,.3)\";\n        }\n        const X = x0 + ((val - MIN) / (MAX - MIN)) * (x1 - x0), [kc] = temperAt(val);\n        g.fillStyle = \"rgba(0,0,0,.45)\";\n        g.beginPath();\n        g.ellipse(X, y + 34, 16, 4, 0, 0, 7);\n        g.fill();\n        g.fillStyle = css(kc);\n        g.strokeStyle = focus ? css(ring) : \"#f2ede6\";\n        g.lineWidth = focus ? 3 : 2;\n        g.beginPath();\n        g.moveTo(X, y - 36);\n        g.lineTo(X + 12, y - 48);\n        g.lineTo(X - 12, y - 48);\n        g.closePath();\n        g.fill();\n        g.stroke();\n        g.beginPath();\n        g.moveTo(X, y - 28);\n        g.lineTo(X, y + 28);\n        g.stroke();\n      }\n      return {\n        tick() {\n          draw();\n          return false;\n        },\n        destroy: () => d.dispose(),\n      };\n    },\n    { enabled: hydrated, paused, key: `${tier}:${palette}` },\n  );\n\n  const onInput = useCallback(\n    (e: React.ChangeEvent<HTMLInputElement>) => {\n      const n = Number(e.target.value);\n      if (value === undefined) setInner(n);\n      onValueChange?.(n);\n      wake();\n    },\n    [value, onValueChange, wake],\n  );\n  const setFocus = (f: boolean) => {\n    focusRef.current = f;\n    wake();\n  };\n\n  return (\n    <div ref={rootRef} data-frictionborn-item=\"temper-slider\" data-tier={tier} className={`fb-temper-slider ${className}`} style={{ ...paletteVars(palette), ...style }} {...rest}>\n      <style nonce={nonce}>{`\n        .fb-temper-slider { position: relative; display: flex; flex-direction: column; padding: 24px 24px 22px; border-radius: 16px; background: #0c0b0a; color: #E9E5DF; }\n        .fb-ts-kick { font: 500 11px ui-monospace, \"Geist Mono\", monospace; letter-spacing: 0.12em; color: #8a8580; }\n        .fb-ts-stage { position: relative; height: 140px; margin: 0 -24px; }\n        .fb-ts-fx { position: absolute; inset: 0; pointer-events: none; }\n        .fb-ts-fx > canvas { position: absolute; inset: 0; display: block; }\n        .fb-ts-range { position: absolute; left: 24px; right: 24px; top: 56px; width: calc(100% - 48px); height: 44px; margin: 0; cursor: pointer; accent-color: var(--fb-heat-2, #E8590C); }\n        /* once the steel is drawn, the native range stays (focus, keys, pointer, screen readers) but paints nothing over it */\n        .fb-temper-slider[data-drawn] .fb-ts-range { -webkit-appearance: none; appearance: none; background: transparent; }\n        .fb-temper-slider[data-drawn] .fb-ts-range::-webkit-slider-runnable-track { background: transparent; border: 0; }\n        .fb-temper-slider[data-drawn] .fb-ts-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 44px; background: transparent; border: 0; }\n        .fb-temper-slider[data-drawn] .fb-ts-range::-moz-range-track { background: transparent; border: 0; }\n        .fb-temper-slider[data-drawn] .fb-ts-range::-moz-range-thumb { width: 28px; height: 44px; background: transparent; border: 0; }\n        .fb-ts-range:disabled { cursor: not-allowed; }\n        .fb-ts-range:focus-visible { outline: none; }\n        .fb-temper-slider:not([data-drawn]) .fb-ts-range:focus-visible { outline: 2px solid var(--ring, var(--fb-heat-2, #E8590C)); outline-offset: 2px; }\n        .fb-ts-out { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; }\n        .fb-ts-out b { font-weight: 600; font-size: 20px; }\n        .fb-ts-out span { font: 13px ui-monospace, \"Geist Mono\", monospace; }\n      `}</style>\n      <div className=\"fb-ts-kick\" aria-hidden=\"true\">TEMPER</div>\n      <div className=\"fb-ts-stage\">\n        <div ref={fxRef} className=\"fb-ts-fx\" aria-hidden=\"true\" />\n        <input\n          type=\"range\"\n          className=\"fb-ts-range\"\n          min={MIN}\n          max={MAX}\n          step={step}\n          value={v}\n          disabled={disabled}\n          aria-label={label}\n          aria-valuetext={`${v} degrees, ${name}`}\n          onChange={onInput}\n          onFocus={() => setFocus(true)}\n          onBlur={() => setFocus(false)}\n        />\n      </div>\n      <div className=\"fb-ts-out\" aria-hidden=\"true\">\n        <b style={{ color: css(readable(col)) }}>{name}</b>\n        <span>{v} °C</span>\n      </div>\n    </div>\n  );\n}\n\nexport default TemperSlider;\n",
          "type": "registry:ui",
          "target": "components/ui/temper-slider.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "temper-slider",
          "version": "0.1.0",
          "summary": "control: Native range input across polished steel; the knob shows the oxide colour that forms at that temperature (canvas 2D, server-safe input)",
          "slot": "control",
          "kind": "canvas"
        },
        "intent": {
          "useWhen": [
            "A temperature, intensity or heat setting where the value has a colour meaning",
            "A brand or product page about heat, metal or making"
          ],
          "avoidWhen": [
            "Generic numeric settings with no colour meaning (use the host's slider)",
            "Ranges outside 180-360 (the oxide scale is physical and fixed)"
          ],
          "alternatives": []
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "in-view",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "on-interaction",
          "webglContexts": 0,
          "tiers": {
            "0": "The same drawing: nothing moves on its own, so every tier draws one frame per change",
            "1": "Same",
            "2": "Same at DPR <= 2",
            "3": "Same at DPR <= 2"
          },
          "reducedMotion": {
            "mode": "still-frame",
            "description": "The steel and the knob are drawn once per change, as at every tier; nothing animates."
          },
          "input": {
            "pointer": "Drag along the steel (a real range input sits over the drawing)",
            "touch": "Drag",
            "keyboard": "Native range keys: arrows, PageUp/PageDown, Home, End; the knob outline turns hot when focused"
          }
        },
        "a11y": {
          "role": "interactive",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "via-runtime",
          "wcag": [
            "1.3.1",
            "1.4.3",
            "2.1.1",
            "2.4.7",
            "4.1.2"
          ],
          "notes": "A native <input type=range> with an accessible name and aria-valuetext (\"250 degrees, Bronze\"). Before the canvas mounts the input is visible; after, it sits transparent over the drawing. The oxide name is lightened only as needed to reach 4.5:1."
        },
        "composition": {
          "maxPerPage": 6,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "light-leak-tabs",
            "flame-switch"
          ]
        },
        "props": [
          {
            "name": "value",
            "type": "number",
            "default": null,
            "effect": "Controlled temperature in °C (clamped to 180-360)."
          },
          {
            "name": "defaultValue",
            "type": "number",
            "default": 250,
            "effect": "Initial temperature when uncontrolled."
          },
          {
            "name": "onValueChange",
            "type": "(celsius: number) => void",
            "default": null,
            "effect": "Called with the new temperature as the knob moves."
          },
          {
            "name": "label",
            "type": "string",
            "default": "Tempering temperature in degrees Celsius",
            "effect": "Accessible name of the slider."
          },
          {
            "name": "step",
            "type": "number",
            "default": 1,
            "effect": "Step of the range input."
          },
          {
            "name": "disabled",
            "type": "boolean",
            "default": false,
            "effect": "Disables the input."
          },
          {
            "name": "palette",
            "type": "\"fire\" | \"ice\" | \"neon\" | \"mono\" | \"custom\"",
            "default": "fire",
            "effect": "Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop: the effect stops drawing; the control keeps working."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "CSP nonce for the component's <style> element."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Inline styles on the root, merged after the palette variables."
          },
          {
            "name": "ref",
            "type": "React.Ref<HTMLDivElement>",
            "default": null,
            "effect": "Receives the root element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/temper-slider",
          "usage": "import { useState } from \"react\";\nimport { TemperSlider } from \"@/components/ui/temper-slider\";\n\nexport function Tempering() {\n  const [c, setC] = useState(250);\n  return <TemperSlider value={c} onValueChange={setC} />;\n}",
          "mistakes": [
            "The scale is fixed at 180-360 °C: it is a themed control, not a general slider.",
            "Give it at least 280 px of width so the tick labels fit.",
            "Use onValueChange (a number), not onChange."
          ],
          "verify": [
            "Server HTML has a visible native range input with its name.",
            "Arrow keys change the value and aria-valuetext names the colour.",
            "One frame is drawn per change; nothing runs while idle."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "99012b7",
          "treeClean": true,
          "resultsHash": "07538dcce16e27db11d6192937d290dbe9d271c0dd9ea83307248979eeb3f403",
          "date": "2026-10-20",
          "sizeKB": {
            "initial": 3.31,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0.0001,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-20",
              "notes": "16 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-20",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-20",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-20",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-20",
              "notes": "15 passed, 0 failed"
            }
          ]
        }
      }
    },
    {
      "$schema": "https://ui.shadcn.com/schema/registry-item.json",
      "name": "text-reveal",
      "type": "registry:ui",
      "title": "TextReveal",
      "description": "headline: word/line/char text reveal (dom, server-safe, SSR text stays static, reduced motion -> static, low-end mobile -> 40 ms stagger)",
      "dependencies": [
        "@frictionborn/runtime"
      ],
      "devDependencies": [],
      "registryDependencies": [],
      "files": [
        {
          "path": "registry/items/text-reveal/text-reveal.tsx",
          "content": "// Original — Frictionborn Motion TextReveal\n\"use client\";\n\nimport React, { useEffect, useRef, useState, useMemo, useId, useImperativeHandle } from \"react\";\nimport { useReducedMotion, useCapability, useHydrated } from \"@frictionborn/runtime\";\n\nexport interface TextRevealProps extends React.HTMLAttributes<HTMLElement> {\n  children: string;\n  as?: React.ElementType;\n  by?: \"word\" | \"character\" | \"line\";\n  delay?: number;\n  stagger?: number;\n  duration?: number;\n  className?: string;\n  style?: React.CSSProperties;\n  maxTier?: number;\n  replayKey?: string | number;\n  /**\n   * When true, halts animation and displays the full text in its final static state\n   * (unfragmented, fully visible) for clean static screenshots, debugging, or paused playback.\n   */\n  paused?: boolean;\n  nonce?: string;\n  ref?: React.Ref<HTMLElement | null>;\n}\n\ninterface CharacterToken {\n  char: string;\n  index: number;\n}\n\ninterface SegmentToken {\n  isSpace: boolean;\n  text: string;\n  chars: CharacterToken[];\n}\n\ninterface WordToken {\n  text: string;\n  isSpace: boolean;\n  index: number;\n}\n\nexport function TextReveal({\n  children,\n  as: Component = \"h1\",\n  by = \"word\",\n  delay = 0,\n  stagger = 60,\n  duration = 400,\n  className = \"\",\n  style,\n  maxTier = 3,\n  replayKey,\n  paused = false,\n  nonce,\n  ref,\n  ...rest\n}: TextRevealProps) {\n  const containerRef = useRef<HTMLElement>(null);\n  const id = useId();\n  const hydrated = useHydrated();\n  const prefersReduced = useReducedMotion();\n  const { tier: rawTier } = useCapability();\n  const tier = Math.min(rawTier, maxTier);\n\n  // Check if this component was pre-rendered in SSR HTML\n  const [isSsrInitial, setIsSsrInitial] = useState(() => {\n    if (typeof document !== \"undefined\") {\n      const el = document.getElementById(id);\n      return Boolean(el && el.getAttribute(\"data-ssr\") === \"true\");\n    }\n    return true;\n  });\n\n  // When replayKey changes, allow animated re-reveal even if initially SSR-rendered\n  const [prevReplayKey, setPrevReplayKey] = useState(replayKey);\n  if (prevReplayKey !== replayKey) {\n    setPrevReplayKey(replayKey);\n    setIsSsrInitial(false);\n  }\n\n  const isSsrPainted = isSsrInitial && replayKey === undefined;\n  const shouldAnimate = hydrated && !prefersReduced && !paused && tier > 0 && !isSsrPainted;\n\n  const [fontsLoaded, setFontsLoaded] = useState(() => {\n    if (typeof document === \"undefined\" || !(\"fonts\" in document)) return true;\n    return document.fonts.status === \"loaded\";\n  });\n  const [containerWidth, setContainerWidth] = useState(0);\n\n  // Wait for web fonts before measuring layout for line splitting\n  useEffect(() => {\n    if (typeof document !== \"undefined\" && \"fonts\" in document && document.fonts.status !== \"loaded\") {\n      document.fonts.ready.then(() => setFontsLoaded(true)).catch(() => setFontsLoaded(true));\n    }\n  }, []);\n\n  // Track container width for line re-splitting\n  useEffect(() => {\n    const el = containerRef.current;\n    if (!el || typeof ResizeObserver === \"undefined\") return;\n\n    const ro = new ResizeObserver((entries) => {\n      for (const entry of entries) {\n        setContainerWidth(entry.contentRect.width);\n      }\n    });\n\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, [hydrated]);\n\n  // Adjust stagger on mobile / tier 1\n  const effectiveStagger = tier <= 1 ? Math.min(stagger, 40) : stagger;\n\n  // Split text into character segment tokens\n  const characterTokens = useMemo<SegmentToken[]>(() => {\n    if (by !== \"character\" || !children || typeof children !== \"string\") return [];\n    const wordsList = children.split(/(\\s+)/);\n    let charIndex = 0;\n    return wordsList.map((segment) => {\n      if (/^\\s+$/.test(segment)) {\n        return { isSpace: true, text: segment, chars: [] };\n      }\n      const chars = Array.from(segment).map((ch) => ({\n        char: ch,\n        index: charIndex++,\n      }));\n      return { isSpace: false, text: segment, chars };\n    });\n  }, [children, by]);\n\n  // Split text into word tokens\n  const wordTokens = useMemo<WordToken[]>(() => {\n    if (by === \"character\" || !children || typeof children !== \"string\") return [];\n    const rawTokens = children.split(/(\\s+)/);\n    let wordIndex = 0;\n    return rawTokens.map((tok) => {\n      const isSpace = /^\\s+$/.test(tok);\n      return {\n        text: tok,\n        isSpace,\n        index: isSpace ? -1 : wordIndex++,\n      };\n    });\n  }, [children, by]);\n\n  // Words only (no whitespace tokens): line groups index into this list\n  const words = useMemo(() => wordTokens.filter((t) => !t.isSpace), [wordTokens]);\n\n  // Line splitting after fonts load\n  const [lineGroups, setLineGroups] = useState<number[][]>([]);\n  const [lineGroupKey, setLineGroupKey] = useState(\"\");\n  const currentLineKey = `${by}:${containerWidth}:${children}:${String(replayKey ?? \"\")}`;\n  if (by === \"line\" && lineGroupKey !== currentLineKey) {\n    setLineGroupKey(currentLineKey);\n    setLineGroups([]);\n  }\n\n  useEffect(() => {\n    if (by !== \"line\" || !fontsLoaded || lineGroups.length > 0 || !containerRef.current) return;\n    const wordElements = containerRef.current.querySelectorAll<HTMLElement>(\"[data-tr-word]\");\n    if (wordElements.length === 0) return;\n\n    const lines: number[][] = [];\n    let currentLine: number[] = [];\n    let currentTop = -1;\n\n    wordElements.forEach((el, idx) => {\n      const top = el.offsetTop;\n      if (currentTop === -1 || Math.abs(top - currentTop) < 4) {\n        currentLine.push(idx);\n        currentTop = top;\n      } else {\n        lines.push(currentLine);\n        currentLine = [idx];\n        currentTop = top;\n      }\n    });\n    if (currentLine.length > 0) lines.push(currentLine);\n    setLineGroups(lines);\n  }, [by, fontsLoaded, lineGroups.length, children, replayKey]);\n\n  useImperativeHandle(ref, () => containerRef.current!, []);\n\n  return (\n    <Component\n      ref={containerRef}\n      id={id}\n      data-frictionborn-item=\"text-reveal\"\n      data-ssr={!hydrated ? \"true\" : undefined}\n      data-tier={tier}\n      className={`fb-text-reveal ${className}`}\n      style={{\n        position: \"relative\",\n        display: \"block\",\n        ...style,\n      }}\n      {...rest}\n    >\n      <style nonce={nonce}>{`\n        [data-motion=\"ok\"] .fb-tr-token {\n          display: inline-block;\n          opacity: 0;\n          transform: translateY(var(--fb-distance, 20px));\n          animation: fb-tr-fade-up var(--fb-tr-dur, 400ms) cubic-bezier(0.22, 1, 0.36, 1) forwards;\n          animation-delay: var(--fb-tr-del, 0ms);\n          will-change: transform, opacity;\n        }\n        @media (prefers-reduced-motion: reduce) {\n          [data-motion=\"ok\"] .fb-tr-token {\n            opacity: 1 !important;\n            transform: none !important;\n            animation: none !important;\n          }\n        }\n        @keyframes fb-tr-fade-up {\n          from {\n            opacity: 0;\n            transform: translateY(var(--fb-distance, 20px));\n          }\n          to {\n            opacity: 1;\n            transform: translateY(0);\n          }\n        }\n      `}</style>\n\n      {/* Screen reader unfragmented text */}\n      <span\n        style={{\n          position: \"absolute\",\n          width: \"1px\",\n          height: \"1px\",\n          padding: 0,\n          margin: \"-1px\",\n          overflow: \"hidden\",\n          clip: \"rect(0, 0, 0, 0)\",\n          whiteSpace: \"nowrap\",\n          border: 0,\n        }}\n      >\n        {children}\n      </span>\n\n      {/* Visual content: static in SSR/reduced motion, split tokens when animated */}\n      {!shouldAnimate ? (\n        <span aria-hidden=\"true\">{children}</span>\n      ) : (\n        <span aria-hidden=\"true\" key={String(replayKey ?? \"default\")}>\n          {by === \"character\" &&\n            characterTokens.map((group, gIdx) =>\n              group.isSpace ? (\n                <span key={gIdx}>{group.text}</span>\n              ) : (\n                <span key={gIdx} style={{ display: \"inline-block\", whiteSpace: \"nowrap\" }}>\n                  {group.chars.map((c) => (\n                    <span\n                      key={c.index}\n                      className=\"fb-tr-token\"\n                      style={\n                        {\n                          \"--fb-tr-dur\": `${duration}ms`,\n                          \"--fb-tr-del\": `${delay + c.index * effectiveStagger}ms`,\n                        } as React.CSSProperties\n                      }\n                    >\n                      {c.char}\n                    </span>\n                  ))}\n                </span>\n              )\n            )}\n\n          {by === \"word\" &&\n            wordTokens.map((token, idx) =>\n              token.isSpace ? (\n                <span key={idx}>{token.text}</span>\n              ) : (\n                <span\n                  key={idx}\n                  className=\"fb-tr-token\"\n                  style={\n                    {\n                      \"--fb-tr-dur\": `${duration}ms`,\n                      \"--fb-tr-del\": `${delay + token.index * effectiveStagger}ms`,\n                    } as React.CSSProperties\n                  }\n                >\n                  {token.text}\n                </span>\n              )\n            )}\n\n          {by === \"line\" && (\n            <span style={{ display: \"block\" }}>\n              {lineGroups.length === 0\n                ? wordTokens.map((token, idx) => (\n                    <span\n                      key={idx}\n                      data-tr-word={!token.isSpace ? \"true\" : undefined}\n                      style={{ display: \"inline-block\" }}\n                    >\n                      {token.text}\n                    </span>\n                  ))\n                : lineGroups.map((indices, lineIdx) => (\n                    <span\n                      key={lineIdx}\n                      style={{\n                        display: \"block\",\n                        overflow: \"hidden\",\n                      }}\n                    >\n                      <span\n                        className=\"fb-tr-token\"\n                        style={\n                          {\n                            display: \"inline-block\",\n                            \"--fb-tr-dur\": `${duration}ms`,\n                            \"--fb-tr-del\": `${delay + lineIdx * (effectiveStagger * 1.5)}ms`,\n                          } as React.CSSProperties\n                        }\n                      >\n                        {indices.map((wIdx) => words[wIdx]?.text).join(\" \")}\n                      </span>\n                    </span>\n                  ))}\n            </span>\n          )}\n        </span>\n      )}\n    </Component>\n  );\n}\n\nexport default TextReveal;\n",
          "type": "registry:ui",
          "target": "components/ui/text-reveal.tsx"
        }
      ],
      "meta": {
        "schemaVersion": "0.1",
        "item": {
          "name": "text-reveal",
          "version": "0.1.0",
          "summary": "headline: word/line/char text reveal (dom, server-safe, SSR text stays static, reduced motion -> static, low-end mobile -> 40 ms stagger)",
          "slot": "headline",
          "kind": "dom"
        },
        "intent": {
          "useWhen": [
            "Hero headlines and section titles requiring editorial typographic reveals",
            "Marketing landing pages with high-signal opening statements",
            "Feature headings that need stepped entrance animations"
          ],
          "avoidWhen": [
            "Long paragraphs or running prose (> 2 lines of body text)",
            "Frequently updating real-time data or tickers",
            "Forms and interactive controls"
          ],
          "alternatives": [
            {
              "name": "scroll-reveal",
              "when": "When revealing whole blocks, cards, or media rather than individual text tokens"
            }
          ]
        },
        "runtime": {
          "serverOutput": "final-state",
          "clientOnly": false,
          "lazyLoaded": "no",
          "requires": {
            "react": ">=19",
            "frameworks": [
              "next-app-router",
              "vite-react"
            ],
            "tailwind": "none"
          }
        },
        "dependencies": {
          "npm": [],
          "registry": []
        },
        "behavior": {
          "loop": "none",
          "webglContexts": 0,
          "tiers": {
            "0": "Plain static text, no splitting (server render, prefers-reduced-motion, Save-Data, or no WebGL2)",
            "1": "Animated reveal with the stagger capped at 40 ms (coarse pointer with low-end hints)",
            "2": "Animated reveal with the configured stagger (60 ms by default)",
            "3": "Same as tier 2; the `by` mode (word, character, line) is honoured at every animated tier"
          },
          "reducedMotion": {
            "mode": "static",
            "description": "Renders plain static text without splitting or animations."
          },
          "input": {
            "pointer": "None. The reveal plays once when the component mounts on the client (for example in a Vite SPA or after client-side navigation) or when replayKey changes. A server-rendered instance is painted as static final text and does not animate unless replayKey is set.",
            "touch": "Same as pointer; the stagger is capped at 40 ms only on tier 1 and tier 0 devices",
            "keyboard": "None; the text is not focusable. It stays selectable. Screen readers read a visually hidden copy of the full text; the animated tokens are aria-hidden."
          }
        },
        "a11y": {
          "role": "content",
          "hiddenFromAT": false,
          "textStaysInDom": true,
          "pauseControl": "not-needed",
          "wcag": [
            "1.3.1",
            "1.4.3",
            "2.2.2"
          ],
          "notes": "Original text is preserved in a visually-hidden span while animated tokens are marked aria-hidden='true', ensuring screen readers never read fragmented letters or words."
        },
        "composition": {
          "maxPerPage": 5,
          "singleton": false,
          "conflictsWith": [],
          "pairsWith": [
            "noise-field",
            "magnetic-button",
            "ambient-hero"
          ]
        },
        "props": [
          {
            "name": "children",
            "type": "string",
            "default": null,
            "effect": "Required. Plain text string to split and reveal (not JSX)."
          },
          {
            "name": "as",
            "type": "React.ElementType",
            "default": "h1",
            "effect": "HTML tag to render as root container."
          },
          {
            "name": "by",
            "type": "\"word\" | \"character\" | \"line\"",
            "default": "word",
            "effect": "Token granularity for entrance stagger."
          },
          {
            "name": "delay",
            "type": "number",
            "default": 0,
            "effect": "Initial delay in ms before animation begins."
          },
          {
            "name": "stagger",
            "type": "number",
            "default": 60,
            "effect": "Delay in ms between subsequent token animations. Capped at 40 ms when the tier is 1 or lower."
          },
          {
            "name": "duration",
            "type": "number",
            "default": 400,
            "effect": "Duration in ms for each token entrance."
          },
          {
            "name": "className",
            "type": "string",
            "default": "",
            "effect": "Extra classes on the root element (the built-in class fb-text-reveal is kept)."
          },
          {
            "name": "style",
            "type": "React.CSSProperties",
            "default": null,
            "effect": "Optional. No default. Inline styles on the root element, merged after position: relative and display: block (consumer wins)."
          },
          {
            "name": "ref",
            "type": "React.Ref<any>",
            "default": null,
            "effect": "Receives the root element chosen by `as` (it also contains the scoped <style> and a screen-reader copy of the text)."
          },
          {
            "name": "maxTier",
            "type": "number",
            "default": 3,
            "effect": "Hard ceiling on the capability tier."
          },
          {
            "name": "replayKey",
            "type": "string | number",
            "default": null,
            "effect": "Optional. No default. When set (or changed), the entrance animation plays after hydration even for a server-rendered instance."
          },
          {
            "name": "paused",
            "type": "boolean",
            "default": false,
            "effect": "Universal pause prop. Renders plain static text instead of the animated tokens; un-pausing replays the reveal from the start (it does not freeze mid-animation)."
          },
          {
            "name": "nonce",
            "type": "string",
            "default": null,
            "effect": "Optional CSP nonce forwarded to the internal scoped <style> element."
          }
        ],
        "agent": {
          "install": "npx shadcn@4.21.1 add @frictionborn/text-reveal",
          "usage": "import { TextReveal } from \"@/components/ui/text-reveal\";\n\nexport default function HeroHeadline() {\n  return (\n    <TextReveal as=\"h1\" by=\"word\" className=\"text-4xl font-bold tracking-tight\">\n      Engineered Motion for High-Signal Interfaces\n    </TextReveal>\n  );\n}",
          "mistakes": [
            "Do not pass complex React elements or JSX as children; TextReveal expects a text string to tokenize.",
            "Do not hide text with opacity: 0 before hydration; the component handles static visibility safely.",
            "A server-rendered TextReveal is painted as final static text and does not animate unless replayKey is set; do not expect a reveal on a Next.js server-rendered hero without it.",
            "Other props (data-*, aria-*, handlers) are spread on the root element; do not pass your own id (the component uses its own to detect a server render).",
            "The reveal styles apply only when <html> has data-motion=\"ok\" (MotionReadyScript in Next, initMotionReady() in Vite)."
          ],
          "verify": [
            "Verify full headline text is present in server HTML before JavaScript executes.",
            "Verify screen reader reads text as a single coherent sentence without letter-by-letter pauses.",
            "Verify reduced motion produces immediate static text with zero rAF cycles."
          ]
        },
        "license": {
          "code": "MIT",
          "derivedFrom": [],
          "notices": [],
          "assets": []
        },
        "measured": {
          "commit": "ffd0225",
          "treeClean": true,
          "resultsHash": "e9a175dc21014d82fc650560dc559dee14ca0676048990e5eec812b4d79d6363",
          "date": "2026-10-21",
          "sizeKB": {
            "initial": 3.12,
            "deferred": 0.02,
            "method": "gzip-9"
          },
          "cls": 0,
          "framesWhenIdle": {
            "offscreen": 0,
            "hiddenTab": 0,
            "reducedMotion": 0
          },
          "axe": {
            "serious": 0,
            "critical": 0
          },
          "devices": [
            {
              "env": "Chromium Desktop (SwiftShader)",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "15 passed, 0 failed"
            },
            {
              "env": "Chromium Mobile (Pixel 7 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "Firefox Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Desktop",
              "via": "playwright",
              "tier": 3,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            },
            {
              "env": "WebKit Mobile (iPhone 14 emulation)",
              "via": "playwright",
              "tier": 2,
              "result": "pass",
              "date": "2026-10-21",
              "notes": "14 passed, 0 failed"
            }
          ]
        }
      }
    }
  ]
}
