{
  "id": "pixel-grid-transition",
  "kind": "element",
  "title": "Pixel grid page transition",
  "summary": "Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.",
  "url": "https://enrichr.dev/elements/pixel-grid-transition.html",
  "section": "page",
  "techniques": [
    "reveal",
    "stagger"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "bold",
    "playful",
    "energetic"
  ],
  "intents": [
    "pixel transition between views",
    "grid cells page transition",
    "staggered block wipe",
    "mosaic reveal on click",
    "row by row cover and reveal"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Cell colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "rows",
      "label": "Rows",
      "type": "range",
      "min": 4,
      "max": 14,
      "step": 1,
      "value": 8
    },
    {
      "key": "cols",
      "label": "Columns",
      "type": "range",
      "min": 6,
      "max": 20,
      "step": 1,
      "value": 14
    },
    {
      "key": "duration",
      "label": "Cell duration (ms)",
      "type": "range",
      "min": 150,
      "max": 1200,
      "step": 10,
      "value": 420
    },
    {
      "key": "jitter",
      "label": "Random delay (rows)",
      "type": "range",
      "min": 0,
      "max": 8,
      "step": 0.5,
      "value": 5
    }
  ],
  "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 \"Pixel grid page transition\" element to this project.\n\nThis is the \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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/pixel-grid-transition.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 \"Pixel grid page transition\" 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 \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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 \"Pixel grid page transition\" element to this codebase.\n\nThis is the \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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-pixel-grid-transition.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Pixel grid page transition 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 \"Pixel grid page transition\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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- pixel-grid-transition.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 \"./pixel-grid-transition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function PixelGridTransition(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 \"Pixel grid page transition\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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- pixel-grid-transition.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/PixelGridTransition.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./pixel-grid-transition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function PixelGridTransition(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 \"Pixel grid page transition\" element.\n\nThis is the \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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), pixel-grid-transition.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 \"Pixel grid page transition\" element. No packages, no server code.\n\nThis is the \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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 pixel-grid-transition.js and then main.js), style.css (the CSS below), pixel-grid-transition.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 \"Pixel grid page transition\" 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 \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.json\n\nWhat it does: A vanilla port with no GSAP. An overlay holds a CSS grid of cells. Each pass gives every cell a delay of its row number plus a random offset, and one rAF loop eases each cell's scale and opacity between 0 and 1.01. The cover pass grows cells from the top edge; once every cell is in, the script swaps which view is visible and runs the exit pass with cells shrinking toward the bottom edge. The fade and slide of the views uses the Web Animations API. Going back runs the same sequence mirrored.\nAccessibility: Pieces and the back button are native buttons, Escape also goes back, and focus moves to the new view's button once the cover is complete. Clicks are ignored while a transition is running. Under reduced motion there are no cells: the view swaps immediately with a brief fade. The hidden view is display none, so it is not reachable by keyboard or screen reader.\n\nTunable settings:\n- Cell colour: color, default #e6ff55\n- Rows: range 4 to 14, step 1, default 8\n- Columns: range 6 to 20, step 1, default 14\n- Cell duration (ms): range 150 to 1200, step 10, default 420\n- Random delay (rows): range 0 to 8, step 0.5, default 5\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/pixel-grid-transition.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 \"Pixel grid page transition\" 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 \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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 PixelGridTransition.\n2. Paste the JavaScript below into a separate code file named pixel-grid-transition.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 \"./pixel-grid-transition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function PixelGridTransition(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(PixelGridTransition, {\n  accent: { type: ControlType.Color, title: \"Cell colour\", defaultValue: \"#e6ff55\" },\n  rows: { type: ControlType.Number, title: \"Rows\", min: 4, max: 14, step: 1, defaultValue: 8 },\n  cols: { type: ControlType.Number, title: \"Columns\", min: 6, max: 20, step: 1, defaultValue: 14 },\n  duration: { type: ControlType.Number, title: \"Cell duration\", min: 150, max: 1200, step: 10, defaultValue: 420 },\n  jitter: { type: ControlType.Number, title: \"Random delay\", min: 0, max: 8, step: 0.5, defaultValue: 5 },\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 \"Pixel grid page transition\" 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 \"Pixel grid page transition\" element from the Enrichr Library: Click a piece and a grid of cells scales in row by row to cover the frame, swaps the view underneath, then scales back out to reveal the new one.\nPage: https://enrichr.dev/elements/pixel-grid-transition.html\nMachine-readable spec: https://enrichr.dev/elements/pixel-grid-transition.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-pixel-grid-transition\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-pixel-grid-transition\"), { ...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": "Pieces and the back button are native buttons, Escape also goes back, and focus moves to the new view's button once the cover is complete. Clicks are ignored while a transition is running. Under reduced motion there are no cells: the view swaps immediately with a brief fade. The hidden view is display none, so it is not reachable by keyboard or screen reader.",
  "performance": "About one hundred cells animate scale and opacity only, from a single rAF loop that stops when the pass finishes. Fewer, larger cells are cheaper on weak devices. The cells are removed from interaction with pointer-events none.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-pgt\">\n  <svg width=\"0\" height=\"0\" aria-hidden=\"true\" focusable=\"false\" style=\"position:absolute\">\n    <defs>\n      <symbol id=\"ef-pgt-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=\"ef-pgt-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=\"ef-pgt-p8\" viewBox=\"1513.7 166.86 322.3 503.06\"><path fill=\"currentColor\" d=\"M1528.7 564.5v-111.6c0-8 6.5-14.5 14.5-14.5 4.2 0 8.2 1.9 11 5 7.8 8.7 19.7 13.7 32.7 11.9 16.8-2.2 30.1-15.9 32-32.7 2.5-22.5-15.1-41.5-37.1-41.5-11 0-20.9 4.7-27.7 12.3-2.8 3.1-6.7 4.9-10.9 4.9-8 0-14.5-6.5-14.5-14.5v-111.6h111.6c8.1 0 14.5-6.5 14.5-14.5 0-4.1-1.8-8.1-4.9-10.9-7.6-6.8-12.3-16.6-12.3-27.6 0-22 19-39.6 41.5-37.1 16.8 1.8 30.5 15.2 32.8 32 1.7 12.9-3.3 24.8-12 32.7-3.1 2.8-5 6.7-5 10.9 0 8 6.5 14.5 14.5 14.5h111.6v111.6c0 8-6.4 14.5-14.5 14.5-4.2 0-8.1-1.9-10.9-5-7.9-8.7-19.7-13.6-32.7-11.9-16.8 2.2-30.1 15.9-32 32.7-2.5 22.5 15.1 41.6 37.1 41.6 11 0 20.8-4.8 27.7-12.3 2.8-3.1 6.7-5 10.8-5 8.1 0 14.5 6.5 14.5 14.5v111.6h-111.6c-8 0-14.5 6.5-14.5 14.5 0 4.2 1.9 8.1 5 10.9 7.5 6.8 12.3 16.7 12.3 27.7 0 22-19 39.5-41.6 37.1-16.8-1.9-30.5-15.3-32.7-32-1.7-13 3.3-24.9 11.9-32.7 3.1-2.9 5-6.8 5-11 0-8-6.4-14.5-14.5-14.5z\"/></symbol>\n    </defs>\n  </svg>\n  <div class=\"ef-pgt__stage\">\n    <div class=\"ef-pgt__intro\">\n      <p class=\"ef-pgt__kicker\">Pick a piece</p>\n      <div class=\"ef-pgt__tiles\">\n        <button type=\"button\" class=\"ef-pgt__tile\" data-i=\"0\"><svg viewBox=\"0 0 100 100\" aria-hidden=\"true\" focusable=\"false\"><use width=\"100\" height=\"100\" href=\"#ef-pgt-p1\"></use></svg><span>Corner</span></button>\n        <button type=\"button\" class=\"ef-pgt__tile\" data-i=\"1\"><svg viewBox=\"0 0 100 100\" aria-hidden=\"true\" focusable=\"false\"><use width=\"100\" height=\"100\" href=\"#ef-pgt-p4\"></use></svg><span>Bridge</span></button>\n        <button type=\"button\" class=\"ef-pgt__tile\" data-i=\"2\"><svg viewBox=\"0 0 100 100\" aria-hidden=\"true\" focusable=\"false\"><use width=\"100\" height=\"100\" href=\"#ef-pgt-p8\"></use></svg><span>Tower</span></button>\n      </div>\n    </div>\n    <section class=\"ef-pgt__panel\" data-i=\"0\" aria-label=\"Corner\">\n      <div class=\"ef-pgt__art\"><svg viewBox=\"0 0 100 100\" aria-hidden=\"true\" focusable=\"false\"><use width=\"100\" height=\"100\" href=\"#ef-pgt-p1\"></use></svg></div>\n      <h3 class=\"ef-pgt__h\">Corner</h3>\n      <p class=\"ef-pgt__p\">Every build starts by finding the edge.</p>\n      <button type=\"button\" class=\"ef-pgt__back\">Back</button>\n    </section>\n    <section class=\"ef-pgt__panel\" data-i=\"1\" aria-label=\"Bridge\">\n      <div class=\"ef-pgt__art\"><svg viewBox=\"0 0 100 100\" aria-hidden=\"true\" focusable=\"false\"><use width=\"100\" height=\"100\" href=\"#ef-pgt-p4\"></use></svg></div>\n      <h3 class=\"ef-pgt__h\">Bridge</h3>\n      <p class=\"ef-pgt__p\">The long piece that joins two sections together.</p>\n      <button type=\"button\" class=\"ef-pgt__back\">Back</button>\n    </section>\n    <section class=\"ef-pgt__panel\" data-i=\"2\" aria-label=\"Tower\">\n      <div class=\"ef-pgt__art\"><svg viewBox=\"0 0 100 100\" aria-hidden=\"true\" focusable=\"false\"><use width=\"100\" height=\"100\" href=\"#ef-pgt-p8\"></use></svg></div>\n      <h3 class=\"ef-pgt__h\">Tower</h3>\n      <p class=\"ef-pgt__p\">Tall pieces hold the structure upright.</p>\n      <button type=\"button\" class=\"ef-pgt__back\">Back</button>\n    </section>\n    <div class=\"ef-pgt__overlay\" aria-hidden=\"true\"></div>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n/* Adapted from https://github.com/codrops/PixelTransition (MIT) — Copyright (c) 2009 - 2023 [Codrops](https://tympanus.net/codrops) */\n.ef-pgt { width: 100%; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-pgt__stage { position: relative; box-sizing: border-box; width: 100%; height: 22rem; border-radius: 1rem; overflow: hidden; background: #0c1e18; color: #fbf8f1; isolation: isolate; }\n.ef-pgt__intro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; padding: 1.2rem; }\n.ef-pgt__intro.is-closed { visibility: hidden; }\n.ef-pgt__kicker { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.75; }\n.ef-pgt__tiles { display: flex; gap: 0.9rem; align-items: stretch; justify-content: center; width: 100%; }\n.ef-pgt__tile { appearance: none; border: 0; cursor: pointer; flex: 1 1 0; max-width: 9rem; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 0.9rem 0.6rem 0.7rem; border-radius: 0.9rem; background: #005236; color: #c6f26b; font: inherit; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; transition: background 200ms, transform 200ms; }\n.ef-pgt__tile svg { width: 100%; height: 4.4rem; display: block; }\n.ef-pgt__tile span { color: #fbf8f1; }\n.ef-pgt__tile:hover { background: #0a6b46; transform: translateY(-3px); }\n.ef-pgt__tile:focus-visible, .ef-pgt__back:focus-visible { outline: 2px solid var(--ef-acc, #e6ff55); outline-offset: 3px; }\n.ef-pgt__panel { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0.5rem; padding: 1.4rem; background: #005236; visibility: hidden; }\n.ef-pgt__panel.is-open { display: flex; visibility: visible; }\n.ef-pgt__art { width: 7rem; height: 7rem; color: #e6ff55; }\n.ef-pgt__art svg { width: 100%; height: 100%; display: block; }\n.ef-pgt__h { margin: 0.4rem 0 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }\n.ef-pgt__p { margin: 0; max-width: 20rem; font-size: 0.9rem; opacity: 0.85; }\n.ef-pgt__back { appearance: none; cursor: pointer; margin-top: 0.9rem; padding: 0.55rem 1.3rem; border-radius: 999px; border: 1.5px solid #fbf8f1; background: transparent; color: #fbf8f1; font: inherit; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em; transition: background 200ms, color 200ms; }\n.ef-pgt__back:hover { background: #fbf8f1; color: #0c1e18; }\n.ef-pgt__overlay { position: absolute; inset: 0; z-index: 5; display: grid; pointer-events: none; }\n.ef-pgt__cell { background: var(--ef-cell, #e6ff55); opacity: 0; transform: scale(0); will-change: transform, opacity; }\n@media (prefers-reduced-motion: reduce) {\n  .ef-pgt__tile { transition: background 200ms; }\n  .ef-pgt__tile:hover { transform: none; }\n  .ef-pgt__panel.is-open { animation: ef-pgt-fade 200ms linear; }\n}\n@keyframes ef-pgt-fade { from { opacity: 0; } to { opacity: 1; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Adapted from https://github.com/codrops/PixelTransition (MIT) — Copyright (c) 2009 - 2023 [Codrops](https://tympanus.net/codrops)\n// Pixel grid transition: clicking a piece covers the frame with a grid of cells that scale in row by row (with random jitter), swaps the\n// view underneath, then scales the cells back out. Cells are driven by one rAF loop; the fade and slide of the views uses the Web\n// Animations API. Reduced motion skips the cells and swaps the view straight away. Buttons are native, Escape goes back, and focus\n// moves to the new view's button so keyboard users never get lost.\n// mount(root, { accent, rows (4-14), cols (6-20), duration (ms), jitter (0-8 rows of random delay) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var stage = root.querySelector(\".ef-pgt__stage\");\n  var intro = root.querySelector(\".ef-pgt__intro\");\n  var overlay = root.querySelector(\".ef-pgt__overlay\");\n  var tiles = [].slice.call(root.querySelectorAll(\".ef-pgt__tile\"));\n  var panels = [].slice.call(root.querySelectorAll(\".ef-pgt__panel\"));\n  var opts = {}, cells = [], raf = 0, busy = false, view = -1, anims = [], offs = [], dead = false, token = 0;\n\n  function clamp(v, a, b) { return Math.max(a, Math.min(b, v)); }\n  function cubicInOut(t) { return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; }\n  function quadOut(t) { return 1 - (1 - t) * (1 - t); }\n\n  function buildCells() {\n    overlay.textContent = \"\";\n    cells = [];\n    overlay.style.gridTemplateColumns = \"repeat(\" + opts.cols + \", 1fr)\";\n    overlay.style.gridTemplateRows = \"repeat(\" + opts.rows + \", 1fr)\";\n    for (var r = 0; r < opts.rows; r++) for (var c = 0; c < opts.cols; c++) {\n      var el = document.createElement(\"div\");\n      el.className = \"ef-pgt__cell\";\n      overlay.appendChild(el);\n      cells.push({ el: el, row: r });\n    }\n  }\n\n  // One staggered pass over every cell. kind \"in\": scale 0 -> 1.01 (opacity 0 -> 1). kind \"out\": scale 1.01 -> 0.\n  function run(kind, origin, reverse) {\n    var my = ++token;\n    return new Promise(function (resolve) {\n      var dur = opts.duration, stag = dur * 0.075, delays = [], maxD = 0;\n      for (var i = 0; i < cells.length; i++) {\n        var row = reverse ? opts.rows - 1 - cells[i].row : cells[i].row;\n        var d = stag * (row + Math.random() * opts.jitter);\n        delays.push(d);\n        if (d > maxD) maxD = d;\n        cells[i].el.style.transformOrigin = origin;\n      }\n      var t0 = performance.now();\n      function step(now) {\n        raf = 0;\n        if (dead || my !== token) return;\n        var done = true;\n        for (var j = 0; j < cells.length; j++) {\n          var p = clamp((now - t0 - delays[j]) / dur, 0, 1);\n          if (p < 1) done = false;\n          var s, op;\n          if (kind === \"in\") { var e = cubicInOut(p); s = 1.01 * e; op = e; }\n          else { var q = quadOut(p); s = 1.01 * (1 - q); op = 1 - q; }\n          var st = cells[j].el.style;\n          st.opacity = op.toFixed(3);\n          st.transform = \"scale(\" + s.toFixed(3) + \")\";\n        }\n        if (done) resolve(); else raf = requestAnimationFrame(step);\n      }\n      raf = requestAnimationFrame(step);\n    });\n  }\n\n  function anim(el, frames, ms, ease) {\n    if (!el.animate) return null;\n    var a = el.animate(frames, { duration: ms, easing: ease, fill: \"both\" });\n    anims.push(a);\n    return a;\n  }\n  function cancelAnims() { anims.forEach(function (a) { try { a.cancel(); } catch (e) {} }); anims = []; }\n\n  function setView(i) {\n    view = i;\n    intro.classList.toggle(\"is-closed\", i >= 0);\n    panels.forEach(function (p, k) { p.classList.toggle(\"is-open\", k === i); });\n  }\n  function focusIn(i) {\n    var el = i >= 0 ? panels[i].querySelector(\".ef-pgt__back\") : tiles[lastTile] ;\n    if (el && el.focus) el.focus({ preventScroll: true });\n  }\n  var lastTile = 0;\n\n  function go(i) {\n    if (busy || dead) return;\n    var leaving = view;\n    if (i >= 0) lastTile = i;\n    if (reduce) { setView(i); focusIn(i); return; }\n    busy = true;\n    var opening = i >= 0;\n    var out = opening ? intro : panels[leaving].querySelector(\".ef-pgt__art\");\n    anim(out, [{ opacity: 1, transform: \"translateY(0)\" }, { opacity: 0, transform: \"translateY(\" + (opening ? 15 : -15) + \"%)\" }], 800, \"cubic-bezier(.65,0,.35,1)\");\n    run(\"in\", opening ? \"50% 0%\" : \"50% 100%\", !opening).then(function () {\n      if (dead) return;\n      cancelAnims();\n      setView(i);\n      focusIn(i);\n      var inn = opening ? panels[i].querySelector(\".ef-pgt__art\") : intro;\n      anim(inn, [{ opacity: 0, transform: \"translateY(\" + (opening ? -25 : 15) + \"%)\" }, { opacity: 1, transform: \"translateY(0)\" }], 800, \"cubic-bezier(.22,1,.36,1)\");\n      return run(\"out\", opening ? \"50% 100%\" : \"50% 0%\", !opening);\n    }).then(function () {\n      if (dead) return;\n      busy = false;\n      for (var k = 0; k < cells.length; k++) { cells[k].el.style.opacity = \"0\"; cells[k].el.style.transform = \"scale(0)\"; }\n    });\n  }\n\n  function reset() {\n    token++;\n    if (raf) cancelAnimationFrame(raf);\n    raf = 0;\n    cancelAnims();\n    busy = false;\n    setView(-1);\n  }\n\n  tiles.forEach(function (b, i) {\n    var f = function () { go(i); };\n    b.addEventListener(\"click\", f);\n    offs.push(function () { b.removeEventListener(\"click\", f); });\n  });\n  panels.forEach(function (p) {\n    var b = p.querySelector(\".ef-pgt__back\");\n    var f = function () { go(-1); };\n    b.addEventListener(\"click\", f);\n    offs.push(function () { b.removeEventListener(\"click\", f); });\n  });\n  function key(e) { if (e.key === \"Escape\" && view >= 0 && !busy) { e.preventDefault(); go(-1); } }\n  stage.addEventListener(\"keydown\", key);\n  offs.push(function () { stage.removeEventListener(\"keydown\", key); });\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ accent: \"#e6ff55\", rows: 8, cols: 14, duration: 420, jitter: 5 }, opts, next || {});\n    opts.rows = clamp(Math.round(opts.rows), 4, 14);\n    opts.cols = clamp(Math.round(opts.cols), 6, 20);\n    opts.duration = clamp(Number(opts.duration), 150, 1200);\n    opts.jitter = clamp(Number(opts.jitter), 0, 8);\n    stage.style.setProperty(\"--ef-cell\", opts.accent);\n    stage.style.setProperty(\"--ef-acc\", opts.accent);\n    if (prev.rows !== opts.rows || prev.cols !== opts.cols) {\n      if (busy) reset();\n      buildCells();\n    }\n  }\n  function destroy() {\n    dead = true;\n    token++;\n    if (raf) cancelAnimationFrame(raf);\n    raf = 0;\n    cancelAnims();\n    offs.forEach(function (f) { f(); });\n    offs = [];\n  }\n  update(o);\n  return { update: update, destroy: destroy };\n}"
  }
}