/* Todo el CSS queda aislado bajo el prefijo pip-popup. */
#pip-popup-overlay.pip-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.76);
  overflow: auto;
  animation: pip-popup-appear 180ms ease-out both;
}

#pip-popup-overlay .pip-popup-dialog {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: max-content;
  max-width: min(100%, 880px);
  max-height: 100%;
  margin: auto;
  border: 0;
  background: transparent;
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.32);
}

#pip-popup-overlay .pip-popup-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  object-fit: contain;
  border: 0;
  border-radius: 4px;
}

#pip-popup-overlay .pip-popup-close {
  position: absolute;
  z-index: 1;
  top: -17px;
  right: -17px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #1b1b1b;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 31px;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  opacity: 1;
  appearance: none;
  -webkit-appearance: none;
  transition: background 150ms ease;
}

#pip-popup-overlay .pip-popup-close:hover,
#pip-popup-overlay .pip-popup-close:focus-visible {
  background: #444;
  color: #fff;
}

#pip-popup-overlay .pip-popup-close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@keyframes pip-popup-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 600px) {
  #pip-popup-overlay.pip-popup-overlay {
    padding: 20px;
  }

  #pip-popup-overlay .pip-popup-image {
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
  }

  #pip-popup-overlay .pip-popup-close {
    top: -16px;
    right: -16px;
    width: 42px;
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #pip-popup-overlay.pip-popup-overlay {
    animation: none;
  }

  #pip-popup-overlay .pip-popup-close {
    transition: none;
  }
}
