{
  "id": "grid-to-slider",
  "kind": "element",
  "title": "Grid to vertical slider",
  "summary": "Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.",
  "url": "https://enrichr.dev/elements/grid-to-slider.html",
  "section": "gallery",
  "techniques": [
    "carousel",
    "stagger",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS",
    "SVG"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "polished",
    "modern",
    "fluid"
  ],
  "intents": [
    "grid to slider transition",
    "flip layout grid to vertical carousel",
    "click thumbnail expands into slider",
    "staggered layout morph from clicked item",
    "gallery grid with fullscreen slider mode"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "palette",
      "label": "Palette",
      "type": "select",
      "options": [
        [
          "forest",
          "Forest"
        ],
        [
          "ink",
          "Green"
        ],
        [
          "cream",
          "Cream"
        ]
      ],
      "value": "forest"
    },
    {
      "key": "count",
      "label": "Tiles",
      "type": "range",
      "min": 4,
      "max": 12,
      "step": 1,
      "value": 8
    },
    {
      "key": "duration",
      "label": "Duration (ms)",
      "type": "range",
      "min": 300,
      "max": 1800,
      "step": 50,
      "value": 900
    },
    {
      "key": "stagger",
      "label": "Stagger (ms)",
      "type": "range",
      "min": 0,
      "max": 80,
      "step": 2,
      "value": 20
    }
  ],
  "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 \"Grid to vertical slider\" element to this project.\n\nThis is the \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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/grid-to-slider.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 \"Grid to vertical slider\" 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 \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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 \"Grid to vertical slider\" element to this codebase.\n\nThis is the \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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-grid-to-slider.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Grid to vertical slider 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 \"Grid to vertical slider\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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- grid-to-slider.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 \"./grid-to-slider\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GridToSlider(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 \"Grid to vertical slider\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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- grid-to-slider.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/GridToSlider.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./grid-to-slider\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GridToSlider(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 \"Grid to vertical slider\" element.\n\nThis is the \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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), grid-to-slider.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 \"Grid to vertical slider\" element. No packages, no server code.\n\nThis is the \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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 grid-to-slider.js and then main.js), style.css (the CSS below), grid-to-slider.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 \"Grid to vertical slider\" 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 \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.json\n\nWhat it does: This is a vanilla port of the Codrops demo, with no GSAP or Flip plugin. Instead of letting the browser re-lay-out the tiles and recording before and after positions, the script computes both layouts itself: a centred grid of cells, and a single column where each tile sits one tile height plus a gap from the current one. Each tile is absolutely positioned and has a rectangle (x, y, width, height). When you click, every tile tweens from where it is now to its rectangle in the new layout on one requestAnimationFrame loop with a power4 in-out ease, and the start delay grows with the distance from the clicked tile so the motion ripples outward. Stepping through the slider reuses the same call with a shorter duration. Hover on the grid brightens a tile with a CSS filter transition.\nAccessibility: Every tile is a button whose label says what it does (open or go to), the current slide has aria-current, and the caption is a polite live region. In slider mode the arrow keys, Home, End and Escape work, the close and step buttons are real buttons, and focus moves to the close button on open and back to the tile on close. In grid mode the arrow keys move between tiles. The wheel is only captured while the slider is open and the pointer is over it, so the page still scrolls normally in grid mode. With reduced motion the layouts switch instantly.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Palette: select (Forest / Green / Cream), default forest\n- Tiles: range 4 to 12, step 1, default 8\n- Duration (ms): range 300 to 1800, step 50, default 900\n- Stagger (ms): range 0 to 80, step 2, default 20\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/grid-to-slider.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 \"Grid to vertical slider\" 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 \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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 GridToSlider.\n2. Paste the JavaScript below into a separate code file named grid-to-slider.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 \"./grid-to-slider\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GridToSlider(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(GridToSlider, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  palette: { type: ControlType.Enum, title: \"Palette\", options: [\"forest\",\"ink\",\"cream\"], optionTitles: [\"Forest\",\"Green\",\"Cream\"], defaultValue: \"forest\" },\n  count: { type: ControlType.Number, title: \"Tiles\", min: 4, max: 12, step: 1, defaultValue: 8 },\n  duration: { type: ControlType.Number, title: \"Duration\", min: 300, max: 1800, step: 50, defaultValue: 900 },\n  stagger: { type: ControlType.Number, title: \"Stagger\", min: 0, max: 80, step: 2, defaultValue: 20 },\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 \"Grid to vertical slider\" 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 \"Grid to vertical slider\" element from the Enrichr Library: Click a tile in a grid and the whole grid glides into a vertical slider centred on it, staggered outward from the clicked tile, then back again.\nPage: https://enrichr.dev/elements/grid-to-slider.html\nMachine-readable spec: https://enrichr.dev/elements/grid-to-slider.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-grid-to-slider\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-grid-to-slider\"), { ...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": "Every tile is a button whose label says what it does (open or go to), the current slide has aria-current, and the caption is a polite live region. In slider mode the arrow keys, Home, End and Escape work, the close and step buttons are real buttons, and focus moves to the close button on open and back to the tile on close. In grid mode the arrow keys move between tiles. The wheel is only captured while the slider is open and the pointer is over it, so the page still scrolls normally in grid mode. With reduced motion the layouts switch instantly.",
  "performance": "Width, height and transform are written on each tile every frame, which is fine for a dozen tiles but is layout work, so keep the count small or swap to scale transforms if you port this to photos at large sizes. The loop stops when every tile has arrived, and a ResizeObserver re-lays-out without animation.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/MYpZBNe",
  "source": {
    "markup": "<div class=\"ef-gts\">\n  <div class=\"ef-gts__stage\" role=\"group\" aria-label=\"Piece grid and slider\">\n    <svg class=\"ef-gts__defs\" width=\"0\" height=\"0\" aria-hidden=\"true\" focusable=\"false\">\n      <symbol id=\"efgts-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=\"efgts-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=\"efgts-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-gts__tiles\"></div>\n    <div class=\"ef-gts__cap\" aria-live=\"polite\"><span class=\"ef-gts__ct\"></span><span class=\"ef-gts__cs\"></span></div>\n    <button type=\"button\" class=\"ef-gts__btn ef-gts__close\" aria-label=\"Back to grid\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path d=\"M6 6l12 12M18 6L6 18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg></button>\n    <div class=\"ef-gts__nav\">\n      <button type=\"button\" class=\"ef-gts__btn ef-gts__prev\" aria-label=\"Previous piece\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path d=\"M6 15l6-6 6 6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg></button>\n      <button type=\"button\" class=\"ef-gts__btn ef-gts__next\" aria-label=\"Next piece\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path d=\"M6 9l6 6 6-6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg></button>\n    </div>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n/* Adapted from https://github.com/codrops/GridToSlider (MIT) — Copyright (c) 2009 - 2022 [Codrops](https://tympanus.net/codrops) */\n.ef-gts { width: 100%; height: 100%; }\n.ef-gts__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); font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-gts__defs { position: absolute; width: 0; height: 0; overflow: hidden; }\n.ef-gts__tiles { position: absolute; inset: 0; }\n.ef-gts__tile { position: absolute; left: 0; top: 0; box-sizing: border-box; margin: 0; padding: 0; border: 0; border-radius: 5px; overflow: hidden; cursor: pointer; color: inherit; background: #005236; outline: none; will-change: transform, width, height; transition: filter 500ms cubic-bezier(.16,1,.3,1), opacity 500ms; }\n.ef-gts__stage[data-mode=\"grid\"] .ef-gts__tile:hover, .ef-gts__stage[data-mode=\"grid\"] .ef-gts__tile:focus-visible { filter: brightness(1.3) saturate(1.1); }\n.ef-gts__tile:focus-visible { box-shadow: 0 0 0 2px var(--ef-bg), 0 0 0 4px var(--ef-acc); z-index: 2; }\n.ef-gts__stage[data-mode=\"slider\"] .ef-gts__tile { opacity: 0.4; }\n.ef-gts__stage[data-mode=\"slider\"] .ef-gts__tile.is-current { opacity: 1; cursor: default; }\n.ef-gts__pc { position: absolute; left: 50%; top: 50%; width: 64%; height: 64%; margin: -32% 0 0 -32%; opacity: 0.92; pointer-events: none; }\n.ef-gts__cap { position: absolute; z-index: 3; left: 1rem; bottom: 0.9rem; pointer-events: none; }\n.ef-gts__ct { display: block; font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }\n.ef-gts__cs { display: block; margin-top: 0.2rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.75; }\n.ef-gts__btn { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; padding: 0; border: 1px solid var(--ef-fg); border-radius: 50%; background: var(--ef-bg); color: var(--ef-fg); cursor: pointer; transition: background 200ms, color 200ms, border-color 200ms; }\n.ef-gts__btn:hover { background: var(--ef-acc); color: #0c1e18; border-color: var(--ef-acc); }\n.ef-gts__btn:focus-visible { outline: 2px solid var(--ef-acc); outline-offset: 2px; }\n.ef-gts__close { position: absolute; z-index: 4; top: 0.8rem; right: 0.8rem; }\n.ef-gts__nav { position: absolute; z-index: 4; right: 0.8rem; top: 50%; display: flex; flex-direction: column; gap: 0.5rem; transform: translateY(-50%); }\n.ef-gts__close, .ef-gts__nav { visibility: hidden; opacity: 0; transform-origin: center; transition: opacity 300ms, visibility 0s 300ms; }\n.ef-gts__nav { transform: translateY(-50%); }\n.ef-gts__stage[data-mode=\"slider\"] .ef-gts__close, .ef-gts__stage[data-mode=\"slider\"] .ef-gts__nav { visibility: visible; opacity: 1; transition: opacity 300ms 200ms, visibility 0s; }\n@media (prefers-reduced-motion: reduce) { .ef-gts__tile, .ef-gts__btn, .ef-gts__close, .ef-gts__nav { transition: none !important; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Adapted from https://github.com/codrops/GridToSlider (MIT) — Copyright (c) 2009 - 2022 [Codrops](https://tympanus.net/codrops)\n// Grid to slider: click a tile and the whole grid reflows into a vertical slider centred on it, every tile gliding between its two layouts\n// with a stagger that starts at the clicked tile (a hand-rolled FLIP: layouts are computed in JS, then each tile tweens its rect).\n// In slider mode use the arrows, arrow keys or the wheel (only while the pointer is over it) to step; Escape or the close button returns.\n// Vanilla port: one rAF loop, no animation library. Reduced motion swaps layouts instantly.\n// mount(root, { accent, palette (forest|ink|cream), count (4-12), duration (ms), stagger (ms) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var stage = root.querySelector(\".ef-gts__stage\");\n  var holder = root.querySelector(\".ef-gts__tiles\");\n  var capT = root.querySelector(\".ef-gts__ct\"), capS = root.querySelector(\".ef-gts__cs\");\n  var bClose = root.querySelector(\".ef-gts__close\"), bPrev = root.querySelector(\".ef-gts__prev\"), bNext = root.querySelector(\".ef-gts__next\");\n  var opts = {}, tiles = [], offs = [], raf = 0, ro = null, dead = false, mode = \"grid\", cur = 0, cols = 3, wheelAt = 0, wheelAcc = 0;\n  var NAMES = [\"Tidal\", \"Ember\", \"Moss\", \"Dusk\", \"Arch\", \"Grain\", \"Haze\", \"Loop\", \"Fern\", \"Kiln\", \"Reed\", \"Slate\"];\n  var PIECES = [\"efgts-p1\", \"efgts-p4\", \"efgts-p8\"];\n  var PAL = { forest: [\"#0c1e18\", \"#fbf8f1\"], ink: [\"#005236\", \"#fbf8f1\"], cream: [\"#fbf8f1\", \"#0c1e18\"] };\n\n  function io4(t) { return t < 0.5 ? 8 * t * t * t * t : 1 - Math.pow(-2 * t + 2, 4) / 2; }\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 18%, transparent 19%), 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  /* layouts: return a target rect for tile i in the current mode */\n  function targets() {\n    var W = stage.clientWidth, H = stage.clientHeight, n = tiles.length, out = [], i;\n    if (mode === \"grid\") {\n      cols = n <= 4 ? 2 : n <= 6 ? 3 : n <= 8 ? 4 : n <= 10 ? 5 : 4;\n      var rows = Math.ceil(n / cols), pad = 20, gap = 10, bottom = 56;\n      var aw = W - pad * 2, ah = H - pad - bottom;\n      var tw = Math.max(36, Math.min((aw - gap * (cols - 1)) / cols, ((ah - gap * (rows - 1)) / rows) * 0.75));\n      var th = tw / 0.75, gw = tw * cols + gap * (cols - 1), gh = th * rows + gap * (rows - 1);\n      var x0 = (W - gw) / 2, y0 = pad + (ah - gh) / 2;\n      for (i = 0; i < n; i++) out.push({ x: x0 + (i % cols) * (tw + gap), y: y0 + Math.floor(i / cols) * (th + gap), w: tw, h: th });\n    } else {\n      var sh = Math.min(H * 0.6, (W * 0.5) / 0.75), sw = sh * 0.75, g = H * 0.07;\n      for (i = 0; i < n; i++) out.push({ x: (W - sw) / 2, y: (H - sh) / 2 - 10 + (i - cur) * (sh + g), w: sw, h: sh });\n    }\n    return out;\n  }\n  function paint(t) {\n    var r = t.r;\n    t.el.style.width = r.w.toFixed(1) + \"px\";\n    t.el.style.height = r.h.toFixed(1) + \"px\";\n    t.el.style.transform = \"translate3d(\" + r.x.toFixed(1) + \"px,\" + r.y.toFixed(1) + \"px,0)\";\n  }\n  function flow(dur, stag, from) {\n    var to = targets(), now = performance.now();\n    tiles.forEach(function (t, i) {\n      if (reduce || dur <= 0) { t.r = to[i]; t.a = null; paint(t); return; }\n      t.a = { from: { x: t.r.x, y: t.r.y, w: t.r.w, h: t.r.h }, to: to[i], t0: now + Math.abs(i - from) * stag, dur: dur };\n    });\n    if (tiles.some(function (t) { return t.a; })) kick();\n  }\n  function kick() { if (!raf && !dead) raf = requestAnimationFrame(tick); }\n  function tick(now) {\n    raf = 0;\n    var live = false;\n    tiles.forEach(function (t) {\n      var a = t.a;\n      if (!a) return;\n      var p = Math.max(0, Math.min(1, (now - a.t0) / a.dur)), e = io4(p);\n      t.r = { x: a.from.x + (a.to.x - a.from.x) * e, y: a.from.y + (a.to.y - a.from.y) * e, w: a.from.w + (a.to.w - a.from.w) * e, h: a.from.h + (a.to.h - a.from.h) * e };\n      paint(t);\n      if (p >= 1) t.a = null; else live = true;\n    });\n    if (live) raf = requestAnimationFrame(tick);\n  }\n\n  /* state */\n  function labels() {\n    var n = tiles.length;\n    tiles.forEach(function (t, i) {\n      t.el.classList.toggle(\"is-current\", mode === \"slider\" && i === cur);\n      if (mode === \"slider\" && i === cur) { t.el.setAttribute(\"aria-current\", \"true\"); t.el.setAttribute(\"aria-label\", \"Piece \" + (i + 1) + \", current\"); }\n      else { t.el.removeAttribute(\"aria-current\"); t.el.setAttribute(\"aria-label\", (mode === \"slider\" ? \"Go to piece \" : \"Open piece \") + (i + 1) + \": \" + NAMES[i % NAMES.length]); }\n    });\n    if (mode === \"slider\") { capT.textContent = NAMES[cur % NAMES.length]; capS.textContent = String(cur + 1).padStart(2, \"0\") + \" / \" + String(n).padStart(2, \"0\"); }\n    else { capT.textContent = \"Pick a piece\"; capS.textContent = n + \" pieces\"; }\n    bPrev.disabled = mode === \"slider\" && cur === 0;\n    bNext.disabled = mode === \"slider\" && cur === n - 1;\n    bPrev.style.opacity = bPrev.disabled ? \"0.35\" : \"\"; bNext.style.opacity = bNext.disabled ? \"0.35\" : \"\";\n  }\n  function open(i) {\n    if (mode === \"slider\") return;\n    cur = i; mode = \"slider\"; stage.setAttribute(\"data-mode\", mode);\n    labels(); flow(opts.duration, opts.stagger, cur);\n    requestAnimationFrame(function () { if (!dead) bClose.focus(); });\n  }\n  function close() {\n    if (mode === \"grid\") return;\n    mode = \"grid\"; stage.setAttribute(\"data-mode\", mode);\n    labels(); flow(opts.duration, opts.stagger, cur);\n    var t = tiles[cur]; if (t) t.el.focus();\n  }\n  function step(d) {\n    if (mode !== \"slider\") return;\n    var n = Math.max(0, Math.min(tiles.length - 1, cur + d));\n    if (n === cur) return;\n    cur = n; labels(); flow(opts.duration * 0.7, opts.stagger * 0.5, cur);\n  }\n  function goTo(i) { if (mode === \"slider\" && i !== cur) { cur = i; labels(); flow(opts.duration * 0.7, opts.stagger * 0.5, cur); } }\n\n  /* build */\n  function build() {\n    holder.textContent = \"\"; tiles = []; cur = Math.min(cur, opts.count - 1);\n    for (var i = 0; i < opts.count; i++) (function (i) {\n      var el = document.createElement(\"button\");\n      el.type = \"button\"; el.className = \"ef-gts__tile\";\n      el.style.background = art(i, opts.accent);\n      var svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n      svg.setAttribute(\"class\", \"ef-gts__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); el.appendChild(svg);\n      function click() { if (mode === \"grid\") open(i); else goTo(i); }\n      el.addEventListener(\"click\", click);\n      offs.push(function () { el.removeEventListener(\"click\", click); });\n      holder.appendChild(el);\n      tiles.push({ el: el, r: { x: 0, y: 0, w: 60, h: 80 }, a: null });\n    })(i);\n    labels(); flow(0, 0, 0);\n  }\n\n  /* input */\n  function onKey(e) {\n    var k = e.key;\n    if (mode === \"slider\") {\n      if (k === \"Escape\") { e.preventDefault(); close(); }\n      else if (k === \"ArrowUp\" || k === \"ArrowLeft\") { e.preventDefault(); step(-1); }\n      else if (k === \"ArrowDown\" || k === \"ArrowRight\") { e.preventDefault(); step(1); }\n      else if (k === \"Home\") { e.preventDefault(); step(-999); }\n      else if (k === \"End\") { e.preventDefault(); step(999); }\n    } else {\n      var idx = tiles.map(function (t) { return t.el; }).indexOf(document.activeElement), j = -1;\n      if (idx < 0) return;\n      if (k === \"ArrowRight\") j = idx + 1; else if (k === \"ArrowLeft\") j = idx - 1;\n      else if (k === \"ArrowDown\") j = idx + cols; else if (k === \"ArrowUp\") j = idx - cols;\n      if (j >= 0 && j < tiles.length) { e.preventDefault(); tiles[j].el.focus(); }\n    }\n  }\n  function onWheel(e) {\n    if (mode !== \"slider\") return;\n    e.preventDefault();\n    var now = performance.now();\n    wheelAcc += e.deltaY;\n    if (now - wheelAt > 420 && Math.abs(wheelAcc) > 20) { wheelAt = now; step(wheelAcc > 0 ? 1 : -1); wheelAcc = 0; }\n    else if (now - wheelAt > 420) wheelAcc = 0;\n  }\n  function onClose() { close(); }\n  function onPrev() { step(-1); }\n  function onNext() { step(1); }\n  stage.addEventListener(\"keydown\", onKey);\n  stage.addEventListener(\"wheel\", onWheel, { passive: false });\n  bClose.addEventListener(\"click\", onClose); bPrev.addEventListener(\"click\", onPrev); bNext.addEventListener(\"click\", onNext);\n  offs.push(function () {\n    stage.removeEventListener(\"keydown\", onKey); stage.removeEventListener(\"wheel\", onWheel);\n    bClose.removeEventListener(\"click\", onClose); bPrev.removeEventListener(\"click\", onPrev); bNext.removeEventListener(\"click\", onNext);\n  });\n  if (typeof ResizeObserver !== \"undefined\") {\n    ro = new ResizeObserver(function () { if (!dead && tiles.length) flow(0, 0, 0); });\n    ro.observe(stage);\n  }\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ accent: \"#e6ff55\", palette: \"forest\", count: 8, duration: 900, stagger: 20 }, opts, next || {});\n    opts.count = Math.max(4, Math.min(12, Math.round(opts.count)));\n    opts.duration = Math.max(0, +opts.duration); opts.stagger = Math.max(0, +opts.stagger);\n    var p = PAL[opts.palette] || PAL.forest;\n    stage.style.setProperty(\"--ef-bg\", p[0]); stage.style.setProperty(\"--ef-fg\", p[1]);\n    stage.style.setProperty(\"--ef-acc\", opts.palette === \"cream\" ? \"#0a6b46\" : opts.accent);\n    stage.setAttribute(\"data-mode\", mode);\n    if (prev.count !== opts.count || prev.accent !== opts.accent) build();\n  }\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      dead = true;\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n      if (ro) ro.disconnect();\n      offs.forEach(function (f) { f(); }); offs = [];\n      holder.textContent = \"\";\n    }\n  };\n}"
  }
}