{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"glass-tint-footer","type":"registry:component","title":"Glass Tint Footer","description":"A liquid-glass footer slab that rises over the section above as you scroll in, its meniscus edge sloshing on fast scrolls, with a pointer light, a droplet gliding between links and frost re-tinted to that section.","dependencies":[],"registryDependencies":[],"files":[{"path":"components/viberdy/glass-tint-footer.tsx","content":"\"use client\";\n\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport type { FormEvent, PointerEvent as ReactPointerEvent } from \"react\";\n\n/**\n * GlassTintFooter — a footer of liquid glass that rises over the section\n * above it as you scroll, with a liquid top edge and a tint borrowed from\n * that section.\n *\n * The footer is a thick glass slab. As it scrolls into view its top edge\n * climbs over the bottom of the previous section, tied to the scroll\n * position (scroll back and it sinks again), and in Chromium the refraction\n * along that edge ramps up from zero as it rises. The edge is a meniscus:\n * scroll fast and it sloshes, three slow springs that settle in under a\n * second and then sleep. The shape is the slab's own clip path with an SVG\n * rim drawn along it, so the edge moves in every engine.\n *\n * Its tint is not a fixed brand colour: it reads the section above (a\n * `data-glass-tint=\"#rrggbb\"` attribute, or failing that its computed\n * background colour) and mixes it into the glass, strongest along the edge\n * and fading toward the bottom. Change that section and the footer re-tints\n * over 600ms. It reads its IMMEDIATE previous sibling, so place it directly\n * after that section; in development it warns when there is nothing to read.\n *\n * A light follows the pointer across the slab (and follows keyboard focus),\n * brightening the nearest stretch of rim. A small glass droplet glides\n * between the footer links on hover and focus, stretching as it travels; it\n * lights and slightly magnifies the link under it and never bends the text.\n *\n * Scrolling: by default it follows the page (window scroll). Inside a\n * fixed-height scroll box (a preview, a modal, a split pane), set\n * scroll=\"frame\" and it follows its nearest scrolling ancestor instead.\n * Under prefers-reduced-motion the slab sits fully risen, the edge stays\n * still and the droplet moves without gliding. Everything sleeps when the\n * footer is off screen or at rest.\n *\n * Link columns, an optional newsletter capsule (you pass onSubscribe; it does\n * not post anywhere by itself), legal links and a note. Hrefs are sanitised.\n * The layout follows the footer's own width (container queries).\n *\n * Needs Tailwind v4 (on v3.4, add the @tailwindcss/container-queries\n * plugin). No dependencies beyond React.\n */\n\ntype Tone = \"dark\" | \"light\";\nexport type FooterLink = { label: string; href: string };\nexport type FooterColumn = { title: string; links: FooterLink[] };\n\n/** Glass kept above the resting edge, px, so an upward swing is never cut flat. */\nconst PAD = 26;\n/** The slab's top corners, px. */\nconst RADIUS = 28;\n/** How far the meniscus swings at strength 1, px. */\nconst SWING = 12;\n/** The meniscus: three standing waves, each a slow damped spring (Hz, damping ratio). */\nconst MODES = [\n  { f: 1.3, z: 0.4 },\n  { f: 2.0, z: 0.36 },\n  { f: 2.8, z: 0.36 },\n];\n/** The droplet's padding around a link, px. */\nconst DROP_X = 9;\nconst DROP_Y = 4;\n\ntype Shared = {\n  lens: number;\n  lensOn: boolean;\n  y0: number;\n  kick: () => void;\n  aim: (x: number, y: number) => void;\n  rest: () => void;\n  hover: (el: HTMLElement) => void;\n  leave: () => void;\n  focus: (el: HTMLElement) => void;\n  blur: (to: Element | null) => void;\n};\nconst noop = () => {};\n\n/** Allow relative paths, fragments, http(s), mailto and tel; anything else becomes \"#\". */\nfunction safeHref(href: string): string {\n  const v = href.replace(/[\\t\\n\\r]/g, \"\").trim();\n  if (v.indexOf(String.fromCharCode(92)) !== -1) return \"#\";\n  if (/^(https?:|mailto:|tel:)/i.test(v)) return v;\n  if (/^[/#?]/.test(v) && !/^\\/\\//.test(v)) return v;\n  return \"#\";\n}\n\n/** \"#rrggbb\" to \"r,g,b\", or null. Anything else is ignored, never interpolated. */\nfunction rgbOf(hex?: string | null): string | null {\n  const m = /^#([0-9a-f]{6})$/i.exec(hex || \"\");\n  if (!m) return null;\n  const n = parseInt(m[1], 16);\n  return ((n >> 16) & 255) + \",\" + ((n >> 8) & 255) + \",\" + (n & 255);\n}\n\n/** \"rgb(r, g, b)\" or an opaque-enough \"rgba(...)\" to \"r,g,b\"; transparent gives null. */\nfunction rgbFromComputed(color: string): string | null {\n  const m = /^rgba?\\(\\s*(\\d+)[,\\s]+(\\d+)[,\\s]+(\\d+)(?:[,\\s/]+([\\d.]+))?\\s*\\)$/.exec(color);\n  if (!m) return null;\n  if (m[4] !== undefined && parseFloat(m[4]) < 0.2) return null;\n  return m[1] + \",\" + m[2] + \",\" + m[3];\n}\n\nfunction isChromium(): boolean {\n  const ua = (navigator as Navigator & { userAgentData?: { brands?: { brand: string }[] } }).userAgentData;\n  return !!ua && !!ua.brands && ua.brands.some((b) => /Chromium/.test(b.brand));\n}\n\n/** Smoothstep on 0..1. */\nfunction ease(t: number): number {\n  const x = Math.min(1, Math.max(0, t));\n  return x * x * (3 - 2 * x);\n}\n\n/** An element's box inside a positioned ancestor, in layout pixels (transforms ignored). */\nfunction offsetIn(el: HTMLElement, box: HTMLElement) {\n  let x = 0;\n  let y = 0;\n  let n: HTMLElement | null = el;\n  while (n && n !== box) {\n    x += n.offsetLeft;\n    y += n.offsetTop;\n    n = n.offsetParent as HTMLElement | null;\n  }\n  return { x, y, w: el.offsetWidth, h: el.offsetHeight };\n}\n\n/** The nearest ancestor that scrolls vertically, or null (the page). */\nfunction scrollParent(el: HTMLElement): HTMLElement | null {\n  let n = el.parentElement;\n  while (n && n !== document.body && n !== document.documentElement) {\n    const o = getComputedStyle(n).overflowY;\n    if (o === \"auto\" || o === \"scroll\" || o === \"overlay\") return n;\n    n = n.parentElement;\n  }\n  return null;\n}\n\n/**\n * A light that eases after the pointer (about 180ms) and fades when it\n * leaves (220ms). paint() gets layout pixels and an opacity; the loop sleeps\n * once the light arrives. aim() points it without a pointer (keyboard\n * focus); rest() lets it fade unless the pointer is still over the element.\n */\nfunction followPointer(el: HTMLElement, paint: (x: number, y: number, o: number) => void) {\n  const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n  const L = { x: 0, y: 0, tx: 0, ty: 0, o: 0, to: 0, raf: 0, last: 0, over: false };\n  function step(now: number) {\n    L.raf = 0;\n    const dt = L.last ? Math.min(1 / 30, (now - L.last) / 1000) : 1 / 60;\n    L.last = now;\n    const kp = reduce.matches ? 1 : 1 - Math.exp(-dt / 0.18);\n    const ko = reduce.matches ? 1 : 1 - Math.exp(-dt / 0.22);\n    L.x += (L.tx - L.x) * kp;\n    L.y += (L.ty - L.y) * kp;\n    L.o += (L.to - L.o) * ko;\n    paint(L.x, L.y, L.o);\n    if (Math.abs(L.tx - L.x) > 0.3 || Math.abs(L.ty - L.y) > 0.3 || Math.abs(L.to - L.o) > 0.004) {\n      L.raf = requestAnimationFrame(step);\n    } else L.last = 0;\n  }\n  const kick = () => {\n    if (!L.raf) L.raf = requestAnimationFrame(step);\n  };\n  function aim(x: number, y: number) {\n    L.tx = x;\n    L.ty = y;\n    L.to = 1;\n    // A light that is out starts where it is aimed, instead of streaking there.\n    if (L.o < 0.02) {\n      L.x = x;\n      L.y = y;\n    }\n    kick();\n  }\n  function onMove(e: PointerEvent) {\n    // Layout pixels, even inside a transform-scaled container.\n    const r = el.getBoundingClientRect();\n    const k = el.offsetWidth / (r.width || 1);\n    L.over = true;\n    aim((e.clientX - r.left) * k, (e.clientY - r.top) * k);\n  }\n  function onLeave() {\n    L.over = false;\n    L.to = 0;\n    kick();\n  }\n  el.addEventListener(\"pointermove\", onMove);\n  el.addEventListener(\"pointerdown\", onMove);\n  el.addEventListener(\"pointerleave\", onLeave);\n  return {\n    aim,\n    rest() {\n      if (!L.over) {\n        L.to = 0;\n        kick();\n      }\n    },\n    stop() {\n      el.removeEventListener(\"pointermove\", onMove);\n      el.removeEventListener(\"pointerdown\", onMove);\n      el.removeEventListener(\"pointerleave\", onLeave);\n      if (L.raf) cancelAnimationFrame(L.raf);\n      L.raf = 0;\n    },\n  };\n}\n\n/**\n * Displacement map for the slab's top edge: red = x, green = y, 128 = none.\n * The rounded box starts PAD pixels down (neutral above it, where the\n * meniscus swings) and runs far below, so only the top edge and corners\n * bend. Mapped at half resolution; the filter stretches it back.\n */\nfunction slabMap(w: number, h: number, r: number, bezel: number): string {\n  const k = 0.5;\n  const mw = Math.max(1, Math.round(w * k));\n  const mh = Math.max(1, Math.round(h * k));\n  const c = document.createElement(\"canvas\");\n  c.width = mw;\n  c.height = mh;\n  const ctx = c.getContext(\"2d\");\n  if (!ctx) return \"\";\n  const img = ctx.createImageData(mw, mh);\n  const hw = w / 2;\n  const hh = h;\n  const sd = (x: number, y: number) => {\n    const qx = Math.abs(x) - (hw - r);\n    const qy = Math.abs(y) - (hh - r);\n    return Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) + Math.min(Math.max(qx, qy), 0) - r;\n  };\n  for (let j = 0; j < mh; j++) {\n    for (let i = 0; i < mw; i++) {\n      const x = (i + 0.5) / k - hw;\n      const y = (j + 0.5) / k - PAD - hh;\n      const t = -sd(x, y);\n      let dx = 0;\n      let dy = 0;\n      if (t > 0 && t < bezel) {\n        const nx = sd(x + 0.5, y) - sd(x - 0.5, y);\n        const ny = sd(x, y + 0.5) - sd(x, y - 0.5);\n        const len = Math.hypot(nx, ny) || 1;\n        const m = Math.pow(1 - t / bezel, 2);\n        dx = (-nx / len) * m;\n        dy = (-ny / len) * m;\n      }\n      const o = (j * mw + i) * 4;\n      img.data[o] = Math.round(128 + 127 * dx);\n      img.data[o + 1] = Math.round(128 + 127 * dy);\n      img.data[o + 2] = 128;\n      img.data[o + 3] = 255;\n    }\n  }\n  ctx.putImageData(img, 0, 0);\n  return c.toDataURL();\n}\n\nexport function GlassTintFooter({\n  brand,\n  tagline,\n  columns,\n  legal = [],\n  note,\n  newsletter = true,\n  onSubscribe,\n  tint,\n  sample = true,\n  tone = \"dark\",\n  refraction = 1,\n  overlap = 56,\n  rise = true,\n  meniscus = 1,\n  scroll = \"page\",\n  className = \"\",\n}: {\n  brand: string;\n  tagline?: string;\n  columns: FooterColumn[];\n  legal?: FooterLink[];\n  /** The small print, e.g. \"© 2026 Studio\". */\n  note?: string;\n  /** Show the email capsule. */\n  newsletter?: boolean;\n  /** Called with the email on submit. Wire it to your own endpoint. */\n  onSubscribe?: (email: string) => void;\n  /** Fallback (or fixed, with sample off) tint, \"#rrggbb\". */\n  tint?: string;\n  /** Read the tint from the section above. */\n  sample?: boolean;\n  tone?: Tone;\n  /** Rim refraction, 0–2 (Chromium only). */\n  refraction?: number;\n  /** How far the slab rises over the section above, px. */\n  overlap?: number;\n  /** Rise over the section as the footer scrolls in. Off: it sits risen. */\n  rise?: boolean;\n  /** How much the top edge sloshes when you scroll fast, 0–1.5. 0 keeps it still. */\n  meniscus?: number;\n  /**\n   * \"page\" (default): follow the window's scroll, for a real page.\n   * \"frame\": follow the nearest scrolling ancestor, for a fixed-height box.\n   */\n  scroll?: \"page\" | \"frame\";\n  className?: string;\n}) {\n  const ref = useRef<HTMLElement>(null);\n  const slabRef = useRef<HTMLDivElement>(null);\n  const tintRef = useRef<HTMLSpanElement>(null);\n  const ringRef = useRef<HTMLSpanElement>(null);\n  const contentRef = useRef<HTMLDivElement>(null);\n  const dropRef = useRef<HTMLSpanElement>(null);\n  const mapRef = useRef<SVGFEImageElement>(null);\n  const dispRef = useRef<SVGFEDisplacementMapElement>(null);\n  const edgeRef = useRef<SVGPathElement>(null);\n  const inClipRef = useRef<SVGPathElement>(null);\n  const outClipRef = useRef<SVGPathElement>(null);\n  const rimGradRef = useRef<SVGLinearGradientElement>(null);\n  const litGradRef = useRef<SVGRadialGradientElement>(null);\n  const litRef = useRef<SVGUseElement>(null);\n  const uid = useId().replace(/[^a-zA-Z0-9]/g, \"\");\n  const filterId = \"gtf\" + uid;\n  const emailId = \"gtfe\" + uid;\n  const edgeId = \"gtfp\" + uid;\n  const inId = \"gtfi\" + uid;\n  const outId = \"gtfo\" + uid;\n  const rimId = \"gtfr\" + uid;\n  const litId = \"gtfl\" + uid;\n  // What the effects share: the lens at full rise, the current edge, and the\n  // light and droplet controls the handlers call into.\n  const shared = useRef<Shared>({\n    lens: 0,\n    lensOn: false,\n    y0: PAD,\n    kick: noop,\n    aim: noop,\n    rest: noop,\n    hover: noop,\n    leave: noop,\n    focus: noop,\n    blur: noop,\n  });\n  const [email, setEmail] = useState(\"\");\n  const [sent, setSent] = useState(false);\n  const dark = tone === \"dark\";\n  const fallback = rgbOf(tint) || \"124,92,255\";\n  const base = \"blur(20px) saturate(180%) brightness(\" + (dark ? 1.08 : 1.04) + \")\";\n  const lift = Math.max(0, overlap);\n\n  // Sample the section above, and follow it: its attributes changing, or a\n  // different element taking its place.\n  useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    let watched: Element | null = null;\n    let warned = false;\n    const attrs = new MutationObserver(() => read());\n    const read = () => {\n      const prev = el.previousElementSibling as HTMLElement | null;\n      let rgb: string | null = null;\n      if (sample && prev) {\n        rgb = rgbOf(prev.getAttribute(\"data-glass-tint\")) || rgbFromComputed(getComputedStyle(prev).backgroundColor);\n      }\n      if (sample && !rgb && !warned && process.env.NODE_ENV !== \"production\") {\n        warned = true;\n        console.warn(\n          \"GlassTintFooter: nothing to sample. Put the footer directly after the section it should borrow from, and give that section data-glass-tint=\\\"#rrggbb\\\" or an opaque background colour.\"\n        );\n      }\n      el.style.setProperty(\"--gtf-rgb\", rgb || fallback);\n      if (sample && prev !== watched) {\n        attrs.disconnect();\n        watched = prev;\n        if (prev) attrs.observe(prev, { attributes: true, attributeFilter: [\"data-glass-tint\", \"style\", \"class\"] });\n      }\n    };\n    read();\n    const parent = el.parentElement;\n    const kids = new MutationObserver(() => read());\n    if (sample && parent) kids.observe(parent, { childList: true });\n    return () => {\n      attrs.disconnect();\n      kids.disconnect();\n    };\n  }, [sample, fallback]);\n\n  // The rise and the meniscus. One loop reads the footer's place in its\n  // scroll box, sets the edge height from it, drives the springs from the\n  // scroll speed, and redraws the clip and the rim. It sleeps when the\n  // footer is off screen or everything has settled.\n  useEffect(() => {\n    const foot = ref.current;\n    const slab = slabRef.current;\n    const content = contentRef.current;\n    const S = shared.current;\n    if (!foot || !slab || !content) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const root = scroll === \"frame\" ? scrollParent(foot) : null;\n    const strength = Math.min(1.5, Math.max(0, meniscus));\n    const st = {\n      W: 0,\n      H: 0,\n      y0: PAD,\n      ty: PAD,\n      pos: 0,\n      hasPos: false,\n      vs: 0,\n      m: MODES.map(() => ({ x: 0, v: 0 })),\n      raf: 0,\n      last: 0,\n      visible: true,\n      moved: false,\n      bias: 0.35,\n      lensY: NaN,\n      lensS: -1,\n    };\n\n    /** Where the edge should sit now, from the footer's place in view; returns its position for speed. */\n    function measure(): number {\n      const fr = foot!.getBoundingClientRect();\n      const k = foot!.offsetHeight / (fr.height || 1);\n      let top = 0;\n      let bottom = window.innerHeight;\n      if (root) {\n        const rr = root.getBoundingClientRect();\n        top = rr.top;\n        bottom = rr.bottom;\n      }\n      // How far the section's bottom line has come up into view, in layout px.\n      const shown = (bottom - fr.top) * k - PAD - lift;\n      const range = Math.max(1, Math.min(st.H - PAD - lift, (bottom - top) * k) * 0.85);\n      const p = rise && !reduce.matches ? ease(shown / range) : 1;\n      st.ty = PAD + lift * (1 - p);\n      return (fr.top - top) * k;\n    }\n\n    function paint() {\n      const W = st.W;\n      const H = st.H;\n      if (!W || !H) return;\n      const y0 = st.y0;\n      const r = Math.min(RADIUS, W / 2);\n      const x0 = r;\n      const span = Math.max(0, W - 2 * r);\n      const lim = PAD - 2;\n      const f = (n: number) => n.toFixed(1);\n      let flat = true;\n      for (const m of st.m) if (Math.abs(m.x) > 0.05) flat = false;\n      let wave = \"L\" + f(x0 + span) + \" \" + f(y0);\n      if (!flat) {\n        // Sample the standing waves across the flat top (pinned at the\n        // corners) and join the samples with quadratic curves through their\n        // midpoints, so the edge stays smooth at any width.\n        const N = 24;\n        const px: number[] = [];\n        const py: number[] = [];\n        for (let i = 0; i <= N; i++) {\n          const u = i / N;\n          let d = 0;\n          for (let j = 0; j < st.m.length; j++) d += st.m[j].x * Math.sin((j + 1) * Math.PI * u);\n          px.push(x0 + span * u);\n          py.push(y0 + lim * Math.tanh(d / lim));\n        }\n        wave = \"\";\n        for (let i = 1; i < N; i++) {\n          wave += \"Q\" + f(px[i]) + \" \" + f(py[i]) + \" \" + f((px[i] + px[i + 1]) / 2) + \" \" + f((py[i] + py[i + 1]) / 2);\n        }\n        wave += \"L\" + f(px[N]) + \" \" + f(py[N]);\n      }\n      const arcL = \"A\" + r + \" \" + r + \" 0 0 1 \" + f(x0) + \" \" + f(y0);\n      const arcR = \"A\" + r + \" \" + r + \" 0 0 1 \";\n      const clip =\n        \"M0 \" + H + \"L0 \" + f(y0 + r) + arcL + wave + arcR + W + \" \" + f(y0 + r) + \"L\" + W + \" \" + H + \"Z\";\n      const edge =\n        \"M0.5 \" + H + \"L0.5 \" + f(y0 + r) + arcL + wave + arcR + (W - 0.5) + \" \" + f(y0 + r) + \"L\" + (W - 0.5) + \" \" + H;\n      const css = 'path(\"' + clip + '\")';\n      slab!.style.setProperty(\"clip-path\", css);\n      slab!.style.setProperty(\"-webkit-clip-path\", css);\n      edgeRef.current?.setAttribute(\"d\", edge);\n      inClipRef.current?.setAttribute(\"d\", clip);\n      outClipRef.current?.setAttribute(\"d\", \"M-400 -400H\" + (W + 400) + \"V\" + (H + 400) + \"H-400Z\" + clip);\n      rimGradRef.current?.setAttribute(\"y1\", f(y0 - 4));\n      rimGradRef.current?.setAttribute(\"y2\", String(H));\n      // Whole pixels for the copy, so text never rests on a half pixel.\n      content!.style.transform = \"translate3d(0,\" + Math.round(y0 - PAD) + \"px,0)\";\n      if (tintRef.current) tintRef.current.style.transform = \"translate3d(0,\" + y0.toFixed(2) + \"px,0)\";\n      // The CSS rim was the no-JS stand-in; the drawn rim takes over.\n      if (ringRef.current) ringRef.current.style.display = \"none\";\n      S.y0 = y0;\n      // The lens band follows the edge, and its bend ramps up as the slab rises.\n      if (S.lensOn && mapRef.current && dispRef.current) {\n        const my = Math.round(y0 - PAD);\n        if (my !== st.lensY) {\n          st.lensY = my;\n          mapRef.current.setAttribute(\"y\", String(my));\n        }\n        const sc = Math.round(S.lens * (lift > 0 ? Math.max(0, 1 - (y0 - PAD) / lift) : 1));\n        if (sc !== st.lensS) {\n          st.lensS = sc;\n          dispRef.current.setAttribute(\"scale\", String(sc));\n        }\n      }\n    }\n\n    function settleSprings() {\n      for (const m of st.m) {\n        m.x = 0;\n        m.v = 0;\n      }\n    }\n\n    function step(now: number) {\n      st.raf = 0;\n      const dt = st.last ? Math.min(1 / 30, (now - st.last) / 1000) : 1 / 60;\n      st.last = now;\n      const pos = measure();\n      const raw = st.hasPos ? (pos - st.pos) / dt : 0;\n      st.pos = pos;\n      st.hasPos = true;\n      st.vs += (raw - st.vs) * (1 - Math.exp(-dt / 0.07));\n      st.y0 = reduce.matches ? st.ty : st.y0 + (st.ty - st.y0) * (1 - Math.exp(-dt / 0.08));\n      if (reduce.matches || strength <= 0) settleSprings();\n      else {\n        // The edge lags the slab: moving up, its middle sags; moving down, it\n        // bulges. Released, the springs overshoot and slosh, then settle.\n        const t1 = SWING * strength * Math.tanh(-st.vs / 1400);\n        const targets = [t1, 0.5 * st.bias * t1, 0.2 * t1];\n        for (let j = 0; j < st.m.length; j++) {\n          const m = st.m[j];\n          const w = 2 * Math.PI * MODES[j].f;\n          m.v += (-w * w * (m.x - targets[j]) - 2 * MODES[j].z * w * m.v) * dt;\n          m.x += m.v * dt;\n        }\n      }\n      paint();\n      let busy = st.moved || Math.abs(st.vs) > 2 || Math.abs(st.ty - st.y0) > 0.1;\n      for (const m of st.m) if (Math.abs(m.x) > 0.12 || Math.abs(m.v) > 1.5) busy = true;\n      st.moved = false;\n      if (busy && st.visible) st.raf = requestAnimationFrame(step);\n      else {\n        st.last = 0;\n        st.hasPos = false;\n        st.vs = 0;\n        st.y0 = st.ty;\n        settleSprings();\n        paint();\n      }\n    }\n\n    const kick = () => {\n      if (!st.raf) st.raf = requestAnimationFrame(step);\n    };\n    S.kick = kick;\n\n    // Size changes: re-measure and place the edge at once, without a slosh.\n    const ro = new ResizeObserver(() => {\n      const first = !st.W;\n      st.W = slab.offsetWidth;\n      st.H = slab.offsetHeight;\n      measure();\n      if (first || !st.raf) {\n        st.y0 = st.ty;\n        settleSprings();\n      }\n      paint();\n    });\n    ro.observe(slab);\n\n    const io = new IntersectionObserver(\n      (entries) => {\n        const e = entries[entries.length - 1];\n        st.visible = e.isIntersecting;\n        st.hasPos = false;\n        if (st.visible) kick();\n      },\n      { root, rootMargin: \"64px 0px\" }\n    );\n    io.observe(foot);\n\n    const onScroll = () => {\n      // Nothing here follows the scroll when the edge is still and risen.\n      if (reduce.matches || (!rise && strength <= 0)) return;\n      st.moved = true;\n      if (st.visible) kick();\n    };\n    const onResize = () => {\n      st.hasPos = false;\n      kick();\n    };\n    // Which side the pointer is on tips the slosh that way.\n    const onPointer = (e: PointerEvent) => {\n      const r = slab.getBoundingClientRect();\n      st.bias = Math.max(-1, Math.min(1, ((e.clientX - r.left) / (r.width || 1) - 0.5) * 2));\n    };\n    const target: HTMLElement | Window = root || window;\n    target.addEventListener(\"scroll\", onScroll, { passive: true });\n    window.addEventListener(\"resize\", onResize);\n    slab.addEventListener(\"pointermove\", onPointer);\n    return () => {\n      ro.disconnect();\n      io.disconnect();\n      target.removeEventListener(\"scroll\", onScroll);\n      window.removeEventListener(\"resize\", onResize);\n      slab.removeEventListener(\"pointermove\", onPointer);\n      if (st.raf) cancelAnimationFrame(st.raf);\n      st.raf = 0;\n      S.kick = noop;\n    };\n  }, [scroll, rise, meniscus, lift]);\n\n  // A light that follows the pointer (and keyboard focus) across the slab:\n  // the rim nearest it brightens, a soft specular sits below it.\n  useEffect(() => {\n    const slab = slabRef.current;\n    const S = shared.current;\n    if (!slab) return;\n    const light = followPointer(slab, (x, y, o) => {\n      slab.style.setProperty(\"--gtf-lx\", x.toFixed(1) + \"px\");\n      slab.style.setProperty(\"--gtf-ly\", y.toFixed(1) + \"px\");\n      slab.style.setProperty(\"--gtf-lo\", o.toFixed(3));\n      litGradRef.current?.setAttribute(\"cx\", x.toFixed(1));\n      litGradRef.current?.setAttribute(\"cy\", y.toFixed(1));\n      litRef.current?.setAttribute(\"opacity\", o.toFixed(3));\n    });\n    S.aim = light.aim;\n    S.rest = light.rest;\n    return () => {\n      light.stop();\n      S.aim = noop;\n      S.rest = noop;\n    };\n  }, []);\n\n  // The slab's lens, sized to it, where the engine can run it. The motion\n  // loop moves it with the edge and ramps its strength with the rise.\n  useEffect(() => {\n    const slab = slabRef.current;\n    const S = shared.current;\n    if (!slab) return;\n    if (!isChromium() || refraction <= 0) {\n      S.lensOn = false;\n      slab.style.backdropFilter = base;\n      return;\n    }\n    let key = \"\";\n    const apply = () => {\n      const w = Math.round(slab.offsetWidth);\n      const h = Math.round(slab.offsetHeight);\n      if (!w || !h || !mapRef.current || !dispRef.current) return;\n      // Refraction up to 1 strengthens the bend; above 1 it widens the bent\n      // band instead, so the peak offset never passes 0.4 of the bezel.\n      const bezel = Math.min(44 * Math.max(1, refraction), (h - PAD) * 0.3);\n      const mh = h + lift + 2;\n      const k = w + \"x\" + mh + \":\" + bezel.toFixed(1);\n      if (k !== key) {\n        key = k;\n        mapRef.current.setAttribute(\"href\", slabMap(w, mh, RADIUS, bezel));\n        mapRef.current.setAttribute(\"width\", String(w));\n        mapRef.current.setAttribute(\"height\", String(mh));\n      }\n      S.lens = Math.round(0.8 * bezel * Math.min(1, refraction));\n      S.lensOn = true;\n      slab.style.backdropFilter = \"url(#\" + filterId + \") \" + base;\n      S.kick();\n    };\n    apply();\n    const ro = new ResizeObserver(apply);\n    ro.observe(slab);\n    return () => {\n      ro.disconnect();\n      S.lensOn = false;\n    };\n  }, [filterId, base, refraction, lift]);\n\n  // The droplet: a small clear lens that glides between the links on hover\n  // and focus. A spring per axis, stretched along its travel; it condenses\n  // where it is first needed and evaporates when nothing is chosen.\n  useEffect(() => {\n    const box = contentRef.current;\n    const drop = dropRef.current;\n    const slab = slabRef.current;\n    const S = shared.current;\n    if (!box || !drop || !slab) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const d = {\n      x: 0, y: 0, w: 0, h: 0, vx: 0, vy: 0, vw: 0, vh: 0,\n      tx: 0, ty: 0, tw: 0, th: 0, s: 0, ts: 0,\n      raf: 0, last: 0, timer: 0, on: null as HTMLElement | null,\n    };\n\n    function paint() {\n      const still = reduce.matches;\n      const ax = still ? 0 : Math.min(0.22, Math.abs(d.vx) / 3200);\n      const ay = still ? 0 : Math.min(0.22, Math.abs(d.vy) / 3200);\n      const m = 0.25 + 0.75 * d.s;\n      const sx = (1 + ax) * (1 - 0.5 * ay) * m;\n      const sy = (1 + ay) * (1 - 0.5 * ax) * m;\n      drop!.style.width = d.w.toFixed(1) + \"px\";\n      drop!.style.height = d.h.toFixed(1) + \"px\";\n      drop!.style.transform =\n        \"translate(\" + d.x.toFixed(2) + \"px,\" + d.y.toFixed(2) + \"px) scale(\" + sx.toFixed(4) + \",\" + sy.toFixed(4) + \")\";\n      drop!.style.visibility = d.s < 0.02 && d.ts === 0 ? \"hidden\" : \"visible\";\n    }\n\n    function step(now: number) {\n      d.raf = 0;\n      const dt = d.last ? Math.min(1 / 30, (now - d.last) / 1000) : 1 / 60;\n      d.last = now;\n      if (reduce.matches) {\n        d.x = d.tx;\n        d.y = d.ty;\n        d.w = d.tw;\n        d.h = d.th;\n        d.vx = d.vy = d.vw = d.vh = 0;\n        d.s = d.ts;\n      } else {\n        // Slightly under-damped: it arrives in about half a second with a\n        // small liquid overshoot.\n        const k = 120;\n        const c = 15;\n        d.vx += (k * (d.tx - d.x) - c * d.vx) * dt;\n        d.x += d.vx * dt;\n        d.vy += (k * (d.ty - d.y) - c * d.vy) * dt;\n        d.y += d.vy * dt;\n        d.vw += (k * (d.tw - d.w) - c * d.vw) * dt;\n        d.w += d.vw * dt;\n        d.vh += (k * (d.th - d.h) - c * d.vh) * dt;\n        d.h += d.vh * dt;\n        d.s += (d.ts - d.s) * (1 - Math.exp(-dt / 0.14));\n      }\n      paint();\n      const moving =\n        Math.abs(d.tx - d.x) > 0.2 || Math.abs(d.ty - d.y) > 0.2 || Math.abs(d.tw - d.w) > 0.2 ||\n        Math.abs(d.th - d.h) > 0.2 || Math.abs(d.vx) + Math.abs(d.vy) > 3 || Math.abs(d.ts - d.s) > 0.004;\n      if (moving) d.raf = requestAnimationFrame(step);\n      else {\n        d.x = d.tx;\n        d.y = d.ty;\n        d.w = d.tw;\n        d.h = d.th;\n        d.vx = d.vy = d.vw = d.vh = 0;\n        d.s = d.ts;\n        paint();\n        d.last = 0;\n      }\n    }\n    const kick = () => {\n      if (!d.raf) d.raf = requestAnimationFrame(step);\n    };\n\n    function target(el: HTMLElement) {\n      const o = offsetIn(el, box!);\n      d.tx = o.x - DROP_X;\n      d.ty = o.y - DROP_Y;\n      d.tw = o.w + DROP_X * 2;\n      d.th = o.h + DROP_Y * 2;\n    }\n    function hover(el: HTMLElement) {\n      window.clearTimeout(d.timer);\n      target(el);\n      // A droplet that is not there yet forms in place rather than flying in.\n      if (d.s < 0.15) {\n        d.x = d.tx;\n        d.y = d.ty;\n        d.w = d.tw;\n        d.h = d.th;\n        d.vx = d.vy = d.vw = d.vh = 0;\n      }\n      d.ts = 1;\n      if (d.on && d.on !== el) d.on.style.transform = \"\";\n      el.style.transform = \"scale(1.05)\";\n      d.on = el;\n      kick();\n    }\n    function leave() {\n      window.clearTimeout(d.timer);\n      // A short grace period, so crossing the gap between links keeps it.\n      d.timer = window.setTimeout(() => {\n        d.ts = 0;\n        if (d.on) d.on.style.transform = \"\";\n        d.on = null;\n        kick();\n      }, 140);\n    }\n    S.hover = hover;\n    S.leave = leave;\n    S.focus = (el: HTMLElement) => {\n      const link = el.closest(\"a[data-gtf-link]\") as HTMLElement | null;\n      if (link) hover(link);\n      const o = offsetIn(el, box);\n      S.aim(box.offsetLeft + o.x + o.w / 2, box.offsetTop + (S.y0 - PAD) + o.y + o.h / 2);\n    };\n    S.blur = (to: Element | null) => {\n      if (!to || !to.closest(\"a[data-gtf-link]\")) leave();\n      if (!to || !slab.contains(to)) S.rest();\n    };\n    // Reflow (a resize, fonts arriving) moves the links: follow them.\n    const ro = new ResizeObserver(() => {\n      if (d.on) {\n        target(d.on);\n        kick();\n      }\n    });\n    ro.observe(box);\n    return () => {\n      ro.disconnect();\n      window.clearTimeout(d.timer);\n      if (d.raf) cancelAnimationFrame(d.raf);\n      d.raf = 0;\n      if (d.on) d.on.style.transform = \"\";\n      S.hover = noop;\n      S.leave = noop;\n      S.focus = noop;\n      S.blur = noop;\n    };\n  }, []);\n\n  function linkFrom(t: EventTarget | null): HTMLElement | null {\n    return t instanceof Element ? (t.closest(\"a[data-gtf-link]\") as HTMLElement | null) : null;\n  }\n  function onOver(e: ReactPointerEvent<HTMLDivElement>) {\n    const a = linkFrom(e.target);\n    if (a) shared.current.hover(a);\n  }\n  function onOut(e: ReactPointerEvent<HTMLDivElement>) {\n    if (linkFrom(e.target) && !linkFrom(e.relatedTarget)) shared.current.leave();\n  }\n\n  function submit(e: FormEvent<HTMLFormElement>) {\n    e.preventDefault();\n    if (!email.trim()) return;\n    onSubscribe?.(email.trim());\n    setSent(true);\n  }\n\n  const ink = dark ? \"#ffffff\" : \"#111111\";\n  const soft = dark ? \"rgba(255,255,255,0.66)\" : \"rgba(17,17,17,0.66)\";\n  const restClip = \"inset(\" + PAD + \"px 0 0 0 round \" + RADIUS + \"px \" + RADIUS + \"px 0 0)\";\n  const ring = \"linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0)\";\n  const linkCls =\n    \"inline-block transition-transform duration-300 ease-[cubic-bezier(0.34,1.4,0.64,1)] focus-visible:underline focus-visible:underline-offset-4 motion-reduce:transition-none\";\n\n  return (\n    <footer\n      ref={ref}\n      className={\"@container pointer-events-none relative z-10 \" + className}\n      style={{ marginTop: -(lift + PAD), color: ink }}\n    >\n      <div\n        ref={slabRef}\n        className=\"pointer-events-auto relative isolate overflow-hidden\"\n        style={{\n          background: dark ? \"rgba(14,14,20,0.42)\" : \"rgba(255,255,255,0.5)\",\n          backdropFilter: base,\n          WebkitBackdropFilter: base,\n          clipPath: restClip,\n          WebkitClipPath: restClip,\n        }}\n      >\n        {/* The borrowed tint: strongest along the edge, fading down. It rides\n            with the edge, and uses background-color (not a gradient) so it\n            transitions. */}\n        <span\n          ref={tintRef}\n          aria-hidden\n          className=\"pointer-events-none absolute inset-0 transition-[background-color] duration-[600ms] ease-out\"\n          style={{\n            transform: \"translate3d(0,\" + PAD + \"px,0)\",\n            backgroundColor: \"rgba(var(--gtf-rgb, \" + fallback + \"), \" + (dark ? 0.34 : 0.26) + \")\",\n            WebkitMaskImage: \"linear-gradient(180deg, #000 0%, rgba(0,0,0,0.45) 38%, rgba(0,0,0,0.12) 100%)\",\n            maskImage: \"linear-gradient(180deg, #000 0%, rgba(0,0,0,0.45) 38%, rgba(0,0,0,0.12) 100%)\",\n          }}\n        />\n        {/* A plain graduated rim for the first paint (and without script);\n            the drawn rim replaces it once the edge is live. */}\n        <span\n          ref={ringRef}\n          aria-hidden\n          className=\"pointer-events-none absolute inset-x-0 bottom-0\"\n          style={{\n            top: PAD,\n            borderRadius: RADIUS + \"px \" + RADIUS + \"px 0 0\",\n            padding: \"1px 1px 0 1px\",\n            background:\n              \"linear-gradient(180deg, rgba(255,255,255,\" + (dark ? 0.6 : 0.95) + \") 0%, rgba(255,255,255,0.12) 38%, rgba(255,255,255,0.06) 70%, rgba(255,255,255,0.22) 100%)\",\n            WebkitMask: \"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)\",\n            WebkitMaskComposite: \"xor\",\n            mask: ring,\n          }}\n        />\n        {/* The pointer's soft specular. */}\n        <span\n          aria-hidden\n          className=\"pointer-events-none absolute inset-0\"\n          style={{\n            opacity: \"var(--gtf-lo, 0)\",\n            background:\n              \"radial-gradient(420px circle at var(--gtf-lx, -999px) var(--gtf-ly, -999px), rgba(255,255,255,\" + (dark ? 0.14 : 0.3) + \"), rgba(255,255,255,0) 65%)\",\n            mixBlendMode: dark ? \"screen\" : \"normal\",\n          }}\n        />\n        <div\n          ref={contentRef}\n          className=\"relative isolate\"\n          style={{ marginTop: PAD }}\n          onPointerOver={onOver}\n          onPointerOut={onOut}\n          onFocus={(e) => shared.current.focus(e.target as HTMLElement)}\n          onBlur={(e) => shared.current.blur(e.relatedTarget instanceof Element ? e.relatedTarget : null)}\n        >\n          {/* The droplet sits UNDER the link text: it lights and lifts the\n              link, it never bends the letters. */}\n          <span\n            ref={dropRef}\n            aria-hidden\n            className=\"pointer-events-none absolute left-0 top-0 rounded-full\"\n            style={{\n              zIndex: -1,\n              width: 0,\n              height: 0,\n              visibility: \"hidden\",\n              transformOrigin: \"50% 50%\",\n              background: dark\n                ? \"radial-gradient(120% 140% at 50% 0%, rgba(var(--gtf-rgb, \" + fallback + \"),0.26), rgba(var(--gtf-rgb, \" + fallback + \"),0) 70%), linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.04) 55%, rgba(255,255,255,0.1) 100%)\"\n                : \"radial-gradient(120% 140% at 50% 0%, rgba(var(--gtf-rgb, \" + fallback + \"),0.2), rgba(var(--gtf-rgb, \" + fallback + \"),0) 70%), linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.3) 55%, rgba(255,255,255,0.45) 100%)\",\n              boxShadow:\n                \"inset 0 1px 0 rgba(255,255,255,0.85), inset 0 -1px 1px rgba(255,255,255,0.3), inset 0 0 10px rgba(255,255,255,\" +\n                (dark ? 0.16 : 0.3) + \"), 0 6px 18px rgba(0,0,0,\" + (dark ? 0.2 : 0.1) + \")\",\n            }}\n          />\n          <div className=\"mx-auto max-w-[1180px] px-6 pb-8 pt-14 @3xl:px-12 @3xl:pt-16\">\n            <div className=\"grid gap-10 @3xl:grid-cols-[minmax(0,1.3fr)_minmax(0,2fr)]\">\n              <div className=\"max-w-[360px]\">\n                <p className=\"text-[22px] font-semibold tracking-[-0.02em]\">{brand}</p>\n                {tagline && (\n                  <p className=\"mt-2 text-[15px] leading-relaxed\" style={{ color: soft }}>\n                    {tagline}\n                  </p>\n                )}\n                {newsletter && (\n                  <form onSubmit={submit} className=\"mt-6\">\n                    <label htmlFor={emailId} className=\"text-[13px] font-semibold\" style={{ color: soft }}>\n                      {sent ? \"You're subscribed.\" : \"One email a month\"}\n                    </label>\n                    <div\n                      className=\"mt-2 flex items-center gap-1 rounded-full p-1 pl-4 has-[input:focus-visible]:outline has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-white/70\"\n                      style={{\n                        background: dark ? \"rgba(255,255,255,0.08)\" : \"rgba(255,255,255,0.5)\",\n                        boxShadow: \"inset 0 1px 0 rgba(255,255,255,0.3), inset 0 -1px 0 rgba(255,255,255,0.08)\",\n                      }}\n                    >\n                      <input\n                        id={emailId}\n                        type=\"email\"\n                        required\n                        autoComplete=\"email\"\n                        placeholder=\"you@studio.com\"\n                        value={email}\n                        onChange={(e) => setEmail(e.target.value)}\n                        className=\"min-w-0 flex-1 bg-transparent text-[15px] outline-none placeholder:opacity-50\"\n                        style={{ color: ink }}\n                      />\n                      <button\n                        type=\"submit\"\n                        className=\"h-10 shrink-0 rounded-full px-4 text-[14px] font-semibold outline-none transition-transform duration-300 ease-[cubic-bezier(0.34,1.4,0.64,1)] focus-visible:ring-2 focus-visible:ring-white/80 active:scale-[0.97]\"\n                        style={{ background: dark ? \"#ffffff\" : \"#111111\", color: dark ? \"#111111\" : \"#ffffff\" }}\n                      >\n                        Subscribe\n                      </button>\n                    </div>\n                  </form>\n                )}\n              </div>\n              <nav aria-label=\"Footer\" className=\"grid grid-cols-2 gap-8 @xl:grid-cols-3\">\n                {columns.map((c) => (\n                  <div key={c.title}>\n                    <p className=\"text-[13px] font-semibold\" style={{ color: soft }}>\n                      {c.title}\n                    </p>\n                    <ul className=\"mt-3 space-y-2.5\">\n                      {c.links.map((l) => (\n                        <li key={l.label}>\n                          <a\n                            href={safeHref(l.href)}\n                            data-gtf-link=\"\"\n                            className={\"text-[15px] \" + linkCls}\n                            style={{ outline: \"none\" }}\n                          >\n                            {l.label}\n                          </a>\n                        </li>\n                      ))}\n                    </ul>\n                  </div>\n                ))}\n              </nav>\n            </div>\n            <div\n              className=\"mt-12 flex flex-col gap-3 pt-6 text-[13px] @2xl:flex-row @2xl:items-center @2xl:justify-between\"\n              style={{ borderTop: \"1px solid \" + (dark ? \"rgba(255,255,255,0.12)\" : \"rgba(17,17,17,0.1)\"), color: soft }}\n            >\n              {note && <p>{note}</p>}\n              {legal.length > 0 && (\n                <ul className=\"flex flex-wrap gap-x-5 gap-y-1\">\n                  {legal.map((l) => (\n                    <li key={l.label}>\n                      <a href={safeHref(l.href)} data-gtf-link=\"\" className={linkCls} style={{ outline: \"none\" }}>\n                        {l.label}\n                      </a>\n                    </li>\n                  ))}\n                </ul>\n              )}\n            </div>\n          </div>\n        </div>\n        <svg aria-hidden width=\"0\" height=\"0\" style={{ position: \"absolute\" }}>\n          <filter id={filterId} x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" colorInterpolationFilters=\"sRGB\">\n            <feImage ref={mapRef} x=\"0\" y=\"0\" preserveAspectRatio=\"none\" result=\"map\" />\n            <feDisplacementMap ref={dispRef} in=\"SourceGraphic\" in2=\"map\" scale=\"0\" xChannelSelector=\"R\" yChannelSelector=\"G\" />\n          </filter>\n        </svg>\n      </div>\n      {/* The edge, drawn along the slab's own clip: a soft shadow above it,\n          a lit lip just inside it, the graduated rim and the pointer's light\n          on the rim. Outside the slab so the shadow is not clipped away. */}\n      <svg aria-hidden className=\"pointer-events-none absolute left-0 top-0 h-full w-full\" style={{ overflow: \"visible\" }}>\n        <defs>\n          <path ref={edgeRef} id={edgeId} d=\"\" fill=\"none\" />\n          <clipPath id={inId}>\n            <path ref={inClipRef} d=\"\" />\n          </clipPath>\n          <clipPath id={outId}>\n            <path ref={outClipRef} d=\"\" clipRule=\"evenodd\" />\n          </clipPath>\n          <linearGradient ref={rimGradRef} id={rimId} gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1={PAD} x2=\"0\" y2=\"400\">\n            <stop offset=\"0\" stopColor=\"#ffffff\" stopOpacity={dark ? 0.6 : 0.95} />\n            <stop offset=\"0.38\" stopColor=\"#ffffff\" stopOpacity={0.12} />\n            <stop offset=\"0.7\" stopColor=\"#ffffff\" stopOpacity={0.06} />\n            <stop offset=\"1\" stopColor=\"#ffffff\" stopOpacity={0.22} />\n          </linearGradient>\n          <radialGradient ref={litGradRef} id={litId} gradientUnits=\"userSpaceOnUse\" cx=\"-999\" cy=\"-999\" r=\"280\">\n            <stop offset=\"0\" stopColor=\"#ffffff\" stopOpacity={0.95} />\n            <stop offset=\"0.7\" stopColor=\"#ffffff\" stopOpacity={0} />\n          </radialGradient>\n        </defs>\n        <g clipPath={\"url(#\" + outId + \")\"}>\n          <use href={\"#\" + edgeId} stroke=\"#000000\" strokeOpacity={dark ? 0.035 : 0.02} strokeWidth={56} />\n          <use href={\"#\" + edgeId} stroke=\"#000000\" strokeOpacity={dark ? 0.05 : 0.025} strokeWidth={28} />\n          <use href={\"#\" + edgeId} stroke=\"#000000\" strokeOpacity={dark ? 0.06 : 0.03} strokeWidth={10} />\n        </g>\n        <g clipPath={\"url(#\" + inId + \")\"}>\n          <use href={\"#\" + edgeId} stroke=\"#ffffff\" strokeOpacity={dark ? 0.045 : 0.08} strokeWidth={16} />\n          <use href={\"#\" + edgeId} stroke=\"#ffffff\" strokeOpacity={dark ? 0.06 : 0.1} strokeWidth={8} />\n          <use href={\"#\" + edgeId} stroke=\"#ffffff\" strokeOpacity={dark ? 0.1 : 0.16} strokeWidth={3} />\n        </g>\n        <use href={\"#\" + edgeId} stroke={\"url(#\" + rimId + \")\"} strokeWidth={1.2} />\n        <use ref={litRef} href={\"#\" + edgeId} stroke={\"url(#\" + litId + \")\"} strokeWidth={1.6} opacity={0} />\n      </svg>\n    </footer>\n  );\n}\n","type":"registry:component","target":"components/viberdy/glass-tint-footer.tsx"}],"meta":{"tier":"free","tags":["footer","section","glass","liquid glass","adaptive tint","scroll-linked","newsletter"],"href":"https://viberdy.dev/library/glass-tint-footer","aiPrompt":"Create a React + Tailwind v4 client component, GlassTintFooter: a liquid-glass footer slab that rises over the bottom of the section above it as it scrolls into view, with a liquid top edge that sloshes when you scroll fast, a pointer light, a glass droplet that glides between its links, and a tint borrowed from the section above.\n\nProps: brand, tagline?, columns ({ title, links: { label, href }[] }[]), legal ({ label, href }[]), note?, newsletter (boolean, default true), onSubscribe?(email), tint? (\"#rrggbb\" fallback, regex-validated), sample (boolean, default true: read the tint from the section above), tone (\"dark\" | \"light\"), refraction (0–2), overlap (px, default 56: how far the slab rises over the section), rise (boolean, default true: tie the rise to scroll), meniscus (0–1.5, default 1: how much the edge sloshes; 0 keeps it still), scroll (\"page\" default: follow window scroll; \"frame\": follow the nearest ancestor whose overflow-y is auto/scroll/overlay, for fixed-height boxes; fall back to the page if there is none), className. Hrefs are sanitised: strip tabs and newlines, reject backslashes, allow http(s), mailto, tel and relative paths starting / # ? but not //.\n\nGeometry. Constants: PAD = 26 (glass kept above the resting edge so an upward swing is never cut flat), RADIUS = 28, SWING = 12. The <footer> is a Tailwind @container, pointer-events none, position relative, z-index 10, margin-top −(overlap + PAD). Its only in-flow child is the slab (pointer-events auto, relative, isolate, overflow hidden): fill rgba(14,14,20,0.42) dark / rgba(255,255,255,0.5) light; backdrop-filter blur(20px) saturate(180%) brightness(1.08) (1.04 light) with the -webkit- prefix; initial clip-path inset(PAD 0 0 0 round 28px 28px 0 0) so the first paint (and no-JS) shows the risen slab. Inside the slab: a content wrapper (relative, isolate, margin-top PAD) holding the droplet and the content; the edge height y0 (slab-local, PAD when risen, PAD + overlap when not) drives translate3d(0, round(y0 − PAD), 0) on the content wrapper, so copy rides with the edge.\n\nRise (one requestAnimationFrame loop in an effect). Each frame read the footer's and the scroll root's getBoundingClientRect (root = window with top 0 and bottom innerHeight) and convert to layout pixels with k = footer.offsetHeight / rect.height (works inside transform-scaled previews). shown = (rootBottom − footerTop)·k − PAD − overlap; range = 0.85 · min(slabHeight − PAD − overlap, rootHeight·k); p = smoothstep(shown / range) (1 when rise is off or under prefers-reduced-motion); target y0 = PAD + overlap·(1 − p). Ease y0 to it with a 80ms time constant. This guarantees p = 1 at the bottom of the page and on short pages.\n\nMeniscus. Three standing waves across the flat top between the corners, sin(k·π·u) for k = 1..3, each a damped spring (1.3 Hz ζ 0.40, 2.0 Hz ζ 0.36, 2.8 Hz ζ 0.36, semi-implicit Euler, dt capped at 1/30). Scroll speed v = d(footerTop − rootTop)·k/dt, low-passed with 70ms. Mode 1 target = SWING·meniscus·tanh(−v/1400) (moving up, the middle sags; moving down, it bulges); mode 2 target = 0.5·bias·t1 where bias is the pointer's side of the slab (−1..1, default 0.35); mode 3 = 0.2·t1. Released, the springs overshoot and settle within about a second. Soft-clamp each sample with (PAD − 2)·tanh(d/(PAD − 2)). Sample 24 segments and join with quadratic curves through the midpoints; when every mode is below 0.05px draw a straight line. Build clip = M0 H L0 y0+r A r r 0 0 1 r y0 [wave] A r r 0 0 1 W y0+r L W H Z and set it as clip-path: path(\"...\") (and -webkit-clip-path) on the slab; never use backdrop-filter url() for the edge. The loop sleeps when nothing moves (no scroll this frame, |v| < 2, y0 settled, springs below 0.12px and 1.5px/s), snaps to rest when it sleeps, and runs only while an IntersectionObserver (root = the scroll root, rootMargin 64px) sees the footer. A ResizeObserver on the slab stores width and height and places the edge at once on first measure. Scroll listeners are passive; do nothing on scroll when reduced motion is on or both rise and meniscus are off.\n\nDrawn edge. An aria-hidden SVG (absolute, full size of the footer, overflow visible, pointer-events none) after the slab: a path in defs holding the rim (the clip's top plus both sides at x = 0.5 and W − 0.5 down to H, fill none), a clipPath with the clip path (inside) and one with a large rect plus the clip path, clip-rule evenodd (outside). Draw with <use href>: a shadow above the edge (black strokes 56/28/10px at 0.035/0.05/0.06 dark, half on light, clipped outside), a lit lip just inside it (white strokes 16/8/3px at 0.045/0.06/0.1 dark, 0.08/0.1/0.16 light, clipped inside), the rim at 1.2px stroked with a userSpaceOnUse vertical gradient from y0 − 4 to H (white 0.6 dark or 0.95 light at 0, 0.12 at 0.38, 0.06 at 0.7, 0.22 at 1), and the pointer-lit rim at 1.6px stroked with a userSpaceOnUse radial gradient (r 280, white 0.95 to 0 at 0.7) whose cx/cy follow the light and whose opacity is the light's. Before the edge goes live, a CSS 1px rim ring (top PAD, radius 28 28 0 0, mask-composite exclude) stands in; hide it on the first paint.\n\nPointer light. On the slab: pointermove/pointerdown in layout pixels ease a position (180ms) and an opacity (220ms, 0 on pointerleave) in a loop that sleeps when settled; a light that is out starts at its new target instead of streaking. Write --gtf-lx/ly/lo for a soft specular layer (radial-gradient 420px, white 0.14 dark screen-blended / 0.3 light, 65%) and update the SVG lit rim. Keyboard parity: focusing any link, input or button in the footer aims the light at its centre; focus leaving the footer lets it fade.\n\nDroplet. A span inside the content wrapper at z-index −1 (under the link text, which is never bent), rounded-full, drawn as a clear lens: radial tint of rgba(var(--gtf-rgb), 0.26) over linear white 0.2 → 0.04 → 0.1 (light: 0.7 → 0.3 → 0.45), shadow inset 0 1px 0 white 0.85, inset 0 −1px 1px white 0.3, inset 0 0 10px white 0.16, 0 6px 18px black 0.2. Links carry data-gtf-link, are inline-block with outline none inline (focus shows as an underline, offset 4) and a transform transition (300ms cubic-bezier(0.34,1.4,0.64,1), none under reduced motion). On pointerover or focus of a link, target its box measured with offsetLeft/offsetTop summed up the offsetParent chain to the wrapper, padded 9px across and 4px down; spring x, y, width, height (k 120, c 15, about half a second with a small overshoot); scale it by 1 + |v|/3200 along each axis (max 0.22, the other axis narrowing by half); presence eases over 140ms and scales it from 0.25, and a droplet that is not yet there forms at its target instead of flying in. The link under it scales to 1.05. On leaving a link for a non-link, or focus leaving the links, release after 140ms (so crossing a gap keeps it). Follow reflow with a ResizeObserver. Under reduced motion it moves without gliding or stretching.\n\nTint sampling (effect): read the footer's IMMEDIATE previousElementSibling: its data-glass-tint if a valid #rrggbb, else its computed background-color if at least 20% opaque, else the tint prop, else rgb(124,92,255); write \"r,g,b\" to --gtf-rgb on the footer. Watch that element (MutationObserver on data-glass-tint, style, class) and the parent's childList. In development, console.warn once when there is nothing to sample. The tint layer fills the slab, is translated down to y0, background-color rgba(var(--gtf-rgb), 0.34) (0.26 light) masked from black at the top to 45% at 38% and 12% at the bottom, transitioning background-color over 600ms.\n\nRefraction (Chromium only, detected with navigator.userAgentData brands containing \"Chromium\", never with @supports): an SVG filter (feImage + feDisplacementMap, R = x, G = y, sRGB) whose map is generated at half resolution on a canvas, height slabHeight + overlap + 2, for a rounded box whose top sits PAD pixels down (neutral above) and runs far below; bezel min(44 × max(1, refraction), 0.3 × (slabHeight − PAD)); offset (1 − t/bezel)² along the inward normal, encoded 128 + 127·d. The loop sets the feImage y to round(y0 − PAD) so the bent band follows the edge, and the scale to round(0.8 × bezel × min(1, refraction) × rise progress), so the glass appears by its refraction ramping from zero. Prepend url(#id) to the slab's backdrop-filter.\n\nContent in a max-width 1180px block (24px side padding, 48px at @3xl; 56px top, 64px at @3xl, 32px bottom): a two-column grid at @3xl (1.3fr brand, 2fr links). Brand block: the name (22px, 600, −0.02em), the tagline (15px, 66% opacity), and, when newsletter is on, a form: a label (\"One email a month\", then \"You're subscribed.\" after submit) and a glass capsule (white 0.08 fill, inset rims) with an email input (required, autocomplete email) and a solid Subscribe pill; submit prevents default, calls onSubscribe and sets the subscribed state; it posts nowhere by itself. Links: a nav labelled \"Footer\" with 2 columns, 3 at @xl, each a 13px 600 title at 66% opacity and 15px links. Bottom row after a 1px divider: the note and the legal links (also droplet links), stacked, side by side at @2xl.\n\nOutput one self-contained \"use client\" TSX file with no dependencies beyond React; export the FooterLink and FooterColumn types. Put each loop in one effect as plain functions (share controls through one ref), measure in layout pixels, and build strings with + rather than template literals.","license":"https://viberdy.dev/license"}}