{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "background-text-branch-canopy",
  "title": "Background Text Branch Canopy",
  "description": "A full-bleed ambient background where an L-system tree grows entirely out of readable text: every limb is one run of words drawn with a single fillText, pivoting on its own foot as it angles from its parent, with the outer canopy senescing and regrowing forever so it never settles into a finished frame.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/loud/background-text-branch-canopy/component.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport type { CSSProperties } from \"react\";\n\n// ---------------------------------------------------------------------------\n// BackgroundTextBranchCanopy — a full-bleed ambient background where TEXT IS\n// THE LIMB, not a texture on one. An L-system tree grows in Canvas 2D, but\n// every branch is drawn with exactly one `ctx.fillText()` call after\n// `translate(foot)` + `rotate(limbAngle)` — a run of readable words from\n// `text`, windowed to that limb's length, set as a rigid body pivoting on\n// its own foot (the joint it grows from) as it angles away from its parent.\n// There is no per-character grid and no glyph-per-cell loop anywhere in this\n// file: the primitive is a run of legible words placed as geometry, not a\n// raster stand-in for luminance.\n//\n// WHY THIS IS NOT A RESTYLE OF EITHER NEIGHBORING FAMILY —\n//   vs. background-ascii-plasma / hero-ascii-* / text-ascii-cascade: those\n//   quantize a scalar field onto a FIXED CHARACTER GRID, one glyph per cell,\n//   chosen by density/luminance — the character is a stand-in pixel and\n//   reads as meaningless. Nothing here is gridded and no character is chosen\n//   by density; the alphabet is real words from `text`, unbroken, upright,\n//   and spaced exactly as typed.\n//   vs. tendril-cast / auxin-canal / tree-root-trace / cambium-lay: those\n//   grow STROKES — an SVG `<path>` (tendril-cast, tree-root-trace) or a\n//   filled ring boundary (cambium-lay) that is textured or colored\n//   afterward. This grows TEXT STRIPS: the geometric primitive painted per\n//   limb is `fillText`, never a `stroke()`/path `d` at all. A stroke can be\n//   drawn at any width without changing its meaning; a limb here stops\n//   existing as a limb the moment its word run would clip below a few\n//   readable characters (see LIMB BUDGET) — the text isn't dressing on a\n//   line, the text's own legibility is the constraint that shapes the tree.\n//\n// LIMB BUDGET, DERIVED FROM READABILITY, NOT THE REVERSE. Trunk length\n// L0 = 0.28 * min(container w, h); each generation's length is L0 * 0.72^d.\n// Type size is picked ONCE from the container (9-15px, clamped from\n// min-dimension * 0.022) and never shrinks with depth — recession is\n// expressed as fewer words and lower alpha, never smaller glyphs, because a\n// depth ramp that shrinks type is exactly the ASCII family's \"raster\n// stand-in\" failure mode reintroduced through the back door. A generation\n// stops recursing once its own length can no longer hold ~4 monospace\n// characters (measured, not guessed) — that per-size arithmetic is the\n// entire depth ceiling; see the readme block above `buildTopology`.\n//\n// PIVOT ON THE FOOT: draw-time places `ctx.translate` at the limb's OWN\n// foot (where it grows from its parent's tip), rotates to the limb's\n// absolute angle, and fillText's from local (0,0) — the run is anchored at\n// the joint and extends toward the tip, upright. Any limb whose absolute\n// angle points generally leftward (cos < 0) is drawn from `angle + PI` with\n// `textAlign: \"right\"` instead of `\"left\"` — same physical span from the\n// same foot, still upright, never mirrored/upside-down text.\n//\n// ALIVE FOREVER, TWO STRUCTURAL CHANNELS, NOT A GROW-ONCE-AND-STOP TIMER:\n//   (1) Turnover. Only the outer canopy (depth >= CHURN_DEPTH) ages and\n//       senesces: each churning limb owns its own randomized lifespan: on\n//       expiry it eases its length down to a stub over SENESCE_MS while its\n//       alpha fades further, then regrows from the same foot with a fresh\n//       word offset and a new lifespan. The trunk and first branch level\n//       never senesce, so the crown's skeleton holds while its outer growth\n//       continually sheds and replaces itself — this is what keeps the\n//       canopy from ever reaching a single finished, static frame.\n//   (2) Sway. Every limb's absolute angle carries `swayAmp(depth) *\n//       sin(t*swayFreq(depth) + phase)` on top of its angle from its\n//       parent, and because the tree is walked parent-before-child every\n//       frame, a child's absolute angle already includes its parent's sway\n//       — the wobble composes down the chain instead of jittering\n//       independently per limb, which is what reads as one breathing crown\n//       instead of noise.\n// Both are on unconditionally, not gated behind hover/pointer — this is a\n// resting-state background.\n//\n// CONTENT PROTECTION: the canopy is deliberately origin-biased toward the\n// right two-thirds of the frame (trunk foot sits right-of-center, growing\n// generally straight up with symmetric spread), and a CSS scrim (a\n// `--background`-tinted linear gradient, strongest at the bottom edge) sits\n// above the canvas so a headline/CTA docked bottom-LEFT — the zone the demo\n// actually uses — has a real reading surface under it rather than fighting a\n// full crown of words. Trunk bias alone is not enough (the crown still\n// reaches the lower third at deep containers), so both are required\n// together. (Previously biased upper-LEFT, which planted the trunk foot\n// directly inside the bottom-left content block's own bounding box — the\n// bias existed but pointed at the wrong corner; a worst-case-spread\n// simulation at 1440x900 confirmed the corrected bias keeps every limb's\n// ink to the right of the content block with margin to spare.)\n//\n// TOKENS: --foreground for the inner ~40% of depth (near, heaviest),\n// --ns-muted for the rest (receding), with alpha itself also stepping down\n// by depth on top of that — so the near/far read holds by VALUE in both\n// themes without any luminance comparison or hue math, the same guarantee\n// dye-whorl/weld-pool get from a luminance ramp, bought here for free by\n// just compositing a token color at lower alpha over `--background`.\n// `--ns-accent` never appears — this is a resting background, not\n// interaction chrome. Canvas 2D fillStyle cannot take a raw `var(--x)`\n// string, so both tokens are read via getComputedStyle at mount and\n// re-read on a MutationObserver watching documentElement's class, same as\n// every other canvas-hosted showpiece in this registry.\n//\n// PERFORMANCE: default hero-sized container (~1200x800) settles at ~60-65\n// limbs (2 primary trunks off one stub, capped generation depth 5-6 by the\n// readability rule above); a large full-bleed container can grow to the\n// hard ceiling of 150 limbs (LIMB_BUDGET). 150 `fillText` calls/frame is\n// negligible next to the clear+composite of a full-bleed canvas, which is\n// the actual per-frame cost here — DPR is capped at 2 (1.5 blurs 10px mono\n// past legibility), 0.6 inside an autoplay card (registry\n// convention, `[data-autoplay-root]`), and the render loop pauses on\n// `visibilitychange` and via `IntersectionObserver` when scrolled offscreen.\n//\n// SMALLEST READABLE SIZE: at a 320px min-dimension (L0=90px, font 9px,\n// cellW ~5.4px), a first-generation limb (length ~65px) still holds a full\n// short word plus a partial second word (~12 chars) — readable. By the\n// third generation (length ~34px) a limb holds one short word only; the\n// component simply stops generating a fourth generation at that size\n// (MIN_LIMB_PX gate) rather than shipping unreadable text, so the crown is\n// shallower, not smaller-lettered, on small containers.\n// ---------------------------------------------------------------------------\n\ninterface Limb {\n  parent: number; // -1 for the trunk stub\n  depth: number;\n  relAngle: number; // angle contributed relative to the parent's absolute angle (trunk: absolute)\n  lenFull: number; // fully-grown length in px\n  churns: boolean; // true once depth >= CHURN_DEPTH — only churning limbs senesce/regrow\n  swayAmp: number;\n  swayFreq: number;\n  swayPhase: number;\n  wordStart: number;\n  lifespan: number;\n  // live simulation state\n  state: \"growing\" | \"mature\" | \"senescing\";\n  growProgress: number; // 0..1, eased length fraction\n  age: number; // ms since last (re)birth, mature-phase clock\n  senesceT: number; // 0..1 progress through the senescence ease\n  // per-frame computed geometry (written during the draw-time tree walk)\n  footX: number;\n  footY: number;\n  tipX: number;\n  tipY: number;\n  absAngle: number;\n}\n\nconst GROW_MS = 2200; // ms for one limb to ease from stub to full length\nconst CHILD_START_FRAC = 0.55; // a limb's children begin growing once it is this far along — the natural stagger, no separate timer needed\nconst CHURN_DEPTH = 2; // trunk + first branch level (depth 0-1) never senesce, keeping the crown's skeleton stable\nconst SENESCE_MS = 1500;\nconst SHRINK_FLOOR = 0.22; // a senescing limb eases down to this fraction of full length, never to zero (a visible stub, not a pop)\nconst LIFESPAN_MIN = 7000;\nconst LIFESPAN_MAX = 15000;\nconst RATIO = 0.72; // per-generation length ratio\nconst HARD_MAX_DEPTH = 6;\nconst MIN_RUN_CHARS = 4; // a generation stops once its length can't hold this many monospace chars\nconst LIMB_BUDGET = 150; // hard ceiling on total limbs regardless of container size\nconst STEP_MS = 1000 / 30; // fixed 30Hz simulation tick, matches the registry's other growth components\nconst PREWARM_MS = 9000; // fast-forwarded synchronously before first paint so t=0 shows a full crown, not a bare stub (tendril-cast's PREWARM_TICKS pattern)\nconst REDUCED_FREEZE_MS = 16000; // fast-forwarded for prefers-reduced-motion: past first full maturation and into steady churn, so the frozen frame shows varied limb depths/ages, not a single freshly-completed tree\nconst MAX_REDUCED_TICKS = 6000;\n\nfunction mulberry32(seed: number) {\n  let a = seed >>> 0;\n  return () => {\n    a = (a + 0x6d2b79f5) >>> 0;\n    let t = a;\n    t = Math.imul(t ^ (t >>> 15), t | 1);\n    t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n  };\n}\n\nfunction makeLimb(\n  parent: number,\n  depth: number,\n  relAngle: number,\n  lenFull: number,\n  rand: () => number,\n  wordCount: number\n): Limb {\n  const churns = depth >= CHURN_DEPTH;\n  return {\n    parent,\n    depth,\n    relAngle,\n    lenFull,\n    churns,\n    swayAmp: Math.min(0.09, 0.015 + depth * 0.01),\n    swayFreq: 0.00015 + depth * 0.00004 + rand() * 0.00006,\n    swayPhase: rand() * Math.PI * 2,\n    wordStart: wordCount > 0 ? Math.floor(rand() * wordCount) : 0,\n    lifespan: LIFESPAN_MIN + rand() * (LIFESPAN_MAX - LIFESPAN_MIN),\n    state: \"growing\",\n    growProgress: 0,\n    age: 0,\n    senesceT: 0,\n    footX: 0,\n    footY: 0,\n    tipX: 0,\n    tipY: 0,\n    absAngle: 0,\n  };\n}\n\n// Builds the fixed topology (parent links, relative angles, full lengths) for\n// a container of the given size. Depth ceiling is derived from readability —\n// a generation is only added once its length can hold MIN_RUN_CHARS at the\n// container's own type size — not picked as an arbitrary constant, per the\n// file header. Two primary trunks off one short stub give the crown width to\n// actually fill a wide frame instead of reading as a single spike.\nfunction buildTopology(w: number, h: number, cellW: number, rand: () => number, wordCount: number): Limb[] {\n  const minDim = Math.min(w, h);\n  const L0 = Math.max(24, minDim * 0.28);\n  const minLimbPx = cellW * MIN_RUN_CHARS;\n  const limbs: Limb[] = [];\n\n  const stub = makeLimb(-1, 0, -Math.PI / 2, L0 * 0.4, rand, wordCount);\n  limbs.push(stub);\n\n  const spawn = (parentIdx: number, depth: number, relAngle: number, lenFull: number) => {\n    if (limbs.length >= LIMB_BUDGET) return;\n    if (depth > HARD_MAX_DEPTH) return;\n    const idx = limbs.length;\n    limbs.push(makeLimb(parentIdx, depth, relAngle, lenFull, rand, wordCount));\n    const nextLen = lenFull * RATIO;\n    if (nextLen < minLimbPx || depth >= HARD_MAX_DEPTH) return;\n    const spread = 0.34 + depth * 0.05 + rand() * 0.08;\n    const jitter = () => (rand() - 0.5) * 0.12;\n    spawn(idx, depth + 1, -spread + jitter(), nextLen);\n    spawn(idx, depth + 1, spread + jitter(), nextLen);\n  };\n\n  const primaryLen = L0 * RATIO;\n  if (primaryLen >= minLimbPx) {\n    spawn(0, 1, -0.3 + (rand() - 0.5) * 0.1, primaryLen);\n    spawn(0, 1, 0.3 + (rand() - 0.5) * 0.1, primaryLen);\n  }\n\n  return limbs;\n}\n\nfunction rebirth(limb: Limb, rand: () => number, wordCount: number): void {\n  limb.state = \"growing\";\n  limb.growProgress = 0;\n  limb.age = 0;\n  limb.senesceT = 0;\n  limb.wordStart = wordCount > 0 ? Math.floor(rand() * wordCount) : 0;\n  limb.lifespan = LIFESPAN_MIN + rand() * (LIFESPAN_MAX - LIFESPAN_MIN);\n}\n\nfunction tick(limb: Limb, dt: number, rand: () => number, wordCount: number, parentReady: boolean): void {\n  if (!parentReady) return; // children wait for the parent to clear CHILD_START_FRAC — see the walk in draw()\n  switch (limb.state) {\n    case \"growing\": {\n      limb.growProgress = Math.min(1, limb.growProgress + dt / GROW_MS);\n      if (limb.growProgress >= 1) {\n        limb.state = \"mature\";\n        limb.age = 0;\n      }\n      return;\n    }\n    case \"mature\": {\n      limb.age += dt;\n      if (limb.churns && limb.age > limb.lifespan) {\n        limb.state = \"senescing\";\n        limb.senesceT = 0;\n      }\n      return;\n    }\n    case \"senescing\": {\n      limb.senesceT = Math.min(1, limb.senesceT + dt / SENESCE_MS);\n      if (limb.senesceT >= 1) rebirth(limb, rand, wordCount);\n      return;\n    }\n  }\n}\n\nfunction buildRun(words: string[], startIdx: number, maxChars: number): string {\n  if (words.length === 0 || maxChars < 1) return \"\";\n  let out = \"\";\n  let i = startIdx;\n  for (let guard = 0; guard < 40; guard++) {\n    const w = words[i % words.length]!;\n    const candidate = out.length === 0 ? w : `${out} ${w}`;\n    if (out.length > 0 && candidate.length > maxChars) break;\n    out = candidate;\n    i++;\n    if (out.length >= maxChars) break;\n  }\n  return out;\n}\n\nconst DEFAULT_TEXT =\n  \"growth begins as a single word and forks into every branch it can still afford to reach light finds its way through language turning each fork into a fresh sentence rooted in the last\";\n\nexport interface BackgroundTextBranchCanopyProps {\n  /** source text whose words run along each limb, windowed to fit and cycled per limb as the canopy grows and turns over. */\n  text?: string;\n  /** extra classes merged onto the rendered root element */\n  className?: string;\n  /** inline styles merged onto the root element */\n  style?: CSSProperties;\n}\n\nexport function BackgroundTextBranchCanopy({ text = DEFAULT_TEXT, className = \"\", style }: BackgroundTextBranchCanopyProps) {\n  const canvasRef = useRef<HTMLCanvasElement>(null);\n\n  useEffect(() => {\n    const canvas = canvasRef.current;\n    if (!canvas) return;\n    const ctx = canvas.getContext(\"2d\");\n    if (!ctx) return;\n\n    const words = text.trim().split(/\\s+/).filter(Boolean);\n    const rand = mulberry32(0x9a5c0de1);\n\n    let disposed = false;\n    let raf = 0;\n    let last = 0;\n    let acc = 0;\n    let simTime = 0;\n    let visible = true;\n    let paused = false;\n\n    let dpr = 1;\n    let w = 0;\n    let h = 0;\n    let cellW = 8; // refined after document.fonts.ready via offscreen measureText\n    let fontSize = 12;\n    let fgCss = \"\";\n    let mutedCss = \"\";\n    let limbs: Limb[] = [];\n\n    const readTokens = () => {\n      fgCss = getComputedStyle(canvas).color;\n      const root = getComputedStyle(document.documentElement);\n      mutedCss = root.getPropertyValue(\"--ns-muted\").trim() || fgCss;\n    };\n\n    const measureCell = (fontFamily: string) => {\n      const off = document.createElement(\"canvas\");\n      const octx = off.getContext(\"2d\");\n      if (!octx) return;\n      octx.font = `${fontSize}px ${fontFamily}`;\n      cellW = Math.max(3, octx.measureText(\"MMMMMMMMMM\").width / 10);\n    };\n\n    const rebuild = () => {\n      const minDim = Math.min(w, h);\n      fontSize = Math.min(15, Math.max(9, minDim * 0.022));\n      const fontFamily = getComputedStyle(canvas).fontFamily;\n      measureCell(fontFamily);\n      ctx.font = `${fontSize}px ${fontFamily}`;\n      limbs = buildTopology(w, h, cellW, rand, words.length);\n    };\n\n    const resize = () => {\n      const rect = canvas.getBoundingClientRect();\n      if (rect.width < 2 || rect.height < 2) return;\n      const isCard = !!canvas.closest(\"[data-autoplay-root]\");\n      dpr = isCard ? Math.min(0.6, window.devicePixelRatio || 1) : Math.min(window.devicePixelRatio || 1, 2);\n      w = rect.width;\n      h = rect.height;\n      canvas.width = Math.max(1, Math.round(w * dpr));\n      canvas.height = Math.max(1, Math.round(h * dpr));\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      rebuild();\n    };\n\n    const stepAll = (dt: number) => {\n      simTime += dt;\n      for (const limb of limbs) {\n        const parentReady = limb.parent === -1 || limbs[limb.parent]!.growProgress >= CHILD_START_FRAC;\n        tick(limb, dt, rand, words.length, parentReady);\n      }\n    };\n\n    // trunk foot biased into the right two-thirds of the frame — see\n    // CONTENT PROTECTION in the file header. Growth runs generally straight\n    // up (symmetric spread) from there, kept clear of a bottom-left-docked\n    // content block by the horizontal bias alone.\n    const originX = () => w * 0.74;\n    const originY = () => h * 0.94;\n\n    const draw = () => {\n      ctx.clearRect(0, 0, w, h);\n      const ox = originX();\n      const oy = originY();\n      const maxDepth = limbs.reduce((m, l) => Math.max(m, l.depth), 1);\n\n      for (let i = 0; i < limbs.length; i++) {\n        const limb = limbs[i]!;\n        const parent = limb.parent === -1 ? null : limbs[limb.parent]!;\n        limb.footX = parent ? parent.tipX : ox;\n        limb.footY = parent ? parent.tipY : oy;\n\n        const sway = limb.swayAmp * Math.sin(simTime * limb.swayFreq + limb.swayPhase);\n        const parentAngle = parent ? parent.absAngle : 0;\n        limb.absAngle = parentAngle + limb.relAngle + sway;\n\n        const shrinkFrac = limb.state === \"senescing\" ? 1 - limb.senesceT * (1 - SHRINK_FLOOR) : 1;\n        const lenCur = limb.lenFull * limb.growProgress * shrinkFrac;\n        limb.tipX = limb.footX + Math.cos(limb.absAngle) * lenCur;\n        limb.tipY = limb.footY + Math.sin(limb.absAngle) * lenCur;\n\n        if (lenCur < cellW * 1.5) continue; // too short to hold even one legible character yet — a young or nearly-shed stub, skip the draw this frame\n\n        const maxChars = Math.max(1, Math.floor(lenCur / cellW));\n        const run = buildRun(words, limb.wordStart, maxChars);\n        if (!run) continue;\n\n        const depthFrac = maxDepth > 0 ? limb.depth / maxDepth : 0;\n        let alpha = 1 - depthFrac * 0.68;\n        if (limb.state === \"growing\") alpha *= limb.growProgress;\n        if (limb.state === \"senescing\") alpha *= 1 - limb.senesceT * 0.75;\n        if (alpha <= 0.02) continue;\n\n        const cosA = Math.cos(limb.absAngle);\n        const flip = cosA < 0;\n        const drawAngle = flip ? limb.absAngle + Math.PI : limb.absAngle;\n\n        ctx.save();\n        ctx.translate(limb.footX, limb.footY);\n        ctx.rotate(drawAngle);\n        ctx.textAlign = flip ? \"right\" : \"left\";\n        ctx.textBaseline = \"middle\";\n        ctx.globalAlpha = alpha;\n        ctx.fillStyle = depthFrac < 0.4 ? fgCss : mutedCss;\n        ctx.fillText(run, 0, 0);\n        ctx.restore();\n      }\n      ctx.globalAlpha = 1;\n    };\n\n    const fastForward = (ms: number) => {\n      let remaining = ms;\n      let guard = 0;\n      while (remaining > 0 && guard < MAX_REDUCED_TICKS) {\n        stepAll(STEP_MS);\n        remaining -= STEP_MS;\n        guard++;\n      }\n    };\n\n    const loop = (now: number) => {\n      raf = 0;\n      if (disposed || paused) return;\n      if (last === 0) last = now;\n      let dt = now - last;\n      last = now;\n      if (dt > 250) dt = 250;\n      acc += dt;\n      while (acc >= STEP_MS) {\n        acc -= STEP_MS;\n        stepAll(STEP_MS);\n      }\n      draw();\n      raf = requestAnimationFrame(loop);\n    };\n\n    const startLive = () => {\n      last = 0;\n      paused = false;\n      if (!raf) raf = requestAnimationFrame(loop);\n    };\n    const stopLive = () => {\n      cancelAnimationFrame(raf);\n      raf = 0;\n      paused = true;\n    };\n\n    const reducedQuery = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const applyMotionPref = () => {\n      stopLive();\n      if (reducedQuery.matches) {\n        fastForward(REDUCED_FREEZE_MS);\n        draw();\n      } else {\n        fastForward(PREWARM_MS);\n        draw();\n        if (visible) startLive();\n      }\n    };\n    reducedQuery.addEventListener(\"change\", applyMotionPref);\n\n    readTokens();\n    const mo = new MutationObserver(() => {\n      readTokens();\n      if (!raf) draw(); // repaint immediately on a theme flip even while paused/reduced-motion\n    });\n    mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\"] });\n\n    const ro = new ResizeObserver(() => {\n      resize();\n      if (reducedQuery.matches) {\n        fastForward(REDUCED_FREEZE_MS);\n        draw();\n      } else if (!raf && visible) {\n        draw();\n      }\n    });\n    ro.observe(canvas);\n\n    const io = new IntersectionObserver((entries) => {\n      visible = entries[0]?.isIntersecting ?? true;\n      if (!reducedQuery.matches) {\n        if (visible) startLive();\n        else stopLive();\n      }\n    });\n    io.observe(canvas);\n\n    const onVisibility = () => {\n      if (document.hidden) stopLive();\n      else if (visible && !reducedQuery.matches) startLive();\n    };\n    document.addEventListener(\"visibilitychange\", onVisibility);\n\n    document.fonts.ready.then(() => {\n      if (disposed) return;\n      rebuild();\n      if (reducedQuery.matches) {\n        fastForward(REDUCED_FREEZE_MS);\n        draw();\n      }\n    });\n\n    resize();\n    applyMotionPref();\n\n    return () => {\n      disposed = true;\n      stopLive();\n      ro.disconnect();\n      io.disconnect();\n      mo.disconnect();\n      reducedQuery.removeEventListener(\"change\", applyMotionPref);\n      document.removeEventListener(\"visibilitychange\", onVisibility);\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [text]);\n\n  return (\n    <div\n      aria-hidden=\"true\"\n      className={`relative h-full w-full overflow-hidden bg-background ${className}`}\n      style={style}\n    >\n      <canvas ref={canvasRef} className=\"absolute inset-0 h-full w-full text-foreground\" style={{ fontFamily: \"var(--font-mono)\" }} />\n      {/* CONTENT PROTECTION: a --background-tinted scrim, strongest along the\n          bottom edge (the reading zone the demo docks its headline/CTA in)\n          and easing to fully transparent by mid-frame, so real overlaid type\n          sits on a real reading surface instead of fighting a canopy of\n          words. Trunk origin bias alone (see originX/originY above) is not\n          enough on its own — the crown still reaches the lower third on\n          tall containers — so both are required together. */}\n      <div\n        className=\"pointer-events-none absolute inset-0\"\n        style={{\n          background:\n            \"linear-gradient(to bottom, transparent 0%, transparent 52%, color-mix(in srgb, var(--background) 55%, transparent) 78%, color-mix(in srgb, var(--background) 92%, transparent) 100%)\",\n        }}\n      />\n    </div>\n  );\n}\n\nBackgroundTextBranchCanopy.displayName = \"BackgroundTextBranchCanopy\";\n",
      "type": "registry:ui",
      "target": "components/ui/background-text-branch-canopy.tsx"
    }
  ],
  "cssVars": {
    "theme": {
      "color-ns-muted": "var(--ns-muted)",
      "color-ns-accent": "var(--ns-accent)"
    },
    "light": {
      "ns-muted": "#4d4d4d",
      "ns-accent": "#006bff"
    },
    "dark": {
      "ns-muted": "#8f8f8f"
    }
  },
  "meta": {
    "collection": "loud",
    "tags": [
      "background",
      "text",
      "canvas",
      "growth",
      "typography",
      "ambient",
      "botanical"
    ],
    "instruction": "Build <BackgroundTextBranchCanopy text? className? style?> as a full-bleed ambient background: a Canvas 2D L-system tree whose every limb is drawn with exactly one ctx.fillText() call after translate(foot)+rotate(limbAngle) — a run of words from `text`, windowed to that limb's own length, pivoting on its own foot as it angles away from its parent. THE PRIMITIVE IS TEXT, NOT A TEXTURED STROKE: there is no path/stroke anywhere in the render, and no per-character grid — this is what separates it from the registry's ASCII family (glyph-per-cell luminance stand-ins on a fixed grid, meaningless characters) and from the registry's growth family, tendril-cast/auxin-canal/tree-root-trace/cambium-lay (all grow strokes that are colored or textured afterward). READABILITY DRIVES DEPTH, NOT THE REVERSE: trunk length is 0.28*min(container w,h), each generation is 0.72x the last, and a generation only recurses once its length can still hold ~4 monospace characters at the container-derived type size (9-15px, clamped, and NEVER shrunk by depth — recession is expressed as fewer words and lower alpha only). PIVOT ON THE FOOT: translate is always the limb's own foot (its parent's tip); when a limb's absolute angle points generally leftward (cos<0) it draws from angle+PI with textAlign 'right' instead of 'left' so the run stays upright and readable rather than mirrored, without moving the pivot. ALIVE FOREVER, TWO STRUCTURAL CHANNELS: (1) only the outer canopy (depth >= 2) ages — each churning limb has its own randomized 7-15s lifespan, senesces down to a stub over 1.5s, then regrows from the same foot with a new word offset, so the crown continually sheds and replaces its outer growth while the trunk/first branch level hold still; (2) every limb's angle carries its own sway term ON TOP of its parent's already-swayed angle (composed via a parent-before-child tree walk each frame), so the whole crown breathes rather than jittering per-limb. Both run unconditionally at rest, no pointer required. TOKENS: --foreground for the nearer ~40% of limbs by generation order, --ns-muted for the rest, with alpha also stepping down by depth on top of that — the near/far read holds by value alone in both themes, no luminance comparison needed. --ns-accent never appears; this is ambient, not interaction chrome. Canvas fillStyle can't take a raw var() string, so both tokens are read via getComputedStyle at mount and re-read on a MutationObserver watching documentElement's class. CONTENT PROTECTION: the trunk is origin-biased into the upper-left two-thirds of the frame, and a --background-tinted linear-gradient scrim (transparent through the top half, strongest at the bottom edge) sits above the canvas so a bottom-docked headline/CTA has a real reading surface — trunk bias alone still lets the crown reach the lower third, so both are required together. prefers-reduced-motion fast-forwards the simulation ~16s past first full maturation into steady turnover before freezing, so the frozen frame shows varied limb ages/depths, not a single freshly-grown tree; the live path is also fast-forwarded ~9s before first paint so t=0 already shows a full crown rather than a bare stub. DPR capped at 2 (1.5 blurs sub-15px monospace past legibility), 0.6 inside an autoplay card, render loop paused on IntersectionObserver-offscreen and visibilitychange. Props: text (source words, default a short passage about growth/branching), className, style."
  },
  "type": "registry:ui"
}