INTERACTION_093CSS
Expandable Card
A card grows in place to reveal its detail without a page change.
Cards / LightView
Cards stack with depth and fan out on interaction. Offset 12px and scaled down per layer behind the front card before the trigger; fanning the stack apart and lifting the front card once hover on desktop, swipe on touch.
/* Stacked Cards — Cards stack with depth and fan out on interaction. */
.stacked-cards {
--dur: 520ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 60ms;
will-change: transform, opacity;
}
.stacked-cards > * {
opacity: 0;
transform: translateY(14px);
animation: stacked-cards-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* offset 12px and scaled down per layer behind the front card -> fanning the stack apart and lifting the front card */
@keyframes stacked-cards-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.stacked-cards > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Stacked Cards — trigger: hover on desktop, swipe on touch */
export function StackedCards({ children }: { children: React.ReactNode }) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
const el = ref.current;
if (!el) return;
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
el.dataset["state"] = "in";
return;
}
const io = new IntersectionObserver(
([entry]) => {
if (entry?.isIntersecting) {
el.dataset["state"] = "in";
io.unobserve(el);
}
},
{ threshold: 0.2 },
);
io.observe(el);
return () => io.disconnect();
}, []);
return (
<div ref={ref} className="stacked-cards" data-state="out">
{children}
</div>
);
}A card grows in place to reveal its detail without a page change.
The card content shifts subtly with pointer position.
Hovering one tile dims and recedes the rest of the grid.
Quotes cross-fade and slide with an auto-advancing rhythm.