/**
 * @file gallery.css
 * Pure CSS masonry gallery using column-count. PhotoSwipe lightbox support.
 */

/*
 * Mercury's SDC applies display:grid to .view-content inside its columns.
 * Override to block so our column-count can take effect.
 */
.view-id-gallery .view-content {
  display: block;
}

/* 
 * Container: Uses CSS Grid for a balanced, responsive layout.
 * We use gap: 1.5rem (24px) for both horizontal and vertical gutters.
 */
.gallery-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

/*
 * Items: Use aspect-ratio to ensure rows are perfectly aligned.
 */
.gallery-item {
  width: 100%;
}

.gallery-item a {
  display: block;
  overflow: hidden;
  border-radius: 0.75rem;
  position: relative;
  aspect-ratio: 1 / 1; /* Square crop for consistency on the grid */
}

/* Ensure intermediate Views wrappers also fill the container */
.gallery-item a > div,
.gallery-item a .field-content {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures image fills the square aspect ratio */
  transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1),
              filter 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item a:hover img {
  transform: scale(1.04);
  filter: brightness(1.02);
}

.gallery-item a:hover {
  box-shadow: inset 0 0 0 1px oklch(0.76 0.07 10 / 0.35);
}

/* Tablet: 3 columns */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

/* Mobile: 2 columns */
@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

/* PhotoSwipe: override default black with site dark charcoal */
.pswp {
  --pswp-bg: oklch(0.16 0.005 15);
}
