.gallery {
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--ap-surface, #f6f3ea);
  border-bottom: 1px solid #c7c7c7;
}

.gallery-card {
  width: 100%;
  aspect-ratio: 4 / 5;
  min-width: 0;
  border-right: 1px solid #bcbcbc;
  border-bottom: 1px solid #bcbcbc;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .3s ease;
  overflow: hidden;
  position: relative;
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #202020;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.gallery-card:hover::after {
  opacity: 0.5;
}

.gallery-card:nth-child(4n) {
  border-right: none;
}

.gallery-card img,
.main-gallery-img,
.hover-gallery-img {
  width: 100%;
  height: 100%;
}

.gallery-card img {
  object-fit: cover;
  display: block;
  transition: opacity .35s ease, transform .35s ease;
}

.gallery-card:hover img {
  transform: scale(1.03);
}

.hover-gallery-img {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.gallery-instagram-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: clamp(34px, 5vw, 58px) !important;
  height: clamp(34px, 5vw, 58px) !important;
  object-fit: contain !important;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.gallery-card:hover .gallery-instagram-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 1100px) {
  .gallery {
    grid-template-columns: 1fr 1fr;
  }

  .gallery-card:nth-child(4n) {
    border-right: 1px solid #bcbcbc;
  }

  .gallery-card:nth-child(2n) {
    border-right: none;
    display: none;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr 1fr;
  }

  .gallery-card,
  .gallery-card:nth-child(2n),
  .gallery-card:nth-child(4n) {
    border-right: none;
  }

  .gallery-card:nth-child(2n + 1) {
    border-right: 1px solid #bcbcbc;
  }
}
