/* ============================================
   GALLERY GRID — CORE
   Shared masonry primitives for gallery.html only.
   Villa detail pages (amethyst, aquamarine,
   moonstone, onyx) each carry their own independent
   copy of this pattern in their own CSS file — this
   file is NOT imported by them, so edit it freely
   without touching villa layouts.
   ============================================ */

/* True masonry via CSS multi-column: each tile keeps its image's natural
   aspect ratio, so column heights self-balance from real photo dimensions —
   no manual per-item sizing to maintain when photos change. */
.gallery-grid {
  column-count: 4;
  column-gap: 10px;
  max-width: 1400px;
  margin: 0 auto;
}

.gallery-item {
  position: relative; /* required so .gallery-overlay (gallery-page.css) anchors to this tile, not the page */
  break-inside: avoid; /* stops a tile being split across two columns */
  -webkit-column-break-inside: avoid; /* older Safari */
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  display: block; /* required inside a column container to avoid inline-gap artifacts */
}

.gallery-img {
  width: 100%;
  height: auto; /* natural aspect ratio drives each tile's height — the masonry effect */
  display: block;
  transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-img {
  transform: scale(1.08);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .gallery-grid { column-count: 3; }
}

@media (max-width: 640px) {
  .gallery-grid { column-count: 2; }
}

@media (max-width: 420px) {
  .gallery-grid { column-count: 1; }
}