{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"fluted-footer","type":"registry:block","title":"Fluted footer","description":"A footer that ends in a pane of reeded glass with your name behind it. Light drifts behind the flutes and turns toward the pointer.","author":"Hairline UI","dependencies":[],"files":[{"path":"registry/fluted-footer.tsx","type":"registry:component","content":"// Hairline UI · fluted-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 { createFlutedRenderer, readGlRgb, type FlutedRenderer, type Rgb } from \"./fluted-gl\";\nimport { FooterCaption, FooterLockup, FooterNav, plateColors, resolveColor, type FooterColumn, type FooterLink } from \"./footer-parts\";\nimport { useInteractionReducedMotion } from \"./ui-interaction-motion\";\n\n/*\n * A footer whose foot is a pane of reeded glass with the brand's name behind it.\n * The links sit above the glass on the same plate; the glass rises out of it with no seam.\n * A slow band of light drifts behind the flutes, and follows the pointer or the column\n * you're reading, so each flute's highlight turns toward you.\n */\n\nexport type FlutedLink = FooterLink;\nexport type FlutedColumn = FooterColumn;\n\nexport interface FlutedFooterProps {\n  /** Brand name: shown in the lockup and set large behind the glass. */\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?: FlutedLink;\n  /** Link columns. */\n  columns?: FlutedColumn[];\n  /** \"auto\" follows the theme; \"dark\" keeps a dark plate on light pages too. */\n  tone?: \"auto\" | \"dark\";\n  /** The glass colour. Any CSS colour or token. Defaults to `var(--chart-3)`. */\n  accent?: string;\n  /** Copyright line. */\n  legal?: string;\n  /** Small links beside the copyright. */\n  legalLinks?: FlutedLink[];\n  className?: string;\n}\n\nconst NO_COLUMNS: FlutedColumn[] = [];\nconst NO_LINKS: FlutedLink[] = [];\nconst DEFAULT_ACCENT = \"var(--chart-3, var(--primary))\";\n\nfunction DefaultMark() {\n  return (\n    <svg viewBox=\"0 0 28 28\" className=\"size-7 shrink-0\" aria-hidden=\"true\">\n      <rect x=\"0.5\" y=\"0.5\" width=\"27\" height=\"27\" rx=\"7.5\" fill=\"color-mix(in oklab, var(--fp-accent) 14%, transparent)\" stroke=\"color-mix(in oklab, var(--fp-accent) 40%, transparent)\" />\n      {[8.5, 12.2, 15.8, 19.5].map((x, i) => (\n        <path key={x} d={`M${x} 7.5v13`} stroke=\"var(--fp-accent)\" strokeOpacity={[0.45, 1, 0.8, 0.55][i]} strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n      ))}\n    </svg>\n  );\n}\n\n/** The name twice in one texture: sharp in red, blurred in green, for the flutes to mix between. */\nfunction drawWordMask(ctx: CanvasRenderingContext2D, word: string, w: number, h: number, bandTop: number, bandHeight: number, family: string) {\n  // Opaque black ground: a transparent canvas is stored premultiplied, and WebGL would lift\n  // every faint pixel of the blur to full strength on upload.\n  ctx.globalCompositeOperation = \"source-over\";\n  ctx.fillStyle = \"#000\";\n  ctx.fillRect(0, 0, w, h);\n  const label = word.trim() || \"Fluted\";\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.86) / Math.max(0.5, m.width / 100), (bandHeight * 0.66) / hRatio));\n  setFont(size);\n  const after = ctx.measureText(label);\n  // Centre the letters' ink (not the em box) a little above the middle of the glass.\n  const baseline = bandTop + bandHeight * 0.46 + (after.actualBoundingBoxAscent - after.actualBoundingBoxDescent) / 2;\n  ctx.textAlign = \"center\";\n  ctx.textBaseline = \"alphabetic\";\n  ctx.fillStyle = \"rgb(255, 0, 0)\";\n  ctx.fillText(label, w * 0.5, baseline);\n  ctx.globalCompositeOperation = \"lighter\";\n  ctx.filter = `blur(${Math.max(2, Math.round(size * 0.045))}px)`;\n  ctx.fillStyle = \"rgb(0, 255, 0)\";\n  ctx.fillText(label, w * 0.5, baseline);\n  ctx.filter = \"none\";\n  ctx.globalCompositeOperation = \"source-over\";\n}\n\nexport function FlutedFooter({\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}: FlutedFooterProps) {\n  const reduced = useInteractionReducedMotion();\n  const plateRef = React.useRef<HTMLDivElement>(null);\n  const canvasRef = React.useRef<HTMLCanvasElement>(null);\n  const glassRef = React.useRef<HTMLDivElement>(null);\n  const targetLightRef = React.useRef({ x: 0.5, y: 0.7, active: false });\n\n  React.useEffect(() => {\n    const plate = plateRef.current;\n    const canvas = canvasRef.current;\n    const glassBand = glassRef.current;\n    if (!plate || !canvas || !glassBand) return;\n\n    let renderer: FlutedRenderer | null = null;\n    try {\n      renderer = createFlutedRenderer(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 lightX = 0.5;\n    let lightY = 0.7;\n    let lightStrength = 0;\n\n    const readColors = (): [Rgb, Rgb, Rgb, boolean] => {\n      const css = getComputedStyle(plate);\n      const paper = readGlRgb(css.backgroundColor, [0.05, 0.08, 0.07]);\n      const ink = readGlRgb(css.color, [0.94, 0.94, 0.9]);\n      const lum = 0.2126 * paper[0] + 0.7152 * paper[1] + 0.0722 * paper[2];\n      const isDark = tone === \"dark\" || lum < 0.42;\n      const accentRgb = readGlRgb(resolveColor(plate, \"var(--fp-accent)\"), isDark ? [0.27, 0.78, 0.62] : [0.14, 0.52, 0.42]);\n      return [paper, ink, accentRgb, isDark];\n    };\n\n    const draw = (t: number, reveal: number) => gl.draw(t, reveal, lightX, lightY, lightStrength);\n\n    const measure = () => {\n      if (disposed) return;\n      const box = plate.getBoundingClientRect();\n      const band = glassBand.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, 1.75);\n      const W = Math.round(w * dpr);\n      const H = Math.round(h * dpr);\n      const topFrac = Math.max(0.05, Math.min(0.92, (band.top - box.top) / h));\n      // About one flute per 18px, so the slices stay readable at any width.\n      const ribs = Math.max(22, Math.min(72, Math.round(w / 18)));\n      gl.layout(W, H, topFrac, ribs);\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        drawWordMask(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) draw(1.2, 1);\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) / 1150), 3);\n      const tgt = targetLightRef.current;\n      lightStrength += ((tgt.active ? 1 : 0) - lightStrength) * 0.08;\n      if (tgt.active) {\n        lightX += (tgt.x - lightX) * 0.1;\n        lightY += (tgt.y - lightY) * 0.1;\n      }\n      draw((now - born) / 1000, reveal);\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) draw(1.2, 1);\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) draw(1.2, 1);\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      targetLightRef.current = {\n        x: Math.max(0, Math.min(1, (e.clientX - r.left) / Math.max(1, r.width))),\n        y: Math.max(0, Math.min(1, (e.clientY - r.top) / Math.max(1, r.height))),\n        active: true,\n      };\n    };\n    const onLeave = () => {\n      targetLightRef.current = { ...targetLightRef.current, active: false };\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  // Reading a column turns the light behind the glass toward it.\n  const aimColumn = (el: HTMLElement | null) => {\n    const plate = plateRef.current;\n    if (!plate || reduced) return;\n    if (!el) {\n      targetLightRef.current = { ...targetLightRef.current, active: false };\n      return;\n    }\n    const pr = plate.getBoundingClientRect();\n    const er = el.getBoundingClientRect();\n    targetLightRef.current = { x: Math.max(0, Math.min(1, (er.left + er.width * 0.5 - pr.left) / Math.max(1, pr.width))), y: 0.65, active: true };\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 === \"dark\", 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 columns={columns} onAim={aimColumn} />\n          </div>\n\n          {/* The glass. Until WebGL is ready, and without it, the name shows as faint type. */}\n          <div ref={glassRef} aria-hidden=\"true\" className=\"relative mt-[clamp(20px,4cqi,48px)] h-[clamp(170px,25cqi,320px)] 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          <FooterCaption legal={legal} links={legalLinks} className=\"relative px-[max(20px,5cqi)] pb-[clamp(18px,2.4cqi,26px)] pt-3\" />\n        </div>\n      </div>\n    </footer>\n  );\n}\n"},{"path":"registry/fluted-gl.ts","type":"registry:component","content":"// Hairline UI · fluted-footer · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n/*\n * Fluted glass, in WebGL 1. A pane of reeded glass rises out of the foot of the plate\n * with the brand's name and a slow band of light behind it. Every flute is a small\n * cylindrical lens: it shows a magnified slice of what lies behind it,\n * sharp in the middle and frosted toward its edges, with a highlight on the side that\n * faces the light. The mask texture carries the name twice: sharp in red, blurred in green.\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 uTime;\nuniform float uReveal;\nuniform vec2 uLight;\nuniform float uLightStrength;\nuniform float uRibs;\nuniform float uGlassTop;\nuniform float uIsDark;\nuniform vec3 uPaper;\nuniform vec3 uInk;\nuniform vec3 uAccent;\n\nfloat hash(vec2 p) {\n  return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n}\n\n// Smooth volumetric light curtain evaluated behind the fluted glass\nvec3 sampleCurtain(vec2 p, float t, vec2 lightPos, float lightAmt) {\n  float gy = clamp((p.y - uGlassTop) / max(0.01, 1.0 - uGlassTop), 0.0, 1.0);\n\n  // Flowing multi-ribbon light folds\n  float w1 = sin(p.x * 4.1 + t * 0.44 + sin(gy * 3.0 - t * 0.28) * 0.85);\n  float w2 = sin(p.x * 7.2 - t * 0.56 + gy * 4.2);\n  float w3 = cos(p.x * 2.4 + t * 0.26 - gy * 2.6);\n  float ribbon = clamp(0.46 + 0.30 * w1 + 0.18 * w2 + 0.14 * w3, 0.0, 1.0);\n\n  // Diagonal gallery light beam + pointer-guided spotlight behind glass\n  float beamAxis = 0.5 + 0.25 * sin(t * 0.32);\n  float activeX = mix(beamAxis, lightPos.x, lightAmt);\n  float beam = exp(-pow((p.x - activeX) / 0.34, 2.0));\n  float verticalRise = smoothstep(0.0, 0.28, gy) * (0.48 + 0.52 * smoothstep(0.12, 0.92, gy));\n\n  // Warm champagne highlight harmonizing with the accent hue\n  vec3 champagne = vec3(0.97, 0.93, 0.82);\n\n  vec3 deepBase = uIsDark > 0.5\n    ? mix(uPaper, uAccent * 0.15, 0.58)\n    : mix(uPaper, mix(uInk, uAccent, 0.55), 0.12);\n  vec3 midTone = uIsDark > 0.5\n    ? mix(uAccent * 0.44, uAccent, 0.54)\n    : mix(uAccent, mix(uInk, uAccent, 0.48), 0.22);\n  vec3 highlight = uIsDark > 0.5\n    ? mix(uAccent, champagne, 0.72)\n    : mix(uAccent, champagne, 0.52);\n\n  float intensity = (0.28 + 0.72 * ribbon) * (0.40 + 0.60 * beam) * verticalRise * uReveal;\n  vec3 col = mix(deepBase, midTone, clamp(intensity * 1.12, 0.0, 1.0));\n  col = mix(col, highlight, pow(clamp(intensity * (0.54 + 0.54 * beam), 0.0, 1.0), 2.15) * (uIsDark > 0.5 ? 0.86 : 0.58));\n\n  return col;\n}\n\nvoid main() {\n  vec2 uv = gl_FragCoord.xy / uRes;\n  float y = 1.0 - uv.y; // 0 top, 1 bottom\n\n  // The glass rises out of the plate: no seam, a soft lift over ~90px.\n  float glassMask = smoothstep(-0.25, 1.0, (y - uGlassTop) * uRes.y / 90.0);\n  vec3 col = uPaper;\n\n  if (glassMask > 0.001) {\n    float gy = clamp((y - uGlassTop) / max(0.01, 1.0 - uGlassTop), 0.0, 1.0);\n\n    // Each flute is a cylindrical lens: it shows a magnified slice of what's behind it, so the name\n    // breaks into strips but stays readable.\n    float idx = floor(uv.x * uRibs);\n    float l = fract(uv.x * uRibs) - 0.5;            // -0.5 … 0.5 across one flute\n    float center = (idx + 0.5) / uRibs;\n    float nx = sin(l * 3.14159);                     // surface normal across the flute\n    float sx = center + l / uRibs * (0.74 + 0.26 * (1.0 - uReveal)) + nx * 0.18 / uRibs;\n    float spread = 0.0016;\n\n    vec3 bgC;\n    bgC.r = sampleCurtain(vec2(sx + spread, y), uTime, uLight, uLightStrength).r;\n    bgC.g = sampleCurtain(vec2(sx, y), uTime, uLight, uLightStrength).g;\n    bgC.b = sampleCurtain(vec2(sx - spread, y), uTime, uLight, uLightStrength).b;\n\n    // Crisp letters at the middle of a flute, frosted toward its edges (R = sharp, G = blurred).\n    vec4 m = texture2D(uMask, vec2(clamp(sx, 0.001, 0.999), y));\n    float frost = 0.18 + 0.7 * pow(abs(l) * 2.0, 1.6);\n    float word = mix(m.r, m.g, frost) * uReveal;\n\n    float activeX = mix(0.5 + 0.24 * sin(uTime * 0.32), uLight.x, uLightStrength);\n    float distLight = exp(-pow((uv.x - activeX) / 0.36, 2.0));\n    vec3 champagne = vec3(0.98, 0.95, 0.87);\n\n    vec3 wordCol = uIsDark > 0.5\n      ? mix(mix(uInk, uAccent, 0.32), champagne, 0.42 + 0.50 * distLight)\n      : mix(mix(uInk, uAccent, 0.36), uAccent * 0.72, 0.30 + 0.45 * distLight);\n\n    vec3 glassCol = mix(bgC, wordCol, word * (uIsDark > 0.5 ? 0.9 : 0.82));\n\n    // A thin highlight runs down each flute on the side facing the light; the joins sit in shadow.\n    float lightDirX = clamp((activeX - uv.x) * 2.2, -0.85, 0.85);\n    float spec = pow(max(0.0, 1.0 - abs(nx - lightDirX * 0.55)), 14.0);\n    float groove = smoothstep(0.4, 0.5, abs(l));\n    vec3 specCol = uIsDark > 0.5 ? mix(uAccent, champagne, 0.78) : vec3(1.0, 0.99, 0.96);\n    glassCol += specCol * spec * (uIsDark > 0.5 ? 0.22 : 0.3) * (0.35 + 0.65 * distLight) * uReveal;\n    glassCol = mix(glassCol, uIsDark > 0.5 ? uPaper * 0.4 : mix(uInk, uAccent, 0.28), groove * (uIsDark > 0.5 ? 0.38 : 0.12));\n\n    // The small print sits on the foot of the glass: calm it so the caption reads.\n    float footCalm = smoothstep(0.78, 1.0, gy);\n    glassCol = mix(glassCol, mix(uPaper, uAccent, uIsDark > 0.5 ? 0.1 : 0.06), footCalm * 0.62);\n\n    // Fine grain so the light never bands.\n    glassCol += (hash(gl_FragCoord.xy + fract(uTime) * 11.0) - 0.5) * 0.02;\n\n    col = mix(col, glassCol, glassMask);\n  }\n\n  gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n}`;\n\nexport function readGlRgb(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 createFlutedRenderer(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    time: u(\"uTime\"),\n    reveal: u(\"uReveal\"),\n    light: u(\"uLight\"),\n    lightStrength: u(\"uLightStrength\"),\n    ribs: u(\"uRibs\"),\n    glassTop: u(\"uGlassTop\"),\n    isDark: u(\"uIsDark\"),\n    paper: u(\"uPaper\"),\n    ink: u(\"uInk\"),\n    accent: u(\"uAccent\"),\n  };\n  gl.uniform1i(u(\"uMask\"), 0);\n\n  return {\n    layout(width: number, height: number, glassTopFrac: number, ribs: 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.glassTop, glassTopFrac);\n      gl.uniform1f(at.ribs, ribs);\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, accent: Rgb, isDark: boolean) {\n      gl.uniform3f(at.paper, ...paper);\n      gl.uniform3f(at.ink, ...ink);\n      gl.uniform3f(at.accent, ...accent);\n      gl.uniform1f(at.isDark, isDark ? 1 : 0);\n    },\n    draw(time: number, reveal: number, lightX: number, lightY: number, lightStrength: number) {\n      gl.uniform1f(at.time, time);\n      gl.uniform1f(at.reveal, reveal);\n      gl.uniform2f(at.light, lightX, lightY);\n      gl.uniform1f(at.lightStrength, lightStrength);\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 FlutedRenderer = NonNullable<ReturnType<typeof createFlutedRenderer>>;\n"},{"path":"registry/footer-parts.tsx","type":"registry:component","content":"// Hairline UI · fluted-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 · fluted-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/fluted-footer. MIT licensed: https://hairlineui.com/license#components","meta":{"license":"MIT"}}