{
  "id": "gradient-waves",
  "kind": "element",
  "title": "Gradient waves background",
  "summary": "Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.",
  "url": "https://enrichr.dev/elements/gradient-waves.html",
  "section": "background",
  "techniques": [
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "Canvas 2D"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "fluid",
    "calm",
    "soft"
  ],
  "intents": [
    "animated gradient waves background",
    "flowing sine wave hero background",
    "layered wave bands canvas",
    "pointer reactive wave background",
    "calm moving gradient backdrop"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "bands",
      "label": "Wave bands",
      "type": "range",
      "min": 3,
      "max": 8,
      "step": 1,
      "value": 5
    },
    {
      "key": "speed",
      "label": "Flow speed",
      "type": "range",
      "min": 0,
      "max": 2,
      "step": 0.1,
      "value": 0.8
    },
    {
      "key": "amplitude",
      "label": "Wave height",
      "type": "range",
      "min": 0.3,
      "max": 2,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "pointer",
      "label": "Pointer influence",
      "type": "range",
      "min": 0,
      "max": 1,
      "step": 0.05,
      "value": 0.7
    }
  ],
  "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 \"Gradient waves background\" element to this project.\n\nThis is the \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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/gradient-waves.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 \"Gradient waves background\" 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 \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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 \"Gradient waves background\" element to this codebase.\n\nThis is the \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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-gradient-waves.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Gradient waves background 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 \"Gradient waves background\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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- gradient-waves.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 \"./gradient-waves\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GradientWaves(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 \"Gradient waves background\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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- gradient-waves.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/GradientWaves.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./gradient-waves\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GradientWaves(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 \"Gradient waves background\" element.\n\nThis is the \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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), gradient-waves.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 \"Gradient waves background\" element. No packages, no server code.\n\nThis is the \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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 gradient-waves.js and then main.js), style.css (the CSS below), gradient-waves.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 \"Gradient waves background\" 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 \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.json\n\nWhat it does: Each band is a vertical stack position with its own sine mix: one wave plus a faster harmonic, each with its own phase that advances with time. Every frame the script walks across the canvas in small steps, builds the band's top edge as a path, closes it to the bottom and fills it with a gradient that runs from the band colour down to the ink background, then strokes the top edge with a thin light line. Bands are painted back to front so the nearer ones cover the farther ones. The pointer position is smoothed and adds a Gaussian bump to the amplitude around it and shifts every band's phase sideways. The puzzle piece reads the front band's height and slope at one x position and is moved and rotated to sit on it.\nAccessibility: Purely decorative: the canvas and the puzzle piece are hidden from assistive tech. Put your text in a normal element above it and check contrast against the lighter bands at the bottom. With prefers-reduced-motion the waves are drawn once as a still frame and only redraw if the pointer moves.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Wave bands: range 3 to 8, step 1, default 5\n- Flow speed: range 0 to 2, step 0.1, default 0.8\n- Wave height: range 0.3 to 2, step 0.1, default 1\n- Pointer influence: range 0 to 1, step 0.05, default 0.7\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/gradient-waves.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 \"Gradient waves background\" 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 \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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 GradientWaves.\n2. Paste the JavaScript below into a separate code file named gradient-waves.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 \"./gradient-waves\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GradientWaves(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(GradientWaves, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  bands: { type: ControlType.Number, title: \"Wave bands\", min: 3, max: 8, step: 1, defaultValue: 5 },\n  speed: { type: ControlType.Number, title: \"Flow speed\", min: 0, max: 2, step: 0.1, defaultValue: 0.8 },\n  amplitude: { type: ControlType.Number, title: \"Wave height\", min: 0.3, max: 2, step: 0.1, defaultValue: 1 },\n  pointer: { type: ControlType.Number, title: \"Pointer influence\", min: 0, max: 1, step: 0.05, defaultValue: 0.7 },\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 \"Gradient waves background\" 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 \"Gradient waves background\" element from the Enrichr Library: Layered, flowing sine-wave bands filled with green-to-lime gradients on a canvas. The pointer bulges the waves near it and slides their phase, and a puzzle piece rides the front wave.\nPage: https://enrichr.dev/elements/gradient-waves.html\nMachine-readable spec: https://enrichr.dev/elements/gradient-waves.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-gradient-waves\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-gradient-waves\"), { ...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": "Purely decorative: the canvas and the puzzle piece are hidden from assistive tech. Put your text in a normal element above it and check contrast against the lighter bands at the bottom. With prefers-reduced-motion the waves are drawn once as a still frame and only redraw if the pointer moves.",
  "performance": "One canvas, a few hundred line segments per band per frame, no per-pixel work. The pixel ratio is capped at 2, the loop pauses when the element is off screen, and it stops entirely on destroy(). Fewer bands or a smaller canvas lowers the cost further.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-gw\">\n  <div class=\"ef-gw__wrap\">\n    <canvas class=\"ef-gw__cv\" aria-hidden=\"true\"></canvas>\n    <svg class=\"ef-gw__piece\" viewBox=\"1513.7 1453.9 322.3 322.3\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M1821 1761.2h-292.3v-111.6c0-8 6.5-14.5 14.5-14.5 4.2 0 8.2 1.9 11 5.1 7.8 8.6 19.7 13.6 32.7 11.9 16.8-2.3 30.1-16 32-32.7 2.5-22.6-15.1-41.6-37.1-41.6-11 0-20.9 4.7-27.7 12.3-2.8 3.1-6.7 4.9-10.9 4.9-8 0-14.5-6.4-14.5-14.4v-111.7h292.3v111.7c0 8-6.4 14.4-14.5 14.4-4.2 0-8.1-1.8-10.9-5-7.9-8.6-19.7-13.6-32.7-11.9-16.8 2.2-30.1 15.9-32 32.7-2.5 22.6 15.1 41.6 37.1 41.6 11 0 20.8-4.8 27.7-12.3 2.8-3.1 6.7-5 10.8-5 8.1 0 14.5 6.5 14.5 14.5z\"/></svg>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-gw { width: 100%; height: 100%; }\n.ef-gw__wrap { position: relative; box-sizing: border-box; width: 100%; height: 100%; min-height: 18rem; border-radius: 1rem; overflow: hidden; background: #0c1e18; touch-action: pan-y; }\n.ef-gw__cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }\n.ef-gw__piece { position: absolute; left: 0; top: 0; width: 3.6rem; height: 3.6rem; color: var(--ef-acc, #e6ff55); pointer-events: none; will-change: transform; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35)); }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Gradient waves: layered, flowing sine-wave bands filled with green-to-lime gradients on a <canvas> 2D context. The pointer bulges the\n// bands near it (amplitude) and slides their phase sideways. A puzzle piece rides the front wave. Reduced motion draws one still frame.\n// mount(root, { background, accent, bands (3-8), speed (0-2), amplitude (0.3-2), pointer (0-1) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-gw__wrap\");\n  var cv = root.querySelector(\".ef-gw__cv\");\n  var piece = root.querySelector(\".ef-gw__piece\");\n  var ctx = cv.getContext(\"2d\");\n  var opts = {}, w = 0, h = 0, dpr = 1, t = 2.4, last = 0, raf = 0, vis = true, dead = false;\n  var px = 0.5, py = 0.5, tpx = 0.5, tpy = 0.5, act = 0, tact = 0;\n  var offs = [];\n  var RAMP = [\"#005236\", \"#0a6b46\", \"#2f7d5b\", \"#c6f26b\"];\n\n  function rgb(c) { var n = parseInt(String(c).replace(\"#\", \"\"), 16); return [(n >> 16) & 255, (n >> 8) & 255, n & 255]; }\n  function ramp(k, a) {\n    var st = RAMP.concat([opts.accent]).map(rgb);\n    var f = Math.max(0, Math.min(0.9999, k)) * (st.length - 1), i = Math.floor(f), m = f - i, A = st[i], B = st[i + 1];\n    return \"rgba(\" + Math.round(A[0] + (B[0] - A[0]) * m) + \",\" + Math.round(A[1] + (B[1] - A[1]) * m) + \",\" + Math.round(A[2] + (B[2] - A[2]) * m) + \",\" + a + \")\";\n  }\n  function band(i, n) {\n    var k = n > 1 ? i / (n - 1) : 0;\n    var boost = act * opts.pointer;\n    return {\n      k: k, i: i,\n      base: h * (0.3 + 0.52 * k),\n      amp: h * (0.045 + 0.04 * k) * opts.amplitude,\n      f: 0.9 + ((i * 37) % 5) * 0.14,\n      ph: t * opts.speed * (i % 2 ? 1 : -0.8) * (0.7 + k * 0.6) + i * 1.1 + (px - 0.5) * boost * 4\n    };\n  }\n  function yAt(b, x) {\n    var u = x / w, TAU = Math.PI * 2;\n    var s = Math.sin(u * TAU * b.f + b.ph) + 0.45 * Math.sin(u * TAU * b.f * 1.9 - b.ph * 0.8 + b.i * 1.7);\n    var near = Math.exp(-Math.pow(u - px, 2) / 0.05) * Math.exp(-Math.pow(b.base / h - py, 2) / 0.1);\n    return b.base + s * b.amp * (1 + near * act * opts.pointer * 2.2);\n  }\n  function draw() {\n    if (!w || !h) return;\n    ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n    var bg = ctx.createLinearGradient(0, 0, 0, h);\n    bg.addColorStop(0, opts.background); bg.addColorStop(1, \"#005236\");\n    ctx.fillStyle = bg; ctx.fillRect(0, 0, w, h);\n    var n = opts.bands, step = Math.max(4, w / 110), front = null;\n    for (var i = 0; i < n; i++) {\n      var b = band(i, n); front = b;\n      ctx.beginPath();\n      ctx.moveTo(0, yAt(b, 0));\n      for (var x = step; x < w + step; x += step) ctx.lineTo(x, yAt(b, x));\n      var edge = ctx.createLinearGradient(0, b.base - b.amp * 1.6, 0, Math.min(h, b.base + h * 0.42));\n      edge.addColorStop(0, ramp(b.k, 0.95));\n      edge.addColorStop(1, \"rgba(12,30,24,0.9)\");\n      ctx.lineTo(w + step, h); ctx.lineTo(0, h); ctx.closePath();\n      ctx.fillStyle = edge; ctx.fill();\n      ctx.beginPath();\n      ctx.moveTo(0, yAt(b, 0));\n      for (var x2 = step; x2 < w + step; x2 += step) ctx.lineTo(x2, yAt(b, x2));\n      ctx.lineWidth = 1.5;\n      ctx.strokeStyle = i === n - 1 ? \"rgba(251,248,241,0.8)\" : \"rgba(251,248,241,\" + (0.1 + 0.22 * b.k).toFixed(2) + \")\";\n      ctx.stroke();\n    }\n    if (front && piece) {\n      var s = piece.getBoundingClientRect().width || 58, cx = w * 0.74;\n      var y0 = yAt(front, cx - 6), y1 = yAt(front, cx + 6), ang = Math.atan2(y1 - y0, 12) * 57.3;\n      piece.style.transform = \"translate(\" + (cx - s / 2).toFixed(1) + \"px,\" + (((y0 + y1) / 2) - s * 0.82).toFixed(1) + \"px) rotate(\" + (ang - 8).toFixed(1) + \"deg)\";\n    }\n  }\n  function size() {\n    var r = wrap.getBoundingClientRect();\n    w = r.width; h = r.height;\n    if (!w || !h) return;\n    dpr = Math.min(window.devicePixelRatio || 1, 2);\n    cv.width = Math.round(w * dpr); cv.height = Math.round(h * dpr);\n    draw();\n  }\n  function frame(ts) {\n    raf = 0;\n    if (!vis || dead) return;\n    var dt = Math.min(0.05, (ts - last) / 1000 || 0.016); last = ts;\n    t += dt;\n    px += (tpx - px) * Math.min(1, dt * 6); py += (tpy - py) * Math.min(1, dt * 6);\n    act += (tact - act) * Math.min(1, dt * 3);\n    draw();\n    raf = requestAnimationFrame(frame);\n  }\n  function start() { if (reduce || raf || !vis || dead) return; last = performance.now(); raf = requestAnimationFrame(frame); }\n  function stop() { if (raf) cancelAnimationFrame(raf); raf = 0; }\n  function mv(e) {\n    var r = wrap.getBoundingClientRect();\n    tpx = (e.clientX - r.left) / r.width; tpy = (e.clientY - r.top) / r.height; tact = 1;\n    if (reduce) { px = tpx; py = tpy; act = 1; draw(); }\n  }\n  function lv() { tact = 0; if (reduce) { act = 0; draw(); } }\n  wrap.addEventListener(\"pointermove\", mv);\n  wrap.addEventListener(\"pointerleave\", lv);\n  offs.push(function () { wrap.removeEventListener(\"pointermove\", mv); wrap.removeEventListener(\"pointerleave\", lv); });\n  var ro = null, io = null;\n  if (window.ResizeObserver) { ro = new ResizeObserver(size); ro.observe(wrap); } else { window.addEventListener(\"resize\", size); offs.push(function () { window.removeEventListener(\"resize\", size); }); }\n  if (window.IntersectionObserver) {\n    io = new IntersectionObserver(function (en) { vis = en[en.length - 1].isIntersecting; if (vis) start(); else stop(); });\n    io.observe(wrap);\n  }\n  function update(next) {\n    opts = Object.assign({ background: \"#0c1e18\", accent: \"#e6ff55\", bands: 5, speed: 0.8, amplitude: 1, pointer: 0.7 }, opts, next || {});\n    opts.bands = Math.max(3, Math.min(8, Math.round(opts.bands)));\n    wrap.style.background = opts.background;\n    wrap.style.setProperty(\"--ef-acc\", opts.accent);\n    size();\n    start();\n  }\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      dead = true; stop();\n      if (ro) ro.disconnect();\n      if (io) io.disconnect();\n      offs.forEach(function (f) { f(); }); offs = [];\n    }\n  };\n}"
  }
}