{
  "id": "glass-torus-hero",
  "kind": "element",
  "title": "Glass torus hero",
  "summary": "A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.",
  "url": "https://enrichr.dev/elements/glass-torus-hero.html",
  "section": "hero",
  "techniques": [
    "webgl",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "WebGL"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "bold",
    "polished"
  ],
  "intents": [
    "glass 3d object hero",
    "refraction shader over text",
    "torus knot webgl hero",
    "glass distortion headline",
    "chromatic dispersion glass effect"
  ],
  "status": "tested",
  "params": [
    {
      "key": "lines",
      "label": "Lines (comma separated)",
      "type": "text",
      "value": "Motion, Design, Library"
    },
    {
      "key": "font",
      "label": "Headline font",
      "type": "select",
      "options": [
        [
          "parkinsans",
          "Parkinsans"
        ],
        [
          "bebas",
          "Bebas Neue"
        ]
      ],
      "value": "parkinsans"
    },
    {
      "key": "speed",
      "label": "Spin speed",
      "type": "range",
      "min": 0,
      "max": 2,
      "step": 0.05,
      "value": 1
    },
    {
      "key": "follow",
      "label": "Pointer lean",
      "type": "range",
      "min": 0,
      "max": 3,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "size",
      "label": "Knot size (% of the view)",
      "type": "range",
      "min": 5,
      "max": 14,
      "step": 0.5,
      "value": 9
    },
    {
      "key": "ior",
      "label": "Index of refraction",
      "type": "range",
      "min": 1,
      "max": 2.2,
      "step": 0.01,
      "value": 1.45
    },
    {
      "key": "thickness",
      "label": "Glass thickness",
      "type": "range",
      "min": 0,
      "max": 2,
      "step": 0.05,
      "value": 0.7
    },
    {
      "key": "dispersion",
      "label": "Dispersion (colour split)",
      "type": "range",
      "min": 0,
      "max": 10,
      "step": 0.5,
      "value": 4
    },
    {
      "key": "tint",
      "label": "Glass tint",
      "type": "color",
      "value": "#ffffff"
    },
    {
      "key": "background",
      "label": "Background",
      "type": "color",
      "value": "#fbf8f1"
    },
    {
      "key": "ink",
      "label": "Headline and labels",
      "type": "color",
      "value": "#0c1e18"
    }
  ],
  "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 \"Glass torus hero\" element to this project.\n\nThis is the \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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/glass-torus-hero.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 \"Glass torus hero\" 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 \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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 \"Glass torus hero\" element to this codebase.\n\nThis is the \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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-glass-torus-hero.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Glass torus hero 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 \"Glass torus hero\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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- glass-torus-hero.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 \"./glass-torus-hero\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GlassTorusHero(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 \"Glass torus hero\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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- glass-torus-hero.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/GlassTorusHero.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./glass-torus-hero\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GlassTorusHero(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 \"Glass torus hero\" element.\n\nThis is the \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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), glass-torus-hero.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 \"Glass torus hero\" element. No packages, no server code.\n\nThis is the \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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 glass-torus-hero.js and then main.js), style.css (the CSS below), glass-torus-hero.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 \"Glass torus hero\" 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 \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.json\n\nWhat it does: The headline is drawn once onto a 2D canvas: each line is sized to fill 92% of the width, then the block is scaled to fit 78% of the height. WebGL shows that canvas full size, then draws a torus knot mesh built in JavaScript with the same (2, 3) curve and 300 by 48 segments that three.js uses. For every pixel of the knot the shader bends the view ray into the glass with refract(), carries it the glass thickness through, projects that point back onto the screen and reads the headline there, once per colour channel with a slightly different index, which splits edges into orange and blue. The read comes from a mipmapped copy at a level set by roughness, as in three.js, so what you see through the glass is softly blurred. A studio room (white walls lit by one lamp, six bright panels) is traced in the shader and mirrored on the surface with a Fresnel term, which gives the white streaks. The knot turns 0.35 and 0.5 radians a second on two axes and leans up to 0.15 and 0.2 radians toward the pointer.\nAccessibility: The canvas has a text label, and the headline is also real text in a visually hidden heading, so screen readers get the words. With prefers-reduced-motion it draws one still pose and never animates. The navigation links are real links with visible focus rings. Nothing here needs the pointer. Without WebGL the headline shows as plain large type.\n\nTunable settings:\n- Lines (comma separated): text, default Motion, Design, Library\n- Headline font: select (Parkinsans / Bebas Neue), default parkinsans\n- Spin speed: range 0 to 2, step 0.05, default 1\n- Pointer lean: range 0 to 3, step 0.1, default 1\n- Knot size (% of the view): range 5 to 14, step 0.5, default 9\n- Index of refraction: range 1 to 2.2, step 0.01, default 1.45\n- Glass thickness: range 0 to 2, step 0.05, default 0.7\n- Dispersion (colour split): range 0 to 10, step 0.5, default 4\n- Glass tint: color, default #ffffff\n- Background: color, default #fbf8f1\n- Headline and labels: color, default #0c1e18\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/glass-torus-hero.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 \"Glass torus hero\" 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 \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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 GlassTorusHero.\n2. Paste the JavaScript below into a separate code file named glass-torus-hero.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 \"./glass-torus-hero\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function GlassTorusHero(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(GlassTorusHero, {\n  lines: { type: ControlType.String, title: \"Lines (comma separated)\", defaultValue: \"Motion, Design, Library\" },\n  font: { type: ControlType.Enum, title: \"Headline font\", options: [\"parkinsans\",\"bebas\"], optionTitles: [\"Parkinsans\",\"Bebas Neue\"], defaultValue: \"parkinsans\" },\n  speed: { type: ControlType.Number, title: \"Spin speed\", min: 0, max: 2, step: 0.05, defaultValue: 1 },\n  follow: { type: ControlType.Number, title: \"Pointer lean\", min: 0, max: 3, step: 0.1, defaultValue: 1 },\n  size: { type: ControlType.Number, title: \"Knot size\", min: 5, max: 14, step: 0.5, defaultValue: 9 },\n  ior: { type: ControlType.Number, title: \"Index of refraction\", min: 1, max: 2.2, step: 0.01, defaultValue: 1.45 },\n  thickness: { type: ControlType.Number, title: \"Glass thickness\", min: 0, max: 2, step: 0.05, defaultValue: 0.7 },\n  dispersion: { type: ControlType.Number, title: \"Dispersion\", min: 0, max: 10, step: 0.5, defaultValue: 4 },\n  tint: { type: ControlType.Color, title: \"Glass tint\", defaultValue: \"#ffffff\" },\n  background: { type: ControlType.Color, title: \"Background\", defaultValue: \"#fbf8f1\" },\n  ink: { type: ControlType.Color, title: \"Headline and labels\", defaultValue: \"#0c1e18\" },\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 \"Glass torus hero\" 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 \"Glass torus hero\" element from the Enrichr Library: A glossy glass torus knot turns slowly in front of a huge three-line headline, bending the letters and splitting their edges into colour.\nPage: https://enrichr.dev/elements/glass-torus-hero.html\nMachine-readable spec: https://enrichr.dev/elements/glass-torus-hero.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-glass-torus-hero\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-glass-torus-hero\"), { ...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 canvas has a text label, and the headline is also real text in a visually hidden heading, so screen readers get the words. With prefers-reduced-motion it draws one still pose and never animates. The navigation links are real links with visible focus rings. Nothing here needs the pointer. Without WebGL the headline shows as plain large type.",
  "performance": "Two draws a frame: the headline texture and the knot (about 29,000 triangles). The glass shader does three texture reads and a short room trace, only on the pixels the knot covers. The headline texture is redrawn only when the text, colours, font or size change. Pixel ratio is capped at 2, the mipmapped copy at 2048 px, and the loop pauses off screen and in hidden tabs. destroy() frees the buffers and loses the WebGL context.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/KwWbBeP",
  "source": {
    "markup": "<div class=\"ef-gtk\">\n  <canvas class=\"ef-gtk__c\" role=\"img\" aria-label=\"A glossy glass knot turns slowly in front of the headline, bending and splitting the big black letters behind it\"></canvas>\n  <h2 class=\"ef-gtk__h\"><span class=\"ef-gtk__l\">Motion</span> <span class=\"ef-gtk__l\">Design</span> <span class=\"ef-gtk__l\">Library</span></h2>\n  <nav class=\"ef-gtk__nav\" aria-label=\"Example navigation\">\n    <a class=\"ef-gtk__logo\" href=\"#\"><svg class=\"ef-gtk__mark\" viewBox=\"0 0 50 50\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"m34.213 25.361 c0 2.655 1.381 4.808 3.086 4.808 0.781 0 1.494 -0.452 2.038 -1.198 0.267 -0.366 0.688 -0.589 1.142 -0.589 h0.054 c0.774 0 1.401 0.627 1.401 1.401 v10.65 h-10.651 c-0.774 0 -1.401 0.627 -1.401 1.401 v0.054 c0 0.453 0.222 0.874 0.589 1.141 0.746 0.544 1.198 1.257 1.198 2.038 0 1.705 -2.152 3.086 -4.808 3.086 -2.655 0 -4.808 -1.381 -4.808 -3.086 0 -0.781 0.452 -1.494 1.198 -2.038 0.366 -0.267 0.589 -0.688 0.589 -1.142 v-0.054 c0 -0.774 -0.627 -1.401 -1.401 -1.401 h-10.65 v-10.651 c0 -0.774 -0.627 -1.401 -1.401 -1.401 h-0.054 c-0.453 0 -0.875 0.222 -1.142 0.589 -0.543 0.746 -1.257 1.198 -2.038 1.198 -1.705 0 -3.086 -2.152 -3.086 -4.808 0 -2.655 1.381 -4.808 3.086 -4.808 0.781 0 1.495 0.452 2.038 1.198 0.267 0.366 0.688 0.589 1.141 0.589 h0.054 c0.774 0 1.401 -0.627 1.401 -1.401 v-10.65 h10.65 c0.774 0 1.401 -0.627 1.401 -1.401 v-0.054 c0 -0.453 -0.222 -0.875 -0.589 -1.142 -0.746 -0.543 -1.198 -1.257 -1.198 -2.038 0 -1.705 2.152 -3.086 4.808 -3.086 2.655 0 4.808 1.381 4.808 3.086 0 0.781 -0.452 1.495 -1.198 2.038 -0.366 0.267 -0.589 0.688 -0.589 1.141 v0.054 c0 0.774 0.627 1.401 1.401 1.401 h10.65 v10.65 c0 0.774 -0.627 1.401 -1.401 1.401 h-0.053 c-0.453 0 -0.874 -0.222 -1.141 -0.589 -0.544 -0.746 -1.257 -1.198 -2.038 -1.198 -1.705 0 -3.086 2.152 -3.086 4.808 z\"/></svg><span>Enrichr</span></a>\n    <ul class=\"ef-gtk__links\">\n      <li class=\"ef-gtk__li\"><a class=\"ef-gtk__a\" href=\"#\">Work</a></li>\n      <li class=\"ef-gtk__li\"><a class=\"ef-gtk__a\" href=\"#\">About</a></li>\n      <li class=\"ef-gtk__li\"><a class=\"ef-gtk__a\" href=\"#\">Contact</a></li>\n    </ul>\n  </nav>\n  <div class=\"ef-gtk__meta\"><span>Enrichr Library &mdash; 2026</span><span>Scroll to explore</span></div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-gtk { --ef-gtk-bg: #fbf8f1; --ef-gtk-ink: #0c1e18; container-type: inline-size; position: relative; box-sizing: border-box; width: 100%; height: 100%; min-height: 26rem; overflow: hidden; border-radius: 1rem; background: var(--ef-gtk-bg); color: var(--ef-gtk-ink); font-family: 'Parkinsans', 'Space Grotesk', sans-serif; touch-action: pan-y; }\n.ef-gtk .ef-gtk__c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }\n.ef-gtk .ef-gtk__h { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; font-size: 1rem; opacity: 1; color: inherit; }\n.ef-gtk .ef-gtk__l { display: block; }\n.ef-gtk .ef-gtk__nav { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: clamp(1.1rem, 3.9%, 1.75rem) clamp(1.3rem, 3.1%, 2.5rem); }\n.ef-gtk .ef-gtk__logo { display: inline-flex; align-items: center; gap: 0.4rem; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.125rem; letter-spacing: -0.02em; }\n.ef-gtk .ef-gtk__mark { width: 1.45rem; height: 1.45rem; display: block; }\n.ef-gtk .ef-gtk__links { display: flex; gap: clamp(1.1rem, 2.5%, 2rem); margin: 0; padding: 0; list-style: none; }\n.ef-gtk .ef-gtk__li { margin: 0; padding: 0; list-style: none; opacity: 1; font-size: 0.8125rem; }\n.ef-gtk .ef-gtk__a { color: inherit; text-decoration: none; font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; transition: opacity 0.25s ease; }\n.ef-gtk .ef-gtk__a:hover, .ef-gtk .ef-gtk__a:focus-visible { opacity: 1; }\n.ef-gtk .ef-gtk__a:focus-visible, .ef-gtk .ef-gtk__logo:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 2px; }\n.ef-gtk .ef-gtk__meta { position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: clamp(1.1rem, 3.9%, 1.75rem) clamp(1.3rem, 3.1%, 2.5rem); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.6; pointer-events: none; }\n/* no WebGL: the headline becomes real, visible type on the plain background */\n.ef-gtk.is-flat .ef-gtk__h { position: absolute; inset: 0; width: auto; height: auto; clip-path: none; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: clamp(2.5rem, 11cqw, 9rem); line-height: 0.98; text-transform: uppercase; letter-spacing: -0.02em; white-space: normal; }\n.ef-gtk.is-flat.is-bebas .ef-gtk__h { font-family: 'Bebas Neue', 'Parkinsans', sans-serif; font-weight: 400; letter-spacing: 0; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Glass torus hero: a glossy glass torus knot floats in front of a huge three-line headline and bends it. Built with raw\n// WebGL1, no three.js. The headline is drawn on a 2D canvas and shown full-screen as a texture. The knot is a real mesh\n// (the same (2,3) torus knot, 300 x 48 segments) shaded like a clear physical glass material: for each pixel the view ray\n// is refracted into the glass (index 1.45), carried \"thickness\" units through it, projected back to the screen and used to\n// read the headline texture, once per colour channel with a slightly different index, so edges split into orange and blue\n// (dispersion). A soft studio room with bright light panels is worked out in the shader and mirrored on the surface with a\n// Fresnel term, which gives the white streaks. The knot turns on two axes (0.35 and 0.5 rad a second) and leans toward the\n// pointer. Reduced motion draws one still pose. The loop pauses off screen and in hidden tabs. No WebGL: plain headline.\n// mount(root, { lines (comma separated), font (\"parkinsans\" | \"bebas\"), speed (spin), follow (pointer lean), size (% of\n//               the view), ior, thickness, dispersion, tint (glass colour), background, ink })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-gtk\");\n  var canvas = root.querySelector(\".ef-gtk__c\");\n  var head = root.querySelector(\".ef-gtk__h\");\n  var opts = {}, raf = 0, visible = true, io = null, ro = null, destroyed = false, last = 0, clock = 0;\n  var W = 1, H = 1, dpr = 1, px = 0, py = 0, lines = [];\n  var CAMERA_Z = 5, FOV = 45, TAN = Math.tan(FOV * Math.PI / 360);\n  var tcan = document.createElement(\"canvas\"), tctx = tcan.getContext(\"2d\");\n  var pcan = document.createElement(\"canvas\"), pctx = pcan.getContext(\"2d\"), potW = 1, potH = 1, maxTex = 2048;\n  var gl = null, bgProg = null, kProg = null, bgBuf = null, vBuf = null, iBuf = null, tex = null, mtex = null, nIdx = 0, ub = {}, uk = {};\n\n  var VS_BG = \"attribute vec2 p;varying vec2 vUv;void main(){vUv=p*.5+.5;gl_Position=vec4(p,0.,1.);}\";\n  var FS_BG = \"precision mediump float;uniform sampler2D uTex;varying vec2 vUv;void main(){gl_FragColor=texture2D(uTex,vUv);}\";\n  var VS_K = \"attribute vec3 aP;attribute vec3 aN;uniform mat4 uM,uVP;uniform mat3 uR;varying vec3 vW,vN;\" +\n    \"void main(){vec4 w=uM*vec4(aP,1.);vW=w.xyz;vN=uR*aN;gl_Position=uVP*w;}\";\n  // Physical glass, the way three.js MeshPhysicalMaterial does transmission + dispersion + IBL specular, with the\n  // RoomEnvironment studio (walls lit by one point light, six emissive panels) traced analytically instead of a cubemap.\n  var FS_K = [\n    \"uniform sampler2D uTex;uniform mat4 uVP;uniform vec3 uCam,uTint;uniform float uThick,uIor,uDisp,uLodW,uLodOff;\",\n    \"varying vec3 vW,vN;\",\n    \"const vec3 BMIN=vec3(-16.6135,-4.4335,-13.5785),BMAX=vec3(15.0995,23.8715,15.0125),LP=vec3(.418,12.699,.3);\",\n    \"vec3 lin(vec3 c){return mix(c/12.92,pow((c+.055)/1.055,vec3(2.4)),step(.04045,c));}\",\n    \"vec3 srgb(vec3 c){c=clamp(c,0.,1.);return mix(c*12.92,1.055*pow(c,vec3(1./2.4))-.055,step(.0031308,c));}\",\n    // refract the view ray, carry it through the glass, project the exit point and read the headline there. The mip level\n    // follows three.js: log2(buffer width) * roughness * clamp(2 ior - 2, 0, 1), plus half a level for its bicubic filter.\n    \"vec3 tr(vec3 n,vec3 v,float ior,float rough){vec3 r=normalize(refract(-v,n,1./ior))*uThick;vec4 c=uVP*vec4(vW+r,1.);vec2 uv=c.xy/c.w*.5+.5;\",\n    \"#ifdef LOD\",\n    \"  return lin(texture2DLodEXT(uTex,uv,max(0.,uLodW*rough*clamp(ior*2.-2.,0.,1.)+uLodOff+.5)).rgb);\",\n    \"#else\",\n    \"  return lin(texture2D(uTex,uv).rgb);\",\n    \"#endif\",\n    \"}\",\n    \"float panel(vec3 r,vec3 c,vec3 h,vec3 ax,float tw,float sf){\",\n    \"  float d=dot(r,ax),cc=dot(c,ax);if(d*cc<=0.)return 0.;float t=cc/d;if(t>tw)return 0.;\",\n    \"  vec3 e=abs(r*t-c)-h;e=e*(1.-ax)-ax*1e3;float m=max(e.x,max(e.y,e.z));float s=sf*t;\",\n    \"  return 1.-smoothstep(-s,s,m);}\",\n    // three.js RoomEnvironment seen from its middle: a white room lit by one point light (900 cd, range 28), six bright panels\n    \"float env(vec3 r,float sf){\",\n    \"  vec3 sr=step(0.,r)*2.-1.;vec3 rr=sr*max(abs(r),vec3(1e-4));\",\n    \"  vec3 tt=mix(BMIN,BMAX,step(0.,rr))/rr;float t=min(tt.x,min(tt.y,tt.z));vec3 p=rr*t;\",\n    \"  vec3 nI=tt.x<=t?vec3(-sr.x,0.,0.):(tt.y<=t?vec3(0.,-sr.y,0.):vec3(0.,0.,-sr.z));\",\n    \"  vec3 L=LP-p;float d=length(L);float k=clamp(1.-pow(d/28.,4.),0.,1.);\",\n    \"  float c=900./max(d*d,.01)*k*k*max(dot(nI,L/d),0.)/3.14159265;\",\n    \"  c=mix(c,50.,panel(rr,vec3(-16.116,10.87,8.208),vec3(.05,1.214,1.3695),vec3(1.,0.,0.),t,sf));\",\n    \"  c=mix(c,50.,panel(rr,vec3(-16.109,14.521,-8.207),vec3(.05,1.2125,1.3755),vec3(1.,0.,0.),t,sf));\",\n    \"  c=mix(c,17.,panel(rr,vec3(14.904,8.698,-1.832),vec3(.075,2.1325,3.1655),vec3(1.,0.,0.),t,sf));\",\n    \"  c=mix(c,43.,panel(rr,vec3(-.462,5.39,14.52),vec3(2.19,2.7205,.044),vec3(0.,0.,1.),t,sf));\",\n    \"  c=mix(c,20.,panel(rr,vec3(3.235,7.986,-12.541),vec3(1.25,1.,.05),vec3(0.,0.,1.),t,sf));\",\n    \"  c=mix(c,100.,panel(rr,vec3(0.,16.5,0.),vec3(.5,.05,.5),vec3(0.,1.,0.),t,sf));\",\n    \"  return c;}\",\n    \"void main(){\",\n    \"  vec3 n=normalize(vN),v=normalize(uCam-vW);\",\n    \"  float rough=.0525;\",\n    \"#ifdef LOD\",\n    \"  vec3 dxy=max(abs(dFdx(n)),abs(dFdy(n)));rough=min(1.,rough+max(max(dxy.x,dxy.y),dxy.z));\",\n    \"#endif\",\n    \"  float hs=(uIor-1.)*.025*uDisp;\",\n    \"  vec3 T=vec3(tr(n,v,uIor-hs,rough).r,tr(n,v,uIor,rough).g,tr(n,v,uIor+hs,rough).b);\",\n    \"  float nv=clamp(dot(n,v),0.,1.);vec4 q=rough*vec4(-1.,-.0275,-.572,.022)+vec4(1.,.0425,1.04,-.04);\",\n    \"  float a=min(q.x*q.x,exp2(-9.28*nv))*q.x+q.y;vec2 fab=vec2(-1.04,1.04)*a+q.zw;\",\n    \"  float f0=pow((uIor-1.)/(uIor+1.),2.);float F=f0*fab.x+fab.y;\",\n    \"  vec3 col=(1.-F)*T*lin(uTint)+F*env(reflect(-v,n),.04+rough*.5);\",\n    \"  gl_FragColor=vec4(srgb(col),1.);}\"\n  ].join(\"\\n\");\n\n  function num(v, d) { v = Number(v); return isFinite(v) ? v : d; }\n  function rgb(h, d) { var m = /^#?([0-9a-f]{6})$/i.exec(h || \"\"); var v = parseInt(m ? m[1] : d, 16); return [(v >> 16) / 255, ((v >> 8) & 255) / 255, (v & 255) / 255]; }\n\n  // TorusKnotGeometry(1, 0.3, 300, 48, 2, 3), the same vertices, normals and winding as three.js\n  function knot() {\n    var TS = 300, RS = 48, P = 2, Q = 3, R = 1, TUBE = 0.3;\n    var vtx = new Float32Array((TS + 1) * (RS + 1) * 6), idx = new Uint16Array(TS * RS * 6), k = 0;\n    function curve(u) { var cs = Math.cos(Q / P * u); return [R * (2 + cs) * 0.5 * Math.cos(u), R * (2 + cs) * Math.sin(u) * 0.5, R * Math.sin(Q / P * u) * 0.5]; }\n    function cross(a, b) { return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]; }\n    function norm(a) { var l = Math.hypot(a[0], a[1], a[2]) || 1; return [a[0] / l, a[1] / l, a[2] / l]; }\n    for (var i = 0; i <= TS; i++) {\n      var u = i / TS * P * Math.PI * 2, P1 = curve(u), P2 = curve(u + 0.01);\n      var T = [P2[0] - P1[0], P2[1] - P1[1], P2[2] - P1[2]], N = [P2[0] + P1[0], P2[1] + P1[1], P2[2] + P1[2]];\n      var B = cross(T, N); N = cross(B, T); B = norm(B); N = norm(N);\n      for (var j = 0; j <= RS; j++) {\n        var v = j / RS * Math.PI * 2, cx = -TUBE * Math.cos(v), cy = TUBE * Math.sin(v);\n        var x = P1[0] + (cx * N[0] + cy * B[0]), y = P1[1] + (cx * N[1] + cy * B[1]), z = P1[2] + (cx * N[2] + cy * B[2]);\n        var n = norm([x - P1[0], y - P1[1], z - P1[2]]);\n        vtx[k++] = x; vtx[k++] = y; vtx[k++] = z; vtx[k++] = n[0]; vtx[k++] = n[1]; vtx[k++] = n[2];\n      }\n    }\n    k = 0;\n    for (var jj = 1; jj <= TS; jj++) {\n      for (var ii = 1; ii <= RS; ii++) {\n        var a = (RS + 1) * (jj - 1) + (ii - 1), b = (RS + 1) * jj + (ii - 1), c = (RS + 1) * jj + ii, d = (RS + 1) * (jj - 1) + ii;\n        idx[k++] = a; idx[k++] = b; idx[k++] = d; idx[k++] = b; idx[k++] = c; idx[k++] = d;\n      }\n    }\n    return { v: vtx, i: idx };\n  }\n\n  function shader(type, src) { var s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s); return gl.getShaderParameter(s, gl.COMPILE_STATUS) ? s : null; }\n  function program(vs, fs, attrs) {\n    var v = shader(gl.VERTEX_SHADER, vs), f = shader(gl.FRAGMENT_SHADER, fs);\n    if (!v || !f) return null;\n    var p = gl.createProgram(); gl.attachShader(p, v); gl.attachShader(p, f);\n    attrs.forEach(function (a, i) { gl.bindAttribLocation(p, i, a); });\n    gl.linkProgram(p); gl.deleteShader(v); gl.deleteShader(f);\n    return gl.getProgramParameter(p, gl.LINK_STATUS) ? p : null;\n  }\n  function setup() {\n    gl = canvas.getContext(\"webgl\", { antialias: true, alpha: false, premultipliedAlpha: false }) || canvas.getContext(\"experimental-webgl\", { antialias: true, alpha: false });\n    if (!gl) return false;\n    // texture2DLodEXT + dFdx give the same softened see-through image as three.js; without them it is sharp but still works\n    var lodOk = !!(gl.getExtension(\"EXT_shader_texture_lod\") && gl.getExtension(\"OES_standard_derivatives\"));\n    var pre = lodOk ? \"#extension GL_EXT_shader_texture_lod : enable\\n#extension GL_OES_standard_derivatives : enable\\n#define LOD 1\\n\" : \"\";\n    bgProg = program(VS_BG, FS_BG, [\"p\"]);\n    kProg = program(VS_K, pre + \"precision highp float;\\n\" + FS_K, [\"aP\", \"aN\"]);\n    if (!kProg && lodOk) kProg = program(VS_K, \"precision highp float;\\n\" + FS_K, [\"aP\", \"aN\"]);\n    if (!bgProg || !kProg) return false;\n    [\"uTex\"].forEach(function (k) { ub[k] = gl.getUniformLocation(bgProg, k); });\n    [\"uM\", \"uVP\", \"uR\", \"uTex\", \"uCam\", \"uTint\", \"uThick\", \"uIor\", \"uDisp\", \"uLodW\", \"uLodOff\"].forEach(function (k) { uk[k] = gl.getUniformLocation(kProg, k); });\n    maxTex = Math.min(2048, gl.getParameter(gl.MAX_TEXTURE_SIZE) || 2048);\n    mtex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, mtex);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n    bgBuf = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, bgBuf);\n    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);\n    var g = knot(); nIdx = g.i.length;\n    vBuf = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, vBuf); gl.bufferData(gl.ARRAY_BUFFER, g.v, gl.STATIC_DRAW);\n    iBuf = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, iBuf); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, g.i, gl.STATIC_DRAW);\n    tex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, tex);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n    return true;\n  }\n\n  function fontFor(size) { return opts.font === \"bebas\" ? \"400 \" + size + \"px 'Bebas Neue', 'Parkinsans', sans-serif\" : \"800 \" + size + \"px 'Parkinsans', 'Space Grotesk', sans-serif\"; }\n  // The headline texture: each line is sized to fill 92% of the width, then the block is fitted into 78% of the height.\n  function drawText() {\n    tcan.width = Math.max(1, Math.round(W * dpr)); tcan.height = Math.max(1, Math.round(H * dpr));\n    tctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n    tctx.fillStyle = opts.background; tctx.fillRect(0, 0, W, H);\n    tctx.fillStyle = opts.ink; tctx.textAlign = \"center\"; tctx.textBaseline = \"middle\";\n    var maxW = W * 0.92, maxH = H * 0.78, base = 100, gap = 0.98;\n    tctx.font = fontFor(base);\n    var sizes = lines.map(function (l) { return base * (maxW / Math.max(1, tctx.measureText(l).width)); });\n    var total = sizes.reduce(function (s, z) { return s + z * gap; }, 0);\n    var fit = Math.min(1, maxH / (total || 1)), y = H / 2 - total * fit / 2;\n    lines.forEach(function (l, i) {\n      var z = sizes[i] * fit;\n      tctx.font = fontFor(z);\n      y += z * gap / 2; tctx.fillText(l, W / 2, y); y += z * gap / 2;\n    });\n    if (!gl) return;\n    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n    gl.bindTexture(gl.TEXTURE_2D, tex);\n    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, tcan);\n    // a power-of-two copy with mipmaps for the glass to look through (three.js reads a mipmapped transmission target)\n    potW = Math.min(maxTex, pow2(tcan.width)); potH = Math.min(maxTex, pow2(tcan.height));\n    if (pcan.width !== potW || pcan.height !== potH) { pcan.width = potW; pcan.height = potH; }\n    pctx.imageSmoothingEnabled = true; pctx.imageSmoothingQuality = \"high\";\n    pctx.drawImage(tcan, 0, 0, potW, potH);\n    gl.bindTexture(gl.TEXTURE_2D, mtex);\n    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pcan);\n    gl.generateMipmap(gl.TEXTURE_2D);\n    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);\n  }\n  function pow2(n) { var p = 1; while (p < n) p *= 2; return p; }\n\n  function render(t) {\n    if (!gl || gl.isContextLost()) return;\n    var rx, ry;\n    if (reduce) { rx = 0.6; ry = 0.4; }\n    else { rx = t * 0.35 + py * 0.15 * opts.follow; ry = t * 0.5 + px * 0.2 * opts.follow; }\n    var aspect = W / H, visH = 2 * CAMERA_Z * TAN, visW = visH * aspect, s = Math.min(visW, visH) * opts.size / 100;\n    // model = translate(0,0,2.2) * rotateX(rx) * rotateY(ry) * scale(s)   (three.js Euler order XYZ)\n    var a = Math.cos(rx), b = Math.sin(rx), c = Math.cos(ry), d = Math.sin(ry);\n    var R = [c, b * d, -a * d, 0, a, b, d, -b * c, a * c]; // column-major 3x3\n    var M = [R[0] * s, R[1] * s, R[2] * s, 0, R[3] * s, R[4] * s, R[5] * s, 0, R[6] * s, R[7] * s, R[8] * s, 0, 0, 0, 2.2, 1];\n    // view-projection: perspective(45deg, aspect, 0.1, 100) * translate(0,0,-5)\n    var f = 1 / TAN, nr = 0.1, fr = 100, A = (fr + nr) / (nr - fr), B = 2 * fr * nr / (nr - fr);\n    var VP = [f / aspect, 0, 0, 0, 0, f, 0, 0, 0, 0, A, -1, 0, 0, A * -CAMERA_Z + B, CAMERA_Z];\n    gl.viewport(0, 0, canvas.width, canvas.height);\n    gl.disable(gl.DEPTH_TEST); gl.depthMask(false); gl.disable(gl.CULL_FACE);\n    gl.useProgram(bgProg);\n    gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tex); gl.uniform1i(ub.uTex, 0);\n    gl.bindBuffer(gl.ARRAY_BUFFER, bgBuf); gl.enableVertexAttribArray(0); gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);\n    gl.disableVertexAttribArray(1);\n    gl.drawArrays(gl.TRIANGLES, 0, 3);\n    gl.enable(gl.DEPTH_TEST); gl.depthMask(true); gl.clear(gl.DEPTH_BUFFER_BIT);\n    gl.enable(gl.CULL_FACE); gl.cullFace(gl.BACK); gl.frontFace(gl.CCW);\n    gl.useProgram(kProg);\n    gl.uniformMatrix4fv(uk.uM, false, M); gl.uniformMatrix4fv(uk.uVP, false, VP); gl.uniformMatrix3fv(uk.uR, false, R);\n    gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, mtex);\n    gl.uniform1i(uk.uTex, 0); gl.uniform3f(uk.uCam, 0, 0, CAMERA_Z);\n    gl.uniform1f(uk.uLodW, Math.log2(Math.max(2, canvas.width))); gl.uniform1f(uk.uLodOff, Math.log2(potW / Math.max(1, canvas.width)));\n    var tint = rgb(opts.tint, \"ffffff\"); gl.uniform3f(uk.uTint, tint[0], tint[1], tint[2]);\n    gl.uniform1f(uk.uThick, opts.thickness * s); gl.uniform1f(uk.uIor, opts.ior); gl.uniform1f(uk.uDisp, opts.dispersion);\n    gl.bindBuffer(gl.ARRAY_BUFFER, vBuf);\n    gl.enableVertexAttribArray(0); gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 24, 0);\n    gl.enableVertexAttribArray(1); gl.vertexAttribPointer(1, 3, gl.FLOAT, false, 24, 12);\n    gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, iBuf);\n    gl.drawElements(gl.TRIANGLES, nIdx, gl.UNSIGNED_SHORT, 0);\n  }\n\n  function loop(now) {\n    raf = requestAnimationFrame(loop);\n    var dt = Math.min(0.05, (now - last) / 1000 || 0); last = now;\n    if (!visible || document.hidden) return;\n    clock += dt * opts.speed;\n    render(clock);\n  }\n  function size() {\n    dpr = Math.min(window.devicePixelRatio || 1, 2);\n    W = Math.max(1, wrap.clientWidth); H = Math.max(1, wrap.clientHeight);\n    canvas.width = Math.round(W * dpr); canvas.height = Math.round(H * dpr);\n    drawText();\n    render(clock);\n  }\n  function move(e) {\n    var r = wrap.getBoundingClientRect();\n    px = (e.clientX - r.left) / Math.max(1, r.width) * 2 - 1;\n    py = (e.clientY - r.top) / Math.max(1, r.height) * 2 - 1;\n  }\n  function setLines() {\n    lines = String(opts.lines).split(\",\").map(function (s) { return s.trim().toUpperCase(); }).filter(Boolean).slice(0, 5);\n    if (!lines.length) lines = [\"MOTION\"];\n    head.textContent = \"\";\n    lines.forEach(function (l, i) {\n      var sp = document.createElement(\"span\"); sp.className = \"ef-gtk__l\"; sp.textContent = l.charAt(0) + l.slice(1).toLowerCase();\n      head.appendChild(sp); if (i < lines.length - 1) head.appendChild(document.createTextNode(\" \"));\n    });\n  }\n  function update(partial) {\n    opts = Object.assign({ lines: \"Motion, Design, Library\", font: \"parkinsans\", speed: 1, follow: 1, size: 9, ior: 1.45, thickness: 0.7, dispersion: 4, tint: \"#ffffff\", background: \"#fbf8f1\", ink: \"#0c1e18\" }, opts, partial || {});\n    opts.speed = Math.max(0, num(opts.speed, 1)); opts.follow = num(opts.follow, 1); opts.size = Math.max(1, num(opts.size, 9));\n    opts.ior = Math.max(1, num(opts.ior, 1.45)); opts.thickness = Math.max(0, num(opts.thickness, 0.7)); opts.dispersion = Math.max(0, num(opts.dispersion, 4));\n    wrap.style.setProperty(\"--ef-gtk-bg\", opts.background); wrap.style.setProperty(\"--ef-gtk-ink\", opts.ink);\n    wrap.classList.toggle(\"is-bebas\", opts.font === \"bebas\");\n    setLines();\n    if (destroyed) return;\n    drawText();\n    render(clock);\n    // the canvas cannot wait for a web font by itself: ask for it, then draw the headline again once it is ready\n    if (document.fonts && document.fonts.load) document.fonts.load(fontFor(100)).then(redraw, function () {});\n  }\n  function redraw() { if (!destroyed) { drawText(); render(clock); } }\n\n  var ok = setup();\n  if (!ok) { gl = null; wrap.classList.add(\"is-flat\"); canvas.style.display = \"none\"; }\n  update(o);\n  if (!ok) return { update: update, destroy: function () { destroyed = true; } };\n  size();\n  if (document.fonts && document.fonts.ready) document.fonts.ready.then(redraw);\n  wrap.addEventListener(\"pointermove\", move);\n  if (!reduce) {\n    if (\"IntersectionObserver\" in window) { io = new IntersectionObserver(function (e) { visible = e[0].isIntersecting; }); io.observe(wrap); }\n    last = performance.now(); raf = requestAnimationFrame(loop);\n  }\n  if (\"ResizeObserver\" in window) { ro = new ResizeObserver(function () { if (!destroyed) size(); }); ro.observe(wrap); }\n  return {\n    update: update,\n    destroy: function () {\n      destroyed = true; cancelAnimationFrame(raf);\n      if (io) io.disconnect();\n      if (ro) ro.disconnect();\n      wrap.removeEventListener(\"pointermove\", move);\n      if (gl) {\n        gl.deleteBuffer(bgBuf); gl.deleteBuffer(vBuf); gl.deleteBuffer(iBuf); gl.deleteTexture(tex); gl.deleteTexture(mtex);\n        gl.deleteProgram(bgProg); gl.deleteProgram(kProg);\n        var lose = gl.getExtension(\"WEBGL_lose_context\"); if (lose) lose.loseContext();\n      }\n    }\n  };\n}"
  }
}