{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "turbidite-graded-bed",
  "title": "Turbidite Graded Bed",
  "description": "A card-scale ambient timeline where each irregular flow-pulse event deposits one new sedimentary bed at the top of a growing stratigraphic column: coarse grains settling first at a sharp, erosively-scoured base and fining continuously upward to a fine cap, stacking pulse by pulse forever with the oldest beds slowly compacting and scrolling off the bottom.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/core/turbidite-graded-bed/component.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useId, useRef } from \"react\";\n\n// ---------------------------------------------------------------------------\n// TurbiditeGradedBed — a submarine-fan stratigraphic column: an ambient\n// \"history is accumulating\" strip where each discrete flow-pulse event\n// deposits ONE new graded bed at the top, coarse grains settling first at\n// its sharp base and progressively finer grains capping it as the current\n// loses competence (a real Bouma-sequence fining-upward signature). The\n// stack keeps growing pulse by pulse, oldest beds compressing slightly under\n// the newer overburden and eventually scrolling off the bottom.\n//\n// Every layer's internal grain-size gradient is a fixed set of dot\n// descriptors (position/radius-factor/alpha-factor, colour-free) computed\n// ONCE at deposit time and cached; painting that dot set into pixels happens\n// once per theme read, never per frame — the per-frame cost is just a\n// handful of drawImage calls compositing already-rendered layer bitmaps\n// into the visible strip. The one animated thing each pulse is the reveal:\n// the coarse base appears first, then a fining sweep uncovers the rest of\n// the layer moving upward — the followable event, ~530ms once every ~3.2s\n// on average, slow enough to watch form.\n//\n// Basal scour: the instant a new pulse starts, the layer it is about to\n// bury gets an irregular scalloped notch eaten into its cap over 80ms (an\n// overpaint in --background tracing a jittered curve, never a straight\n// line) with a thin --border stroke tracing the resulting erosive contact —\n// the real signature that separates one event's bed from the next, distinct\n// from a flat stacking seam.\n// ---------------------------------------------------------------------------\n\nexport interface TurbiditeGradedBedProps {\n  /** average seconds between flow-pulse events (irregular, 1.8-5.5s bounds). @default 3.2 */\n  pulseIntervalSeconds?: number;\n  /** freezes on the reduced-motion still without unmounting */\n  paused?: boolean;\n  className?: string;\n  style?: React.CSSProperties;\n}\n\ninterface Dot {\n  x: number; // local px, 0..layerWidth\n  y: number; // local px, 0 = layer's fine cap, baseHeight = layer's coarse base\n  rf: number; // radius factor 0..1 (already includes per-dot jitter)\n  af: number; // alpha factor 0..1 (already includes per-dot jitter)\n}\n\ninterface Layer {\n  baseHeight: number; // deposited height, px, never mutated\n  height: number; // current rendered height after compaction\n  compression: number; // 0..COMPRESSION_CAP\n  yTop: number; // current top offset in strip-space, recomputed every pulse\n  dots: Dot[];\n  canvas: HTMLCanvasElement;\n  ctx: CanvasRenderingContext2D;\n  texW: number; // css px width the canvas was baked at\n  depositStart: number; // ms, performance.now() at deposit start; -1 once settled\n  scourPoints: number[] | null; // depth px per sample, set once this layer is buried\n  scourStart: number; // ms; -1 until scour begins\n  scourSettled: boolean;\n}\n\nconst MIN_INTERVAL_MS = 1800;\nconst MAX_INTERVAL_MS = 5500;\nconst MEAN_INTERVAL_MS = 3200;\n\nconst SCOUR_MS = 80;\nconst DEPOSIT_BASE_MS = 120; // coarse base appears\nconst DEPOSIT_FINE_MS = 330; // fining sweep upward through the rest\nconst DEPOSIT_TOTAL_MS = DEPOSIT_BASE_MS + DEPOSIT_FINE_MS;\n\nconst LAYER_MIN_PX = 14;\nconst LAYER_MAX_PX = 34;\n\nconst COMPRESSION_PER_EVENT = 0.003; // 0.3% per subsequent event\nconst COMPRESSION_CAP = 0.4;\nconst BOTTOM_ZONE_FRAC = 0.8; // bottom 20% of the visible strip compacts\n\nconst DOT_RADIUS_MIN = 0.5;\nconst DOT_RADIUS_MAX = 2.1;\nconst DOT_DENSITY_MIN = 3; // dots per ~40px row-width at the fine cap\nconst DOT_DENSITY_MAX = 11; // dots per ~40px row-width at the coarse base\nconst DOT_ALPHA_MIN = 0.2; // perceptual floor kept clear of zero for light theme\nconst DOT_ALPHA_MAX = 0.9;\nconst ROW_STEP = 1.6;\n\nconst CULL_MARGIN_PX = 48;\nconst REDUCED_MOTION_LAYERS = 6; // enough to fill+overflow a typical card\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 clamp(n: number, min: number, max: number) {\n  return Math.max(min, Math.min(max, n));\n}\n\n// exponential-ish irregular spacing, clamped to bounds proportional to the\n// requested mean (default mean 3.2s -> the documented 1.8-5.5s bounds)\nfunction nextInterval(rand: () => number, meanMs: number): number {\n  const raw = -meanMs * Math.log(1 - rand() * 0.98);\n  const min = meanMs * (MIN_INTERVAL_MS / MEAN_INTERVAL_MS);\n  const max = meanMs * (MAX_INTERVAL_MS / MEAN_INTERVAL_MS);\n  return clamp(raw, min, max);\n}\n\n// skewed strength scalar: most pulses modest, occasional ones large\nfunction pulseHeight(rand: () => number, scale: number): number {\n  const strength = Math.pow(rand(), 3); // concentrated near 0, tail toward 1\n  return (LAYER_MIN_PX + (LAYER_MAX_PX - LAYER_MIN_PX) * strength) * scale;\n}\n\nfunction buildDots(baseHeight: number, texW: number, rand: () => number): Dot[] {\n  const dots: Dot[] = [];\n  for (let y = 0; y < baseHeight; y += ROW_STEP) {\n    const t = baseHeight > 0 ? y / baseHeight : 0; // 0 cap(fine) -> 1 base(coarse)\n    const density = DOT_DENSITY_MIN + (DOT_DENSITY_MAX - DOT_DENSITY_MIN) * t;\n    const count = Math.max(1, Math.round((density * texW) / 40));\n    for (let i = 0; i < count; i++) {\n      dots.push({\n        x: rand() * texW,\n        y: y + (rand() - 0.5) * ROW_STEP,\n        rf: t * (0.65 + rand() * 0.45),\n        af: t * (0.7 + rand() * 0.3),\n      });\n    }\n  }\n  return dots;\n}\n\nfunction paintLayerCanvas(layer: Layer, colors: { fg: string; bg: string }, dpr: number) {\n  const c = layer.canvas;\n  const w = layer.texW;\n  const h = layer.baseHeight;\n  const pw = Math.max(1, Math.round(w * dpr));\n  const ph = Math.max(1, Math.round(h * dpr));\n  if (c.width !== pw || c.height !== ph) {\n    c.width = pw;\n    c.height = ph;\n  }\n  const ctx = layer.ctx;\n  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n  ctx.clearRect(0, 0, w, h);\n  ctx.fillStyle = colors.bg;\n  ctx.fillRect(0, 0, w, h);\n  for (const d of layer.dots) {\n    const r = DOT_RADIUS_MIN + (DOT_RADIUS_MAX - DOT_RADIUS_MIN) * d.rf;\n    const a = DOT_ALPHA_MIN + (DOT_ALPHA_MAX - DOT_ALPHA_MIN) * d.af;\n    ctx.globalAlpha = a;\n    ctx.fillStyle = colors.fg;\n    ctx.beginPath();\n    ctx.arc(d.x, d.y, r, 0, Math.PI * 2);\n    ctx.fill();\n  }\n  ctx.globalAlpha = 1;\n}\n\nfunction buildScourPoints(rand: () => number, samples: number): number[] {\n  const maxDepth = 2 + rand() * 2; // 2-4px\n  const phase = rand() * Math.PI * 2;\n  const pts: number[] = [];\n  for (let i = 0; i < samples; i++) {\n    const u = i / (samples - 1);\n    const wobble = 0.5 + 0.5 * Math.sin(u * Math.PI * 3.1 + phase);\n    const jitter = (rand() - 0.5) * 0.6;\n    pts.push(clamp(maxDepth * (wobble + jitter), 0.4, maxDepth));\n  }\n  return pts;\n}\n\nexport function TurbiditeGradedBed({\n  pulseIntervalSeconds = 3.2,\n  paused = false,\n  className = \"\",\n  style,\n}: TurbiditeGradedBedProps) {\n  const wrapRef = useRef<HTMLDivElement | null>(null);\n  const canvasRef = useRef<HTMLCanvasElement | null>(null);\n  const uid = useId();\n  const pausedRef = useRef(paused);\n  pausedRef.current = paused;\n\n  useEffect(() => {\n    const wrap = wrapRef.current;\n    const canvas = canvasRef.current;\n    if (!wrap || !canvas) return;\n    const ctx = canvas.getContext(\"2d\", { alpha: true });\n    if (!ctx) return;\n\n    let disposed = false;\n    let raf = 0;\n    let running = false;\n    let staticMode = false;\n    let onScreen = true;\n\n    let w = 0;\n    let h = 0;\n    let dpr = 1;\n    let scale = 1; // derived from the strip's own (smaller) dimension: width\n\n    let layers: Layer[] = [];\n    let pulseTimer = 0;\n    const rand = mulberry32(0x7b1d3e);\n    const meanMs = Math.max(200, pulseIntervalSeconds * 1000);\n\n    let colors = { fg: \"#171717\", bg: \"#ffffff\", border: \"#e5e5e5\" };\n    const readColors = () => {\n      const cs = getComputedStyle(document.documentElement);\n      colors = {\n        fg: cs.getPropertyValue(\"--foreground\").trim() || \"#171717\",\n        bg: cs.getPropertyValue(\"--background\").trim() || \"#ffffff\",\n        border: cs.getPropertyValue(\"--border\").trim() || \"#e5e5e5\",\n      };\n    };\n    readColors();\n\n    const makeLayer = (heightPx: number): Layer => {\n      const c = document.createElement(\"canvas\");\n      const lctx = c.getContext(\"2d\")!;\n      const layer: Layer = {\n        baseHeight: heightPx,\n        height: heightPx,\n        compression: 0,\n        yTop: 0,\n        dots: buildDots(heightPx, w, rand),\n        canvas: c,\n        ctx: lctx,\n        texW: w,\n        depositStart: -1,\n        scourPoints: null,\n        scourStart: -1,\n        scourSettled: true,\n      };\n      paintLayerCanvas(layer, colors, dpr);\n      return layer;\n    };\n\n    // -- one deposit: shift the whole stack down by the new layer's height,\n    // start eroding the (now-buried) previous top layer's cap, then start\n    // the new layer's own base-then-fining reveal. ------------------------\n    const depositPulse = (nowMs: number) => {\n      const heightPx = pulseHeight(rand, scale);\n      const newLayer = makeLayer(heightPx);\n      newLayer.depositStart = nowMs;\n\n      const prevTop = layers[0];\n      for (const l of layers) l.yTop += heightPx;\n      layers.unshift(newLayer);\n\n      if (prevTop) {\n        prevTop.scourPoints = buildScourPoints(rand, 10);\n        prevTop.scourStart = nowMs;\n        prevTop.scourSettled = false;\n      }\n\n      // compaction: any layer whose current span sits in the bottom 20% of\n      // the visible strip squeezes a little further under the new overburden\n      for (const l of layers) {\n        if (l === newLayer) continue;\n        if (l.yTop + l.height > BOTTOM_ZONE_FRAC * h) {\n          l.compression = Math.min(COMPRESSION_CAP, l.compression + COMPRESSION_PER_EVENT);\n          l.height = l.baseHeight * (1 - l.compression);\n        }\n      }\n      recomputeStack();\n\n      // cull anything fully scrolled past the bottom edge\n      while (layers.length && (layers[layers.length - 1]?.yTop ?? 0) > h + CULL_MARGIN_PX) {\n        layers.pop();\n      }\n    };\n\n    const recomputeStack = () => {\n      let y = 0;\n      for (const l of layers) {\n        l.yTop = y;\n        y += l.height;\n      }\n    };\n\n    const scheduleNextPulse = () => {\n      window.clearTimeout(pulseTimer);\n      pulseTimer = window.setTimeout(() => {\n        if (disposed || staticMode) return;\n        depositPulse(performance.now());\n        scheduleNextPulse();\n      }, nextInterval(rand, meanMs));\n    };\n\n    // -- composite the whole visible strip from cached layer bitmaps; the\n    // only per-frame work is a reveal clip (depositing layer) and a scour\n    // overpaint (freshly buried layer), both driven off elapsed time, never\n    // by recomputing the dot fields themselves. ---------------------------\n    const drawScene = (nowMs: number) => {\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      ctx.clearRect(0, 0, w, h);\n\n      for (let i = layers.length - 1; i >= 0; i--) {\n        const l = layers[i];\n        if (!l) continue;\n        if (l.yTop > h || l.yTop + l.height < 0) continue;\n\n        let revealTopLocal = 0; // texture-local y above which nothing is drawn yet\n        if (l.depositStart >= 0) {\n          const elapsed = nowMs - l.depositStart;\n          if (elapsed < DEPOSIT_BASE_MS) {\n            // coarse base appears first: reveal only the bottom slice\n            const baseSliceFrac = 0.28;\n            revealTopLocal = l.baseHeight * (1 - baseSliceFrac);\n          } else if (elapsed < DEPOSIT_TOTAL_MS) {\n            const fineT = (elapsed - DEPOSIT_BASE_MS) / DEPOSIT_FINE_MS;\n            const startFrac = 0.72; // matches (1 - baseSliceFrac) above\n            revealTopLocal = l.baseHeight * startFrac * (1 - fineT);\n          } else {\n            l.depositStart = -1;\n            revealTopLocal = 0;\n          }\n        }\n\n        const srcH = Math.max(0, l.baseHeight - revealTopLocal);\n        if (srcH <= 0) continue;\n        const destFracH = srcH / l.baseHeight;\n        const destY = l.yTop + l.height * (revealTopLocal / l.baseHeight);\n        const destH = l.height * destFracH;\n\n        ctx.drawImage(\n          l.canvas,\n          0,\n          revealTopLocal * dpr,\n          l.texW * dpr,\n          srcH * dpr,\n          0,\n          destY,\n          w,\n          destH\n        );\n\n        // erosive basal scour on the layer that just got buried\n        if (l.scourPoints && !l.scourSettled) {\n          const elapsed = nowMs - l.scourStart;\n          const progress = clamp(elapsed / SCOUR_MS, 0, 1);\n          if (progress >= 1) l.scourSettled = true;\n          drawScourNotch(l, progress);\n        } else if (l.scourPoints) {\n          drawScourNotch(l, 1);\n        }\n      }\n    };\n\n    const drawScourNotch = (l: Layer, progress: number) => {\n      const pts = l.scourPoints;\n      if (!pts) return;\n      const n = pts.length;\n      ctx.beginPath();\n      ctx.moveTo(0, l.yTop);\n      for (let k = 0; k < n; k++) {\n        const x = (k / (n - 1)) * w;\n        const y = l.yTop + pts[k]! * progress;\n        ctx.lineTo(x, y);\n      }\n      ctx.lineTo(w, l.yTop);\n      ctx.closePath();\n      ctx.fillStyle = colors.bg;\n      ctx.fill();\n\n      ctx.beginPath();\n      for (let k = 0; k < n; k++) {\n        const x = (k / (n - 1)) * w;\n        const y = l.yTop + pts[k]! * progress;\n        if (k === 0) ctx.moveTo(x, y);\n        else ctx.lineTo(x, y);\n      }\n      ctx.strokeStyle = colors.border;\n      ctx.lineWidth = 1;\n      ctx.stroke();\n    };\n\n    // -- deterministic reduced-motion / paused still: several complete\n    // graded beds stacked, the freshest one fully formed and settled, its\n    // own basal scour fully baked, no active deposit/scour in flight. -----\n    const drawStaticFrame = () => {\n      layers = [];\n      let y = 0;\n      let prevTop: Layer | null = null;\n      for (let i = 0; i < REDUCED_MOTION_LAYERS; i++) {\n        const heightPx = pulseHeight(rand, scale);\n        const l = makeLayer(heightPx);\n        l.depositStart = -1;\n        if (prevTop) {\n          prevTop.scourPoints = buildScourPoints(rand, 10);\n          prevTop.scourSettled = true;\n        }\n        layers.unshift(l);\n        for (const other of layers) if (other !== l) other.yTop += heightPx;\n        prevTop = l;\n        y += heightPx;\n      }\n      recomputeStack();\n      drawScene(performance.now());\n    };\n\n    const resetAll = () => {\n      window.clearTimeout(pulseTimer);\n      layers = [];\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      ctx.clearRect(0, 0, w, h);\n    };\n\n    const loop = (nowMs: number) => {\n      if (!running) return;\n      drawScene(nowMs);\n      raf = requestAnimationFrame(loop);\n    };\n\n    const wake = () => {\n      if (running || disposed || staticMode) return;\n      running = true;\n      raf = requestAnimationFrame(loop);\n      scheduleNextPulse();\n    };\n    const sleep = () => {\n      cancelAnimationFrame(raf);\n      raf = 0;\n      running = false;\n      window.clearTimeout(pulseTimer);\n    };\n\n    const applySize = () => {\n      const rect = wrap.getBoundingClientRect();\n      if (rect.width < 2 || rect.height < 2) return;\n      const changed = Math.abs(rect.width - w) > 0.5 || Math.abs(rect.height - h) > 0.5;\n      w = rect.width;\n      h = rect.height;\n      dpr = Math.min(window.devicePixelRatio || 1, 2);\n      scale = clamp(w / 220, 0.6, 1.6);\n      const pw = Math.max(2, Math.round(w * dpr));\n      const ph = Math.max(2, Math.round(h * dpr));\n      if (canvas.width !== pw || canvas.height !== ph) {\n        canvas.width = pw;\n        canvas.height = ph;\n      }\n      canvas.style.width = `${w}px`;\n      canvas.style.height = `${h}px`;\n      if (changed) {\n        // baked layer bitmaps are sized to the old strip width — a resize\n        // invalidates them, so restart cleanly rather than rescale in place\n        if (staticMode) drawStaticFrame();\n        else {\n          resetAll();\n          if (!pausedRef.current) wake();\n        }\n      }\n    };\n\n    const ro = new ResizeObserver(applySize);\n    ro.observe(wrap);\n    applySize();\n\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    let reduced = mq.matches;\n    const applyMode = () => {\n      if (reduced || pausedRef.current) {\n        staticMode = true;\n        sleep();\n        drawStaticFrame();\n      } else {\n        if (staticMode) resetAll();\n        staticMode = false;\n        if (onScreen && !document.hidden) wake();\n      }\n    };\n    const onMq = () => {\n      reduced = mq.matches;\n      applyMode();\n    };\n    mq.addEventListener(\"change\", onMq);\n\n    const io = new IntersectionObserver(\n      (entries) => {\n        onScreen = entries.some((en) => en.isIntersecting);\n        if (!onScreen) sleep();\n        else if (!staticMode && !document.hidden) wake();\n      },\n      { threshold: 0 }\n    );\n    io.observe(wrap);\n\n    const onVis = () => {\n      if (document.hidden) sleep();\n      else if (!staticMode && onScreen) wake();\n    };\n    document.addEventListener(\"visibilitychange\", onVis);\n    applyMode();\n\n    let lastPolledPaused = pausedRef.current;\n    let poll = 0;\n    const pollPaused = () => {\n      if (pausedRef.current !== lastPolledPaused) {\n        lastPolledPaused = pausedRef.current;\n        applyMode();\n      }\n      poll = window.setTimeout(pollPaused, 140);\n    };\n    pollPaused();\n\n    const themeObserver = new MutationObserver(() => {\n      readColors();\n      for (const l of layers) paintLayerCanvas(l, colors, dpr);\n      if (staticMode) drawScene(performance.now());\n    });\n    themeObserver.observe(document.documentElement, {\n      attributes: true,\n      attributeFilter: [\"class\"],\n    });\n\n    return () => {\n      disposed = true;\n      ro.disconnect();\n      io.disconnect();\n      mq.removeEventListener(\"change\", onMq);\n      document.removeEventListener(\"visibilitychange\", onVis);\n      themeObserver.disconnect();\n      window.clearTimeout(poll);\n      sleep();\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [pulseIntervalSeconds]);\n\n  return (\n    <div\n      ref={wrapRef}\n      data-turbidite-graded-bed={uid}\n      role=\"img\"\n      aria-label=\"Accumulating stratigraphic record, one graded sediment layer per flow event\"\n      className={`relative h-full w-full overflow-hidden bg-background ${className}`}\n      style={style}\n    >\n      <canvas ref={canvasRef} aria-hidden=\"true\" className=\"absolute inset-0 block h-full w-full\" />\n    </div>\n  );\n}\n\nTurbiditeGradedBed.displayName = \"TurbiditeGradedBed\";\n",
      "type": "registry:ui",
      "target": "components/ui/turbidite-graded-bed.tsx"
    }
  ],
  "meta": {
    "collection": "core",
    "tags": [
      "timeline",
      "canvas",
      "ambient",
      "generative",
      "activity-log",
      "grain",
      "stratigraphy",
      "raf"
    ],
    "instruction": "Build <TurbiditeGradedBed pulseIntervalSeconds? paused? className? style?> as a card-scale ambient vertical strip reproducing a submarine turbidite's stratigraphic column: one <canvas> (w-full h-full, DPR-capped at 2, resized only via a ResizeObserver on the wrapper, never window.resize) inside a role=\"img\" wrapper. STATE: an array of `Layer` objects, index 0 always the newest/topmost, each holding baseHeight (deposited height, never mutated), a compaction-reduced `height`, `yTop` (recomputed every pulse by summing heights from index 0), and a fixed array of colour-free `Dot` descriptors {x, y, radiusFactor, alphaFactor} generated ONCE at deposit time via a seeded mulberry32 PRNG — dots run from y=0 (the layer's fine cap) to y=baseHeight (its coarse base), radiusFactor/alphaFactor both scaling with that same 0..1 position so density and grain radius are both highest at the base and lowest at the cap (the fining-upward signature). PULSES: fire on setTimeout at an irregular interval averaging `pulseIntervalSeconds` (default 3.2s, exponential-ish via -mean*ln(1-rand()*0.98), clamped to bounds proportional to the documented 1.8-5.5s range) — never a metronome. Each pulse: sample a layer height from a skewed distribution (Math.pow(rand(),3) so most events are modest, occasional ones large) in the 14-34px range scaled by the strip's own width (clamp(width/220, 0.6, 1.6) — geometry is derived from the container's smaller dimension so it still reads at any card size), bake its dot field into an offscreen <canvas> sized to the strip's current width, shift every existing layer's yTop down by the new height, unshift the new layer to index 0, and arm the PREVIOUS top layer's basal scour (10 sampled depth points 2-4px via a jittered sine, never a straight line) with a start timestamp. Cull any layer once its yTop exceeds the strip height by 48px so memory stays bounded while the loop stays visually unbounded (older beds genuinely scroll off the bottom). COMPACTION: every pulse, any existing layer whose current span falls in the bottom 20% of the visible strip has its compression increased by 0.3% (capped 40% total) and height recomputed as baseHeight*(1-compression) — a slow, continuous squeeze from the growing overburden, applied every pulse but only visible over many. RENDER LOOP (rAF, only while visible/awake): compositing is drawImage calls of the cached per-layer bitmaps, never dot recomputation — the only per-frame work is (a) a reveal clip on the currently-depositing layer (0-120ms: only the bottom ~28% base slice is revealed; 120-450ms: the reveal boundary sweeps linearly from that 28% line up to the layer's very top, so the coarse base visibly appears first and the fine cap resolves last) and (b) an overpaint on a freshly-buried layer's cap tracing its scour depth points scaled by elapsed/80ms, filled in the `--background` token (a genuine erasure of already-drawn grains, not a fill token misuse) with a 1px `--border` stroke along the same scalloped curve marking the erosive contact line — `--border` is used ONLY as that stroke, never as a fill or the layer's own background (which is `--background`). TOKENS: colours read once via getComputedStyle(document.documentElement) before any paint and re-read (repainting every cached layer bitmap from its stored dot descriptors, not regenerating the dots) on a MutationObserver watching documentElement's class attribute — theme toggles never lose accumulated history. No `--ns-accent` anywhere; this is a pure ambient record with no interactive chrome. LIFECYCLE: IntersectionObserver (threshold 0) and visibilitychange both pause the rAF loop and clear the pulse timer (no catch-up scheduling on wake, just a fresh randomized interval); prefers-reduced-motion and the `paused` prop (polled every 140ms) both freeze on a synchronously-built deterministic still — six complete graded beds stacked with the freshest fully formed, settled, and its own basal scour fully baked in, no deposit or scour animation in flight, the single most-structured frame. A resize invalidates every cached layer bitmap (baked at the old strip width) so the whole column resets and restarts cleanly rather than attempting to rescale finished beds in place. Pure DOM + 2D canvas, zero dependencies."
  },
  "type": "registry:ui"
}