JSFiddle - React, Tailwind, and code Playground

by von

HTML

<style>
html {
scroll-behavior: smooth;
}

main *,
main *::after,
main *::before {
margin: 0;
padding: 0;
box-sizing: border-box;
}

.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
justify-items: center;
grid-gap: 10px;
}

figure {
width: 100%;
cursor: pointer;
margin: 10px;
box-sizing: border-box;
}

figure .image {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
pointer-events: none;
}

.image-span {
position: relative;
display: block;
pointer-events: none;
}

.image-span::after {
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
background-image: url("mag-icon.png");
background-position: 100% 100%;
background-size: 35%;
background-repeat: no-repeat;
pointer-events: none;
}

figure figcaption {
text-align: center;
pointer-events: none;
font-weight: bold;
}

figure p {
text-align: justify;
}

.mid-div {
position: absolute;
top: 50%;
}

.mozal {
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.3);
z-index: 1;
}

.mozal.hide {
display: none;
}

.mozal-box {
max-width: 80%;
max-height: 80%;
background-color: wheat;
position: relative;
}

.mozal-image {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}

.close {
position: absolute;
top: 5px;
right: 5px;
color: white;
text-shadow: 0 0 0 dimgray;
cursor: pointer;
}

.close:hover {
color: dimgray;
text-shadow: 0 0 0 white;
}
i {
position: absolute;
top: 50%;
transform: translateY(-50%);
padding: 10px;
color: #aaa;
transition: all 300ms;
}
i:hover {
color: #fff;
transform: scale(1);
cursor: pointer;
}
i.fa-arrow-right {
right: 0;
transform: translate(100%, -50%);
}
i.fa-arrow-left {
left: 0;
transform: translate(-100%, -50%);
}
.mozal-box .caption {
width: 100%;
position: absolute;
bottom: 0;
text-align: center;
padding: 10px;
color: #fff;
background-image: linear-gradient(to top, #333,...