.sb-photo-gallery {
  background: #fff;
}

.sb-photo-gallery--soft {
  background: #f8fafc;
}

.sb-photo-gallery--dark {
  background: #0f172a;
}

.sb-photo-gallery__heading {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: #0f172a;
}

.sb-photo-gallery--dark .sb-photo-gallery__heading {
  color: #f1f5f9;
}

/* Grid layout */
.sb-photo-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.sb-photo-gallery--cols-2 { grid-template-columns: repeat(2, 1fr); }
.sb-photo-gallery--cols-3 { grid-template-columns: repeat(3, 1fr); }
.sb-photo-gallery--cols-4 { grid-template-columns: repeat(4, 1fr); }

.sb-photo-gallery--gap-none { gap: 0; }
.sb-photo-gallery--gap-sm   { gap: 6px; }
.sb-photo-gallery--gap-md   { gap: 12px; }
.sb-photo-gallery--gap-lg   { gap: 20px; }

/* Gallery item */
.sb-gallery-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #e2e8f0;
}

.sb-gallery-item__link {
  display: block;
  position: relative;
  overflow: hidden;
}

/* Aspect ratios */
.sb-gallery-item--square .sb-gallery-item__img,
.sb-gallery-item--square .sb-gallery-item__link {
  aspect-ratio: 1 / 1;
}

.sb-gallery-item--wide .sb-gallery-item__img,
.sb-gallery-item--wide .sb-gallery-item__link {
  aspect-ratio: 16 / 9;
}

.sb-gallery-item--portrait .sb-gallery-item__img,
.sb-gallery-item--portrait .sb-gallery-item__link {
  aspect-ratio: 3 / 4;
}

.sb-gallery-item__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}

.sb-gallery-item:hover .sb-gallery-item__img {
  transform: scale(1.04);
}

/* Hover overlay */
.sb-gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}

.sb-gallery-item:hover .sb-gallery-item__overlay {
  opacity: 1;
}

.sb-gallery-item__caption {
  font-size: .78rem;
  color: #64748b;
  padding: 5px 4px 2px;
  text-align: center;
}

.sb-photo-gallery--dark .sb-gallery-item__caption {
  color: #94a3b8;
}

/* Lightbox overlay */
.sb-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: sbLbFadeIn .15s ease;
}

@keyframes sbLbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sb-lightbox-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  pointer-events: none;
}

.sb-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: #fff;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  opacity: .8;
}

.sb-lightbox-close:hover {
  opacity: 1;
}

@media (max-width: 767.98px) {
  .sb-photo-gallery--cols-3,
  .sb-photo-gallery--cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 479.98px) {
  .sb-photo-gallery--cols-2,
  .sb-photo-gallery--cols-3,
  .sb-photo-gallery--cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

html[data-theme="dark"] .sb-photo-gallery {
  background: #0f172a;
}

html[data-theme="dark"] .sb-photo-gallery--soft {
  background: #1e293b;
}

html[data-theme="dark"] .sb-photo-gallery__heading {
  color: #f1f5f9;
}

html[data-theme="dark"] .sb-gallery-item {
  background: #334155;
}

html[data-theme="dark"] .sb-gallery-item__caption {
  color: #94a3b8;
}
