{
  "id": "stagger-letter-swap",
  "kind": "element",
  "title": "Stagger letter swap",
  "summary": "Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.",
  "url": "https://enrichr.dev/elements/stagger-letter-swap.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "stagger",
    "reveal",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS",
    "Web Animations API"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "editorial",
    "kinetic",
    "polished"
  ],
  "intents": [
    "letter stagger text transition",
    "typography motion page switch",
    "characters slide up and out then new text in",
    "about overlay text swap animation",
    "split text per character reveal"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "tint",
      "label": "Second screen colour",
      "type": "color",
      "value": "#c6f26b"
    },
    {
      "key": "stagger",
      "label": "Stagger (ms)",
      "type": "range",
      "min": 4,
      "max": 60,
      "step": 1,
      "value": 14
    },
    {
      "key": "duration",
      "label": "Letter duration (ms)",
      "type": "range",
      "min": 200,
      "max": 1200,
      "step": 50,
      "value": 500
    },
    {
      "key": "cursor",
      "label": "Cursor size (px)",
      "type": "range",
      "min": 24,
      "max": 120,
      "step": 2,
      "value": 56
    }
  ],
  "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 \"Stagger letter swap\" element to this project.\n\nThis is the \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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/stagger-letter-swap.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 \"Stagger letter swap\" 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 \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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 \"Stagger letter swap\" element to this codebase.\n\nThis is the \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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-stagger-letter-swap.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Stagger letter swap 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 \"Stagger letter swap\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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- stagger-letter-swap.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 \"./stagger-letter-swap\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function StaggerLetterSwap(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 \"Stagger letter swap\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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- stagger-letter-swap.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/StaggerLetterSwap.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./stagger-letter-swap\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function StaggerLetterSwap(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 \"Stagger letter swap\" element.\n\nThis is the \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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), stagger-letter-swap.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 \"Stagger letter swap\" element. No packages, no server code.\n\nThis is the \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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 stagger-letter-swap.js and then main.js), style.css (the CSS below), stagger-letter-swap.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 \"Stagger letter swap\" 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 \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.json\n\nWhat it does: This is a vanilla JS and CSS port of the Codrops Typography Motion idea, with no GSAP or SplitText. On mount the script splits each paragraph into word spans holding character spans and puts the full sentence on the paragraph as an aria-label. Each paragraph has overflow hidden, so a character moved up or down by 100 percent disappears at the line edge. A swap runs in three steps: the current characters animate out with the Web Animations API and a per-letter delay, the background colour animates toward the other screen's colour just before they finish, then the other screen's characters animate in from below with the same stagger and a picture rises in last. The cursor is a circle moved by a small lerp loop that stops when it catches up.\nAccessibility: The swap is a real toggle button with aria-pressed, and the EF mark is a button that returns to the first screen. The hidden screen is inert and aria-hidden, and every paragraph keeps its full text as an aria-label so the split letters are not read one by one. With reduced motion the letters do not move, the screens swap with a short fade and the cursor circle is removed.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Second screen colour: color, default #c6f26b\n- Stagger (ms): range 4 to 60, step 1, default 14\n- Letter duration (ms): range 200 to 1200, step 50, default 500\n- Cursor size (px): range 24 to 120, step 2, default 56\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/stagger-letter-swap.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 \"Stagger letter swap\" 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 \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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 StaggerLetterSwap.\n2. Paste the JavaScript below into a separate code file named stagger-letter-swap.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 \"./stagger-letter-swap\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function StaggerLetterSwap(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(StaggerLetterSwap, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  tint: { type: ControlType.Color, title: \"Second screen colour\", defaultValue: \"#c6f26b\" },\n  stagger: { type: ControlType.Number, title: \"Stagger\", min: 4, max: 60, step: 1, defaultValue: 14 },\n  duration: { type: ControlType.Number, title: \"Letter duration\", min: 200, max: 1200, step: 50, defaultValue: 500 },\n  cursor: { type: ControlType.Number, title: \"Cursor size\", min: 24, max: 120, step: 2, defaultValue: 56 },\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 \"Stagger letter swap\" 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 \"Stagger letter swap\" element from the Enrichr Library: Click to swap two screens of big type: every character slides up and out in a stagger, the background shifts colour, and the next text rises into place, with a soft cursor circle following the mouse.\nPage: https://enrichr.dev/elements/stagger-letter-swap.html\nMachine-readable spec: https://enrichr.dev/elements/stagger-letter-swap.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-stagger-letter-swap\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-stagger-letter-swap\"), { ...your settings... });\n   (set the container's innerHTML to the markup first, as in the contract).\n2. Embed elements have a size limit (check Webflow's current number). If the code is longer, host the JS and CSS as files and link them from Custom code in the page settings, then keep only the container and the mount call in the Embed.\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}"
  },
  "exportTools": [
    "claude",
    "chatgpt",
    "cursor",
    "v0",
    "lovable",
    "bolt",
    "replit",
    "figma",
    "framer",
    "webflow"
  ],
  "accessibility": "The swap is a real toggle button with aria-pressed, and the EF mark is a button that returns to the first screen. The hidden screen is inert and aria-hidden, and every paragraph keeps its full text as an aria-label so the split letters are not read one by one. With reduced motion the letters do not move, the screens swap with a short fade and the cursor circle is removed.",
  "performance": "Only transform and opacity animate on the letters, and the background colour animates once per swap. The cursor loop stops when idle. Each letter is its own element, so very long paragraphs will create many animations; keep the text to headlines and short passages.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-slr\">\n  <div class=\"ef-slr__wrap\">\n    <div class=\"ef-slr__bar\">\n      <button type=\"button\" class=\"ef-slr__home\"><b>EF</b> <span>2026</span></button>\n      <button type=\"button\" class=\"ef-slr__tog\" aria-pressed=\"false\"><span class=\"ef-slr__tl is-on\">About</span><span class=\"ef-slr__tl\">Close</span></button>\n    </div>\n    <div class=\"ef-slr__body\">\n      <section class=\"ef-slr__panel ef-slr__panel--home is-current\" aria-label=\"Home\">\n        <p class=\"ef-slr__p ef-slr__p--big\" data-split>Build with</p>\n        <p class=\"ef-slr__p ef-slr__p--big ef-slr__p--right\" data-split>every piece</p>\n      </section>\n      <section class=\"ef-slr__panel ef-slr__panel--about\" aria-label=\"About\">\n        <p class=\"ef-slr__p\" data-split>Every letter is</p>\n        <p class=\"ef-slr__p ef-slr__p--right\" data-split>its own small piece</p>\n        <p class=\"ef-slr__p\" data-split>moving in order to</p>\n        <p class=\"ef-slr__p\" data-split>fit a bigger shape</p>\n        <figure class=\"ef-slr__fig\">\n          <div class=\"ef-slr__art\"></div>\n          <figcaption class=\"ef-slr__cap\">Each character slides on its own, in a stagger, and the next set rises into the gap it leaves behind.</figcaption>\n        </figure>\n      </section>\n    </div>\n    <svg class=\"ef-slr__cur\" width=\"80\" height=\"80\" viewBox=\"0 0 80 80\" aria-hidden=\"true\"><circle cx=\"40\" cy=\"40\" r=\"20\"></circle></svg>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n/* Adapted from https://github.com/codrops/TypographyMotion (MIT) — Copyright (c) 2009 - 2020 [Codrops](https://tympanus.net/codrops) */\n.ef-slr { width: 100%; }\n.ef-slr__wrap { --ef-acc: #e6ff55; --ef-cur: 56px; position: relative; box-sizing: border-box; width: 100%; min-height: 26rem; overflow: hidden; border-radius: 1rem; padding: 1rem 1.3rem 1.3rem; display: flex; flex-direction: column; container-type: inline-size; background: #fbf8f1; color: #0c1e18; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-slr__bar { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }\n.ef-slr__home, .ef-slr__tog { padding: 0.35rem 0; border: 0; background: none; color: inherit; font: inherit; font-size: 0.85rem; cursor: pointer; }\n.ef-slr__home b { font-weight: 800; }\n.ef-slr__tog { font-weight: 800; }\n.ef-slr__tl { display: none; }\n.ef-slr__tl.is-on { display: inline-block; }\n.ef-slr__home:focus-visible, .ef-slr__tog:focus-visible { outline: 2px solid #0a6b46; outline-offset: 4px; border-radius: 2px; }\n.ef-slr__body { position: relative; z-index: 1; flex: 1; display: grid; grid-template-columns: 100%; grid-template-areas: \"x\"; cursor: default; }\n.ef-slr__panel { grid-area: x; display: flex; flex-direction: column; visibility: hidden; pointer-events: none; }\n.ef-slr__panel.is-current { visibility: visible; pointer-events: auto; }\n.ef-slr__panel--home { justify-content: center; }\n.ef-slr__p { position: relative; flex: none; margin: 0; overflow: hidden; font-family: Georgia, \"Times New Roman\", serif; font-weight: 400; font-size: clamp(1.5rem, 7.5cqw, 3rem); line-height: 1.12; letter-spacing: -0.02em; text-transform: uppercase; }\n.ef-slr__p--big { font-size: clamp(2.2rem, 12cqw, 5.4rem); line-height: 1.02; }\n.ef-slr__p--right { align-self: flex-end; }\n.ef-slr__w { display: inline-block; white-space: nowrap; }\n.ef-slr__c { display: inline-block; will-change: transform; }\n.ef-slr__fig { display: flex; align-items: center; gap: 1rem; margin: 1.1rem 0 0; }\n.ef-slr__art { position: relative; flex: none; width: 6.5rem; height: 5.2rem; border-radius: 0.5rem; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #e6ff55; background: linear-gradient(150deg, #0a6b46, #0c1e18); }\n.ef-slr__art svg { width: 78%; height: 78%; display: block; }\n.ef-slr__cap { margin: 0; font-size: 0.78rem; line-height: 1.45; max-width: 18rem; }\n.ef-slr__cur { position: absolute; z-index: 2; left: 0; top: 0; width: var(--ef-cur); height: var(--ef-cur); pointer-events: none; opacity: 0; transition: opacity 400ms; will-change: transform; }\n.ef-slr__cur circle { fill: var(--ef-acc); fill-opacity: 0.55; }\n.ef-slr__cur.is-on { opacity: 1; }\n@media (prefers-reduced-motion: reduce) { .ef-slr__cur { display: none; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Adapted from https://github.com/codrops/TypographyMotion (MIT) — Copyright (c) 2009 - 2020 [Codrops](https://tympanus.net/codrops)\n// Stagger letter swap: every character of the current text slides up and out in a stagger, the background shifts colour, then the next text's\n// characters rise into place from below and a picture settles in. A soft circle follows the mouse. Click About / Close (or the EF mark) to swap.\n// Vanilla port: text is split into word and character spans here, the motion is the Web Animations API, the cursor is a small rAF lerp. No libraries.\n// mount(root, { accent, tint (colour), stagger (ms), duration (ms), cursor (px) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-slr__wrap\");\n  var home = root.querySelector(\".ef-slr__home\");\n  var tog = root.querySelector(\".ef-slr__tog\");\n  var tls = root.querySelectorAll(\".ef-slr__tl\");\n  var panels = [root.querySelector(\".ef-slr__panel--home\"), root.querySelector(\".ef-slr__panel--about\")];\n  var fig = root.querySelector(\".ef-slr__fig\");\n  var art = root.querySelector(\".ef-slr__art\");\n  var cur = root.querySelector(\".ef-slr__cur\");\n  var BASE = \"#fbf8f1\";\n  var opts = {}, offs = [], running = [], view = 0, animating = false, destroyed = false, raf = 0;\n  var tx = 0, ty = 0, cx = 0, cy = 0, seen = false;\n  var PIECE = { vb: \"1423.36 860.8 503.07 322.3\", 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\" };\n  art.innerHTML = '<svg viewBox=\"' + PIECE.vb + '\" preserveAspectRatio=\"xMidYMid meet\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"' + PIECE.d + '\"/></svg>';\n\n  function clamp(v, a, b) { return Math.max(a, Math.min(b, v)); }\n  function lerp(a, b, t) { return a + (b - a) * t; }\n\n  // Split each [data-split] paragraph into word spans holding character spans. Screen readers get the whole text from aria-label.\n  Array.prototype.forEach.call(root.querySelectorAll(\"[data-split]\"), function (p) {\n    var text = p.textContent.trim().replace(/\\s+/g, \" \");\n    p.textContent = \"\";\n    p.setAttribute(\"aria-label\", text);\n    text.split(\" \").forEach(function (word, wi) {\n      if (wi) p.appendChild(document.createTextNode(\" \"));\n      var w = document.createElement(\"span\"); w.className = \"ef-slr__w\"; w.setAttribute(\"aria-hidden\", \"true\");\n      for (var i = 0; i < word.length; i++) { var c = document.createElement(\"span\"); c.className = \"ef-slr__c\"; c.textContent = word.charAt(i); w.appendChild(c); }\n      p.appendChild(w);\n    });\n  });\n  function chars(panel) { return Array.prototype.slice.call(panel.querySelectorAll(\".ef-slr__c\")); }\n\n  function an(el, kf, op) {\n    var a = el.animate(kf, Object.assign({ fill: \"both\" }, op));\n    running.push(a);\n    return a;\n  }\n  function done(list) {\n    return Promise.all(list.map(function (a) { return a.finished; })).then(function () {\n      list.forEach(function (a) { a.cancel(); });\n      return true;\n    }, function () { return false; });\n  }\n  function cancelAll() { running.forEach(function (a) { try { a.cancel(); } catch (e) {} }); running = []; }\n\n  function setView(n) {\n    view = n;\n    panels.forEach(function (p, i) {\n      p.classList.toggle(\"is-current\", i === n);\n      if (i === n) p.removeAttribute(\"inert\"); else p.setAttribute(\"inert\", \"\");\n      p.setAttribute(\"aria-hidden\", i === n ? \"false\" : \"true\");\n    });\n    tog.setAttribute(\"aria-pressed\", n === 1 ? \"true\" : \"false\");\n    Array.prototype.forEach.call(tls, function (t, i) { t.classList.toggle(\"is-on\", i === (n === 1 ? 1 : 0)); });\n  }\n  function target(n) { return n === 1 ? opts.tint : BASE; }\n\n  function swap(to) {\n    if (animating || to === view || destroyed) return;\n    if (reduce) {\n      setView(to);\n      wrap.style.backgroundColor = target(to);\n      an(panels[to], [{ opacity: 0 }, { opacity: 1 }], { duration: 160, easing: \"ease-out\" }).finished.then(function () { cancelAll(); }, function () {});\n      return;\n    }\n    animating = true;\n    var D = opts.duration, S = opts.stagger, from = view;\n    var outC = chars(panels[from]), outs = [];\n    outC.forEach(function (c, i) {\n      outs.push(an(c, [{ transform: \"translateY(0)\", opacity: 1 }, { transform: \"translateY(-100%)\", opacity: 0 }], { duration: D, delay: i * S, easing: \"cubic-bezier(.55,.06,.68,.19)\" }));\n    });\n    if (from === 1) outs.push(an(fig, [{ opacity: 1, transform: \"translateY(0)\" }, { opacity: 0, transform: \"translateY(20%)\" }], { duration: D * 0.8, easing: \"ease-in\" }));\n    var total = D + Math.max(0, outC.length - 1) * S;\n    var goal = target(to);\n    var bg = an(wrap, [{ backgroundColor: getComputedStyle(wrap).backgroundColor }, { backgroundColor: goal }], { duration: 800, delay: Math.max(0, total - D / 4), easing: \"ease-in-out\" });\n    done(outs).then(function (ok) {\n      if (!ok || destroyed) return;\n      setView(to);\n      var inn = [];\n      chars(panels[to]).forEach(function (c, i) {\n        inn.push(an(c, [{ transform: \"translateY(100%)\" }, { transform: \"translateY(0)\" }], { duration: D, delay: i * S, easing: \"cubic-bezier(.215,.61,.355,1)\" }));\n      });\n      if (to === 1) inn.push(an(fig, [{ opacity: 0, transform: \"translateY(40%) rotate(-4deg)\" }, { opacity: 1, transform: \"translateY(0) rotate(0deg)\" }], { duration: 800, delay: D * 1.2, easing: \"cubic-bezier(.215,.61,.355,1)\" }));\n      inn.push(bg);\n      done(inn).then(function (ok2) {\n        if (!ok2 || destroyed) return;\n        wrap.style.backgroundColor = target(view);\n        animating = false;\n      });\n    });\n  }\n\n  function onTog() { swap(view === 1 ? 0 : 1); }\n  function onHome() { swap(0); }\n  function onMove(e) {\n    if (reduce || e.pointerType === \"touch\") return;\n    var r = wrap.getBoundingClientRect();\n    tx = e.clientX - r.left - opts.cursor / 2; ty = e.clientY - r.top - opts.cursor / 2;\n    if (!seen) { seen = true; cx = tx; cy = ty; }\n    cur.classList.add(\"is-on\");\n    kick();\n  }\n  function onLeave() { cur.classList.remove(\"is-on\"); }\n  function kick() { if (!raf && !destroyed) raf = requestAnimationFrame(tick); }\n  function tick() {\n    raf = 0;\n    cx = lerp(cx, tx, 0.18); cy = lerp(cy, ty, 0.18);\n    cur.style.transform = \"translate3d(\" + cx.toFixed(1) + \"px,\" + cy.toFixed(1) + \"px,0)\";\n    if (Math.abs(tx - cx) > 0.1 || Math.abs(ty - cy) > 0.1) raf = requestAnimationFrame(tick);\n  }\n\n  function update(next) {\n    opts = Object.assign({ accent: \"#e6ff55\", tint: \"#c6f26b\", stagger: 14, duration: 500, cursor: 56 }, opts, next || {});\n    opts.stagger = clamp(+opts.stagger, 4, 60);\n    opts.duration = clamp(+opts.duration, 200, 1200);\n    opts.cursor = clamp(+opts.cursor, 24, 120);\n    wrap.style.setProperty(\"--ef-acc\", opts.accent);\n    wrap.style.setProperty(\"--ef-cur\", opts.cursor + \"px\");\n    art.style.color = opts.accent;\n    if (!animating) wrap.style.backgroundColor = target(view);\n  }\n\n  var wire = function (el, ev, fn) { el.addEventListener(ev, fn); offs.push(function () { el.removeEventListener(ev, fn); }); };\n  wire(tog, \"click\", onTog);\n  wire(home, \"click\", onHome);\n  wire(wrap, \"pointermove\", onMove);\n  wire(wrap, \"pointerleave\", onLeave);\n  setView(0);\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      destroyed = true;\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n      cancelAll();\n      offs.forEach(function (f) { f(); });\n      offs = [];\n    }\n  };\n}"
  }
}