To create this interaction, I set up five variants: one default and four for each card's expanded state.
In the primary variant, all cards are in their default state, stacked in a grid. In the other four variants, one card is set to the expanded state while the remaining three cards are collapsed. The expanded card is positioned absolutely, while the collapsed cards are positioned relatively. This approach is consistent across all four variants.
The text and button that appears in the expanded state of each card is initially positioned absolutely and set to opacity 0 in the default state. When the card transitions to the expanded state, the text switches to relative positioning.
Finally, I added click interactions to allow smooth transitions between the default, expanded, and collapsed states across all variants. That’s it!