/* ============================================
   GALLERY — Masonry + Lightbox
   ============================================ */

/* --- Masonry Grid --- */
.ps-gallery-grid {
  columns: 3;
  column-gap: var(--space-md);
  padding: 0;
}

.ps-gallery-item {
  break-inside: avoid;
  margin-bottom: var(--space-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform var(--duration-normal) var(--ease-out);
}

.ps-gallery-item:hover {
  transform: scale(1.02);
}

.ps-gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--duration-slow) var(--ease-out);
}

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

.ps-gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--duration-normal);
  display: flex;
  align-items: flex-end;
  padding: var(--space-lg);
}

.ps-gallery-item:hover .ps-gallery-item__overlay {
  opacity: 1;
}

.ps-gallery-item__caption {
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
}

/* Zoom icon */
.ps-gallery-item__zoom {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--duration-normal) var(--ease-out);
  color: var(--color-gray-700);
  font-size: 1rem;
}

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

/* --- Lightbox --- */
.ps-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal), visibility var(--duration-normal);
}

.ps-lightbox.active {
  opacity: 1;
  visibility: visible;
}

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

.ps-lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  transition: transform var(--duration-normal) var(--ease-out),
              opacity var(--duration-normal);
}

.ps-lightbox__img.loading {
  opacity: 0.3;
}

.ps-lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: var(--color-white);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
  z-index: 10001;
}

.ps-lightbox__close:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

.ps-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: var(--color-white);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
  z-index: 10001;
}

.ps-lightbox__nav:hover {
  background: rgba(255,255,255,0.25);
}

.ps-lightbox__prev {
  left: 20px;
}

.ps-lightbox__next {
  right: 20px;
}

.ps-lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-family: var(--font-heading);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
}

.ps-lightbox__caption {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  text-align: center;
  max-width: 80%;
}

/* --- Album Sub-Filters --- */
.ps-albums {
  margin-top: var(--space-md);
  margin-bottom: var(--space-xl);
}

.ps-albums__group {
  display: none;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: center;
}

.ps-albums__group.active {
  display: flex;
}

.ps-album-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-full, 999px);
  background: var(--color-white);
  color: var(--color-gray-600);
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.ps-album-btn:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
  background: var(--color-primary-lightest);
}

.ps-album-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
}

.ps-album-btn__count {
  font-size: 0.75rem;
  opacity: 0.6;
}

.ps-album-btn.active .ps-album-btn__count {
  opacity: 0.8;
}

/* --- Filter button count badge --- */
.ps-filter-btn__count {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-left: 2px;
}

.ps-filter-btn.active .ps-filter-btn__count {
  opacity: 0.8;
}

/* Page header styles moved to components.css */

@media (max-width: 991px) {
  .ps-gallery-grid {
    columns: 2;
  }
}

@media (max-width: 575px) {
  .ps-gallery-grid {
    columns: 1;
  }

  .ps-lightbox__nav {
    width: 40px;
    height: 40px;
  }

  .ps-lightbox__prev { left: 10px; }
  .ps-lightbox__next { right: 10px; }

  .ps-albums__group.active {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-xs);
  }

  .ps-album-btn {
    flex-shrink: 0;
  }
}
