{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"three-ray-marched-board-models-of-one-homepage-in-window-light-where-the-design-you-pick-trades-places-with-the-one-in-front-on-a-base-that-lights-blue","type":"registry:block","title":"Three Ray Marched Board Models of One Homepage in Window Light Where the Design You Pick Trades Places with the One in Front on a Base That Lights Blue","description":"Free React and WebGL design picker. Three board models of one homepage stand in window light, and the one you choose comes forward on a base that lights blue.","dependencies":["framer-motion"],"files":[{"path":"components/we-inc/three-ray-marched-board-models-of-one-homepage-in-window-light-where-the-design-you-pick-trades-places-with-the-one-in-front-on-a-base-that-lights-blue.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\n\n/** The made-up shop all three designs are for. Change the words here. */\nconst SHOP = {\n  name: \"Juniper Row\",\n  town: \"Margate\",\n  sentence: \"A florist in Margate that delivers by bike\",\n};\n/** The three designs: the name shown beside the stage, one line about each, and its photograph. */\nconst DESIGNS = [\n  {\n    name: \"Linen\",\n    line: \"Serif columns on cream card.\",\n    body: \"#EDE5D5\",\n    photo: {\n      src: \"https://images.pexels.com/photos/28868047/pexels-photo-28868047.jpeg?auto=compress&cs=tinysrgb&w=900\",\n      alt: \"Woman in a white shirt holding a tall bunch of white gypsophila against her chest\",\n      tone: \"#d9d2c6\",\n    },\n  },\n  {\n    name: \"Poppy\",\n    line: \"One loud line over full colour.\",\n    body: \"#C7463A\",\n    photo: {\n      src: \"https://images.pexels.com/photos/13023364/pexels-photo-13023364.jpeg?auto=compress&cs=tinysrgb&w=1200\",\n      alt: \"Single pale yellow strawflower in a small blue glass bottle against a red paper backdrop\",\n      tone: \"#c9483c\",\n    },\n  },\n  {\n    name: \"Midnight\",\n    line: \"A quiet arch on black.\",\n    body: \"#131416\",\n    photo: {\n      src: \"https://images.pexels.com/photos/31189167/pexels-photo-31189167.jpeg?auto=compress&cs=tinysrgb&w=900\",\n      alt: \"White and blush roses beside a white jug against a black cloth\",\n      tone: \"#0d0d0e\",\n    },\n  },\n];\n\nconst BLUE = \"#4F98FB\";\nconst INK = \"#0B0D12\";\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 MONO = 'ui-monospace, \"SF Mono\", Menlo, Consolas, monospace';\n/** Which design stands forward when the piece loads, counted from 0. */\nconst START = 1;\n/** Seconds the self-playing demo holds each design before picking the next. */\nconst HOLD = 4.4;\n/** Seconds one swap takes from the first move to the last. */\nconst TRAVEL = 1.15;\n/** Lowest and highest render scale (canvas pixels per CSS pixel). The loop steps down when frames run slow. */\nconst MIN_SCALE = 0.5001;\nconst MAX_SCALE = 1.5001;\n\n/* ---------- the three pages, drawn once on 2D canvases and used as the print on each model ---------- */\n\nconst PW = 1200;\nconst PH = 1600;\n/** Parts of each page that stand proud of the board: place and size in page pixels, corner radii (top left, top right, bottom right, bottom left), height in scene units, and gloss from 0 to 1. */\ntype Raised = { x: number; y: number; w: number; h: number; r: [number, number, number, number]; lift: number; gloss: number };\nconst all = (r: number): [number, number, number, number] => [r, r, r, r];\nconst LINEN = {\n  photo: { x: 652, y: 214, w: 468, h: 900, r: all(5), lift: 0.05, gloss: 0.92 } as Raised,\n  cta: { x: 78, y: 1012, w: 372, h: 98, r: all(49), lift: 0.03, gloss: 0.7 } as Raised,\n};\nconst POPPY = {\n  nav: { x: 60, y: 60, w: 1080, h: 112, r: all(56), lift: 0.032, gloss: 0.6 } as Raised,\n  sticker: { x: 84, y: 300, w: 232, h: 232, r: all(116), lift: 0.022, gloss: 0.35 } as Raised,\n  cta: { x: 70, y: 1376, w: 448, h: 118, r: all(59), lift: 0.04, gloss: 0.75 } as Raised,\n};\nconst MIDNIGHT = {\n  arch: { x: 330, y: 186, w: 540, h: 770, r: [270, 270, 6, 6], lift: 0.055, gloss: 0.95 } as Raised,\n  cta: { x: 410, y: 1332, w: 380, h: 96, r: all(48), lift: 0.03, gloss: 0.7 } as Raised,\n};\nconst RAISED: Raised[][] = [Object.values(LINEN), Object.values(POPPY), Object.values(MIDNIGHT)];\n\ntype Ctx = CanvasRenderingContext2D;\nconst setFont = (c: Ctx, style: string, size: number, family: string, track = 0) => {\n  c.font = `${style} ${size}px ${family}`;\n  (c as unknown as { letterSpacing: string }).letterSpacing = `${(track * size).toFixed(2)}px`;\n};\nfunction wrap(c: Ctx, text: string, maxW: number): string[] {\n  const out: string[] = [];\n  let line = \"\";\n  for (const word of text.split(\" \")) {\n    const next = line ? line + \" \" + word : word;\n    if (line && c.measureText(next).width > maxW) {\n      out.push(line);\n      line = word;\n    } else line = next;\n  }\n  out.push(line);\n  return out;\n}\nfunction shape(c: Ctx, x: number, y: number, w: number, h: number, r: [number, number, number, number]) {\n  c.beginPath();\n  c.moveTo(x + r[0], y);\n  c.arcTo(x + w, y, x + w, y + h, r[1]);\n  c.arcTo(x + w, y + h, x, y + h, r[2]);\n  c.arcTo(x, y + h, x, y, r[3]);\n  c.arcTo(x, y, x + w, y, r[0]);\n  c.closePath();\n}\nconst rect = (c: Ctx, k: Raised) => shape(c, k.x, k.y, k.w, k.h, k.r);\n/** Fill a shape with the photograph: fx and fy say which point of the picture sits in the middle, zoom enlarges it. */\nfunction photoIn(c: Ctx, img: HTMLImageElement | null, tone: string, x: number, y: number, w: number, h: number, fx = 0.5, fy = 0.5, zoom = 1) {\n  c.fillStyle = tone;\n  c.fillRect(x, y, w, h);\n  if (!img || !img.naturalWidth) return;\n  const s = Math.max(w / img.naturalWidth, h / img.naturalHeight) * zoom;\n  const dw = img.naturalWidth * s;\n  const dh = img.naturalHeight * s;\n  const dx = Math.min(0, Math.max(w - dw, w / 2 - fx * dw));\n  const dy = Math.min(0, Math.max(h - dh, h / 2 - fy * dh));\n  c.drawImage(img, x + dx, y + dy, dw, dh);\n}\nfunction arrow(c: Ctx, x: number, y: number, s: number, colour: string) {\n  c.strokeStyle = colour;\n  c.lineWidth = s * 0.14;\n  c.lineCap = \"round\";\n  c.lineJoin = \"round\";\n  c.beginPath();\n  c.moveTo(x, y);\n  c.lineTo(x + s, y);\n  c.moveTo(x + s * 0.58, y - s * 0.42);\n  c.lineTo(x + s, y);\n  c.lineTo(x + s * 0.58, y + s * 0.42);\n  c.stroke();\n}\n\n/** Linen: cream card, a serif headline in a left column, a tall photograph on the right, three numbered notes below. */\nfunction drawLinen(c: Ctx, img: HTMLImageElement | null) {\n  const ink = \"#1D1914\";\n  c.fillStyle = DESIGNS[0].body;\n  c.fillRect(0, 0, PW, PH);\n  c.textBaseline = \"alphabetic\";\n  c.fillStyle = ink;\n  setFont(c, \"italic 500\", 50, SERIF, -0.01);\n  c.fillText(SHOP.name, 78, 124);\n  setFont(c, \"500\", 21, SERIF, 0.2);\n  let x = 1122;\n  for (const item of [\"JOURNAL\", \"WEDDINGS\", \"BUNCHES\"]) {\n    x -= c.measureText(item).width;\n    c.fillText(item, x, 118);\n    x -= 44;\n  }\n  c.fillStyle = \"rgba(29,25,20,0.3)\";\n  c.fillRect(78, 160, 1042, 2);\n  c.save();\n  rect(c, LINEN.photo);\n  c.clip();\n  photoIn(c, img, DESIGNS[0].photo.tone, LINEN.photo.x, LINEN.photo.y, LINEN.photo.w, LINEN.photo.h, 0.46, 0.4, 1.04);\n  c.restore();\n  c.fillStyle = ink;\n  const lines: [string, string][] = [[\"400\", \"Flowers,\"], [\"400\", \"cut this\"], [\"italic 400\", \"morning.\"]];\n  lines.forEach(([style, text], i) => {\n    setFont(c, style, 146, SERIF, -0.028);\n    c.fillText(text, 70, 404 + i * 140);\n  });\n  c.fillStyle = \"#4b4337\";\n  setFont(c, \"400\", 31, SERIF, 0);\n  wrap(c, \"Seasonal bunches from growers near the coast, tied by hand and out of the door on a bicycle by noon.\", 500).forEach((l, i) => c.fillText(l, 80, 806 + i * 45));\n  c.fillStyle = ink;\n  rect(c, LINEN.cta);\n  c.fill();\n  c.fillStyle = DESIGNS[0].body;\n  setFont(c, \"600\", 32, FONT, -0.01);\n  c.fillText(\"Order a bunch\", 122, 1072);\n  arrow(c, 122 + c.measureText(\"Order a bunch\").width + 22, 1061, 30, DESIGNS[0].body);\n  c.fillStyle = \"#6a6052\";\n  setFont(c, \"italic 400\", 23, SERIF, 0);\n  c.fillText(\"Gypsophila, tied this morning\", LINEN.photo.x, 1160);\n  c.fillStyle = \"rgba(29,25,20,0.3)\";\n  c.fillRect(78, 1250, 1042, 2);\n  const notes: [string, string, string][] = [[\"i.\", \"The weekly bunch\", \"Whatever is best that week\"], [\"ii.\", \"Wedding flowers\", \"From buttonholes to arches\"], [\"iii.\", \"Sunday workshops\", \"Six seats at the long table\"]];\n  notes.forEach(([n, t, s], i) => {\n    const nx = 80 + i * 352;\n    c.fillStyle = ink;\n    setFont(c, \"italic 400\", 60, SERIF, 0);\n    c.fillText(n, nx, 1348);\n    setFont(c, \"500\", 33, SERIF, -0.01);\n    c.fillText(t, nx, 1418);\n    c.fillStyle = \"#6a6052\";\n    setFont(c, \"400\", 23, SERIF, 0);\n    c.fillText(s, nx, 1458);\n  });\n  c.fillStyle = \"#6a6052\";\n  setFont(c, \"500\", 19, SERIF, 0.22);\n  c.fillText(`${SHOP.name.toUpperCase()}, ${SHOP.town.toUpperCase()}`, 80, 1524);\n}\n\n/** Poppy: the photograph over the whole board, a white menu pill, a paper sticker and one very large line. */\nfunction drawPoppy(c: Ctx, img: HTMLImageElement | null) {\n  const dark = \"#2B0C08\";\n  photoIn(c, img, DESIGNS[1].photo.tone, 0, 0, PW, PH, 0.37, 0.56, 1.36);\n  if (!img || !img.naturalWidth) {\n    c.fillStyle = DESIGNS[1].body;\n    c.fillRect(0, 0, PW, PH);\n  }\n  c.textBaseline = \"alphabetic\";\n  c.fillStyle = \"#fff\";\n  rect(c, POPPY.nav);\n  c.fill();\n  c.fillStyle = dark;\n  setFont(c, \"800\", 36, FONT, -0.01);\n  c.fillText(SHOP.name.toUpperCase(), 112, 129);\n  setFont(c, \"600\", 27, FONT, 0);\n  let x = 1090;\n  for (const item of [\"Find us\", \"Weddings\", \"Bunches\"]) {\n    x -= c.measureText(item).width;\n    c.fillText(item, x, 126);\n    x -= 46;\n  }\n  // sticker\n  const s = POPPY.sticker;\n  c.fillStyle = \"#F4D548\";\n  rect(c, s);\n  c.fill();\n  c.save();\n  c.translate(s.x + s.w / 2, s.y + s.h / 2);\n  c.rotate(-0.2);\n  c.fillStyle = dark;\n  c.textAlign = \"center\";\n  setFont(c, \"800\", 40, FONT, -0.02);\n  c.fillText(\"SAME DAY\", 0, -6);\n  setFont(c, \"italic 500\", 38, SERIF, 0);\n  c.fillText(\"by bicycle\", 0, 38);\n  c.restore();\n  c.textAlign = \"left\";\n  // the line\n  c.fillStyle = \"#fff\";\n  const words = [\"Send\", \"colour.\"];\n  let size = 300;\n  for (; size > 120; size -= 4) {\n    setFont(c, \"800\", size, FONT, -0.055);\n    if (Math.max(...words.map((w) => c.measureText(w).width)) < 1010) break;\n  }\n  words.forEach((w, i) => c.fillText(w, 58, 1082 + i * size * 0.86));\n  rect(c, POPPY.cta);\n  c.fill();\n  c.fillStyle = dark;\n  setFont(c, \"700\", 40, FONT, -0.015);\n  c.fillText(\"Send a bunch\", 122, 1449);\n  arrow(c, 122 + c.measureText(\"Send a bunch\").width + 26, 1435, 36, dark);\n  c.fillStyle = \"#fff\";\n  setFont(c, \"700\", 23, FONT, 0.16);\n  const foot = `${SHOP.town.toUpperCase()} / OPEN TILL SIX`;\n  c.fillText(foot, 1140 - c.measureText(foot).width, 1446);\n}\n\n/** Midnight: black board, the photograph in an arch, a light centred line and small spaced capitals. */\nfunction drawMidnight(c: Ctx, img: HTMLImageElement | null) {\n  const cream = \"#EDE6D8\";\n  c.fillStyle = DESIGNS[2].body;\n  c.fillRect(0, 0, PW, PH);\n  c.textBaseline = \"alphabetic\";\n  c.textAlign = \"center\";\n  c.fillStyle = cream;\n  setFont(c, \"600\", 23, MONO, 0.42);\n  const nameW = c.measureText(SHOP.name.toUpperCase()).width;\n  c.fillText(SHOP.name.toUpperCase(), 600 + 5, 116);\n  c.fillStyle = \"rgba(237,230,216,0.34)\";\n  c.fillRect(78, 107, 600 - nameW / 2 - 110, 1.5);\n  c.fillRect(600 + nameW / 2 + 32, 107, 600 - nameW / 2 - 110, 1.5);\n  const a = MIDNIGHT.arch;\n  c.strokeStyle = \"rgba(237,230,216,0.4)\";\n  c.lineWidth = 1.5;\n  shape(c, a.x - 18, a.y - 18, a.w + 36, a.h + 36, [288, 288, 10, 10]);\n  c.stroke();\n  c.save();\n  rect(c, a);\n  c.clip();\n  photoIn(c, img, DESIGNS[2].photo.tone, a.x, a.y, a.w, a.h, 0.56, 0.6, 1.02);\n  c.restore();\n  c.fillStyle = cream;\n  setFont(c, \"300\", 112, FONT, -0.04);\n  c.fillText(\"Flowers for\", 600, 1104);\n  c.fillText(\"the evening.\", 600, 1216);\n  c.fillStyle = \"rgba(237,230,216,0.62)\";\n  setFont(c, \"500\", 20, MONO, 0.3);\n  c.fillText(`CUT TODAY  /  TIED BY HAND  /  ${SHOP.town.toUpperCase()}`, 603, 1284);\n  c.fillStyle = cream;\n  rect(c, MIDNIGHT.cta);\n  c.fill();\n  c.fillStyle = \"#131416\";\n  setFont(c, \"600\", 31, FONT, -0.01);\n  c.fillText(\"Reserve a bunch\", 600, 1391);\n  c.fillStyle = \"rgba(237,230,216,0.34)\";\n  c.fillRect(78, 1462, 1044, 1.5);\n  c.fillStyle = \"rgba(237,230,216,0.62)\";\n  setFont(c, \"500\", 19, MONO, 0.26);\n  c.textAlign = \"left\";\n  c.fillText(\"01 BUNCHES\", 78, 1512);\n  c.textAlign = \"center\";\n  c.fillText(\"02 WEDDINGS\", 602, 1512);\n  c.textAlign = \"right\";\n  c.fillText(\"03 JOURNAL\", 1122, 1512);\n  c.textAlign = \"left\";\n}\nconst PAINT = [drawLinen, drawPoppy, drawMidnight];\n\n/* ---------- shaders ---------- */\n\nconst f = (n: number) => n.toFixed(5);\nconst lin = (hex: string) => `vec3(${[1, 3, 5].map((i) => f(Math.pow(parseInt(hex.slice(i, i + 2), 16) / 255, 2.2))).join(\", \")})`;\n/** Half the thickness of a board, in scene units. A board is 1.5 wide and 2 tall. */\nconst TH = 0.062;\n// The raised parts, written out as distance functions so the picture and the relief can never drift apart.\nconst RELIEF = RAISED.map((list, i) => {\n  const at = (k: Raised) => `c.xy - vec2(${f((k.x + k.w / 2 - PW / 2) / 800)}, ${f((PH / 2 - (k.y + k.h / 2)) / 800)}), vec2(${f(k.w / 1600)}, ${f(k.h / 1600)}), vec4(${[k.r[1], k.r[2], k.r[0], k.r[3]].map((r) => f(r / 800)).join(\", \")})`;\n  const d = list.map((k) => `d = min(d, ext(rb4(${at(k)}), c.z - ${f((TH + k.lift) / 2)}, ${f((TH + k.lift) / 2)}, 0.008));`).join(\"\\n  \");\n  const g = list.map((k) => `e = rb4(${at(k)}); if (e < b) { b = e; g = ${f(k.gloss)}; }`).join(\"\\n  \");\n  return `float rel${i}(vec3 c){ float d = 1e5;\\n  ${d}\\n  return d; }\\nfloat gls${i}(vec3 c){ float b = 1e5, g = 0.0, e;\\n  ${g}\\n  return g; }`;\n}).join(\"\\n\");\n\nconst VERT = `#version 300 es\nin vec2 a; out vec2 vUv;\nvoid main(){ vUv = a * 0.5 + 0.5; gl_Position = vec4(a, 0.0, 1.0); }`;\n\nconst SCENE = `#version 300 es\nprecision highp float;\nin vec2 vUv; out vec4 o;\nuniform vec2 uRes;\nuniform vec3 uCam, uTarget;\nuniform float uFov;\nuniform vec4 uA[3]; // each model: x, z, extra lean, turn\nuniform vec4 uB[3]; // each model: how brightly its base is lit, then the distance the lens is focused at\nuniform sampler2D uT0, uT1, uT2;\n\nconst vec3 L = vec3(-0.5499, 0.6199, 0.5599);\nconst vec3 SUNC = vec3(1.0, 0.945, 0.85);\nconst float SUNI = 2.35;\nconst vec3 FLOORC = vec3(0.87, 0.86, 0.835);\nconst vec3 BLUE = vec3(0.078, 0.314, 0.965);\nconst vec3 BLUEE = vec3(0.07, 0.34, 3.0);\nconst vec3 OPAL = vec3(0.75, 0.765, 0.79);\nconst float WZ = -3.3, RC = 1.15, TH = ${f(TH)}, SH = 0.155, LEAN = 0.105, ZF = 26.0;\nconst vec3 BODY[3] = vec3[3](${DESIGNS.map((d) => lin(d.body)).join(\", \")});\nconst float FACEG[3] = float[3](0.05, 0.5, 0.72);\nconst float EDGEG[3] = float[3](0.3, 0.55, 0.6);\n\nfloat gCy[3]; float gSy[3]; float gCp[3]; float gSp[3];\nfloat gPix, gDist;\n\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), 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); }\nvec3 tone(vec3 x){ vec3 c = 1.0 - exp(-max(x, 0.0) * 0.84); c = mix(c, c * c * (3.0 - 2.0 * c), 0.38); return pow(c, vec3(1.0 / 2.2)); }\n\nfloat rb2(vec2 p, vec2 h, float r){ vec2 d = abs(p) - h + r; return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0) - r; }\nfloat rb4(vec2 p, vec2 b, vec4 r){ r.xy = p.x > 0.0 ? r.xy : r.zw; r.x = p.y > 0.0 ? r.x : r.y; vec2 q = abs(p) - b + r.x; return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x; }\nfloat ext(float d2, float y, float h, float bev){ vec2 w = vec2(d2, abs(y) - h) + bev; return min(max(w.x, w.y), 0.0) + length(max(w, 0.0)) - bev; }\n${RELIEF}\n\nvec3 toSled(vec3 p, int i){ p -= vec3(uA[i].x, 0.0, uA[i].y); p.xz = vec2(gCy[i] * p.x - gSy[i] * p.z, gSy[i] * p.x + gCy[i] * p.z); return p; }\nvec3 toBoard(vec3 q, int i){ q.y -= SH; q.yz = vec2(gCp[i] * q.y - gSp[i] * q.z, gSp[i] * q.y + gCp[i] * q.z); q.y -= 1.0; return q; }\nvec3 dirBoard(vec3 d, int i){ d.xz = vec2(gCy[i] * d.x - gSy[i] * d.z, gSy[i] * d.x + gCy[i] * d.z); d.yz = vec2(gCp[i] * d.y - gSp[i] * d.z, gSp[i] * d.y + gCp[i] * d.z); return d; }\n\nfloat sdSled(vec3 q){\n  float e = q.y > 0.1 ? 0.022 : 0.003;\n  vec2 w = vec2(rb2(q.xz, vec2(0.6, 0.27), 0.05), abs(q.y - 0.1) - 0.1) + e;\n  return min(max(w.x, w.y), 0.0) + length(max(w, 0.0)) - e;\n}\nfloat sdBoard(vec3 c, int i){\n  float d = ext(rb2(c.xy, vec2(0.75, 1.0), 0.035), c.z, TH, 0.011);\n  if (d > 0.2) return d - 0.07;\n  float r = i == 0 ? rel0(c) : i == 1 ? rel1(c) : rel2(c);\n  return min(d, r);\n}\nvec2 map(vec3 p){\n  vec2 r = vec2(1e5, 0.0);\n  for (int i = 0; i < 3; i++){\n    vec3 q = toSled(p, i);\n    float bd = length(q - vec3(0.0, 1.1, -0.1)) - 1.5;\n    if (bd > 0.3){ if (bd < r.x) r = vec2(bd, 0.0); continue; }\n    float d = sdSled(q); if (d < r.x) r = vec2(d, 4.0 + float(i));\n    d = sdBoard(toBoard(q, i), i); if (d < r.x) r = vec2(d, 1.0 + float(i));\n  }\n  return r;\n}\nvec3 normal(vec3 p){\n  vec2 e = vec2(1.0, -1.0) * 0.0015;\n  return normalize(e.xyy * map(p + e.xyy).x + e.yyx * map(p + e.yyx).x + e.yxy * map(p + e.yxy).x + e.xxx * map(p + e.xxx).x);\n}\nvec2 march(vec3 ro, vec3 rd, int steps, float far){\n  float t = 0.0; vec2 h = vec2(0.0);\n  for (int i = 0; i < 120; i++){\n    if (i >= steps) break;\n    h = map(ro + rd * t);\n    if (h.x < 0.0004 * (1.0 + t * 0.3) || t > far) break;\n    t += h.x * 0.92;\n  }\n  return vec2(t, (t > far || h.x > 0.02) ? 0.0 : h.y);\n}\nfloat shadow(vec3 ro, vec3 rd){\n  float res = 1.0, t = 0.012;\n  for (int i = 0; i < 34; i++){\n    vec2 m = map(ro + rd * t); float h = m.x;\n    if (m.y > 0.5) res = min(res, 9.0 * h / t);\n    t += clamp(h, 0.007 + t * 0.02, 0.32);\n    if (res < 0.004 || t > 6.0) break;\n  }\n  res = clamp(res, 0.0, 1.0);\n  return res * res * (3.0 - 2.0 * res);\n}\nfloat occ(vec3 p, vec3 n){\n  float o = 0.0, s = 1.0;\n  for (int i = 0; i < 5; i++){\n    float h = 0.01 + 0.11 * float(i) / 4.0;\n    o += (h - map(p + n * h).x) * s;\n    s *= 0.78;\n  }\n  return clamp(1.0 - 3.0 * o, 0.0, 1.0);\n}\n\n// The window: one tall opening high on the left. Everything it lights sits inside a slanted beam with soft edges.\nfloat win(vec3 p){\n  float v = dot(p, vec3(0.435, 0.785, -0.442));\n  float s = 0.26;\n  return smoothstep(4.25 + s, 4.25 - s, v) * (0.5 + 0.5 * smoothstep(-3.5 - s * 2.0, -3.5 + s * 2.0, v));\n}\n// The bars of that window, as they fall on the wall behind the models.\nfloat panes(vec3 p){\n  float u = dot(p, vec3(0.713, 0.0, 0.701)), v = dot(p, vec3(0.435, 0.785, -0.442));\n  float bu = abs(fract(u / 2.35 + 0.27) - 0.5) * 2.35, bv = abs(fract(v / 1.8 + 0.12) - 0.5) * 1.8;\n  float lit = smoothstep(-0.07, 0.17, bu) * smoothstep(-0.06, 0.15, bv);\n  return mix(1.0, 0.4 + 0.6 * lit, smoothstep(-1.1, -2.3, p.z));\n}\nvec3 fillL(vec3 n){ return mix(vec3(0.7, 0.68, 0.65), vec3(0.74, 0.82, 0.97), 0.5 + 0.5 * n.y); }\n\nfloat rectL(vec3 ro, vec3 rd, vec3 c, vec3 n, vec2 hs, float soft){\n  float dn = dot(rd, n); if (dn > -1e-4) return 0.0;\n  float t = dot(c - ro, n) / dn; if (t < 0.0) return 0.0;\n  vec3 q = ro + rd * t - c; float s = soft * t + 0.02;\n  vec3 u = normalize(cross(vec3(0.0, 1.0, 0.0), n)), v = cross(n, u);\n  vec2 d = abs(vec2(dot(q, u), dot(q, v))) - hs;\n  return smoothstep(s, -s, d.x) * smoothstep(s, -s, d.y);\n}\n// The room the models mirror: a sunlit floor below, pale walls, a brighter ceiling and the window itself.\nvec3 env(vec3 ro, vec3 rd, float rough){\n  float soft = 0.04 + rough * 0.9;\n  vec3 c = mix(vec3(1.7, 1.67, 1.6), vec3(0.62, 0.64, 0.69), smoothstep(-0.55 - rough * 0.3, 0.12 + rough * 0.3, rd.y));\n  c = mix(c, vec3(1.45, 1.47, 1.52), smoothstep(0.2, 0.95, rd.y));\n  c = mix(c, vec3(1.6, 1.57, 1.5), 0.85 * smoothstep(0.15, 0.9, -rd.z) * smoothstep(-0.05, 0.25, rd.y));\n  c += SUNC * 7.5 * rectL(ro, rd, L * 9.0 + vec3(0.0, 0.6, 0.0), -L, vec2(2.4, 2.9), soft);\n  // a white flat behind the camera, up and to the right: it is what the gloss on the photographs picks up\n  c += vec3(0.94, 0.97, 1.0) * 3.4 * rectL(ro, rd, vec3(5.5, 4.4, 10.0), normalize(vec3(-5.5, -3.2, -10.0)), vec2(2.6, 2.2), soft + 0.06);\n  return c;\n}\n\nbool stageHit(vec3 ro, vec3 rd, out float t, out vec3 n){\n  t = 1e9; n = vec3(0.0, 1.0, 0.0);\n  if (rd.y < -1e-5){ float tf = -ro.y / rd.y; if (tf > 0.0 && ro.z + rd.z * tf > WZ + RC){ t = tf; return true; } }\n  if (rd.z < -1e-5){ float tw = (WZ - ro.z) / rd.z; if (tw > 0.0 && ro.y + rd.y * tw > RC){ t = tw; n = vec3(0.0, 0.0, 1.0); return true; } }\n  vec2 oc = vec2(ro.y - RC, ro.z - (WZ + RC)); vec2 d = vec2(rd.y, rd.z);\n  float a = dot(d, d), b = dot(oc, d), h = b * b - a * (dot(oc, oc) - RC * RC);\n  if (h > 0.0 && a > 1e-7){\n    float tc = (-b + sqrt(h)) / a; vec2 pc = oc + d * tc;\n    if (tc > 0.0 && pc.x < 0.02 && pc.y < 0.02){ t = tc; n = vec3(0.0, -pc.x / RC, -pc.y / RC); return true; }\n  }\n  return false;\n}\n// The sweep with nothing standing on it: used for what the floor and the models mirror.\nvec3 stageLite(vec3 ro, vec3 rd){\n  float t; vec3 n;\n  if (!stageHit(ro, rd, t, n)) return env(ro, rd, 0.3);\n  vec3 p = ro + rd * t;\n  return FLOORC * (SUNC * SUNI * max(dot(n, L), 0.0) * win(p) * panes(p) + fillL(n));\n}\n\nvec3 tex(int i, vec2 uv, float lod){\n  vec3 c = i == 0 ? textureLod(uT0, uv, lod).rgb : i == 1 ? textureLod(uT1, uv, lod).rgb : textureLod(uT2, uv, lod).rgb;\n  return pow(c, vec3(2.2));\n}\n\nvec3 shadeBoard(vec3 p, vec3 n, int i, vec3 rd, bool hq){\n  vec3 q = toSled(p, i); vec3 c = toBoard(q, i);\n  // the flat of the board and of everything raised on it shares one exact normal\n  vec3 nl = dirBoard(n, i);\n  if (abs(nl.z) > 0.96) n = sign(nl.z) * vec3(gSy[i] * gCp[i], gSp[i], gCy[i] * gCp[i]);\n  float sh = 1.0, ao = 1.0;\n  if (hq){ sh = shadow(p + n * 0.004, L); ao = occ(p, n); }\n  float ndl = max(dot(n, L), 0.0);\n  float nv = max(dot(n, -rd), 0.0);\n  float d2 = rb2(c.xy, vec2(0.75, 1.0), 0.035);\n  bool face = c.z > TH - 0.007 && d2 < -0.003;\n  vec3 alb; float g;\n  if (face){\n    vec2 uv = vec2(c.x / 1.5 + 0.5, 0.5 - c.y / 2.0);\n    float lod = clamp(log2(gDist * gPix * 800.0 / max(nv, 0.4)) - 0.45, 0.0, 8.0);\n    alb = tex(i, uv, lod);\n    g = FACEG[i];\n    if (c.z > TH + 0.006) g = i == 0 ? gls0(c) : i == 1 ? gls1(c) : gls2(c);\n    // card has a tooth; lacquer does not\n    alb *= 1.0 + (0.05 * (n2(c.xy * 210.0) - 0.5) + 0.04 * (n2(c.xy * 77.0 + 3.0) - 0.5)) * (1.0 - g);\n  } else { alb = BODY[i]; g = EDGEG[i]; }\n  vec3 r = reflect(rd, n);\n  float fr = 0.04 + 0.96 * pow(1.0 - nv, 5.0);\n  vec3 col = alb * (SUNC * SUNI * ndl * sh * win(p) + fillL(n) * ao);\n  col += fr * env(p, r, mix(0.6, 0.05, g)) * (0.3 + 0.7 * ao) * mix(0.3, 1.0, g);\n  // blue from the lit base creeps up the foot of the board\n  col += BLUE * uB[i].x * 0.55 * exp(-(c.y + 1.0) * 11.0) * (0.3 + 0.7 * alb) * step(0.0, nl.z);\n  return col;\n}\n\nvec3 shadeSled(vec3 p, vec3 n, int i, vec3 rd, bool hq){\n  // a block of opal acrylic with a lamp inside: milky when it is off, blue all through when it is on\n  vec3 q = toSled(p, i);\n  float g = uB[i].x;\n  vec3 nq = vec3(gCy[i] * n.x - gSy[i] * n.z, n.y, gSy[i] * n.x + gCy[i] * n.z);\n  if (abs(nq.y) > 0.96) n = vec3(0.0, sign(nq.y), 0.0);\n  else if (abs(nq.z) > 0.96) n = sign(nq.z) * vec3(gSy[i], 0.0, gCy[i]);\n  else if (abs(nq.x) > 0.96) n = sign(nq.x) * vec3(gCy[i], 0.0, -gSy[i]);\n  float sh = 1.0, ao = 1.0;\n  if (hq){ sh = shadow(p + n * 0.004, L); ao = occ(p, n); }\n  float nv = max(dot(n, -rd), 0.0);\n  float fr = 0.045 + 0.955 * pow(1.0 - nv, 5.0);\n  // light gets a little way into the plastic before it comes back, so the shading is softer than on card\n  float wrap = max(dot(n, L) * 0.6 + 0.4, 0.0);\n  vec3 col = OPAL * (SUNC * SUNI * mix(wrap, wrap * sh, 0.7) * win(p) * 0.8 + fillL(n) * (0.5 + 0.5 * ao));\n  // the slot the board stands in\n  float dB = abs(q.z + 0.012) - 0.078;\n  col *= 1.0 - 0.3 * smoothstep(0.05, 0.0, dB) * step(0.9, n.y);\n  // thin plastic at the edges lets more through, and the lamp bar shows as a soft grey band low in the block\n  float rim = smoothstep(0.07, 0.0, min(0.6 - abs(q.x), min(0.27 - abs(q.z), 0.2 - q.y)));\n  float bar = exp(-pow((q.y - 0.055) / 0.04, 2.0)) * smoothstep(0.56, 0.4, abs(q.x)) * (1.0 - abs(n.y));\n  col *= (1.0 + 0.1 * rim) * (1.0 - 0.1 * bar * (1.0 - g)) * (0.88 + 0.12 * smoothstep(0.0, 0.08, q.y));\n  // how much of the lamp reaches this bit of the surface: most straight above the bar, least at the ends\n  float dl = length(vec2(q.y - 0.05, q.z * 0.8));\n  float through = 1.0 / (1.0 + pow(dl / 0.2, 2.0)) * smoothstep(0.66, 0.3, abs(q.x));\n  vec3 lamp = BLUEE * (0.3 + 0.62 * through) + vec3(0.36, 0.55, 0.8) * (bar * 0.5 + through * through * 0.3);\n  col = mix(col, col * vec3(0.04, 0.18, 0.8), smoothstep(0.0, 0.5, g)) + lamp * g;\n  col += fr * env(p, reflect(rd, n), 0.04) * (0.4 + 0.6 * ao) * 1.35;\n  return col;\n}\nvec3 shade(vec3 p, vec3 n, float id, vec3 rd, bool hq){\n  return id < 3.5 ? shadeBoard(p, n, int(id - 0.5), rd, hq) : shadeSled(p, n, int(id - 3.5), rd, hq);\n}\n\nvec3 stageShade(vec3 p, vec3 n, vec3 rd, float t){\n  vec2 pq = p.xz + p.y * vec2(0.37, 0.81);\n  vec3 alb = FLOORC * (1.0 + 0.035 * (n2(pq * 3.1) - 0.5) + 0.02 * (n2(pq * 47.0) - 0.5));\n  float near = step(t, 24.0);\n  float sh = near > 0.5 ? shadow(p + n * 0.005, L) : 1.0;\n  float ao = 1.0; vec3 tint = vec3(0.0); float tw = 0.0; vec3 bleed = vec3(0.0);\n  float floorish = smoothstep(0.6, 0.98, n.y);\n  for (int i = 0; i < 3; i++){\n    vec3 q = toSled(p, i);\n    float dS = rb2(q.xz, vec2(0.6, 0.27), 0.07);\n    float lowS = exp(-p.y * 3.0);\n    ao *= 1.0 - 0.6 * lowS * smoothstep(0.4, -0.05, dS);\n    // the lit base washes the floor round it\n    float oS = max(dS, 0.0);\n    tw += uB[i].x * lowS * (0.75 * exp(-oS * 7.0) + 0.3 * exp(-oS * 2.0));\n    // colour thrown forward off each board\n    float fz = q.z - 0.06;\n    bleed += BODY[i] * step(0.0, fz) * exp(-fz * 1.5) * smoothstep(1.05 + fz * 0.8, 0.15, abs(q.x)) * lowS;\n  }\n  vec3 col = alb * (SUNC * SUNI * max(dot(n, L), 0.0) * sh * win(p) * panes(p) + fillL(n) * ao);\n  col += alb * bleed * 0.5 * (0.35 + 0.65 * sh);\n  if (floorish > 0.0 && near > 0.5){\n    // polished floor: a soft mirror, strongest at a glancing angle\n    vec3 nf = normalize(n + vec3((n2(p.xz * 1.3) - 0.5) * 0.006, 0.0, (n2(p.zx * 1.3 + 5.0) - 0.5) * 0.006));\n    vec3 rr = reflect(rd, nf);\n    float fr = (0.04 + 0.96 * pow(1.0 - max(dot(nf, -rd), 0.0), 5.0)) * 0.8 * floorish;\n    vec3 rp = p + n * 0.004;\n    vec3 rc = stageLite(rp, rr);\n    vec2 rh = march(rp, rr, 52, 9.0);\n    if (rh.y > 0.5){\n      vec3 hp = rp + rr * rh.x; float keep = gDist; gDist = t + rh.x;\n      rc = mix(rc, shade(hp, normal(hp), rh.y, rr, false), exp(-rh.x * 0.5));\n      gDist = keep;\n    }\n    col = mix(col, rc, fr);\n  }\n  col = col * mix(vec3(1.0), vec3(0.34, 0.6, 1.0), clamp(tw, 0.0, 1.0)) + BLUE * tw * 0.4;\n  return col;\n}\n\nvoid main(){\n  for (int i = 0; i < 3; i++){ gCy[i] = cos(uA[i].w); gSy[i] = sin(uA[i].w); gCp[i] = cos(LEAN + uA[i].z); gSp[i] = sin(LEAN + uA[i].z); }\n  gPix = 2.0 * tan(uFov * 0.5) / uRes.y;\n  vec2 uv = (gl_FragCoord.xy - 0.5 * uRes) / uRes.y;\n  vec3 fw = normalize(uTarget - uCam), rgt = normalize(cross(fw, vec3(0.0, 1.0, 0.0))), up = cross(rgt, fw);\n  vec3 rd = normalize(fw + (uv.x * rgt + uv.y * up) * 2.0 * tan(uFov * 0.5));\n  vec3 ro = uCam;\n  float ts; vec3 ns;\n  bool hs = stageHit(ro, rd, ts, ns);\n  float far = hs ? min(ts, 40.0) : 40.0;\n  vec2 hit = march(ro, rd, 110, far);\n  float t; vec3 col;\n  if (hit.y > 0.5 && hit.x < far){\n    t = hit.x; vec3 p = ro + rd * t; gDist = t;\n    col = shade(p, normal(p), hit.y, rd, true);\n  } else if (hs){\n    t = ts; gDist = t; col = stageShade(ro + rd * ts, ns, rd, ts);\n  } else { t = 40.0; col = env(ro, rd, 0.2); }\n  // the lit base blooms a little in the lens\n  for (int i = 0; i < 3; i++){\n    vec3 c = vec3(uA[i].x, 0.1, uA[i].y);\n    float tc = clamp(dot(c - ro, rd), 0.0, t);\n    vec3 dv = ro + rd * tc - c; dv.x *= 0.45;\n    col += BLUE * uB[i].x * 0.016 / (0.03 + dot(dv, dv));\n  }\n  o = vec4(tone(col), clamp(t / ZF, 0.0, 1.0));\n}`;\n\nconst POST = `#version 300 es\nprecision highp float;\nin vec2 vUv; out vec4 o;\nuniform sampler2D uSrc;\nuniform vec2 uRes;\nuniform float uFocus, uTime;\nfloat hash(vec2 p){ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }\nvoid main(){\n  vec4 c0 = texture(uSrc, vUv);\n  float z = c0.a * 26.0;\n  {\n    vec2 e = 1.0 / uRes; vec3 Lm = vec3(0.299, 0.587, 0.114);\n    float nw = dot(textureLod(uSrc, vUv + vec2(-e.x, -e.y), 0.0).rgb, Lm), ne = dot(textureLod(uSrc, vUv + vec2(e.x, -e.y), 0.0).rgb, Lm);\n    float sw = dot(textureLod(uSrc, vUv + vec2(-e.x, e.y), 0.0).rgb, Lm), se = dot(textureLod(uSrc, vUv + e, 0.0).rgb, Lm), lm = dot(c0.rgb, Lm);\n    float lo = min(lm, min(min(nw, ne), min(sw, se))), hi = max(lm, max(max(nw, ne), max(sw, se)));\n    vec2 dir = vec2(-((nw + ne) - (sw + se)), (nw + sw) - (ne + se));\n    float rcp = 1.0 / (min(abs(dir.x), abs(dir.y)) + max((nw + ne + sw + se) * 0.03125, 0.0078));\n    dir = clamp(dir * rcp, -8.0, 8.0) * e;\n    vec3 a = 0.5 * (textureLod(uSrc, vUv + dir * (1.0 / 3.0 - 0.5), 0.0).rgb + textureLod(uSrc, vUv + dir * (2.0 / 3.0 - 0.5), 0.0).rgb);\n    vec3 b = a * 0.5 + 0.25 * (textureLod(uSrc, vUv - dir * 0.5, 0.0).rgb + textureLod(uSrc, vUv + dir * 0.5, 0.0).rgb);\n    float lb = dot(b, Lm);\n    c0.rgb = (lb < lo || lb > hi) ? a : b;\n  }\n  float px = uRes.y / 720.0;\n  float coc = clamp(abs(z - uFocus) / max(z, 0.1) * (z < uFocus ? 8.0 : 5.0) - 0.5, 0.0, 6.0) * px;\n  vec3 acc = c0.rgb; float ws = 1.0;\n  float j = hash(gl_FragCoord.xy) * 6.283;\n  float lod = log2(max(coc / 3.0, 1.0));\n  for (int i = 0; i < 14; i++){\n    float fi = (float(i) + 0.5) / 14.0;\n    float a = float(i) * 2.39996 + j;\n    vec2 off = vec2(cos(a), sin(a)) * sqrt(fi) * coc / uRes;\n    vec4 s = textureLod(uSrc, vUv + off, lod);\n    acc += s.rgb; ws += 1.0;\n  }\n  vec3 col = acc / ws;\n  vec3 bl = textureLod(uSrc, vUv, 4.0).rgb * 0.5 + textureLod(uSrc, vUv, 6.0).rgb * 0.5;\n  col += bl * bl * 0.035;\n  vec2 v = vUv - 0.5;\n  col *= 1.0 - dot(v, v) * 0.22;\n  float g = hash(gl_FragCoord.xy + fract(uTime) * 91.7) - 0.5;\n  col += g * 0.02 * (1.0 - 0.4 * col);\n  o = vec4(col, 1.0);\n}`;\n\n/* ---------- small motion helpers ---------- */\n\ntype Spring = { x: number; v: number; t: number; k: number; c: number };\nconst spring = (x: number, k: number, c: number): Spring => ({ x, v: 0, t: x, k, c });\nconst stepSpring = (s: Spring, dt: number, push = 0) => {\n  s.v += (-s.k * (s.x - s.t) - s.c * s.v + push) * dt;\n  s.x += s.v * dt;\n};\n\nexport default function ThreeDesignModelsOnASunlitStage() {\n  const reduce = useReducedMotion();\n  const [pick, setPick] = useState(START);\n  const [ready, setReady] = useState(false);\n  const rootRef = useRef<HTMLElement>(null);\n  const canvasRef = useRef<HTMLCanvasElement>(null);\n  const flatRef = useRef<(HTMLCanvasElement | null)[]>([]);\n  const hitRef = useRef<(HTMLDivElement | null)[]>([]);\n  const photoRef = useRef<(HTMLImageElement | null)[]>([]);\n  // The design asked for last. The picture catches up a moment later, so the keyboard reads this and not the state.\n  const want = useRef(START);\n  // The render loop owns the scene. React talks to it through this handle.\n  const api = useRef<{ choose: (i: number) => void; hover: (i: number, on: boolean) => void } | null>(null);\n\n  // Print the three pages. They are the picture on each model, and the still shown where the renderer cannot run.\n  useEffect(() => {\n    const sheets = flatRef.current;\n    const paint = (i: number, img: HTMLImageElement | null) => {\n      const cv = sheets[i];\n      const cx = cv?.getContext(\"2d\");\n      if (!cv || !cx) return;\n      cx.setTransform(1, 0, 0, 1, 0, 0);\n      PAINT[i](cx, img);\n      cv.dispatchEvent(new Event(\"printed\"));\n    };\n    const offs = DESIGNS.map((_, i) => {\n      const img = photoRef.current[i];\n      const ok = !!img && img.complete && img.naturalWidth > 0;\n      paint(i, ok ? img : null);\n      if (!img || ok) return () => {};\n      const fn = () => paint(i, img);\n      img.addEventListener(\"load\", fn);\n      return () => img.removeEventListener(\"load\", fn);\n    });\n    return () => offs.forEach((off) => off());\n  }, []);\n\n  useEffect(() => {\n    const root = rootRef.current;\n    const canvas = canvasRef.current;\n    const sheets = flatRef.current;\n    if (!root || !canvas || sheets.length < 3 || sheets.some((s) => !s)) return;\n    const gl = canvas.getContext(\"webgl2\", { antialias: false, alpha: false, powerPreference: \"high-performance\" });\n    if (!gl) return;\n\n    const compile = (type: number, src: string) => {\n      const s = gl.createShader(type)!;\n      gl.shaderSource(s, src);\n      gl.compileShader(s);\n      if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(s) || \"shader\");\n      return s;\n    };\n    const link = (fs: string) => {\n      const p = gl.createProgram()!;\n      gl.attachShader(p, compile(gl.VERTEX_SHADER, VERT));\n      gl.attachShader(p, compile(gl.FRAGMENT_SHADER, fs));\n      gl.bindAttribLocation(p, 0, \"a\");\n      gl.linkProgram(p);\n      if (!gl.getProgramParameter(p, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(p) || \"link\");\n      return p;\n    };\n    let scene: WebGLProgram;\n    let post: WebGLProgram;\n    try {\n      scene = link(SCENE);\n      post = link(POST);\n    } catch (e) {\n      console.error(e);\n      return;\n    }\n    const U = (p: WebGLProgram, n: string) => gl.getUniformLocation(p, n);\n    const su = Object.fromEntries([\"uRes\", \"uCam\", \"uTarget\", \"uFov\", \"uA\", \"uB\", \"uT0\", \"uT1\", \"uT2\"].map((n) => [n, U(scene, n)]));\n    const pu = Object.fromEntries([\"uSrc\", \"uRes\", \"uFocus\", \"uTime\"].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);\n    gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);\n\n    let dirty = true;\n    const texs = sheets.map(() => {\n      const t = gl.createTexture()!;\n      gl.bindTexture(gl.TEXTURE_2D, t);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n      return t;\n    });\n    const upload = (i: number) => {\n      const cv = sheets[i]!;\n      gl.bindTexture(gl.TEXTURE_2D, texs[i]);\n      try {\n        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, cv);\n      } catch {\n        // a photograph that may not be read back: print the page with its plain colour instead\n        const c2 = document.createElement(\"canvas\");\n        c2.width = PW;\n        c2.height = PH;\n        PAINT[i](c2.getContext(\"2d\")!, null);\n        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c2);\n      }\n      gl.generateMipmap(gl.TEXTURE_2D);\n      dirty = true;\n    };\n    const onPrinted = sheets.map((cv, i) => {\n      const fn = () => {\n        upload(i);\n        kick();\n      };\n      cv!.addEventListener(\"printed\", fn);\n      return fn;\n    });\n\n    // the moving parts, one set for each model\n    let chosen = START;\n    // Two places at the back, one at the front. Whoever is picked trades places with the model in front.\n    const slot = DESIGNS.map((_, i) => (i < START ? -1 : 1));\n    const prog = DESIGNS.map((_, i) => (i === START ? 1 : 0));\n    const side = DESIGNS.map((_, i) => spring(i === START ? 0 : slot[i], 80, 15));\n    const fwd = DESIGNS.map((_, i) => spring(i === START ? 1 : 0, 64, 13.5));\n    const goal = DESIGNS.map((_, i) => (i === START ? 1 : 0));\n    const lean = DESIGNS.map(() => spring(0, 190, 7.5));\n    const turn = DESIGNS.map((_, i) => spring(i === START ? -0.05 : -slot[i] * 0.1, 40, 11));\n    const glow = DESIGNS.map((_, i) => spring(i === START ? 1 : 0, 120, 16));\n    const hov = [0, 0, 0];\n    const landed = DESIGNS.map((_, i) => i === START);\n    const push = spring(0, 70, 9);\n    const cam = { ax: 0, ay: 0, tx: 0, ty: 0 };\n    let demo = !reduce;\n    let clock = 0;\n    let time = 0;\n    let idleAt = HOLD;\n    let wake = Infinity;\n    let cues: { at: number; fn: () => void }[] = [];\n    const at = (delay: number, fn: () => void) => {\n      cues.push({ at: clock + delay, fn });\n      cues.sort((a, b) => a.at - b.at);\n    };\n    const settle = (j: number) => {\n      cues = [];\n      chosen = j;\n      DESIGNS.forEach((_, i) => {\n        const on = i === j ? 1 : 0;\n        fwd[i].x = fwd[i].t = goal[i] = prog[i] = on;\n        fwd[i].v = 0;\n        side[i].x = side[i].t = on ? 0 : slot[i];\n        side[i].v = 0;\n        turn[i].x = turn[i].t = on ? -0.05 : -slot[i] * 0.1;\n        turn[i].v = 0;\n        lean[i].x = lean[i].v = 0;\n        glow[i].x = glow[i].t = on;\n        glow[i].v = 0;\n        landed[i] = on === 1;\n      });\n      dirty = true;\n    };\n    const choose = (j: number) => {\n      if (j === chosen) return;\n      const prev = chosen;\n      chosen = j;\n      want.current = j;\n      slot[prev] = slot[j];\n      if (reduce) {\n        settle(j);\n        setPick(j);\n        return;\n      }\n      cues = [];\n      // the base lights first, then the model lets go and comes forward\n      glow[j].t = 0.8;\n      goal[prev] = 0;\n      landed[prev] = false;\n      at(0.14, () => (glow[prev].t = 0));\n      at(0.12, () => {\n        goal[j] = 1;\n        setPick(j);\n      });\n    };\n    const quiet = () => {\n      demo = false;\n      idleAt = Infinity;\n      wake = clock + 14;\n    };\n    api.current = {\n      choose: (j) => {\n        quiet();\n        choose(j);\n        kick();\n      },\n      hover: (j, on) => {\n        hov[j] = on ? 1 : 0;\n        kick();\n      },\n    };\n\n    // render target\n    const fbo = gl.createFramebuffer();\n    const fbTex = gl.createTexture()!;\n    gl.bindTexture(gl.TEXTURE_2D, fbTex);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_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    let scale = Math.min(MAX_SCALE, Math.max(MIN_SCALE, window.devicePixelRatio || 1));\n    let cssW = 1;\n    let cssH = 1;\n    let phone = false;\n    let bw = 0;\n    let bh = 0;\n    const resize = () => {\n      const r = canvas.getBoundingClientRect();\n      cssW = Math.max(1, r.width);\n      cssH = Math.max(1, r.height);\n      phone = cssW < 768;\n      // never more than about 2.2 million pixels through the ray marcher\n      const s = Math.min(scale, Math.sqrt(2.2e6 / (cssW * cssH)));\n      const w = Math.round(cssW * s);\n      const h = Math.round(cssH * s);\n      if (w !== bw || h !== bh) {\n        bw = w;\n        bh = h;\n        canvas.width = w;\n        canvas.height = h;\n        gl.bindTexture(gl.TEXTURE_2D, fbTex);\n        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, w, h, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n        gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, fbTex, 0);\n      }\n      dirty = true;\n    };\n    resize();\n    sheets.forEach((_, i) => upload(i));\n\n    const A = new Float32Array(12);\n    const B = new Float32Array(12);\n    const hitKey = [\"\", \"\", \"\"];\n    const draw = () => {\n      const wide = cssW / cssH;\n      // where things stand, and where the camera is\n      const gap = phone ? 1.72 : 2.08;\n      const run = phone ? 2.1 : 1.8;\n      const front = phone ? -0.1 : -0.34;\n      const fov = phone ? 0.5 : 0.36;\n      const tgt = [phone ? 0 : -0.2, phone ? 1.02 : 0.8, (phone ? 1.2 : 0.55)];\n      const az = (phone ? -0.1 : -0.17) + cam.ax * 0.07 + Math.sin(time * 0.19) * 0.014;\n      const el = (phone ? 0.15 : 0.115) - cam.ay * 0.035 + Math.sin(time * 0.27 + 1) * 0.005;\n      const dist = (phone ? 9.6 : 10.2 * Math.max(1, 1.62 / wide)) * (1 - 0.01 * push.x);\n      const camPos = [tgt[0] + dist * Math.sin(az) * Math.cos(el), tgt[1] + dist * Math.sin(el), tgt[2] + dist * Math.cos(az) * Math.cos(el)];\n      // focus rides with whichever model is furthest forward\n      let fx = 0;\n      let fz = 0;\n      let fwt = 0;\n      for (let i = 0; i < 3; i++) {\n        const w = Math.pow(Math.max(0, fwd[i].x), 2) + 0.001;\n        fx += (side[i].x * gap + fwd[i].x * front) * w;\n        fz += fwd[i].x * run * w;\n        fwt += w;\n      }\n      const fp = [fx / fwt - camPos[0], 1.1 - camPos[1], fz / fwt - camPos[2]];\n      const focus = Math.hypot(fp[0], fp[1], fp[2]);\n      for (let i = 0; i < 3; i++) {\n        A[i * 4] = side[i].x * gap + fwd[i].x * front;\n        A[i * 4 + 1] = fwd[i].x * run;\n        A[i * 4 + 2] = lean[i].x;\n        A[i * 4 + 3] = turn[i].x;\n        B[i * 4] = Math.max(0, glow[i].x + (i === chosen ? 0 : hov[i] * 0.22));\n        B[i * 4 + 1] = focus;\n      }\n      gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n      gl.viewport(0, 0, bw, bh);\n      gl.useProgram(scene);\n      gl.uniform2f(su.uRes, bw, bh);\n      gl.uniform3f(su.uCam, camPos[0], camPos[1], camPos[2]);\n      gl.uniform3f(su.uTarget, tgt[0], tgt[1], tgt[2]);\n      gl.uniform1f(su.uFov, fov);\n      gl.uniform4fv(su.uA, A);\n      gl.uniform4fv(su.uB, B);\n      [\"uT0\", \"uT1\", \"uT2\"].forEach((n, i) => {\n        gl.activeTexture(gl.TEXTURE0 + i);\n        gl.bindTexture(gl.TEXTURE_2D, texs[i]);\n        gl.uniform1i(su[n], i);\n      });\n      gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n      gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n      gl.viewport(0, 0, bw, bh);\n      gl.useProgram(post);\n      gl.activeTexture(gl.TEXTURE0);\n      gl.bindTexture(gl.TEXTURE_2D, fbTex);\n      gl.generateMipmap(gl.TEXTURE_2D);\n      gl.uniform1i(pu.uSrc, 0);\n      gl.uniform2f(pu.uRes, bw, bh);\n      gl.uniform1f(pu.uFocus, focus);\n      gl.uniform1f(pu.uTime, reduce ? 0 : time);\n      gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n      // keep a pointer target over each model in the picture\n      const fwv = [tgt[0] - camPos[0], tgt[1] - camPos[1], tgt[2] - camPos[2]];\n      const fl = Math.hypot(fwv[0], fwv[1], fwv[2]);\n      fwv[0] /= fl; fwv[1] /= fl; fwv[2] /= fl;\n      const rg = [-fwv[2], 0, fwv[0]];\n      const rl = Math.hypot(rg[0], rg[2]);\n      rg[0] /= rl; rg[2] /= rl;\n      const up = [rg[1] * fwv[2] - rg[2] * fwv[1], rg[2] * fwv[0] - rg[0] * fwv[2], rg[0] * fwv[1] - rg[1] * fwv[0]];\n      for (let i = 0; i < 3; i++) {\n        const hit = hitRef.current[i];\n        if (!hit) continue;\n        const v = [A[i * 4] - camPos[0], 1.1 - camPos[1], A[i * 4 + 1] - 0.1 - camPos[2]];\n        const depth = v[0] * fwv[0] + v[1] * fwv[1] + v[2] * fwv[2];\n        const k = cssH / (depth * 2 * Math.tan(fov / 2));\n        const x = cssW / 2 + (v[0] * rg[0] + v[2] * rg[2]) * k;\n        const y = cssH / 2 - (v[0] * up[0] + v[1] * up[1] + v[2] * up[2]) * k;\n        const next = `${Math.round(x)}|${Math.round(y)}|${Math.round(k)}`;\n        if (next !== hitKey[i]) {\n          hitKey[i] = next;\n          hit.style.left = `${x}px`;\n          hit.style.top = `${y}px`;\n          hit.style.width = `${1.5 * k}px`;\n          hit.style.height = `${2.1 * k}px`;\n          hit.style.zIndex = String(Math.round(100 - depth * 5));\n        }\n      }\n    };\n\n    let raf = 0;\n    let last = 0;\n    let onScreen = true;\n    let slow = 0;\n    let first = true;\n    const frame = (now: number) => {\n      raf = 0;\n      const raw = last ? (now - last) / 1000 : 0.016;\n      last = now;\n      const dt = Math.min(raw, 0.1);\n      if (reduce) {\n        if (dirty) {\n          dirty = false;\n          draw();\n        }\n      } else {\n        clock += dt;\n        time += dt;\n        while (cues.length && cues[0].at <= clock) cues.shift()!.fn();\n        if (clock > wake) {\n          wake = Infinity;\n          demo = true;\n          idleAt = clock + 1.5;\n        }\n        if (demo && clock > idleAt) {\n          choose((chosen + 1) % DESIGNS.length);\n          idleAt = clock + HOLD + 1.2;\n        }\n        for (let i = 0; i < 3; i++) {\n          // Each model follows a slow plan and a spring follows the plan, so it starts late and rocks as it stops.\n          // Coming in: sideways along the back, a small step away, then forward. Going out: sideways across the front, then back.\n          prog[i] = Math.max(0, Math.min(1, prog[i] + ((goal[i] === 1 ? 1 : -1) * dt) / TRAVEL));\n          const ease = (a: number, b: number) => {\n            const u = Math.max(0, Math.min(1, (prog[i] - a) / (b - a)));\n            return u * u * (3 - 2 * u);\n          };\n          let plan: number;\n          if (goal[i] === 1) {\n            side[i].t = slot[i] * (1 - ease(0, 0.55));\n            plan = ease(0.25, 1) - 0.05 * Math.sin(Math.PI * Math.min(1, prog[i] / 0.3));\n          } else {\n            side[i].t = slot[i] * (1 - ease(0.45, 1));\n            plan = ease(0, 0.75);\n          }\n          fwd[i].t = Math.max(plan, i === chosen ? -1 : hov[i] * 0.07);\n          const f = Math.max(0, Math.min(1, fwd[i].x));\n          turn[i].t = -side[i].x * 0.1 * (1 - f) - 0.05 * f;\n          for (let n = 0; n < 4; n++) {\n            const h = dt / 4;\n            const v0 = fwd[i].v;\n            const s0 = side[i].v;\n            stepSpring(fwd[i], h);\n            stepSpring(side[i], h);\n            stepSpring(lean[i], h, ((fwd[i].v - v0) / h) * 2.6);\n            stepSpring(turn[i], h, ((side[i].v - s0) / h) * 1.5);\n            stepSpring(glow[i], h);\n          }\n          lean[i].x = Math.max(-0.09, Math.min(0.12, lean[i].x));\n          if (goal[i] === 1 && !landed[i] && fwd[i].x > 0.965) {\n            // it arrives: the light under it flares and the camera takes the knock\n            landed[i] = true;\n            glow[i].t = 1;\n            glow[i].v += 7;\n            push.v += 1.5;\n          }\n        }\n        for (let n = 0; n < 4; n++) {\n          stepSpring(push, dt / 4);\n        }\n        const kc = 1 - Math.exp(-dt * 3.2);\n        cam.ax += (cam.tx - cam.ax) * kc;\n        cam.ay += (cam.ty - cam.ay) * kc;\n        draw();\n        // step the resolution down if this machine cannot hold the frame rate\n        if (raw > 0.03) slow++;\n        else slow = Math.max(0, slow - 1);\n        if (slow > 24 && scale > MIN_SCALE) {\n          scale = Math.max(MIN_SCALE, scale * 0.84);\n          slow = 0;\n          resize();\n        }\n      }\n      if (first) {\n        first = false;\n        setReady(true);\n      }\n      if (onScreen && !document.hidden && (!reduce || dirty)) raf = requestAnimationFrame(frame);\n    };\n    function kick() {\n      if (!raf && onScreen && !document.hidden) {\n        last = 0;\n        raf = requestAnimationFrame(frame);\n      }\n    }\n    const io = new IntersectionObserver(([e]) => {\n      onScreen = e.isIntersecting;\n      kick();\n    });\n    io.observe(root);\n    const ro = new ResizeObserver(() => {\n      resize();\n      kick();\n    });\n    ro.observe(canvas);\n    const onVis = () => kick();\n    document.addEventListener(\"visibilitychange\", onVis);\n    const onMove = (e: PointerEvent) => {\n      if (reduce) return;\n      const r = root.getBoundingClientRect();\n      cam.tx = Math.max(-1, Math.min(1, ((e.clientX - r.left) / r.width) * 2 - 1));\n      cam.ty = Math.max(-1, Math.min(1, ((e.clientY - r.top) / r.height) * 2 - 1));\n    };\n    const onLeave = () => {\n      cam.tx = 0;\n      cam.ty = 0;\n    };\n    root.addEventListener(\"pointermove\", onMove);\n    root.addEventListener(\"pointerleave\", onLeave);\n    const onLost = (e: Event) => {\n      e.preventDefault();\n      setReady(false);\n      cancelAnimationFrame(raf);\n      api.current = null;\n    };\n    canvas.addEventListener(\"webglcontextlost\", onLost);\n    kick();\n\n    return () => {\n      cancelAnimationFrame(raf);\n      io.disconnect();\n      ro.disconnect();\n      document.removeEventListener(\"visibilitychange\", onVis);\n      root.removeEventListener(\"pointermove\", onMove);\n      root.removeEventListener(\"pointerleave\", onLeave);\n      canvas.removeEventListener(\"webglcontextlost\", onLost);\n      sheets.forEach((cv, i) => cv?.removeEventListener(\"printed\", onPrinted[i]));\n      api.current = null;\n      texs.forEach((t) => gl.deleteTexture(t));\n      gl.deleteTexture(fbTex);\n      gl.deleteFramebuffer(fbo);\n      gl.deleteBuffer(quad);\n      gl.deleteProgram(scene);\n      gl.deleteProgram(post);\n    };\n  }, [reduce]);\n\n  const choose = (i: number) => {\n    want.current = i;\n    if (api.current) api.current.choose(i);\n    else setPick(i);\n  };\n  const onKeys = (e: React.KeyboardEvent<HTMLDivElement>) => {\n    const step = e.key === \"ArrowRight\" || e.key === \"ArrowDown\" ? 1 : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\" ? -1 : 0;\n    if (!step) return;\n    e.preventDefault();\n    const next = (want.current + step + DESIGNS.length) % DESIGNS.length;\n    choose(next);\n    (e.currentTarget.children[next] as HTMLElement | undefined)?.focus();\n  };\n  const design = DESIGNS[pick];\n\n  return (\n    <section ref={rootRef} className=\"relative isolate h-[680px] w-full overflow-hidden md:h-[740px]\" style={{ backgroundColor: \"#ECEAE5\", color: INK, fontFamily: FONT }}>\n      {/* The still: the three printed pages standing in a row. Shown before the renderer starts and wherever it cannot run. */}\n      <div className={`absolute inset-0 transition-opacity duration-700 ${ready ? \"pointer-events-none opacity-0\" : \"opacity-100\"}`} style={{ background: \"linear-gradient(118deg, rgba(255,255,255,0) 56%, rgba(128,134,150,0.32) 82%), linear-gradient(180deg, #F3F1EC 0%, #ECEAE5 62%, #E2E0DB 62.3%, #EFEDE8 100%)\" }}>\n        <div className=\"absolute inset-x-0 top-[25%] flex items-end justify-center gap-[3.5%] px-4 md:top-[17%]\">\n          {DESIGNS.map((d, i) => (\n            <div\n              key={d.name}\n              aria-hidden=\"true\"\n              onClick={() => choose(i)}\n              className=\"relative w-[29%] max-w-[262px] cursor-pointer transition-transform duration-500 ease-out motion-reduce:transition-none\"\n              style={{ aspectRatio: \"3 / 4\", transform: i === pick ? \"translateY(9%) scale(1.13)\" : \"scale(0.95)\", zIndex: i === pick ? 2 : 1 }}\n            >\n              <canvas\n                ref={(el) => {\n                  flatRef.current[i] = el;\n                }}\n                width={PW}\n                height={PH}\n                className=\"block h-full w-full rounded-[5px]\"\n                style={{ backgroundColor: d.body, boxShadow: i === pick ? \"0 1px 0 rgba(255,255,255,0.5) inset, 26px 44px 60px -22px rgba(40,48,66,0.5), 8px 10px 16px -6px rgba(40,48,66,0.3)\" : \"18px 30px 44px -20px rgba(40,48,66,0.4), 5px 7px 12px -5px rgba(40,48,66,0.25)\" }}\n              />\n              <span\n                className=\"absolute inset-x-[11%] top-[96.5%] h-[7.5%] rounded-[4px] transition-[background-color,box-shadow] duration-500 motion-reduce:transition-none\"\n                style={i === pick ? { backgroundColor: BLUE, boxShadow: \"0 0 28px 5px rgba(79,152,251,0.5), inset 0 1px 0 rgba(255,255,255,0.55), inset 0 -7px 10px -4px rgba(160,205,255,0.9)\" } : { backgroundColor: \"#F4F4F2\", boxShadow: \"0 8px 12px -5px rgba(40,48,66,0.3), inset 0 1px 0 #fff, inset 0 -6px 8px -4px rgba(120,130,150,0.25)\" }}\n              />\n            </div>\n          ))}\n        </div>\n      </div>\n\n      {/* The photographs printed on the pages. Kept as real images so they load once and are described to screen readers. */}\n      <div className=\"sr-only\">\n        {DESIGNS.map((d, i) => (\n          <img\n            alt={`${d.name} design: ${d.photo.alt}`}\n            key={d.name}\n            src={d.photo.src}\n            crossOrigin=\"anonymous\"\n            width={300}\n            height={400}\n            ref={(el) => {\n              photoRef.current[i] = el;\n            }}\n          />\n        ))}\n      </div>\n\n      <canvas ref={canvasRef} aria-hidden=\"true\" className={`absolute inset-0 h-full w-full transition-opacity duration-700 ${ready ? \"opacity-100\" : \"opacity-0\"}`} />\n\n      {/* Pointer targets laid over the models in the picture. The named buttons below do the same job for keyboards and screen readers. */}\n      {DESIGNS.map((d, i) => (\n        <div\n          key={d.name}\n          ref={(el) => {\n            hitRef.current[i] = el;\n          }}\n          aria-hidden=\"true\"\n          className={`absolute -translate-x-1/2 -translate-y-1/2 touch-manipulation select-none ${ready ? \"\" : \"hidden\"} ${i === pick ? \"\" : \"cursor-pointer\"}`}\n          onClick={() => choose(i)}\n          onPointerEnter={() => api.current?.hover(i, true)}\n          onPointerLeave={() => api.current?.hover(i, false)}\n        />\n      ))}\n\n      <p className=\"pointer-events-none absolute left-5 top-5 text-[10px] font-semibold uppercase tracking-[0.22em] text-[#0B0D12]/55 md:left-10 md:top-9 md:text-[11px]\">\n        One sentence <span className=\"mx-1.5 text-[#0B0D12]/30\">/</span> Three designs\n      </p>\n      <p className=\"pointer-events-none absolute right-5 top-5 hidden max-w-[260px] text-right text-[13px] font-medium leading-snug tracking-tight text-[#0B0D12]/55 md:right-10 md:top-8 md:block\">\n        &ldquo;{SHOP.sentence}&rdquo;\n      </p>\n\n      <div className=\"pointer-events-none absolute left-5 top-11 md:bottom-10 md:left-10 md:top-auto\">\n        <p className=\"flex items-center gap-2.5 text-[10px] font-semibold uppercase tracking-[0.22em] text-[#0B0D12]/60 md:text-[11px]\">\n          <span className=\"h-2 w-2 rounded-full\" style={{ backgroundColor: BLUE }} />\n          Design 0{pick + 1} <span className=\"text-[#0B0D12]/30\">/</span> 0{DESIGNS.length}\n        </p>\n        <div className=\"relative mt-1 h-[58px] w-[320px] overflow-hidden md:mt-1.5 md:h-[104px] md:w-[520px]\">\n          <AnimatePresence initial={false} mode=\"popLayout\">\n            <motion.h2\n              key={design.name}\n              initial={reduce ? { opacity: 0 } : { y: \"70%\", opacity: 0 }}\n              animate={{ y: \"0%\", opacity: 1 }}\n              exit={reduce ? { opacity: 0 } : { y: \"-50%\", opacity: 0 }}\n              transition={reduce ? { duration: 0.01 } : { y: { type: \"spring\", stiffness: 210, damping: 22 }, opacity: { duration: 0.28 } }}\n              className=\"absolute left-0 top-0 text-[56px] font-extrabold leading-[1] tracking-[-0.055em] md:text-[100px]\"\n            >\n              {design.name}\n            </motion.h2>\n          </AnimatePresence>\n        </div>\n        <p className=\"mt-0.5 text-[14px] font-medium tracking-tight text-[#0B0D12]/65 md:mt-2 md:text-[17px]\">{design.line}</p>\n      </div>\n\n      <div className=\"absolute inset-x-0 bottom-5 z-[200] flex flex-col items-center gap-2.5 md:inset-x-auto md:bottom-10 md:right-10 md:items-end md:gap-3\">\n        <span className=\"text-[10px] font-semibold uppercase tracking-[0.22em] text-[#0B0D12]/50 md:text-[11px]\">Pick one</span>\n        <div role=\"radiogroup\" aria-label={`Design for ${SHOP.name}`} onKeyDown={onKeys} className=\"flex rounded-full p-1\" style={{ backgroundColor: \"rgba(255,255,255,0.72)\", boxShadow: \"0 0 0 1px rgba(11,13,18,0.08), 0 14px 30px -14px rgba(30,40,60,0.35)\", backdropFilter: \"blur(10px)\" }}>\n          {DESIGNS.map((d, i) => (\n            <button\n              key={d.name}\n              type=\"button\"\n              role=\"radio\"\n              aria-checked={i === pick}\n              tabIndex={i === pick ? 0 : -1}\n              onClick={() => choose(i)}\n              className=\"relative h-11 rounded-full px-5 text-[15px] font-bold tracking-tight transition-colors duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0B0D12] focus-visible:ring-offset-2 motion-reduce:transition-none\"\n              style={{ color: INK }}\n            >\n              {i === pick && (\n                <motion.span layoutId=\"three-design-models-pill\" className=\"absolute inset-0 rounded-full\" style={{ backgroundColor: BLUE, boxShadow: \"inset 0 1px 0 rgba(255,255,255,0.45), 0 6px 16px -4px rgba(79,152,251,0.75)\" }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 380, damping: 32 }} />\n              )}\n              <span className=\"relative\">{d.name}</span>\n            </button>\n          ))}\n        </div>\n      </div>\n      <p className=\"sr-only\" aria-live=\"polite\">\n        {design.name}, design {pick + 1} of {DESIGNS.length} for {SHOP.name}. {design.line}\n      </p>\n    </section>\n  );\n}\n"}]}
