{
  "id": "image-drag-tilt",
  "kind": "element",
  "title": "Image drag with tilt",
  "summary": "A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.",
  "url": "https://enrichr.dev/elements/image-drag-tilt.html",
  "section": "gallery",
  "techniques": [
    "pointer-interaction",
    "carousel"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "playful",
    "tactile",
    "modern"
  ],
  "intents": [
    "draggable image gallery with inertia",
    "drag cards that tilt with velocity",
    "physics drag carousel",
    "swipe gallery skew effect",
    "draggable card row"
  ],
  "status": "tested",
  "params": [
    {
      "key": "colorA",
      "label": "Base colour",
      "type": "color",
      "value": "#005236"
    },
    {
      "key": "colorB",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "count",
      "label": "Cards",
      "type": "range",
      "min": 3,
      "max": 10,
      "step": 1,
      "value": 7
    },
    {
      "key": "tilt",
      "label": "Tilt amount",
      "type": "range",
      "min": 0,
      "max": 2,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "friction",
      "label": "Glide (higher = longer)",
      "type": "range",
      "min": 0.8,
      "max": 0.98,
      "step": 0.01,
      "value": 0.93
    }
  ],
  "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 \"Image drag with tilt\" element to this project.\n\nThis is the \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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/image-drag-tilt.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 \"Image drag with tilt\" 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 \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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 \"Image drag with tilt\" element to this codebase.\n\nThis is the \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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-image-drag-tilt.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Image drag with tilt 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 \"Image drag with tilt\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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- image-drag-tilt.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 \"./image-drag-tilt\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ImageDragTilt(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 \"Image drag with tilt\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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- image-drag-tilt.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/ImageDragTilt.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./image-drag-tilt\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ImageDragTilt(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 \"Image drag with tilt\" element.\n\nThis is the \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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), image-drag-tilt.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 \"Image drag with tilt\" element. No packages, no server code.\n\nThis is the \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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 image-drag-tilt.js and then main.js), style.css (the CSS below), image-drag-tilt.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 \"Image drag with tilt\" 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 \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.json\n\nWhat it does: The row is moved by a single translate value. While dragging, the pointer delta sets the position and a smoothed velocity is tracked. On release, that velocity keeps moving the row and decays by a friction factor each frame. Past either end, a spring pulls the row back and the drag itself is damped, so it feels like rubber rather than a wall. A second smoothed value follows the velocity and drives each card rotate, skewX and lift, with a small per-card multiplier so the cards do not move in lockstep. The loop stops when everything is at rest.\nAccessibility: The area is focusable and responds to the left and right arrow keys, which nudge the row with the same inertia. Cards are decorative and hidden from assistive technology, so replace them with real links or buttons for content that needs to be read. Reduced motion keeps plain dragging with no tilt, glide or springs. Touch input keeps vertical page scrolling.\n\nTunable settings:\n- Base colour: color, default #005236\n- Accent colour: color, default #e6ff55\n- Cards: range 3 to 10, step 1, default 7\n- Tilt amount: range 0 to 2, step 0.1, default 1\n- Glide (higher = longer): range 0.8 to 0.98, step 0.01, default 0.93\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/image-drag-tilt.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 \"Image drag with tilt\" 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 \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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 ImageDragTilt.\n2. Paste the JavaScript below into a separate code file named image-drag-tilt.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 \"./image-drag-tilt\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ImageDragTilt(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(ImageDragTilt, {\n  colorA: { type: ControlType.Color, title: \"Base colour\", defaultValue: \"#005236\" },\n  colorB: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  count: { type: ControlType.Number, title: \"Cards\", min: 3, max: 10, step: 1, defaultValue: 7 },\n  tilt: { type: ControlType.Number, title: \"Tilt amount\", min: 0, max: 2, step: 0.1, defaultValue: 1 },\n  friction: { type: ControlType.Number, title: \"Glide\", min: 0.8, max: 0.98, step: 0.01, defaultValue: 0.93 },\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 \"Image drag with tilt\" 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 \"Image drag with tilt\" element from the Enrichr Library: A row of generated art cards you drag with the pointer, tilting and skewing with speed, gliding on release and easing back from the ends.\nPage: https://enrichr.dev/elements/image-drag-tilt.html\nMachine-readable spec: https://enrichr.dev/elements/image-drag-tilt.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-image-drag-tilt\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-image-drag-tilt\"), { ...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 area is focusable and responds to the left and right arrow keys, which nudge the row with the same inertia. Cards are decorative and hidden from assistive technology, so replace them with real links or buttons for content that needs to be read. Reduced motion keeps plain dragging with no tilt, glide or springs. Touch input keeps vertical page scrolling.",
  "performance": "Only transforms change, on the row and on each card, and only while something is moving. The loop sleeps at rest and when the element is off screen. Ten cards with gradient art is light on the GPU.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-idt\">\n  <div class=\"ef-idt__stage\" tabindex=\"0\" role=\"group\" aria-roledescription=\"draggable gallery\" aria-label=\"Art cards. Drag, or use the left and right arrow keys.\">\n    <div class=\"ef-idt__track\"></div>\n    <p class=\"ef-idt__hint\" aria-hidden=\"true\">Drag</p>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-idt { width: 100%; }\n.ef-idt__stage { position: relative; overflow: hidden; width: 100%; min-height: 19rem; box-sizing: border-box; border-radius: 1rem; display: flex; align-items: center; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; outline: none; }\n.ef-idt__stage.is-drag { cursor: grabbing; }\n.ef-idt__stage:focus-visible { box-shadow: inset 0 0 0 2px #e6ff55; }\n.ef-idt__track { display: flex; gap: 1.1rem; padding: 2rem 1.6rem; will-change: transform; }\n.ef-idt__card { position: relative; flex: 0 0 auto; width: 10.5rem; height: 13.5rem; border-radius: 0.9rem; overflow: hidden; box-shadow: 0 18px 30px -16px rgba(0, 0, 0, 0.55); will-change: transform; transform-origin: 50% 90%; pointer-events: none; }\n.ef-idt__cap { position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.7rem; display: flex; justify-content: space-between; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #fbf8f1; }\n.ef-idt__hint { position: absolute; left: 50%; bottom: 0.7rem; margin: 0; transform: translateX(-50%); font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.55; pointer-events: none; transition: opacity 400ms; }\n.ef-idt__stage.is-moved .ef-idt__hint { opacity: 0; }\n.ef-idt__card::after { content: \"\"; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.55)); }\n.ef-idt__cap { z-index: 1; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Image drag tilt: a row of procedurally drawn art cards you can drag. Cards rotate and skew with the drag velocity, glide on with inertia\n// when released, and ease softly back from the ends. Arrow keys nudge the row. Reduced motion keeps plain dragging with no tilt or glide.\n// mount(root, { background, colorA, colorB, count (3-10), tilt (0-2), friction (0.8-0.98) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var stage = root.querySelector(\".ef-idt__stage\");\n  var track = root.querySelector(\".ef-idt__track\");\n  var opts = {}, cards = [], raf = 0, visible = true, io = null;\n  var x = 0, v = 0, tiltV = 0, dragging = false, lastX = 0, lastT = 0, minX = 0, moved = false, pid = null;\n  var TITLES = [\"Tide\", \"Ember\", \"Moss\", \"Dusk\", \"Arch\", \"Grain\", \"Haze\", \"Loop\", \"Shore\", \"Bloom\"];\n\n  function art(i, a, b) {\n    var c = \"#fbf8f1\";\n    var p = i % 6;\n    if (p === 0) return \"radial-gradient(circle at 50% 42%, \" + b + \" 0 24%, transparent 25%), linear-gradient(160deg, \" + a + \", #0c1e18)\";\n    if (p === 1) return \"conic-gradient(from 200deg at 30% 70%, \" + a + \", \" + b + \", \" + c + \", \" + a + \")\";\n    if (p === 2) return \"repeating-linear-gradient(115deg, \" + a + \" 0 14px, #0c1e18 14px 28px), linear-gradient(\" + a + \", \" + a + \")\";\n    if (p === 3) return \"radial-gradient(circle at 36% 40%, \" + b + \" 0 22%, transparent 23%), radial-gradient(circle at 64% 60%, \" + c + \" 0 22%, transparent 23%), linear-gradient(200deg, \" + a + \", #0c3a2b)\";\n    if (p === 4) return \"radial-gradient(ellipse 34% 28% at 50% 46%, \" + c + \" 0 99%, transparent 100%), linear-gradient(\" + c + \", \" + c + \") 50% 100% / 68% 46% no-repeat, linear-gradient(180deg, \" + a + \", \" + b + \")\";\n    return \"radial-gradient(circle, \" + b + \" 0 2.5px, transparent 3px) 0 0 / 18px 18px, linear-gradient(145deg, \" + a + \", #0c1e18)\";\n  }\n  function build() {\n    track.textContent = \"\";\n    cards = [];\n    for (var i = 0; i < opts.count; i++) {\n      var d = document.createElement(\"div\");\n      d.className = \"ef-idt__card\";\n      d.style.background = art(i, opts.colorA, opts.colorB);\n      d.setAttribute(\"aria-hidden\", \"true\");\n      var cap = document.createElement(\"div\");\n      cap.className = \"ef-idt__cap\";\n      var s1 = document.createElement(\"span\"); s1.textContent = TITLES[i % TITLES.length];\n      var s2 = document.createElement(\"span\"); s2.textContent = String(i + 1).padStart(2, \"0\");\n      cap.appendChild(s1); cap.appendChild(s2); d.appendChild(cap);\n      track.appendChild(d);\n      cards.push(d);\n    }\n    measure();\n    x = Math.max(minX, Math.min(0, x));\n    paint();\n  }\n  function measure() { minX = Math.min(0, stage.clientWidth - track.scrollWidth); }\n  function paint() {\n    track.style.transform = \"translate3d(\" + x.toFixed(2) + \"px,0,0)\";\n    if (reduce) return;\n    var t = Math.max(-1, Math.min(1, tiltV / 40)) * opts.tilt;\n    for (var i = 0; i < cards.length; i++) {\n      var f = 0.75 + (i % 3) * 0.25;\n      cards[i].style.transform = \"rotate(\" + (t * 14 * f).toFixed(2) + \"deg) skewX(\" + (-t * 9 * f).toFixed(2) + \"deg) translateY(\" + (Math.abs(t) * -6 * f).toFixed(1) + \"px)\";\n    }\n  }\n  function wake() { if (!raf && visible) raf = requestAnimationFrame(frame); }\n  function frame() {\n    raf = 0;\n    measure();\n    if (!dragging) {\n      if (reduce) { v = 0; } else {\n        x += v;\n        v *= opts.friction;\n        if (x > 0) { v += (0 - x) * 0.07; v *= 0.82; if (Math.abs(x) < 0.3 && Math.abs(v) < 0.3) { x = 0; v = 0; } }\n        else if (x < minX) { v += (minX - x) * 0.07; v *= 0.82; if (Math.abs(x - minX) < 0.3 && Math.abs(v) < 0.3) { x = minX; v = 0; } }\n      }\n    }\n    tiltV += (v - tiltV) * 0.14;\n    paint();\n    var settled = !dragging && Math.abs(v) < 0.05 && Math.abs(tiltV) < 0.05 && x <= 0 && x >= minX;\n    if (!settled) raf = requestAnimationFrame(frame);\n    else { tiltV = 0; paint(); }\n  }\n  function down(e) {\n    if (e.button > 0) return;\n    dragging = true; moved = false; pid = e.pointerId;\n    lastX = e.clientX; lastT = performance.now(); v = 0;\n    try { stage.setPointerCapture(e.pointerId); } catch (x2) {}\n    stage.classList.add(\"is-drag\");\n    wake();\n  }\n  function move(e) {\n    if (!dragging || e.pointerId !== pid) return;\n    var now = performance.now();\n    var dx = e.clientX - lastX, dt = Math.max(1, now - lastT);\n    var over = x > 0 ? x : x < minX ? minX - x : 0;\n    x += dx * (over > 0 ? 1 / (1 + over / 60) : 1);\n    var inst = dx / dt * 16;\n    v += (inst - v) * 0.4;\n    lastX = e.clientX; lastT = now;\n    if (!moved && Math.abs(dx) > 1) { moved = true; stage.classList.add(\"is-moved\"); }\n    wake();\n  }\n  function up(e) {\n    if (!dragging || (e && e.pointerId !== pid)) return;\n    dragging = false;\n    if (performance.now() - lastT > 90) v = 0;\n    stage.classList.remove(\"is-drag\");\n    wake();\n  }\n  function key(e) {\n    var d = e.key === \"ArrowRight\" ? -1 : e.key === \"ArrowLeft\" ? 1 : 0;\n    if (!d) return;\n    e.preventDefault();\n    stage.classList.add(\"is-moved\");\n    if (reduce) { x = Math.max(minX, Math.min(0, x + d * 160)); paint(); } else { v += d * 22; }\n    wake();\n  }\n  function resize() { measure(); x = Math.max(minX, Math.min(0, x)); wake(); }\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ background: \"#0c1e18\", colorA: \"#005236\", colorB: \"#e6ff55\", count: 7, tilt: 1, friction: 0.93 }, opts, next || {});\n    opts.count = Math.max(3, Math.min(10, Math.round(opts.count)));\n    stage.style.background = opts.background;\n    stage.style.color = \"#fbf8f1\";\n    if (prev.count !== opts.count || prev.colorA !== opts.colorA || prev.colorB !== opts.colorB) build();\n  }\n  update(o);\n  stage.addEventListener(\"pointerdown\", down);\n  stage.addEventListener(\"pointermove\", move);\n  stage.addEventListener(\"pointerup\", up);\n  stage.addEventListener(\"pointercancel\", up);\n  stage.addEventListener(\"keydown\", key);\n  window.addEventListener(\"resize\", resize);\n  if (\"IntersectionObserver\" in window) {\n    io = new IntersectionObserver(function (en) { visible = en[0].isIntersecting; if (visible) wake(); else { cancelAnimationFrame(raf); raf = 0; } });\n    io.observe(stage);\n  }\n  if (!reduce) { v = -16; wake(); }\n  return {\n    update: update,\n    destroy: function () {\n      cancelAnimationFrame(raf); raf = 0;\n      if (io) io.disconnect();\n      stage.removeEventListener(\"pointerdown\", down);\n      stage.removeEventListener(\"pointermove\", move);\n      stage.removeEventListener(\"pointerup\", up);\n      stage.removeEventListener(\"pointercancel\", up);\n      stage.removeEventListener(\"keydown\", key);\n      window.removeEventListener(\"resize\", resize);\n    }\n  };\n}"
  }
}