Skip to content

No.134 · Cards

Approach Card

A project card whose hierarchy responds to distance: from afar it's only a title; as you come closer the title steps back and the details arrive from the side you approach.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

Written for the variant you picked above: Pair

Design a portfolio/project card whose hierarchy is driven by distance rather than hover. One CSS variable, --p (0 = far, 1 = close), controls the whole layout. Compute it from a single window pointermove listener: the distance from the pointer to the card's rectangle edge (0 inside), mapped through 1 − d/220px and a smoothstep, then eased with a 0.11 lerp in a rAF loop that stops when settled. When --p first rises above 0.04, record which side the pointer came from (--dir = ±1). At p = 0 the card (21:27, 18px radius, #121015 with a hairline ring) shows only a mono index and year at the top and a very large Instrument Serif title sitting at the bottom. As p rises, the title scales to 50% from its top-left and translates up into a slot under the meta row (the travel distance is measured once with a ResizeObserver), and three details — summary, tech chips, a 'Read the case study →' line — each run their own clamp((p − 0.35 − 0.12k)·2.6) progress, fading in and sliding 22px from the approach side. A radial light gathers on that side, the ring strengthens, and a hairline along the bottom scales with p as a quiet proximity gauge. Keyboard focus sets p to 1. Each card takes an accent colour for its light and gauge. Selected variant — Pair (pair): Pair: two cards side by side (wrapping on narrow screens) — Masar (accent #b9cce4) and Wally (accent #e8a24a) — so with the pointer between them both half-open. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Approach the card and it reorganises itself continuously; focus it with the keyboard for the full detail view. It's a normal link. Motion: Continuous: a lerped proximity value drives transform/opacity through CSS calc(); staggered detail entry from the approach direction. Accessibility: The whole card is one link containing all text in reading order (title is an h3), so screen readers get everything regardless of --p. Focus opens it fully; reduced motion jumps straight to each target value. Responsive behavior: Fluid width up to 21rem with a fixed aspect ratio; the title's travel is re-measured on resize. Touch: On devices without hover the card renders in its fully-open state. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Approach the card and it reorganises itself continuously; focus it with the keyboard for the full detail view. It's a normal link.
Motion
Continuous: a lerped proximity value drives transform/opacity through CSS calc(); staggered detail entry from the approach direction.
Accessibility
The whole card is one link containing all text in reading order (title is an h3), so screen readers get everything regardless of --p. Focus opens it fully; reduced motion jumps straight to each target value.
Responsive
Fluid width up to 21rem with a fixed aspect ratio; the title's travel is re-measured on resize.
On touch
On devices without hover the card renders in its fully-open state.