/* Gallery — Masonry grid + Lightbox */

/* ============================================
   GALLERY GRID
   ============================================ */

.gallery {
  padding-block: var(--space-lg);
}

.gallery__section {
  margin-bottom: var(--space-xl);
}

.gallery__section:last-child {
  margin-bottom: 0;
}

.gallery__section-title {
  margin-bottom: var(--space-md);
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Masonry-style span variations */
  .gallery-grid--masonry .gallery-item:nth-child(4n + 1) {
    grid-row: span 2;
  }

  .gallery-grid--masonry .gallery-item:nth-child(7n + 3) {
    grid-column: span 2;
  }
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background-color: var(--color-sand);
}

.gallery-grid--masonry .gallery-item:nth-child(4n + 1) {
  aspect-ratio: auto;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(27, 58, 75, 0);
  transition: background var(--transition-fast);
}

.gallery-item:hover::after {
  background: rgba(27, 58, 75, 0.15);
}

/* Gallery expand icon on hover */
.gallery-item__icon {
  position: absolute;
  bottom: var(--space-sm);
  right: var(--space-sm);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(253, 251, 247, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition-fast),
              transform var(--transition-fast);
}

.gallery-item:hover .gallery-item__icon {
  opacity: 1;
  transform: scale(1);
}

.gallery-item__icon svg {
  width: 18px;
  height: 18px;
  fill: var(--color-deep-blue);
}

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(27, 58, 75, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base),
              visibility var(--transition-base);
}

.lightbox--open {
  opacity: 1;
  visibility: visible;
}

.lightbox__image-wrapper {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--transition-base),
              transform var(--transition-base);
}

.lightbox--open .lightbox__image {
  opacity: 1;
  transform: scale(1);
}

.lightbox__close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(253, 251, 247, 0.15);
  color: var(--color-warm-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  z-index: 1;
}

.lightbox__close:hover {
  background: rgba(253, 251, 247, 0.3);
}

.lightbox__close svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(253, 251, 247, 0.15);
  color: var(--color-warm-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.lightbox__nav:hover {
  background: rgba(253, 251, 247, 0.3);
}

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

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

.lightbox__nav svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.lightbox__counter {
  position: absolute;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--fs-small);
  color: rgba(253, 251, 247, 0.6);
  font-weight: var(--fw-medium);
}
