/* PhotoGrid WP — Public Styles */
.pgw-wrapper {
  --pgw-gap: 12px;
  --pgw-radius: 6px;
  --pgw-overlay: rgba(0, 0, 0, 0.45);
  --pgw-lb-bg: rgba(0, 0, 0, 0.94);
  --pgw-btn-bg: #0073aa;
  --pgw-btn-hover: #005f8d;
  --pgw-caption-bg: rgba(0, 0, 0, 0.65);
  --pgw-speed: 0.3s;
}

/* ── Grid ─────────────────────────────────────────────────────────── */
.pgw-gallery {
  display: grid;
  gap: var(--pgw-gap);
  width: 100%;
}

.pgw-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pgw-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pgw-cols-4 { grid-template-columns: repeat(4, 1fr); }
.pgw-cols-5 { grid-template-columns: repeat(5, 1fr); }
.pgw-cols-6 { grid-template-columns: repeat(6, 1fr); }

.pgw-masonry {
  grid-auto-rows: 10px;
  align-items: start;
}

/* ── Items ────────────────────────────────────────────────────────── */
.pgw-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--pgw-radius);
  margin: 0;
  background: #f0f0f0;
}

.pgw-item-link {
  display: block;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  outline-offset: 2px;
}

/* Uniform 4:3 ratio for non-masonry */
.pgw-uniform .pgw-item-link::before {
  content: '';
  display: block;
  padding-top: 75%;
}

.pgw-uniform .pgw-photo-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Masonry — natural image heights */
.pgw-masonry .pgw-photo-img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Hover effects ────────────────────────────────────────────────── */
.pgw-photo-img {
  transition: transform var(--pgw-speed) ease;
}

.pgw-hover-zoom .pgw-item-link:hover .pgw-photo-img,
.pgw-hover-zoom .pgw-item-link:focus-visible .pgw-photo-img {
  transform: scale(1.07);
}

.pgw-overlay {
  position: absolute;
  inset: 0;
  background: var(--pgw-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--pgw-speed) ease;
  pointer-events: none;
  border-radius: inherit;
}

.pgw-item-link:hover .pgw-overlay,
.pgw-item-link:focus-visible .pgw-overlay {
  opacity: 1;
}

.pgw-hover-none .pgw-overlay { display: none; }

.pgw-zoom-icon {
  color: #fff;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  font-style: normal;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ── Captions ─────────────────────────────────────────────────────── */
.pgw-caption {
  padding: 6px 8px;
  font-size: 0.85rem;
  color: #555;
  text-align: center;
}

.pgw-hover-slide .pgw-caption,
.pgw-hover-overlay .pgw-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--pgw-caption-bg);
  color: #fff;
  padding: 10px 12px;
  margin: 0;
  transform: translateY(100%);
  transition: transform var(--pgw-speed) ease;
  font-size: 0.85rem;
}

.pgw-hover-slide .pgw-item:hover .pgw-caption,
.pgw-hover-slide .pgw-item:focus-within .pgw-caption,
.pgw-hover-overlay .pgw-item:hover .pgw-caption,
.pgw-hover-overlay .pgw-item:focus-within .pgw-caption {
  transform: translateY(0);
}

/* ── Load More ────────────────────────────────────────────────────── */
.pgw-load-more-wrapper {
  text-align: center;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pgw-load-more-btn {
  background: var(--pgw-btn-bg);
  color: #fff;
  border: none;
  padding: 12px 36px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.22s ease;
  font-family: inherit;
}

.pgw-load-more-btn:hover { background: var(--pgw-btn-hover); }
.pgw-load-more-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.pgw-spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid rgba(0, 115, 170, 0.3);
  border-top-color: var(--pgw-btn-bg);
  border-radius: 50%;
  animation: pgw-spin 0.75s linear infinite;
}

@keyframes pgw-spin { to { transform: rotate(360deg); } }

.pgw-no-photos {
  text-align: center;
  color: #777;
  padding: 40px 20px;
  grid-column: 1 / -1;
}

/* ── Lightbox ─────────────────────────────────────────────────────── */
.pgw-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: var(--pgw-lb-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.pgw-lb-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(92vw, 1200px);
  max-height: 92vh;
}

.pgw-lb-img {
  max-width: min(90vw, 1200px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 3px;
  display: block;
  user-select: none;
  transition: opacity 0.18s ease, transform 0.22s ease;
}

.pgw-lb-img.fading { opacity: 0; }

/* Slide transitions for navigation */
.pgw-lb-img.pgw-slide-out-left  { transform: translateX(-60px); opacity: 0; }
.pgw-lb-img.pgw-slide-out-right { transform: translateX(60px);  opacity: 0; }
.pgw-lb-img.pgw-slide-in-right  { transform: translateX(60px);  opacity: 0; transition: none; }
.pgw-lb-img.pgw-slide-in-left   { transform: translateX(-60px); opacity: 0; transition: none; }

.pgw-lb-caption {
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  margin-top: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 600px;
}

.pgw-lb-close {
  position: absolute;
  top: -44px; right: -4px;
  width: 36px; height: 36px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.pgw-lb-close:hover { background: rgba(255, 255, 255, 0.28); }

.pgw-lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 1000001;
}

.pgw-lb-nav:hover { background: rgba(255, 255, 255, 0.26); }
.pgw-lb-prev { left: 16px; }
.pgw-lb-next { right: 16px; }

.pgw-lb-counter {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pgw-cols-5,
  .pgw-cols-6 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 680px) {
  .pgw-cols-4,
  .pgw-cols-5,
  .pgw-cols-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .pgw-cols-3,
  .pgw-cols-4,
  .pgw-cols-5,
  .pgw-cols-6 { grid-template-columns: repeat(2, 1fr); }

  .pgw-lb-nav { font-size: 1.4rem; padding: 8px 12px; }
  .pgw-lb-prev { left: 6px; }
  .pgw-lb-next { right: 6px; }
}
