/* Gallery Grid — Masonry container */
/* Masonry column sizer (not rendered, used for column width calculation) */
.grid .grid-sizer {
  width: calc((100% - 60px) / 4); /* 4 columns: (100% - 3×20px) / 4 */
}

/* Masonry gutter sizer (not rendered, used for horizontal gap calculation) */
.grid .gutter-sizer {
  width: 20px;
}

.gallery-card {
  width: calc((100% - 60px) / 4); /* must match .grid-sizer */
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(255,255,255,0.98);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: border-color 0.15s ease-out;
  /* <a> tag reset */
  display: block;
  text-decoration: none;
  color: inherit;
}

.gallery-card:hover {
  border-color: var(--accent);
}

/* Image thumbnail — fixed ratio with background cover */
.gallery-card-thumb {
  background-color: #ebe4da;
  background-image: linear-gradient(135deg, #f4eee6 0%, #ebe4da 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  position: relative;
  padding-top: 75%;
}

/* Hidden img: preserved solely for imagesLoaded/PhotoSwipe dimension detection */
.gallery-card-thumb img {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.gallery-card-body {
  padding: 14px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gallery-card-title {
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-cat {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 12px;
}

/* PhotoSwipe thumbnail strip */
.pswp__thumbnail-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.pswp__thumbnail-strip::-webkit-scrollbar {
  height: 4px;
}

.pswp__thumbnail-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.pswp__thumbnail-item {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  box-sizing: border-box;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background-color: #444;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0;
  transition: border-color 0.15s ease-out;
}

.pswp__thumbnail-item.is-active {
  border-color: #fff;
}

.pswp__thumbnail-item:hover:not(.is-active) {
  border-color: rgba(255, 255, 255, 0.5);
}

/* Responsive — adjust Masonry column widths per breakpoint */
@media (max-width: 960px) {
  .grid .grid-sizer,
  .gallery-card {
    width: calc((100% - 20px) / 2); /* 2 columns: (100% - 1×20px) / 2 */
  }
}
