{
  "id": "scroll-spiral",
  "kind": "element",
  "title": "Scroll spiral",
  "summary": "Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.",
  "url": "https://enrichr.dev/elements/scroll-spiral.html",
  "section": "gallery",
  "techniques": [
    "3d-css",
    "scroll-driven",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "kinetic",
    "immersive",
    "playful"
  ],
  "intents": [
    "spiral scroll gallery",
    "helix carousel 3d",
    "wheel rotate 3d gallery",
    "drag to rotate card ring",
    "scroll driven 3d item list"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "count",
      "label": "Tiles",
      "type": "range",
      "min": 5,
      "max": 16,
      "step": 1,
      "value": 10
    },
    {
      "key": "radius",
      "label": "Radius (px)",
      "type": "range",
      "min": 40,
      "max": 260,
      "step": 5,
      "value": 150
    },
    {
      "key": "pitch",
      "label": "Rise per tile (px)",
      "type": "range",
      "min": 0,
      "max": 60,
      "step": 2,
      "value": 34
    },
    {
      "key": "twist",
      "label": "Twist per tile (rad)",
      "type": "range",
      "min": 0.3,
      "max": 1.2,
      "step": 0.05,
      "value": 0.7
    }
  ],
  "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 \"Scroll spiral\" element to this project.\n\nThis is the \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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/scroll-spiral.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 \"Scroll spiral\" 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 \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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 \"Scroll spiral\" element to this codebase.\n\nThis is the \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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-scroll-spiral.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Scroll spiral 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 \"Scroll spiral\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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- scroll-spiral.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 \"./scroll-spiral\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ScrollSpiral(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 \"Scroll spiral\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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- scroll-spiral.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/ScrollSpiral.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./scroll-spiral\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ScrollSpiral(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 \"Scroll spiral\" element.\n\nThis is the \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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), scroll-spiral.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 \"Scroll spiral\" element. No packages, no server code.\n\nThis is the \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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 scroll-spiral.js and then main.js), style.css (the CSS below), scroll-spiral.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 \"Scroll spiral\" 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 \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.json\n\nWhat it does: Each tile has a position along the helix, and one number, the scroll position, shifts all of them. For every tile the script works out its offset from the front, wraps it so the list loops, and turns that into an angle. The angle gives the tile's x and depth on a circle, its offset gives the vertical rise, and the front-facing amount drives the scale and opacity, so the tile in front is large and bright while the ones winding away shrink and fade. Wheel and drag add to a target position, a requestAnimationFrame loop eases toward it, and a short timer after input stops snaps the target to the nearest whole tile. The stage uses CSS perspective and the helix uses preserve-3d.\nAccessibility: The stage is focusable and the arrow keys step one tile at a time. The current tile and total are written to an aria-live label. The wheel is captured only while the pointer is over the element. Reduced motion removes the easing, so each input jumps straight to the target tile. The tiles are decorative stand-ins, so replace them with real links or buttons if the items are interactive.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Tiles: range 5 to 16, step 1, default 10\n- Radius (px): range 40 to 260, step 5, default 150\n- Rise per tile (px): range 0 to 60, step 2, default 34\n- Twist per tile (rad): range 0.3 to 1.2, step 0.05, default 0.7\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/scroll-spiral.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 \"Scroll spiral\" 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 \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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 ScrollSpiral.\n2. Paste the JavaScript below into a separate code file named scroll-spiral.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 \"./scroll-spiral\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ScrollSpiral(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(ScrollSpiral, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  count: { type: ControlType.Number, title: \"Tiles\", min: 5, max: 16, step: 1, defaultValue: 10 },\n  radius: { type: ControlType.Number, title: \"Radius\", min: 40, max: 260, step: 5, defaultValue: 150 },\n  pitch: { type: ControlType.Number, title: \"Rise per tile\", min: 0, max: 60, step: 2, defaultValue: 34 },\n  twist: { type: ControlType.Number, title: \"Twist per tile\", min: 0.3, max: 1.2, step: 0.05, defaultValue: 0.7 },\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 \"Scroll spiral\" 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 \"Scroll spiral\" element from the Enrichr Library: Tiles arranged on a 3D helix that turns and rescales as you wheel, drag or press the arrow keys, snapping to the nearest tile when you stop.\nPage: https://enrichr.dev/elements/scroll-spiral.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-spiral.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-scroll-spiral\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-scroll-spiral\"), { ...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": "The stage is focusable and the arrow keys step one tile at a time. The current tile and total are written to an aria-live label. The wheel is captured only while the pointer is over the element. Reduced motion removes the easing, so each input jumps straight to the target tile. The tiles are decorative stand-ins, so replace them with real links or buttons if the items are interactive.",
  "performance": "Per frame it writes one transform and one opacity for each tile, up to 16. The loop runs only while the position is still moving and stops once it settles. No layout reads happen in the loop.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-ssp\">\n  <div class=\"ef-ssp__stage\" tabindex=\"0\" role=\"group\" aria-label=\"Spiral gallery. Scroll, drag, or use the arrow keys to turn it.\">\n    <div class=\"ef-ssp__helix\"></div>\n    <div class=\"ef-ssp__hud\" aria-live=\"polite\"></div>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-ssp { width: 100%; }\n.ef-ssp__stage { position: relative; box-sizing: border-box; width: 100%; height: 24rem; border-radius: 1rem; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #0a6b46 0%, #005236 38%, #0c1e18 100%); color: #fbf8f1; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; perspective: 900px; perspective-origin: 50% 45%; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; outline: none; }\n.ef-ssp__stage.is-drag { cursor: grabbing; }\n.ef-ssp__stage:focus-visible { box-shadow: inset 0 0 0 3px var(--ef-acc, #e6ff55); }\n.ef-ssp__helix { position: absolute; inset: 0; transform-style: preserve-3d; }\n.ef-ssp__item { position: absolute; left: 50%; top: 50%; width: 6.4rem; height: 8rem; margin: -4rem 0 0 -3.2rem; border-radius: 0.8rem; display: grid; place-items: center; overflow: hidden; box-shadow: 0 14px 26px -12px rgba(0, 0, 0, 0.6); will-change: transform, opacity; backface-visibility: visible; }\n.ef-ssp__item svg { width: 62%; height: 62%; display: block; }\n.ef-ssp__no { position: absolute; top: 0.5rem; left: 0.6rem; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.14em; opacity: 0.8; }\n.ef-ssp__hud { position: absolute; left: 0; right: 0; bottom: 0.9rem; text-align: center; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; pointer-events: none; text-shadow: 0 2px 8px rgba(12, 30, 24, 0.7); }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Scroll spiral: tiles sit on a helix. Wheel, drag or arrow keys turn it; each tile's position, scale and opacity are recomputed from its\n// angle, so the front tile is big and bright and the ones winding away shrink and fade. Motion eases toward a target and snaps to the nearest\n// tile when input stops. Input is listened for on the element itself (not window). Reduced motion moves in instant steps.\n// An original rebuild from the general idea of a scroll-driven spiral gallery.\n// mount(root, { accent, count (5-16), radius (px), pitch (px per tile), twist (radians per tile) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var stage = root.querySelector(\".ef-ssp__stage\");\n  var helix = root.querySelector(\".ef-ssp__helix\");\n  var hud = root.querySelector(\".ef-ssp__hud\");\n  var opts = {}, offs = [], items = [], pos = 0, tgt = 0, raf = 0, snapT = 0, lastActive = -1, drag = null;\n  var NS = \"http://www.w3.org/2000/svg\";\n  var PIECES = [\n    { vb: \"1513.7 1453.9 322.3 322.3\", 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    { vb: \"1423.36 860.8 503.07 322.3\", 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    { vb: \"1513.7 166.86 322.3 503.06\", 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  ];\n  var NAMES = [\"Fold\", \"Weave\", \"Lattice\", \"Bloom\", \"Anchor\", \"Tessera\", \"Hinge\", \"Canopy\", \"Relay\", \"Grove\", \"Strand\", \"Keystone\", \"Ridge\", \"Mosaic\", \"Thread\", \"Orbit\"];\n\n  function listen(el, ev, fn, op) { el.addEventListener(ev, fn, op); offs.push(function () { el.removeEventListener(ev, fn, op); }); }\n  function colours(i) {\n    var a = opts.accent;\n    var set = [[\"#005236\", a], [a, \"#005236\"], [\"#0a6b46\", \"#fbf8f1\"], [\"#fbf8f1\", \"#2f7d5b\"], [\"#c6f26b\", \"#0c1e18\"], [\"#2f7d5b\", \"#fbf8f1\"]];\n    return set[i % set.length];\n  }\n  function build() {\n    helix.textContent = \"\";\n    items = [];\n    for (var i = 0; i < opts.count; i++) {\n      var c = colours(i), p = PIECES[i % 3];\n      var el = document.createElement(\"div\");\n      el.className = \"ef-ssp__item\";\n      el.style.background = c[0];\n      el.style.color = c[1];\n      var svg = document.createElementNS(NS, \"svg\");\n      svg.setAttribute(\"viewBox\", p.vb);\n      svg.setAttribute(\"aria-hidden\", \"true\");\n      var path = document.createElementNS(NS, \"path\");\n      path.setAttribute(\"fill\", \"currentColor\");\n      path.setAttribute(\"d\", p.d);\n      svg.appendChild(path);\n      var no = document.createElement(\"span\");\n      no.className = \"ef-ssp__no\";\n      no.textContent = String(i + 1).padStart(2, \"0\");\n      el.appendChild(svg); el.appendChild(no);\n      helix.appendChild(el);\n      items.push(el);\n    }\n    lastActive = -1;\n    render();\n  }\n  function render() {\n    var n = items.length, half = n / 2;\n    for (var i = 0; i < n; i++) {\n      var t = ((i - pos + half) % n + n) % n - half;\n      var ang = t * opts.twist;\n      var front = (Math.cos(ang) + 1) / 2;\n      var s = 0.5 + 0.55 * front;\n      var edge = 1 - Math.min(1, Math.max(0, (Math.abs(t) - (half - 1.6)) / 1.6));\n      var op = (0.22 + 0.78 * front) * edge;\n      items[i].style.transform = \"translate3d(\" + (Math.sin(ang) * opts.radius).toFixed(1) + \"px,\" + (t * opts.pitch).toFixed(1) + \"px,\" + ((Math.cos(ang) - 1) * opts.radius).toFixed(1) + \"px) rotateY(\" + ang.toFixed(3) + \"rad) scale(\" + s.toFixed(3) + \")\";\n      items[i].style.opacity = op.toFixed(3);\n      items[i].style.zIndex = String(Math.round(front * 100));\n    }\n    var act = ((Math.round(pos) % n) + n) % n;\n    if (act !== lastActive) {\n      lastActive = act;\n      hud.textContent = String(act + 1).padStart(2, \"0\") + \" / \" + String(n).padStart(2, \"0\") + \"  ·  \" + NAMES[act % NAMES.length];\n    }\n  }\n  function tick() {\n    raf = 0;\n    var d = tgt - pos;\n    if (Math.abs(d) < 0.0015) { pos = tgt; render(); return; }\n    pos += d * 0.14;\n    render();\n    raf = requestAnimationFrame(tick);\n  }\n  function kick() {\n    if (reduce) { pos = tgt; render(); return; }\n    if (!raf) raf = requestAnimationFrame(tick);\n  }\n  function snapLater() {\n    clearTimeout(snapT);\n    snapT = setTimeout(function () { tgt = Math.round(tgt); kick(); }, 140);\n  }\n  function step(d) { clearTimeout(snapT); tgt = Math.round(tgt) + d; kick(); }\n\n  function onWheel(e) {\n    e.preventDefault();\n    var k = e.deltaMode === 1 ? 16 : 1;\n    var d = (Math.abs(e.deltaY) >= Math.abs(e.deltaX) ? e.deltaY : e.deltaX) * k;\n    tgt += d * 0.0045;\n    kick(); snapLater();\n  }\n  function onDown(e) {\n    if (e.button !== undefined && e.button !== 0) return;\n    drag = { x: e.clientX, y: e.clientY, id: e.pointerId };\n    stage.classList.add(\"is-drag\");\n    try { stage.setPointerCapture(e.pointerId); } catch (x) {}\n    clearTimeout(snapT);\n  }\n  function onMove(e) {\n    if (!drag) return;\n    var dx = e.clientX - drag.x, dy = e.clientY - drag.y;\n    drag.x = e.clientX; drag.y = e.clientY;\n    tgt -= (Math.abs(dy) > Math.abs(dx) ? dy : -dx) * 0.012;\n    kick();\n  }\n  function onUp(e) {\n    if (!drag) return;\n    drag = null;\n    stage.classList.remove(\"is-drag\");\n    try { stage.releasePointerCapture(e.pointerId); } catch (x) {}\n    snapLater();\n  }\n  function onKey(e) {\n    var k = e.key;\n    if (k === \"ArrowRight\" || k === \"ArrowDown\") { e.preventDefault(); step(1); }\n    else if (k === \"ArrowLeft\" || k === \"ArrowUp\") { e.preventDefault(); step(-1); }\n  }\n  listen(stage, \"wheel\", onWheel, { passive: false });\n  listen(stage, \"pointerdown\", onDown);\n  listen(stage, \"pointermove\", onMove);\n  listen(stage, \"pointerup\", onUp);\n  listen(stage, \"pointercancel\", onUp);\n  listen(stage, \"keydown\", onKey);\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ accent: \"#e6ff55\", count: 10, radius: 150, pitch: 34, twist: 0.7 }, opts, next || {});\n    opts.count = Math.max(5, Math.min(16, Math.round(opts.count)));\n    stage.style.setProperty(\"--ef-acc\", opts.accent);\n    if (prev.count !== opts.count || prev.accent !== opts.accent) build(); else render();\n  }\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      cancelAnimationFrame(raf); raf = 0; clearTimeout(snapT);\n      offs.forEach(function (f) { f(); }); offs = [];\n    }\n  };\n}"
  }
}