/* =============================================================================
   Lifter Image Popups — Frontend CSS
   Hardened for cross-theme compatibility (Astra, WPBakery, Divi, etc.)
   ============================================================================= */

/* ── Popup wrapper ─────────────────────────────────────────────────────────── */
/* Covers entire viewport. Sits above everything via max z-index.
   pointer-events: none so the wrapper itself doesn't eat clicks — only
   the overlay and box do. */

.lifter-popup {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483647 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  pointer-events: none !important;

  /* Fade in/out transition */
  opacity: 1;
  transition: opacity 0.2s ease;
}

.lifter-popup--hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  /* Keep display:flex so transition plays, visibility collapses interaction */
  visibility: hidden !important;
}

/* ── Overlay ───────────────────────────────────────────────────────────────── */
/* Blocks ALL interaction behind popup. CRITICAL: pointer-events: auto */

.lifter-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.68) !important;
  z-index: 0 !important;
  pointer-events: auto !important;
  cursor: pointer;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* ── Popup box ─────────────────────────────────────────────────────────────── */

.lifter-box {
  position: relative !important;
  z-index: 1 !important;
  pointer-events: auto !important;

  background: #fff;
  width: 920px;
  max-width: 94vw;
  border-radius: 14px;
  overflow: hidden;

  /* Scroll within box on small screens */
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;

  /* Entry animation */
  animation: lifterSlideIn 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) both;

  /* Thin scrollbar on webkit */
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.lifter-box::-webkit-scrollbar        { width: 5px; }
.lifter-box::-webkit-scrollbar-track  { background: transparent; }
.lifter-box::-webkit-scrollbar-thumb  { background: rgba(0,0,0,0.2); border-radius: 3px; }

/* ── Content area ─────────────────────────────────────────────────────────── */

.lifter-content {
  display: block;
  line-height: 0; /* collapse whitespace under inline images */
}

/* ── Image content type ───────────────────────────────────────────────────── */

.lifter-content img {
  width: 100% !important;
  height: auto !important;
  display: block !important;
  max-width: 100% !important;
  /* Support any dimension — portrait, landscape, square */
  object-fit: contain;
}

.lifter-image-link {
  display: block;
  line-height: 0;
}

.lifter-image-link:hover img {
  opacity: 0.93;
  transition: opacity 0.15s ease;
}

/* ── Close button ─────────────────────────────────────────────────────────── */
/* Hard reset — themes cannot shift or override this */

.lifter-close {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 2 !important;

  /* Size */
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  margin: 0 !important;

  /* Layout */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  /* Style */
  background: rgba(0, 0, 0, 0.4) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  line-height: 1 !important;
  font-size: 0 !important; /* SVG only — no text baseline shift issues */

  /* Hover */
  transition: background 0.15s ease, transform 0.15s ease !important;
}

.lifter-close:hover,
.lifter-close:focus {
  background: rgba(0, 0, 0, 0.65) !important;
  transform: scale(1.08) !important;
  outline: 2px solid rgba(255,255,255,0.6) !important;
  outline-offset: 2px !important;
}

.lifter-close svg {
  display: block;
  flex-shrink: 0;
}

/* ── Body scroll lock ─────────────────────────────────────────────────────── */

body.lifter-popup-open {
  overflow: hidden !important;
}

/* ── Entry animation ─────────────────────────────────────────────────────── */

@keyframes lifterSlideIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .lifter-box {
    width: 96vw;
    max-height: 88vh;
    border-radius: 10px;
  }
  .lifter-close {
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
  }
}
