.gallery-mosaic {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(180px, auto);
  gap: 6px;
  width: var(--container);
  max-width: 100%;
  margin-inline: auto;
  padding-inline: 4vw;
}

.gallery-mosaic__item {
  position: relative;
  margin: 0;
  padding: 0;
  border: none;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-ivory-deep);
}

.gallery-mosaic__item picture {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.gallery-mosaic__item img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-out), filter var(--duration-fast);
}

.gallery-mosaic__item:hover img {
  transform: scale(1.04);
}

.gallery-mosaic__item--wide {
  grid-column: span 8;
  grid-row: span 2;
  min-height: 320px;
}

.gallery-mosaic__item--tall {
  grid-column: span 4;
  grid-row: span 3;
  min-height: 420px;
}

.gallery-mosaic__item--normal {
  grid-column: span 4;
  grid-row: span 2;
  min-height: 240px;
}

@media (max-width: 768px) {
  .gallery-mosaic {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
  }

  .gallery-mosaic__item--wide,
  .gallery-mosaic__item--tall,
  .gallery-mosaic__item--normal {
    grid-column: span 1;
    grid-row: span 1;
    min-height: 200px;
  }

  .gallery-mosaic__item--wide {
    grid-column: span 2;
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 11, 10, 0.94);
  padding: var(--space-md);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__figure {
  margin: 0;
  max-width: min(92vw, 1400px);
  max-height: 85vh;
}

.lightbox__image {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  margin-inline: auto;
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 3rem;
  height: 3rem;
  border: none;
  background: transparent;
  color: var(--color-ivory);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.lightbox__close:hover {
  opacity: 1;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.5;
}

.lightbox__nav::after {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  border-top: 1px solid var(--color-ivory);
  border-right: 1px solid var(--color-ivory);
}

.lightbox__nav--prev {
  left: var(--space-sm);
}

.lightbox__nav--prev::after {
  transform: rotate(-135deg);
  margin-left: 8px;
}

.lightbox__nav--next {
  right: var(--space-sm);
}

.lightbox__nav--next::after {
  transform: rotate(45deg);
}

.lightbox__nav:hover {
  opacity: 1;
}

.lightbox__caption {
  position: absolute;
  bottom: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  max-width: 40rem;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--color-stone-light);
}

body.lightbox-open {
  overflow: hidden;
}
