body {
  --home-green: #205747;
  --home-dark: #123f33;
  --home-white: #fffefa;
}

body.gallery-is-open {
  overflow: hidden;
}

.gallery-section {
  background: #fff;
  padding-block: clamp(4rem, 6vw, 7rem) clamp(6rem, 9vw, 11rem);
}

.gallery-container {
  margin-inline: auto;
  max-width: 1640px;
  padding-inline: clamp(1.25rem, 5.5vw, 6.5rem);
  width: 100%;
}

.gallery-mosaic {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gallery-item {
  background: var(--home-dark);
  border: 0;
  cursor: zoom-in;
  display: block;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 100%;
}

.gallery-item img {
  aspect-ratio: 4 / 3;
  display: block;
  height: 100%;
  object-fit: cover;
  transition: opacity 260ms ease, transform 450ms ease;
  width: 100%;
}

.gallery-mosaic > .gallery-item:last-child {
  grid-column: span 2;
}

.gallery-item::after {
  align-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  content: '+';
  display: flex;
  font-family: Arial, sans-serif;
  font-size: 1.8rem;
  height: 3rem;
  justify-content: center;
  left: 50%;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.75);
  transition: opacity 220ms ease, transform 220ms ease;
  width: 3rem;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  opacity: 0.52;
  transform: scale(1.025);
}

.gallery-item:hover::after,
.gallery-item:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.gallery-lightbox {
  background: transparent;
  border: 0;
  color: #fff;
  height: 100%;
  margin: auto;
  max-height: none;
  max-width: none;
  padding: clamp(3.5rem, 6vw, 6rem) clamp(3rem, 8vw, 9rem);
  width: 100%;
}

.gallery-lightbox[open] {
  display: block;
}

.gallery-lightbox::backdrop {
  background: rgb(10 24 20 / 92%);
}

.gallery-lightbox figure {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  margin: 0;
  touch-action: pan-y;
}

.gallery-lightbox img {
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 25%);
  max-height: calc(100vh - 9rem);
  max-width: 100%;
  object-fit: contain;
  user-select: none;
}

.gallery-lightbox figcaption {
  font-size: 0.9rem;
  margin-top: 0.8rem;
}

.gallery-lightbox__close,
.gallery-lightbox__arrow {
  align-items: center;
  background: rgb(255 255 255 / 12%);
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  height: 3.2rem;
  justify-content: center;
  position: fixed;
  width: 3.2rem;
  z-index: 1;
}

.gallery-lightbox__close {
  font-size: 2rem;
  right: 2rem;
  top: 2rem;
}

.gallery-lightbox__arrow {
  font-size: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox__arrow--previous {
  left: 2rem;
}

.gallery-lightbox__arrow--next {
  right: 2rem;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible,
.gallery-lightbox__arrow:hover,
.gallery-lightbox__arrow:focus-visible {
  background: rgb(255 255 255 / 24%);
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .gallery-container {
    padding-inline: 1.5rem;
  }
}

@media (max-width: 700px) {
  .gallery-mosaic {
    gap: 0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-lightbox {
    padding: 4.5rem 1rem 3.5rem;
  }

  .gallery-lightbox__close {
    right: 1rem;
    top: 1rem;
  }

  .gallery-lightbox__arrow {
    bottom: 0.8rem;
    top: auto;
    transform: none;
  }

  .gallery-lightbox__arrow--previous {
    left: calc(50% - 4rem);
  }

  .gallery-lightbox__arrow--next {
    right: calc(50% - 4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item img,
  .gallery-item::after {
    transition: none;
  }
}
