{
  "id": "sideways-scroll-letters",
  "kind": "element",
  "title": "Sideways scroll letters",
  "summary": "A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.",
  "url": "https://enrichr.dev/elements/sideways-scroll-letters.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "scroll-driven",
    "stagger"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "bold",
    "kinetic"
  ],
  "intents": [
    "horizontal scroll text animation",
    "letters fall into place on scroll",
    "split text horizontal scroll",
    "scroll driven marquee headline",
    "scrolltrigger container animation without gsap"
  ],
  "status": "tested",
  "params": [
    {
      "key": "text",
      "label": "Text",
      "type": "text",
      "value": "⏾ Work Hard. Sleep Hard. ✦"
    },
    {
      "key": "autoplay",
      "label": "Autoplay",
      "type": "select",
      "options": [
        [
          "1",
          "On"
        ],
        [
          "0",
          "Off, follow the page scroll"
        ]
      ],
      "value": "1"
    },
    {
      "key": "speed",
      "label": "Autoplay speed",
      "type": "range",
      "min": 0.25,
      "max": 3,
      "step": 0.05,
      "value": 1
    },
    {
      "key": "size",
      "label": "Text size (% of width)",
      "type": "range",
      "min": 4,
      "max": 20,
      "step": 0.5,
      "value": 10
    },
    {
      "key": "lift",
      "label": "Highest lift (% of letter height)",
      "type": "range",
      "min": 0,
      "max": 400,
      "step": 10,
      "value": 200
    },
    {
      "key": "tilt",
      "label": "Max tilt (degrees)",
      "type": "range",
      "min": 0,
      "max": 90,
      "step": 1,
      "value": 20
    },
    {
      "key": "color",
      "label": "Text colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "background",
      "label": "Background",
      "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 \"Sideways scroll letters\" element to this project.\n\nThis is the \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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/sideways-scroll-letters.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 \"Sideways scroll letters\" 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 \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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 \"Sideways scroll letters\" element to this codebase.\n\nThis is the \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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-sideways-scroll-letters.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Sideways scroll letters 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 \"Sideways scroll letters\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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- sideways-scroll-letters.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 \"./sideways-scroll-letters\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function SidewaysScrollLetters(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 \"Sideways scroll letters\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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- sideways-scroll-letters.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/SidewaysScrollLetters.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./sideways-scroll-letters\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function SidewaysScrollLetters(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 \"Sideways scroll letters\" element.\n\nThis is the \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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), sideways-scroll-letters.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 \"Sideways scroll letters\" element. No packages, no server code.\n\nThis is the \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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 sideways-scroll-letters.js and then main.js), style.css (the CSS below), sideways-scroll-letters.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 \"Sideways scroll letters\" 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 \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.json\n\nWhat it does: The line starts one box-width to the right of the box, words 4% of the width apart, and a transform slides it left until it has gone off the left edge. Every letter is its own span with a random lift (anywhere from 200% of its height up to 20% down) and a random tilt (up to 20 degrees either way). A letter's progress runs from the moment its left edge meets the right side of the box to the moment it reaches 30% of the width, and its offset eases to zero along a back-out curve (GSAP's back.out(1.2)), so it overshoots a little before it sits. Each letter chases its progress with a 1 s power3-out catch-up that restarts whenever the progress changes, which is how GSAP's scrub: 1 works, so letters lag and float while the line moves and settle once it stops. This is the original's ScrollTrigger containerAnimation and SplitText rebuilt in a few lines. With autoplay on, the line glides across at about a third of the box width per second and loops; it is off screen at both ends, so the loop has no seam. With autoplay off, the page scroll drives it, from the box entering at the bottom of the screen to leaving at the top.\nAccessibility: The text is visually hidden for screen readers and the moving letters are hidden from them, so it reads as one line. With prefers-reduced-motion the whole line shows wrapped and centred with every letter at rest, and nothing moves. Nothing needs keyboard input.\n\nTunable settings:\n- Text: text, default ⏾ Work Hard. Sleep Hard. ✦\n- Autoplay: select (On / Off, follow the page scroll), default 1\n- Autoplay speed: range 0.25 to 3, step 0.05, default 1\n- Text size (% of width): range 4 to 20, step 0.5, default 10\n- Highest lift (% of letter height): range 0 to 400, step 10, default 200\n- Max tilt (degrees): range 0 to 90, step 1, default 20\n- Text colour: color, default #e6ff55\n- Background: 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/sideways-scroll-letters.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 \"Sideways scroll letters\" 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 \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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 SidewaysScrollLetters.\n2. Paste the JavaScript below into a separate code file named sideways-scroll-letters.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 \"./sideways-scroll-letters\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function SidewaysScrollLetters(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(SidewaysScrollLetters, {\n  text: { type: ControlType.String, title: \"Text\", defaultValue: \"⏾ Work Hard. Sleep Hard. ✦\" },\n  autoplay: { type: ControlType.Enum, title: \"Autoplay\", options: [\"1\",\"0\"], optionTitles: [\"On\",\"Off, follow the page scroll\"], defaultValue: \"1\" },\n  speed: { type: ControlType.Number, title: \"Autoplay speed\", min: 0.25, max: 3, step: 0.05, defaultValue: 1 },\n  size: { type: ControlType.Number, title: \"Text size\", min: 4, max: 20, step: 0.5, defaultValue: 10 },\n  lift: { type: ControlType.Number, title: \"Highest lift\", min: 0, max: 400, step: 10, defaultValue: 200 },\n  tilt: { type: ControlType.Number, title: \"Max tilt\", min: 0, max: 90, step: 1, defaultValue: 20 },\n  color: { type: ControlType.Color, title: \"Text colour\", defaultValue: \"#e6ff55\" },\n  background: { type: ControlType.Color, title: \"Background\", 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 \"Sideways scroll letters\" 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 \"Sideways scroll letters\" element from the Enrichr Library: A huge line of text slides sideways across the box while each letter arrives tossed and tilted and settles into the line as it crosses.\nPage: https://enrichr.dev/elements/sideways-scroll-letters.html\nMachine-readable spec: https://enrichr.dev/elements/sideways-scroll-letters.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-sideways-scroll-letters\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-sideways-scroll-letters\"), { ...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 text is visually hidden for screen readers and the moving letters are hidden from them, so it reads as one line. With prefers-reduced-motion the whole line shows wrapped and centred with every letter at rest, and nothing moves. Nothing needs keyboard input.",
  "performance": "Each frame writes one transform for the line and one per letter, with no layout reads; letter positions are measured only on resize or when fonts load. The loop runs only while the box is on screen in a visible tab, and in scroll mode only while letters are still catching up.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/azJPjXW",
  "source": {
    "markup": "<div class=\"ef-ssl\"><div class=\"ef-ssl__text\">⏾ Work Hard. Sleep Hard. ✦</div></div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-ssl {\n  --ef-ssl-size: 10;\n  position: relative; box-sizing: border-box; width: 100%; min-height: 28rem; overflow: hidden; border-radius: 1rem;\n  display: flex; align-items: center; container-type: inline-size;\n  background: #0c1e18; color: #e6ff55;\n}\n.ef-ssl *, .ef-ssl *::before, .ef-ssl *::after { box-sizing: border-box; }\n/* the line starts one full width to the right of the box, words 4% of the width apart */\n.ef-ssl .ef-ssl__text {\n  position: relative; display: flex; flex: none; width: max-content; gap: 4cqw; padding: 0 0 0 100cqw; margin: 0;\n  white-space: nowrap; color: inherit; opacity: 1; will-change: transform;\n  font-family: 'Parkinsans', 'Space Grotesk', sans-serif; font-weight: 600; line-height: 1.1;\n  font-size: clamp(2rem, calc(var(--ef-ssl-size) * 1cqw), 12rem);\n}\n.ef-ssl .ef-ssl__word { display: inline-block; }\n.ef-ssl .ef-ssl__ch { position: relative; display: inline-block; }\n.ef-ssl .ef-ssl__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n\n/* reduced motion: the whole line, wrapped and centred, letters at rest */\n.ef-ssl.is-reduced { justify-content: center; }\n.ef-ssl.is-reduced .ef-ssl__text {\n  flex: 1; width: auto; flex-wrap: wrap; justify-content: center; row-gap: .1em; padding: 2rem; transform: none !important;\n  white-space: normal; font-size: clamp(1.5rem, calc(var(--ef-ssl-size) * .6cqw), 7rem);\n}\n.ef-ssl.is-reduced .ef-ssl__ch { transform: none !important; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Sideways scroll letters: one huge line of text slides right to left across the box, and every letter arrives tossed (a\n// random lift of up to 200% of its height, or a 20% drop, and a random tilt of up to 20 degrees) and settles into the line\n// on a back-out curve with a slight overshoot as it crosses the box. The line starts one box-width to the right and ends\n// fully off the left edge. Each letter's own progress runs from when its left edge meets the right side of the box to when\n// it reaches 30% of the width, and it chases that progress with a 1 s power3-out catch-up that restarts on every change,\n// so letters lag and float while the line moves, exactly like a GSAP ScrollTrigger containerAnimation with scrub: 1 on\n// SplitText letters (re-implemented here: spans per letter, the line moved by a transform, no library).\n// With autoplay on, the line glides across on a loop at a steady pace; with it off, the page scroll drives it, from the\n// moment the box enters at the bottom of the screen to the moment it leaves at the top.\n// Reduced motion: the whole line shows wrapped and centred, letters at rest, nothing moves.\n// The loop pauses off screen and in hidden tabs.\n// mount(root, { text, autoplay (1 = glide on a loop, 0 = follow the page scroll), speed (autoplay pace), size (% of the\n//               box width), lift (highest lift, % of letter height), tilt (max tilt, degrees), color, background })\nfunction mount(root, o) {\n  var reduce = !!(window.matchMedia && window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches);\n  var box = root.querySelector(\".ef-ssl\");\n  var line = box.querySelector(\".ef-ssl__text\");\n  var opts = {}, chars = [], sr = null, textW = 1, rootW = 1, P = 0, rt = 0, last = 0, raf = 0;\n  var visible = true, io = null, ro = null, destroyed = false, built = false;\n\n  function num(v, d) { v = Number(v); return isFinite(v) ? v : d; }\n  function on(v) { return !(v === 0 || v === \"0\" || v === false || v === \"off\"); }\n  function make(tag, cls, txt) { var e = document.createElement(tag); if (cls) e.className = cls; if (txt != null) e.textContent = txt; return e; }\n  function backOut(p) { p -= 1; return p * p * (2.2 * p + 1.2) + 1; } // GSAP back.out(1.2)\n  function power3Out(p) { return 1 - (1 - p) * (1 - p) * (1 - p); }\n\n  function build() {\n    var text = String(opts.text == null ? \"\" : opts.text).replace(/\\s+/g, \" \").trim() || \"Work Hard. Sleep Hard.\";\n    line.textContent = \"\"; chars = [];\n    if (sr && sr.parentNode) sr.parentNode.removeChild(sr);\n    sr = make(\"span\", \"ef-ssl__sr\", text); box.appendChild(sr);\n    line.setAttribute(\"aria-hidden\", \"true\");\n    text.split(\" \").forEach(function (w) {\n      var word = make(\"span\", \"ef-ssl__word\");\n      Array.from(w).forEach(function (ch) {\n        var s = make(\"span\", \"ef-ssl__ch\", ch);\n        word.appendChild(s);\n        // random(-200, 20) for the lift and random(-20, 20) for the tilt, kept as unit numbers so the sliders apply live\n        chars.push({ el: s, u: Math.random(), v: Math.random() * 2 - 1, x: 0, ps: 0, pe: 1, cur: 0, from: 0, to: 0, t0: -1e9 });\n      });\n      line.appendChild(word);\n    });\n    built = true;\n    measure();\n    snap();\n  }\n  // where each letter sits in the line, and the stretch of progress over which it settles\n  function measure() {\n    if (!built || reduce) return;\n    rootW = Math.max(1, box.clientWidth); textW = Math.max(1, line.offsetWidth);\n    chars.forEach(function (c) {\n      var x = c.el.offsetLeft;\n      c.ps = (x - rootW) / textW;          // left edge at 100% of the box\n      c.pe = (x - 0.3 * rootW) / textW;    // left edge at 30% of the box\n    });\n  }\n  function target(c) { var t = (P - c.ps) / (c.pe - c.ps || 1); return t < 0 ? 0 : t > 1 ? 1 : t; }\n  function snap() { chars.forEach(function (c) { c.cur = c.from = c.to = target(c); c.t0 = -1e9; }); render(); }\n  function scrollP() {\n    var r = box.getBoundingClientRect(), vh = window.innerHeight || document.documentElement.clientHeight;\n    var p = (vh - r.top) / (vh + r.height);\n    return p < 0 ? 0 : p > 1 ? 1 : p;\n  }\n\n  function render() {\n    if (reduce) return false;\n    line.style.transform = \"translate3d(\" + (-P * textW).toFixed(2) + \"px,0,0)\";\n    var moving = false, lift = opts.lift, tilt = opts.tilt;\n    for (var i = 0; i < chars.length; i++) {\n      var c = chars[i], t = target(c);\n      var k = Math.min(1, (rt - c.t0) / 1000);\n      c.cur = c.from + (c.to - c.from) * power3Out(k); // where the running catch-up has got to by this frame\n      if (Math.abs(t - c.to) > 1e-6) { c.from = c.cur; c.to = t; c.t0 = rt; k = 0; } // scrub: 1 restarts it from there\n      if (k < 1) moving = true;\n      var rest = 1 - backOut(c.cur); // share of the starting offset still left\n      var y = (-lift + c.u * (lift + 20)) * rest, r = c.v * tilt * rest;\n      c.el.style.transform = \"translateY(\" + y.toFixed(2) + \"%) rotate(\" + r.toFixed(2) + \"deg)\";\n    }\n    return moving;\n  }\n\n  function loop(now) {\n    raf = 0;\n    var dt = Math.min(50, Math.max(0, now - last)); last = now;\n    if (!visible || document.hidden || destroyed) return; // the observer and visibilitychange restart it\n    rt += dt;\n    var auto = opts.autoplay;\n    if (auto) {\n      P += dt * 0.0003 * opts.speed * rootW / textW; // about 0.3 box widths a second at speed 1\n      if (P >= 1) { P %= 1; snap(); }                // the line is off screen at both ends, so the loop has no seam\n    } else P = scrollP();\n    var moving = render();\n    if (auto || moving) raf = requestAnimationFrame(loop);\n  }\n  function kick() { if (!raf && !destroyed && !reduce && built) { last = performance.now(); raf = requestAnimationFrame(loop); } }\n  function onScroll() { if (!opts.autoplay) kick(); }\n  function relayout() { if (destroyed) return; var keep = P; measure(); P = keep; render(); kick(); }\n\n  function update(partial) {\n    var prev = opts;\n    opts = Object.assign({ text: \"⏾ Work Hard. Sleep Hard. ✦\", autoplay: 1, speed: 1, size: 10, lift: 200, tilt: 20, color: \"#e6ff55\", background: \"#0c1e18\" }, opts, partial || {});\n    opts.autoplay = on(opts.autoplay);\n    opts.speed = Math.min(5, Math.max(0.05, num(opts.speed, 1)));\n    opts.size = Math.min(30, Math.max(2, num(opts.size, 10)));\n    opts.lift = Math.max(0, num(opts.lift, 200));\n    opts.tilt = Math.max(0, num(opts.tilt, 20));\n    box.style.background = opts.background;\n    box.style.color = opts.color;\n    box.style.setProperty(\"--ef-ssl-size\", String(opts.size));\n    box.classList.toggle(\"is-reduced\", reduce);\n    if (destroyed) return;\n    if (!built || prev.text !== opts.text) build();\n    else if (prev.size !== opts.size) relayout();\n    else render();\n    if (prev.autoplay !== opts.autoplay && !opts.autoplay) P = scrollP();\n    kick();\n  }\n\n  update(o);\n  window.addEventListener(\"scroll\", onScroll, { passive: true });\n  if (\"IntersectionObserver\" in window) {\n    io = new IntersectionObserver(function (es) { visible = es[es.length - 1].isIntersecting; if (visible) kick(); });\n    io.observe(box);\n  }\n  if (\"ResizeObserver\" in window) { ro = new ResizeObserver(relayout); ro.observe(box); }\n  if (document.fonts && document.fonts.ready) document.fonts.ready.then(relayout);\n  function onVis() { if (!document.hidden) kick(); }\n  document.addEventListener(\"visibilitychange\", onVis);\n  return {\n    update: update,\n    destroy: function () {\n      destroyed = true; cancelAnimationFrame(raf); raf = 0;\n      window.removeEventListener(\"scroll\", onScroll);\n      document.removeEventListener(\"visibilitychange\", onVis);\n      if (io) io.disconnect();\n      if (ro) ro.disconnect();\n    }\n  };\n}"
  }
}