.gallery {
  padding: 24px 0;
}

.gallery__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.gallery-item {
  display: block;
  width: 100%;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

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

body.lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 5000;
}

.gallery-lightbox.is-open {
  display: block;
}

.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.gallery-lightbox__content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 70px;
}

.gallery-lightbox__imagewrap {
  max-width: min(1200px, 92vw);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox__imagewrap img {
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  background: #111;
}

.gallery-lightbox__close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.gallery-lightbox__close:hover {
  background: rgba(255,255,255,.24);
}

.gallery-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}

.gallery-lightbox__nav:hover {
  background: rgba(255,255,255,.24);
}

.gallery-lightbox__nav--prev {
  left: 16px;
}

.gallery-lightbox__nav--next {
  right: 16px;
}

.gallery-lightbox__counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 14px;
}

@media (max-width: 768px) {
  .gallery-lightbox__content {
    padding: 24px 16px 60px;
  }

  .gallery-lightbox__nav {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }

  .gallery-lightbox__nav--prev {
    left: 8px;
  }

  .gallery-lightbox__nav--next {
    right: 8px;
  }

  .gallery-lightbox__close {
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    font-size: 26px;
  }
}