{
    "id": "bhaskar/loose-type-letterpress-hero-you-can-push-around",
    "kind": "plan",
    "title": "Loose type letterpress hero you can push around",
    "summary": "A bold cobalt hero where every headline letter is a loose piece of type that springs away from your finger or cursor and settles back.",
    "author": "Admin",
    "stars": 0,
    "url": "https://ownlyplans.com/bhaskar/loose-type-letterpress-hero-you-can-push-around/",
    "stack": [
        "CSS",
        "HTML",
        "JavaScript"
    ],
    "tools": [
        "claude-code",
        "cursor",
        "lovable"
    ],
    "difficulty": "intermediate",
    "license": "cc-by-4.0",
    "version": "1.0",
    "overview": "A single-file hero for a letterpress studio, with no libraries. The headline is split into letters. Each letter has its own small spring, so it is pushed away by the pointer, tilts as it goes and settles back. Pressing harder (mouse down or touch) makes the push stronger. The first view is one entrance moment: the letters drop in as if the line has just been locked up. The page is plain cobalt blue and white, with one serif face doing all the work.",
    "steps": [
        {
            "title": "Set the cobalt page and the type",
            "body": "Use one strong colour and one heavy serif. The headline is the whole design, so keep everything around it quiet.",
            "prompt": "Create a single-file HTML hero for Galley & Co., a two-press letterpress studio. Page colour cobalt #2438ff with a soft navy glow in the bottom right, text in paper white #fbfaf5, secondary text #c7ccff. Fonts: Fraunces 900 for the headline and Instrument Sans for everything else, loaded from Google Fonts with Georgia and system-ui fallbacks. Layout: a top bar with the studio name and a few links, then a giant two-line headline, \"Set in lead.\" in solid white and \"Pulled by hand.\" as outlined letters (transparent fill, 2px white text stroke), left aligned. Below it put a short paragraph and two buttons, and a thin rule and small footer line at the bottom. The headline should be about 13vw wide so it fills the page.",
            "done": "A cobalt page with a huge two-line headline, one solid and one outlined, a paragraph, two buttons and a footer line.",
            "files": []
        },
        {
            "title": "Split the headline into letters",
            "body": "Turn each character into its own inline-block span so it can move on its own, while keeping the headline readable for screen readers.",
            "prompt": "In JavaScript, take the text of each headline row from a data attribute and create one inline-block span per character (use a non-breaking space for spaces). Keep the headline as one accessible label with aria-label and mark the visual rows aria-hidden. Store each letter's centre point from getBoundingClientRect after fonts have loaded and again on resize and scroll. Give each letter its own state: x, y, rotation and their velocities.",
            "done": "The headline looks the same as before, but each letter is its own element with a stored position.",
            "files": []
        },
        {
            "title": "Add the spring and the push",
            "body": "Every frame, push letters away from the pointer and pull them back toward home. Damping makes them settle instead of wobbling forever.",
            "prompt": "Run a requestAnimationFrame loop. For each letter, measure its distance to the pointer. Inside a radius of about 16% of the screen width (between 120px and 240px) add a velocity away from the pointer that grows with the square of how close it is, and add a rotation velocity in the same direction. Pressing the pointer down multiplies the push by about 1.6. Then add a spring that pulls x, y and rotation back to zero (about 7.5% of the offset per frame), damp the velocities (multiply by 0.82 for position, 0.8 for rotation) and apply the result with transform: translate3d and rotate. At start, drop every letter in from above with a small random tilt so the first thing the visitor sees is the line being locked up.",
            "done": "Moving the mouse over the headline scatters the letters, and they spring back into place when you move away.",
            "files": []
        },
        {
            "title": "Make it work on phones and respect reduced motion",
            "body": "The same effect works with a finger. Then handle the small screen and anyone who asks for less motion.",
            "prompt": "Use pointer events so touch and mouse share the same code, and set touch-action: pan-y on the hero so vertical scrolling still works. Reset the pointer position when the finger lifts or leaves. At 760px and below hide the text links, make the paragraph and buttons stack, make the buttons share the row, and stack the footer lines. If prefers-reduced-motion is on, skip the animation loop and draw the letters once in their home position. Check there is no horizontal scrolling at 390px wide.",
            "done": "On a phone, dragging a finger across the headline pushes the letters, the page still scrolls, and nothing overflows sideways.",
            "files": []
        }
    ],
    "files": [
        {
            "type": "markdown",
            "name": "loose-type-hero.html",
            "note": "The finished file. Open it in a browser.",
            "file": "loose-type-hero",
            "url": "https://ownlyplans.com/bhaskar/loose-type-letterpress-hero-you-can-push-around/loose-type-hero/"
        }
    ],
    "install": "",
    "how_to_use": "Call get_step with step 1, do it, check \"done when\", then continue.",
    "live_preview": true
}