How do I bring containers to the front by clicking them?

Hello community! So, I’m looking for some advice on a how-to question I have.

In short, I want to arrange some items stacked partially on top of each other, then when you click on one of the other items, it brings it to the front. Here’s an example:

The starting layout is like this:

Then, let’s say you click the second picture, with the waves. I’d want it to look like this:

I’d love to have a dynamic menu like this. Does anyone know how I could make that happen?