# Integrate `Quicksilver` from Motion Garden

You are helping me add the **Quicksilver** component to an existing project.
Everything you need is below — full source, dependencies, props and the
behavioural contract. Read it all before writing anything.

- **Component:** Quicksilver
- **Category:** Backgrounds
- **Summary:** Molten chrome. Every other shader background emits light. This one reflects a studio that does not exist, built out of the surface normal: sharp softbox edges, a conductor's Fresnel wash, thin-film iridescence, and a wake that keeps moving where you dragged.
- **Reference:** https://motion-garden.netlify.app/components/quicksilver
- **Full catalog (for you, the agent):** https://motion-garden.netlify.app/llms.txt

## Stack this source assumes

- React 19 with the Next.js App Router (never the `pages/` directory)
- TypeScript, strict
- Tailwind CSS v4, CSS-first config (utilities are inline; no `tailwind.config` needed)

If my project differs, adapt the integration — but do not rewrite the animation math to suit a different stack. Ask me first.

## Dependencies

```bash
bun add ogl
```

## Files to create

2 files — all of them are required. Paths are as shipped; the component may live anywhere in my project, but keep every peer file at the exact path shown so the import aliases resolve.

### 1. `components/registry/quicksilver/quicksilver.tsx`

```tsx
"use client";

import { memo, useEffect, useRef, useState } from "react";
import { Renderer, Program, Mesh, Triangle } from "ogl";
import { useAnimationLoop, type Metrics } from "@/hooks/use-animation-loop";

interface QuicksilverProps {
  flowSpeed?: number;
  warp?: number;
  stir?: number;
  viscosity?: number;
  fresnel?: number;
  iridescence?: number;
  roughness?: number;
  tint?: string;
  sheenColor?: string;
  backgroundColor?: string;
  paused?: boolean;
  reducedMotion?: boolean;
  className?: string;
}

const STIRS = 8;

const hexToRgb01 = (hex: string): [number, number, number] => {
  const h = hex.replace("#", "");
  const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
  const n = parseInt(full, 16);
  if (Number.isNaN(n) || full.length !== 6) return [1, 1, 1];
  return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];
};

const supportsWebGL2 = () => {
  try {
    return !!document.createElement("canvas").getContext("webgl2");
  } catch {
    return false;
  }
};

const vertex = `#version 300 es
in vec2 position;
void main() { gl_Position = vec4(position, 0.0, 1.0); }`;

const fragment = `#version 300 es
precision highp float;
out vec4 fragColor;

uniform vec2  uResolution;
uniform float uDpr;
uniform vec2  uPhase;
uniform float uWarp;
uniform float uStir;
uniform float uViscosity;
uniform float uFresnel;
uniform float uIridescence;
uniform float uRoughness;
uniform vec3  uTint;
uniform vec3  uSheen;
uniform vec3  uBg;
uniform vec2  uStirPos[8];
uniform vec4  uStirVec[8];

float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.56);
  return fract(p.x * p.y);
}

float vnoise(vec2 p) {
  vec2 i = floor(p), f = fract(p);
  vec2 u = f * f * (3.0 - 2.0 * f);
  return mix(
    mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),
    mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x),
    u.y
  );
}

// Two octaves for the warp, four for the height. Warping at four costs three
// extra noise samples per height evaluation - and there are three evaluations
// per pixel - for detail the normal's difference throws away again.
float fbm2(vec2 p) {
  return vnoise(p) * 0.62 + vnoise(p * 2.03) * 0.31;
}
float fbm4(vec2 p) {
  float a = 0.5, s = 0.0;
  for (int i = 0; i < 4; i++) { s += a * vnoise(p); p *= 2.03; a *= 0.5; }
  return s;
}

const float DOMAIN = 2.2;

