.bcg-gallery {
  --bcg-gap: 18px;
  width: min(100%, 1320px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(var(--bcg-columns, 4), minmax(0, 1fr));
  gap: var(--bcg-gap);
  align-items: start;
}

.bcg-gallery:has(.bcg-item:only-child) {
  grid-template-columns: minmax(260px, 520px);
  justify-content: center;
}

.bcg-item {
  display: grid;
  grid-template-rows: auto 1fr;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(20, 20, 23, .1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(20, 20, 23, .08);
}

.bcg-open {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: #f5f5f6;
  cursor: zoom-in;
}

.bcg-open img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
  transition: transform .28s ease, filter .28s ease;
}

.bcg-open:hover img {
  transform: scale(1.04);
  filter: saturate(1.08);
}

.bcg-item figcaption {
  display: grid;
  gap: 4px;
  padding: 14px 16px 16px;
  min-height: 62px;
}

.bcg-item strong {
  color: #141417;
  font-size: 1rem;
  line-height: 1.25;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bcg-item span,
.bcg-empty {
  color: #6b7280;
  font-weight: 700;
  line-height: 1.45;
}

.bcg-empty {
  padding: 18px;
  border: 1px solid rgba(20, 20, 23, .1);
  border-radius: 8px;
  background: #fff;
}

.bcg-lightbox {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483647 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: grid !important;
  place-items: center !important;
  padding: 28px !important;
  background: rgba(5, 7, 8, .92) !important;
}

.bcg-lightbox[hidden] {
  display: none !important;
}

.bcg-lightbox-inner {
  width: min(1280px, 100%) !important;
  max-height: calc(100dvh - 56px) !important;
  display: grid;
  gap: 12px;
  place-items: center;
}

.bcg-lightbox img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: calc(100vw - 56px) !important;
  max-height: calc(100dvh - 132px) !important;
  object-fit: contain !important;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .4);
}

.bcg-lightbox-text {
  color: #fff;
  text-align: center;
}

.bcg-lightbox-text strong {
  display: block;
  font-size: 1.1rem;
}

.bcg-lightbox-text span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, .72);
}

.bcg-close {
  position: fixed !important;
  top: 18px !important;
  right: 18px !important;
  z-index: 2147483647 !important;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #141417;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.bcg-lock {
  overflow: hidden !important;
}

@media (max-width: 1100px) {
  .bcg-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .bcg-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .bcg-item figcaption {
    padding: 12px;
  }
}

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