{
  "id": "scroll-text-repetition",
  "kind": "element",
  "title": "Scroll text repetition",
  "summary": "A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.",
  "url": "https://enrichr.dev/elements/scroll-text-repetition.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "scroll-driven",
    "parallax"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "bold",
    "kinetic",
    "editorial"
  ],
  "intents": [
    "repeating text rows on scroll",
    "marquee text driven by scroll",
    "scroll linked typography",
    "outline and filled text rows",
    "big headline scroll animation"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "text",
      "label": "Headline",
      "type": "text",
      "value": "Keep scrolling"
    },
    {
      "key": "rows",
      "label": "Rows",
      "type": "range",
      "min": 3,
      "max": 9,
      "step": 1,
      "value": 6
    },
    {
      "key": "speed",
      "label": "Scroll speed",
      "type": "range",
      "min": 0.2,
      "max": 2,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "outline",
      "label": "Outline alternate rows",
      "type": "select",
      "options": [
        [
          "true",
          "Yes"
        ],
        [
          "false",
          "No"
        ]
      ],
      "value": "true"
    }
  ],
  "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 \"Scroll text repetition\" element to this project.\n\nThis is the \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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/scroll-text-repetition.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 \"Scroll text repetition\" 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 \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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 \"Scroll text repetition\" element to this codebase.\n\nThis is the \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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-scroll-text-repetition.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Scroll text repetition 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 \"Scroll text repetition\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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- scroll-text-repetition.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 \"./scroll-text-repetition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ScrollTextRepetition(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 \"Scroll text repetition\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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- scroll-text-repetition.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/ScrollTextRepetition.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./scroll-text-repetition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ScrollTextRepetition(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 \"Scroll text repetition\" element.\n\nThis is the \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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), scroll-text-repetition.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 \"Scroll text repetition\" element. No packages, no server code.\n\nThis is the \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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 scroll-text-repetition.js and then main.js), style.css (the CSS below), scroll-text-repetition.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 \"Scroll text repetition\" 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 \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.json\n\nWhat it does: The element owns a scrollable box with a tall track inside it and a sticky stage that stays in view. On scroll, the script reads scrollTop as a 0 to 1 progress value and, inside one requestAnimationFrame, writes a --x offset to each row. Every row gets its own direction (alternating left and right), speed multiplier and starting offset derived from its index, so the stack fans out and crosses over as you scroll. Rows are the same headline repeated, with every other row switched to an outlined style using text stroke.\nAccessibility: The scroller is focusable, so keyboard users can scroll it with the arrow keys, Page Up and Page Down. Only the first row is exposed to screen readers; the repeats are aria-hidden so the headline is not announced several times. With reduced motion on, the rows stay still and the scroll does nothing visually. Outlined text has lower contrast than filled text, so keep it decorative.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Headline: text, default Keep scrolling\n- Rows: range 3 to 9, step 1, default 6\n- Scroll speed: range 0.2 to 2, step 0.1, default 1\n- Outline alternate rows: select (Yes / No), default true\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/scroll-text-repetition.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 \"Scroll text repetition\" 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 \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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 ScrollTextRepetition.\n2. Paste the JavaScript below into a separate code file named scroll-text-repetition.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 \"./scroll-text-repetition\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ScrollTextRepetition(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(ScrollTextRepetition, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  text: { type: ControlType.String, title: \"Headline\", defaultValue: \"Keep scrolling\" },\n  rows: { type: ControlType.Number, title: \"Rows\", min: 3, max: 9, step: 1, defaultValue: 6 },\n  speed: { type: ControlType.Number, title: \"Scroll speed\", min: 0.2, max: 2, step: 0.1, defaultValue: 1 },\n  outline: { type: ControlType.Enum, title: \"Outline alternate rows\", options: [\"true\",\"false\"], optionTitles: [\"Yes\",\"No\"], defaultValue: \"true\" },\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 \"Scroll text repetition\" 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 \"Scroll text repetition\" element from the Enrichr Library: A headline repeated as stacked rows that slide sideways at different speeds and offsets as you scroll, alternating filled and outlined type.\nPage: https://enrichr.dev/elements/scroll-text-repetition.html\nMachine-readable spec: https://enrichr.dev/elements/scroll-text-repetition.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-scroll-text-repetition\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-scroll-text-repetition\"), { ...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 scroller is focusable, so keyboard users can scroll it with the arrow keys, Page Up and Page Down. Only the first row is exposed to screen readers; the repeats are aria-hidden so the headline is not announced several times. With reduced motion on, the rows stay still and the scroll does nothing visually. Outlined text has lower contrast than filled text, so keep it decorative.",
  "performance": "One passive scroll listener queues a single requestAnimationFrame, which writes one CSS variable per row. Rows animate only by transform, and a ResizeObserver handles size changes. The listeners, observer and any pending frame are removed by destroy().",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-str\">\n  <div class=\"ef-str__wrap\">\n    <div class=\"ef-str__scroller\" tabindex=\"0\" role=\"region\" aria-label=\"Scroll to shift the repeated headline rows\">\n      <div class=\"ef-str__track\">\n        <div class=\"ef-str__stage\"><div class=\"ef-str__rows\"></div></div>\n      </div>\n    </div>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-str { width: 100%; }\n.ef-str__wrap { box-sizing: border-box; width: 100%; border-radius: 1rem; overflow: hidden; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-str__scroller { height: 22rem; overflow-y: auto; overflow-x: hidden; position: relative; outline: none; scrollbar-width: thin; scrollbar-color: var(--ef-acc, #e6ff55) transparent; }\n.ef-str__scroller:focus-visible { box-shadow: inset 0 0 0 2px var(--ef-acc, #e6ff55); }\n.ef-str__track { height: 220%; position: relative; }\n.ef-str__stage { position: sticky; top: 0; height: 22rem; overflow: hidden; display: flex; align-items: center; }\n.ef-str__rows { width: 100%; display: flex; flex-direction: column; justify-content: center; }\n.ef-str__row { display: block; white-space: nowrap; will-change: transform; transform: translate3d(var(--x, 0px), 0, 0); font-size: var(--ef-fs, 3.2rem); line-height: 0.98; font-weight: 900; letter-spacing: -0.03em; text-transform: uppercase; color: var(--ef-acc, #e6ff55); }\n.ef-str__row.is-outline { color: transparent; -webkit-text-stroke: 1.5px var(--ef-acc, #e6ff55); }\n@media (prefers-reduced-motion: reduce) { .ef-str__row { will-change: auto; transform: none; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Scroll text repetition: one headline repeated as stacked rows. Scrolling the element's own scroller slides each row sideways at a\n// different speed and offset; rows alternate filled and outlined. Scroll progress (0-1) is mapped to a per-row translateX written\n// via a CSS variable inside requestAnimationFrame. Reduced motion keeps the rows static. Works inside overflow:hidden containers.\n// mount(root, { background, accent, text, rows (3-9), speed (0.2-2), outline (bool) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-str__wrap\");\n  var sc = root.querySelector(\".ef-str__scroller\");\n  var stage = root.querySelector(\".ef-str__stage\");\n  var rowsEl = root.querySelector(\".ef-str__rows\");\n  var opts = {}, rows = [], raf = 0;\n\n  function measure() {\n    var h = Math.max(120, sc.clientHeight);\n    stage.style.height = h + \"px\";\n    var fs = Math.max(26, Math.min(76, (h / opts.rows) * 0.98));\n    wrap.style.setProperty(\"--ef-fs\", fs.toFixed(1) + \"px\");\n  }\n  function render() {\n    raf = 0;\n    var max = Math.max(1, sc.scrollHeight - sc.clientHeight);\n    var p = sc.scrollTop / max;\n    var w = sc.clientWidth;\n    for (var i = 0; i < rows.length; i++) {\n      if (reduce) { rows[i].style.setProperty(\"--x\", \"0px\"); continue; }\n      var dir = i % 2 ? 1 : -1;\n      var mult = 0.35 + ((i * 37) % 11) / 10; // varied speed per row\n      var base = (((i * 53) % 7) / 7 - 0.5) * w * 0.4; // varied offset per row\n      var x = base + dir * (p - 0.5) * w * 1.1 * mult * opts.speed;\n      rows[i].style.setProperty(\"--x\", x.toFixed(1) + \"px\");\n    }\n  }\n  function queue() { if (!raf) raf = requestAnimationFrame(render); }\n  function build() {\n    rowsEl.textContent = \"\";\n    rows = [];\n    for (var i = 0; i < opts.rows; i++) {\n      var d = document.createElement(\"span\");\n      d.className = \"ef-str__row\" + (opts.outline && i % 2 ? \" is-outline\" : \"\");\n      d.setAttribute(\"aria-hidden\", i === 0 ? \"false\" : \"true\");\n      var s = \"\";\n      for (var k = 0; k < 4; k++) s += opts.text + \" • \";\n      d.textContent = s;\n      rowsEl.appendChild(d);\n      rows.push(d);\n    }\n    measure();\n    queue();\n  }\n  function onScroll() { queue(); }\n  function onResize() { measure(); queue(); }\n  sc.addEventListener(\"scroll\", onScroll, { passive: true });\n  window.addEventListener(\"resize\", onResize);\n  var ro = null;\n  if (window.ResizeObserver) { ro = new ResizeObserver(onResize); ro.observe(sc); }\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ background: \"#0c1e18\", accent: \"#e6ff55\", text: \"Keep scrolling\", rows: 6, speed: 1, outline: true }, opts, next || {});\n    opts.rows = Math.max(3, Math.min(9, Math.round(opts.rows)));\n    opts.speed = Math.max(0.2, Math.min(2, Number(opts.speed) || 1));\n    opts.outline = opts.outline === true || opts.outline === \"true\";\n    opts.text = String(opts.text || \"Keep scrolling\").slice(0, 40);\n    wrap.style.background = opts.background;\n    wrap.style.setProperty(\"--ef-acc\", opts.accent);\n    sc.setAttribute(\"aria-label\", \"Scroll to shift the repeated headline: \" + opts.text);\n    if (prev.rows !== opts.rows || prev.text !== opts.text || prev.outline !== opts.outline) build(); else queue();\n  }\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      sc.removeEventListener(\"scroll\", onScroll);\n      window.removeEventListener(\"resize\", onResize);\n      if (ro) ro.disconnect();\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n    }\n  };\n}"
  }
}