{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"ridge-footer","type":"registry:block","title":"Ridge footer","description":"A footer that ends in a range of mountains printed in dots, with your name standing among the peaks. The ridges part as the pointer moves.","author":"Hairline UI","dependencies":[],"files":[{"path":"registry/ridge-footer.tsx","type":"registry:component","content":"// Hairline UI · ridge-footer · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n\"use client\";\n\nimport * as React from \"react\";\nimport { FooterCaption, FooterLockup, FooterNav, plateColors, resolveColor, type FooterColumn, type FooterLink } from \"./footer-parts\";\nimport { createRidgeRenderer, readRidgeRgb, type Rgb, type RidgeRenderer } from \"./ridge-gl\";\nimport { useInteractionReducedMotion } from \"./ui-interaction-motion\";\n\n/*\n * A footer that ends in a range of mountains, printed in dots: five ridges in an ordered\n * dither, a low sun, and the brand's name standing among the peaks. The text sits in the\n * sky above. The ridges drift apart a little as the pointer moves (nearer ones move more),\n * and reading a column pans the view toward it.\n */\n\nexport type RidgeLink = FooterLink;\nexport type RidgeColumn = FooterColumn;\n\nexport interface RidgeFooterProps {\n  /** Brand name: shown in the lockup and set among the mountains. */\n  wordmark: string;\n  /** Optional logo beside the name. */\n  logo?: React.ReactNode;\n  /** One short line about the product. */\n  tagline?: string;\n  /** A contact link under the tagline, e.g. an email address. */\n  contact?: RidgeLink;\n  /** Link columns. */\n  columns?: RidgeColumn[];\n  /** \"auto\" follows the theme; \"night\" keeps the dusk plate on light pages too. */\n  tone?: \"auto\" | \"night\";\n  /** The ink of the mountains and the sun. Any CSS colour or token. Defaults to `var(--chart-1)`. */\n  accent?: string;\n  /** Copyright line. */\n  legal?: string;\n  /** Small links beside the copyright. */\n  legalLinks?: RidgeLink[];\n  className?: string;\n}\n\nconst NO_COLUMNS: RidgeColumn[] = [];\nconst NO_LINKS: RidgeLink[] = [];\nconst DEFAULT_ACCENT = \"var(--chart-1, var(--primary))\";\n\nfunction seedFromString(s: string): number {\n  let h = 13;\n  for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) % 997;\n  return (h % 47) * 0.37;\n}\n\nfunction DefaultMark() {\n  return (\n    <svg viewBox=\"0 0 26 26\" className=\"size-[26px] shrink-0\" aria-hidden=\"true\">\n      <rect x=\"0.5\" y=\"0.5\" width=\"25\" height=\"25\" rx=\"6.5\" fill=\"color-mix(in oklab, var(--fp-accent) 14%, transparent)\" stroke=\"color-mix(in oklab, var(--fp-accent) 36%, transparent)\" />\n      <circle cx=\"17\" cy=\"8.5\" r=\"2.5\" fill=\"var(--fp-accent)\" />\n      <path d=\"M5 19.5 10.5 11.5l3.3 4.6 2.2-2.7 4.5 6.1Z\" fill=\"currentColor\" opacity=\"0.88\" />\n    </svg>\n  );\n}\n\nfunction drawRidgeWordMask(ctx: CanvasRenderingContext2D, word: string, w: number, h: number, sceneTop: number, sceneH: number, family: string) {\n  ctx.globalCompositeOperation = \"source-over\";\n  ctx.fillStyle = \"#000\";\n  ctx.fillRect(0, 0, w, h);\n  const label = word.trim() || \"Ridge\";\n  const setFont = (size: number) => {\n    ctx.font = `700 ${size}px ${family}`;\n    if (\"letterSpacing\" in ctx) {\n      (ctx as CanvasRenderingContext2D & { letterSpacing: string }).letterSpacing = `${(-0.045 * size).toFixed(2)}px`;\n    }\n  };\n  setFont(100);\n  const m = ctx.measureText(label);\n  const hRatio = (m.actualBoundingBoxAscent + m.actualBoundingBoxDescent) / 100 || 0.72;\n  const size = Math.max(24, Math.min((w * 0.88) / Math.max(0.5, m.width / 100), (sceneH * 0.56) / hRatio));\n  setFont(size);\n  ctx.textAlign = \"center\";\n  ctx.textBaseline = \"middle\";\n  ctx.fillStyle = \"rgb(255, 0, 0)\";\n  ctx.fillText(label, w * 0.5, sceneTop + sceneH * 0.55);\n}\n\nexport function RidgeFooter({\n  wordmark,\n  logo,\n  tagline,\n  contact,\n  columns = NO_COLUMNS,\n  tone = \"auto\",\n  accent = DEFAULT_ACCENT,\n  legal,\n  legalLinks = NO_LINKS,\n  className = \"\",\n}: RidgeFooterProps) {\n  const reduced = useInteractionReducedMotion();\n  const plateRef = React.useRef<HTMLDivElement>(null);\n  const canvasRef = React.useRef<HTMLCanvasElement>(null);\n  const sceneRef = React.useRef<HTMLDivElement>(null);\n  const parallaxTargetRef = React.useRef({ x: 0, y: 0 });\n\n  React.useEffect(() => {\n    const plate = plateRef.current;\n    const canvas = canvasRef.current;\n    const sceneBand = sceneRef.current;\n    if (!plate || !canvas || !sceneBand) return;\n\n    let renderer: RidgeRenderer | null = null;\n    try {\n      renderer = createRidgeRenderer(canvas);\n    } catch {\n      renderer = null;\n    }\n    if (!renderer) return;\n    const gl = renderer;\n\n    let raf = 0;\n    let visible = false;\n    let hidden = document.hidden;\n    let disposed = false;\n    let revealStart = -1;\n    let born = performance.now();\n    let px = 0;\n    let py = 0;\n\n    const readColors = (): [Rgb, Rgb, Rgb, boolean] => {\n      const css = getComputedStyle(plate);\n      const paper = readRidgeRgb(css.backgroundColor, [0.06, 0.07, 0.1]);\n      const fg = readRidgeRgb(css.color, [0.92, 0.94, 0.98]);\n      const primary = readRidgeRgb(resolveColor(plate, \"var(--fp-accent)\"), [0.19, 0.36, 0.87]);\n      const lum = 0.2126 * paper[0] + 0.7152 * paper[1] + 0.0722 * paper[2];\n      const isDark = tone === \"night\" || lum < 0.42;\n      return [paper, fg, primary, isDark];\n    };\n\n    const seed = seedFromString(wordmark);\n\n    const measure = () => {\n      if (disposed) return;\n      const box = plate.getBoundingClientRect();\n      const band = sceneBand.getBoundingClientRect();\n      const w = Math.max(1, box.width);\n      const h = Math.max(1, box.height);\n      const dpr = Math.min(window.devicePixelRatio || 1, 2);\n      const W = Math.round(w * dpr);\n      const H = Math.round(h * dpr);\n      const topFrac = Math.max(0.05, Math.min(0.9, (band.top - box.top) / h));\n      gl.layout(W, H, dpr, topFrac, seed);\n\n      const mask = document.createElement(\"canvas\");\n      mask.width = W;\n      mask.height = H;\n      const mctx = mask.getContext(\"2d\");\n      if (mctx) {\n        const family = getComputedStyle(plate).fontFamily || \"system-ui, sans-serif\";\n        drawRidgeWordMask(mctx, wordmark, W, H, (band.top - box.top) * dpr, band.height * dpr, family);\n        gl.mask(mask);\n      }\n      gl.colors(...readColors());\n      if (reduced) gl.draw(0, 1, 0, 0);\n    };\n\n    const frame = (now: number) => {\n      raf = 0;\n      if (disposed || !visible || hidden || reduced) return;\n      if (revealStart < 0) revealStart = now;\n      const reveal = 1 - Math.pow(1 - Math.min(1, (now - revealStart) / 1300), 3);\n      const t = (now - born) / 1000;\n      const tgt = parallaxTargetRef.current;\n      px += (tgt.x - px) * 0.07;\n      py += (tgt.y - py) * 0.07;\n      gl.draw(t, reveal, px, py);\n      raf = requestAnimationFrame(frame);\n    };\n\n    const kick = () => {\n      if (!raf && visible && !hidden && !reduced && !disposed) raf = requestAnimationFrame(frame);\n    };\n\n    const start = () => {\n      if (disposed) return;\n      born = performance.now();\n      measure();\n      plate.dataset.ready = \"\";\n      kick();\n    };\n    if (document.fonts?.status === \"loaded\") start();\n    else document.fonts.ready.then(start, start);\n\n    const ro = new ResizeObserver(() => !disposed && plate.dataset.ready !== undefined && measure());\n    ro.observe(plate);\n\n    const io = new IntersectionObserver(\n      ([entry]) => {\n        visible = entry.isIntersecting;\n        if (visible && reduced) gl.draw(0, 1, 0, 0);\n        else kick();\n      },\n      { threshold: 0.12 },\n    );\n    io.observe(plate);\n\n    const onVis = () => {\n      hidden = document.hidden;\n      if (!hidden) kick();\n    };\n    document.addEventListener(\"visibilitychange\", onVis);\n\n    const mo = new MutationObserver(() => {\n      gl.colors(...readColors());\n      if (reduced) gl.draw(0, 1, 0, 0);\n    });\n    mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\", \"style\", \"data-theme\"] });\n\n    const onMove = (e: PointerEvent) => {\n      if (reduced || e.pointerType === \"touch\") return;\n      const r = plate.getBoundingClientRect();\n      const nx = ((e.clientX - r.left) / Math.max(1, r.width)) * 2 - 1;\n      const ny = ((e.clientY - r.top) / Math.max(1, r.height)) * 2 - 1;\n      parallaxTargetRef.current = { x: Math.max(-1, Math.min(1, nx)), y: Math.max(-1, Math.min(1, ny)) };\n    };\n    const onLeave = () => {\n      parallaxTargetRef.current = { x: 0, y: 0 };\n    };\n\n    plate.addEventListener(\"pointermove\", onMove);\n    plate.addEventListener(\"pointerleave\", onLeave);\n\n    return () => {\n      disposed = true;\n      cancelAnimationFrame(raf);\n      raf = 0;\n      ro.disconnect();\n      io.disconnect();\n      mo.disconnect();\n      document.removeEventListener(\"visibilitychange\", onVis);\n      plate.removeEventListener(\"pointermove\", onMove);\n      plate.removeEventListener(\"pointerleave\", onLeave);\n      gl.dispose();\n      delete plate.dataset.ready;\n    };\n  }, [wordmark, tone, accent, reduced]);\n\n  const panToColumn = (index: number, total: number) => {\n    if (reduced) return;\n    const norm = total <= 1 ? 0 : (index / (total - 1)) * 2 - 1;\n    parallaxTargetRef.current = { x: norm * 0.72, y: -0.15 };\n  };\n\n  return (\n    <footer className={`w-full max-w-[1200px] ${className}`}>\n      <div aria-hidden=\"true\" data-natural-width className=\"grid h-0\" style={{ gridTemplateColumns: \"minmax(0, 1200px)\" }} />\n      <div className=\"@container w-full\">\n        <div ref={plateRef} className=\"group/plate relative isolate touch-pan-y overflow-clip rounded-[28px]\" style={plateColors(tone === \"night\", accent)}>\n          <canvas\n            ref={canvasRef}\n            aria-hidden=\"true\"\n            className=\"pointer-events-none absolute inset-0 -z-10 size-full opacity-0 transition-opacity duration-700 group-data-[ready]/plate:opacity-100\"\n          />\n\n          <div className=\"grid grid-cols-1 gap-x-10 gap-y-9 px-[max(20px,5cqi)] pt-[clamp(28px,4.5cqi,56px)] @[700px]:grid-cols-[minmax(0,1fr)_auto]\">\n            <FooterLockup logo={logo ?? <DefaultMark />} name={wordmark} tagline={tagline} contact={contact} />\n            <FooterNav\n              columns={columns}\n              onAim={(el, index) => {\n                if (el) panToColumn(index, columns.length);\n                else parallaxTargetRef.current = { x: 0, y: 0 };\n              }}\n            />\n          </div>\n\n          {/* The range. Until WebGL is ready, and without it, the name shows as faint type. */}\n          <div ref={sceneRef} aria-hidden=\"true\" className=\"relative mt-[clamp(8px,2cqi,24px)] h-[clamp(210px,30cqi,360px)] w-full select-none\">\n            <p className=\"absolute inset-0 flex items-center justify-center text-[15cqi] font-bold tracking-[-0.045em] opacity-20 transition-opacity duration-700 group-data-[ready]/plate:opacity-0\">\n              {wordmark}\n            </p>\n          </div>\n\n          {/* The nearest ridge is dark in both themes, so the small print is always light. */}\n          <div style={{ color: \"color-mix(in oklab, white 88%, var(--fp-accent))\" }}>\n            <FooterCaption legal={legal} links={legalLinks} className=\"relative px-[max(20px,5cqi)] pb-[clamp(18px,2.4cqi,26px)] pt-2\" />\n          </div>\n        </div>\n      </div>\n    </footer>\n  );\n}\n"},{"path":"registry/ridge-gl.ts","type":"registry:component","content":"// Hairline UI · ridge-footer · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n/*\n * A mountain range in ordered dither, in WebGL 1: a sky glow, a low sun, three ridges at\n * different depths that part with the pointer, valley mist, and the brand's name standing\n * between the far and middle ridges.\n */\n\nexport type Rgb = [number, number, number];\n\nconst VERTEX = `attribute vec2 aPos;\nvoid main() { gl_Position = vec4(aPos, 0.0, 1.0); }`;\n\nconst FRAGMENT = `precision highp float;\nuniform sampler2D uMask;\nuniform vec2 uRes;\nuniform float uScale;\nuniform float uTime;\nuniform float uReveal;\nuniform vec2 uParallax;\nuniform float uSceneTop;\nuniform float uSeed;\nuniform float uIsDark;\nuniform vec3 uPaper;\nuniform vec3 uInk;\nuniform vec3 uPrimary;\n\n// 4x4 Bayer threshold matrix (0..1) evaluated cleanly in WebGL 1 without array indexing\nfloat bayer4(vec2 p) {\n  vec2 c = mod(floor(p), 4.0);\n  int x = int(c.x);\n  int y = int(c.y);\n  int m = 0;\n  if (y == 0) { m = (x == 0) ? 0 : (x == 1) ? 8 : (x == 2) ? 2 : 10; }\n  else if (y == 1) { m = (x == 0) ? 12 : (x == 1) ? 4 : (x == 2) ? 14 : 6; }\n  else if (y == 2) { m = (x == 0) ? 3 : (x == 1) ? 11 : (x == 2) ? 1 : 9; }\n  else { m = (x == 0) ? 15 : (x == 1) ? 7 : (x == 2) ? 13 : 5; }\n  return (float(m) + 0.5) / 16.0;\n}\n\nfloat hash1(float n) { return fract(sin(n) * 43758.5453123); }\n\n// Layered organic alpine ridge profile (returns height 0..1 from bottom of scene)\nfloat ridge(float x, float seed, float freq, float amp, float base) {\n  float s = x * freq + seed;\n  float h = 0.0;\n  h += sin(s) * 0.48;\n  h += sin(s * 2.13 + 1.4) * 0.28;\n  h += sin(s * 4.37 - 0.8) * 0.14;\n  h += cos(s * 8.91 + 2.2) * 0.06;\n  // Sharpen mountain peaks slightly like real glacial ridges\n  float peak = 1.0 - abs(sin(s * 1.15 + 0.6));\n  return base + (h * 0.55 + (peak - 0.45) * 0.45) * amp;\n}\n\nvoid main() {\n  vec2 uv = gl_FragCoord.xy / uRes;\n  float y = 1.0 - uv.y; // 0 top, 1 bottom\n\n  // Quantized pixel cell for crisp 2px editorial Bayer dither grain\n  vec2 ditherCoord = floor(gl_FragCoord.xy / max(1.0, 2.0 * uScale));\n  float threshold = bayer4(ditherCoord);\n\n  vec3 col = uPaper;\n  if (y < uSceneTop - 0.04) {\n    gl_FragColor = vec4(col, 1.0);\n    return;\n  }\n\n  // Normalized scene coordinates (0 = sceneTop, 1 = bottom edge)\n  float sy = clamp((y - uSceneTop) / max(0.01, 1.0 - uSceneTop), 0.0, 1.0);\n  float fromBottom = 1.0 - sy;\n  float px = uParallax.x;\n  float py = uParallax.y;\n\n  // Alpine cobalt-blue Risograph & twilight palette derived from primary/accent\n  vec3 skyGlow = uIsDark > 0.5\n    ? mix(uPaper, uPrimary, 0.34)\n    : mix(uPaper, uPrimary, 0.22);\n  vec3 sunCol = uIsDark > 0.5\n    ? mix(uPrimary, vec3(0.95, 0.98, 1.0), 0.16)\n    : mix(uPrimary, uPaper, 0.18);\n  vec3 farCol = uIsDark > 0.5\n    ? mix(uPaper, mix(uPrimary, uInk, 0.35), 0.32)\n    : mix(uPaper, mix(uInk, uPrimary, 0.42), 0.28);\n  vec3 midCol = uIsDark > 0.5\n    ? mix(uPaper, mix(uPrimary, uInk, 0.22), 0.52)\n    : mix(uPaper, mix(uInk, uPrimary, 0.36), 0.52);\n  vec3 nearCol = uIsDark > 0.5\n    ? mix(uPaper, mix(uPrimary, vec3(0.02, 0.03, 0.06), 0.72), 0.88)\n    : mix(uPaper, mix(uInk, uPrimary, 0.22), 0.88);\n  vec3 rimCol = uIsDark > 0.5\n    ? mix(uPrimary, vec3(0.92, 0.96, 1.0), 0.5)\n    : mix(uPrimary, uPaper, 0.18);\n\n  // 1. Atmospheric Bayer-dithered sky glow rising behind the ridges\n  float sunX = 0.66 + px * 0.015;\n  float sunBaseY = mix(0.22, 0.58, uReveal) + py * 0.01;\n  float aspect = uRes.x / max(1.0, uRes.y * max(0.01, 1.0 - uSceneTop));\n  vec2 toSun = vec2((uv.x - sunX) * aspect, fromBottom - sunBaseY);\n  float sunDist = length(toSun);\n  float halo = exp(-sunDist * 1.45) * 0.88 * uReveal;\n  float horizonWash = smoothstep(0.0, 0.85, sy) * 0.45 * uReveal;\n  float skyDither = step(threshold, clamp(halo + horizonWash * 0.65, 0.0, 0.95));\n  col = mix(col, skyGlow, skyDither * smoothstep(uSceneTop - 0.02, uSceneTop + 0.06, y));\n\n  // Crisp stars in upper dark sky\n  if (uIsDark > 0.5 && sy > 0.04 && sy < 0.62) {\n    vec2 cell = floor(ditherCoord / 9.0);\n    float rnd = hash1(dot(cell, vec2(127.1, 311.7)) + uSeed);\n    if (rnd > 0.986) {\n      vec2 inside = fract(ditherCoord / 9.0);\n      if (inside.x < 0.22 && inside.y < 0.22) {\n        float tw = 0.45 + 0.55 * sin(uTime * (1.2 + rnd * 2.0) + rnd * 60.0);\n        col = mix(col, sunCol, tw * 0.75 * uReveal);\n      }\n    }\n  }\n\n  // 2. Bold dithered sun/moon disc behind the far range\n  float sunRad = 0.26;\n  float discEdge = smoothstep(sunRad + 0.04, sunRad - 0.04, sunDist);\n  if (discEdge > 0.01) {\n    float discFill = step(threshold * 0.85, discEdge);\n    float scan = 1.0 - 0.22 * step(0.5, fract(gl_FragCoord.y / (4.0 * uScale))) * smoothstep(sunBaseY + 0.05, sunBaseY - 0.2, fromBottom);\n    col = mix(col, sunCol, discFill * scan * uReveal);\n  }\n\n  // 3. Far mountain ridge (depth 0.35x)\n  float farX = uv.x + px * 0.024;\n  float farH = ridge(farX, uSeed + 1.1, 4.6, 0.24, 0.52) * (0.65 + 0.35 * uReveal);\n  if (fromBottom < farH) {\n    float crestDist = farH - fromBottom;\n    float shade = clamp(crestDist / 0.22, 0.0, 1.0);\n    float dRim = step(threshold, clamp(1.0 - crestDist / 0.065, 0.0, 1.0) * (0.45 + 0.55 * exp(-abs(uv.x - sunX) * 2.2)));\n    float dBody = step(threshold, 0.35 + 0.65 * shade);\n    vec3 mCol = mix(skyGlow, farCol, dBody);\n    mCol = mix(mCol, rimCol, dRim * 0.72);\n    col = mCol;\n  }\n\n  // 4. Monumental brand wordmark standing behind the mid-range ridge\n  float wordRise = (1.0 - uReveal) * 0.14;\n  vec2 wUv = vec2(clamp(uv.x + px * 0.04, 0.0, 1.0), clamp(y - wordRise, 0.0, 1.0));\n  float word = texture2D(uMask, wUv).r;\n  if (word > 0.05) {\n    // The name stays a clear step away from the sun: near-white at night, near-ink by day.\n    vec3 wordColor = uIsDark > 0.5\n      ? mix(uInk, sunCol, 0.08 + 0.1 * exp(-abs(uv.x - sunX) * 1.8))\n      : mix(uInk, uPrimary, 0.12 + 0.1 * exp(-abs(uv.x - sunX) * 1.8));\n    float above = texture2D(uMask, vec2(wUv.x, max(0.0, wUv.y - 2.0 * uScale / uRes.y))).r;\n    float topEdge = clamp(word - above, 0.0, 1.0);\n    col = mix(col, wordColor, word * 0.94);\n    col = mix(col, rimCol, topEdge * 0.75);\n  }\n\n  // 5. Drifting Bayer-dithered valley mist gliding behind mid ridge\n  float mistWave = sin(uv.x * 5.2 - uTime * 0.22 + uSeed) * 0.045 + cos(uv.x * 9.1 + uTime * 0.16) * 0.025;\n  float mistBand = exp(-pow((fromBottom - (0.36 + mistWave)) / 0.095, 2.0));\n  if (mistBand > 0.06) {\n    float mDith = step(threshold, mistBand * 0.52 * uReveal);\n    col = mix(col, skyGlow, mDith * (uIsDark > 0.5 ? 0.55 : 0.48));\n  }\n\n  // 6. Mid mountain ridge (depth 0.72x — physically overlaps bottom of wordmark)\n  float midX = uv.x + px * 0.052;\n  float midH = ridge(midX, uSeed + 4.7, 5.4, 0.22, 0.31) * (0.72 + 0.28 * uReveal);\n  if (fromBottom < midH) {\n    float crestDist = midH - fromBottom;\n    float dRim = step(threshold, clamp(1.0 - crestDist / 0.055, 0.0, 1.0) * (0.35 + 0.65 * exp(-abs(uv.x - sunX) * 2.0)));\n    float slopeGrad = clamp(crestDist / 0.26, 0.0, 1.0);\n    float dSlope = step(threshold, 0.25 + 0.75 * slopeGrad);\n    vec3 mCol = mix(farCol, midCol, dSlope);\n    mCol = mix(mCol, rimCol, dRim * 0.62);\n    col = mCol;\n  }\n\n  // 7. Foreground dark silhouette ridge (depth 1.0x — anchors the bottom caption cleanly)\n  float nearX = uv.x + px * 0.088;\n  float nearH = ridge(nearX, uSeed + 9.3, 3.8, 0.12, 0.215) * (0.75 + 0.25 * uReveal);\n  if (fromBottom < nearH) {\n    float crestDist = nearH - fromBottom;\n    float dRim = step(threshold, clamp(1.0 - crestDist / 0.028, 0.0, 1.0) * 0.55);\n    float dBody = step(threshold, clamp(0.45 + crestDist / 0.14, 0.0, 1.0));\n    col = mix(midCol, nearCol, dBody);\n    col = mix(col, rimCol, dRim * 0.32);\n  }\n\n  gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n}`;\n\nexport function readRidgeRgb(css: string, fallback: Rgb): Rgb {\n  if (typeof document === \"undefined\" || !css) return fallback;\n  const c = document.createElement(\"canvas\");\n  c.width = c.height = 1;\n  const ctx = c.getContext(\"2d\");\n  if (!ctx) return fallback;\n  ctx.fillStyle = css;\n  ctx.fillRect(0, 0, 1, 1);\n  const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;\n  return [r / 255, g / 255, b / 255];\n}\n\nexport function createRidgeRenderer(canvas: HTMLCanvasElement) {\n  const gl = canvas.getContext(\"webgl\", {\n    antialias: false,\n    alpha: false,\n    premultipliedAlpha: false,\n    preserveDrawingBuffer: false,\n    powerPreference: \"low-power\",\n  });\n  if (!gl) return null;\n\n  const compile = (type: number, source: string) => {\n    const s = gl.createShader(type)!;\n    gl.shaderSource(s, source);\n    gl.compileShader(s);\n    if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(s) ?? \"shader\");\n    return s;\n  };\n\n  const program = gl.createProgram()!;\n  gl.attachShader(program, compile(gl.VERTEX_SHADER, VERTEX));\n  gl.attachShader(program, compile(gl.FRAGMENT_SHADER, FRAGMENT));\n  gl.linkProgram(program);\n  if (!gl.getProgramParameter(program, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(program) ?? \"program\");\n  gl.useProgram(program);\n\n  const buffer = gl.createBuffer();\n  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n  gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);\n  const aPos = gl.getAttribLocation(program, \"aPos\");\n  gl.enableVertexAttribArray(aPos);\n  gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 0, 0);\n\n  const maskTex = gl.createTexture();\n  gl.activeTexture(gl.TEXTURE0);\n  gl.bindTexture(gl.TEXTURE_2D, maskTex);\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\n  const u = (n: string) => gl.getUniformLocation(program, n);\n  const at = {\n    res: u(\"uRes\"),\n    scale: u(\"uScale\"),\n    time: u(\"uTime\"),\n    reveal: u(\"uReveal\"),\n    parallax: u(\"uParallax\"),\n    sceneTop: u(\"uSceneTop\"),\n    seed: u(\"uSeed\"),\n    isDark: u(\"uIsDark\"),\n    paper: u(\"uPaper\"),\n    ink: u(\"uInk\"),\n    primary: u(\"uPrimary\"),\n  };\n  gl.uniform1i(u(\"uMask\"), 0);\n\n  return {\n    layout(width: number, height: number, dpr: number, sceneTopFrac: number, seed: number) {\n      canvas.width = width;\n      canvas.height = height;\n      gl.viewport(0, 0, width, height);\n      gl.uniform2f(at.res, width, height);\n      gl.uniform1f(at.scale, dpr);\n      gl.uniform1f(at.sceneTop, sceneTopFrac);\n      gl.uniform1f(at.seed, seed);\n    },\n    mask(image: HTMLCanvasElement) {\n      gl.activeTexture(gl.TEXTURE0);\n      gl.bindTexture(gl.TEXTURE_2D, maskTex);\n      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n    },\n    colors(paper: Rgb, ink: Rgb, primary: Rgb, isDark: boolean) {\n      gl.uniform3f(at.paper, ...paper);\n      gl.uniform3f(at.ink, ...ink);\n      gl.uniform3f(at.primary, ...primary);\n      gl.uniform1f(at.isDark, isDark ? 1 : 0);\n    },\n    draw(time: number, reveal: number, px: number, py: number) {\n      gl.uniform1f(at.time, time);\n      gl.uniform1f(at.reveal, reveal);\n      gl.uniform2f(at.parallax, px, py);\n      gl.drawArrays(gl.TRIANGLES, 0, 3);\n    },\n    dispose() {\n      gl.deleteTexture(maskTex);\n      gl.deleteBuffer(buffer);\n      gl.deleteProgram(program);\n    },\n  };\n}\n\nexport type RidgeRenderer = NonNullable<ReturnType<typeof createRidgeRenderer>>;\n"},{"path":"registry/footer-parts.tsx","type":"registry:component","content":"// Hairline UI · ridge-footer · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n\"use client\";\n\nimport * as React from \"react\";\nimport { INTERACTION_FOCUS, INTERACTION_PRESS } from \"./ui-interaction-motion\";\n\n/*\n * The text of an art-led footer: brand lockup, link columns and small print.\n * It sits inside the picture, so it carries no panels, rules or labels of its own:\n * the plate sets the colours (--fp-fg, --fp-muted, --fp-accent) and the art does the rest.\n */\n\nexport interface FooterLink {\n  label: string;\n  href: string;\n}\n\nexport interface FooterColumn {\n  title: string;\n  links: FooterLink[];\n}\n\nexport const mixColor = (color: string, amount: number, into = \"transparent\") => `color-mix(in oklab, ${color} ${amount}%, ${into})`;\n\n/**\n * Plate colours. \"auto\" follows the theme (card in light, card in dark); \"night\" holds\n * a near-black plate tinted by the accent on any page, for art that only reads at night.\n */\nexport function plateColors(night: boolean, accent: string): React.CSSProperties {\n  return night\n    ? {\n        [\"--fp-accent\" as string]: accent,\n        [\"--fp-fg\" as string]: mixColor(\"white\", 94, accent),\n        [\"--fp-muted\" as string]: mixColor(\"white\", 60),\n        backgroundColor: mixColor(accent, 7, mixColor(\"white\", 5, \"black\")),\n        color: \"var(--fp-fg)\",\n        boxShadow: `0 0 0 1px ${mixColor(\"white\", 9)}, inset 0 1px 0 ${mixColor(\"white\", 9)}`,\n      }\n    : {\n        [\"--fp-accent\" as string]: accent,\n        [\"--fp-fg\" as string]: \"var(--card-foreground)\",\n        [\"--fp-muted\" as string]: \"var(--muted-foreground)\",\n        backgroundColor: \"var(--card)\",\n        color: \"var(--fp-fg)\",\n        boxShadow: \"0 0 0 1px var(--border)\",\n      };\n}\n\nexport function FooterLockup({\n  logo,\n  name,\n  tagline,\n  contact,\n  action,\n}: {\n  logo?: React.ReactNode;\n  name: string;\n  tagline?: string;\n  contact?: FooterLink;\n  action?: FooterLink;\n}) {\n  return (\n    <div className=\"flex max-w-[36ch] flex-col items-start gap-3.5\">\n      <div className=\"flex items-center gap-2.5\">\n        {logo}\n        <p className=\"text-[17px] font-semibold tracking-[-0.02em]\">{name}</p>\n      </div>\n      {tagline && <p className=\"text-pretty text-[14px] leading-6 text-[color:var(--fp-muted)]\">{tagline}</p>}\n      {contact && (\n        <a href={contact.href} className={`group/contact mt-1 inline-flex cursor-pointer items-center gap-1.5 rounded-sm text-[14px] font-medium ${INTERACTION_FOCUS}`}>\n          <span className=\"underline decoration-[color:var(--fp-muted)] decoration-1 underline-offset-[5px] transition-colors group-hover/contact:decoration-[color:var(--fp-accent)]\">\n            {contact.label}\n          </span>\n          <span aria-hidden=\"true\" className=\"transition-transform duration-200 group-hover/contact:translate-x-0.5\">\n            →\n          </span>\n        </a>\n      )}\n      {action && (\n        <a\n          href={action.href}\n          className={`group/action mt-1.5 inline-flex h-9 cursor-pointer items-center gap-1.5 rounded-full px-4 text-[13.5px] font-medium ${INTERACTION_PRESS} ${INTERACTION_FOCUS}`}\n          style={{\n            backgroundColor: \"var(--fp-accent)\",\n            // The label picks its side from the accent itself, so any brand colour stays legible.\n            color: \"oklch(from var(--fp-accent) clamp(0.16, (0.68 - l) * 100, 0.985) calc(c * 0.25) h)\",\n          }}\n        >\n          {action.label}\n          <span aria-hidden=\"true\" className=\"transition-transform duration-200 group-hover/action:translate-x-0.5\">\n            →\n          </span>\n        </a>\n      )}\n    </div>\n  );\n}\n\n/**\n * Link columns. `onAim` reports the column the pointer or keyboard is in (null when it leaves),\n * so the picture can answer it.\n */\nexport function FooterNav({ columns, onAim }: { columns: FooterColumn[]; onAim?: (column: HTMLElement | null, index: number) => void }) {\n  if (!columns.length) return null;\n  return (\n    <nav\n      aria-label=\"Footer\"\n      onPointerLeave={() => onAim?.(null, -1)}\n      className=\"grid grid-cols-2 gap-x-[clamp(16px,4cqi,56px)] gap-y-7 @[440px]:grid-cols-[repeat(3,auto)]\"\n    >\n      {columns.map((col, index) => (\n        <div\n          key={col.title}\n          onPointerEnter={(e) => onAim?.(e.currentTarget, index)}\n          onFocus={(e) => onAim?.(e.currentTarget, index)}\n          onBlur={(e) => {\n            if (!e.currentTarget.contains(e.relatedTarget as Node | null)) onAim?.(null, -1);\n          }}\n          className=\"flex min-w-0 flex-col gap-2.5\"\n        >\n          <p className=\"text-[12px] text-[color:var(--fp-muted)]\">{col.title}</p>\n          <ul className=\"flex flex-col gap-1.5\">\n            {col.links.map((l) => (\n              <li key={l.label}>\n                <a\n                  href={l.href}\n                  className={`cursor-pointer rounded-sm text-[13.5px] transition-colors duration-150 hover:text-[color:var(--fp-accent)] @[480px]:text-[14px] ${INTERACTION_FOCUS}`}\n                >\n                  {l.label}\n                </a>\n              </li>\n            ))}\n          </ul>\n        </div>\n      ))}\n    </nav>\n  );\n}\n\n/** The small print, set as the picture's caption: no rule above it. */\nexport function FooterCaption({\n  legal,\n  links,\n  note,\n  className = \"\",\n}: {\n  legal?: string;\n  links: FooterLink[];\n  /** Anything that belongs beside the copyright, e.g. a local clock. */\n  note?: React.ReactNode;\n  className?: string;\n}) {\n  if (!legal && !links.length && !note) return null;\n  return (\n    <div className={`flex flex-wrap items-center justify-between gap-x-6 gap-y-2 text-[12.5px] ${className}`}>\n      {(legal || note) && (\n        <p className=\"flex flex-wrap items-center gap-x-3 gap-y-1\">\n          {legal && <span>{legal}</span>}\n          {note}\n        </p>\n      )}\n      {links.length > 0 && (\n        <ul className=\"flex flex-wrap gap-x-5 gap-y-1\">\n          {links.map((l) => (\n            <li key={l.label}>\n              <a href={l.href} className={`cursor-pointer rounded-sm opacity-80 transition-opacity hover:opacity-100 ${INTERACTION_FOCUS}`}>\n                {l.label}\n              </a>\n            </li>\n          ))}\n        </ul>\n      )}\n    </div>\n  );\n}\n\n/** A theme colour (any CSS colour, `var(...)` included) resolved to what the browser paints, for canvas and WebGL. */\nexport function resolveColor(host: HTMLElement, value: string): string {\n  const probe = document.createElement(\"span\");\n  probe.style.cssText = \"position:absolute;display:none\";\n  probe.style.color = value;\n  host.appendChild(probe);\n  const out = getComputedStyle(probe).color;\n  probe.remove();\n  return out;\n}\n"},{"path":"registry/ui-interaction-motion.ts","type":"registry:component","content":"// Hairline UI · ridge-footer · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n'use client';\n\nimport * as React from 'react';\n\nexport const EASE_OUT = 'cubic-bezier(0.16, 1, 0.3, 1)';\nexport const EASE_SETTLE = 'cubic-bezier(0.22, 1.18, 0.36, 1)';\n/** Thrown things (indicators, thumbs): a slight overshoot on transform only. */\nexport const EASE_THROW = 'cubic-bezier(0.34, 1.36, 0.64, 1)';\n/**\n * The press every button primitive shares: a 3% give that eases in and settles back.\n * Tailwind v4's scale-* writes the `scale` property, so `scale` has to be in the list\n * or the press snaps.\n */\nexport const INTERACTION_PRESS =\n  'transition-[background-color,color,box-shadow,opacity,scale] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)] active:scale-[0.97] motion-reduce:transition-none motion-reduce:active:scale-100';\nexport const INTERACTION_FOCUS ='focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background';\n\nconst query = '(prefers-reduced-motion: reduce)';\nconst subscribe = (notify: () => void) => {\n  const media = window.matchMedia(query);\n  media.addEventListener('change', notify);\n  return () => media.removeEventListener('change', notify);\n};\nexport const useInteractionReducedMotion = () => React.useSyncExternalStore(subscribe, () => window.matchMedia(query).matches, () => false);\n\nexport function useInteractionActivity<T extends Element>() {\n  const ref = React.useRef<T>(null);\n  const [visible, setVisible] = React.useState(false);\n  const [hidden, setHidden] = React.useState(false);\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const observer = new IntersectionObserver(([entry]) => setVisible(entry.isIntersecting));\n    observer.observe(el);\n    const visibility = () => setHidden(document.hidden);\n    visibility(); document.addEventListener('visibilitychange', visibility);\n    return () => { observer.disconnect(); document.removeEventListener('visibilitychange', visibility); };\n  }, []);\n  return { ref, active: visible && !hidden };\n}\n\nexport function interactionIcon(on: boolean, reduced: boolean): React.CSSProperties {\n  return { opacity: on ? 1 : 0, transform: on ? 'none' : 'scale(0.6)', filter: on ? 'blur(0px)' : 'blur(3px)', transition: reduced ? 'none' : `opacity 220ms ${EASE_OUT}, transform 380ms ${EASE_OUT}, filter 220ms ${EASE_OUT}` };\n}\n\n/** A raised object: one tight contact shadow, one short ambient, a hairline of light on its top edge. */\nexport const MATERIAL_LIFT =\n  'shadow-[0_1px_1.5px_rgb(0_0_0/0.07),0_3px_8px_-2px_rgb(0_0_0/0.1),inset_0_0.5px_0_rgb(255_255_255/0.8)] dark:shadow-[0_1px_2px_rgb(0_0_0/0.5),0_4px_10px_-2px_rgb(0_0_0/0.35),inset_0_0.5px_0_rgb(255_255_255/0.1)]';\n/** A trough something sits in, shaded from above, lit along its bottom edge. */\nexport const MATERIAL_RECESS =\n  'shadow-[inset_0_1px_2.5px_rgb(0_0_0/0.09),inset_0_-0.5px_0_rgb(255_255_255/0.7)] dark:shadow-[inset_0_1px_3px_rgb(0_0_0/0.45),inset_0_-0.5px_0_rgb(255_255_255/0.07)]';\n\nexport type SpringConfig = { stiffness: number; damping: number; mass?: number };\nexport interface Spring {\n  get(): number;\n  getVelocity(): number;\n  getTarget(): number;\n  /** Aim somewhere new from wherever it is now, keeping its speed. */\n  set(target: number): void;\n  /** Add speed (units per second), on top of what it already has. */\n  push(velocity: number): void;\n  /** Be there now, at rest. */\n  jump(value: number): void;\n  configure(config: SpringConfig): void;\n  stop(): void;\n}\n\n// Every moving spring on the page shares one frame loop, which sleeps when the last one rests. Each spring's onFrame runs\n// once per frame after all of them have stepped, so several springs that draw one shape paint it once.\nconst SPRING_STEP = 1 / 240;\ntype Running = { step: () => void };\nconst runningSprings = new Set<Running>();\nconst springPainters = new Set<() => void>();\nlet springFrame = 0;\nlet springLast = 0;\nlet springSpare = 0;\n\nfunction springTick(now: number) {\n  // A hidden tab stops the frames, so the first one back must not count the whole gap as time passed.\n  springSpare += Math.min((now - springLast) / 1000, 0.05);\n  springLast = now;\n  while (springSpare >= SPRING_STEP) {\n    runningSprings.forEach((spring) => spring.step());\n    springSpare -= SPRING_STEP;\n  }\n  const painters = [...springPainters];\n  springPainters.clear();\n  painters.forEach((paint) => paint());\n  springFrame = runningSprings.size ? requestAnimationFrame(springTick) : 0;\n}\n\nfunction wakeSprings(spring: Running) {\n  runningSprings.add(spring);\n  if (springFrame) return;\n  springSpare = 0;\n  springFrame = requestAnimationFrame((now) => {\n    springLast = now - 1000 / 60;\n    springTick(now);\n  });\n}\n\n/**\n * A spring that carries its speed: re-aim it mid-flight and it curves on from where it is, push it while it swings and the\n * push adds to the swing. Use it for anything that can be interrupted; a curve restarts from a standstill every time.\n * `onFrame` should write straight to the DOM. `precision` is how close counts as there, in the value's own units.\n */\nexport function createSpring(initial: number, config: SpringConfig, onFrame: () => void, precision = 0.01): Spring {\n  let value = initial;\n  let velocity = 0;\n  let target = initial;\n  let { stiffness, damping, mass = 1 } = config;\n  const running: Running = {\n    step() {\n      velocity += ((-stiffness * (value - target) - damping * velocity) / mass) * SPRING_STEP;\n      value += velocity * SPRING_STEP;\n      if (Math.abs(value - target) < precision && Math.abs(velocity) < precision * 10) {\n        value = target;\n        velocity = 0;\n        runningSprings.delete(running);\n      }\n      springPainters.add(onFrame);\n    },\n  };\n  return {\n    get: () => value,\n    getVelocity: () => velocity,\n    getTarget: () => target,\n    set(next) {\n      if (next === target && !runningSprings.has(running)) return;\n      target = next;\n      wakeSprings(running);\n    },\n    push(speed) {\n      velocity += speed;\n      wakeSprings(running);\n    },\n    jump(next) {\n      value = next;\n      target = next;\n      velocity = 0;\n      runningSprings.delete(running);\n      onFrame();\n    },\n    configure(next) {\n      ({ stiffness, damping, mass = 1 } = next);\n    },\n    stop() {\n      runningSprings.delete(running);\n    },\n  };\n}\n\n/** Sample recent movement rather than averaging a long drag and losing its release velocity. */\nexport type PointerSample = { x: number; time: number };\nexport function samplePointer(samples: PointerSample[], x: number, time: number) {\n  samples.push({ x, time });\n  while (samples.length > 2 && time - samples[0].time > 100) samples.shift();\n}\nexport function releaseVelocity(samples: PointerSample[], now: number) {\n  if (samples.length < 2 || now - samples[samples.length - 1].time > 100) return 0;\n  const first = samples[0], last = samples[samples.length - 1];\n  return (last.x - first.x) / Math.max(1, last.time - first.time);\n}\n\n/** Smooth Apple/rational rubber-band curve: continuous exponential-like resistance without linear kinks. */\nexport function rubberBand(overshoot: number, dimension = 320, constant = 0.55): number {\n  const d = dimension || 320;\n  const abs = Math.abs(overshoot);\n  return Math.sign(overshoot) * (1 - 1 / ((abs * constant) / d + 1)) * d;\n}\n\n/** Projects resting travel from release velocity (velocity in px/ms; time in seconds). */\nexport function projectInertia(distance: number, velocity: number, time = 0.12): number {\n  return distance + velocity * 1000 * time;\n}\n\n/** Smooths incoming release velocity toward a boundary so springs don't slam or clip into walls. */\nexport function softenVelocity(velocity: number, distanceToTarget: number, factor = 10): number {\n  const maxAllowed = Math.abs(distanceToTarget) * factor;\n  return Math.sign(velocity) * Math.min(Math.abs(velocity), maxAllowed);\n}\n\n/** A damped spring sampled by WAAPI: tuned for organic lightness with a hint of life (3% breath). */\nexport function springFrames(\n  from: number,\n  to: number,\n  velocity = 0,\n  duration = 480,\n  config: { omega?: number; damping?: number; steps?: number } = {},\n) {\n  const { omega = 16, damping = 0.74, steps = 36 } = config;\n  const damped = omega * Math.sqrt(Math.max(0.001, 1 - damping * damping));\n  const displacement = from - to;\n  const coefficient = (velocity * 1000 + damping * omega * displacement) / damped;\n  return Array.from({ length: steps + 1 }, (_, i) => {\n    const t = (i / steps) * (duration / 1000);\n    const value = to + Math.exp(-damping * omega * t) * (displacement * Math.cos(damped * t) + coefficient * Math.sin(damped * t));\n    return { value: i === steps ? to : value, offset: i / steps };\n  });\n}\n\n"}],"css":{},"docs":"Docs and live preview: https://hairlineui.com/blocks/ridge-footer. MIT licensed: https://hairlineui.com/license#components","meta":{"license":"MIT"}}