I have a drop shadow at the bottom left corner of a div. I created it using a ::before pseudo-element. I want the div to scale when I hover over it but when I do so the pseudo-element moves to the top of the stack order. Why does this happen and how can I stop the element from moving to the top?
.grid-item {
width: 200px;
height: 200px;
margin: 100px auto;
background-color: #c2c8e1;
border: 1px solid rgba(211, 215, 233, 0.9);
position: relative;
transition: transform 0.2s ease-in-out;
}
.grid-item:before {
content: "";
z-index: -1;
width: 60%;
position: absolute;
top: 80%;
bottom: 12px;
left: 10px;
background: #777;
box-shadow: 0 15px 10px #777;
transform: rotate(-4deg);
}
.grid-item:hover {
transform: scale(1.03);
}
<div class="grid-item"></div>