// Sum of the live impulses, as a DISPLACEMENT OF THE HEIGHT rather than of the
// sampling coordinate. Translating the domain instead is the obvious move and it
// is invisible: the noise is statistically homogeneous, so sliding it sideways
// yields a field that looks the same, and taking the normal's differences after
// the shift means the normal never sees the shift at all. Deforming the height
// puts the stir inside the finite differences, so the metal genuinely bulges.
//
// The term is dot(direction, offset): signed along the stroke, so metal piles up
// ahead of the drag and hollows out behind it. That is what a finger pulled
// through something viscous actually leaves, and it is why the wake reads as
// displacement rather than as a brightness smear.
float stirHeight(vec2 p) {
  vec2 q = p / DOMAIN;
  float acc = 0.0;
  for (int i = 0; i < 8; i++) {
    if (uStirVec[i].w < 0.5) continue;
    vec2 d = q - uStirPos[i];
    float decay = exp(-uStirVec[i].z / max(uViscosity * 2.2, 0.05));
    float fall = exp(-dot(d, d) * 14.0);
    acc += dot(uStirVec[i].xy, d) * decay * fall;
  }
  return acc * uStir * 30.0;
}

float height(vec2 p, vec2 flow) {
  vec2 q = p + uWarp * vec2(fbm2(p + flow), fbm2(p.yx + flow.yx + 3.7));
  return fbm4(q * 1.25 + flow * 0.4) + stirHeight(p);
}

// The studio. Roughness widens the two softbox edges rather than blurring a
// texture - a rough metal does not reflect a blurrier room, it reflects the same
// room over a wider cone, and the visible consequence is exactly this.
vec3 studio(vec3 r, float rough) {
  float y = clamp(r.y, -1.0, 1.0);
  float soft = mix(0.015, 0.34, clamp(rough, 0.0, 1.0));

  vec3 sky = mix(vec3(0.30, 0.33, 0.40), vec3(0.78, 0.82, 0.92), smoothstep(-0.1, 0.95, y));
  vec3 floorCol = mix(uBg, vec3(0.16, 0.17, 0.21), smoothstep(-1.0, 0.05, y));
  vec3 col = mix(floorCol, sky, smoothstep(-0.06, 0.10, y));

  float box = smoothstep(0.34 - soft, 0.34 + soft, y) * (1.0 - smoothstep(0.70 - soft, 0.70 + soft, y));
  col += vec3(1.0) * box * 0.85;

  float lip = smoothstep(-0.34 - soft, -0.34 + soft, y) * (1.0 - smoothstep(-0.14 - soft, -0.14 + soft, y));
  col += vec3(0.62, 0.66, 0.78) * lip * 0.30;

  // A slow azimuthal ripple so a perfectly flat patch is never perfectly flat.
  col *= 0.92 + 0.08 * cos(atan(r.z, r.x) * 3.0);
  return col;
}

// Thin film. The hue comes from optical thickness over the cosine, so it tracks
// the surface angle instead of being painted on - which is the entire difference
// between iridescence and a rainbow gradient.
vec3 thinFilm(float cosT) {
  float d = 3.4 / max(cosT, 0.09);
  return 0.5 + 0.5 * cos(d * vec3(1.0, 0.86, 0.72) + vec3(0.0, 2.1, 4.2));
}

