.img-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.img-modal.is-open {
  display: flex;
  opacity: 1;
}
.img-modal__overlay {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
}
.img-modal__content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  z-index: 1;
  padding: 8px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.img-modal__img {
  display: block;
  max-width: 100%;
  max-height: calc(95vh - 16px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.img-modal__close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.2s ease,
    background 0.2s ease;
  font-family: Arial, sans-serif;
}
.img-modal__close:hover {
  background: #f2f2f2;
  transform: rotate(90deg);
}
.img-modal__close:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* Индикатор "увеличения" на кликабельных картинках */
.entry-content img,
article img {
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}
.entry-content img:hover,
article img:hover {
  opacity: 0.92;
}

/* Класс блокировки прокрутки (стили выставляются из JS, но класс оставлен
       на случай если тема делает что-то своё с body в это время) */
body.img-modal-open {
  touch-action: none;
}

/* Мобильные устройства */
@media (max-width: 600px) {
  .img-modal__close {
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    font-size: 20px;
  }
  .img-modal__content {
    padding: 4px;
  }
}
