.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.popup-content {
  position: relative;
  max-width: 50%;
  max-height: 50%;
}

.popup-image {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* This is the key: make sure the X can always be clicked */

.popup-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #000;
  color: #fff;
  font-size: 24px;
  line-height: 36px;
  cursor: pointer;
  z-index: 100000;
  pointer-events: auto;
}

/* Also ensure the link/image cannot “steal” the click above the X */

.popup-content a, .popup-content img {
  position: relative;
  z-index: 1;
}

