{
  "id": "stack-to-grid-intro",
  "kind": "element",
  "title": "Stack to grid intro",
  "summary": "A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.",
  "url": "https://enrichr.dev/elements/stack-to-grid-intro.html",
  "section": "gallery",
  "techniques": [
    "reveal",
    "stagger",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS",
    "SVG"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "polished",
    "playful",
    "kinetic"
  ],
  "intents": [
    "image stack to grid intro animation",
    "tiles scatter then land in a grid",
    "gallery intro with stacked cards",
    "title letters spread apart reveal",
    "grid hover zoom with inner image scale"
  ],
  "status": "tested",
  "params": [
    {
      "key": "title",
      "label": "Title",
      "type": "text",
      "value": "Stack"
    },
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "count",
      "label": "Tiles",
      "type": "range",
      "min": 4,
      "max": 9,
      "step": 1,
      "value": 6
    },
    {
      "key": "scatter",
      "label": "Scatter distance (%)",
      "type": "range",
      "min": 0,
      "max": 300,
      "step": 10,
      "value": 100
    },
    {
      "key": "speed",
      "label": "Speed",
      "type": "range",
      "min": 0.5,
      "max": 2,
      "step": 0.1,
      "value": 1
    }
  ],
  "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 \"Stack to grid intro\" element to this project.\n\nThis is the \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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/stack-to-grid-intro.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 \"Stack to grid intro\" 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 \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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 \"Stack to grid intro\" element to this codebase.\n\nThis is the \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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-stack-to-grid-intro.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Stack to grid intro 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 \"Stack to grid intro\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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- stack-to-grid-intro.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 \"./stack-to-grid-intro\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function StackToGridIntro(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 \"Stack to grid intro\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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- stack-to-grid-intro.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/StackToGridIntro.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./stack-to-grid-intro\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function StackToGridIntro(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 \"Stack to grid intro\" element.\n\nThis is the \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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), stack-to-grid-intro.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 \"Stack to grid intro\" element. No packages, no server code.\n\nThis is the \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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 stack-to-grid-intro.js and then main.js), style.css (the CSS below), stack-to-grid-intro.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 \"Stack to grid intro\" 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 \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.json\n\nWhat it does: This is a vanilla port of the Codrops intro, with no GSAP. Every tile keeps a small state object (x, y, scale, rotation, opacity, inner scale) and one requestAnimationFrame loop tweens those numbers with expo and power eases. First the script measures each grid cell and moves every tile to the centre of the stage at 0.6 scale and a random tilt, so they appear one after another as a pile. Then the title letters slide outward from the middle and fade, all tiles except the first fly off by a random distance and fade, reappear in their own cell at 0.8 scale and settle to 1, while the first tile flies straight in and its inner art scales from 1.8 down to 1 for the reveal. Captions fade in last. After the intro a hover or focus pushes the tile to 0.95 and zooms the art inside to 1.2.\nAccessibility: Tiles are buttons with labels, and keyboard focus triggers the same push-in and zoom as hover, plus a visible focus ring. The big title is decorative and hidden from screen readers. The Replay button is a real button. With reduced motion the stack is skipped: the grid just fades in and the hover movement is off.\n\nTunable settings:\n- Title: text, default Stack\n- Accent colour: color, default #e6ff55\n- Tiles: range 4 to 9, step 1, default 6\n- Scatter distance (%): range 0 to 300, step 10, default 100\n- Speed: range 0.5 to 2, step 0.1, default 1\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/stack-to-grid-intro.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 \"Stack to grid intro\" 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 \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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 StackToGridIntro.\n2. Paste the JavaScript below into a separate code file named stack-to-grid-intro.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 \"./stack-to-grid-intro\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function StackToGridIntro(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(StackToGridIntro, {\n  title: { type: ControlType.String, title: \"Title\", defaultValue: \"Stack\" },\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  count: { type: ControlType.Number, title: \"Tiles\", min: 4, max: 9, step: 1, defaultValue: 6 },\n  scatter: { type: ControlType.Number, title: \"Scatter distance\", min: 0, max: 300, step: 10, defaultValue: 100 },\n  speed: { type: ControlType.Number, title: \"Speed\", min: 0.5, max: 2, step: 0.1, defaultValue: 1 },\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 \"Stack to grid intro\" 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 \"Stack to grid intro\" element from the Enrichr Library: A pile of tiles sits under a big title, then the letters spread apart, the pile scatters and every tile lands in its grid cell, with a hover zoom afterwards.\nPage: https://enrichr.dev/elements/stack-to-grid-intro.html\nMachine-readable spec: https://enrichr.dev/elements/stack-to-grid-intro.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-stack-to-grid-intro\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-stack-to-grid-intro\"), { ...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 with labels, and keyboard focus triggers the same push-in and zoom as hover, plus a visible focus ring. The big title is decorative and hidden from screen readers. The Replay button is a real button. With reduced motion the stack is skipped: the grid just fades in and the hover movement is off.",
  "performance": "Only transform and opacity change, on a handful of elements, and the rAF loop stops as soon as the last tween ends. Measuring happens once per replay. Keep the tile count modest if you swap the gradients for large photos, and give photos explicit sizes so the stack position is measured correctly.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/myWajNQ",
  "source": {
    "markup": "<div class=\"ef-stg\">\n  <div class=\"ef-stg__stage\">\n    <svg class=\"ef-stg__defs\" width=\"0\" height=\"0\" aria-hidden=\"true\" focusable=\"false\">\n      <symbol id=\"efstg-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=\"efstg-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=\"efstg-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    </svg>\n    <div class=\"ef-stg__grid\"></div>\n    <h3 class=\"ef-stg__title\" aria-hidden=\"true\"></h3>\n    <button type=\"button\" class=\"ef-stg__replay\">Replay</button>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n/* Adapted from https://github.com/codrops/ImageStackGrid (MIT) — Copyright (c) 2009 - 2020 [Codrops](https://tympanus.net/codrops) */\n.ef-stg { width: 100%; height: 100%; }\n.ef-stg__stage { --ef-bg: #0c1e18; --ef-fg: #fbf8f1; --ef-acc: #e6ff55; position: relative; box-sizing: border-box; width: 100%; height: 100%; min-height: 28rem; overflow: hidden; background: var(--ef-bg); color: var(--ef-fg); container-type: inline-size; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-stg__defs { position: absolute; width: 0; height: 0; overflow: hidden; }\n.ef-stg__grid { position: absolute; inset: 0; display: grid; justify-content: center; align-content: center; gap: 10px; padding: 20px; }\n.ef-stg__tile { position: relative; display: block; box-sizing: border-box; width: var(--tw); height: var(--th); margin: 0; padding: 0; border: 0; border-radius: 6px; overflow: hidden; cursor: pointer; color: inherit; font: inherit; text-align: left; background: #005236; will-change: transform, opacity; outline: none; }\n.ef-stg__tile.is-stacked { cursor: default; }\n.ef-stg__tile:focus-visible { box-shadow: 0 0 0 2px var(--ef-bg), 0 0 0 4px var(--ef-acc); }\n.ef-stg__in { position: absolute; inset: 0; overflow: hidden; will-change: transform; }\n.ef-stg__pc { position: absolute; left: 50%; top: 46%; width: 62%; height: 62%; margin: -31% 0 0 -31%; opacity: 0.92; }\n.ef-stg__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6rem 0.55rem 0.5rem; background: linear-gradient(180deg, transparent, rgba(12, 30, 24, 0.78)); color: #fbf8f1; pointer-events: none; }\n.ef-stg__num { display: block; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.16em; opacity: 0.85; }\n.ef-stg__name { display: block; font-size: 0.85rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }\n.ef-stg__title { position: absolute; inset: 0; z-index: 2; margin: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(2rem, 17cqw, 5.4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--ef-acc); pointer-events: none; text-shadow: 0 2px 24px rgba(12, 30, 24, 0.5); }\n.ef-stg__ch { display: inline-block; white-space: pre; will-change: transform, opacity; }\n.ef-stg__replay { position: absolute; z-index: 3; right: 0.7rem; bottom: 0.7rem; padding: 0.4rem 0.8rem; border: 1px solid var(--ef-fg); border-radius: 99px; background: transparent; color: var(--ef-fg); font: inherit; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: background 200ms, color 200ms; }\n.ef-stg__replay:hover { background: var(--ef-acc); color: #0c1e18; border-color: var(--ef-acc); }\n.ef-stg__replay:focus-visible { outline: 2px solid var(--ef-acc); outline-offset: 2px; }\n@media (prefers-reduced-motion: reduce) { .ef-stg__replay { transition: none; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Adapted from https://github.com/codrops/ImageStackGrid (MIT) — Copyright (c) 2009 - 2020 [Codrops](https://tympanus.net/codrops)\n// Stack to grid intro: tiles pile up in the centre at random angles under a big title, then the title letters spread out, the pile\n// scatters and every tile lands in its grid cell (the first one flies straight in with a zoom-out reveal). Hover or focus pushes a tile in\n// and zooms its art. Vanilla port: one rAF tween loop, no animation library. Replay button restarts it; reduced motion shows the final grid.\n// mount(root, { title, accent, count (4-9), scatter (0-300 %), speed (0.5-2) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var stage = root.querySelector(\".ef-stg__stage\");\n  var grid = root.querySelector(\".ef-stg__grid\");\n  var titleEl = root.querySelector(\".ef-stg__title\");\n  var replay = root.querySelector(\".ef-stg__replay\");\n  var opts = {}, tiles = [], chars = [], tw = [], offs = [], raf = 0, phase = \"idle\", ro = null, dead = false, timer = 0;\n  var NAMES = [\"Tidal\", \"Ember\", \"Moss\", \"Dusk\", \"Arch\", \"Grain\", \"Haze\", \"Loop\", \"Fern\"];\n  var PIECES = [\"efstg-p1\", \"efstg-p4\", \"efstg-p8\"];\n\n  function expo(t) { return t >= 1 ? 1 : 1 - Math.pow(2, -10 * t); }\n  function p3(t) { return 1 - Math.pow(1 - t, 4); }\n  function p1(t) { return 1 - (1 - t) * (1 - t); }\n  function rnd(a, b) { return a + Math.random() * (b - a); }\n\n  function art(i, a) {\n    var p = i % 4;\n    if (p === 0) return \"linear-gradient(160deg, #0a6b46, #005236)\";\n    if (p === 1) return \"radial-gradient(circle at 72% 24%, \" + a + \" 0 20%, transparent 21%), linear-gradient(200deg, #2f7d5b, #0c1e18)\";\n    if (p === 2) return \"linear-gradient(145deg, #c6f26b, #2f7d5b)\";\n    return \"repeating-linear-gradient(120deg, #005236 0 10px, #0c1e18 10px 20px)\";\n  }\n\n  /* tween loop */\n  function go(st, key, to, delay, dur, ease, fromVal, replace) {\n    if (replace) tw = tw.filter(function (a) { return !(a.st === st && a.key === key); });\n    tw.push({ st: st, key: key, to: to, t0: performance.now() + delay, dur: Math.max(1, dur), ease: ease, fv: fromVal, from: null });\n    kick();\n  }\n  function at(delay, fn) { tw.push({ fn: fn, t0: performance.now() + delay }); kick(); }\n  function kick() { if (!raf && !dead) raf = requestAnimationFrame(tick); }\n  function tick(now) {\n    raf = 0;\n    for (var i = 0; i < tw.length; i++) {\n      var a = tw[i];\n      if (now < a.t0) continue;\n      if (a.fn) { a.done = true; a.fn(); continue; }\n      if (a.from === null) a.from = a.fv !== undefined ? a.fv : a.st[a.key];\n      var p = Math.min(1, (now - a.t0) / a.dur);\n      a.st[a.key] = a.from + (a.to - a.from) * a.ease(p);\n      if (p >= 1) a.done = true;\n    }\n    tw = tw.filter(function (a) { return !a.done; });\n    renderAll();\n    if (tw.length) raf = requestAnimationFrame(tick);\n  }\n  function renderAll() {\n    tiles.forEach(function (t) {\n      var s = t.st;\n      t.el.style.transform = \"translate3d(\" + s.x.toFixed(1) + \"px,\" + s.y.toFixed(1) + \"px,0) rotate(\" + s.r.toFixed(2) + \"deg) scale(\" + s.s.toFixed(3) + \")\";\n      t.el.style.opacity = s.o.toFixed(3);\n      t.inner.style.transform = \"scale(\" + s.is.toFixed(3) + \")\";\n      t.cap.style.opacity = s.co.toFixed(3);\n    });\n    chars.forEach(function (c) {\n      c.node.style.transform = \"translate3d(\" + c.st.x.toFixed(1) + \"px,\" + c.st.y.toFixed(1) + \"px,0)\";\n      c.node.style.opacity = c.st.o.toFixed(3);\n    });\n  }\n  function stop() {\n    if (raf) cancelAnimationFrame(raf);\n    raf = 0; tw = []; clearTimeout(timer);\n  }\n\n  /* layout */\n  function layout() {\n    var W = stage.clientWidth, H = stage.clientHeight, n = opts.count;\n    var cols = n <= 4 ? 2 : n <= 6 ? 3 : n <= 8 ? 4 : 3;\n    var rows = Math.ceil(n / cols), pad = 20, gap = 10;\n    var tw0 = Math.min((W - pad * 2 - gap * (cols - 1)) / cols, ((H - pad * 2 - gap * (rows - 1)) / rows) * 0.75);\n    tw0 = Math.max(40, tw0);\n    grid.style.gridTemplateColumns = \"repeat(\" + cols + \", \" + tw0.toFixed(1) + \"px)\";\n    grid.style.setProperty(\"--tw\", tw0.toFixed(1) + \"px\");\n    grid.style.setProperty(\"--th\", (tw0 / 0.75).toFixed(1) + \"px\");\n  }\n  function measure() {\n    tiles.forEach(function (t) { t.el.style.transform = \"none\"; });\n    var sr = stage.getBoundingClientRect();\n    tiles.forEach(function (t) {\n      var r = t.el.getBoundingClientRect();\n      t.w = r.width; t.h = r.height;\n      t.dx = sr.left + sr.width / 2 - (r.left + r.width / 2);\n      t.dy = sr.top + sr.height / 2 - (r.top + r.height / 2);\n    });\n  }\n\n  /* build */\n  function build() {\n    stop();\n    grid.textContent = \"\"; tiles = [];\n    titleEl.textContent = \"\"; chars = [];\n    layout();\n    var t = String(opts.title || \"\");\n    for (var c = 0; c < t.length; c++) {\n      var sp = document.createElement(\"span\");\n      sp.className = \"ef-stg__ch\"; sp.textContent = t[c];\n      titleEl.appendChild(sp);\n      chars.push({ node: sp, st: { x: 0, y: 0, o: 1 } });\n    }\n    for (var i = 0; i < opts.count; i++) (function (i) {\n      var el = document.createElement(\"button\");\n      el.type = \"button\"; el.className = \"ef-stg__tile\";\n      el.setAttribute(\"aria-label\", \"Piece \" + (i + 1) + \": \" + NAMES[i % NAMES.length]);\n      var inner = document.createElement(\"span\"); inner.className = \"ef-stg__in\";\n      inner.style.background = art(i, opts.accent);\n      var svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n      svg.setAttribute(\"class\", \"ef-stg__pc\"); svg.setAttribute(\"aria-hidden\", \"true\");\n      svg.style.color = i % 4 === 2 ? \"#0c1e18\" : i % 2 ? \"#fbf8f1\" : opts.accent;\n      svg.style.transform = \"rotate(\" + ((i % 5) - 2) * 7 + \"deg)\";\n      var use = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n      use.setAttribute(\"href\", \"#\" + PIECES[i % 3]);\n      svg.appendChild(use); inner.appendChild(svg);\n      var cap = document.createElement(\"span\"); cap.className = \"ef-stg__cap\";\n      var num = document.createElement(\"span\"); num.className = \"ef-stg__num\"; num.textContent = String(i + 1).padStart(2, \"0\");\n      var nm = document.createElement(\"span\"); nm.className = \"ef-stg__name\"; nm.textContent = NAMES[i % NAMES.length];\n      cap.appendChild(num); cap.appendChild(nm);\n      el.appendChild(inner); el.appendChild(cap);\n      var tile = { el: el, inner: inner, cap: cap, w: 0, h: 0, dx: 0, dy: 0, st: { x: 0, y: 0, s: 1, r: 0, o: 1, is: 1, co: 1 } };\n      function hin() { hover(tile, true); }\n      function hout() { hover(tile, false); }\n      el.addEventListener(\"pointerenter\", hin); el.addEventListener(\"pointerleave\", hout);\n      el.addEventListener(\"focus\", hin); el.addEventListener(\"blur\", hout);\n      offs.push(function () { el.removeEventListener(\"pointerenter\", hin); el.removeEventListener(\"pointerleave\", hout); el.removeEventListener(\"focus\", hin); el.removeEventListener(\"blur\", hout); });\n      grid.appendChild(el); tiles.push(tile);\n    })(i);\n    renderAll();\n  }\n  function hover(t, on) {\n    if (phase !== \"grid\" || reduce) return;\n    var d = 900 / opts.speed;\n    go(t.st, \"s\", on ? 0.95 : 1, 0, d, expo, undefined, true);\n    go(t.st, \"is\", on ? 1.2 : 1, 0, d, expo, undefined, true);\n  }\n\n  /* the intro */\n  function play() {\n    stop();\n    var n = tiles.length, D = 1000 / opts.speed;\n    layout(); measure();\n    tiles.forEach(function (t) { t.el.classList.remove(\"is-stacked\"); });\n    if (reduce) {\n      phase = \"grid\";\n      tiles.forEach(function (t) { var s = t.st; s.x = 0; s.y = 0; s.s = 1; s.r = 0; s.is = 1; s.co = 1; s.o = 0; go(s, \"o\", 1, 0, 300, p1); });\n      chars.forEach(function (c) { c.st.o = 0; });\n      renderAll();\n      return;\n    }\n    phase = \"stack\";\n    tiles.forEach(function (t, i) {\n      var s = t.st;\n      s.x = t.dx; s.y = t.dy; s.s = 0.6; s.r = rnd(-10, 10); s.o = 0; s.is = i === 0 ? 1.8 : 1; s.co = 0;\n      t.el.classList.add(\"is-stacked\");\n      go(s, \"o\", 1, 0.2 * i * D, 1, p1);\n    });\n    chars.forEach(function (c) { c.st.x = 0; c.st.y = 14; c.st.o = 0; go(c.st, \"o\", 1, 0, D, expo); go(c.st, \"y\", 0, 0, D, expo); });\n    renderAll();\n    var T = (0.2 * (n - 1) + 0.6) * D, mid = Math.floor(chars.length / 2);\n    chars.forEach(function (c, pos) {\n      var sd = (Math.abs(pos - mid) / Math.max(1, mid)) * 0.2 * D;\n      go(c.st, \"x\", -40 * (mid - pos), T + sd, D, expo);\n      go(c.st, \"o\", 0, T + sd, D, expo);\n    });\n    tiles.forEach(function (t, i) {\n      var s = t.st;\n      if (i === 0) {\n        [[\"x\", 0], [\"y\", 0], [\"s\", 1], [\"r\", 0], [\"o\", 1], [\"is\", 1]].forEach(function (k) { go(s, k[0], k[1], T, 1.2 * D, expo); });\n      } else {\n        var sc = opts.scatter / 100;\n        go(s, \"x\", s.x + rnd(-2, 2) * t.w * sc, T, D, p3);\n        go(s, \"y\", s.y + rnd(-2, 2) * t.h * sc, T, D, p3);\n        go(s, \"r\", rnd(-20, 20), T, D, p3);\n        go(s, \"o\", 0, T, D, p3);\n        at(T + D, function () { s.x = 0; s.y = 0; s.r = 0; s.s = 0.8; });\n        go(s, \"s\", 1, T + D, 0.5 * D, expo, 0.8);\n        go(s, \"o\", 1, T + D, 0.5 * D, expo, 0);\n      }\n      go(s, \"co\", 1, T + 0.3 * D + i * 0.04 * D, D, p1);\n    });\n    at(T + 1.2 * D, function () { phase = \"grid\"; tiles.forEach(function (t) { t.el.classList.remove(\"is-stacked\"); }); });\n  }\n\n  function onReplay() { play(); }\n  replay.addEventListener(\"click\", onReplay);\n  offs.push(function () { replay.removeEventListener(\"click\", onReplay); });\n  if (typeof ResizeObserver !== \"undefined\") {\n    ro = new ResizeObserver(function () {\n      if (dead || !tiles.length) return;\n      layout();\n      if (phase === \"stack\") { measure(); tiles.forEach(function (t) { t.st.x = t.dx; t.st.y = t.dy; }); }\n      renderAll();\n    });\n    ro.observe(stage);\n  }\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ title: \"Stack\", accent: \"#e6ff55\", count: 6, scatter: 100, speed: 1 }, opts, next || {});\n    opts.count = Math.max(4, Math.min(9, Math.round(opts.count)));\n    opts.scatter = Math.max(0, Math.min(300, +opts.scatter));\n    opts.speed = Math.max(0.5, Math.min(2, +opts.speed));\n    stage.style.setProperty(\"--ef-acc\", opts.accent);\n    if (prev.count !== opts.count || prev.accent !== opts.accent || prev.title !== opts.title) { build(); play(); }\n  }\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      dead = true; stop();\n      if (ro) ro.disconnect();\n      offs.forEach(function (f) { f(); }); offs = [];\n      grid.textContent = \"\"; titleEl.textContent = \"\";\n    }\n  };\n}"
  }
}