{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"tide-footer","type":"registry:block","title":"Tide footer","description":"A footer drawn as one engraved seascape: your name rises out of the water and stands on the horizon, its reflection ripples under the pointer and every link sends a ring across the sea.","author":"Hairline UI","dependencies":[],"files":[{"path":"registry/tide-footer.tsx","type":"registry:component","content":"// Hairline UI · tide-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 { createTide, readColor, Ripples, type Rgb, type Tide } from \"./tide-water\";\nimport { INTERACTION_FOCUS, useInteractionReducedMotion } from \"./ui-interaction-motion\";\n\n/* ─────────────────────────────────────────────────────────\n * TIDE FOOTER: the whole footer is one engraved seascape\n *\n *   plate    one surface, like a print: your line and the\n *            links in the sky, your name standing on the\n *            horizon, its reflection in the sea, the small print\n *            as the caption under the picture; text and letters\n *            share the same side margins\n *   swell    left alone the sea breathes: a drop somewhere\n *            every second or so, a fine rain of small ones, a\n *            slow swell that sways the reflection\n *   mirror   the reflection is drawn into the lines; every ring\n *            bends and tears it\n *   wake     the pointer drags a wake through the water (harder\n *            the faster it moves); over the letters it ripples\n *            their reflection; a click or a tap drops a splash;\n *            on phones a sideways drag does the same\n *   engraved the water is rows of fine ink lines in your theme's\n *            colours, in perspective, lifted by the waves, tinted\n *            --primary on the crests, fading out at the bottom\n *\n * Plain links in a labelled nav; the picture is decoration.\n * ───────────────────────────────────────────────────────── */\n\nexport interface TideLink {\n  label: string;\n  href: string;\n}\n\nexport interface TideColumn {\n  title: string;\n  links: TideLink[];\n}\n\nexport interface TideFooterProps {\n  /** The name: beside the logo, and standing on the horizon. */\n  wordmark: string;\n  /** Your logo mark, shown beside the name (about 32px). */\n  logo?: React.ReactNode;\n  /** A short description under the name. */\n  tagline?: string;\n  /** One way to reach you under the description: an email or a contact page. */\n  contact?: TideLink;\n  columns?: TideColumn[];\n  /** The small print: \"© 2026 Northwind Labs\". */\n  legal?: string;\n  /** Links beside the small print: privacy, terms. */\n  legalLinks?: TideLink[];\n  className?: string;\n}\n\nconst NO_COLUMNS: TideColumn[] = [];\nconst NO_LINKS: TideLink[] = [];\n\nconst mix = (color: string, amount: number, into = \"transparent\") => `color-mix(in oklab, ${color} ${amount}%, ${into})`;\n// The one lit surface: paper with a little of the primary in it, a hairline ring and a lit top edge.\nconst PLATE: React.CSSProperties = {\n  backgroundColor: mix(\"var(--card)\", 96, \"var(--primary)\"),\n  boxShadow: `0 0 0 1px var(--border), inset 0 1px 0 ${mix(\"var(--background)\", 70)}`,\n};\n\nconst lerp = (a: Rgb, b: Rgb, t: number): Rgb => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];\n\nfunction themeColors(el: HTMLElement): [Rgb, Rgb, Rgb] {\n  const css = getComputedStyle(el);\n  const card = readColor(css.getPropertyValue(\"--card\").trim(), [1, 1, 1]);\n  const fg = readColor(css.getPropertyValue(\"--foreground\").trim(), [0.1, 0.1, 0.12]);\n  const primary = readColor(css.getPropertyValue(\"--primary\").trim(), [0.19, 0.36, 0.87]);\n  // The paper is the plate's own background, so the picture and the page around the text are one surface.\n  return [readColor(css.backgroundColor, lerp(card, primary, 0.04)), lerp(fg, primary, 0.3), primary];\n}\n\n/**\n * Draws the mask: the wordmark with its lowest ink on the baseline (red), a rim of paper round it (green)\n * and a low sun behind it (blue). Returns where the word starts and ends, as fractions of the width.\n */\nfunction letters(ctx: CanvasRenderingContext2D, word: string, w: number, baseline: number, tall: number, family: string) {\n  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n  const set = (size: number) => {\n    ctx.font = `650 ${size}px ${family}`;\n    if (\"letterSpacing\" in ctx) (ctx as CanvasRenderingContext2D & { letterSpacing: string }).letterSpacing = `${(-0.045 * size).toFixed(2)}px`;\n  };\n  set(100);\n  const m = ctx.measureText(word);\n  const ratio = (m.actualBoundingBoxAscent + m.actualBoundingBoxDescent) / 100 || 0.72;\n  const size = Math.min((w * 0.9) / Math.max(1, m.width / 100), tall / ratio);\n  set(size);\n  const mm = ctx.measureText(word);\n  const x = (w - mm.width) / 2;\n  const y = baseline - mm.actualBoundingBoxDescent;\n  ctx.lineJoin = \"round\";\n  ctx.lineWidth = size * 0.08;\n  ctx.strokeStyle = \"rgb(0, 255, 0)\";\n  ctx.strokeText(word, x, y);\n  ctx.globalCompositeOperation = \"lighter\";\n  ctx.fillStyle = \"rgb(255, 0, 0)\";\n  ctx.fillText(word, x, y);\n  ctx.fillStyle = \"rgb(0, 0, 255)\";\n  ctx.beginPath();\n  ctx.arc(w * 0.6, baseline - tall * 0.42, tall * 0.62, 0, Math.PI * 2);\n  ctx.fill();\n  ctx.globalCompositeOperation = \"source-over\";\n  return { from: x / w, to: (x + mm.width) / w };\n}\n\nexport function TideFooter({ wordmark, logo, tagline, contact, columns = NO_COLUMNS, legal, legalLinks = NO_LINKS, className = \"\" }: TideFooterProps) {\n  const reduced = useInteractionReducedMotion();\n  const plateRef = React.useRef<HTMLDivElement>(null);\n  const canvasRef = React.useRef<HTMLCanvasElement>(null);\n  const markRef = React.useRef<HTMLDivElement>(null);\n  const seaRef = React.useRef<HTMLDivElement>(null);\n\n  React.useEffect(() => {\n    const plate = plateRef.current;\n    const canvas = canvasRef.current;\n    const mark = markRef.current;\n    const seaBand = seaRef.current;\n    if (!plate || !canvas || !mark || !seaBand) return;\n    let tide: Tide | null = null;\n    try {\n      tide = createTide(canvas);\n    } catch {\n      tide = null;\n    }\n    if (!tide) return;\n    const water = tide;\n    let ripples: Ripples | null = null;\n    let raf = 0;\n    let visible = false;\n    let disposed = false;\n    // The plate's width, the horizon and the sea's depth in CSS px from its top, how far the letters sink\n    // before they surface (a fraction of the plate's height) and where the word starts and ends.\n    let geo = { w: 1, horizon: 0, sea: 1, sink: 0, from: 0, to: 1 };\n    let nextDrop = 0;\n    let last = { x: 0, y: 0, t: 0 };\n    // When the name started to surface (0: not yet, still under water).\n    let surfaced = 0;\n    let lastLink: Element | null = null;\n\n    const measure = () => {\n      const box = plate.getBoundingClientRect();\n      const markBox = mark.getBoundingClientRect();\n      const w = Math.max(1, box.width);\n      const h = Math.max(1, box.height);\n      const horizon = markBox.bottom - box.top;\n      const sea = Math.max(1, seaBand.getBoundingClientRect().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      water.layout(W, H, dpr, Math.round(sea / 4.6), horizon / h, (horizon + sea) / h);\n      const family = getComputedStyle(mark).fontFamily || \"system-ui, sans-serif\";\n      // The letters at the canvas's size, with their rim, standing on the horizon.\n      const mask = document.createElement(\"canvas\");\n      mask.width = W;\n      mask.height = H;\n      const mctx = mask.getContext(\"2d\");\n      const word = mctx ? letters(mctx, wordmark, W, horizon * dpr, markBox.height * dpr * 0.94, family) : { from: 0, to: 1 };\n      water.mask(mask);\n      geo = { w, horizon, sea, sink: (markBox.height * 1.02) / h, ...word };\n      // The sea's grid: about 4.5px a column, and rows in perspective (more of them, bunched at the horizon).\n      const gw = Math.max(90, Math.min(300, Math.round(w / 4.5)));\n      const gh = Math.max(24, Math.min(140, Math.round((2.2 * gw * sea) / w)));\n      ripples = new Ripples(gw, gh);\n      water.colors(...themeColors(plate));\n      if (reduced) still();\n      else draw();\n    };\n\n    // How far under the water the letters are: all the way until they surface, then up over 1.5s with a small bob.\n    const depthOfName = (now: number) => {\n      if (reduced) return 0;\n      if (!surfaced) return 1;\n      const t = Math.min(1, (now - surfaced) / 1500) - 1;\n      return -(t * t * (1.9 * t + 0.9));\n    };\n    const born = performance.now();\n    const draw = (now = born) => ripples && water.draw(ripples.encode(), ripples.w, ripples.h, (now - born) / 1000, depthOfName(now) * geo.sink);\n    // Reduced motion: a few rings, settled a little, drawn once.\n    const still = () => {\n      if (!ripples) return;\n      for (const [fx, fy] of [[0.18, 0.4], [0.52, 0.2], [0.84, 0.55]]) ripples.drop(fx * ripples.w, fy * ripples.h, 3, 1.4);\n      for (let i = 0; i < 70; i++) ripples.step();\n      draw();\n    };\n\n    const frame = (now: number) => {\n      raf = 0;\n      if (!visible || disposed || !ripples) return;\n      // The swell: a drop every second or so, and a fine rain of small ones.\n      if (now > nextDrop) {\n        ripples.drop(Math.random() * ripples.w, (0.1 + Math.random() * 0.85) * ripples.h, 2.6, 0.65);\n        nextDrop = now + 700 + Math.random() * 900;\n      }\n      if (Math.random() < 0.25) ripples.drop(Math.random() * ripples.w, Math.random() * ripples.h, 1, 0.07);\n      // While the name surfaces, water streams off the letters at the waterline.\n      if (surfaced && now - surfaced < 1100) {\n        for (let i = 0; i < 2; i++) ripples.drop((geo.from + Math.random() * (geo.to - geo.from)) * ripples.w, 1.5, 2, 0.3);\n      }\n      ripples.step();\n      draw(now);\n      raf = requestAnimationFrame(frame);\n    };\n    const run = () => {\n      if (!raf && visible && !reduced) raf = requestAnimationFrame(frame);\n    };\n\n    // A point on the sea's grid, or null away from the water. Over the letters it lands in their\n    // reflection (the same distance below the horizon), so touching a letter ripples its mirror image.\n    const cell = (e: PointerEvent) => {\n      if (!ripples) return null;\n      const box = plate.getBoundingClientRect();\n      const depth = Math.abs(e.clientY - box.top - geo.horizon) / geo.sea;\n      if (depth > 1) return null;\n      return { x: ((e.clientX - box.left) / geo.w) * ripples.w, y: Math.max(1.5, Math.pow(depth, 0.68) * ripples.h) };\n    };\n    // The wake: drops along the path the pointer moved, harder the faster it went.\n    const onMove = (e: PointerEvent) => {\n      if (reduced || (e.pointerType === \"touch\" && e.buttons === 0)) return;\n      const p = cell(e);\n      if (!p || !ripples) {\n        last = { ...last, t: 0 };\n        return;\n      }\n      const dt = Math.max(8, e.timeStamp - last.t);\n      const speed = Math.hypot(p.x - last.x, p.y - last.y) / dt;\n      if (e.timeStamp - last.t < 120) {\n        const steps = Math.min(6, Math.ceil(Math.hypot(p.x - last.x, p.y - last.y) / 2));\n        for (let i = 1; i <= steps; i++) ripples.drop(last.x + ((p.x - last.x) * i) / steps, last.y + ((p.y - last.y) * i) / steps, 2.2, Math.min(0.9, 0.12 + speed * 2.4) / steps);\n      }\n      last = { x: p.x, y: p.y, t: e.timeStamp };\n    };\n    const onDown = (e: PointerEvent) => {\n      if (reduced || (e.target instanceof Element && e.target.closest(\"a\"))) return;\n      const p = cell(e);\n      if (!p || !ripples) return;\n      ripples.drop(p.x, p.y, 3.8, 3);\n      last = { x: p.x, y: p.y, t: e.timeStamp };\n    };\n    // Reaching a link (pointer or keyboard) sends a ring across the sea below it.\n    const ring = (link: Element) => {\n      if (reduced || !ripples || link === lastLink) return;\n      lastLink = link;\n      const box = plate.getBoundingClientRect();\n      const r = link.getBoundingClientRect();\n      ripples.drop(((r.left + r.width / 2 - box.left) / geo.w) * ripples.w, ripples.h * 0.22, 3, 1.1);\n    };\n    const onOver = (e: PointerEvent) => {\n      const link = e.target instanceof Element ? e.target.closest(\"a\") : null;\n      if (link) ring(link);\n      else lastLink = null;\n    };\n    const onFocus = (e: FocusEvent) => {\n      if (e.target instanceof Element && e.target.closest(\"a\")) ring(e.target);\n    };\n    // The name surfaces once, when most of it is on screen; it breaks the water along its width.\n    const surface = new IntersectionObserver(\n      ([entry]) => {\n        if (!entry.isIntersecting || surfaced || reduced || !ripples) return;\n        surfaced = performance.now();\n        for (let x = geo.from * ripples.w; x <= geo.to * ripples.w; x += 3) ripples.drop(x, 1.5, 2.4, 0.7);\n        surface.disconnect();\n      },\n      { threshold: 0.6 },\n    );\n\n    const start = () => {\n      if (disposed) return;\n      measure();\n      plate.dataset.ready = \"\";\n      surface.observe(mark);\n      run();\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    const io = new IntersectionObserver(([entry]) => {\n      visible = entry.isIntersecting;\n      run();\n    });\n    io.observe(plate);\n    const mo = new MutationObserver(() => {\n      water.colors(...themeColors(plate));\n      if (reduced) draw();\n    });\n    mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\", \"style\", \"data-theme\"] });\n    plate.addEventListener(\"pointermove\", onMove);\n    plate.addEventListener(\"pointerdown\", onDown);\n    plate.addEventListener(\"pointerover\", onOver);\n    plate.addEventListener(\"focusin\", onFocus);\n\n    return () => {\n      disposed = true;\n      cancelAnimationFrame(raf);\n      ro.disconnect();\n      io.disconnect();\n      mo.disconnect();\n      surface.disconnect();\n      plate.removeEventListener(\"pointermove\", onMove);\n      plate.removeEventListener(\"pointerdown\", onDown);\n      plate.removeEventListener(\"pointerover\", onOver);\n      plate.removeEventListener(\"focusin\", onFocus);\n      water.dispose();\n      delete plate.dataset.ready;\n    };\n  }, [wordmark, reduced]);\n\n  return (\n    <footer className={`w-full max-w-[1200px] ${className}`}>\n      {/* Its natural width where the parent sizes to its content, without forcing it on narrow screens. */}\n      <div aria-hidden=\"true\" data-natural-width className=\"grid h-0\" style={{ gridTemplateColumns: \"minmax(0, 1200px)\" }} />\n      <div className=\"@container w-full\">\n        {/* One plate: the picture is drawn behind everything, and the text sits on the same margins as the letters. */}\n        <div ref={plateRef} className=\"group/plate relative isolate touch-pan-y overflow-clip rounded-[28px] text-card-foreground\" style={PLATE}>\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            <div className=\"flex max-w-[34ch] 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]\">{wordmark}</p>\n              </div>\n              {tagline && <p className=\"text-pretty text-[14px] leading-6 text-muted-foreground\">{tagline}</p>}\n              {contact && (\n                <a\n                  href={contact.href}\n                  className={`group/contact mt-1 inline-flex cursor-pointer items-center gap-1.5 rounded-sm text-[14px] font-medium ${INTERACTION_FOCUS}`}\n                >\n                  <span className=\"underline decoration-border underline-offset-[5px] transition-colors group-hover/contact:decoration-primary\">{contact.label}</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            </div>\n            {columns.length > 0 && (\n              <nav aria-label=\"Footer\" className=\"grid grid-cols-3 gap-x-[clamp(14px,4cqi,56px)] gap-y-7\">\n                {columns.map((col) => (\n                  <div key={col.title} className=\"flex min-w-0 flex-col gap-2.5\">\n                    <p className=\"text-[12px] text-muted-foreground\">{col.title}</p>\n                    <ul className=\"flex flex-col gap-1.5\">\n                      {col.links.map((l) => (\n                        <li key={l.label}>\n                          <a href={l.href} className={`cursor-pointer rounded-sm text-[13.5px] transition-colors hover:text-primary @[480px]:text-[14px] ${INTERACTION_FOCUS}`}>\n                            {l.label}\n                          </a>\n                        </li>\n                      ))}\n                    </ul>\n                  </div>\n                ))}\n              </nav>\n            )}\n          </div>\n\n          {/* The name stands on the bottom of this band (the horizon); until the water is ready, and without WebGL, it shows as type. */}\n          <div ref={markRef} aria-hidden=\"true\" className=\"relative mt-[clamp(36px,7cqi,96px)] h-[16cqi] select-none\">\n            <p\n              className=\"absolute inset-x-0 bottom-0 text-center text-[17.5cqi] font-semibold leading-[0.72] tracking-[-0.045em] transition-opacity duration-700 group-data-[ready]/plate:opacity-0\"\n              style={{ color: mix(\"var(--foreground)\", 70, \"var(--primary)\") }}\n            >\n              {wordmark}\n            </p>\n          </div>\n          {/* The sea and the reflection. */}\n          <div ref={seaRef} aria-hidden=\"true\" className=\"h-[max(104px,19cqi)]\" />\n\n          {(legal || legalLinks.length > 0) && (\n            <div className=\"flex flex-wrap items-center justify-between gap-x-6 gap-y-2 px-[max(20px,5cqi)] pb-[clamp(18px,2.5cqi,28px)] pt-2 text-[12.5px] text-muted-foreground\">\n              {legal && <p>{legal}</p>}\n              {legalLinks.length > 0 && (\n                <ul className=\"flex flex-wrap gap-x-5 gap-y-1\">\n                  {legalLinks.map((l) => (\n                    <li key={l.label}>\n                      <a href={l.href} className={`cursor-pointer rounded-sm transition-colors hover:text-foreground ${INTERACTION_FOCUS}`}>\n                        {l.label}\n                      </a>\n                    </li>\n                  ))}\n                </ul>\n              )}\n            </div>\n          )}\n        </div>\n      </div>\n    </footer>\n  );\n}\n"},{"path":"registry/tide-water.ts","type":"registry:component","content":"// Hairline UI · tide-footer · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n/* ─────────────────────────────────────────────────────────\n * TIDE water (React-free)\n *\n *   Ripples   a height field covering the sea, stepped with the\n *             two-buffer wave equation; its rows are in\n *             perspective (they bunch up towards the horizon), so\n *             rings flatten into ellipses the further away they are\n *   renderer  one WebGL 1 shader draws a side view: the letters\n *             stand on the horizon, solid ink with a lit top edge;\n *             below, the sea is rows of fine ink lines, close at\n *             the horizon and opening out towards you, lifted by\n *             the waves, thicker on the slopes in shadow, tinted\n *             on the crests; the wordmark's reflection is drawn\n *             into the lines (thicker, tinted), and the waves\n *             bend and break it\n * The field is uploaded as an 8-bit texture each frame (a few\n * kilobytes) and filtered smooth on the GPU.\n * ───────────────────────────────────────────────────────── */\n\nexport class Ripples {\n  readonly w: number;\n  readonly h: number;\n  private cur: Float32Array;\n  private prev: Float32Array;\n  readonly bytes: Uint8Array;\n\n  constructor(w: number, h: number) {\n    this.w = w;\n    this.h = h;\n    this.cur = new Float32Array(w * h);\n    this.prev = new Float32Array(w * h);\n    this.bytes = new Uint8Array(w * h);\n  }\n\n  /** A round push into the water at (x, y) in cells. */\n  drop(x: number, y: number, radius: number, strength: number) {\n    const r = Math.max(1, radius);\n    const x0 = Math.max(1, Math.floor(x - r));\n    const x1 = Math.min(this.w - 2, Math.ceil(x + r));\n    const y0 = Math.max(1, Math.floor(y - r));\n    const y1 = Math.min(this.h - 2, Math.ceil(y + r));\n    for (let j = y0; j <= y1; j++)\n      for (let i = x0; i <= x1; i++) {\n        const d = Math.hypot(i - x, j - y) / r;\n        if (d >= 1) continue;\n        this.cur[j * this.w + i] -= strength * (Math.cos(d * Math.PI) * 0.5 + 0.5);\n      }\n  }\n\n  /** One step of the wave equation; returns the field's energy so a caller can tell when it's calm. */\n  step(damping = 0.986) {\n    const { w, h, cur, prev } = this;\n    let energy = 0;\n    for (let j = 1; j < h - 1; j++) {\n      let k = j * w + 1;\n      for (let i = 1; i < w - 1; i++, k++) {\n        const n = ((cur[k - 1] + cur[k + 1] + cur[k - w] + cur[k + w]) * 0.5 - prev[k]) * damping;\n        prev[k] = n;\n        energy += n * n;\n      }\n    }\n    this.prev = cur;\n    this.cur = prev;\n    return energy;\n  }\n\n  /** The field as bytes, 128 being still water. */\n  encode(gain = 90) {\n    const { cur, bytes } = this;\n    for (let k = 0; k < cur.length; k++) {\n      const v = 128 + cur[k] * gain;\n      bytes[k] = v < 0 ? 0 : v > 255 ? 255 : v;\n    }\n    return bytes;\n  }\n}\n\nconst VERTEX = `attribute vec2 aPos;\nvoid main() { gl_Position = vec4(aPos, 0.0, 1.0); }`;\n\nconst FRAGMENT = `precision highp float;\nuniform sampler2D uField;\nuniform sampler2D uMask;\nuniform vec2 uRes;\nuniform vec2 uGrid;\nuniform float uLines;\nuniform float uScale;\nuniform float uHorizon;\nuniform float uSeaEnd;\nuniform float uRise;\nuniform float uTime;\nuniform vec3 uPaper;\nuniform vec3 uInk;\nuniform vec3 uCrest;\n\nfloat field(vec2 p) { return texture2D(uField, p).r * 2.0 - 1.0; }\n// The water's height at (x, row): the simulated rings plus a slow swell.\nfloat sea(vec2 p) {\n  return field(p) + 0.1 * sin(p.x * 13.0 + p.y * 9.0 + uTime * 0.9) * sin(p.x * 3.7 - p.y * 2.0 - uTime * 0.45);\n}\nfloat band(float v, float width) {\n  float d = abs(fract(v) - 0.5);\n  return 1.0 - smoothstep(width - 0.08, width + 0.08, d);\n}\n\nvoid main() {\n  vec2 uv = gl_FragCoord.xy / uRes;\n  float y = 1.0 - uv.y;\n  float span = uSeaEnd - uHorizon;\n  // The letters rise out of the water (uRise, from the top of the plate's height); the sun stays put.\n  vec4 m = texture2D(uMask, vec2(uv.x, y - uRise));\n  float sun = texture2D(uMask, vec2(uv.x, y)).b;\n  vec3 col = uPaper;\n\n  if (y < uHorizon) {\n    // The sky: faint ruled lines just above the horizon, fading upwards, kept off the letters by their rim.\n    float fade = clamp(1.0 - (uHorizon - y) / (span * 1.1), 0.0, 1.0);\n    float sky = band((uHorizon - y) * uRes.y / (9.0 * uScale), 0.06) * 0.13 * (1.0 - m.g) * fade * fade;\n    col = mix(col, uInk, sky);\n    // A low sun behind the name, engraved in fine lines.\n    float disc = band(gl_FragCoord.y / (3.2 * uScale), 0.16) * sun * (1.0 - m.g);\n    col = mix(col, uCrest, disc * 0.42);\n  } else if (y < uSeaEnd) {\n    // The sea: rows of lines in perspective, close at the horizon and opening out towards you,\n    // lifted by the waves. The grid runs in the same rows, so rings flatten with distance.\n    float depth = (y - uHorizon) / span;\n    float row = pow(depth, 0.68);\n    vec2 p = vec2(uv.x, row);\n    vec2 cell = 1.0 / uGrid;\n    float h = sea(p);\n    float dx = sea(p + vec2(cell.x, 0.0)) - sea(p - vec2(cell.x, 0.0));\n    float dy = sea(p + vec2(0.0, cell.y)) - sea(p - vec2(0.0, cell.y));\n    float v = (row + h * 0.022) * uLines;\n    // The reflections, mirrored in the horizon: swayed gently by the swell and torn by the rings' slopes.\n    float sway = (0.001 + 0.004 * depth) * sin(row * 20.0 + uTime * 1.3) + 0.0012 * sin(row * 47.0 - uTime * 2.1);\n    vec2 ref = vec2(uv.x + sway + dx * 0.08, uHorizon - (y - uHorizon) + dy * 0.08 + h * 0.012);\n    float away = 1.0 - smoothstep(0.45, 1.0, depth);\n    float refl = texture2D(uMask, ref - vec2(0.0, uRise)).r * away;\n    float glow = texture2D(uMask, ref).b * (1.0 - refl) * away;\n    float shade = clamp(0.4 - dy * 6.0 + abs(h) * 0.5, 0.0, 1.0);\n    float width = (0.08 + 0.16 * shade) * (0.5 + 0.5 * depth) + refl * 0.2 + glow * 0.12;\n    float line = band(v, width);\n    float crest = smoothstep(0.12, 0.5, h);\n    vec3 ink = mix(uInk, uCrest, max(max(crest, refl * 0.3), glow * 0.85));\n    // Like the bottom of an engraving, the sea fades out into the paper before the caption.\n    float fade = 1.0 - smoothstep(0.72, 1.0, depth);\n    col = mix(col, ink, line * (0.26 + 0.5 * depth + refl * 0.2 + glow * 0.15) * fade);\n  }\n  // The horizon: one fine line.\n  col = mix(col, uInk, (1.0 - smoothstep(0.0, 1.2 * uScale, abs(y - uHorizon) * uRes.y)) * 0.3);\n\n  // The letters stand on the horizon (only what is above the water): solid ink, lit along their top edges.\n  if (y < uHorizon) {\n    float above = texture2D(uMask, vec2(uv.x, y - uRise - 1.6 * uScale / uRes.y)).r;\n    float edge = clamp(m.r - above, 0.0, 1.0);\n    col = mix(col, mix(uInk, uCrest, 0.2), m.r);\n    col = mix(col, mix(uCrest, uPaper, 0.35), edge * 0.85);\n  }\n  gl_FragColor = vec4(col, 1.0);\n}`;\n\nexport type Rgb = [number, number, number];\n\nexport function createTide(canvas: HTMLCanvasElement) {\n  const gl = canvas.getContext(\"webgl\", { antialias: false, alpha: false, premultipliedAlpha: false, preserveDrawingBuffer: false, powerPreference: \"low-power\" });\n  if (!gl) return null;\n  const shader = (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  const program = gl.createProgram()!;\n  gl.attachShader(program, shader(gl.VERTEX_SHADER, VERTEX));\n  gl.attachShader(program, shader(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 texture = (unit: number) => {\n    const t = gl.createTexture();\n    gl.activeTexture(gl.TEXTURE0 + unit);\n    gl.bindTexture(gl.TEXTURE_2D, t);\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    return t;\n  };\n  const fieldTex = texture(0);\n  const maskTex = texture(1);\n  gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n\n  const u = (n: string) => gl.getUniformLocation(program, n);\n  const at = { res: u(\"uRes\"), grid: u(\"uGrid\"), lines: u(\"uLines\"), scale: u(\"uScale\"), horizon: u(\"uHorizon\"), seaEnd: u(\"uSeaEnd\"), rise: u(\"uRise\"), time: u(\"uTime\"), paper: u(\"uPaper\"), ink: u(\"uInk\"), crest: u(\"uCrest\") };\n  gl.uniform1i(u(\"uField\"), 0);\n  gl.uniform1i(u(\"uMask\"), 1);\n  let grid: [number, number] = [1, 1];\n\n  return {\n    /** Sizes the canvas (device pixels), the number of lines in the sea, and where the horizon and the end of the sea are (0 top to 1 bottom). */\n    layout(width: number, height: number, dpr: number, lines: number, horizon: number, seaEnd: number) {\n      gl.uniform1f(at.horizon, horizon);\n      gl.uniform1f(at.seaEnd, seaEnd);\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.lines, lines);\n      gl.uniform1f(at.scale, dpr);\n    },\n    /** The letters (red), the rim of paper round them (green) and the sun (blue), at the canvas's size. */\n    mask(image: HTMLCanvasElement) {\n      gl.activeTexture(gl.TEXTURE1);\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, crest: Rgb) {\n      gl.uniform3f(at.paper, ...paper);\n      gl.uniform3f(at.ink, ...ink);\n      gl.uniform3f(at.crest, ...crest);\n    },\n    /** Uploads the field and draws a frame at a time in seconds (for the swell), the letters lowered by rise (a fraction of the height). */\n    draw(bytes: Uint8Array, w: number, h: number, time: number, rise = 0) {\n      gl.uniform1f(at.time, time);\n      gl.uniform1f(at.rise, rise);\n      gl.activeTexture(gl.TEXTURE0);\n      gl.bindTexture(gl.TEXTURE_2D, fieldTex);\n      if (grid[0] !== w || grid[1] !== h) {\n        grid = [w, h];\n        gl.uniform2f(at.grid, w, h);\n        gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w, h, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, bytes);\n      } else gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, w, h, gl.LUMINANCE, gl.UNSIGNED_BYTE, bytes);\n      gl.drawArrays(gl.TRIANGLES, 0, 3);\n    },\n    dispose() {\n      gl.deleteTexture(fieldTex);\n      gl.deleteTexture(maskTex);\n      gl.deleteBuffer(buffer);\n      gl.deleteProgram(program);\n    },\n  };\n}\n\nexport type Tide = NonNullable<ReturnType<typeof createTide>>;\n\n/** A CSS colour (any space the browser knows) as 0..1 RGB, read through a 1px canvas. */\nexport function readColor(css: string, fallback: Rgb): Rgb {\n  const c = document.createElement(\"canvas\");\n  c.width = c.height = 1;\n  const ctx = c.getContext(\"2d\");\n  if (!ctx || !css) 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"},{"path":"registry/ui-interaction-motion.ts","type":"registry:component","content":"// Hairline UI · tide-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/ui/tide-footer. MIT licensed: https://hairlineui.com/license#components","meta":{"license":"MIT"}}