/* General site styling (keep or add other site styles above this if needed) */

/* ========== Popup Styles (FINAL CORRECTED VERSION) ========== */

/* Fullscreen popup overlay */
.popup {
  /* Hides it by default, BUT the next 'display: flex' immediately overrides it, 
     which is how your original code made it visible on load. We keep this
     behavior to ensure the pop-up appears. */
  display: none; 
  
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;

  /* This is the line that makes the pop-up visible and enables centering */
  display: flex; 
  justify-content: center;
  align-items: center;

  /* FIX for clipping: Allows the entire screen to scroll if content is too tall */
  overflow: auto; 
  padding: 20px;
  box-sizing: border-box;
}

/* Popup content wrapper */
.popup-content {
  position: relative;
  max-width: 100%;
  
  /* RE-ADDED CONSTRAINT: Crucial for vertical sizing and keeping the image visible */
  max-height: 100vh;
  overflow: visible;

  /* Ensures the image inside is centered */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Popup image */
.popup-content img {
  max-width: 100%;
  max-height: 100%; 
  object-fit: contain;
  display: block;
}

/* Override for tall images */
.popup-content img.tall {
  width: auto;
  height: 100%;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 30px;
  color: white;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 2;
}

/* Small screen fallback for very short viewports - kept for safety */
@media (max-height: 500px) {
  .popup {
    align-items: flex-start;
    padding-top: 40px;
  }
}