.gallery {
  overflow: hidden;
  padding: 1rem;
  width: 100%;
  height: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.thumbnails {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  flex-wrap: wrap;
}

.thumbnail-container {
  width: 18rem;
  height: 18rem;
  overflow: hidden;
  margin: 0.1rem;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.thumbnail-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition-duration: 0.5s;
}

.thumbnails img:hover {
  transform: scale(1.2);
  -webkit-transform: scale(1.2);
  -moz-transform: scale(1.2);
  transition-duration: 1s;
  filter: brightness(0.6);
  border-radius: 0.2rem;
}

.modal-image:not(.no-zoom):hover {
  transform: none;
  -webkit-transform: none;
  -moz-transform: none;
  filter: none;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 10000;
}

.modal-content {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  box-sizing: border-box;
  padding: 1rem;
}

.modal-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid #ccc;
  object-fit: contain;
  transition: none;
  width: 100%;
  height: 100%;
}

.closebtn {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 4rem;
  font-weight: bold;
  color: white;
  cursor: pointer;
}

.previous,
.nextbtn {
  position: absolute;
  top: 50%;
  width: auto;
  padding: 16px;
  margin-top: -50px;
  font-weight: bold;
  font-size: 30px;
  cursor: pointer;
  color: white;
  user-select: none;
}

.nextbtn {
  right: 0;
}

.previous:hover,
.nextbtn:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

@media only screen and (max-width: 768px) {
  .thumbnail-container {
    width: 100%;
    height: 25rem;
  }
  .previous,
  .nextbtn {
    position: absolute;
    top: 50%;
    width: auto;
    padding: 1rem;
    margin-top: -2.5rem;
    font-weight: bold;
    font-size: 30px;
    cursor: pointer;
    color: white;
    user-select: none;
  }
  .closebtn {
    position: absolute;
    top: 1.5rem;
    right: 20px;
    font-size: 4rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
  }
}

@media (hover: none) {
  .thumbnails img:not(.no-zoom):hover {
    transform: none;
    -webkit-transform: none;
    -moz-transform: none;
  }
}

.image-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 14px;
}
