.ks-popup {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.ks-popup[hidden] {
  display: none;
}

.ks-popup--visible {
  opacity: 1;
  visibility: visible;
}

.ks-popup__window {
  position: relative;
  width: min(560px, 92vw, calc(84vh * 0.8));
  max-height: 84vh;
  overflow: visible;
  transform: translateY(12px) scale(0.98);
  transition: transform 220ms ease;
}

.ks-popup--visible .ks-popup__window {
  transform: translateY(0) scale(1);
}

.ks-popup__image {
  display: block;
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
}

.ks-popup__close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #111a55;
  color: #ffffff;
  font: 400 32px/36px Arial, sans-serif;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.ks-popup__close:hover {
  background: #e8335c;
}

.ks-popup__close:focus-visible {
  outline: 3px solid #ffd21c;
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .ks-popup {
    padding: 18px;
  }

  .ks-popup__window {
    width: min(92vw, calc(86vh * 0.8));
    max-height: 86vh;
  }

  .ks-popup__image {
    max-height: 86vh;
    border-radius: 8px;
  }

  .ks-popup__close {
    top: -13px;
    right: -13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ks-popup,
  .ks-popup__window {
    transition: none;
  }
}
