{
  "id": "dome-grid-3d",
  "kind": "element",
  "title": "Dome grid 3D",
  "summary": "A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.",
  "url": "https://enrichr.dev/elements/dome-grid-3d.html",
  "section": "gallery",
  "techniques": [
    "pointer-interaction",
    "3d-css"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "immersive",
    "modern",
    "playful"
  ],
  "intents": [
    "3d sphere image grid drag",
    "dome gallery inside sphere",
    "inertia drag rotate tiles",
    "spherical grid css 3d",
    "draggable globe gallery"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "columns",
      "label": "Tiles around",
      "type": "range",
      "min": 8,
      "max": 24,
      "step": 1,
      "value": 16
    },
    {
      "key": "depth",
      "label": "Depth fade",
      "type": "range",
      "min": 0,
      "max": 1,
      "step": 0.05,
      "value": 0.5
    },
    {
      "key": "inertia",
      "label": "Inertia",
      "type": "range",
      "min": 0,
      "max": 1,
      "step": 0.05,
      "value": 0.6
    },
    {
      "key": "autoSpin",
      "label": "Auto spin",
      "type": "range",
      "min": 0,
      "max": 1,
      "step": 0.05,
      "value": 0.3
    }
  ],
  "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 \"Dome grid 3D\" element to this project.\n\nThis is the \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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/dome-grid-3d.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 \"Dome grid 3D\" 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 \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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 \"Dome grid 3D\" element to this codebase.\n\nThis is the \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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-dome-grid-3d.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Dome grid 3D 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 \"Dome grid 3D\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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- dome-grid-3d.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 \"./dome-grid-3d\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function DomeGrid3d(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 \"Dome grid 3D\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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- dome-grid-3d.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/DomeGrid3d.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./dome-grid-3d\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function DomeGrid3d(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 \"Dome grid 3D\" element.\n\nThis is the \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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), dome-grid-3d.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 \"Dome grid 3D\" element. No packages, no server code.\n\nThis is the \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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 dome-grid-3d.js and then main.js), style.css (the CSS below), dome-grid-3d.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 \"Dome grid 3D\" 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 \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.json\n\nWhat it does: Tiles are placed in rows of latitude, with fewer tiles in the rows nearer the poles so spacing stays even. Each tile gets rotateY(lon) rotateX(lat) translateZ(-radius), which puts it on the far inside of the sphere with its face pointing at the centre, so it always faces the viewer. The whole scene is one element rotated with rotateX and rotateY. Dragging adds to the two angles and records a velocity; a single requestAnimationFrame loop applies that velocity with exponential decay, and stops itself when the dome is still. Each frame the script works out how directly each tile faces the camera from its fixed direction vector and fades it with opacity, hiding the ones turned away.\nAccessibility: The dome is one focusable group with a label; arrow keys turn it, so no pointer is needed. The tiles are decorative and hidden from assistive tech. Under reduced motion there is no auto spin and no inertia: the dome moves only while dragged, and keys step it instantly. The wheel is captured only while the pointer is over the dome.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Tiles around: range 8 to 24, step 1, default 16\n- Depth fade: range 0 to 1, step 0.05, default 0.5\n- Inertia: range 0 to 1, step 0.05, default 0.6\n- Auto spin: range 0 to 1, step 0.05, default 0.3\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/dome-grid-3d.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 \"Dome grid 3D\" 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 \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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 DomeGrid3d.\n2. Paste the JavaScript below into a separate code file named dome-grid-3d.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 \"./dome-grid-3d\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function DomeGrid3d(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(DomeGrid3d, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  columns: { type: ControlType.Number, title: \"Tiles around\", min: 8, max: 24, step: 1, defaultValue: 16 },\n  depth: { type: ControlType.Number, title: \"Depth fade\", min: 0, max: 1, step: 0.05, defaultValue: 0.5 },\n  inertia: { type: ControlType.Number, title: \"Inertia\", min: 0, max: 1, step: 0.05, defaultValue: 0.6 },\n  autoSpin: { type: ControlType.Number, title: \"Auto spin\", min: 0, max: 1, step: 0.05, defaultValue: 0.3 },\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 \"Dome grid 3D\" 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 \"Dome grid 3D\" element from the Enrichr Library: A grid of puzzle-piece tiles wrapped onto the inside of a sphere that you drag to turn with inertia; tiles face the viewer and fade with depth.\nPage: https://enrichr.dev/elements/dome-grid-3d.html\nMachine-readable spec: https://enrichr.dev/elements/dome-grid-3d.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-dome-grid-3d\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-dome-grid-3d\"), { ...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 dome is one focusable group with a label; arrow keys turn it, so no pointer is needed. The tiles are decorative and hidden from assistive tech. Under reduced motion there is no auto spin and no inertia: the dome moves only while dragged, and keys step it instantly. The wheel is captured only while the pointer is over the dome.",
  "performance": "About 100 tiles with transform and opacity only, updated in one loop that sleeps when nothing moves or the element is off screen. Opacity is quantised so most frames touch few styles. Avoid blurs or large shadows on the tiles.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/pveqZMj",
  "source": {
    "markup": "<div class=\"ef-dg\">\n  <svg class=\"ef-dg__defs\" width=\"0\" height=\"0\" aria-hidden=\"true\" focusable=\"false\">\n    <defs>\n      <symbol id=\"efdg-p1\" viewBox=\"1513.7 1453.9 322.3 322.3\"><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\"/></symbol>\n      <symbol id=\"efdg-p4\" viewBox=\"1423.36 860.8 503.07 322.3\"><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\"/></symbol>\n      <symbol id=\"efdg-p8\" viewBox=\"1513.7 166.86 322.3 503.06\"><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\"/></symbol>\n    </defs>\n  </svg>\n  <div class=\"ef-dg__wrap\" tabindex=\"0\" role=\"group\" aria-roledescription=\"3D dome\" aria-label=\"Dome of puzzle tiles. Drag, scroll or use the arrow keys to rotate it.\">\n    <div class=\"ef-dg__stage\"><div class=\"ef-dg__scene\"></div></div>\n    <span class=\"ef-dg__vig\" aria-hidden=\"true\"></span>\n    <span class=\"ef-dg__hint\" aria-hidden=\"true\">Drag to turn the dome</span>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-dg { width: 100%; height: 100%; }\n.ef-dg__defs { position: absolute; width: 0; height: 0; overflow: hidden; }\n.ef-dg__wrap { --ef-acc: #e6ff55; position: relative; box-sizing: border-box; width: 100%; height: 100%; min-height: 26rem; overflow: hidden; border-radius: 1rem; background: #0c1e18; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }\n.ef-dg__wrap.is-drag { cursor: grabbing; }\n.ef-dg__wrap:focus-visible { box-shadow: inset 0 0 0 2px var(--ef-acc); }\n.ef-dg__stage { position: absolute; inset: 0; perspective: 900px; perspective-origin: 50% 50%; }\n.ef-dg__scene { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }\n.ef-dg__tile { position: absolute; left: 0; top: 0; border-radius: 12%; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 0 0 1px rgba(251, 248, 241, 0.08) inset; }\n.ef-dg__tile svg { position: absolute; left: 16%; top: 16%; width: 68%; height: 68%; display: block; overflow: visible; }\n.ef-dg__vig { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 46%, rgba(12, 30, 24, 0.85) 100%); }\n.ef-dg__hint { position: absolute; left: 50%; bottom: 0.9rem; transform: translateX(-50%); padding: 0.35rem 0.8rem; border-radius: 99px; background: rgba(12, 30, 24, 0.75); color: #fbf8f1; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; pointer-events: none; transition: opacity 400ms; }\n.ef-dg__wrap.is-used .ef-dg__hint { opacity: 0; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Dome grid 3D: puzzle-piece tiles laid out on the inside of a sphere. Every tile faces the centre, so it faces the viewer; drag to rotate the\n// dome with inertia, scroll or use the arrow keys. Tiles fade as they swing away, which sells the depth. Pure CSS 3D transforms + one rAF loop.\n// Reduced motion: no inertia, no auto-spin; the dome turns only while you drag and keys step it instantly.\n// mount(root, { accent, columns (8-24), depth (0-1 fade strength), inertia (0-1), autoSpin (0-1) })\nfunction mount(root, o) {\n  var mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n  var wrap = root.querySelector(\".ef-dg__wrap\");\n  var stage = root.querySelector(\".ef-dg__stage\");\n  var scene = root.querySelector(\".ef-dg__scene\");\n  var opts = {}, tiles = [], offs = [], raf = 0, last = 0, onScreen = true, ro = null, io = null;\n  var rx = -8, ry = 0, vx = 0, vy = 0, drag = null, dirty = true, size = { w: 0, h: 0 };\n  var D2R = Math.PI / 180;\n  var LIME = \"#e6ff55\";\n  var SYMS = [\"efdg-p1\", \"efdg-p4\", \"efdg-p8\"];\n\n  function rnd(i) { var x = Math.sin(i * 127.1 + 311.7) * 43758.5453; return x - Math.floor(x); }\n  function palette(a) {\n    return [[\"#005236\", a], [\"#0a6b46\", \"#fbf8f1\"], [\"#2f7d5b\", \"#c6f26b\"], [\"#c6f26b\", \"#005236\"], [\"#fbf8f1\", \"#0a6b46\"], [\"#0c1e18\", \"#c6f26b\"], [a, \"#0c1e18\"], [\"#005236\", \"#fbf8f1\"]];\n  }\n  function clearOffs() { offs.forEach(function (f) { f(); }); offs = []; }\n\n  function build() {\n    scene.textContent = \"\";\n    tiles = [];\n    var W = wrap.clientWidth || 520, H = wrap.clientHeight || 420;\n    size = { w: W, h: H };\n    var R = Math.max(W, H) * 0.56;\n    stage.style.perspective = Math.round(R * 1.5) + \"px\";\n    var cols = opts.columns;\n    var tw = (2 * Math.PI * R / cols) * 0.8;\n    var dLat = (tw * 1.1 / R) / D2R;\n    var latMax = 64;\n    var rows = Math.floor(2 * latMax / dLat) + 1;\n    var pal = palette(opts.accent);\n    var k = 0;\n    for (var r = 0; r < rows; r++) {\n      var lat = -latMax + r * dLat + (2 * latMax - (rows - 1) * dLat) / 2;\n      var cl = Math.cos(lat * D2R);\n      var n = Math.max(5, Math.round(cols * cl));\n      var step = 360 / n;\n      for (var c = 0; c < n; c++) {\n        var lon = c * step + (r % 2) * step / 2;\n        var t = document.createElement(\"div\");\n        t.className = \"ef-dg__tile\";\n        var pc = pal[Math.floor(rnd(k) * pal.length)];\n        t.style.width = tw.toFixed(1) + \"px\";\n        t.style.height = tw.toFixed(1) + \"px\";\n        t.style.background = pc[0];\n        t.style.color = pc[1];\n        t.style.transform = \"rotateY(\" + lon.toFixed(2) + \"deg) rotateX(\" + lat.toFixed(2) + \"deg) translateZ(\" + (-R).toFixed(1) + \"px) translate(-50%,-50%) rotate(\" + (Math.floor(rnd(k + 7) * 4) * 90) + \"deg)\";\n        var svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n        svg.setAttribute(\"aria-hidden\", \"true\");\n        var use = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n        use.setAttribute(\"href\", \"#\" + SYMS[Math.floor(rnd(k + 3) * 3)]);\n        svg.appendChild(use);\n        t.appendChild(svg);\n        scene.appendChild(t);\n        var lr = lon * D2R, ar = lat * D2R;\n        tiles.push({ el: t, x: -Math.cos(ar) * Math.sin(lr), y: Math.sin(ar), z: -Math.cos(ar) * Math.cos(lr), op: -1 });\n        k++;\n      }\n    }\n    dirty = true;\n    render();\n  }\n\n  function render() {\n    dirty = false;\n    scene.style.transform = \"rotateX(\" + rx.toFixed(2) + \"deg) rotateY(\" + ry.toFixed(2) + \"deg)\";\n    var a = rx * D2R, b = ry * D2R, sa = Math.sin(a), ca = Math.cos(a), sb = Math.sin(b), cb = Math.cos(b);\n    var span = 0.18 + 0.7 * opts.depth;\n    var start = 0.1;\n    for (var i = 0; i < tiles.length; i++) {\n      var t = tiles[i];\n      var z1 = -t.x * sb + t.z * cb;\n      var z2 = t.y * sa + z1 * ca;\n      var cs = -z2;\n      var op = cs <= start ? 0 : Math.min(1, (cs - start) / span);\n      op = Math.round(op * 50) / 50;\n      if (op !== t.op) {\n        t.op = op;\n        t.el.style.opacity = op;\n        t.el.style.visibility = op === 0 ? \"hidden\" : \"visible\";\n      }\n    }\n  }\n\n  function clampX() { rx = Math.max(-48, Math.min(48, rx)); }\n  function frame(now) {\n    raf = 0;\n    var dt = Math.min(0.05, (now - last) / 1000 || 0.016);\n    last = now;\n    var reduce = mq.matches;\n    if (!drag && !reduce) {\n      var decay = Math.exp(-dt * (9 - opts.inertia * 7.6));\n      ry += vx * dt; rx += vy * dt;\n      vx *= decay; vy *= decay;\n      if (Math.abs(vx) < 0.05) vx = 0;\n      if (Math.abs(vy) < 0.05) vy = 0;\n      if (opts.autoSpin > 0) ry += opts.autoSpin * 10 * dt;\n      clampX();\n      dirty = true;\n    }\n    if (dirty) render();\n    schedule();\n  }\n  function schedule() {\n    if (raf || !onScreen) return;\n    var moving = vx || vy || drag || dirty || (opts.autoSpin > 0 && !mq.matches);\n    if (moving) raf = requestAnimationFrame(frame);\n  }\n  function kick() { last = performance.now(); schedule(); }\n\n  // pointer drag\n  function down(e) {\n    if (e.pointerType === \"mouse\" && e.button !== 0) return;\n    drag = { id: e.pointerId, x: e.clientX, y: e.clientY, t: performance.now() };\n    vx = 0; vy = 0;\n    wrap.classList.add(\"is-drag\", \"is-used\");\n    try { wrap.setPointerCapture(e.pointerId); } catch (err) {}\n    kick();\n  }\n  function move(e) {\n    if (!drag || e.pointerId !== drag.id) return;\n    var now = performance.now();\n    var dx = e.clientX - drag.x, dy = e.clientY - drag.y;\n    var dts = Math.max(0.008, (now - drag.t) / 1000);\n    var k = 0.28;\n    ry -= dx * k; rx += dy * k;\n    clampX();\n    if (!mq.matches) {\n      vx = vx * 0.5 + (-dx * k / dts) * 0.5;\n      vy = vy * 0.5 + (dy * k / dts) * 0.5;\n      var cap = 600; vx = Math.max(-cap, Math.min(cap, vx)); vy = Math.max(-cap, Math.min(cap, vy));\n    }\n    drag.x = e.clientX; drag.y = e.clientY; drag.t = now;\n    dirty = true; schedule();\n  }\n  function up(e) {\n    if (!drag || e.pointerId !== drag.id) return;\n    if (performance.now() - drag.t > 90) { vx = 0; vy = 0; }\n    drag = null;\n    wrap.classList.remove(\"is-drag\");\n    try { wrap.releasePointerCapture(e.pointerId); } catch (err) {}\n    kick();\n  }\n  // wheel is captured only while the pointer is over the element (listener lives on it)\n  function wheel(e) {\n    e.preventDefault();\n    wrap.classList.add(\"is-used\");\n    var dx = e.deltaX, dy = e.deltaY;\n    if (e.shiftKey && !dx) { dx = dy; dy = 0; }\n    var k = e.deltaMode === 1 ? 14 : 1;\n    ry += dx * k * 0.12; rx -= dy * k * 0.12;\n    clampX();\n    dirty = true;\n    if (!mq.matches) { vx = dx * k * 0.4; vy = -dy * k * 0.4; }\n    kick();\n  }\n  function key(e) {\n    var s = 0, t = 0;\n    if (e.key === \"ArrowRight\") s = 1; else if (e.key === \"ArrowLeft\") s = -1;\n    else if (e.key === \"ArrowDown\") t = 1; else if (e.key === \"ArrowUp\") t = -1;\n    else return;\n    e.preventDefault();\n    wrap.classList.add(\"is-used\");\n    if (mq.matches) { ry += s * 18; rx += t * 12; clampX(); dirty = true; }\n    else { vx += s * 110; vy += t * 70; }\n    kick();\n  }\n\n  function attach() {\n    wrap.addEventListener(\"pointerdown\", down);\n    wrap.addEventListener(\"pointermove\", move);\n    wrap.addEventListener(\"pointerup\", up);\n    wrap.addEventListener(\"pointercancel\", up);\n    wrap.addEventListener(\"wheel\", wheel, { passive: false });\n    wrap.addEventListener(\"keydown\", key);\n    offs.push(function () {\n      wrap.removeEventListener(\"pointerdown\", down);\n      wrap.removeEventListener(\"pointermove\", move);\n      wrap.removeEventListener(\"pointerup\", up);\n      wrap.removeEventListener(\"pointercancel\", up);\n      wrap.removeEventListener(\"wheel\", wheel);\n      wrap.removeEventListener(\"keydown\", key);\n    });\n    if (window.ResizeObserver) {\n      ro = new ResizeObserver(function () {\n        if (Math.abs(wrap.clientWidth - size.w) > 2 || Math.abs(wrap.clientHeight - size.h) > 2) build();\n      });\n      ro.observe(wrap);\n    }\n    if (window.IntersectionObserver) {\n      io = new IntersectionObserver(function (en) { onScreen = en[0].isIntersecting; if (onScreen) kick(); });\n      io.observe(wrap);\n    }\n  }\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ accent: LIME, columns: 16, depth: 0.5, inertia: 0.6, autoSpin: 0.3 }, opts, next || {});\n    opts.columns = Math.max(8, Math.min(24, Math.round(opts.columns)));\n    opts.depth = Math.max(0, Math.min(1, +opts.depth));\n    opts.inertia = Math.max(0, Math.min(1, +opts.inertia));\n    opts.autoSpin = Math.max(0, Math.min(1, +opts.autoSpin));\n    wrap.style.setProperty(\"--ef-acc\", opts.accent);\n    if (prev.columns !== opts.columns || prev.accent !== opts.accent) build(); else dirty = true;\n    kick();\n  }\n  attach();\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      clearOffs();\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0; onScreen = false;\n      if (ro) ro.disconnect();\n      if (io) io.disconnect();\n      scene.textContent = \"\"; tiles = [];\n    }\n  };\n}"
  }
}