.gallery-wrapper {
  align-items: center;
  background: rgba(36, 36, 36, .736);
  backdrop-filter: blur(8px);
  display: none; /* Initially hidden */
  inset: 0;
  height: 100vh;
  justify-content: center;
  overflow: hidden;
  position: fixed;
  width: 100vw;
  z-index: 9999999;
}

@keyframes show-gallery {
  0% {
    display: none;
    opacity: 0;
  }
  1% {
    display: flex;
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes hide-gallery {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.gallery-wrapper.on {
  animation: show-gallery 1s ease-in-out forwards;
}

.gallery-wrapper.closing {
  animation: hide-gallery 1s ease-in-out forwards;
}

.gallery-closer {
  background: transparent;
  border: 0;
  inset: 0;
  position: fixed;
}

.gallery-close-button {
  background: rgb(36, 36, 36);
  border: 2px solid rgba(236, 236, 236, .236);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(0, 0, 0, .236);
  color: white;
  height: 55px;
  position: relative;
  width: 55px;
}

.gallery-close-button::before,
.gallery-close-button::after {
  background: white;
  border-radius: 18px;
  content: '';
  inset: 45% 25%;
  position: absolute;
}

.gallery-close-button::before {
  transform: rotate(45deg);
}

.gallery-close-button::after {
  transform: rotate(-45deg);
}

.gallery {
  display: flex;
  justify-content: center;
  position: relative;
  width: 100%;
}

.item {
  align-items: center;
  border-radius: clamp(7.36px, 9.736px, .736vw);
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  box-shadow: 0 0 18px rgba(0, 0, 0, .376);
  height: calc(80vh - 35px);
  margin-bottom: 65px;
  opacity: 0;
  overflow: clip;
  transform: scale(.85) translateY(35%);
  transition: opacity .5s ease-in-out, transform .85s ease-in-out;
  width: fit-content;
  visibility: hidden;
}

.item.active {
  opacity: 1;
  position: absolute;
  transform: scale(1);
  visibility: visible;
}

.item img {
  object-fit: contain;
  height: 100%;
  width: 100%;
}

.controls {
  display: flex;
  inset: auto auto 25px auto;
  justify-content: center;
  position: absolute;
  width: 100%;
}

.controls button {
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  height: 50px;
  justify-content: center;
  margin: 0 .25vw;
  padding: 0;
  transition: background .25s, filter .25s;
  width: 50px;
}

.controls button:hover {
  background: rgba(0, 0, 0, 1);
  filter: invert(1);
}

@media only screen and (max-width: 600px) {
  .gallery {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .item {
    box-shadow: none;
    height: 80vh;
    max-width: 85vw;
    transform: scale(.95) translateY(-1.365%);
    width: unset;
  }

  .controls {
    justify-content: center;
    bottom: 15dvh;
    top: auto;
    width: 100%;
  }

  .controls button {
    height: 45px;
    margin: 0 5px;
    width: 45px;
  }
}
