{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"click-to-edit-page-with-inlaid-pieces-you-lift-out-of-lit-sockets-and-turn-over-in-the-air","type":"registry:block","title":"Click-to-Edit Page with Inlaid Pieces You Lift Out of Lit Sockets and Turn Over in the Air","description":"Visual editing demo in 3D: lift the photo, headline or button out of a page and blue light shows in the empty socket. Free React code and HTML to copy.","dependencies":["framer-motion"],"files":[{"path":"components/we-inc/click-to-edit-page-with-inlaid-pieces-you-lift-out-of-lit-sockets-and-turn-over-in-the-air.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\nimport type { CSSProperties, KeyboardEvent as ReactKeyboardEvent } from \"react\";\nimport { useReducedMotion } from \"framer-motion\";\n\nconst BLUE = \"#4F98FB\";\nconst INK = \"#0B0D12\";\nconst PAPER = \"#F6F4EF\";\nconst sans = '\"Inter Tight\", \"Inter\", ui-sans-serif, system-ui, sans-serif';\n\n/** What is printed straight onto the page and never moves. */\nconst page = {\n  brand: \"Ostra Ceramics\",\n  links: [\"Shop\", \"Classes\", \"Studio\"],\n  sub: \"Small batches, glazed in sea colours. Wheel classes every Saturday.\",\n};\n\ntype Side = { text: string; photo?: string; alt?: string; tone?: \"paper\" | \"ink\" | \"blue\" };\ntype Piece = { id: string; label: string; x: number; y: number; w: number; h: number; radius: number; axis: \"X\" | \"Y\"; edge: string; sides: [Side, Side] };\n\n/** The loose pieces. Each one has a second version on its back: lift it, let go, and it lands the other way up. */\nconst pieces: Piece[] = [\n  {\n    id: \"photo\", label: \"Photo\", x: 404, y: 82, w: 182, h: 300, radius: 14, axis: \"Y\", edge: \"#e4dfd4\",\n    sides: [\n      { text: \"Hands shaping a bowl on the wheel\", photo: \"https://images.pexels.com/photos/37222842/pexels-photo-37222842.jpeg?auto=compress&cs=tinysrgb&w=600\", alt: \"Two hands shaping a small clay bowl on a spinning wheel, seen from above\" },\n      { text: \"Hands raising a tall clay form\", photo: \"https://images.pexels.com/photos/36370411/pexels-photo-36370411.jpeg?auto=compress&cs=tinysrgb&w=600\", alt: \"Hands raising a tall form in wet grey clay on a pottery wheel\" },\n    ],\n  },\n  {\n    id: \"headline\", label: \"Headline\", x: 34, y: 84, w: 344, h: 142, radius: 12, axis: \"X\", edge: \"#d9d3c7\",\n    sides: [\n      { text: \"Cups made slowly.\", tone: \"paper\" },\n      { text: \"Thrown by hand.\", tone: \"ink\" },\n    ],\n  },\n  {\n    id: \"button\", label: \"Button\", x: 34, y: 328, w: 204, h: 56, radius: 28, axis: \"X\", edge: \"#2c62b8\",\n    sides: [\n      { text: \"Book a class\", tone: \"blue\" },\n      { text: \"Shop the kiln\", tone: \"ink\" },\n    ],\n  },\n];\n\n// Design pixels. The scene is scaled to fit its frame.\nconst W = 620;\nconst H = 420;\nconst SCENE_W = 900;\nconst SCENE_H = 500;\nconst T = 12; // thickness of a piece\nconst LIFT = 124;\nconst clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));\n\nfunction SideFace({ p, side, back }: { p: Piece; side: Side; back: boolean }) {\n  const turn = back ? `rotate${p.axis}(180deg) ` : \"\";\n  const base: CSSProperties = { borderRadius: p.radius, transform: `${turn}translateZ(${T / 2 + 0.6}px)`, backfaceVisibility: \"hidden\" };\n  if (side.photo)\n    return (\n      <span className=\"absolute inset-0 block overflow-hidden\" style={{ ...base, background: \"#6f6a63\" }}>\n        <img src={side.photo} alt=\"\" width={p.w} height={p.h} draggable={false} className=\"h-full w-full object-cover\" />\n        <span className=\"absolute inset-0\" style={{ borderRadius: p.radius, boxShadow: \"inset 0 0 0 1px rgba(255,255,255,0.22), inset 0 1.5px 0 rgba(255,255,255,0.45)\", background: \"linear-gradient(140deg, rgba(255,255,255,0.20) 0%, rgba(255,255,255,0) 32%, rgba(0,0,0,0.12) 100%)\" }} />\n      </span>\n    );\n  const ink = side.tone === \"ink\";\n  const blue = side.tone === \"blue\";\n  const big = p.id === \"headline\";\n  return (\n    <span\n      className={`absolute inset-0 flex items-center ${big ? \"px-[18px] text-[53px] font-black leading-[0.94] tracking-[-0.055em]\" : \"justify-center gap-2 text-[16px] font-extrabold tracking-[-0.02em]\"}`}\n      style={{\n        ...base,\n        color: ink ? \"#F6F4EF\" : INK,\n        background: blue ? `linear-gradient(180deg, #73affd 0%, ${BLUE} 48%, #3f84e6 100%)` : ink ? \"linear-gradient(180deg, #232733 0%, #10131a 100%)\" : \"linear-gradient(180deg, #ffffff 0%, #f8f6f1 100%)\",\n        boxShadow: ink ? \"inset 0 1.5px 0 rgba(255,255,255,0.20), inset 0 0 0 1px rgba(255,255,255,0.07)\" : blue ? \"inset 0 1.5px 0 rgba(255,255,255,0.55), inset 0 -2px 0 rgba(11,13,18,0.14)\" : \"inset 0 1.5px 0 #ffffff, inset 0 0 0 1px rgba(11,13,18,0.07), inset 0 -2px 0 rgba(11,13,18,0.06)\",\n      }}\n    >\n      {side.text}\n      {!big && (\n        <svg width=\"14\" height=\"14\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n          <path d=\"M4 10h12M11 5l5 5-5 5\" />\n        </svg>\n      )}\n    </span>\n  );\n}\n\nexport default function LiftOutPageEdit() {\n  const reduce = useReducedMotion();\n  const stageRef = useRef<HTMLDivElement>(null);\n  const wrapRef = useRef<HTMLDivElement>(null);\n  const sceneRef = useRef<HTMLDivElement>(null);\n  const pageRef = useRef<HTMLDivElement>(null);\n  const cursorRef = useRef<HTMLDivElement>(null);\n  const [shown, setShown] = useState<number[]>(pieces.map(() => 0));\n  const [held, setHeld] = useState(-1);\n  const api = useRef<{ press: (i: number) => void } | null>(null);\n\n  useEffect(() => {\n    const stage = stageRef.current, wrap = wrapRef.current, scene = sceneRef.current, pg = pageRef.current, cursor = cursorRef.current;\n    if (!stage || !wrap || !scene || !pg || !cursor) return;\n    const q = (sel: string) => Array.from(pg.querySelectorAll<HTMLElement>(sel));\n    const movers = q(\"[data-mover]\"), turners = q(\"[data-turner]\"), shadows = q(\"[data-shadow]\"), contacts = q(\"[data-contact]\"), sockets = q(\"[data-socket]\"), anchors = q(\"[data-anchor]\");\n    const sim = pieces.map((p) => ({ x: 0, y: 0, z: 0, vx: 0, vy: 0, vz: 0, tx: 0, ty: 0, tz: 0, rot: 0, vrot: 0, trot: 0, lx: 0, ly: 0, mode: \"rest\" as \"rest\" | \"held\" | \"turn\" | \"seat\", until: 0, flash: 0, axis: p.axis }));\n    const s = { scale: 1, dip: 0, vdip: 0, px: 0, py: 0, tpx: 0, tpy: 0, user: -1e9, drag: -1, sx: 0, sy: 0, cx: 0, cy: 0, cshow: 0, demoI: 0, demoPhase: \"wait\" as \"wait\" | \"go\" | \"hold\" | \"after\", demoT: performance.now() + 250, first: true };\n    let raf = 0;\n    let visible = true;\n    let last = performance.now();\n\n    const measure = () => {\n      const sc = clamp(wrap.clientWidth / 745, 0.4, 1.3);\n      s.scale = sc;\n      wrap.style.height = `${Math.round(SCENE_H * sc)}px`;\n      scene.style.transform = `translateX(-50%) scale(${sc.toFixed(4)})`;\n    };\n    measure();\n    const ro = new ResizeObserver(measure);\n    ro.observe(wrap);\n    const sr0 = stage.getBoundingClientRect();\n    s.cx = sr0.width * 0.78;\n    s.cy = sr0.height * 0.9;\n\n    const lift = (i: number, now: number, auto: number) => {\n      const p = sim[i];\n      if (reduce) return;\n      p.mode = \"held\";\n      p.tz = LIFT;\n      p.until = auto ? now + auto : 0;\n      setHeld(i);\n    };\n    const letGo = (i: number) => {\n      const p = sim[i];\n      p.trot += 180;\n      p.tx = 0;\n      p.ty = 0;\n      p.until = 0;\n      setShown((v) => v.map((f, k) => (k === i ? 1 - f : f)));\n      setHeld(-1);\n      if (reduce) {\n        p.rot = p.trot;\n        p.mode = \"rest\";\n        return;\n      }\n      p.mode = \"turn\";\n    };\n\n    const tick = (now: number) => {\n      const dt = Math.min(0.033, (now - last) / 1000);\n      last = now;\n\n      // the self-playing hand: go to a piece, pick it up, hold it, let it go\n      const demoOn = !reduce && now - s.user > 7000 && s.drag < 0;\n      if (demoOn) {\n        const i = s.demoI, p = sim[i];\n        if (s.demoPhase === \"wait\" && now > s.demoT) {\n          s.demoPhase = \"go\";\n          s.demoT = now + (s.first ? 420 : 620);\n        } else if (s.demoPhase === \"go\" && now > s.demoT) {\n          lift(i, now, 0);\n          p.tx = i === 0 ? 44 : 26;\n          p.ty = i === 0 ? 10 : -14;\n          s.demoPhase = \"hold\";\n          s.demoT = now + (s.first ? 3100 : 1150);\n          s.first = false;\n        } else if (s.demoPhase === \"hold\" && now > s.demoT) {\n          letGo(i);\n          s.demoPhase = \"after\";\n        } else if (s.demoPhase === \"after\" && p.mode === \"rest\") {\n          s.demoI = (i + 1) % pieces.length;\n          s.demoPhase = \"wait\";\n          s.demoT = now + 700;\n        }\n        if (s.demoPhase === \"go\" || s.demoPhase === \"hold\") {\n          const ar = anchors[i].getBoundingClientRect(), sr = stage.getBoundingClientRect();\n          const k = s.demoPhase === \"hold\" ? 0.45 : 0.14;\n          s.cx += (ar.left - sr.left - s.cx) * k;\n          s.cy += (ar.top - sr.top - s.cy) * k;\n        }\n      } else if (s.demoPhase === \"hold\" && s.drag < 0) {\n        // the visitor took over while the hand was holding something\n        if (sim[s.demoI].mode === \"held\") letGo(s.demoI);\n        s.demoPhase = \"after\";\n      }\n      s.cshow += ((demoOn ? 1 : 0) - s.cshow) * 0.15;\n      cursor.style.opacity = s.cshow.toFixed(3);\n      cursor.style.transform = `translate(${s.cx.toFixed(1)}px, ${s.cy.toFixed(1)}px) scale(${((s.demoPhase === \"hold\" ? 0.9 : 1) * clamp(s.scale * 1.1, 0.62, 1)).toFixed(2)})`;\n\n      sim.forEach((p, i) => {\n        if (p.mode === \"held\" && p.until && now > p.until) letGo(i);\n        if (p.mode === \"turn\" && Math.abs(p.trot - p.rot) < 46) {\n          p.tz = 0;\n          p.mode = \"seat\";\n        }\n        if (!reduce) {\n          const k = p.mode === \"seat\" ? 210 : 150, c = p.mode === \"seat\" ? 15 : 17;\n          p.vx += (k * (p.tx - p.x) - c * p.vx) * dt;\n          p.vy += (k * (p.ty - p.y) - c * p.vy) * dt;\n          p.vz += (k * (p.tz - p.z) - c * p.vz) * dt;\n          p.x += p.vx * dt;\n          p.y += p.vy * dt;\n          p.z += p.vz * dt;\n          p.vrot += (74 * (p.trot - p.rot) - 11.5 * p.vrot) * dt;\n          p.rot += p.vrot * dt;\n          if (p.z < 0) {\n            // it lands in its socket: the page takes the knock and the light is shut in\n            p.z = 0;\n            if (p.mode === \"seat\") {\n              s.vdip -= Math.min(150, Math.abs(p.vz) * 0.55);\n              p.flash = 1;\n              p.mode = \"rest\";\n            }\n            p.vz = -p.vz * 0.22;\n          }\n        }\n        p.flash *= 0.93;\n        const up = clamp(p.z / LIFT, 0, 1);\n        const float = p.mode === \"held\" ? Math.sin(now / 520 + i) : 0;\n        p.lx += ((p.mode === \"held\" ? -9 : 0) * up + float * 1.6 - clamp(p.vy * 0.05, -14, 14) - p.lx) * 0.2;\n        p.ly += ((p.mode === \"held\" ? 13 : 0) * up + float * 2.2 + clamp(p.vx * 0.05, -14, 14) - p.ly) * 0.2;\n        movers[i].style.transform = `translate3d(${p.x.toFixed(2)}px, ${p.y.toFixed(2)}px, ${(p.z + float * 2 * up + T / 2 + 1).toFixed(2)}px)`;\n        movers[i].style.zIndex = p.z > 2 ? \"5\" : \"1\";\n        turners[i].style.transform = `rotateX(${p.lx.toFixed(2)}deg) rotateY(${p.ly.toFixed(2)}deg) rotate${p.axis}(${p.rot.toFixed(2)}deg)`;\n        shadows[i].style.opacity = (0.62 * Math.min(1, p.z / 26) * (1 - up * 0.45)).toFixed(3);\n        shadows[i].style.transform = `translate(${(p.x + p.z * 0.2).toFixed(1)}px, ${(p.y + p.z * 0.46).toFixed(1)}px) scale(${(1 + up * 0.07).toFixed(3)})`;\n        contacts[i].style.opacity = (1 - Math.min(1, p.z / 18)).toFixed(3);\n        sockets[i].style.setProperty(\"--lit\", clamp(Math.min(1, p.z / 30) + p.flash * 0.9, 0, 1).toFixed(3));\n      });\n\n      s.vdip += (-420 * s.dip - 19 * s.vdip) * dt;\n      s.dip += s.vdip * dt;\n      s.px += (s.tpx - s.px) * 0.07;\n      s.py += (s.tpy - s.py) * 0.07;\n      const idle = reduce ? 0 : Math.sin(now / 2700) * 1.6;\n      pg.style.transform = `rotateX(${(36 - s.py * 4).toFixed(2)}deg) rotateZ(${(-7 + s.px * 4 + idle).toFixed(2)}deg) translateZ(${s.dip.toFixed(2)}px)`;\n      if (visible) raf = requestAnimationFrame(tick);\n    };\n\n    const io = new IntersectionObserver(([e]) => {\n      const was = visible;\n      visible = e.isIntersecting;\n      if (visible && !was) {\n        last = performance.now();\n        raf = requestAnimationFrame(tick);\n      }\n    });\n    io.observe(stage);\n    raf = requestAnimationFrame(tick);\n\n    const down = (e: PointerEvent) => {\n      const el = (e.target as HTMLElement).closest<HTMLElement>(\"[data-turner]\");\n      if (!el || e.button !== 0) return;\n      const i = turners.indexOf(el);\n      if (i < 0 || sim[i].mode === \"turn\" || sim[i].mode === \"seat\") return;\n      s.user = performance.now();\n      if (reduce) {\n        letGo(i);\n        return;\n      }\n      s.drag = i;\n      s.sx = e.clientX;\n      s.sy = e.clientY;\n      lift(i, s.user, 0);\n      el.setPointerCapture(e.pointerId);\n    };\n    const move = (e: PointerEvent) => {\n      const r = stage.getBoundingClientRect();\n      s.tpx = clamp(((e.clientX - r.left) / r.width - 0.5) * 2, -1, 1);\n      s.tpy = clamp(((e.clientY - r.top) / r.height - 0.5) * 2, -1, 1);\n      if (s.drag < 0) return;\n      s.user = performance.now();\n      sim[s.drag].tx = clamp((e.clientX - s.sx) / s.scale, -150, 150);\n      sim[s.drag].ty = clamp(((e.clientY - s.sy) / s.scale) * 1.2, -130, 130);\n    };\n    const up = () => {\n      if (s.drag < 0) return;\n      const i = s.drag;\n      s.drag = -1;\n      s.user = performance.now();\n      if (sim[i].mode === \"held\") letGo(i);\n    };\n    const leave = () => {\n      s.tpx = 0;\n      s.tpy = 0;\n    };\n    pg.addEventListener(\"pointerdown\", down);\n    stage.addEventListener(\"pointermove\", move);\n    stage.addEventListener(\"pointerup\", up);\n    stage.addEventListener(\"pointercancel\", up);\n    stage.addEventListener(\"pointerleave\", leave);\n\n    api.current = {\n      press: (i) => {\n        const now = performance.now();\n        s.user = now;\n        if (sim[i].mode !== \"rest\") return;\n        if (reduce) letGo(i);\n        else lift(i, now, 520);\n      },\n    };\n\n    return () => {\n      cancelAnimationFrame(raf);\n      ro.disconnect();\n      io.disconnect();\n      pg.removeEventListener(\"pointerdown\", down);\n      stage.removeEventListener(\"pointermove\", move);\n      stage.removeEventListener(\"pointerup\", up);\n      stage.removeEventListener(\"pointercancel\", up);\n      stage.removeEventListener(\"pointerleave\", leave);\n      api.current = null;\n    };\n  }, [reduce]);\n\n  const onKey = (i: number) => (e: ReactKeyboardEvent) => {\n    if (e.key === \"Enter\" || e.key === \" \") {\n      e.preventDefault();\n      api.current?.press(i);\n    }\n  };\n\n  return (\n    <section className=\"relative overflow-hidden bg-[#0B0D12] px-4 pb-10 pt-10 sm:pb-12 sm:pt-8\" style={{ fontFamily: sans }}>\n      <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0\" style={{ background: \"radial-gradient(60% 58% at 50% 44%, #262b37 0%, #171a22 44%, #0e1016 76%, #0B0D12 100%)\" }} />\n      <div ref={stageRef} className=\"relative mx-auto w-full max-w-[1000px]\">\n        <div ref={wrapRef} className=\"relative w-full\" style={{ height: SCENE_H }}>\n          <div ref={sceneRef} className=\"absolute left-1/2 top-0 select-none\" style={{ width: SCENE_W, height: SCENE_H, transformOrigin: \"50% 0\", transform: \"translateX(-50%)\", perspective: \"1500px\", perspectiveOrigin: \"50% 30%\" }}>\n            <div ref={pageRef} className=\"absolute\" style={{ left: SCENE_W / 2 - W / 2, top: 62, width: W, height: H, transformStyle: \"preserve-3d\", transform: \"rotateX(36deg) rotateZ(-7deg)\" }}>\n              {/* shadow on the table and the thickness of the page */}\n              <div aria-hidden=\"true\" className=\"absolute inset-0\" style={{ borderRadius: 30, background: \"rgba(0,0,0,0.8)\", filter: \"blur(40px)\", transform: \"translate3d(26px, 50px, -80px)\" }} />\n              <div aria-hidden=\"true\" className=\"absolute inset-0\" style={{ borderRadius: 18, background: \"rgba(0,0,0,0.85)\", filter: \"blur(8px)\", transform: \"translate3d(4px, 8px, -22px)\" }} />\n              {[9, 8, 7, 6, 5, 4, 3, 2, 1].map((i) => (\n                <div key={i} aria-hidden=\"true\" className=\"absolute inset-0\" style={{ borderRadius: 16, background: i > 7 ? \"#8f8878\" : i % 2 ? \"#d6cfc1\" : \"#c9c1b1\", transform: `translateZ(${-i * 2}px)` }} />\n              ))}\n              <div className=\"absolute inset-0 overflow-hidden\" style={{ borderRadius: 16, background: PAPER, boxShadow: \"inset 0 1.5px 0 #ffffff, inset 0 -2px 0 rgba(11,13,18,0.10)\" }}>\n                <div className=\"absolute left-[38px] right-[36px] top-[26px] flex items-center justify-between\">\n                  <span className=\"flex items-center gap-[9px] text-[15px] font-extrabold tracking-[-0.025em]\" style={{ color: INK }}>\n                    <span aria-hidden=\"true\" className=\"h-[10px] w-[10px] rounded-full\" style={{ background: BLUE }} />\n                    {page.brand}\n                  </span>\n                  <span className=\"flex items-center gap-[22px] text-[12px] font-bold text-neutral-700\">\n                    {page.links.map((l) => (\n                      <span key={l}>{l}</span>\n                    ))}\n                  </span>\n                </div>\n                <div aria-hidden=\"true\" className=\"absolute left-[36px] right-[36px] top-[62px] h-px bg-neutral-900/10\" />\n                <p className=\"absolute left-[38px] top-[250px] w-[300px] text-[14.5px] font-semibold leading-snug text-neutral-600\">{page.sub}</p>\n                <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0\" style={{ background: \"linear-gradient(120deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 30%, rgba(40,30,10,0.07) 100%)\" }} />\n                {/* the sockets: dark wells with the blue light that shows through when a piece is out */}\n                {pieces.map((p) => (\n                  <div key={p.id} data-socket=\"\" aria-hidden=\"true\" className=\"absolute\" style={{ left: p.x, top: p.y, width: p.w, height: p.h, borderRadius: p.radius, background: \"#07080c\", boxShadow: \"inset 0 5px 10px rgba(0,0,0,0.9), inset 0 0 0 1px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.9)\", [\"--lit\" as string]: 0 }}>\n                    <div className=\"absolute inset-0\" style={{ borderRadius: p.radius, opacity: \"var(--lit)\" as unknown as number, background: \"radial-gradient(120% 120% at 50% 100%, rgba(79,152,251,0.55) 0%, rgba(79,152,251,0.12) 55%, rgba(79,152,251,0) 100%)\", boxShadow: `inset 0 0 0 1.5px ${BLUE}, inset 0 0 26px rgba(79,152,251,0.8)` }} />\n                  </div>\n                ))}\n              </div>\n              {/* blue light spilling onto the page around an open socket */}\n              {pieces.map((p) => (\n                <div key={p.id} aria-hidden=\"true\" className=\"pointer-events-none absolute\" style={{ left: p.x, top: p.y, width: p.w, height: p.h, transform: \"translateZ(0.5px)\" }}>\n                  <div data-contact=\"\" className=\"absolute inset-0\" style={{ borderRadius: p.radius, background: \"rgba(30,22,8,0.5)\", filter: \"blur(4px)\", transform: \"translate(2px, 5px)\" }} />\n                  <div data-shadow=\"\" className=\"absolute inset-0\" style={{ borderRadius: p.radius + 6, background: \"rgba(11,13,18,0.8)\", filter: \"blur(16px)\", opacity: 0 }} />\n                </div>\n              ))}\n              {/* the pieces */}\n              {pieces.map((p, i) => (\n                <div key={p.id} data-mover=\"\" className=\"absolute\" style={{ left: p.x, top: p.y, width: p.w, height: p.h, transformStyle: \"preserve-3d\", transform: `translate3d(0,0,${T / 2 + 1}px)` }}>\n                  <span data-anchor=\"\" aria-hidden=\"true\" className=\"absolute h-0 w-0\" style={{ left: \"64%\", top: \"58%\", transform: `translateZ(${T}px)` }} />\n                  <div\n                    data-turner=\"\"\n                    role=\"button\"\n                    tabIndex={0}\n                    aria-pressed={held === i}\n                    aria-label={`${p.label}: ${(p.sides[shown[i]].alt || p.sides[shown[i]].text).replace(/\\.$/, \"\")}. Pick it up to turn it over.`}\n                    onKeyDown={onKey(i)}\n                    className=\"lift-out-page-piece absolute inset-0 cursor-grab touch-none outline-none active:cursor-grabbing\"\n                    style={{ borderRadius: p.radius, transformStyle: \"preserve-3d\" }}\n                  >\n                    <span aria-hidden=\"true\" className=\"absolute inset-0 block\" style={{ transformStyle: \"preserve-3d\" }}>\n                      {[-3, -2, -1, 0, 1, 2, 3].map((k) => (\n                        <span key={k} className=\"absolute inset-0 block\" style={{ borderRadius: p.radius, background: p.edge, transform: `translateZ(${(k * T) / 6}px)` }} />\n                      ))}\n                      <SideFace p={p} side={p.sides[0]} back={false} />\n                      <SideFace p={p} side={p.sides[1]} back />\n                    </span>\n                  </div>\n                </div>\n              ))}\n            </div>\n          </div>\n        </div>\n\n        {/* the hand that plays the demo */}\n        <div ref={cursorRef} aria-hidden=\"true\" className=\"pointer-events-none absolute left-0 top-0 z-20\" style={{ opacity: 0, transformOrigin: \"0 0\" }}>\n          <svg width=\"30\" height=\"34\" viewBox=\"0 0 30 34\" style={{ filter: \"drop-shadow(0 6px 8px rgba(0,0,0,0.5))\" }}>\n            <path d=\"M4 3l20 12.5-9.2 1.9L10 26z\" fill=\"#ffffff\" stroke=\"#0B0D12\" strokeWidth=\"1.8\" strokeLinejoin=\"round\" />\n          </svg>\n        </div>\n\n        <p className=\"relative z-10 mx-auto mt-1 flex max-w-[30rem] items-center justify-center gap-[10px] text-center text-[13px] font-bold tracking-[-0.01em] text-white/70\">\n          <span aria-hidden=\"true\" className=\"h-2 w-2 shrink-0 rounded-full\" style={{ background: held >= 0 ? BLUE : \"rgba(255,255,255,0.3)\", boxShadow: held >= 0 ? `0 0 12px ${BLUE}` : \"none\" }} />\n          <span aria-live=\"polite\">{held >= 0 ? `Holding the ${pieces[held].label.toLowerCase()}. Let go and it turns over.` : \"Pick up the photo, the headline or the button.\"}</span>\n        </p>\n      </div>\n      <style>{`\n        .lift-out-page-piece:focus-visible { outline: 3px solid ${BLUE}; outline-offset: 5px; }\n      `}</style>\n    </section>\n  );\n}\n"}]}
