/* WP Gallery Frontend Styles */

.wpg-gallery {
  position: relative;
  margin: 0 auto;
}

/* Items container — default CSS Grid */
.wpg-items {
  display: grid;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Single item */
.wpg-item {
  position: relative;
  overflow: hidden;
  background-color: #f0f0f0;
  /* Blur-up: thumbnail background shows blurred while real image loads */
  background-size: cover;
  background-position: center;
}

.wpg-item-link {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.wpg-item-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* Overlay for caption/title */
.wpg-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.wpg-item:hover .wpg-item-overlay,
.wpg-effect-none .wpg-item-overlay {
  opacity: 1;
}

.wpg-item-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.wpg-item-caption {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

/* Custom grid type — items sized by grid-column/grid-row spans */
.wpg-type-custom-grid .wpg-items {
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 80px;
}

.wpg-type-custom-grid .wpg-item {
  /* Override aspect-ratio for custom grid — size comes from grid spans */
  aspect-ratio: unset !important;
}

.wpg-type-custom-grid .wpg-item .wpg-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Grid type — uniform sizing */
.wpg-type-grid .wpg-item-img {
  height: 100%;
  object-fit: cover;
}

/* Creative gallery overrides — flex layout set by JS */
.wpg-type-creative-gallery .wpg-items {
  display: flex;
  flex-wrap: wrap;
}

.wpg-type-creative-gallery .wpg-item {
  flex: 0 0 auto;
}

.wpg-type-creative-gallery .wpg-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* PhotoSwipe caption */
.wpg-pswp-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.wpg-pswp-desc {
  font-size: 14px;
  opacity: 0.85;
}
.pswp .wpg-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  color: #fff;
  text-align: center;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
}

/* PhotoSwipe panorama play button — centered below the photo, above caption */
.pswp .pswp__button--wpg-panorama-play {
  position: absolute;
  bottom: 80px;
  left: 50%;
  margin: 0;
  padding: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  z-index: 1050;
  transform: translateX(-50%);
  transition: background 0.15s ease, transform 0.15s ease;
}
.pswp .pswp__button--wpg-panorama-play:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: translateX(-50%) scale(1.08);
}
.pswp .pswp__button--wpg-panorama-play svg {
  display: block;
}
@media (max-width: 768px) {
  .pswp .pswp__button--wpg-panorama-play {
    bottom: 100px;
  }
}

/* Mobile: hide arrows (swipe gestures handle navigation) and let
   the photo fill full width. Caption is still visible at the bottom. */
@media (max-width: 768px) {
  .pswp__button--arrow {
    display: none !important;
  }
}

/* Alignment */
.wpg-halign-left .wpg-item-img { object-position: left center; }
.wpg-halign-right .wpg-item-img { object-position: right center; }
.wpg-valign-top .wpg-item-img { object-position: center top; }
.wpg-valign-bottom .wpg-item-img { object-position: center bottom; }