void main() {
  vec2 res = uResolution / uDpr;
  vec2 uv = (gl_FragCoord.xy / uDpr - res * 0.5) / max(res.y, 1.0);

  vec2 flow = vec2(cos(uPhase.x), sin(uPhase.y)) * 1.4;
  vec2 p = uv * DOMAIN;

  // Central difference for the normal. Every derivative is taken before any
  // branch below, so no fragment can reach fwidth in non-uniform control flow.
  float e = 0.006;
  float h  = height(p, flow);
  float hx = height(p + vec2(e, 0.0), flow);
  float hy = height(p + vec2(0.0, e), flow);
  vec3 n = normalize(vec3((h - hx) / e, (h - hy) / e, 1.6));

  vec3 v = vec3(0.0, 0.0, 1.0);
  vec3 r = reflect(-v, n);
  float cosT = clamp(dot(n, v), 0.0, 1.0);

  vec3 env = studio(r, uRoughness);

  // Metals tint what they reflect, and the tint washes out toward white at
  // grazing angles. That is the whole of a conductor's Fresnel response.
  float fres = pow(1.0 - cosT, max(uFresnel, 0.1));
  vec3 col = env * mix(uTint, vec3(1.0), fres);

  col = mix(col, col * (0.55 + 0.85 * thinFilm(cosT)), uIridescence * (0.35 + 0.65 * fres));
  col += uSheen * fres * 0.45;

  // Vignette toward the environment floor rather than to black, so the panel
  // edge reads as the room falling away instead of as a mask.
  float vig = 1.0 - 0.35 * dot(uv, uv);
  col = mix(uBg, col, clamp(vig, 0.0, 1.0));

  fragColor = vec4(col, 1.0);
}`;

const RATES = [0.23, 0.17];
const TAU = Math.PI * 2;
const STIR_LIFE = 2.6;
const STIR_SPACING = 0.04;

const Quicksilver = memo(
  ({
    flowSpeed = 0.35,
    warp = 0.55,
    stir = 1,
    viscosity = 0.6,
    fresnel = 2.2,
    iridescence = 0.45,
    roughness = 0.18,
    tint = "#c8d2e0",
    sheenColor = "#a855f7",
    backgroundColor = "#05060a",
    paused = false,
    reducedMotion = false,
    className,
  }: QuicksilverProps) => {
    const containerRef = useRef<HTMLDivElement>(null);
    const drawRef = useRef<((dt: number) => void | false) | null>(null);
    const measureRef = useRef<((m: Metrics) => void) | null>(null);
    const glRef = useRef<WebGLRenderingContext | WebGL2RenderingContext | null>(null);
    const pushStir = useRef<
      ((x: number, y: number, dx: number, dy: number) => void) | null
    >(null);
    const lastStir = useRef<{ x: number; y: number } | null>(null);

    const [fallback, setFallback] = useState(false);

    const loop = useAnimationLoop({
      target: containerRef,
      halted: paused || reducedMotion,
      dpr: "auto",
      onResize: (metrics) => measureRef.current?.(metrics),
      onFrame: ({ dt }) => (drawRef.current ? drawRef.current(dt) : false),
      gl: () => glRef.current,
    });

    const live = useRef({
      flowSpeed, warp, stir, viscosity, fresnel, iridescence,
      roughness, tint, sheenColor, backgroundColor,
    });
    live.current = {
      flowSpeed, warp, stir, viscosity, fresnel, iridescence,
      roughness, tint, sheenColor, backgroundColor,
    };

    useEffect(() => {
      const container = containerRef.current;
      if (fallback || !container) return;
      if (!supportsWebGL2()) {
        setFallback(true);
        return;
      }

      const renderer = new Renderer({
        webgl: 2,
        alpha: false,
        antialias: false,
        powerPreference: "high-performance",
        dpr: Math.min(window.devicePixelRatio || 1, 2),
      });
      const gl = renderer.gl;
      glRef.current = gl;

      const canvas = gl.canvas as HTMLCanvasElement;
      canvas.style.display = "block";
      canvas.style.position = "absolute";
      canvas.style.top = "0";
      canvas.style.left = "0";
      container.appendChild(canvas);

      const stirPos: number[] = new Array(STIRS * 2).fill(0);
      const stirVec: number[] = new Array(STIRS * 4).fill(0);

      const program = new Program(gl, {
        vertex,
        fragment,
        uniforms: {
          uResolution: { value: new Float32Array([1, 1]) },
          uDpr: { value: 1 },
          uPhase: { value: new Float32Array([0, 1.3]) },
          uWarp: { value: warp },
          uStir: { value: stir },
          uViscosity: { value: viscosity },
          uFresnel: { value: fresnel },
          uIridescence: { value: iridescence },
          uRoughness: { value: roughness },
          uTint: { value: new Float32Array(hexToRgb01(tint)) },
          uSheen: { value: new Float32Array(hexToRgb01(sheenColor)) },
          uBg: { value: new Float32Array(hexToRgb01(backgroundColor)) },
          uStirPos: { value: stirPos },
          uStirVec: { value: stirVec },
        },
      });
      const mesh = new Mesh(gl, { geometry: new Triangle(gl), program });
      const u = program.uniforms as Record<string, { value: number | Float32Array }>;

      const phase = new Float32Array([0, 1.3]);
      let slot = 0;

      pushStir.current = (x, y, dx, dy) => {
        stirPos[slot * 2 + 0] = x;
        stirPos[slot * 2 + 1] = y;
        const i4 = slot * 4;
        stirVec[i4 + 0] = dx;
        stirVec[i4 + 1] = dy;
        stirVec[i4 + 2] = 0;
        stirVec[i4 + 3] = 1;
        slot = (slot + 1) % STIRS;
      };

      const sync = () => {
        const l = live.current;
        (u.uPhase.value as Float32Array).set(phase);
        u.uWarp.value = l.warp;
        u.uStir.value = l.stir;
        u.uViscosity.value = l.viscosity;
        u.uFresnel.value = l.fresnel;
        u.uIridescence.value = l.iridescence;
        u.uRoughness.value = l.roughness;
        (u.uTint.value as Float32Array).set(hexToRgb01(l.tint));
        (u.uSheen.value as Float32Array).set(hexToRgb01(l.sheenColor));
        (u.uBg.value as Float32Array).set(hexToRgb01(l.backgroundColor));
      };

      drawRef.current = (dt) => {
        const l = live.current;
        for (let i = 0; i < 2; i++) {
          phase[i] = (phase[i] + dt * RATES[i] * l.flowSpeed) % TAU;
        }
        for (let i = 0; i < STIRS; i++) {
          const i4 = i * 4;
          if (stirVec[i4 + 3] < 0.5) continue;
          stirVec[i4 + 2] += dt;
          if (stirVec[i4 + 2] > STIR_LIFE) stirVec[i4 + 3] = 0;
        }
        sync();
        renderer.render({ scene: mesh });
      };

      measureRef.current = ({ width, height: h, dpr }) => {
        renderer.dpr = dpr;
        renderer.setSize(Math.max(1, Math.floor(width)), Math.max(1, Math.floor(h)));
        const res = u.uResolution.value as Float32Array;
        res[0] = gl.drawingBufferWidth;
        res[1] = gl.drawingBufferHeight;
        u.uDpr.value = dpr;
        sync();
        renderer.render({ scene: mesh });
      };

      loop.resize();
      loop.start();

      return () => {
        drawRef.current = null;
        measureRef.current = null;
        pushStir.current = null;
        if (container.contains(canvas)) container.removeChild(canvas);
      };
      // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [fallback]);

    useEffect(() => {
      loop.paint();
    }, [
      flowSpeed, warp, stir, viscosity, fresnel, iridescence,
      roughness, tint, sheenColor, backgroundColor, loop,
    ]);

    const track = (e: React.PointerEvent<HTMLDivElement>) => {
      if (reducedMotion) return;
      const rect = e.currentTarget.getBoundingClientRect();
      if (rect.width === 0 || rect.height === 0) return;
      const x = (e.clientX - rect.left - rect.width * 0.5) / rect.height;
      const y = (rect.top + rect.height * 0.5 - e.clientY) / rect.height;

      const prev = lastStir.current;
      if (!prev) {
        lastStir.current = { x, y };
        return;
      }

      const dx = x - prev.x;
      const dy = y - prev.y;
      const len = Math.hypot(dx, dy);
      if (len < STIR_SPACING) return;
      lastStir.current = { x, y };

      const speed = Math.min(len / STIR_SPACING, 2.5);
      const mag = (speed * 0.06) / len;
      pushStir.current?.(x, y, dx * mag, dy * mag);
      loop.start();
    };
    const release = () => {
      lastStir.current = null;
    };

    if (fallback) {
      return (
        <div
          className={className ?? "relative h-full w-full overflow-hidden"}
          style={{
            backgroundColor,
            backgroundImage: `linear-gradient(150deg, ${backgroundColor} 0%, ${tint} 38%, #ffffff 46%, ${tint} 54%, ${sheenColor} 72%, ${backgroundColor} 100%)`,
          }}
        />
      );
    }

    return (
      <div
        ref={containerRef}
        className={className ?? "relative h-full w-full overflow-hidden"}
        onPointerMove={track}
        onPointerLeave={release}
        onPointerCancel={release}
      />
    );
  },
);

