{
  "id": "cube-page-transition",
  "kind": "element",
  "title": "3D cube page transition",
  "summary": "Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.",
  "url": "https://enrichr.dev/elements/cube-page-transition.html",
  "section": "page",
  "techniques": [
    "3d-css",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "cinematic",
    "immersive",
    "polished"
  ],
  "intents": [
    "3d cube page transition",
    "rotating cube slider",
    "cube navigation between sections",
    "css 3d cube scenes",
    "swipe cube carousel"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "duration",
      "label": "Turn time (ms)",
      "type": "range",
      "min": 300,
      "max": 2000,
      "step": 50,
      "value": 900
    },
    {
      "key": "dip",
      "label": "Dip back (px)",
      "type": "range",
      "min": 0,
      "max": 300,
      "step": 10,
      "value": 140
    },
    {
      "key": "tilt",
      "label": "Tilt (deg)",
      "type": "range",
      "min": 0,
      "max": 20,
      "step": 1,
      "value": 6
    },
    {
      "key": "perspective",
      "label": "Perspective (px)",
      "type": "range",
      "min": 400,
      "max": 2000,
      "step": 50,
      "value": 900
    }
  ],
  "license": "Free to use in personal and client projects during the preview. Final licence terms will be published here before any paid tier starts; ask before reselling the code as a collection.",
  "contract": "function mount(root, opts) -> { update(partialOpts), destroy() }; root must contain the element markup",
  "exports": {
    "claude": "Add the \"3D cube page transition\" element to this project.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nSteps:\n1. Look at the project first to see its framework and where components, styles and static files live. Follow its conventions.\n2. Fetch https://enrichr.dev/elements/cube-page-transition.json if you can read URLs (fields: source.markup, source.css, source.js, params); otherwise use the source at the end of this message.\n3. Add the files, mount it where I tell you (default: the top of the home page), and pass the settings below as the opts.\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n5. Run the dev server and check it. with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "chatgpt": "I want the \"3D cube page transition\" element on my website. Below is its complete source. Please:\n1. Build one self-contained index.html that I can open locally to see it working (put the CSS in a <style> tag and the JavaScript in a <script> tag, with the markup in the body).\n2. Then explain, step by step, which parts go where in my own site, and how to mount it. My stack is: [tell me yours, or say \"plain HTML\"].\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.",
    "cursor": "Add the \"3D cube page transition\" element to this codebase.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nUse Composer / agent mode. First search the repo for how components, styles and scripts are organised, then add the files in the matching places, mount it on the page I name, and run the app to confirm it works. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.\n\nOptional: save this as .cursor/rules/enrichr-cube-page-transition.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr 3D cube page transition element\nalwaysApply: false\n---\nmount(root, opts) expects the element markup inside root and returns { update, destroy }. Always call destroy() on unmount and never edit the ef- class names.",
    "v0": "Create a Next.js (App Router) client component for the \"3D cube page transition\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles to create:\n- cube-page-transition.js : the JavaScript below, with one line appended at the end: export { mount };  (and the markup exported as: export const markup = \"<the markup string>\";). If the project uses TypeScript and does not allow JS imports, put // @ts-nocheck on the first line.\n- the CSS below goes in your global stylesheet (or a plain .css file imported once at the app root). The class names are global and start with ef-.\n\nUse this component as the wrapper (adjust the import paths):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./cube-page-transition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CubePageTransition(props: Record<string, unknown>) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n```\n\nRender it on the home page so I can see it. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "lovable": "Add the \"3D cube page transition\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles to create:\n- cube-page-transition.js : the JavaScript below, with one line appended at the end: export { mount };  (and the markup exported as: export const markup = \"<the markup string>\";). If the project uses TypeScript and does not allow JS imports, put // @ts-nocheck on the first line.\n- the CSS below goes in your global stylesheet (or a plain .css file imported once at the app root). The class names are global and start with ef-.\n\nWrapper component (src/components/CubePageTransition.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./cube-page-transition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CubePageTransition(props: Record<string, unknown>) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n```\n\nRemove the \"use client\" line if it is not needed. Show it on the home page. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "bolt": "Create a small Vite project (vanilla JavaScript, no framework unless I already have one) that shows the \"3D cube page transition\" element.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles: index.html (a container element, then a script tag), style.css (the CSS below), cube-page-transition.js (the JavaScript below) and main.js that sets the container's innerHTML to the markup and calls mount(container, opts) with the settings below. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.",
    "replit": "Create a new HTML, CSS and JavaScript Repl that shows the \"3D cube page transition\" element. No packages, no server code.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles: index.html (a container element, link style.css, load cube-page-transition.js and then main.js), style.css (the CSS below), cube-page-transition.js (the JavaScript below), main.js (sets the container's innerHTML to the markup, then calls mount(container, opts) with the settings below). Press Run to preview. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "figma": "Designer handoff notes for the \"3D cube page transition\" element (Enrichr Library). Figma cannot run this JavaScript inside a design file, so use it as a motion reference and hand the code to a developer.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nWhat it does: The cube fills the stage. Face i is rotated i times 90 degrees around Y and pushed out by half the stage width, so the whole cube is pushed back by the same amount to keep the front face flush with the screen. To change scene the script tweens one angle, rotating the cube by minus that angle, and adds a sine-shaped extra translateZ and rotateX so the cube shrinks away and tilts at the midpoint of the turn before settling. The angle keeps counting past 360 so next always spins the same direction, and dots take the shortest way round. Backface visibility is hidden on every face.\nAccessibility: Left and right arrow keys, the two buttons and the dots all change scene, and the stage has a polite live region announcing the new scene. Faces that are not showing are inert and aria-hidden so tab order and screen readers only see the current scene. With prefers-reduced-motion the scenes switch instantly with no turn.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Turn time (ms): range 300 to 2000, step 50, default 900\n- Dip back (px): range 0 to 300, step 10, default 140\n- Tilt (deg): range 0 to 20, step 1, default 6\n- Perspective (px): range 400 to 2000, step 50, default 900\n\nCurrent settings:\n{{SETTINGS}}\n\nFor the developer: Element contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nIn Figma:\n- Draw the resting state as a frame and the end state as a second frame; link them with Smart Animate to show the motion in a prototype.\n- Put the settings above in the frame's notes or Dev Mode annotations so the developer matches them.\n- Link https://enrichr.dev/elements/cube-page-transition.html in the handoff: the live demo and the copy-ready code are there. Developers can paste the prompts for Claude, Cursor or v0 from the Export menu.\nNothing is copied from another designer's file; this is original code from Enrichr.",
    "framer": "Add the \"3D cube page transition\" element to Framer as a code component. Framer code components are React, so wrap the vanilla code like this. Check it in the Framer editor, as Framer's component API can change.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\n1. In Framer: Assets > Code > New component. Name it CubePageTransition.\n2. Paste the JavaScript below into a separate code file named cube-page-transition.js in the same project, with  export { mount };  and  export const markup = \"<the markup string>\";  added. Put the CSS into the component as a <style> tag.\n3. Component:\n```tsx\nimport { addPropertyControls, ControlType } from \"framer\"\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./cube-page-transition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CubePageTransition(props: any) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n\naddPropertyControls(CubePageTransition, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  duration: { type: ControlType.Number, title: \"Turn time\", min: 300, max: 2000, step: 50, defaultValue: 900 },\n  dip: { type: ControlType.Number, title: \"Dip back\", min: 0, max: 300, step: 10, defaultValue: 140 },\n  tilt: { type: ControlType.Number, title: \"Tilt\", min: 0, max: 20, step: 1, defaultValue: 6 },\n  perspective: { type: ControlType.Number, title: \"Perspective\", min: 400, max: 2000, step: 50, defaultValue: 900 },\n})\n```\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "webflow": "Add the \"3D cube page transition\" element to a Webflow site with an Embed element. Test it on the published or preview site: scripts in embeds may not run inside the Designer canvas.\n\nThis is the \"3D cube page transition\" element from the Enrichr Library: Four scenes sit on the faces of a CSS 3D cube that turns to the next scene with buttons, dots, arrow keys, swipe or wheel, dipping back mid-turn like a page change.\nPage: https://enrichr.dev/elements/cube-page-transition.html\nMachine-readable spec: https://enrichr.dev/elements/cube-page-transition.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\n1. Add an Embed element where it should appear. Paste a <style> block with the CSS, one container <div id=\"enrichr-cube-page-transition\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-cube-page-transition\"), { ...your settings... });\n   (set the container's innerHTML to the markup first, as in the contract).\n2. Embed elements have a size limit (check Webflow's current number). If the code is longer, host the JS and CSS as files and link them from Custom code in the page settings, then keep only the container and the mount call in the Embed.\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}"
  },
  "exportTools": [
    "claude",
    "chatgpt",
    "cursor",
    "v0",
    "lovable",
    "bolt",
    "replit",
    "figma",
    "framer",
    "webflow"
  ],
  "accessibility": "Left and right arrow keys, the two buttons and the dots all change scene, and the stage has a polite live region announcing the new scene. Faces that are not showing are inert and aria-hidden so tab order and screen readers only see the current scene. With prefers-reduced-motion the scenes switch instantly with no turn.",
  "performance": "Each turn writes one transform on the cube per frame; faces never change. The tween is a requestAnimationFrame loop that stops when the turn ends. Heavy content inside faces is the main cost, so keep scenes light or use images sized to the stage.",
  "dependencies": [],
  "source": {
    "markup": "<svg width=\"0\" height=\"0\" style=\"position:absolute\" aria-hidden=\"true\" focusable=\"false\"><defs>\n<symbol id=\"ef-cube-p1\" viewBox=\"1513.7 1453.9 322.3 322.3\">\n    <path fill=\"currentColor\" d=\"M1821 1761.2h-292.3v-111.6c0-8 6.5-14.5 14.5-14.5 4.2 0 8.2 1.9 11 5.1 7.8 8.6 19.7 13.6 32.7 11.9 16.8-2.3 30.1-16 32-32.7 2.5-22.6-15.1-41.6-37.1-41.6-11 0-20.9 4.7-27.7 12.3-2.8 3.1-6.7 4.9-10.9 4.9-8 0-14.5-6.4-14.5-14.4v-111.7h292.3v111.7c0 8-6.4 14.4-14.5 14.4-4.2 0-8.1-1.8-10.9-5-7.9-8.6-19.7-13.6-32.7-11.9-16.8 2.2-30.1 15.9-32 32.7-2.5 22.6 15.1 41.6 37.1 41.6 11 0 20.8-4.8 27.7-12.3 2.8-3.1 6.7-5 10.8-5 8.1 0 14.5 6.5 14.5 14.5z\"/>\n  </symbol>\n\n<symbol id=\"ef-cube-p4\" viewBox=\"1423.36 860.8 503.07 322.3\">\n    <path fill=\"currentColor\" d=\"M1821 875.8v111.6c0 8 6.5 14.5 14.5 14.5 4.2 0 8.1-1.9 10.9-5 6.8-7.5 16.7-12.3 27.7-12.3 22 0 39.6 19 37.1 41.6-1.9 16.7-15.2 30.5-32 32.7-13 1.7-24.8-3.3-32.7-11.9-2.8-3.2-6.8-5-11-5-8 0-14.5 6.4-14.5 14.4v111.7h-111.6c-8 0-14.5-6.5-14.5-14.5 0-4.2 1.9-8.2 5-11 8.7-7.9 13.7-19.7 12-32.7-2.3-16.8-16-30.1-32.8-32-22.5-2.5-41.5 15.1-41.5 37.1 0 11 4.7 20.9 12.3 27.7 3.1 2.8 4.9 6.7 4.9 10.8v0.1c0 8-6.4 14.5-14.5 14.5h-111.6v-111.7c0-8-6.4-14.4-14.5-14.4-4.1 0-8 1.8-10.8 4.9-6.9 7.6-16.7 12.3-27.7 12.3-22 0-39.6-19-37.1-41.6 1.9-16.7 15.2-30.4 32-32.7 13-1.7 24.8 3.3 32.7 11.9 2.8 3.2 6.7 5.1 10.9 5.1 8.1 0 14.5-6.5 14.5-14.5v-111.6z\"/>\n  </symbol>\n\n<symbol id=\"ef-cube-p8\" viewBox=\"1513.7 166.86 322.3 503.06\">\n    <path fill=\"currentColor\" d=\"M1528.7 564.5v-111.6c0-8 6.5-14.5 14.5-14.5 4.2 0 8.2 1.9 11 5 7.8 8.7 19.7 13.7 32.7 11.9 16.8-2.2 30.1-15.9 32-32.7 2.5-22.5-15.1-41.5-37.1-41.5-11 0-20.9 4.7-27.7 12.3-2.8 3.1-6.7 4.9-10.9 4.9-8 0-14.5-6.5-14.5-14.5v-111.6h111.6c8.1 0 14.5-6.5 14.5-14.5 0-4.1-1.8-8.1-4.9-10.9-7.6-6.8-12.3-16.6-12.3-27.6 0-22 19-39.6 41.5-37.1 16.8 1.8 30.5 15.2 32.8 32 1.7 12.9-3.3 24.8-12 32.7-3.1 2.8-5 6.7-5 10.9 0 8 6.5 14.5 14.5 14.5h111.6v111.6c0 8-6.4 14.5-14.5 14.5-4.2 0-8.1-1.9-10.9-5-7.9-8.7-19.7-13.6-32.7-11.9-16.8 2.2-30.1 15.9-32 32.7-2.5 22.5 15.1 41.6 37.1 41.6 11 0 20.8-4.8 27.7-12.3 2.8-3.1 6.7-5 10.8-5 8.1 0 14.5 6.5 14.5 14.5v111.6h-111.6c-8 0-14.5 6.5-14.5 14.5 0 4.2 1.9 8.1 5 10.9 7.5 6.8 12.3 16.7 12.3 27.7 0 22-19 39.5-41.6 37.1-16.8-1.9-30.5-15.3-32.7-32-1.7-13 3.3-24.9 11.9-32.7 3.1-2.9 5-6.8 5-11 0-8-6.4-14.5-14.5-14.5z\"/>\n  </symbol></defs></svg>\n<div class=\"ef-cube\">\n  <div class=\"ef-cube__stage\" tabindex=\"0\" role=\"group\" aria-roledescription=\"carousel\" aria-label=\"Four scenes on a rotating cube. Use the buttons or left and right arrow keys.\">\n    <div class=\"ef-cube__cube\"></div>\n    <div class=\"ef-cube__ui\">\n      <button type=\"button\" class=\"ef-cube__btn\" data-dir=\"-1\" aria-label=\"Previous scene\">&#8592;</button>\n      <div class=\"ef-cube__dots\"></div>\n      <button type=\"button\" class=\"ef-cube__btn\" data-dir=\"1\" aria-label=\"Next scene\">&#8594;</button>\n    </div>\n    <p class=\"ef-cube__live\" aria-live=\"polite\"></p>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-cube { width: 100%; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-cube__stage { position: relative; box-sizing: border-box; width: 100%; height: 30rem; border-radius: 1rem; overflow: hidden; background: #0c1e18; perspective: var(--persp, 900px); touch-action: pan-y; outline: none; }\n.ef-cube__stage:focus-visible { box-shadow: inset 0 0 0 2px var(--ef-acc, #e6ff55); }\n.ef-cube__cube { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }\n.ef-cube__face { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 1.6rem 1.6rem 4.6rem; box-sizing: border-box; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--bg, #005236); color: var(--fg, #fbf8f1); }\n.ef-cube__art { position: absolute; right: 6%; top: 8%; width: 58%; height: 58%; color: var(--art, #e6ff55); opacity: 0.95; }\n.ef-cube__no { position: absolute; left: 1.6rem; top: 1.4rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.8; }\n.ef-cube__t { position: relative; margin: 0; font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1; font-weight: 800; letter-spacing: -0.03em; }\n.ef-cube__s { position: relative; margin: 0.5rem 0 0; max-width: 20rem; font-size: 0.9rem; line-height: 1.4; opacity: 0.85; }\n.ef-cube__ui { position: absolute; left: 0; right: 0; bottom: 1rem; display: flex; align-items: center; justify-content: center; gap: 0.9rem; }\n.ef-cube__btn { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1.5px solid #fbf8f1; background: rgba(12, 30, 24, 0.55); color: #fbf8f1; font-size: 1.05rem; line-height: 1; cursor: pointer; transition: background 200ms, color 200ms; }\n.ef-cube__btn:hover { background: var(--ef-acc, #e6ff55); color: #0c1e18; border-color: var(--ef-acc, #e6ff55); }\n.ef-cube__btn:focus-visible, .ef-cube__dot:focus-visible { outline: 2px solid var(--ef-acc, #e6ff55); outline-offset: 2px; }\n.ef-cube__dots { display: flex; gap: 0.5rem; padding: 0.7rem 0.9rem; border-radius: 999px; background: rgba(12, 30, 24, 0.72); }\n.ef-cube__dot { width: 0.7rem; height: 0.7rem; padding: 0; border-radius: 50%; border: 1.5px solid #fbf8f1; background: transparent; cursor: pointer; transition: background 200ms, transform 200ms; }\n.ef-cube__dot[aria-current=\"true\"] { background: var(--ef-acc, #e6ff55); border-color: var(--ef-acc, #e6ff55); transform: scale(1.2); }\n.ef-cube__live { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n@media (prefers-reduced-motion: reduce) { .ef-cube__btn, .ef-cube__dot { transition: none; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Cube page transition: four scenes sit on the faces of a 3D cube; buttons, dots, arrow keys, swipe or wheel turn it to the next scene.\n// The cube dips back and tilts a little mid-turn so it reads like a page change. Reduced motion: scenes switch instantly with no turn.\n// mount(root, { duration (ms), dip (px pushed back mid-turn), tilt (deg), perspective (px), accent }) -> { update, destroy, go }\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var stage = root.querySelector(\".ef-cube__stage\");\n  var cube = root.querySelector(\".ef-cube__cube\");\n  var dotsBox = root.querySelector(\".ef-cube__dots\");\n  var live = root.querySelector(\".ef-cube__live\");\n  var opts = {}, offs = [], faces = [], dots = [], angle = 0, step = 0, raf = 0, wheelAt = 0, down = null, ro = null;\n  var SCENES = [\n    { t: \"Match\", s: \"Pieces that fit are easier to find than you think.\", bg: \"#005236\", fg: \"#fbf8f1\", art: \"#e6ff55\", p: \"p1\" },\n    { t: \"Connect\", s: \"Wide pieces bridge two ideas into one clean shape.\", bg: \"#c6f26b\", fg: \"#0c1e18\", art: \"#005236\", p: \"p4\" },\n    { t: \"Build\", s: \"Tall pieces stack. Each one carries the next.\", bg: \"#0a6b46\", fg: \"#fbf8f1\", art: \"#fbf8f1\", p: \"p8\" },\n    { t: \"Finish\", s: \"The last turn lands where the first one began.\", bg: \"#fbf8f1\", fg: \"#0c1e18\", art: \"#2f7d5b\", p: \"p1\" }\n  ];\n  var half = 300, w = 600;\n\n  function build() {\n    cube.textContent = \"\"; dotsBox.textContent = \"\"; faces = []; dots = [];\n    SCENES.forEach(function (sc, i) {\n      var f = document.createElement(\"section\");\n      f.className = \"ef-cube__face\";\n      f.setAttribute(\"aria-label\", \"Scene \" + (i + 1) + \" of 4: \" + sc.t);\n      f.style.setProperty(\"--bg\", sc.bg); f.style.setProperty(\"--fg\", sc.fg); f.style.setProperty(\"--art\", i === 0 ? opts.accent : sc.art);\n      f.innerHTML = '<span class=\"ef-cube__no\">0' + (i + 1) + ' / 04</span><svg class=\"ef-cube__art\" aria-hidden=\"true\" focusable=\"false\"><use href=\"#ef-cube-' + sc.p + '\" width=\"100%\" height=\"100%\"/></svg><h3 class=\"ef-cube__t\">' + sc.t + '</h3><p class=\"ef-cube__s\">' + sc.s + '</p>';\n      cube.appendChild(f); faces.push(f);\n      var d = document.createElement(\"button\");\n      d.type = \"button\"; d.className = \"ef-cube__dot\"; d.setAttribute(\"aria-label\", \"Go to scene \" + (i + 1) + \": \" + sc.t);\n      var h = function () { go(i); };\n      d.addEventListener(\"click\", h);\n      offs.push(function () { d.removeEventListener(\"click\", h); });\n      dotsBox.appendChild(d); dots.push(d);\n    });\n    layout(); mark();\n  }\n  function layout() {\n    w = stage.clientWidth || 600; half = w / 2;\n    stage.style.setProperty(\"--persp\", Math.round(w * opts.perspective / 600) + \"px\");\n    for (var i = 0; i < faces.length; i++) faces[i].style.transform = \"rotateY(\" + i * 90 + \"deg) translateZ(\" + half + \"px)\";\n    paint(angle, 0);\n  }\n  function paint(a, t) {\n    var dip = Math.sin(Math.PI * t);\n    cube.style.transform = \"translateZ(\" + (-half - dip * opts.dip).toFixed(1) + \"px) rotateX(\" + (dip * opts.tilt).toFixed(2) + \"deg) rotateY(\" + (-a).toFixed(2) + \"deg)\";\n  }\n  function idx() { return ((step % 4) + 4) % 4; }\n  function mark() {\n    var cur = idx();\n    faces.forEach(function (f, i) {\n      if (i === cur) { f.removeAttribute(\"aria-hidden\"); if (\"inert\" in f) f.inert = false; }\n      else { f.setAttribute(\"aria-hidden\", \"true\"); if (\"inert\" in f) f.inert = true; }\n    });\n    dots.forEach(function (d, i) { if (i === cur) d.setAttribute(\"aria-current\", \"true\"); else d.removeAttribute(\"aria-current\"); });\n    live.textContent = \"Scene \" + (cur + 1) + \" of 4: \" + SCENES[cur].t;\n  }\n  function ease(t) { return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; }\n  function turn(toStep) {\n    if (raf) { cancelAnimationFrame(raf); raf = 0; }\n    step = toStep; mark();\n    var to = toStep * 90;\n    if (reduce || opts.duration < 30) { angle = to; paint(angle, 0); return; }\n    var from = angle, t0 = performance.now();\n    function tick(now) {\n      var p = Math.min(1, (now - t0) / opts.duration);\n      angle = from + (to - from) * ease(p);\n      paint(angle, p);\n      if (p < 1) raf = requestAnimationFrame(tick); else { raf = 0; angle = to; paint(angle, 0); }\n    }\n    raf = requestAnimationFrame(tick);\n  }\n  function go(i) {\n    var cur = idx(), diff = ((i - cur + 6) % 4) - 2;\n    if (diff === -2) diff = 2;\n    if (diff !== 0) turn(step + diff);\n  }\n  function by(d) { turn(step + d); }\n\n  function key(e) {\n    var d = e.key === \"ArrowRight\" || e.key === \"ArrowDown\" ? 1 : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\" ? -1 : 0;\n    if (!d) return;\n    e.preventDefault(); by(d);\n  }\n  function btn(e) {\n    var b = e.target.closest ? e.target.closest(\".ef-cube__btn\") : null;\n    if (b) by(parseInt(b.getAttribute(\"data-dir\"), 10));\n  }\n  function pd(e) { if (e.target.closest && e.target.closest(\"button\")) return; down = { x: e.clientX, y: e.clientY }; }\n  function pu(e) {\n    if (!down) return;\n    var dx = e.clientX - down.x, dy = e.clientY - down.y;\n    down = null;\n    if (Math.abs(dx) > 50 && Math.abs(dx) > Math.abs(dy)) by(dx < 0 ? 1 : -1);\n  }\n  function wheel(e) {\n    e.preventDefault();\n    var now = performance.now();\n    if (now - wheelAt < Math.max(400, opts.duration * 0.8)) return;\n    var d = Math.abs(e.deltaY) > Math.abs(e.deltaX) ? e.deltaY : e.deltaX;\n    if (Math.abs(d) < 4) return;\n    wheelAt = now; by(d > 0 ? 1 : -1);\n  }\n  function on(el, ev, fn, op) { el.addEventListener(ev, fn, op); offs.push(function () { el.removeEventListener(ev, fn, op); }); }\n  on(stage, \"keydown\", key);\n  on(stage, \"click\", btn);\n  on(stage, \"pointerdown\", pd);\n  on(stage, \"pointerup\", pu);\n  on(stage, \"pointercancel\", function () { down = null; });\n  on(stage, \"wheel\", wheel, { passive: false });\n  if (window.ResizeObserver) { ro = new ResizeObserver(function () { layout(); }); ro.observe(stage); }\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ duration: 900, dip: 140, tilt: 6, perspective: 900, accent: \"#e6ff55\" }, opts, next || {});\n    stage.style.setProperty(\"--ef-acc\", opts.accent);\n    if (!faces.length || prev.accent !== opts.accent) build(); else layout();\n  }\n  update(o);\n  return { update: update, go: go, destroy: function () { if (raf) cancelAnimationFrame(raf); raf = 0; offs.forEach(function (f) { f(); }); offs = []; if (ro) ro.disconnect(); } };\n}"
  }
}