{
  "id": "fanned-card-deck",
  "kind": "element",
  "title": "Fanned card deck",
  "summary": "A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.",
  "url": "https://enrichr.dev/elements/fanned-card-deck.html",
  "section": "gallery",
  "techniques": [
    "carousel",
    "3d-css",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "playful",
    "editorial"
  ],
  "intents": [
    "fanned card carousel",
    "card deck slider",
    "3D card fan gallery",
    "looping card carousel with arrows",
    "hand of cards gallery"
  ],
  "status": "tested",
  "params": [
    {
      "key": "words",
      "label": "Cards (comma separated)",
      "type": "text",
      "value": "Form, Flow, Play, Feel, Move"
    },
    {
      "key": "spread",
      "label": "Spread (px)",
      "type": "range",
      "min": 60,
      "max": 240,
      "step": 10,
      "value": 150
    },
    {
      "key": "tilt",
      "label": "Tilt per card (deg)",
      "type": "range",
      "min": 0,
      "max": 20,
      "step": 1,
      "value": 9
    },
    {
      "key": "turn",
      "label": "3D turn per card (deg)",
      "type": "range",
      "min": 0,
      "max": 40,
      "step": 2,
      "value": 18
    },
    {
      "key": "duration",
      "label": "Duration (ms)",
      "type": "range",
      "min": 200,
      "max": 1400,
      "step": 50,
      "value": 800
    },
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "background",
      "label": "Background",
      "type": "color",
      "value": "#0c1e18"
    },
    {
      "key": "ink",
      "label": "Light card colour",
      "type": "color",
      "value": "#fbf8f1"
    }
  ],
  "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 \"Fanned card deck\" element to this project.\n\nThis is the \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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/fanned-card-deck.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 \"Fanned card deck\" 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 \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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 \"Fanned card deck\" element to this codebase.\n\nThis is the \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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-fanned-card-deck.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Fanned card deck 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 \"Fanned card deck\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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- fanned-card-deck.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 \"./fanned-card-deck\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function FannedCardDeck(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 \"Fanned card deck\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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- fanned-card-deck.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/FannedCardDeck.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./fanned-card-deck\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function FannedCardDeck(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 \"Fanned card deck\" element.\n\nThis is the \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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), fanned-card-deck.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 \"Fanned card deck\" element. No packages, no server code.\n\nThis is the \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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 fanned-card-deck.js and then main.js), style.css (the CSS below), fanned-card-deck.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 \"Fanned card deck\" 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 \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.json\n\nWhat it does: Each card's place is its signed distance from the selected card around the loop, so the deck has no ends. That distance sets its sideways offset, a small drop, a rotation, a turn away in 3D, a smaller scale and a fade, and the cards transition to their new transforms on a smooth in-out curve. A card that wraps from one end of the fan to the other has its transition switched off for that move, so it jumps behind the deck instead of sweeping across the front. Spacing scales with the width of the stage.\nAccessibility: The deck is a focusable group described as a carousel, and Left, Right, Home and End move through it. Each card is labelled with its position, side cards are hidden from assistive technology, and the counter is a polite live region. Previous and Next are real buttons with labels. With prefers-reduced-motion the cards move without 3D turns or sliding.\n\nTunable settings:\n- Cards (comma separated): text, default Form, Flow, Play, Feel, Move\n- Spread (px): range 60 to 240, step 10, default 150\n- Tilt per card (deg): range 0 to 20, step 1, default 9\n- 3D turn per card (deg): range 0 to 40, step 2, default 18\n- Duration (ms): range 200 to 1400, step 50, default 800\n- Accent colour: color, default #e6ff55\n- Background: color, default #0c1e18\n- Light card colour: color, default #fbf8f1\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/fanned-card-deck.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 \"Fanned card deck\" 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 \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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 FannedCardDeck.\n2. Paste the JavaScript below into a separate code file named fanned-card-deck.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 \"./fanned-card-deck\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function FannedCardDeck(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(FannedCardDeck, {\n  words: { type: ControlType.String, title: \"Cards (comma separated)\", defaultValue: \"Form, Flow, Play, Feel, Move\" },\n  spread: { type: ControlType.Number, title: \"Spread\", min: 60, max: 240, step: 10, defaultValue: 150 },\n  tilt: { type: ControlType.Number, title: \"Tilt per card\", min: 0, max: 20, step: 1, defaultValue: 9 },\n  turn: { type: ControlType.Number, title: \"3D turn per card\", min: 0, max: 40, step: 2, defaultValue: 18 },\n  duration: { type: ControlType.Number, title: \"Duration\", min: 200, max: 1400, step: 50, defaultValue: 800 },\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  background: { type: ControlType.Color, title: \"Background\", defaultValue: \"#0c1e18\" },\n  ink: { type: ControlType.Color, title: \"Light card colour\", defaultValue: \"#fbf8f1\" },\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 \"Fanned card deck\" 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 \"Fanned card deck\" element from the Enrichr Library: A looping deck of cards fanned like a hand around the one in focus, moved with buttons, arrow keys, a swipe or a click on a side card.\nPage: https://enrichr.dev/elements/fanned-card-deck.html\nMachine-readable spec: https://enrichr.dev/elements/fanned-card-deck.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-fanned-card-deck\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-fanned-card-deck\"), { ...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 deck is a focusable group described as a carousel, and Left, Right, Home and End move through it. Each card is labelled with its position, side cards are hidden from assistive technology, and the counter is a polite live region. Previous and Next are real buttons with labels. With prefers-reduced-motion the cards move without 3D turns or sliding.",
  "performance": "Moves are CSS transitions on transform and opacity, composited without layout. Nothing runs at rest; a ResizeObserver recomputes the spacing only when the stage width changes.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-fan\">\n  <div class=\"ef-fan__stage\" role=\"group\" aria-roledescription=\"carousel\" aria-label=\"Card deck, use the left and right arrow keys\" tabindex=\"0\">\n    <div class=\"ef-fan__deck\"></div>\n  </div>\n  <div class=\"ef-fan__ctl\">\n    <button type=\"button\" class=\"ef-fan__btn ef-fan__prev\" aria-label=\"Previous card\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M19 12H5M11 6l-6 6 6 6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg></button>\n    <span class=\"ef-fan__count\" aria-live=\"polite\"></span>\n    <button type=\"button\" class=\"ef-fan__btn ef-fan__next\" aria-label=\"Next card\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M5 12h14M13 6l6 6-6 6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg></button>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-fan { --ef-fan-bg: #0c1e18; --ef-fan-acc: #e6ff55; --ef-fan-ink: #fbf8f1; --ef-fan-d: 800ms; width: 100%; box-sizing: border-box; padding: 1rem 0.5rem 1.2rem; border-radius: 1rem; background: var(--ef-fan-bg); color: var(--ef-fan-ink); font-family: \"Helvetica Neue\", Arial, \"Segoe UI\", system-ui, sans-serif; }\n.ef-fan__stage { position: relative; height: 21rem; perspective: 1200px; overflow: hidden; touch-action: pan-y; cursor: grab; outline: none; border-radius: 0.8rem; }\n.ef-fan__stage:focus-visible { box-shadow: inset 0 0 0 3px var(--ef-fan-acc); }\n.ef-fan__stage.is-drag { cursor: grabbing; }\n.ef-fan__deck { position: absolute; left: 50%; top: 50%; width: 12.5rem; height: 17rem; margin: -8.5rem 0 0 -6.25rem; transform-style: preserve-3d; }\n.ef-fan__card { position: absolute; inset: 0; box-sizing: border-box; padding: 1.2rem; border-radius: 1.1rem; display: flex; flex-direction: column; justify-content: space-between; background: var(--ef-fan-acc); color: var(--ef-fan-bg); box-shadow: 0 1.2rem 2.6rem rgba(0, 0, 0, 0.35); transform-origin: 50% 80%; backface-visibility: hidden; transition: transform var(--ef-fan-d) cubic-bezier(0.65, 0, 0.35, 1), opacity var(--ef-fan-d) ease; user-select: none; }\n.ef-fan__card:nth-child(4n+2) { background: var(--ef-fan-ink); }\n.ef-fan__card:nth-child(4n+3) { background: color-mix(in srgb, var(--ef-fan-acc) 35%, #4b8a5f); }\n.ef-fan__card:nth-child(4n) { background: color-mix(in srgb, var(--ef-fan-ink) 80%, var(--ef-fan-acc)); }\n.ef-fan__card.is-jump { transition: none; }\n.ef-fan__lbl { font: 600 0.62rem/1 ui-monospace, \"SFMono-Regular\", Menlo, monospace; letter-spacing: 0.12em; }\n.ef-fan__g { display: block; width: 58%; height: auto; margin: 0 auto; }\n.ef-fan__w { margin: 0; font-size: 3rem; font-weight: 900; line-height: 0.9; letter-spacing: -0.07em; text-transform: uppercase; }\n.ef-fan__ctl { display: flex; align-items: center; justify-content: center; gap: 1.6rem; margin-top: 0.6rem; }\n.ef-fan__btn { display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 1px solid color-mix(in srgb, var(--ef-fan-ink) 45%, transparent); border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }\n.ef-fan__btn svg { width: 1.2rem; height: 1.2rem; }\n.ef-fan__btn:hover { background: var(--ef-fan-acc); color: var(--ef-fan-bg); border-color: var(--ef-fan-acc); }\n.ef-fan__btn:focus-visible { outline: 3px solid var(--ef-fan-acc); outline-offset: 3px; }\n.ef-fan__count { min-width: 4.5rem; text-align: center; font: 600 0.8rem/1 ui-monospace, \"SFMono-Regular\", Menlo, monospace; letter-spacing: 0.1em; }\n@media (prefers-reduced-motion: reduce) { .ef-fan__card { transition: opacity 200ms ease; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Fanned card deck: cards spread like a hand of playing cards around the one in focus. Each card's place is its distance\n// from the selected card on a loop, and that distance sets its offset, lift, tilt, turn away in 3D, size and fade. Moving\n// is a CSS transition on transform; a card that wraps from one end of the fan to the other jumps instead of sweeping across.\n// Buttons, arrow keys, a swipe or drag, or a click on a side card all change the selection, and the counter is announced.\n// mount(root, { words (comma separated), spread (px between cards), tilt (deg per step), turn (3D turn per step), duration (ms),\n//               accent, background, ink })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var box = root.querySelector(\".ef-fan\");\n  var stage = root.querySelector(\".ef-fan__stage\");\n  var deck = root.querySelector(\".ef-fan__deck\");\n  var count = root.querySelector(\".ef-fan__count\");\n  var prev = root.querySelector(\".ef-fan__prev\");\n  var next = root.querySelector(\".ef-fan__next\");\n  var NS = \"http://www.w3.org/2000/svg\";\n  var GLYPHS = [\n    '<path d=\"M50 8V92M8 50H92M20 20L80 80M80 20L20 80\" stroke-width=\"10\" stroke-linecap=\"round\"/>',\n    '<circle cx=\"50\" cy=\"50\" r=\"40\" stroke-width=\"8\"/><path d=\"M50 10a40 40 0 0 1 0 80z\" stroke=\"none\" fill=\"currentColor\"/>',\n    '<circle cx=\"50\" cy=\"50\" r=\"40\" stroke-width=\"7\"/><circle cx=\"50\" cy=\"50\" r=\"20\" stroke-width=\"7\"/><circle cx=\"50\" cy=\"50\" r=\"5\" stroke=\"none\" fill=\"currentColor\"/>',\n    '<path d=\"M22 78L78 22M36 22h42v42\" stroke-width=\"10\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>',\n    '<path d=\"M50 6L94 50L50 94L6 50Z\" stroke-width=\"8\" stroke-linejoin=\"round\"/><path d=\"M50 30L70 50L50 70L30 50Z\" stroke=\"none\" fill=\"currentColor\"/>'\n  ];\n  var opts = {}, cards = [], sel = 0, prevD = [], scale = 1, ro = null, drag = null, offs = [];\n\n  function build() {\n    deck.textContent = \"\";\n    cards = []; prevD = [];\n    var words = String(opts.words).split(\",\").map(function (s) { return s.trim(); }).filter(Boolean).slice(0, 9);\n    if (words.length < 2) words = words.concat([\"Card\", \"Deck\"]).slice(0, 3);\n    words.forEach(function (word, i) {\n      var c = document.createElement(\"article\"); c.className = \"ef-fan__card\";\n      c.setAttribute(\"role\", \"group\"); c.setAttribute(\"aria-roledescription\", \"slide\");\n      c.setAttribute(\"aria-label\", (i + 1) + \" of \" + words.length + \": \" + word);\n      var l = document.createElement(\"span\"); l.className = \"ef-fan__lbl\"; l.textContent = \"STUDY \" + String(i + 1).padStart(2, \"0\");\n      var g = document.createElementNS(NS, \"svg\"); g.setAttribute(\"viewBox\", \"0 0 100 100\"); g.setAttribute(\"class\", \"ef-fan__g\");\n      g.setAttribute(\"aria-hidden\", \"true\"); g.setAttribute(\"focusable\", \"false\"); g.setAttribute(\"fill\", \"none\"); g.setAttribute(\"stroke\", \"currentColor\");\n      g.innerHTML = GLYPHS[i % GLYPHS.length];\n      var h = document.createElement(\"h3\"); h.className = \"ef-fan__w\"; h.textContent = word;\n      c.appendChild(l); c.appendChild(g); c.appendChild(h);\n      c.addEventListener(\"click\", function () { if (!drag || !drag.moved) go(i); });\n      deck.appendChild(c); cards.push(c);\n    });\n    sel = Math.min(sel, cards.length - 1);\n  }\n  function dist(i) {\n    var n = cards.length, d = ((i - sel) % n + n) % n;\n    if (d > n / 2) d -= n;\n    return d;\n  }\n  function layout() {\n    var n = cards.length;\n    cards.forEach(function (c, i) {\n      var d = dist(i), a = Math.abs(d);\n      var wrap = prevD[i] !== undefined && Math.abs(d - prevD[i]) > 1.5;\n      c.classList.toggle(\"is-jump\", wrap);\n      var x = d * opts.spread * scale, y = a * 18 * scale;\n      c.style.transform = reduce\n        ? \"translate3d(\" + x + \"px,\" + y + \"px,0) scale(\" + (1 - a * 0.1) + \")\"\n        : \"translate3d(\" + x.toFixed(1) + \"px,\" + y.toFixed(1) + \"px,\" + (-a * 60) + \"px) rotate(\" + (d * opts.tilt) + \"deg) rotateY(\" + (-d * opts.turn) + \"deg) scale(\" + (1 - a * 0.1).toFixed(3) + \")\";\n      c.style.opacity = a === 0 || a === 1 ? \"1\" : a === 2 ? \"0.32\" : \"0\";\n      c.style.zIndex = String(20 - a);\n      c.style.pointerEvents = a > 2 ? \"none\" : \"\";\n      if (a === 0) c.removeAttribute(\"aria-hidden\"); else c.setAttribute(\"aria-hidden\", \"true\");\n      prevD[i] = d;\n    });\n    count.textContent = String(sel + 1).padStart(2, \"0\") + \" / \" + String(n).padStart(2, \"0\");\n    // Drop the jump flag after the new positions have been painted, so later moves animate again.\n    cancelAnimationFrame(wrapTimer);\n    wrapTimer = requestAnimationFrame(function () { wrapTimer = requestAnimationFrame(function () { cards.forEach(function (c) { c.classList.remove(\"is-jump\"); }); }); });\n  }\n  var wrapTimer = 0;\n  function go(i) { sel = (i % cards.length + cards.length) % cards.length; layout(); }\n  function step(k) { go(sel + k); }\n  function onKey(e) {\n    if (e.key === \"ArrowRight\") { e.preventDefault(); step(1); }\n    else if (e.key === \"ArrowLeft\") { e.preventDefault(); step(-1); }\n    else if (e.key === \"Home\") { e.preventDefault(); go(0); }\n    else if (e.key === \"End\") { e.preventDefault(); go(cards.length - 1); }\n  }\n  function down(e) { if (e.button !== undefined && e.button !== 0) return; drag = { x: e.clientX, moved: false, id: e.pointerId }; }\n  function move(e) {\n    if (!drag || e.pointerId !== drag.id) return;\n    if (!drag.moved && Math.abs(e.clientX - drag.x) > 8) { drag.moved = true; stage.classList.add(\"is-drag\"); try { stage.setPointerCapture(e.pointerId); } catch (err) {} }\n  }\n  function up(e) {\n    if (!drag || e.pointerId !== drag.id) return;\n    var dx = e.clientX - drag.x;\n    stage.classList.remove(\"is-drag\");\n    if (drag.moved && Math.abs(dx) > 40) step(dx < 0 ? 1 : -1);\n    var was = drag; setTimeout(function () { if (drag === was) drag = null; }, 0);\n  }\n  function measure() { scale = Math.max(0.45, Math.min(1, (stage.clientWidth || 720) / 720)); deck.style.transform = \"scale(\" + Math.max(0.7, scale).toFixed(3) + \")\"; layout(); }\n  function onPrev() { step(-1); }\n  function onNext() { step(1); }\n  stage.addEventListener(\"keydown\", onKey);\n  stage.addEventListener(\"pointerdown\", down);\n  stage.addEventListener(\"pointermove\", move);\n  stage.addEventListener(\"pointerup\", up);\n  stage.addEventListener(\"pointercancel\", up);\n  prev.addEventListener(\"click\", onPrev);\n  next.addEventListener(\"click\", onNext);\n  offs.push(function () {\n    stage.removeEventListener(\"keydown\", onKey); stage.removeEventListener(\"pointerdown\", down); stage.removeEventListener(\"pointermove\", move);\n    stage.removeEventListener(\"pointerup\", up); stage.removeEventListener(\"pointercancel\", up);\n    prev.removeEventListener(\"click\", onPrev); next.removeEventListener(\"click\", onNext);\n  });\n\n  function update(nextOpts) {\n    opts = Object.assign({ words: \"Form, Flow, Play, Feel, Move\", spread: 150, tilt: 9, turn: 18, duration: 800, accent: \"#e6ff55\", background: \"#0c1e18\", ink: \"#fbf8f1\" }, opts, nextOpts || {});\n    [\"spread\", \"tilt\", \"turn\", \"duration\"].forEach(function (k) { opts[k] = Number(opts[k]) || 0; });\n    box.style.setProperty(\"--ef-fan-d\", (reduce ? 0 : opts.duration) + \"ms\");\n    box.style.setProperty(\"--ef-fan-acc\", opts.accent);\n    box.style.setProperty(\"--ef-fan-bg\", opts.background);\n    box.style.setProperty(\"--ef-fan-ink\", opts.ink);\n    build();\n    measure();\n  }\n  update(o);\n  if (\"ResizeObserver\" in window) { ro = new ResizeObserver(function () { measure(); }); ro.observe(stage); }\n  return { update: update, destroy: function () { offs.forEach(function (f) { f(); }); offs = []; if (ro) ro.disconnect(); cancelAnimationFrame(wrapTimer); } };\n}"
  }
}