{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-faraday-wave-cell",
  "title": "Hero Faraday Wave Cell",
  "description": "Full-bleed hero background reproducing Faraday's 1831 discovery: a fluid layer vibrated vertically above a critical amplitude breaks into standing surface waves oscillating at half the driving frequency, tessellating into stripe, square and hexagonal cells that keep reorganizing rather than settling.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/loud/hero-faraday-wave-cell/component.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\n\n// ---------------------------------------------------------------------------\n// HeroFaradayWaveCell — a full-bleed hero background reproducing Faraday's\n// 1831 observation: a fluid layer vibrated VERTICALLY above a critical\n// driving amplitude develops standing surface waves that oscillate at HALF\n// the driving frequency (a parametric, subharmonic response — not a driven\n// resonance at the forcing frequency itself), and above threshold the free\n// surface tessellates into cellular patterns whose SYMMETRY (stripes,\n// squares, hexagons) is set by which resonant wave triads the drive selects,\n// not by the drive frequency alone. Below threshold the surface stays flat.\n//\n// DISTINCT FROM slider-chladni-tune: Chladni figures are sand collecting\n// along the NODAL LINES of a vibrating SOLID plate — a 2D eigenmode of a\n// rigid boundary, static once locked. This is a free FLUID surface: the\n// standing wave itself is the visible thing (no grains, no boundary\n// eigenmode), it never locks — it oscillates every drive cycle by\n// definition — and its cellular symmetry keeps reorganizing at a threshold\n// that is fluid, not sand settling into place.\n//\n// MECHANISM (analytic sum of standing-wave modes, not a PDE solve — cheap\n// enough to run on a coarse grid every frame). A resonant triad of plane\n// waves at the same |k| but different orientations is the real mechanism\n// behind pattern selection in parametric surface waves: one wavevector\n// gives stripes, two orthogonal wavevectors give a square lattice, three at\n// 60 degrees give a hexagonal lattice (a standard three-wave resonance).\n// Height at a point is the WEIGHTED SUM of all three families' spatial\n// patterns, modulated by ONE shared subharmonic time factor\n// cos(omega_sub * t) where omega_sub = pi * drivingFrequencyHz (i.e. HALF\n// the driving angular frequency) — this is what makes the whole field\n// invert in sync every drive period, the defining subharmonic signature.\n// A slow driving-amplitude envelope (period `amplitudeDriftPeriod`) sweeps\n// through and occasionally below the critical threshold: above it the\n// pattern amplitude ramps to full strength, below it the surface smoothly\n// flattens — real Faraday-wave behavior, not an invented fade. Three\n// independent, incommensurate-period sinusoids weight how much of the\n// stripe/square/hexagon family is present at any moment (sharpened by a\n// power curve so one family usually dominates, the way a real cell\n// tessellation reorganizes rather than blending three lattices evenly), and\n// the shared base wavevector angle keeps rotating slowly, so the pattern\n// never settles into a repeating loop.\n//\n// GRID + BUDGET. The field is evaluated on a small offscreen buffer (~35\n// samples across the container's SMALLER dimension, aspect-scaled on the\n// other axis, capped around 6500 total cells) and upscaled onto the\n// full-bleed backing canvas with the canvas's own bilinear image smoothing\n// — an interpolated coarse grid, not a per-pixel evaluation, and far\n// cheaper than a wave-equation solve. Per cell the inner loop is 4 dot\n// products against frame-constant wavevectors (recomputed once per frame,\n// not per cell) and 4 cos() calls — at the capped cell budget that's under\n// 30k trig evaluations per frame, the same order of magnitude as\n// slider-chladni-tune's per-frame grain pass.\n//\n// SCALE. Wavelength is derived from the container's smaller dimension\n// (`cyclesAcrossMin` wave cycles across it), never a fixed pixel size, so\n// the cell tessellation reads at the same relative scale whether the hero\n// fills a viewport or a small preview card.\n//\n// LEGIBILITY. A full-frame tessellation fights headline/CTA type sitting in\n// the usual centered hero position, the same problem\n// background-halftone-rosette solved with an explicit coverage gradient —\n// here inverted spatially to match a centered content block instead of a\n// centered visual: an elliptical amplitude mask damps the field to ~15% of\n// full amplitude behind the content (still visibly live, never fully flat)\n// and grows to 100% toward the frame edges, so density is bought at the\n// edges instead of behind the type.\n//\n// TOKENS. Trough -> --background, mid -> --ns-muted, crest -> --foreground,\n// a three-stop ramp read via getComputedStyle(document.documentElement) at\n// mount and re-read on a MutationObserver watching documentElement's class.\n// Because the ramp is always background -> muted -> foreground regardless\n// of which theme is active, crest and trough stay distinguishable under\n// both polarities without ever inverting which token means \"crest.\" No\n// --ns-accent anywhere — this is a resting ambient background, not\n// interaction chrome, and --border never fills a cell (it's a 1px\n// separator token, near-invisible in light theme at cell scale).\n//\n// REDUCED MOTION. Freezes on a fully-formed pure-hexagon frame (weights\n// forced to [0,0,1], amplitude at full strength, subharmonic factor at its\n// peak +1) rather than sampling the live time formula at some t — a\n// numeric coincidence with the live formula could land on a transitional\n// blend or a below-threshold dip. The pure-hex frame is deliberately\n// chosen over stripes/squares because hexagonal cells are the most\n// legible tessellation at a glance. No rAF runs in this mode.\n// ---------------------------------------------------------------------------\n\nexport interface HeroFaradayWaveCellProps {\n  /** wave cycles across the container's smaller dimension. @default 5 */\n  cyclesAcrossMin?: number;\n  /** driving frequency in Hz; the visible standing wave runs at half this. @default 0.42 */\n  drivingFrequencyHz?: number;\n  /** period, in seconds, of the driving-amplitude envelope sweeping across the critical threshold. @default 46 */\n  amplitudeDriftPeriod?: number;\n  /** freezes the field on the same frame prefers-reduced-motion uses. @default false */\n  paused?: boolean;\n  /** rendered over the wave field — eyebrow, headline, CTA. */\n  children?: ReactNode;\n  className?: string;\n  style?: CSSProperties;\n}\n\ntype RGB = readonly [number, number, number];\n\nfunction parseColor(raw: string): RGB | null {\n  const s = raw.trim();\n  if (!s) return null;\n  if (s.startsWith(\"#\")) {\n    const hex = s.slice(1);\n    if (hex.length === 3) {\n      const r = parseInt(hex[0] + hex[0], 16);\n      const g = parseInt(hex[1] + hex[1], 16);\n      const b = parseInt(hex[2] + hex[2], 16);\n      return Number.isNaN(r + g + b) ? null : [r, g, b];\n    }\n    if (hex.length >= 6) {\n      const r = parseInt(hex.slice(0, 2), 16);\n      const g = parseInt(hex.slice(2, 4), 16);\n      const b = parseInt(hex.slice(4, 6), 16);\n      return Number.isNaN(r + g + b) ? null : [r, g, b];\n    }\n    return null;\n  }\n  const m = s.match(/rgba?\\(\\s*([\\d.]+)[,\\s]+([\\d.]+)[,\\s]+([\\d.]+)/);\n  return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;\n}\n\nfunction clamp(v: number, lo: number, hi: number) {\n  return Math.min(hi, Math.max(lo, v));\n}\n\nfunction smoothstep(edge0: number, edge1: number, x: number) {\n  const t = clamp((x - edge0) / Math.max(1e-9, edge1 - edge0), 0, 1);\n  return t * t * (3 - 2 * t);\n}\n\nfunction lerpRGB(a: RGB, b: RGB, t: number): RGB {\n  return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];\n}\n\n// three-stop token ramp: trough -> mid -> crest\nfunction rampColor(t01: number, bg: RGB, muted: RGB, fg: RGB): RGB {\n  return t01 < 0.5 ? lerpRGB(bg, muted, t01 * 2) : lerpRGB(muted, fg, (t01 - 0.5) * 2);\n}\n\nfunction useReducedMotionPref(): boolean {\n  const [reduced, setReduced] = useState(false);\n  useEffect(() => {\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    setReduced(mq.matches);\n    const onChange = (e: MediaQueryListEvent) => setReduced(e.matches);\n    mq.addEventListener(\"change\", onChange);\n    return () => mq.removeEventListener(\"change\", onChange);\n  }, []);\n  return reduced;\n}\n\nconst THRESHOLD = 0.34; // critical driving amplitude, normalized 0..1\nconst THRESHOLD_RAMP = 0.14; // smoothstep width above threshold to full pattern strength\nconst ENV_PHASE = 1.55; // phase offset so the default envelope starts well above threshold\nconst ANGLE_RATE = (2 * Math.PI) / 240; // base wavevector orientation, one full turn per 4min\nconst WEIGHT_PERIODS: readonly [number, number, number] = [27, 33, 41]; // incommensurate, seconds\nconst WEIGHT_PHASES: readonly [number, number, number] = [0, 2.1, 4.4];\nconst WEIGHT_POW = 4; // sharpens family dominance so one tessellation usually leads\nconst MAX_CELLS = 6500;\nconst MIN_SAMPLES_ACROSS_MIN_DIM = 35;\n\n// elliptical legibility mask: damped near the centered content block, full\n// strength toward the frame edges (inverse of background-halftone-rosette's\n// radial gradient, matched to a centered-content hero instead of a\n// centered-visual one).\nconst MASK_CENTER_AMP = 0.15;\nconst MASK_EDGE_AMP = 1.0;\nconst MASK_INNER = 0.15;\nconst MASK_OUTER = 0.85;\nconst MASK_ELLIPSE_X = 0.62; // wider than tall, matching a typical headline block's aspect\n\nexport function HeroFaradayWaveCell({\n  cyclesAcrossMin = 5,\n  drivingFrequencyHz = 0.42,\n  amplitudeDriftPeriod = 46,\n  paused = false,\n  children,\n  className = \"\",\n  style,\n}: HeroFaradayWaveCellProps) {\n  const reduced = useReducedMotionPref();\n  const isStatic = paused || reduced;\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const canvasRef = useRef<HTMLCanvasElement>(null);\n\n  useEffect(() => {\n    const container = containerRef.current;\n    const canvas = canvasRef.current;\n    if (!container || !canvas) return;\n    const ctx = canvas.getContext(\"2d\");\n    if (!ctx) return;\n\n    // -- token-derived ink, read at mount and re-derived on theme flips --\n    let bg: RGB = [255, 255, 255];\n    let muted: RGB = [128, 128, 128];\n    let fg: RGB = [23, 23, 23];\n    const deriveColors = () => {\n      const cs = getComputedStyle(document.documentElement);\n      bg = parseColor(cs.getPropertyValue(\"--background\")) ?? bg;\n      muted = parseColor(cs.getPropertyValue(\"--ns-muted\")) ?? muted;\n      fg = parseColor(cs.getPropertyValue(\"--foreground\")) ?? fg;\n    };\n    deriveColors();\n\n    // offscreen low-res field buffer, upscaled with the main canvas's own\n    // bilinear image smoothing\n    const buffer = document.createElement(\"canvas\");\n    const bctx = buffer.getContext(\"2d\");\n    if (!bctx) return;\n\n    let cols = 1;\n    let rows = 1;\n    let imgData: ImageData | null = null;\n    let pixels: Uint8ClampedArray | null = null;\n\n    let width = 0;\n    let height = 0;\n    let dpr = 1;\n    let sized = false;\n    let raf = 0;\n    let visible = true;\n    let kUnit = 0.02; // radians per px, derived from container's smaller dimension\n\n    const resizeBuffer = () => {\n      const minDim = Math.max(1, Math.min(width, height));\n      const cellPx = minDim / (MIN_SAMPLES_ACROSS_MIN_DIM * 1.4);\n      let c = Math.max(8, Math.round(width / cellPx));\n      let r = Math.max(8, Math.round(height / cellPx));\n      const total = c * r;\n      if (total > MAX_CELLS) {\n        const scale = Math.sqrt(MAX_CELLS / total);\n        c = Math.max(8, Math.round(c * scale));\n        r = Math.max(8, Math.round(r * scale));\n      }\n      cols = c;\n      rows = r;\n      buffer.width = cols;\n      buffer.height = rows;\n      imgData = bctx.createImageData(cols, rows);\n      pixels = imgData.data;\n      kUnit = (2 * Math.PI * cyclesAcrossMin) / minDim;\n    };\n\n    const resize = () => {\n      const rect = container.getBoundingClientRect();\n      if (rect.width < 4 || rect.height < 4) {\n        sized = false;\n        return;\n      }\n      width = rect.width;\n      height = rect.height;\n      dpr = Math.min(1.5, window.devicePixelRatio || 1);\n      canvas.width = Math.round(width * dpr);\n      canvas.height = Math.round(height * dpr);\n      canvas.style.width = `${width}px`;\n      canvas.style.height = `${height}px`;\n      resizeBuffer();\n      sized = true;\n    };\n    resize();\n\n    const startTime = performance.now();\n\n    const computeField = (t: number) => {\n      if (!pixels) return;\n\n      // driving-amplitude envelope, sweeping across the critical threshold\n      const drive = 0.5 + 0.5 * Math.sin((2 * Math.PI * t) / amplitudeDriftPeriod + ENV_PHASE);\n      const patternAmp = smoothstep(THRESHOLD, THRESHOLD + THRESHOLD_RAMP, drive);\n\n      // subharmonic time factor: HALF the driving frequency, the defining\n      // parametric signature — the whole field inverts in sync each cycle\n      const omegaSub = Math.PI * drivingFrequencyHz;\n      const subCos = Math.cos(omegaSub * t);\n\n      // three incommensurate slow sinusoids -> sharpened, normalized family weights\n      let w0 = 0.5 + 0.5 * Math.sin((2 * Math.PI * t) / WEIGHT_PERIODS[0] + WEIGHT_PHASES[0]);\n      let w1 = 0.5 + 0.5 * Math.sin((2 * Math.PI * t) / WEIGHT_PERIODS[1] + WEIGHT_PHASES[1]);\n      let w2 = 0.5 + 0.5 * Math.sin((2 * Math.PI * t) / WEIGHT_PERIODS[2] + WEIGHT_PHASES[2]);\n      w0 = Math.pow(w0, WEIGHT_POW);\n      w1 = Math.pow(w1, WEIGHT_POW);\n      w2 = Math.pow(w2, WEIGHT_POW);\n      const wSum = Math.max(1e-9, w0 + w1 + w2);\n      const wStripe = w0 / wSum;\n      const wSquare = w1 / wSum;\n      const wHex = w2 / wSum;\n\n      // frame-constant wavevectors (orientation only changes once per\n      // frame, not per cell): stripe/square/hex share a rotating base angle\n      const theta0 = ANGLE_RATE * t;\n      const kx0 = kUnit * Math.cos(theta0);\n      const ky0 = kUnit * Math.sin(theta0);\n      const a90 = theta0 + Math.PI / 2;\n      const kx90 = kUnit * Math.cos(a90);\n      const ky90 = kUnit * Math.sin(a90);\n      const a60 = theta0 + Math.PI / 3;\n      const kx60 = kUnit * Math.cos(a60);\n      const ky60 = kUnit * Math.sin(a60);\n      const a120 = theta0 + (2 * Math.PI) / 3;\n      const kx120 = kUnit * Math.cos(a120);\n      const ky120 = kUnit * Math.sin(a120);\n\n      let idx = 0;\n      for (let j = 0; j < rows; j++) {\n        const ny = rows > 1 ? j / (rows - 1) : 0.5;\n        const worldY = ny * height - height / 2;\n        const dy = (ny - 0.5) * 2;\n        for (let i = 0; i < cols; i++) {\n          const nx = cols > 1 ? i / (cols - 1) : 0.5;\n          const worldX = nx * width - width / 2;\n          const dx = (nx - 0.5) * 2;\n\n          const c0 = Math.cos(kx0 * worldX + ky0 * worldY);\n          const c90 = Math.cos(kx90 * worldX + ky90 * worldY);\n          const c60 = Math.cos(kx60 * worldX + ky60 * worldY);\n          const c120 = Math.cos(kx120 * worldX + ky120 * worldY);\n\n          const patternStripe = c0;\n          const patternSquare = (c0 + c90) / 2;\n          const patternHex = (c0 + c60 + c120) / 3;\n          const spatial = wStripe * patternStripe + wSquare * patternSquare + wHex * patternHex;\n\n          const ellipseR = Math.sqrt(Math.pow(dx * MASK_ELLIPSE_X, 2) + Math.pow(dy, 2));\n          const mask = MASK_CENTER_AMP + (MASK_EDGE_AMP - MASK_CENTER_AMP) * smoothstep(MASK_INNER, MASK_OUTER, ellipseR);\n\n          const h = patternAmp * spatial * subCos * mask;\n          const t01 = clamp((h + 1) / 2, 0, 1);\n          const [r, g, b] = rampColor(t01, bg, muted, fg);\n\n          pixels[idx] = r;\n          pixels[idx + 1] = g;\n          pixels[idx + 2] = b;\n          pixels[idx + 3] = 255;\n          idx += 4;\n        }\n      }\n    };\n\n    const computeStaticField = () => {\n      if (!pixels) return;\n      // pure-hexagon, full-strength, peak-subharmonic frame — see the\n      // REDUCED MOTION note above for why this isn't a live-formula sample.\n      const theta0 = 0.3; // a mild fixed tilt so the lattice doesn't align to the frame axes\n      const kx0 = kUnit * Math.cos(theta0);\n      const ky0 = kUnit * Math.sin(theta0);\n      const a60 = theta0 + Math.PI / 3;\n      const kx60 = kUnit * Math.cos(a60);\n      const ky60 = kUnit * Math.sin(a60);\n      const a120 = theta0 + (2 * Math.PI) / 3;\n      const kx120 = kUnit * Math.cos(a120);\n      const ky120 = kUnit * Math.sin(a120);\n\n      let idx = 0;\n      for (let j = 0; j < rows; j++) {\n        const ny = rows > 1 ? j / (rows - 1) : 0.5;\n        const worldY = ny * height - height / 2;\n        const dy = (ny - 0.5) * 2;\n        for (let i = 0; i < cols; i++) {\n          const nx = cols > 1 ? i / (cols - 1) : 0.5;\n          const worldX = nx * width - width / 2;\n          const dx = (nx - 0.5) * 2;\n\n          const c0 = Math.cos(kx0 * worldX + ky0 * worldY);\n          const c60 = Math.cos(kx60 * worldX + ky60 * worldY);\n          const c120 = Math.cos(kx120 * worldX + ky120 * worldY);\n          const patternHex = (c0 + c60 + c120) / 3;\n\n          const ellipseR = Math.sqrt(Math.pow(dx * MASK_ELLIPSE_X, 2) + Math.pow(dy, 2));\n          const mask = MASK_CENTER_AMP + (MASK_EDGE_AMP - MASK_CENTER_AMP) * smoothstep(MASK_INNER, MASK_OUTER, ellipseR);\n\n          const h = patternHex * mask; // amplitude 1, subCos at its peak (+1)\n          const t01 = clamp((h + 1) / 2, 0, 1);\n          const [r, g, b] = rampColor(t01, bg, muted, fg);\n\n          pixels[idx] = r;\n          pixels[idx + 1] = g;\n          pixels[idx + 2] = b;\n          pixels[idx + 3] = 255;\n          idx += 4;\n        }\n      }\n    };\n\n    const paint = () => {\n      if (!sized || !imgData) return;\n      bctx.putImageData(imgData, 0, 0);\n      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n      ctx.imageSmoothingEnabled = true;\n      ctx.imageSmoothingQuality = \"high\";\n      ctx.clearRect(0, 0, width, height);\n      ctx.drawImage(buffer, 0, 0, cols, rows, 0, 0, width, height);\n    };\n\n    const renderStatic = () => {\n      computeStaticField();\n      paint();\n    };\n\n    const loop = () => {\n      const t = (performance.now() - startTime) / 1000;\n      computeField(t);\n      paint();\n      raf = requestAnimationFrame(loop);\n    };\n    const wake = () => {\n      if (isStatic) return;\n      if (!raf && sized && visible && !document.hidden) raf = requestAnimationFrame(loop);\n    };\n    const sleep = () => {\n      cancelAnimationFrame(raf);\n      raf = 0;\n    };\n\n    if (isStatic) {\n      renderStatic();\n    } else {\n      computeField(0);\n      paint();\n      wake();\n    }\n\n    const ro = new ResizeObserver(() => {\n      resize();\n      if (isStatic) renderStatic();\n      else paint();\n    });\n    ro.observe(container);\n\n    const io = new IntersectionObserver((entries) => {\n      visible = entries[0]?.isIntersecting ?? true;\n      if (isStatic) return;\n      if (visible) wake();\n      else sleep();\n    });\n    io.observe(container);\n\n    const mo = new MutationObserver(() => {\n      deriveColors();\n      if (isStatic) renderStatic();\n      else paint();\n    });\n    mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\"] });\n\n    const onVis = () => {\n      if (isStatic) return;\n      if (document.hidden) sleep();\n      else wake();\n    };\n    document.addEventListener(\"visibilitychange\", onVis);\n\n    return () => {\n      sleep();\n      ro.disconnect();\n      io.disconnect();\n      mo.disconnect();\n      document.removeEventListener(\"visibilitychange\", onVis);\n    };\n    // cyclesAcrossMin/drivingFrequencyHz/amplitudeDriftPeriod are read\n    // fresh each frame from closure, and isStatic fully determines which\n    // branch runs, so this effect only needs to re-run on those inputs.\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [isStatic, cyclesAcrossMin, drivingFrequencyHz, amplitudeDriftPeriod]);\n\n  return (\n    <div\n      ref={containerRef}\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 h-full w-full\" />\n      {children && <div className=\"pointer-events-none relative z-10 h-full w-full\">{children}</div>}\n    </div>\n  );\n}\n\nHeroFaradayWaveCell.displayName = \"HeroFaradayWaveCell\";\n",
      "type": "registry:ui",
      "target": "components/ui/hero-faraday-wave-cell.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": [
      "hero",
      "background",
      "canvas",
      "physics",
      "fluid",
      "wave",
      "cellular",
      "ambient"
    ],
    "instruction": "Build <HeroFaradayWaveCell cyclesAcrossMin? drivingFrequencyHz? amplitudeDriftPeriod? paused? children? className? style?> as a full-bleed Canvas 2D hero background reproducing Michael Faraday's 1831 observation that a fluid layer vibrated VERTICALLY above a critical driving amplitude develops standing surface waves oscillating at exactly HALF the driving frequency — a parametric, subharmonic response, not a driven resonance at the forcing frequency — and that above threshold the free surface tessellates into cellular patterns (stripes, squares or hexagons) whose symmetry comes from which resonant plane-wave triad the drive selects. MECHANISM: an analytic sum of standing-wave modes on a coarse grid, not a wave-equation solve. One frame-constant base wavevector (magnitude k derived from cyclesAcrossMin cycles across the container's smaller dimension, orientation rotating slowly and continuously) generates three plane-wave families: one wave alone reads as stripes, two orthogonal waves as a square lattice, three waves 60 degrees apart as a hexagonal lattice — the standard three-wave resonant-triad picture behind real parametric pattern selection. Height at a grid point is the weighted sum of all three families' spatial cosine patterns, multiplied by ONE shared subharmonic time factor cos(pi * drivingFrequencyHz * t) — pi*f, not 2*pi*f, because the visible oscillation is HALF the driving frequency by definition — so the whole field inverts in sync every drive cycle, the defining subharmonic signature. A slow driving-amplitude envelope (period amplitudeDriftPeriod, default 46s) sweeps through and periodically below a critical threshold: a smoothstep ramps pattern strength to zero below threshold (a genuinely flat surface, the real below-threshold behavior) and to full strength above it, never an invented fade. Three independent, incommensurate-period sinusoids (27s/33s/41s) set how much of the stripe/square/hex family is present at any moment, sharpened by a power curve so one tessellation usually dominates rather than three lattices blending evenly, matching how a real cellular pattern reorganizes between symmetries instead of interpolating. GRID + BUDGET: the field is evaluated on a small offscreen buffer (~35 samples across the smaller container dimension, aspect-scaled on the other axis, capped near 6500 total cells) and upscaled onto the full-bleed backing canvas via the canvas's own bilinear image smoothing — an interpolated coarse grid, not per-pixel evaluation. Per cell the inner loop does 4 dot products against wavevectors that are recomputed once per frame (not per cell) and 4 cos() calls, keeping the whole field under roughly 30k trig evaluations per frame. TOKENS: a three-stop ramp, trough at --background, mid at --ns-muted, crest at --foreground, read via getComputedStyle(document.documentElement) at mount and re-read on a MutationObserver watching documentElement's class — because the ramp direction is always background-to-foreground regardless of theme, crest and trough stay distinguishable under both polarities without inverting which token reads as 'crest'. No --ns-accent anywhere: this is a resting ambient background, not interaction chrome. LEGIBILITY: a full-frame tessellation fights centered headline/CTA type, the same problem background-halftone-rosette solved with an explicit coverage gradient — here inverted spatially to match a centered content block instead of a centered visual: an elliptical amplitude mask damps the field to ~15% of full amplitude behind the content region and grows to 100% toward the frame edges, so pattern density is bought at the edges rather than behind the type; the damped zone is still visibly live at 15%, never fully flat. SCALE: wavelength is derived from the container's smaller dimension, never a fixed pixel size, so the tessellation reads at the same relative cell size in a full viewport hero or a small preview card. HOST: DPR-capped backing store (1.5, matching other full-bleed showpieces since area cost dominates), ResizeObserver on the host element, IntersectionObserver (threshold 0) plus visibilitychange pausing the single rAF loop when offscreen or hidden. prefers-reduced-motion (and the paused prop) freeze on a pure-hexagon frame at full pattern strength and peak subharmonic phase (weights forced to [0,0,1], amplitude 1, cos term at +1) rather than sampling the live time formula at some t, because a numeric coincidence with the live formula could land on a transitional blend or a below-threshold flat dip — hexagons are chosen specifically because they read as the most legible tessellation at a glance. A11Y: the canvas is aria-hidden and pointer-events are never captured by it; children (headline, CTA) render as real DOM in normal focus order above the field, wrapped in a pointer-events-none layer so only elements that opt back in (a CTA anchor/button) are actually clickable."
  },
  "type": "registry:ui"
}