.gallery {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.gallery--single {
  grid-template-columns: minmax(0, 1fr);
}

.gallery img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.gallery__thumbs {
  height: 600px;
  overflow: hidden;
  min-width: 0;
}

.gallery__main {
  grid-column: span 5 / span 5;
  max-width: 100%;
  overflow: hidden;
  width: 100%;
  height: 600px;
  position: relative;
  outline: 1px solid var(--gray-400);
  border-radius: var(--rounded);
}

.gallery--single .gallery__main {
  grid-column: auto;
}

.gallery__main img {
  height: calc(100% - 4rem);
  width: calc(100% - 4rem);
}

.gallery__main-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gallery__main:not(:hover) .arrow-btn {
  opacity: 0;
  pointer-events: none;
}

.gallery__thumb-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  height: 90px;
  position: relative;
  transition: all 300ms;
}

.gallery__thumb-wrapper img {
  border-radius: var(--rounded);
}

.gallery__thumb-wrapper:active {
  scale: 0.9;
}

.gallery__main .arrow-btn {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 99;
  transition: all 300ms;
}

.gallery__main .arrow-btn:active {
  scale: 0.9;
}

@media (hover: hover) {
  .gallery__main .arrow-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
  }
}

.gallery__button--prev {
  left: 1rem;
}

.gallery__button--next {
  right: 1rem;
}

@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .gallery__main {
    grid-column: auto;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: min(70vh, 28rem);
  }

  .gallery__main img {
    height: calc(100% - 2rem);
    width: calc(100% - 2rem);
  }

  .gallery__thumbs {
    height: 5rem;
    width: 100%;
  }

  .gallery__thumb-wrapper {
    width: 4.5rem;
    height: 4.5rem;
  }

  .gallery__button--prev {
    left: 0.5rem;
  }

  .gallery__button--next {
    right: 0.5rem;
  }
}

@media (max-width: 640px) {
  .gallery__main {
    max-height: min(65vh, 22rem);
  }

  .gallery__main img {
    height: calc(100% - 1.25rem);
    width: calc(100% - 1.25rem);
  }

  .gallery__thumbs {
    height: 4.25rem;
  }

  .gallery__thumb-wrapper {
    width: 3.75rem;
    height: 3.75rem;
  }
}

@media (hover: none) {
  .gallery__main .arrow-btn {
    opacity: 1;
    pointer-events: all;
  }
}
