/* Popup gallery overlay and controls */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms ease, visibility 250ms ease;
}

.popup-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  position: relative;
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.popup-image {
  width: auto;
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  object-fit: contain;
}

.popup-caption {
  margin-top: 12px;
  color: #f5f5f5;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  max-width: 100%;
}

.popup-counter {
  margin-top: 6px;
  color: #bdbdbd;
  font-size: 0.85rem;
}

.popup-close,
.popup-prev,
.popup-next {
  position: absolute;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 180ms ease, transform 180ms ease;
}

.popup-close:hover,
.popup-prev:hover,
.popup-next:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.popup-close {
  top: 20px;
  right: 20px;
  font-size: 22px;
}

.popup-prev,
.popup-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
}

.popup-prev {
  left: 24px;
}

.popup-next {
  right: 24px;
}

.popup-overlay.hidden {
  display: none;
}

.popup-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.popup-caption,
.popup-counter {
  max-width: 920px;
  word-break: break-word;
}

.popup-overlay .popup-content {
  width: 100%;
}

@media (max-width: 768px) {
  .popup-close,
  .popup-prev,
  .popup-next {
    padding: 8px 10px;
    font-size: 20px;
  }

  .popup-caption {
    font-size: 0.9rem;
    padding: 0 10px;
  }
}

/* Optional helper classes for image triggers */
.popup-trigger,
.popup-item,
[data-popup="gallery"] {
  cursor: pointer;
}