Quicksilver.displayName = "Quicksilver";

export default Quicksilver;
```

### 2. `hooks/use-animation-loop.ts` — peer hook, required

```tsx
"use client";

import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";

export interface Metrics {
  width: number;
  height: number;
  dpr: number;
  bufferWidth: number;
  bufferHeight: number;
}

export interface FrameInfo {
  now: number;
  dt: number;
  elapsed: number;
  frame: number;
}

export interface AnimationLoopHandle {
  start(): void;
  stop(): void;
  paint(): void;
  resize(): void;
  readonly running: boolean;
}

export interface AnimationLoopOptions {
  target: React.RefObject<HTMLElement | null>;
  halted?: boolean;
  dpr?: number | "auto";
  onResize?(metrics: Metrics): void;
  onFrame?(info: FrameInfo): void | false;
  paintWhenHalted?: boolean;
  resizeDebounceMs?: number;
  gl?(): WebGLRenderingContext | WebGL2RenderingContext | null | undefined;
  onDispose?(): void;
  deps?: unknown[];
}

const MAX_DT = 1 / 15;

export function useAnimationLoop(
  options: AnimationLoopOptions,
): AnimationLoopHandle {
  const opts = useRef(options);
  useLayoutEffect(() => {
    opts.current = options;
  });

  const raf = useRef<number | null>(null);
  const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
  const running = useRef(false);
  const disposed = useRef(false);
  const startedAt = useRef(0);
  const last = useRef(0);
  const frame = useRef(0);

  const measure = useCallback((): Metrics | null => {
    const el = opts.current.target.current;
    if (!el) return null;
    const rect = el.getBoundingClientRect();
    const cap = opts.current.dpr ?? "auto";
    const limit = cap === "auto" ? 2 : cap;
    const dpr = Math.min(
      typeof window === "undefined" ? 1 : window.devicePixelRatio || 1,
      limit,
    );
    return {
      width: rect.width,
      height: rect.height,
      dpr,
      bufferWidth: Math.max(1, Math.round(rect.width * dpr)),
      bufferHeight: Math.max(1, Math.round(rect.height * dpr)),
    };
  }, []);

  const tick = useCallback(function tick(now: number) {
    if (disposed.current) return;

    if (startedAt.current === 0) startedAt.current = now;
    const dt = last.current === 0 ? 0 : Math.min((now - last.current) / 1000, MAX_DT);
    last.current = now;

    const info: FrameInfo = {
      now,
      dt,
      elapsed: (now - startedAt.current) / 1000,
      frame: frame.current++,
    };

    const verdict = opts.current.onFrame?.(info);

    if (disposed.current) return;

    if (verdict === false || opts.current.halted) {
      running.current = false;
      raf.current = null;
      return;
    }
    raf.current = requestAnimationFrame(tick);
  }, []);

  const start = useCallback(() => {
    if (disposed.current || running.current) return;
    running.current = true;
    last.current = 0;
    raf.current = requestAnimationFrame(tick);
  }, [tick]);

  const stop = useCallback(() => {
    running.current = false;
    if (raf.current !== null) {
      cancelAnimationFrame(raf.current);
      raf.current = null;
    }
  }, []);

  const paint = useCallback(() => start(), [start]);

  const resize = useCallback(() => {
    const metrics = measure();
    if (!metrics) return;
    opts.current.onResize?.(metrics);
    if (opts.current.paintWhenHalted !== false) paint();
    else if (!opts.current.halted) start();
  }, [measure, paint, start]);

  const deps = options.deps ?? [];

  useEffect(() => {
    disposed.current = false;
    const el = opts.current.target.current;
    if (!el) return;

    const run = () => {
      if (disposed.current) return;
      resize();
    };

    const observer = new ResizeObserver(() => {
      const wait = opts.current.resizeDebounceMs ?? 0;
      if (wait <= 0) {
        run();
        return;
      }
      if (timer.current !== null) clearTimeout(timer.current);
      timer.current = setTimeout(() => {
        timer.current = null;
        run();
      }, wait);
    });
    observer.observe(el);

    resize();
    if (!opts.current.halted) start();

    return () => {
      disposed.current = true;
      running.current = false;
      if (raf.current !== null) {
        cancelAnimationFrame(raf.current);
        raf.current = null;
      }
      if (timer.current !== null) {
        clearTimeout(timer.current);
        timer.current = null;
      }
      observer.disconnect();
      opts.current.onDispose?.();
      const context = opts.current.gl?.();
      context?.getExtension("WEBGL_lose_context")?.loseContext();
      startedAt.current = 0;
      last.current = 0;
      frame.current = 0;
    };
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, deps);

  const halted = options.halted ?? false;
  useEffect(() => {
    if (!halted) start();
  }, [halted, start]);

  return useMemo<AnimationLoopHandle>(
    () => ({
      start,
      stop,
      paint,
      resize,
      get running() {
        return running.current;
      },
    }),
    [start, stop, paint, resize],
  );
}
```


## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `flowSpeed` | `number` | `0.35` | How fast the surface churns. At zero the metal sets, and a still frame is the only honest way to see how much of what you are looking at is the height field and how much is the light sitting on it. Range 0–2 ×. |
| `warp` | `number` | `0.55` | How far the noise drags its own coordinates before it is sampled again. Low is rolled sheet metal; past about one the surface folds back through itself and stops reading as a liquid at all. Range 0–1.5. |
| `stir` | `number` | `1` | How hard the pointer drags the metal. Eight recent impulses are kept alive at once, each with its own direction and age, which is why this leaves a wake rather than a dent — and why the whole component still costs one pass and no render target. Range 0–3 ×. |
| `viscosity` | `number` | `0.6` | How long a stir survives after the pointer has left. Low is mercury and settles almost before you have finished the gesture; high holds the wake long enough that you can write in it. Range 0.05–1. |
| `fresnel` | `number` | `2.2` | Schlick exponent on the rim response. Low mirrors the whole surface evenly and reads as painted plastic; high keeps the bright reflection at the grazing angles, which is where metal actually puts it. Range 0.5–6. |
| `iridescence` | `number` | `0.45` | Thin-film interference over the reflection, and the whole difference between chrome and oil on water. The hue comes from the film's optical thickness over the viewing cosine, so it tracks the surface angle instead of being a rainbow painted across the panel. Range 0–1. |
| `roughness` | `number` | `0.18` | How soft the reflected studio edges are. This is not a blur: a rough conductor reflects the same room over a wider cone, so what widens is the light-to-dark transition. Zero is a mirror and shows every artefact in the height field, and a little roughness is what lets procedural metal survive being looked at closely. Range 0–1. |
| `tint` | `string (hex)` | `"#c8d2e0"` | The base metal. Conductors tint what they reflect, and this washes out toward white at the grazing angles rather than staying constant — which is the part most fake chrome gets wrong. |
| `sheenColor` | `string (hex)` | `"#a855f7"` | The colour carried by the grazing-angle sheen. |
| `backgroundColor` | `string (hex)` | `"#05060a"` | The floor of the reflected environment, and what the vignette falls away to — so the panel edge reads as the room ending rather than as a mask laid over it. |

## Usage

```tsx
import Quicksilver from "@/components/registry/quicksilver/quicksilver";

<Quicksilver
  flowSpeed={0.35}
  warp={0.55}
  stir={1}
  viscosity={0.6}
  fresnel={2.2}
  iridescence={0.45}
  roughness={0.18}
  tint="#c8d2e0"
  sheenColor="#a855f7"
  backgroundColor="#05060a"
/>
```

The import path matches the file path above; change it if you move the component. Every value shown is the documented default — pass only what you actually want to change. The snippet lists the tunable props only: if the component's props type in the source requires others (content, handlers, data), pass those too.

## Integration rules

- Keep the `"use client"` directive. This is a client component and will not render as a Server Component.
- It fills its parent. Give the wrapper an explicit height (or a definite grid area) — against a height-auto parent it collapses to nothing.
- It takes a `reducedMotion` prop and quiesces when true. Wire it to a `prefers-reduced-motion` listener rather than hardcoding `false`.
- It runs a free-running animation loop. Halt it when off-screen or backgrounded if you care about battery.
- The peer hook is required, not optional. Copy it to `hooks/use-animation-loop.ts` so the component's `@/hooks/use-animation-loop` import resolves.
- It owns a GPU/canvas context and releases it on unmount. Preserve the cleanup return — leaking contexts kills the tab after a few navigations.

## Your task

1. Tell me where in my project this should live and why.
2. Create the files above verbatim.
3. Wire the component into the place I point you at, with sensible props for that context.
4. Flag anything in my setup that conflicts with the stack assumptions above.

Do not restyle the component or alter the animation math unless I ask.
