Displaying collection details by click in a fixed div

Hey everyone,

I am trying to build a collection gallery of 4 images in a row (rightbound).
When clicking on one of the collection item images the details to that specific item should be displayed on the left side of the screen in a fixed div.
I got the logic partly, but when i click item #5 after item #1 and want to click item #1 afterwards, the details of item #1 are hidden behind item #5. But the latest clicked item should be always on top of the z-index.

Currently I have a (first) click animations on the item.
The animation is displaying the fixed div and creating a border around the active element.

If you have any idea how to create this logic I’d be super thankful.

Thank you & best,

Here is my site Read-Only: [LINK](Webflow - Playground)
(how to share your site Read-Only link)