{
  "id": "make-way-grid",
  "kind": "element",
  "title": "Make way grid",
  "summary": "A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.",
  "url": "https://enrichr.dev/elements/make-way-grid.html",
  "section": "gallery",
  "techniques": [
    "pointer-interaction",
    "stagger"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "playful",
    "fluid",
    "modern"
  ],
  "intents": [
    "grid hover scale neighbours move away",
    "make way grid hover effect",
    "spring push tiles on hover",
    "gallery grid proximity displacement",
    "tile grid grows on hover"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "scale",
      "label": "Hover scale",
      "type": "range",
      "min": 1.05,
      "max": 2,
      "step": 0.05,
      "value": 1.5
    },
    {
      "key": "push",
      "label": "Push distance (px)",
      "type": "range",
      "min": 0,
      "max": 60,
      "step": 1,
      "value": 22
    },
    {
      "key": "stiffness",
      "label": "Spring stiffness",
      "type": "range",
      "min": 0.04,
      "max": 0.4,
      "step": 0.01,
      "value": 0.14
    },
    {
      "key": "columns",
      "label": "Columns",
      "type": "range",
      "min": 2,
      "max": 6,
      "step": 1,
      "value": 4
    }
  ],
  "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 \"Make way grid\" element to this project.\n\nThis is the \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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/make-way-grid.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 \"Make way grid\" 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 \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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 \"Make way grid\" element to this codebase.\n\nThis is the \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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-make-way-grid.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Make way grid 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 \"Make way grid\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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- make-way-grid.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 \"./make-way-grid\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function MakeWayGrid(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 \"Make way grid\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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- make-way-grid.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/MakeWayGrid.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./make-way-grid\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function MakeWayGrid(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 \"Make way grid\" element.\n\nThis is the \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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), make-way-grid.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 \"Make way grid\" element. No packages, no server code.\n\nThis is the \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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 make-way-grid.js and then main.js), style.css (the CSS below), make-way-grid.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 \"Make way grid\" 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 \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.json\n\nWhat it does: Each tile keeps a position, scale and velocity. When a tile is hovered or focused, the script measures every tile's centre, then works out a target for each neighbour: a direction away from the hovered tile, with a length that falls off exponentially with distance, plus extra room for the growth of the hovered tile. One requestAnimationFrame loop steps a damped spring for every tile towards its target and writes --x, --y and --s custom properties, which the stylesheet turns into a translate and scale. When all tiles settle, the loop stops. Leaving the tile sets every target back to zero and the spring eases the grid home.\nAccessibility: Tiles are buttons, so they are reachable by keyboard, and focusing a tile makes the grid react exactly as hover does, with a visible focus ring. Each tile has an aria-label. With prefers-reduced-motion the tiles do not move or scale; the hovered or focused tile only gets an accent outline. Hover is ignored for touch pointers.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Hover scale: range 1.05 to 2, step 0.05, default 1.5\n- Push distance (px): range 0 to 60, step 1, default 22\n- Spring stiffness: range 0.04 to 0.4, step 0.01, default 0.14\n- Columns: range 2 to 6, step 1, default 4\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/make-way-grid.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 \"Make way grid\" 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 \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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 MakeWayGrid.\n2. Paste the JavaScript below into a separate code file named make-way-grid.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 \"./make-way-grid\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function MakeWayGrid(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(MakeWayGrid, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  scale: { type: ControlType.Number, title: \"Hover scale\", min: 1.05, max: 2, step: 0.05, defaultValue: 1.5 },\n  push: { type: ControlType.Number, title: \"Push distance\", min: 0, max: 60, step: 1, defaultValue: 22 },\n  stiffness: { type: ControlType.Number, title: \"Spring stiffness\", min: 0.04, max: 0.4, step: 0.01, defaultValue: 0.14 },\n  columns: { type: ControlType.Number, title: \"Columns\", min: 2, max: 6, step: 1, defaultValue: 4 },\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 \"Make way grid\" 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 \"Make way grid\" element from the Enrichr Library: A grid of gradient tiles where the hovered tile grows and every neighbour is pushed aside by a spring, strongest for the closest tiles, so the grid never overlaps.\nPage: https://enrichr.dev/elements/make-way-grid.html\nMachine-readable spec: https://enrichr.dev/elements/make-way-grid.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-make-way-grid\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-make-way-grid\"), { ...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": "Tiles are buttons, so they are reachable by keyboard, and focusing a tile makes the grid react exactly as hover does, with a visible focus ring. Each tile has an aria-label. With prefers-reduced-motion the tiles do not move or scale; the hovered or focused tile only gets an accent outline. Hover is ignored for touch pointers.",
  "performance": "Only transforms are animated, and only on the tiles. Layout is measured once per hover change, not per frame, and the rAF loop sleeps when every spring has settled. Keep the tile count modest (under about 40) as every tile is updated each frame.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-mwg\">\n  <div class=\"ef-mwg__wrap\"><div class=\"ef-mwg__grid\" role=\"list\"></div></div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-mwg { width: 100%; }\n.ef-mwg__wrap { box-sizing: border-box; width: 100%; min-height: 20rem; padding: 2.6rem; border-radius: 1rem; display: flex; align-items: center; overflow: hidden; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-mwg__grid { width: 100%; display: grid; grid-template-columns: repeat(var(--ef-cols, 4), minmax(0, 1fr)); gap: 0.7rem; }\n.ef-mwg__tile { --x: 0px; --y: 0px; --s: 1; position: relative; display: block; aspect-ratio: 1; border-radius: 0.8rem; border: 0; padding: 0; color: #fbf8f1; cursor: pointer; font: inherit; text-align: left; transform: translate3d(var(--x), var(--y), 0) scale(var(--s)); will-change: transform; outline: none; box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.6); }\n.ef-mwg__tile.is-on { z-index: 2; box-shadow: 0 18px 28px -12px rgba(0, 0, 0, 0.7); }\n.ef-mwg__tile:focus-visible { z-index: 2; box-shadow: 0 0 0 2px var(--ef-acc, #e6ff55), 0 18px 28px -12px rgba(0, 0, 0, 0.7); }\n.ef-mwg__art { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }\n.ef-mwg__art::after { content: \"\"; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.55)); }\n.ef-mwg__n { position: absolute; left: 0.6rem; bottom: 0.5rem; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; }\n@media (max-width: 30rem) { .ef-mwg__wrap { padding: 1.4rem; } }\n@media (prefers-reduced-motion: reduce) { .ef-mwg__tile { transform: none; } .ef-mwg__tile.is-on, .ef-mwg__tile:focus-visible { box-shadow: 0 0 0 2px var(--ef-acc, #e6ff55); } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Make way grid: hovering (or focusing) a tile scales it up and pushes every other tile away from it, further for tiles that are close, so the grid stays intact.\n// Each tile has a small spring that chases its target offset and scale; one rAF loop runs only while something is moving. Reduced motion: no movement, just a highlight.\n// mount(root, { background, accent, scale (1.05-2), push (px), stiffness (0.04-0.4), columns (2-6) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-mwg__wrap\");\n  var grid = root.querySelector(\".ef-mwg__grid\");\n  var opts = {}, tiles = [], offs = [], raf = 0, active = -1, dead = false;\n  var NAMES = [\"Tidal\", \"Ember\", \"Moss\", \"Dusk\", \"Arch\", \"Grain\", \"Haze\", \"Loop\", \"Bloom\", \"Slate\", \"Flint\", \"Drift\"];\n\n  // Enrichr puzzle-piece artwork, inline so the code stays portable. piece(i, accent) returns an aria-hidden SVG string, a different piece per card.\n  var PIECES = [[\"1513.7 1453.9 322.3 322.3\", \"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    [\"1423.36 860.8 503.07 322.3\", \"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    [\"1513.7 166.86 322.3 503.06\", \"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  var PLACE = [[52, -16, 80, 14], [-24, 34, 96, -22], [46, 26, 74, 32], [-8, -20, 84, -12], [58, 38, 92, 24], [4, 18, 78, -32]]; // left %, top %, width %, rotate deg\n  var PCOL = [[\"#2f7d5b\", 0.95], [\"#0c1e18\", 0.8], [\"ACC\", 0.9], [\"#c6f26b\", 0.85], [\"#0a6b46\", 0.95], [\"#fbf8f1\", 0.85]];\n  function piece(i, accent, sx, ox) {\n    var p = PIECES[i % 3], q = PLACE[i % 6], c = PCOL[i % 6], k = sx || 1, o = ox || 0;\n    return '<span class=\"ef-mwg__pc\" aria-hidden=\"true\" style=\"position:absolute;left:' + (o + q[0] * k).toFixed(1) + '%;top:' + q[1] + '%;width:' + (q[2] * k).toFixed(1) + '%;transform:rotate(' + q[3] + 'deg);color:' + (c[0] === \"ACC\" ? accent : c[0]) + ';opacity:' + c[1] + ';pointer-events:none\"><svg viewBox=\"' + p[0] + '\" aria-hidden=\"true\" focusable=\"false\" style=\"display:block;width:100%;height:auto\"><path fill=\"currentColor\" d=\"' + p[1] + '\"/></svg></span>';\n  }\n  function art(i, a) {\n    var c = \"#fbf8f1\", d = \"#0c1e18\", p = i % 6;\n    if (p === 0) return \"radial-gradient(circle at 70% 30%, \" + a + \" 0 18%, transparent 19%), linear-gradient(160deg, #005236, \" + d + \")\";\n    if (p === 1) return \"conic-gradient(from 210deg at 35% 65%, #005236, \" + a + \", \" + c + \", #005236)\";\n    if (p === 2) return \"repeating-linear-gradient(120deg, #005236 0 10px, \" + d + \" 10px 20px)\";\n    if (p === 3) return \"radial-gradient(circle at 30% 35%, \" + a + \" 0 20%, transparent 21%), radial-gradient(circle at 62% 62%, \" + c + \" 0 20%, transparent 21%), linear-gradient(200deg, #0a6b46, \" + d + \")\";\n    if (p === 4) return \"linear-gradient(190deg, #005236, \" + a + \")\";\n    return \"radial-gradient(circle, \" + a + \" 0 2px, transparent 2.5px) 0 0 / 14px 14px, linear-gradient(145deg, #005236, \" + d + \")\";\n  }\n  function clear() {\n    offs.forEach(function (f) { f(); }); offs = [];\n    if (raf) cancelAnimationFrame(raf); raf = 0;\n  }\n  function measure() {\n    tiles.forEach(function (t) {\n      var w = t.el.offsetWidth;\n      t.size = w; t.cx = t.el.offsetLeft + w / 2; t.cy = t.el.offsetTop + t.el.offsetHeight / 2;\n    });\n  }\n  function setTargets() {\n    var h = active >= 0 ? tiles[active] : null;\n    tiles.forEach(function (t, i) {\n      if (!h || reduce) { t.tx = 0; t.ty = 0; t.ts = 1; return; }\n      if (i === active) { t.tx = 0; t.ty = 0; t.ts = opts.scale; return; }\n      var dx = t.cx - h.cx, dy = t.cy - h.cy, d = Math.sqrt(dx * dx + dy * dy) || 1;\n      var f = Math.exp(-d / (h.size * 1.6));\n      // every tile on a side of the grown tile yields by its extra half-size, so nothing overlaps\n      var grow = h.size * (opts.scale - 1) / 2;\n      var gx = grow * Math.max(-1, Math.min(1, dx / (h.size * 0.6)));\n      var gy = grow * Math.max(-1, Math.min(1, dy / (h.size * 0.6)));\n      var m = opts.push * (0.25 + f * 1.4);\n      t.tx = dx / d * m + gx; t.ty = dy / d * m + gy; t.ts = 1;\n    });\n    if (!raf && !dead) raf = requestAnimationFrame(tick);\n  }\n  function tick() {\n    raf = 0;\n    var k = opts.stiffness, damp = 0.78, moving = false;\n    tiles.forEach(function (t) {\n      t.vx = (t.vx + (t.tx - t.x) * k) * damp; t.vy = (t.vy + (t.ty - t.y) * k) * damp; t.vs = (t.vs + (t.ts - t.s) * k) * damp;\n      t.x += t.vx; t.y += t.vy; t.s += t.vs;\n      if (Math.abs(t.vx) + Math.abs(t.vy) + Math.abs(t.vs * 100) > 0.02 || Math.abs(t.tx - t.x) > 0.05 || Math.abs(t.ty - t.y) > 0.05 || Math.abs(t.ts - t.s) > 0.0005) moving = true;\n      else { t.x = t.tx; t.y = t.ty; t.s = t.ts; t.vx = t.vy = t.vs = 0; }\n      t.el.style.setProperty(\"--x\", t.x.toFixed(2) + \"px\");\n      t.el.style.setProperty(\"--y\", t.y.toFixed(2) + \"px\");\n      t.el.style.setProperty(\"--s\", t.s.toFixed(4));\n    });\n    if (moving && !dead) raf = requestAnimationFrame(tick);\n  }\n  function activate(i) {\n    active = i;\n    tiles.forEach(function (t, j) { t.el.classList.toggle(\"is-on\", j === i); });\n    measure(); setTargets();\n  }\n  function build() {\n    clear();\n    grid.textContent = \"\";\n    tiles = [];\n    active = -1;\n    var n = opts.columns * 3;\n    for (var i = 0; i < n; i++) (function (i) {\n      var b = document.createElement(\"button\");\n      b.type = \"button\"; b.className = \"ef-mwg__tile\"; b.setAttribute(\"role\", \"listitem\");\n      b.setAttribute(\"aria-label\", NAMES[i % NAMES.length] + \" \" + (i + 1));\n      var bg = document.createElement(\"span\"); bg.className = \"ef-mwg__art\"; bg.style.background = art(i, opts.accent);\n      bg.insertAdjacentHTML(\"beforeend\", piece(i, opts.accent));\n      var nm = document.createElement(\"span\"); nm.className = \"ef-mwg__n\"; nm.textContent = String(i + 1).padStart(2, \"0\");\n      b.appendChild(bg); b.appendChild(nm);\n      var t = { el: b, x: 0, y: 0, s: 1, vx: 0, vy: 0, vs: 0, tx: 0, ty: 0, ts: 1, cx: 0, cy: 0, size: 1 };\n      function en(e) { if (e && e.pointerType === \"touch\") return; activate(i); }\n      function lv() { if (active === i) activate(-1); }\n      b.addEventListener(\"pointerenter\", en); b.addEventListener(\"pointerleave\", lv);\n      b.addEventListener(\"focus\", en); b.addEventListener(\"blur\", lv);\n      offs.push(function () { b.removeEventListener(\"pointerenter\", en); b.removeEventListener(\"pointerleave\", lv); b.removeEventListener(\"focus\", en); b.removeEventListener(\"blur\", lv); });\n      grid.appendChild(b); tiles.push(t);\n    })(i);\n    var onResize = function () { measure(); setTargets(); };\n    window.addEventListener(\"resize\", onResize);\n    offs.push(function () { window.removeEventListener(\"resize\", onResize); });\n    measure();\n  }\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ background: \"#0c1e18\", accent: \"#e6ff55\", scale: 1.5, push: 22, stiffness: 0.14, columns: 4 }, opts, next || {});\n    opts.columns = Math.max(2, Math.min(6, Math.round(opts.columns)));\n    wrap.style.background = opts.background;\n    wrap.style.setProperty(\"--ef-acc\", opts.accent);\n    grid.style.setProperty(\"--ef-cols\", opts.columns);\n    if (prev.columns !== opts.columns || prev.accent !== opts.accent) build();\n    else if (active >= 0) setTargets();\n  }\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      dead = true; clear();\n      tiles.forEach(function (t) { t.el.style.removeProperty(\"--x\"); t.el.style.removeProperty(\"--y\"); t.el.style.removeProperty(\"--s\"); });\n    }\n  };\n}"
  }
}