{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"pearl-necklace-length-picker-on-a-velvet-bust-with-a-knotted-strand-that-drapes-and-swings-like-a-real-chain","type":"registry:block","title":"Pearl Necklace Length Picker on a Velvet Bust with a Knotted Strand That Drapes and Swings Like a Real Chain","description":"Length selector on a canvas: a knotted pearl strand on a velvet bust drapes under simulated gravity and swings when pulled. Free React and HTML to copy.","dependencies":[],"files":[{"path":"components/we-inc/pearl-necklace-length-picker-on-a-velvet-bust-with-a-knotted-strand-that-drapes-and-swings-like-a-real-chain.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\nimport type { KeyboardEvent as ReactKeyboardEvent } from \"react\";\n\n// The lengths on offer. `pearls` is how many show in front of the neck; the longest entry sets the size of the strand.\nconst lengths = [\n  { label: \"Choker\", size: \"40 cm\", pearls: 12, price: \"£640\" },\n  { label: \"Princess\", size: \"45 cm\", pearls: 16, price: \"£820\" },\n  { label: \"Matinee\", size: \"58 cm\", pearls: 22, price: \"£1,080\" },\n  { label: \"Opera\", size: \"76 cm\", pearls: 28, price: \"£1,460\" },\n];\nconst strand = { name: \"Akoya strand\", detail: \"Hand knotted on silk\" };\nconst START = 2; // which length is on the bust at load\nconst VW = 520, VH = 470; // drawing space; the canvas scales this to its width\n\nexport default function PearlNecklaceLengthPicker() {\n  const canvas = useRef<HTMLCanvasElement>(null);\n  const hit = useRef<HTMLDivElement>(null);\n  const radios = useRef<(HTMLButtonElement | null)[]>([]);\n  const [pick, setPick] = useState(START);\n  const pickRef = useRef(START);\n  const api = useRef<{ go: (i: number, fromUser: boolean) => void } | null>(null);\n\n  useEffect(() => {\n    const cv = canvas.current, pad = hit.current;\n    if (!cv || !pad) return;\n    const ctx = cv.getContext(\"2d\");\n    if (!ctx) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    let scale = 1;\n\n    const CX = VW / 2, BY = 408, NW = 58, AY = -286; // bust centre, its base line, half the neck width, where the strand leaves the neck\n    const NMAX = Math.max(...lengths.map((l) => l.pearls)) + 2, MID = (NMAX - 1) / 2;\n    // graduated: the largest pearl hangs at the centre\n    const rad = Array.from({ length: NMAX }, (_, i) => 7.2 + 4.2 * Math.pow(1 - Math.abs(i - MID) / (MID + 1), 1.4));\n    const rest = Array.from({ length: NMAX - 1 }, (_, i) => rad[i] + rad[i + 1] + 0.9);\n    const px = new Float32Array(NMAX), py = new Float32Array(NMAX), ox = new Float32Array(NMAX), oy = new Float32Array(NMAX);\n    const s = { n: lengths[START].pearls, lx: -0.3, ly: -0.2, lxTo: -0.3, lyTo: -0.2, grab: -1, gx: 0, gy: 0, t: 0, wind: 0 };\n\n    const grainCv = document.createElement(\"canvas\"); grainCv.width = grainCv.height = 128;\n    const gx = grainCv.getContext(\"2d\");\n    if (gx) {\n      let seed = 3; const rnd = () => { seed = (seed * 16807) % 2147483647; return seed / 2147483647; };\n      for (let i = 0; i < 9000; i++) { const v = rnd(); gx.fillStyle = v > 0.55 ? `rgba(255,255,255,${(v - 0.55) * 0.3})` : `rgba(0,0,0,${(0.55 - v) * 0.4})`; gx.fillRect(rnd() * 128, rnd() * 128, 0.6 + rnd() * 0.7, 0.6 + rnd() * 0.7); }\n    }\n    const grain = ctx.createPattern(grainCv, \"repeat\");\n\n    const bust = () => {\n      ctx.beginPath(); ctx.moveTo(-NW, -344);\n      ctx.bezierCurveTo(-NW, -288, -NW - 2, -264, -102, -242); ctx.bezierCurveTo(-154, -224, -190, -198, -194, -150);\n      ctx.bezierCurveTo(-198, -100, -152, -30, -130, 4); ctx.bezierCurveTo(-70, 24, 70, 24, 130, 4);\n      ctx.bezierCurveTo(152, -30, 198, -100, 194, -150); ctx.bezierCurveTo(190, -198, 154, -224, 102, -242);\n      ctx.bezierCurveTo(NW + 2, -264, NW, -288, NW, -344); ctx.bezierCurveTo(NW, -362, -NW, -362, -NW, -344); ctx.closePath();\n    };\n\n    // which pearls are in front of the neck, and how far the next one has been fed round\n    const span = () => { const h = s.n / 2, lo = Math.floor(MID - h) + 1, hi = Math.ceil(MID + h) - 1; return { lo, hi, fl: lo - (MID - h), fr: MID + h - hi }; };\n\n    const step = (dt: number) => {\n      const { lo, hi, fl, fr } = span();\n      for (let i = 0; i < NMAX; i++) {\n        if (i < lo) { px[i] = ox[i] = -NW; py[i] = oy[i] = AY; continue; }\n        if (i > hi) { px[i] = ox[i] = NW; py[i] = oy[i] = AY; continue; }\n        if (i === s.grab) continue;\n        // the bust leans back, so the pearls ride on velvet: gravity is softened and motion dies away quickly\n        const vx = (px[i] - ox[i]) * 0.986, vy = (py[i] - oy[i]) * 0.986;\n        ox[i] = px[i]; oy[i] = py[i];\n        px[i] += vx + s.wind * dt * dt; py[i] += vy + 1500 * dt * dt;\n      }\n      if (s.grab >= lo && s.grab <= hi) {\n        // you cannot pull a pearl further than the strand on either side of it allows\n        let tx = s.gx, ty = Math.max(AY - 6, s.gy), reachL = rest[Math.max(0, lo - 1)] * fl, reachR = rest[Math.min(NMAX - 2, hi)] * fr;\n        for (let i = lo; i < s.grab; i++) reachL += rest[i];\n        for (let i = s.grab; i < hi; i++) reachR += rest[i];\n        for (let k = 0; k < 4; k++) {\n          let d = Math.hypot(tx + NW, ty - AY); if (d > reachL) { tx = -NW + ((tx + NW) * reachL) / d; ty = AY + ((ty - AY) * reachL) / d; }\n          d = Math.hypot(tx - NW, ty - AY); if (d > reachR) { tx = NW + ((tx - NW) * reachR) / d; ty = AY + ((ty - AY) * reachR) / d; }\n        }\n        ox[s.grab] = px[s.grab]; oy[s.grab] = py[s.grab]; px[s.grab] += (tx - px[s.grab]) * 0.5; py[s.grab] += (ty - py[s.grab]) * 0.5;\n      }\n      for (let it = 0; it < 18; it++) {\n        for (let i = Math.max(0, lo - 1); i <= Math.min(NMAX - 2, hi); i++) {\n          const j = i + 1, want = rest[i] * (i === lo - 1 ? fl : i === hi ? fr : 1);\n          const dx = px[j] - px[i], dy = py[j] - py[i], d = Math.hypot(dx, dy) || 0.001, k = (d - want) / d;\n          const fi = i < lo || i === s.grab ? 0 : 1, fj = j > hi || j === s.grab ? 0 : 1, sum = fi + fj;\n          if (!sum) continue;\n          px[i] += dx * k * (fi / sum); py[i] += dy * k * (fi / sum); px[j] -= dx * k * (fj / sum); py[j] -= dy * k * (fj / sum);\n        }\n        if (it % 3 === 0) {\n          // pearls are solid: two that are not neighbours still cannot share a place\n          for (let i = lo; i <= hi; i++) for (let j = i + 2; j <= hi; j++) {\n            const dx = px[j] - px[i], dy = py[j] - py[i], min = rad[i] + rad[j];\n            if (Math.abs(dx) >= min || Math.abs(dy) >= min) continue;\n            const d = Math.hypot(dx, dy) || 0.001; if (d >= min) continue;\n            const k = ((min - d) / d) * 0.5, fi = i === s.grab ? 0 : 1, fj = j === s.grab ? 0 : 1;\n            px[i] -= dx * k * fi; py[i] -= dy * k * fi; px[j] += dx * k * fj; py[j] += dy * k * fj;\n          }\n        }\n      }\n    };\n    const relax = () => {\n      const { lo, hi } = span();\n      for (let i = 0; i < NMAX; i++) { const u = Math.max(0, Math.min(1, (i - lo + 1) / (hi - lo + 2))); px[i] = ox[i] = -NW + 2 * NW * u; py[i] = oy[i] = AY + Math.sin(u * Math.PI) * s.n * 8; }\n      for (let k = 0; k < 500; k++) step(1 / 120);\n      for (let i = 0; i < NMAX; i++) { ox[i] = px[i]; oy[i] = py[i]; }\n    };\n\n    const pearl = (x: number, y: number, r: number) => {\n      const hx = x + (-0.34 + s.lx * 0.3) * r, hy = y + (-0.4 + s.ly * 0.22) * r;\n      // body: nacre is brightest under the lamp and falls to a warm grey before the edge\n      let g = ctx.createRadialGradient(hx, hy, r * 0.05, x, y, r);\n      g.addColorStop(0, \"#ffffff\"); g.addColorStop(0.2, \"#fdf8f1\"); g.addColorStop(0.5, \"#efe5da\"); g.addColorStop(0.78, \"#c9b9ad\"); g.addColorStop(0.93, \"#93857f\"); g.addColorStop(1, \"#6f6463\");\n      ctx.beginPath(); ctx.arc(x, y, r, 0, 6.3); ctx.fillStyle = g; ctx.fill();\n      ctx.save(); ctx.clip();\n      // the dark velvet mirrored in the lower half, then light coming back up off it along the rim\n      g = ctx.createLinearGradient(x, y - r * 0.1, x, y + r);\n      g.addColorStop(0, \"rgba(34,28,36,0)\"); g.addColorStop(0.55, \"rgba(34,28,36,0.3)\"); g.addColorStop(0.8, \"rgba(34,28,36,0.16)\"); g.addColorStop(1, \"rgba(255,238,230,0.5)\");\n      ctx.fillStyle = g; ctx.fillRect(x - r, y - r, r * 2, r * 2);\n      // orient: the rose and green that float on a good pearl\n      g = ctx.createRadialGradient(x - r * 0.5, y - r * 0.1, 0, x - r * 0.5, y - r * 0.1, r * 1.1);\n      g.addColorStop(0, \"rgba(255,170,190,0.2)\"); g.addColorStop(1, \"rgba(255,170,190,0)\");\n      ctx.fillStyle = g; ctx.fillRect(x - r, y - r, r * 2, r * 2);\n      g = ctx.createRadialGradient(x + r * 0.55, y + r * 0.2, 0, x + r * 0.55, y + r * 0.2, r);\n      g.addColorStop(0, \"rgba(150,230,210,0.2)\"); g.addColorStop(1, \"rgba(150,230,210,0)\");\n      ctx.fillStyle = g; ctx.fillRect(x - r, y - r, r * 2, r * 2);\n      ctx.restore();\n      // the lamp itself, soft edged because nacre is not glass\n      g = ctx.createRadialGradient(hx, hy, 0, hx, hy, r * 0.34);\n      g.addColorStop(0, \"rgba(255,255,255,1)\"); g.addColorStop(0.45, \"rgba(255,255,255,0.8)\"); g.addColorStop(1, \"rgba(255,255,255,0)\");\n      ctx.fillStyle = g; ctx.beginPath(); ctx.arc(hx, hy, r * 0.34, 0, 6.3); ctx.fill();\n    };\n\n    const draw = () => {\n      ctx.setTransform(scale, 0, 0, scale, 0, 0);\n      ctx.clearRect(0, 0, VW, VH);\n      ctx.translate(CX, BY);\n      // shadow of the bust on the table\n      ctx.save(); ctx.translate(-s.lx * 14, 18); ctx.scale(1, 0.15);\n      let g = ctx.createRadialGradient(0, 0, 40, 0, 0, 200);\n      g.addColorStop(0, \"rgba(58,30,26,0.62)\"); g.addColorStop(0.55, \"rgba(58,30,26,0.28)\"); g.addColorStop(1, \"rgba(58,30,26,0)\");\n      ctx.fillStyle = g; ctx.beginPath(); ctx.arc(0, 0, 200, 0, 6.3); ctx.fill(); ctx.restore();\n\n      // black velvet: dark where you face the pile, pale along every edge that turns away\n      bust(); ctx.fillStyle = \"#121013\"; ctx.fill();\n      ctx.save(); bust(); ctx.clip();\n      const lampX = s.lx * 120, lampY = -150 + s.ly * 60;\n      g = ctx.createRadialGradient(lampX, lampY, 10, lampX, lampY, 250);\n      g.addColorStop(0, \"rgba(96,90,108,0.5)\"); g.addColorStop(0.5, \"rgba(60,56,70,0.2)\"); g.addColorStop(1, \"rgba(40,36,48,0)\");\n      ctx.fillStyle = g; ctx.fillRect(-240, -370, 480, 410);\n      ctx.save(); ctx.shadowColor = \"rgba(176,168,196,0.9)\"; ctx.shadowBlur = 30 * scale; ctx.lineWidth = 7; ctx.strokeStyle = \"rgba(176,168,196,0.55)\"; bust(); ctx.stroke();\n      ctx.shadowColor = \"rgba(226,220,236,0.8)\"; ctx.shadowBlur = 7 * scale; ctx.lineWidth = 1.5; bust(); ctx.stroke(); ctx.restore();\n      // the neck is a column: its own soft band of light, and shade where it meets the shoulders\n      g = ctx.createLinearGradient(-NW, 0, NW, 0);\n      const nh = 0.5 + s.lx * 0.3;\n      g.addColorStop(0, \"rgba(0,0,0,0)\"); g.addColorStop(Math.max(0.05, nh - 0.3), \"rgba(0,0,0,0.25)\"); g.addColorStop(nh, \"rgba(120,114,134,0.22)\"); g.addColorStop(Math.min(0.95, nh + 0.3), \"rgba(0,0,0,0.3)\"); g.addColorStop(1, \"rgba(0,0,0,0)\");\n      ctx.fillStyle = g; ctx.fillRect(-NW, -348, NW * 2, 96);\n      g = ctx.createLinearGradient(0, -282, 0, -214);\n      g.addColorStop(0, \"rgba(0,0,0,0)\"); g.addColorStop(0.5, \"rgba(0,0,0,0.34)\"); g.addColorStop(1, \"rgba(0,0,0,0)\");\n      ctx.fillStyle = g; ctx.fillRect(-150, -282, 300, 68);\n      g = ctx.createLinearGradient(0, -40, 0, 26);\n      g.addColorStop(0, \"rgba(0,0,0,0)\"); g.addColorStop(1, \"rgba(0,0,0,0.5)\");\n      ctx.fillStyle = g; ctx.fillRect(-230, -40, 460, 70);\n      if (grain) { ctx.globalAlpha = 0.7; ctx.fillStyle = grain; ctx.fillRect(-240, -370, 480, 410); ctx.globalAlpha = 1; }\n      ctx.restore();\n      // the cut top of the neck\n      ctx.beginPath(); ctx.ellipse(0, -344, NW, 14, 0, 0, 6.3);\n      g = ctx.createLinearGradient(-NW, 0, NW, 0); g.addColorStop(0, \"#2a262e\"); g.addColorStop(nh, \"#57515f\"); g.addColorStop(1, \"#211e25\");\n      ctx.fillStyle = g; ctx.fill(); ctx.lineWidth = 1; ctx.strokeStyle = \"rgba(214,206,226,0.5)\"; ctx.stroke();\n\n      // the strand passes behind the neck, so pearls are only cut off where they meet its edge\n      const { lo, hi } = span();\n      ctx.save(); ctx.beginPath(); ctx.rect(-NW, -370, NW * 2, 120); ctx.rect(-VW, AY + 3, VW * 2, VH); ctx.clip();\n      // light the pearls throw onto the velvet under them\n      ctx.save(); ctx.globalCompositeOperation = \"lighter\";\n      for (let i = lo; i <= hi; i++) { const r = rad[i] * 2; g = ctx.createRadialGradient(px[i], py[i] + 2, rad[i] * 0.7, px[i], py[i] + 2, r); g.addColorStop(0, \"rgba(255,236,226,0.08)\"); g.addColorStop(1, \"rgba(255,236,226,0)\"); ctx.fillStyle = g; ctx.beginPath(); ctx.arc(px[i], py[i] + 2, r, 0, 6.3); ctx.fill(); }\n      ctx.restore();\n      // silk and its knots show in the gaps\n      ctx.beginPath();\n      for (let i = Math.max(0, lo - 1); i <= Math.min(NMAX - 1, hi + 1); i++) { if (i === Math.max(0, lo - 1)) ctx.moveTo(px[i], py[i]); else ctx.lineTo(px[i], py[i]); }\n      ctx.lineWidth = 1.6; ctx.lineJoin = \"round\"; ctx.strokeStyle = \"#e6dccb\"; ctx.stroke();\n      const order: number[] = [];\n      for (let i = Math.max(0, lo - 1); i <= Math.min(NMAX - 1, hi + 1); i++) order.push(i);\n      order.sort((a, b) => Math.abs(b - MID) - Math.abs(a - MID));\n      for (const i of order) pearl(px[i], py[i], rad[i]);\n      ctx.restore();\n    };\n\n    const fit = () => {\n      const w = cv.clientWidth; if (!w) return;\n      const dpr = Math.min(2, window.devicePixelRatio || 1);\n      cv.width = Math.round(w * dpr); cv.height = Math.round(((w * VH) / VW) * dpr); scale = cv.width / VW; draw();\n    };\n\n    let raf = 0, last = 0, t0 = 0, seen = true, touched = -1e9, nextDemo = 3400, act = 0, pluck = -1, pluckUntil = 0;\n    const select = (i: number) => { if (pickRef.current !== i) { pickRef.current = i; setPick(i); } };\n    const frame = (now: number) => {\n      raf = 0;\n      if (!t0) { t0 = now; last = now; }\n      const dt = Math.min(0.033, (now - last) / 1000); last = now;\n      const t = now - t0; s.t = t / 1000;\n      const target = lengths[pickRef.current].pearls;\n      s.n += Math.max(-dt * 16, Math.min(dt * 16, target - s.n)); // pearls are fed round the neck at a steady rate\n      if (now - touched > 6000) {\n        s.lxTo = Math.sin(t / 1600) * 0.8; s.lyTo = Math.cos(t / 2300) * 0.5;\n        if (t > nextDemo && s.grab < 0) {\n          // the demo lifts the strand to one side and lets it swing, then tries another length\n          if (act % 2 === 0) { const sp = span(); pluck = Math.round(MID + (act % 4 === 0 ? -1 : 1) * (sp.hi - sp.lo) * 0.2); pluckUntil = t + 520; nextDemo = t + 3000; }\n          else { select((pickRef.current + 1) % lengths.length); nextDemo = t + 3200; }\n          act++;\n        }\n        if (pluck >= 0) {\n          if (t < pluckUntil) { const dir = pluck < MID ? -1 : 1; s.grab = pluck; s.gx = px[pluck] + dir * 5; s.gy = py[pluck] - 4; }\n          else { s.grab = -1; pluck = -1; }\n        }\n      } else if (pluck >= 0) { s.grab = -1; pluck = -1; }\n      s.wind = Math.sin(s.t * 1.1) * 70;\n      s.lx += (s.lxTo - s.lx) * Math.min(1, dt * 5); s.ly += (s.lyTo - s.ly) * Math.min(1, dt * 5);\n      step(dt / 2); step(dt / 2);\n      draw();\n      if (seen && !document.hidden) raf = requestAnimationFrame(frame);\n    };\n    const wake = () => { if (!raf && !reduce) { last = performance.now(); raf = requestAnimationFrame(frame); } };\n    const still = () => { s.n = lengths[pickRef.current].pearls; s.grab = -1; s.lx = s.lxTo; s.ly = s.lyTo; relax(); draw(); };\n\n    api.current = { go: (i, fromUser) => { if (fromUser) touched = performance.now(); select(i); if (reduce) still(); else wake(); } };\n\n    const local = (e: PointerEvent) => { const b = cv.getBoundingClientRect(); return { x: ((e.clientX - b.left) / b.width) * VW - CX, y: ((e.clientY - b.top) / b.height) * VH - BY }; };\n    const onDown = (e: PointerEvent) => {\n      const p = local(e), { lo, hi } = span();\n      let best = -1, bd = 34;\n      for (let i = lo; i <= hi; i++) { const d = Math.hypot(px[i] - p.x, py[i] - p.y); if (d < bd) { bd = d; best = i; } }\n      touched = performance.now(); pluck = -1;\n      if (best < 0 || reduce) return;\n      s.grab = best; s.gx = p.x; s.gy = p.y; pad.setPointerCapture(e.pointerId); e.preventDefault(); wake();\n    };\n    const onMove = (e: PointerEvent) => {\n      const p = local(e);\n      s.lxTo = Math.max(-1, Math.min(1, p.x / (VW / 2))); s.lyTo = Math.max(-1, Math.min(1, (p.y + 200) / 260));\n      touched = Math.max(touched, performance.now() - 3000);\n      if (s.grab >= 0 && pluck < 0) { touched = performance.now(); s.gx = p.x; s.gy = p.y; }\n      if (reduce) { s.lx = s.lxTo; s.ly = s.lyTo; draw(); }\n    };\n    const onUp = () => { if (pluck < 0) s.grab = -1; touched = performance.now(); };\n    pad.addEventListener(\"pointerdown\", onDown);\n    pad.addEventListener(\"pointermove\", onMove);\n    pad.addEventListener(\"pointerup\", onUp);\n    pad.addEventListener(\"pointercancel\", onUp);\n    const ro = new ResizeObserver(fit); ro.observe(cv);\n    const io = new IntersectionObserver(([en]) => { seen = en.isIntersecting; if (seen) wake(); });\n    io.observe(cv);\n    const onVis = () => { if (!document.hidden) wake(); };\n    document.addEventListener(\"visibilitychange\", onVis);\n    relax(); fit();\n    if (!reduce) wake();\n    return () => {\n      cancelAnimationFrame(raf); api.current = null; ro.disconnect(); io.disconnect();\n      pad.removeEventListener(\"pointerdown\", onDown); pad.removeEventListener(\"pointermove\", onMove);\n      pad.removeEventListener(\"pointerup\", onUp); pad.removeEventListener(\"pointercancel\", onUp);\n      document.removeEventListener(\"visibilitychange\", onVis);\n    };\n  }, []);\n\n  const choose = (i: number) => { pickRef.current = i; setPick(i); api.current?.go(i, true); };\n  const onKey = (e: ReactKeyboardEvent, i: number) => {\n    const next = e.key === \"ArrowRight\" || e.key === \"ArrowDown\" ? (i + 1) % lengths.length : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\" ? (i + lengths.length - 1) % lengths.length : e.key === \"Home\" ? 0 : e.key === \"End\" ? lengths.length - 1 : -1;\n    if (next < 0) return;\n    e.preventDefault(); choose(next); radios.current[next]?.focus();\n  };\n  const now = lengths[pick];\n\n  return (\n    <section className=\"relative flex min-h-[560px] w-full flex-col items-center overflow-hidden bg-[#dcc5bd] bg-[radial-gradient(80%_64%_at_50%_40%,#f3e6e0_0%,#e2cdc5_56%,#cdb2a9_100%)] px-4 pb-6 pt-4 sm:min-h-[720px] sm:justify-center sm:pb-4\">\n      <div className=\"relative w-full max-w-[640px] sm:-mt-16\">\n        <canvas ref={canvas} aria-hidden=\"true\" className=\"block w-full\" style={{ aspectRatio: `${VW} / ${VH}` }} />\n        <div ref={hit} aria-hidden=\"true\" className=\"absolute inset-0 cursor-grab touch-pan-y active:cursor-grabbing\" />\n      </div>\n      <div className=\"flex w-full max-w-[540px] flex-col gap-4 sm:absolute sm:bottom-8 sm:left-8 sm:right-8 sm:w-auto sm:max-w-none sm:flex-row sm:items-end sm:justify-between\">\n        <p className=\"pointer-events-none text-[#5a443e]\">\n          <span className=\"block font-serif text-[17px] italic leading-tight text-[#2a1c19]\">{strand.name}</span>\n          <span className=\"mt-1 block font-mono text-[10.5px] uppercase tracking-[0.18em]\">{strand.detail}</span>\n          <span aria-live=\"polite\" className=\"mt-1 block font-mono text-[10.5px] uppercase tracking-[0.18em]\">\n            {now.label} <span className=\"mx-1 text-[#9c827a]\">/</span> {now.size} <span className=\"mx-1 text-[#9c827a]\">/</span> <span className=\"text-[#2a1c19]\">{now.price}</span>\n          </span>\n        </p>\n        <div role=\"radiogroup\" aria-label=\"Necklace length\" className=\"flex flex-wrap gap-1.5\">\n          {lengths.map((l, i) => (\n            <button\n              key={l.label}\n              ref={(el) => { radios.current[i] = el; }}\n              type=\"button\"\n              role=\"radio\"\n              aria-checked={pick === i}\n              tabIndex={pick === i ? 0 : -1}\n              onClick={() => choose(i)}\n              onKeyDown={(e) => onKey(e, i)}\n              className={`h-10 rounded-full border px-3.5 font-mono text-[10.5px] uppercase tracking-[0.14em] outline-none transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-[#2a1c19] focus-visible:ring-offset-2 focus-visible:ring-offset-[#dcc5bd] motion-reduce:transition-none ${pick === i ? \"border-[#1b1416] bg-[#1b1416] text-[#fbf1ea]\" : \"border-[#8f746c] bg-transparent text-[#3d2b27] hover:border-[#1b1416]\"}`}\n            >\n              {l.label}\n            </button>\n          ))}\n        </div>\n      </div>\n    </section>\n  );\n}\n"}]}
