{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"cast-glass-wordmark-footer-ray-marched-in-webgl-with-jewel-coloured-letters-that-throw-coloured-shadows-and-turn-on-their-pivots-when-pressed","type":"registry:block","title":"Cast Glass Wordmark Footer Ray-Marched in WebGL With Jewel-Coloured Letters That Throw Coloured Shadows and Turn on Their Pivots When Pressed","description":"Free React footer: a giant wordmark cast in coloured glass, traced in a WebGL shader on a white studio floor, with link columns and a legal line set around it.","dependencies":[],"files":[{"path":"components/we-inc/cast-glass-wordmark-footer-ray-marched-in-webgl-with-jewel-coloured-letters-that-throw-coloured-shadows-and-turn-on-their-pivots-when-pressed.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// Everything a visitor would edit first.\nconst brand = {\n  word: \"ombra\", // cast in glass, as wide as the footer. Letters that hang below the line (g j p q y) are cut off at the floor.\n  name: \"Ombra Glassworks\",\n  line: \"Letters, lamps and lenses, cast slowly in coloured glass.\",\n  place: [\"Kiln Yard, 18 Tidemill Lane\", \"Open to visitors Thursday to Saturday\"],\n  legal: \"© 2026 Ombra Glassworks Ltd.\",\n};\nconst columns = [\n  { title: \"Studio\", links: [\"About\", \"The furnace\", \"People\", \"Careers\"] },\n  { title: \"Work\", links: [\"Commissions\", \"Shop signs\", \"Lighting\", \"Archive\"] },\n  { title: \"Visit\", links: [\"Workshop tours\", \"Open days\", \"Stockists\", \"Contact\"] },\n  { title: \"Read\", links: [\"Journal\", \"Newsletter\", \"Press\", \"Care guide\"] },\n];\nconst small = [\"Privacy\", \"Terms\", \"Cookies\"];\n// One glass per letter, repeating. Each is how fast the glass swallows red, green and blue per unit of depth.\nconst GLASS = [\n  [3.3, 1.55, 0.06], // cobalt\n  [0.05, 1.9, 3.6], // vermilion\n  [0.04, 0.8, 3.6], // amber\n  [3.2, 0.42, 2.2], // emerald\n  [0.2, 3.2, 1.1], // rose\n];\n// The same five glasses as screen colours, for the still that shows when WebGL is not there.\nconst TINT = [\"#2447d6\", \"#f0492c\", \"#f6ae17\", \"#12a26a\", \"#ee3d84\"];\nconst DEPTH = 0.3; // half the thickness of a letter, front to back\nconst SUN = { turn: -0.24, height: 0.64 }; // where the lamp stands, in radians: behind the word and to the left\nconst FONT = '\"Inter Tight\", \"Inter\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif';\nconst SERIF = '\"Iowan Old Style\", \"Palatino Linotype\", Palatino, \"Book Antiqua\", Georgia, serif';\nconst WEIGHT = 800;\n\nconst TW = 2048, TH = 640, UNIT = 320; // the plate the word is set on: pixels, and pixels per unit of the scene\nconst BASE = 0.93; // how far down the plate the baseline sits\nconst MAXL = 8;\n\nconst VERT = `#version 300 es\nin vec2 aPos; void main(){ gl_Position = vec4(aPos, 0.0, 1.0); }`;\n\nconst TONE = `\nvec3 tone(vec3 x){ vec3 c = 1.0 - exp(-max(x, 0.0) * 1.22); c = mix(c, c * c * (3.0 - 2.0 * c), 0.5); return pow(c, vec3(1.0 / 2.2)); }\n`;\n\n// The photograph: a white sweep, a lamp behind it, and a word of cast glass traced ray by ray.\nconst SCENE = `#version 300 es\nprecision highp float;\nout vec4 outC;\nuniform vec2 uRes; uniform vec4 uJit; uniform float uSeed; uniform float uDirect;\nuniform vec3 uCam; uniform float uFoc; uniform vec2 uShift; uniform float uFocus;\nuniform vec3 uSun; uniform sampler2D uSdf; uniform vec4 uPlate; uniform float uReach; uniform vec2 uWide;\nuniform vec2 uCol[8]; uniform float uTurn[8]; uniform float uMid[8]; uniform vec3 uAbs[8]; uniform float uBusy;\nconst float ZW = 10.0; const float RC = 3.4; const float TOP = 90.0;\nconst float D = ${DEPTH.toFixed(3)};\nconst float BW = 0.105; const float BZ = 0.075; const float RR = 0.012; const float BL = 0.129035;\nconst float IOR = 1.5;\nconst vec3 FLOORC = vec3(0.93, 0.915, 0.89);\nconst vec3 SUNC = vec3(1.0, 0.95, 0.86);\n${TONE}\nfloat h21(vec2 p){ vec3 q = fract(vec3(p.xyx) * 0.1031); q += dot(q, q.yzx + 33.33); return fract((q.x + q.y) * q.z); }\nfloat n2(vec2 x){ vec2 i = floor(x); vec2 f = fract(x); f = f * f * (3.0 - 2.0 * f);\n  return mix(mix(h21(i), h21(i + vec2(1.0, 0.0)), f.x), mix(h21(i + vec2(0.0, 1.0)), h21(i + vec2(1.0, 1.0)), f.x), f.y); }\n\n// Which letter a point belongs to: the word is cut into columns between the glyphs.\nint col(float x){ int i = 0; for (int k = 0; k < 7; k++) if (x > uCol[k].y) i = k + 1; return i; }\n\n// Distance to the outline of the word on its plate, read from the baked field.\nfloat sdf2(vec2 q){\n  vec2 uv = vec2(q.x / (2.0 * uPlate.x) + 0.5, (q.y - uPlate.z) / uPlate.y);\n  vec2 c = clamp(uv, 0.002, 0.998);\n  return texture(uSdf, c).r + length((uv - c) * vec2(2.0 * uPlate.x, uPlate.y));\n}\n// A letter is its outline pushed back through the glass, with a wide cut bevel round both faces.\nfloat shape(float a2, float z){ float a = a2 + RR; float b = abs(z) - D + RR; return max(max(a, b), (a * BZ + b * BW + BW * BZ) / BL) - RR; }\n// Each letter stands on its own pivot: this is a point seen from the turned frame of letter n.\nvec3 turned(int n, vec3 p, out vec2 cs){\n  float th = uTurn[n]; cs = vec2(cos(th), sin(th)); float xx = p.x - uMid[n];\n  return vec3(uMid[n] + xx * cs.x - p.z * cs.y, p.y, xx * cs.y + p.z * cs.x);\n}\n// Letter n by itself. Its outline is only read inside its own column of the plate, so a turning letter never drags its neighbours round.\nfloat letter(int n, vec3 p){\n  vec2 cs; vec3 q = turned(n, p, cs);\n  float cx = clamp(q.x, uCol[n].x, uCol[n].y); float dx = abs(q.x - cx);\n  float a = sdf2(vec2(cx, q.y));\n  return shape(dx > 0.0 ? max(dx, a - dx) : a, q.z);\n}\n// The whole word, and which letter is nearest. While nothing turns it is one read of the plate.\nfloat mapW(vec3 p, out int who){\n  who = col(p.x);\n  if (uBusy < 0.5) return shape(sdf2(p.xy), p.z);\n  float d = letter(who, p);\n  int j = p.x - uCol[who].x < uCol[who].y - p.x ? who - 1 : who + 1;\n  if (j >= 0 && j < 8) { float e = letter(j, p); if (e < d) { d = e; who = j; } }\n  return d;\n}\nfloat map(vec3 p){ int w; return mapW(p, w); }\nvec2 box(vec3 ro, vec3 rd){\n  vec3 c = vec3(0.0, 0.98, 0.0); vec3 b = vec3(uPlate.x, 1.0, D + uReach);\n  vec3 m = 1.0 / (rd + vec3(1e-6)); vec3 n = m * (ro - c); vec3 k = abs(m) * b; vec3 a = -n - k; vec3 z = -n + k;\n  return vec2(max(max(a.x, a.y), a.z), min(min(z.x, z.y), z.z));\n}\nfloat march(vec3 ro, vec3 rd, int steps){\n  vec2 tb = box(ro, rd); if (tb.y < max(tb.x, 0.0)) return -1.0;\n  float t = max(tb.x, 0.0);\n  for (int i = 0; i < steps; i++) { float d = map(ro + rd * t); if (d < 0.0007) return t; t += d; if (t > tb.y) break; }\n  return -1.0;\n}\n// The way a face points, worked out from the same pieces as the solid so that flat faces come out flat and creases crisp.\nvec3 nrm(vec3 p, int who){\n  vec2 cs; vec3 q = turned(who, p, cs);\n  q.x = clamp(q.x, uCol[who].x, uCol[who].y);\n  vec2 uv = clamp(vec2(q.x / (2.0 * uPlate.x) + 0.5, (q.y - uPlate.z) / uPlate.y), 0.002, 0.998);\n  vec3 tx = texture(uSdf, uv).rgb;\n  vec2 g = normalize(tx.gb + 1e-6);\n  float sz = q.z < 0.0 ? -1.0 : 1.0;\n  float a = tx.r + RR; float b = abs(q.z) - D + RR; float e = (a * BZ + b * BW + BW * BZ) / BL;\n  float m = max(max(a, b), e);\n  float wa = exp((a - m) * 260.0); float wb = exp((b - m) * 260.0); float we = exp((e - m) * 260.0);\n  vec3 n = wa * vec3(g, 0.0) + wb * vec3(0.0, 0.0, sz) + we * vec3(g * BZ, sz * BW) / BL;\n  n = normalize(n);\n  return vec3(n.x * cs.x + n.z * cs.y, n.y, n.z * cs.x - n.x * cs.y);\n}\n// How far a point inside the glass is from the face the lamp shines in through.\nfloat toSun(vec3 p){ float t = 0.0; for (int i = 0; i < 9; i++) { float d = -map(p + uSun * t); if (d < 0.003) break; t += max(d, 0.014); } return t; }\n// Cast glass is never quite flat: a slow wave on every face.\nvec3 wavy(vec3 n, vec3 p){\n  vec3 w = vec3(n2(p.xy * 4.3 + p.z * 3.1) - 0.5, n2(p.yx * 4.9 + 11.0 - p.z * 2.7) - 0.5, n2(p.xy * 3.7 + 5.0) - 0.5);\n  return normalize(n + 0.05 * w);\n}\n\n// The room the glass reflects: a bright studio with a window, a strip light, a scrim overhead and one black card.\nvec3 env(vec3 rd){\n  float el = asin(clamp(rd.y, -1.0, 1.0)); float az = atan(rd.x, -rd.z);\n  vec3 c = mix(vec3(0.3, 0.29, 0.28), vec3(1.25, 1.27, 1.3), smoothstep(-0.2, 0.55, rd.y));\n  c += vec3(1.0, 0.99, 0.97) * 12.0 * smoothstep(0.75, 1.1, el);\n  vec2 w = abs(vec2(az + 0.7, el - 0.52)) - vec2(0.42, 0.3);\n  float bars = smoothstep(0.012, 0.026, abs(az + 0.7)) * smoothstep(0.012, 0.026, abs(el - 0.52));\n  c += vec3(1.0, 0.98, 0.95) * 26.0 * smoothstep(0.02, -0.02, max(w.x, w.y)) * bars;\n  vec2 w2 = abs(vec2(az - 1.15, el - 0.3)) - vec2(0.09, 0.6);\n  c += vec3(0.95, 0.97, 1.0) * 18.0 * smoothstep(0.03, -0.03, max(w2.x, w2.y));\n  vec2 w3 = abs(vec2(az - 0.42, el - 0.2)) - vec2(0.26, 0.5);\n  c *= 1.0 - 0.9 * smoothstep(0.06, -0.06, max(w3.x, w3.y));\n  c += SUNC * 46.0 * smoothstep(0.9962, 0.9989, dot(rd, uSun));\n  return c;\n}\n\n// How much of the lamp reaches a point on the floor, and in what colour: the light is filtered by every bit of glass it crosses.\nvec3 sunVis(vec3 p, float jit){\n  vec2 tb = box(p, uSun); if (tb.y < max(tb.x, 0.0)) return vec3(1.0);\n  float t0 = max(tb.x, 0.0); float dt = (tb.y - t0) / 22.0; float t = t0 + dt * jit;\n  vec3 ab = vec3(0.0); float len = 0.0; float deep = 0.0;\n  for (int i = 0; i < 22; i++) {\n    vec3 q = p + uSun * t; int who; float d = mapW(q, who); float soft = 0.002 + 0.005 * t;\n    float w = smoothstep(soft, -soft, d);\n    ab += uAbs[who] * w * dt; len += w * dt; deep = max(deep, -d);\n    t += dt;\n  }\n  if (len < 0.0005) return vec3(1.0);\n  // the edge of the glass throws light aside, the bevel just inside it gathers a bright line, and the wave in the faces draws threads\n  vec2 al = normalize(uSun.xz); vec2 fq = vec2(dot(p.xz, vec2(-al.y, al.x)), dot(p.xz, al));\n  float thread = n2(vec2(fq.x * 17.0 + 1.4 * n2(fq * 1.9), fq.y * 1.1));\n  float edge = smoothstep(0.0, 0.035, len);\n  float line = exp(-pow((deep - 0.07) / 0.02, 2.0)) * smoothstep(0.1, 0.4, len);\n  float core = smoothstep(0.2, 0.7, len);\n  // any light that so much as clips a letter comes out coloured: the bevels bend it through more glass than a straight line would\n  vec3 thru = exp(-(ab / max(len, 1e-4)) * (len * 1.5 + 0.34 * edge)) * (0.92 + 0.5 * core * thread * thread + 1.1 * line);\n  return mix(vec3(1.0), thru, edge);\n}\n\n// Everything that is not glass: floor, cove and wall of one white sweep.\nvec3 stage(vec3 ro, vec3 rd, float full, float jit){\n  float t = 1e9; vec3 n = vec3(0.0, 1.0, 0.0);\n  if (rd.y < 0.0) { float tf = -ro.y / rd.y; float z = ro.z + rd.z * tf; if (z < ZW - RC) t = tf; }\n  if (t > 1e8 && rd.z > 0.0) { float tw = (ZW - ro.z) / rd.z; float y = ro.y + rd.y * tw; if (y > TOP) return env(rd); if (y > RC) { t = tw; n = vec3(0.0, 0.0, -1.0); } }\n  if (t > 1e8) {\n    vec2 o = ro.yz - vec2(RC, ZW - RC); float a = dot(rd.yz, rd.yz); float b = dot(o, rd.yz); float h = b * b - a * (dot(o, o) - RC * RC);\n    if (h > 0.0 && a > 1e-7) { float tc = (-b + sqrt(h)) / a; vec2 pc = ro.yz + rd.yz * tc; if (tc > 0.0 && pc.x < RC + 0.02 && pc.y > ZW - RC - 0.02) { t = tc; vec2 nn = (vec2(RC, ZW - RC) - pc) / RC; n = vec3(0.0, nn.x, nn.y); } }\n  }\n  if (t > 1e8) return env(rd);\n  vec3 p = ro + rd * t;\n  // the sweep is only as big as the picture needs: past its edges the studio is dark, and that is what draws the edges of the glass\n  if (abs(p.x - uCam.x) > uWide.x * (p.z - uCam.z) + 0.5 || p.z < uWide.y) return env(rd) * 0.06;\n  vec2 pq = p.xz + p.y * vec2(0.37, 0.81);\n  float tooth = 0.5 * (n2(pq * 130.0) - 0.5) + 0.3 * (n2(pq * 47.0 + 7.0) - 0.5); float mott = n2(pq * 0.9) - 0.5;\n  vec3 alb = FLOORC * (1.0 + 0.035 * tooth + 0.03 * mott);\n  vec3 vis = vec3(1.0);\n  float near = map(p + n * 0.05);\n  if (full > 0.5 && n.y > 0.2) vis = sunVis(p + n * 0.003, jit);\n  float occ = 0.5 + 0.5 * smoothstep(0.0, 0.3, near);\n  vec3 lit = SUNC * 2.15 * uSun.y * vis + vec3(0.15, 0.17, 0.22) * occ;\n  if (full > 0.5 && n.y > 0.99) {\n    // the floor is sealed and polished: it carries a soft mirror image of the glass\n    vec3 r = normalize(reflect(rd, n) + 0.035 * vec3(jit - 0.5, 0.0, fract(jit * 7.31) - 0.5));\n    float tr = march(p + n * 0.004, r, 30);\n    if (tr > 0.0) {\n      vec3 h = p + r * tr; float fr = 0.04 + 0.96 * pow(1.0 - max(-rd.y, 0.0), 5.0);\n      int who; mapW(h, who);\n      vec3 gc = exp(-uAbs[who] * 1.1) * 1.5 + 0.08;\n      lit = mix(lit, gc / alb, fr * 0.62 * exp(-h.y * 1.1));\n    }\n  }\n  // the wall is a light wall: it glows by itself, brightest behind the word\n  float wash = exp(-dot(p.xy - vec2(0.0, 6.0), p.xy - vec2(0.0, 6.0)) / 700.0);\n  vec3 glow = vec3(1.5, 1.52, 1.57) * (0.86 + 0.2 * wash);\n  return alb * mix(glow, lit, smoothstep(0.0, 0.85, n.y));\n}\n\n// What a ray that has left one letter meets next: sometimes another letter, then the sweep.\nvec3 beyond(vec3 p, vec3 d, float jit){\n  p.y = max(p.y, 0.001);\n  vec3 tint = vec3(1.0);\n  float t = march(p + d * 0.03, d, 26);\n  if (t > 0.0) { int who; mapW(p + d * (t + 0.05), who); tint = exp(-uAbs[who] * 1.0) * 0.9; }\n  return stage(p, d, 1.0, jit) * tint;\n}\n\nvec3 glass(vec3 p, vec3 rd, float jit){\n  int who; mapW(p, who);\n  vec3 ab = uAbs[who];\n  vec3 n = wavy(nrm(p, who), p);\n  float nv = clamp(dot(-rd, n), 0.0, 1.0);\n  float f = 0.04 + 0.96 * pow(1.0 - nv, 5.0);\n  vec3 refl = stage(p + n * 0.01, reflect(rd, n), 1.0, jit);\n  vec3 pos = p - n * 0.012; vec3 dir = refract(rd, n, 1.0 / IOR); float len = 0.0; vec3 glow = vec3(0.0);\n  for (int b = 0; b < 5; b++) {\n    float t = 0.0;\n    for (int i = 0; i < 26; i++) { float d = -map(pos + dir * t); if (d < 0.0016) break; t += max(d, 0.006); }\n    if (b == 0) {\n      // cast glass is faintly cloudy, so the lamp behind lights it from within: brightest near the faces the light comes in by\n      vec3 pa = pos + dir * t * 0.25; vec3 pb = pos + dir * t * 0.7;\n      glow = (exp(-ab * 2.6 * (toSun(pa) + t * 0.25)) + exp(-ab * 2.6 * (toSun(pb) + t * 0.7))) * 0.5 * (1.0 - exp(-t * 2.2));\n    }\n    pos += dir * t; len += t;\n    vec3 m = wavy(nrm(pos, who), pos + 3.0); if (dot(m, dir) < 0.0) m = -m;\n    vec3 rf = refract(dir, -m, IOR);\n    if (dot(rf, rf) < 0.5) { dir = reflect(dir, -m); pos -= m * 0.014; }\n    else { dir = rf; pos += m * 0.014; break; }\n  }\n  vec3 att = exp(-ab * len * 2.4);\n  // glass splits colour a little: red leaves bent slightly less than blue\n  vec3 dv = (dir - rd) * 0.022;\n  vec3 col = beyond(pos, dir, jit);\n  col.r = beyond(pos, normalize(dir - dv), jit).r; col.b = beyond(pos, normalize(dir + dv), jit).b;\n  return (col * att + glow * SUNC * 0.12) * (1.0 - f) + refl * f;\n}\n\nvoid main(){\n  vec2 fc = gl_FragCoord.xy + uJit.xy;\n  vec2 uv = (fc - 0.5 * uRes) / uRes.y - uShift;\n  vec3 rd = normalize(vec3(uv, uFoc));\n  vec3 ro = uCam;\n  vec3 fp = ro + rd * (uFocus / rd.z);\n  ro.xy += uJit.zw; rd = normalize(fp - ro);\n  float ign = fract(52.9829189 * fract(dot(gl_FragCoord.xy, vec2(0.06711056, 0.00583715))) + uSeed);\n  float t = march(ro, rd, 72);\n  vec3 col = t > 0.0 ? glass(ro + rd * t, rd, ign) : stage(ro, rd, 1.0, ign);\n  col = min(col, vec3(12.0));\n  if (uDirect > 0.5) col = tone(col);\n  outC = vec4(col, 1.0);\n}\n`;\n\n// Developing the negative: a little bloom off the hot glints, the film curve, a soft vignette and grain.\nconst POST = `#version 300 es\nprecision highp float;\nout vec4 outC;\nuniform sampler2D uAcc; uniform vec2 uRes; uniform float uGrain;\n${TONE}\nfloat h21(vec2 p){ vec3 q = fract(vec3(p.xyx) * 0.1031); q += dot(q, q.yzx + 33.33); return fract((q.x + q.y) * q.z); }\nvoid main(){\n  vec2 uv = gl_FragCoord.xy / uRes;\n  vec3 c = texture(uAcc, uv).rgb;\n  vec2 px = 1.0 / uRes;\n  vec3 nb = texture(uAcc, uv + vec2(px.x, 0.0)).rgb + texture(uAcc, uv - vec2(px.x, 0.0)).rgb + texture(uAcc, uv + vec2(0.0, px.y)).rgb + texture(uAcc, uv - vec2(0.0, px.y)).rgb;\n  c = max(c + (c - nb * 0.25) * 0.35, 0.0);\n  vec3 b = vec3(0.0);\n  for (int i = 0; i < 20; i++) {\n    float a = float(i) * 2.39996; float r = sqrt((float(i) + 0.5) / 20.0);\n    vec3 s = texture(uAcc, uv + vec2(cos(a), sin(a)) * r * 0.02 * vec2(uRes.y / uRes.x, 1.0)).rgb;\n    b += min(max(s - 3.2, 0.0), vec3(8.0)) * (1.0 - 0.6 * r);\n  }\n  c += b * 0.02;\n  vec2 q = (uv - 0.5) * vec2(uRes.x / uRes.y, 1.0);\n  c *= 1.0 - 0.1 * smoothstep(0.5, 1.4, length(q));\n  c = tone(c);\n  float g = h21(gl_FragCoord.xy + uGrain * 91.7) - 0.5;\n  c += g * 0.016;\n  outC = vec4(c, 1.0);\n}\n`;\n\n// One pass of the exact squared distance transform (Felzenszwalb and Huttenlocher).\nfunction edt1d(f: Float32Array, n: number, d: Float32Array, v: Int32Array, z: Float32Array) {\n  let k = 0;\n  v[0] = 0; z[0] = -1e20; z[1] = 1e20;\n  for (let q = 1; q < n; q++) {\n    let s = 0;\n    for (;;) {\n      const p = v[k];\n      s = (f[q] + q * q - (f[p] + p * p)) / (2 * q - 2 * p);\n      if (s <= z[k] && k > 0) k--; else break;\n    }\n    k++; v[k] = q; z[k] = s; z[k + 1] = 1e20;\n  }\n  k = 0;\n  for (let q = 0; q < n; q++) { while (z[k + 1] < q) k++; const p = v[k]; d[q] = (q - p) * (q - p) + f[p]; }\n}\nfunction edt(grid: Float32Array, w: number, h: number) {\n  const n = Math.max(w, h), f = new Float32Array(n), d = new Float32Array(n), v = new Int32Array(n), z = new Float32Array(n + 1);\n  for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) f[y] = grid[y * w + x]; edt1d(f, h, d, v, z); for (let y = 0; y < h; y++) grid[y * w + x] = d[y]; }\n  for (let y = 0; y < h; y++) { for (let x = 0; x < w; x++) f[x] = grid[y * w + x]; edt1d(f, w, d, v, z); for (let x = 0; x < w; x++) grid[y * w + x] = Math.sqrt(d[x]); }\n}\n\n// Set the word once on a 2D canvas and turn it into a field of distances the shader can stand up in space.\nfunction bakeWord(text: string) {\n  const chars = [...text].slice(0, MAXL);\n  const cv = document.createElement(\"canvas\");\n  cv.width = TW; cv.height = TH;\n  const g = cv.getContext(\"2d\", { willReadFrequently: true });\n  const data = new Float32Array(TW * TH * 3);\n  for (let i = 0; i < TW * TH; i++) data[i * 3] = 0.5;\n  const flat = { data, half: 3, tall: 1.4, edges: chars.slice(1).map((_, i) => ((i + 1) / chars.length) * 6 - 3), spans: chars.map((_, i) => [(i / chars.length) * 6 - 3, ((i + 1) / chars.length) * 6 - 3]) };\n  if (!g) return flat;\n  const px = 300, track = 0.034 * px;\n  g.font = `${WEIGHT} ${px}px ${FONT}`;\n  // each letter keeps its kerning against the ones before it, with a hair of air added so the castings stand apart\n  const xs = chars.map((_, i) => g.measureText(chars.slice(0, i).join(\"\")).width + i * track);\n  const m = g.measureText(chars.join(\"\"));\n  const total = m.width + (chars.length - 1) * track;\n  const asc = m.actualBoundingBoxAscent || px * 0.74;\n  const k = Math.min((TW * 0.95) / total, (TH * 0.86) / asc);\n  g.font = `${WEIGHT} ${px * k}px ${FONT}`;\n  g.fillStyle = \"#fff\"; g.textBaseline = \"alphabetic\";\n  const x0 = (TW - total * k) / 2, y0 = Math.round(TH * BASE);\n  chars.forEach((ch, i) => g.fillText(ch, x0 + xs[i] * k, y0));\n  const spans = chars.map((ch, i) => { const mm = g.measureText(ch); const x = x0 + xs[i] * k; return [(x - (mm.actualBoundingBoxLeft || 0) - TW / 2) / UNIT, (x + (mm.actualBoundingBoxRight || mm.width) - TW / 2) / UNIT]; });\n  const edges = spans.slice(1).map((sp, i) => (sp[0] + spans[i][1]) / 2);\n  const img = g.getImageData(0, 0, TW, TH).data;\n  // rows are stored bottom first so that up on the plate is up in the scene\n  const outer = new Float32Array(TW * TH), inner = new Float32Array(TW * TH);\n  for (let y = 0; y < TH; y++) for (let x = 0; x < TW; x++) {\n    const a = img[((TH - 1 - y) * TW + x) * 4 + 3] / 255, i = y * TW + x;\n    if (a >= 1) { outer[i] = 0; inner[i] = 1e12; } else if (a <= 0) { outer[i] = 1e12; inner[i] = 0; }\n    else { const dd = 0.5 - a; outer[i] = dd > 0 ? dd * dd : 0; inner[i] = dd < 0 ? dd * dd : 0; }\n  }\n  edt(outer, TW, TH); edt(inner, TW, TH);\n  for (let i = 0; i < data.length; i++) outer[i] = (outer[i] - inner[i]) / UNIT;\n  // three light blurs take the stair steps off the outline, so the walls of the glass come out smooth\n  let a = outer, b = inner;\n  for (let pass = 0; pass < 4; pass++) {\n    b.set(a);\n    for (let y = 1; y < TH - 1; y++) for (let x = 1; x < TW - 1; x++) {\n      const i = y * TW + x;\n      b[i] = (a[i] * 4 + (a[i - 1] + a[i + 1] + a[i - TW] + a[i + TW]) * 2 + a[i - TW - 1] + a[i - TW + 1] + a[i + TW - 1] + a[i + TW + 1]) / 16;\n    }\n    [a, b] = [b, a];\n  }\n  // red is the distance; green and blue are the direction it grows in, taken from a softer copy so the walls of the glass are glassy smooth\n  const soft = b; soft.set(a);\n  const line = new Float32Array(Math.max(TW, TH));\n  const R = 3;\n  for (let pass = 0; pass < 3; pass++) {\n    for (let y = 0; y < TH; y++) {\n      const o = y * TW; let sum = 0;\n      for (let x = 0; x < TW; x++) line[x] = soft[o + x];\n      for (let x = -R; x <= R; x++) sum += line[Math.min(TW - 1, Math.max(0, x))];\n      for (let x = 0; x < TW; x++) { soft[o + x] = sum / (2 * R + 1); sum += line[Math.min(TW - 1, x + R + 1)] - line[Math.max(0, x - R)]; }\n    }\n    for (let x = 0; x < TW; x++) {\n      let sum = 0;\n      for (let y = 0; y < TH; y++) line[y] = soft[y * TW + x];\n      for (let y = -R; y <= R; y++) sum += line[Math.min(TH - 1, Math.max(0, y))];\n      for (let y = 0; y < TH; y++) { soft[y * TW + x] = sum / (2 * R + 1); sum += line[Math.min(TH - 1, y + R + 1)] - line[Math.max(0, y - R)]; }\n    }\n  }\n  const inv = UNIT / 2;\n  for (let y = 0; y < TH; y++) for (let x = 0; x < TW; x++) {\n    const i = y * TW + x, o = i * 3, xl = x > 0 ? i - 1 : i, xr = x < TW - 1 ? i + 1 : i, yd = y > 0 ? i - TW : i, yu = y < TH - 1 ? i + TW : i;\n    data[o] = a[i]; data[o + 1] = (soft[xr] - soft[xl]) * inv; data[o + 2] = (soft[yu] - soft[yd]) * inv;\n  }\n  return { data, half: (total * k) / 2 / UNIT, tall: (asc * k) / UNIT, edges, spans };\n}\n\n// No WebGL: the same word set in type, each letter tinted like its glass, with its colour laid out on the floor in front of it.\nfunction Still() {\n  const chars = [...brand.word].slice(0, MAXL);\n  const row = (shadow: boolean) => chars.map((ch, i) => (\n    <span key={i} className={shadow ? \"\" : \"bg-clip-text text-transparent\"} style={shadow ? { color: TINT[i % TINT.length] } : { backgroundImage: `linear-gradient(172deg, #ffffff -30%, ${TINT[i % TINT.length]} 26%, ${TINT[i % TINT.length]} 62%, #1a1511 190%)`, WebkitBackgroundClip: \"text\" }}>{ch}</span>\n  ));\n  return (\n    <div aria-hidden=\"true\" className=\"absolute inset-x-0 bottom-[150px] flex select-none justify-center lg:bottom-[190px]\">\n      <div className=\"relative whitespace-nowrap text-[28vw] font-extrabold leading-[0.72] tracking-[-0.01em] lg:text-[min(28vw,390px)]\">\n        <div className=\"absolute inset-0 opacity-60 blur-[2px] lg:blur-[3px]\" style={{ transformOrigin: \"50% 103.5%\", transform: \"scaleY(-0.42) skewX(-18deg)\", mixBlendMode: \"multiply\" }}>{row(true)}</div>\n        <div className=\"relative\" style={{ filter: \"drop-shadow(0 1px 0 rgba(255,255,255,0.8))\" }}>{row(false)}</div>\n      </div>\n    </div>\n  );\n}\n\nexport default function CastGlassWordmarkFooter() {\n  const stage = useRef<HTMLDivElement>(null);\n  const canvas = useRef<HTMLCanvasElement>(null);\n  const hit = useRef<HTMLDivElement>(null);\n  const [shown, setShown] = useState<\"wait\" | \"gl\" | \"still\">(\"wait\");\n  const [calm, setCalm] = useState(false);\n  const api = useRef<{ nudge: () => void } | null>(null);\n\n  useEffect(() => {\n    const box = stage.current, cv = canvas.current, pad = hit.current;\n    if (!box || !cv || !pad) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    setCalm(reduce);\n    const gl = cv.getContext(\"webgl2\", { antialias: false, alpha: false, powerPreference: \"high-performance\" }) as WebGL2RenderingContext | null;\n    if (!gl) { setShown(\"still\"); return; }\n    const canAcc = !!gl.getExtension(\"EXT_color_buffer_float\") || !!gl.getExtension(\"EXT_color_buffer_half_float\");\n    const info = gl.getExtension(\"WEBGL_debug_renderer_info\");\n    const renderer = info ? String(gl.getParameter(info.UNMASKED_RENDERER_WEBGL)) : \"\";\n    const software = /swiftshader|llvmpipe|software|basic render/i.test(renderer);\n    const still = reduce || software; // nothing plays by itself: draw, refine, then rest\n\n    const compile = (type: number, src: string) => {\n      const sh = gl.createShader(type);\n      if (!sh) return null;\n      gl.shaderSource(sh, src); gl.compileShader(sh);\n      return gl.getShaderParameter(sh, gl.COMPILE_STATUS) ? sh : null;\n    };\n    const link = (frag: string) => {\n      const v = compile(gl.VERTEX_SHADER, VERT), f = compile(gl.FRAGMENT_SHADER, frag);\n      const p = gl.createProgram();\n      if (!v || !f || !p) return null;\n      gl.attachShader(p, v); gl.attachShader(p, f); gl.bindAttribLocation(p, 0, \"aPos\"); gl.linkProgram(p);\n      return gl.getProgramParameter(p, gl.LINK_STATUS) ? p : null;\n    };\n    const scene = link(SCENE), post = canAcc ? link(POST) : null;\n    if (!scene || (canAcc && !post)) { setShown(\"still\"); return; }\n    const U = (p: WebGLProgram, n: string) => gl.getUniformLocation(p, n);\n    const su = Object.fromEntries([\"uRes\", \"uJit\", \"uSeed\", \"uDirect\", \"uCam\", \"uFoc\", \"uShift\", \"uFocus\", \"uSun\", \"uSdf\", \"uPlate\", \"uReach\", \"uWide\", \"uCol\", \"uTurn\", \"uMid\", \"uAbs\", \"uBusy\"].map((n) => [n, U(scene, n)]));\n    const pu = post ? Object.fromEntries([\"uAcc\", \"uRes\", \"uGrain\"].map((n) => [n, U(post, n)])) : {};\n\n    const quad = gl.createBuffer();\n    gl.bindBuffer(gl.ARRAY_BUFFER, quad);\n    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);\n    gl.enableVertexAttribArray(0); gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);\n\n    // the word, as a plate of distances\n    let word = bakeWord(brand.word);\n    const sdf = gl.createTexture();\n    const plate = () => {\n      gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, sdf);\n      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB16F, TW, TH, 0, gl.RGB, gl.FLOAT, word.data);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n    };\n    plate();\n    const count = Math.min(MAXL, [...brand.word].length);\n    const absorb = new Float32Array(MAXL * 3);\n    for (let i = 0; i < MAXL; i++) absorb.set(GLASS[i % GLASS.length], i * 3);\n    const colArr = new Float32Array(MAXL * 2).fill(1e9), turnArr = new Float32Array(MAXL), midArr = new Float32Array(MAXL).fill(1e9);\n\n    // The accumulation plate: every frame is one more exposure blended onto it.\n    const acc = canAcc ? gl.createTexture() : null;\n    const fbo = canAcc ? gl.createFramebuffer() : null;\n    let W = 0, H = 0, scale = 1, cssW = 1, cssH = 1;\n    const size = () => {\n      const r = box.getBoundingClientRect();\n      cssW = Math.max(1, r.width); cssH = Math.max(1, r.height);\n      const dpr = Math.min(software ? 1 : 1.75, window.devicePixelRatio || 1) * scale;\n      // never more than about one and a half million pixels of tracing\n      const k = Math.min(1, Math.sqrt(1.6e6 / (cssW * cssH * dpr * dpr)));\n      const w = Math.max(2, Math.round(cssW * dpr * k)), h = Math.max(2, Math.round(cssH * dpr * k));\n      if (w === W && h === H) return;\n      W = w; H = h; cv.width = W; cv.height = H;\n      if (acc && fbo) {\n        gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, acc);\n        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16F, W, H, 0, gl.RGBA, gl.HALF_FLOAT, null);\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        gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, acc, 0);\n        gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n      }\n      s.count = 0; s.fresh = true;\n    };\n\n    const s = {\n      a: new Float32Array(MAXL), v: new Float32Array(MAXL), rest: new Float32Array(MAXL), from: new Float32Array(MAXL), spinT: new Float32Array(MAXL).fill(-1),\n      due: [] as { at: number; i: number; v: number; turn: number }[],\n      px: 0, py: 0, sx: 0, sy: 0, over: false, count: 0, fresh: true, frame: 0, slow: 0,\n      visible: true, raf: 0, last: 0, t0: 0, now: 0, touched: false, demoAt: 0, first: true, alive: true,\n    };\n    const halton = (i: number, b: number) => { let f = 1, r = 0; while (i > 0) { f /= b; r += f * (i % b); i = Math.floor(i / b); } return r; };\n\n    // The camera is a view camera: it stands above the word looking level, and the lens is shifted down, so uprights stay upright.\n    const DIST = 12, EYE = 3.1;\n    const lens = () => {\n      const aspect = cssW / cssH, wide = cssW >= 1024;\n      const foc = Math.min(((wide ? 0.445 : 0.46) * aspect * DIST) / word.half, (0.4 * DIST) / word.tall);\n      const base = wide ? 0.735 : cssW >= 640 ? 0.77 : 0.8; // how far down the frame the word stands\n      return { foc, base, shift: 0.5 - base + (foc * EYE) / DIST, cx: s.sx * 0.14 };\n    };\n\n    const draw = (alpha: number, sample: number) => {\n      const { foc, shift, cx, base } = lens();\n      const jx = sample ? halton(sample, 2) - 0.5 : 0, jy = sample ? halton(sample, 3) - 0.5 : 0;\n      const la = halton(sample, 5) * Math.PI * 2, lr = sample ? Math.sqrt(halton(sample, 7)) * 0.03 : 0;\n      const t = (s.now - s.t0) / 1000;\n      const sa = SUN.turn + (still ? 0 : Math.sin(t * 0.21) * 0.13) + s.sx * 0.42, se = SUN.height - s.sy * 0.1;\n      gl.useProgram(scene);\n      gl.bindFramebuffer(gl.FRAMEBUFFER, canAcc ? fbo : null);\n      gl.viewport(0, 0, W, H);\n      if (canAcc && alpha < 1) { gl.enable(gl.BLEND); gl.blendColor(0, 0, 0, alpha); gl.blendFunc(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_ALPHA); } else gl.disable(gl.BLEND);\n      gl.uniform2f(su.uRes, W, H);\n      gl.uniform4f(su.uJit, canAcc ? jx : 0, canAcc ? jy : 0, canAcc ? Math.cos(la) * lr : 0, canAcc ? Math.sin(la) * lr : 0);\n      gl.uniform1f(su.uSeed, canAcc && sample ? (sample * 0.61803) % 1 || 0.5 : 0);\n      gl.uniform1f(su.uDirect, canAcc ? 0 : 1);\n      gl.uniform3f(su.uCam, cx, EYE, -DIST);\n      gl.uniform1f(su.uFoc, foc);\n      gl.uniform2f(su.uShift, 0, shift);\n      gl.uniform1f(su.uFocus, DIST);\n      gl.uniform3f(su.uSun, Math.sin(sa) * Math.cos(se), Math.sin(se), Math.cos(sa) * Math.cos(se));\n      gl.uniform4f(su.uPlate, TW / UNIT / 2, TH / UNIT, -(TH * (1 - BASE)) / UNIT, 0);\n      for (let i = 0; i < count; i++) { colArr[i * 2] = i ? word.edges[i - 1] : -1e9; colArr[i * 2 + 1] = i < count - 1 ? word.edges[i] : 1e9; }\n      let reach = 0;\n      for (let i = 0; i < count; i++) {\n        const th = s.a[i] - s.rest[i] === 0 && s.spinT[i] < 0 ? 0 : s.a[i] % (Math.PI * 2), hw = (word.spans[i][1] - word.spans[i][0]) / 2;\n        turnArr[i] = th; midArr[i] = (word.spans[i][0] + word.spans[i][1]) / 2;\n        reach = Math.max(reach, hw * Math.abs(Math.sin(th)) + DEPTH * Math.abs(Math.cos(th)) - DEPTH);\n      }\n      gl.uniform1f(su.uReach, 0.02 + reach);\n      gl.uniform1f(su.uBusy, reach > 0 ? 1 : 0);\n      // x: how fast the lit sweep widens with distance from the lens; y: where it ends in front of the word\n      gl.uniform2f(su.uWide, ((cssW / cssH) * 0.5 * 1.12) / foc, -DIST + (foc * EYE) / (1 - base + (foc * EYE) / DIST) - 1.3);\n      gl.uniform2fv(su.uCol, colArr); gl.uniform1fv(su.uTurn, turnArr); gl.uniform1fv(su.uMid, midArr); gl.uniform3fv(su.uAbs, absorb);\n      gl.uniform1i(su.uSdf, 0);\n      gl.drawArrays(gl.TRIANGLES, 0, 3);\n      if (canAcc && post) {\n        gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n        gl.disable(gl.BLEND);\n        gl.useProgram(post);\n        gl.uniform1i(pu.uAcc, 1); gl.uniform2f(pu.uRes, W, H);\n        gl.uniform1f(pu.uGrain, still ? 1 : s.frame % 64);\n        gl.drawArrays(gl.TRIANGLES, 0, 3);\n      }\n    };\n\n    // Which letter stands under a point of the frame, or -1.\n    const letterAt = (clientX: number, clientY: number) => {\n      const r = box.getBoundingClientRect(), { foc, shift, cx } = lens();\n      const ux = (clientX - r.left - cssW / 2) / cssH, uy = (cssH / 2 - (clientY - r.top)) / cssH - shift;\n      const t = (DIST - DEPTH) / foc, x = cx + ux * t, y = EYE + uy * t;\n      if (y < 0 || y > word.tall + 0.1) return { i: -1, side: 1 };\n      const i = word.spans.findIndex((sp) => x > sp[0] - 0.03 && x < sp[1] + 0.03);\n      return { i, side: i >= 0 && x < (word.spans[i][0] + word.spans[i][1]) / 2 ? -1 : 1 };\n    };\n\n    // Every letter stands on a pivot. A push sends it round once: it winds up a little, swings through, leans past the mark and settles.\n    // The letters either side feel it a moment later and shiver.\n    const back = (x: number) => { const c = 1.15; return x < 0.5 ? (Math.pow(2 * x, 2) * ((c + 1) * 2 * x - c)) / 2 : (Math.pow(2 * x - 2, 2) * ((c + 1) * (x * 2 - 2) + c) + 2) / 2; };\n    const spin = (i: number, turn: number) => {\n      if (reduce || i < 0 || i >= count || s.spinT[i] >= 0) return;\n      s.spinT[i] = 0; s.from[i] = s.rest[i]; s.rest[i] += Math.PI * 2 * turn;\n      wake();\n    };\n    const push = (from: number, turn: number) => {\n      for (let i = 0; i < count; i++) { const n = Math.abs(i - from); if (n) s.due.push({ at: s.now + 180 + n * 110, i, v: turn * 2.6 * Math.pow(0.55, n - 1) * (n % 2 ? -1 : 1), turn: 0 }); }\n      spin(from, turn);\n    };\n    const wave = () => { for (let i = 0; i < count; i++) s.due.push({ at: s.now + i * 170, i, v: 0, turn: 1 }); wake(); };\n    api.current = { nudge: () => { s.touched = true; wave(); } };\n\n    const frame = (now: number) => {\n      s.raf = 0;\n      if (!s.visible || !s.alive) return;\n      const dtRaw = s.last ? (now - s.last) / 1000 : 0.016;\n      const dt = Math.min(0.033, dtRaw);\n      s.last = now; s.now = now; s.frame++;\n      // it opens finished and holds; then, until someone touches it, a push runs along the word every few seconds\n      if (!s.t0) { s.t0 = now; s.demoAt = now + 4300; }\n      if (!still && !s.touched && now > s.demoAt) { wave(); s.demoAt = now + 9500; }\n\n      let moving = false, busy = false;\n      if (!reduce) {\n        for (let n = s.due.length - 1; n >= 0; n--) if (s.due[n].at <= now) { const e = s.due[n]; s.due.splice(n, 1); if (e.turn) spin(e.i, e.turn); else if (s.spinT[e.i] < 0) s.v[e.i] += e.v; }\n        if (s.due.length) moving = true;\n        for (let i = 0; i < count; i++) {\n          let want = s.rest[i];\n          const turning = s.spinT[i] >= 0;\n          if (turning) {\n            s.spinT[i] += dt / 1.85;\n            if (s.spinT[i] >= 1) s.spinT[i] = -1; else want = s.from[i] + (s.rest[i] - s.from[i]) * back(s.spinT[i]);\n          }\n          const stiff = turning ? 170 : 46, damp = turning ? 24 : 5.2;\n          for (let k = 0; k < 3; k++) { s.v[i] += (stiff * (want - s.a[i]) - damp * s.v[i]) * (dt / 3); s.a[i] += s.v[i] * (dt / 3); }\n          if (turning || Math.abs(s.v[i]) > 0.004 || Math.abs(want - s.a[i]) > 0.0006) { moving = true; busy = true; }\n          else { s.a[i] = want; s.v[i] = 0; }\n        }\n      }\n      if (!still) {\n        s.sx += (s.px - s.sx) * (1 - Math.exp(-dt * 2.6)); s.sy += (s.py - s.sy) * (1 - Math.exp(-dt * 2.6));\n        moving = true;\n      }\n      const fast = busy || Math.abs(s.px - s.sx) + Math.abs(s.py - s.sy) > 0.02;\n      if (s.fresh || !canAcc) { draw(1, 0); s.fresh = false; s.count = 1; }\n      else if (moving) { draw(fast ? 0.5 : still ? 0.5 : 0.12, 1 + (s.frame % 64)); s.count = still ? 1 : 6; }\n      else if (s.count < 48) { s.count++; draw(1 / s.count, s.count); }\n      if (s.first) { s.first = false; setShown(\"gl\"); }\n\n      // measured, not guessed: if frames run long for a while, give up some resolution\n      if (!still && dtRaw > 0.026) s.slow++; else s.slow = Math.max(0, s.slow - 2);\n      if (s.slow > 45 && scale > 0.45) { scale *= 0.82; s.slow = 0; size(); }\n\n      if (moving || s.count < 48) s.raf = requestAnimationFrame(frame);\n    };\n    const wake = () => { if (!s.raf && s.visible && s.alive) { s.last = 0; s.raf = requestAnimationFrame(frame); } };\n\n    size();\n    const ro = new ResizeObserver(() => { size(); wake(); });\n    ro.observe(box);\n    const io = new IntersectionObserver(([e]) => { s.visible = e.isIntersecting && !document.hidden; if (s.visible) wake(); }, { threshold: 0.05 });\n    io.observe(box);\n    const vis = () => { s.visible = !document.hidden; if (s.visible) wake(); };\n    document.addEventListener(\"visibilitychange\", vis);\n    // if a web font arrives after the first frame, cast the word again in it\n    const fontIn = () => !!document.fonts?.check(`${WEIGHT} 40px ${FONT.split(\",\")[0]}`);\n    const hadFont = fontIn();\n    document.fonts?.ready.then(() => {\n      if (!s.alive || fontIn() === hadFont) return;\n      word = bakeWord(brand.word); plate();\n      s.count = 0; s.fresh = true; wake();\n    });\n\n    const move = (e: PointerEvent) => {\n      const r = box.getBoundingClientRect();\n      if (e.pointerType !== \"touch\") { s.px = ((e.clientX - r.left) / r.width) * 2 - 1; s.py = ((e.clientY - r.top) / r.height) * 2 - 1; }\n      const on = !reduce && letterAt(e.clientX, e.clientY).i >= 0;\n      if (on !== s.over) { s.over = on; pad.style.cursor = on ? \"pointer\" : \"\"; }\n      if (!still) wake();\n    };\n    const tap = (e: PointerEvent) => {\n      const at = letterAt(e.clientX, e.clientY);\n      if (at.i < 0) return;\n      s.touched = true;\n      // the side that is pressed goes away from you\n      push(at.i, -at.side);\n    };\n    const leave = () => { s.px = 0; s.py = 0; };\n    box.addEventListener(\"pointermove\", move);\n    pad.addEventListener(\"pointerdown\", tap);\n    box.addEventListener(\"pointerleave\", leave);\n    const lost = (e: Event) => { e.preventDefault(); setShown(\"still\"); };\n    cv.addEventListener(\"webglcontextlost\", lost);\n    wake();\n\n    return () => {\n      s.alive = false;\n      cancelAnimationFrame(s.raf); ro.disconnect(); io.disconnect();\n      document.removeEventListener(\"visibilitychange\", vis);\n      box.removeEventListener(\"pointermove\", move); pad.removeEventListener(\"pointerdown\", tap);\n      box.removeEventListener(\"pointerleave\", leave); cv.removeEventListener(\"webglcontextlost\", lost);\n      api.current = null;\n    };\n  }, []);\n\n  const ring = \"outline-none focus-visible:ring-2 focus-visible:ring-[#1a1511] focus-visible:ring-offset-2 focus-visible:ring-offset-[#efece6]\";\n  return (\n    <footer className=\"relative isolate overflow-hidden bg-[#efece6] text-[#1a1511]\" style={{ fontFamily: FONT }}>\n      <style>{`\n        @keyframes cast-glass-wordmark-footer-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }\n        .cast-glass-wordmark-footer-rise { animation: cast-glass-wordmark-footer-rise 700ms cubic-bezier(0.2, 0.9, 0.2, 1) both; }\n        .cast-glass-wordmark-footer-link { background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1.5px; transition: background-size 320ms cubic-bezier(0.2, 0.9, 0.2, 1); }\n        .cast-glass-wordmark-footer-link:hover, .cast-glass-wordmark-footer-link:focus-visible { background-size: 100% 1.5px; }\n        @media (prefers-reduced-motion: reduce) { .cast-glass-wordmark-footer-rise { animation: none; } .cast-glass-wordmark-footer-link { transition: none; } }\n      `}</style>\n      <div ref={stage} className=\"relative h-[900px] w-full sm:h-[860px] lg:h-[840px]\" style={{ background: \"linear-gradient(180deg, #ebe9e6 0%, #efede9 46%, #f4f1ea 74%, #f1ede5 100%)\" }}>\n        {shown === \"still\" && <Still />}\n        <canvas ref={canvas} aria-hidden=\"true\" className={`absolute inset-0 h-full w-full transition-opacity duration-700 motion-reduce:transition-none ${shown === \"gl\" ? \"opacity-100\" : \"opacity-0\"}`} />\n        <div ref={hit} aria-hidden=\"true\" className=\"absolute inset-0 select-none\" style={{ touchAction: \"pan-y\" }} />\n\n        <div className=\"pointer-events-none absolute inset-0 mx-auto flex max-w-[1440px] flex-col justify-between px-6 pb-6 pt-9 sm:px-10 lg:px-16 lg:pb-8 lg:pt-14\">\n          <div className=\"cast-glass-wordmark-footer-rise grid gap-x-10 gap-y-9 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.5fr)]\">\n            <div>\n              <p className=\"text-[11px] font-semibold uppercase tracking-[0.3em] text-[#4a423a]\">{brand.name}</p>\n              <p className=\"mt-4 max-w-[17ch] text-[30px] italic leading-[1.06] tracking-[-0.015em] sm:text-[34px] lg:mt-5 lg:text-[44px]\" style={{ fontFamily: SERIF }}>{brand.line}</p>\n              <p className=\"mt-5 hidden text-[13px] leading-[1.55] text-[#4a423a] lg:block\">{brand.place[0]}<br />{brand.place[1]}</p>\n            </div>\n            <nav aria-label=\"Footer\" className=\"pointer-events-auto grid grid-cols-2 gap-x-6 gap-y-8 sm:grid-cols-4\">\n              {columns.map((col) => (\n                <div key={col.title}>\n                  <h3 className=\"text-[11px] font-semibold uppercase tracking-[0.3em] text-[#4a423a]\">{col.title}</h3>\n                  <ul className=\"mt-3 lg:mt-5\">\n                    {col.links.map((l) => (\n                      <li key={l}><a href=\"#\" className={`cast-glass-wordmark-footer-link inline-flex h-10 items-center whitespace-nowrap text-[17px] font-medium tracking-[-0.015em] lg:h-[42px] lg:text-[20px] ${ring}`}>{l}</a></li>\n                    ))}\n                  </ul>\n                </div>\n              ))}\n            </nav>\n          </div>\n\n          <div className=\"flex flex-wrap items-center justify-between gap-x-8 gap-y-1 text-[12px] font-medium tracking-[0.02em] text-[#3a332c]\">\n            <p>{brand.legal}</p>\n            <div className=\"pointer-events-auto flex flex-wrap items-center gap-x-6\">\n              {shown === \"gl\" && !calm && (\n                <button type=\"button\" onClick={() => api.current?.nudge()} className={`hidden h-10 items-center gap-2 rounded-full text-[11px] font-semibold uppercase tracking-[0.24em] sm:inline-flex ${ring}`}>\n                  <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"M16.5 10a6.5 6.5 0 1 1-2.2-4.9M16.6 3.2v3.4h-3.4\" /></svg>\n                  Turn the letters\n                </button>\n              )}\n              <ul className=\"flex items-center gap-x-5\">\n                {small.map((l) => (\n                  <li key={l}><a href=\"#\" className={`cast-glass-wordmark-footer-link inline-flex h-10 items-center ${ring}`}>{l}</a></li>\n                ))}\n              </ul>\n            </div>\n          </div>\n        </div>\n      </div>\n    </footer>\n  );\n}\n"}]}
