/* МОДАЛЬНЫЕ ОКНА */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  overflow-y: auto;
  padding: 20px;
  background-color: color-mix(in srgb, var(--primary) 50%, transparent);
}

.modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

body:has(.modal.open) {
  overflow: hidden;
}

.modal__box {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: auto;
}

.modal__close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 1;
  display: flex;
  cursor: pointer;
  color: var(--text-primary);
}

.modal__close:hover {
  opacity: 0.7;
}

.form--modal .form__title {
  padding-right: 40px;
}

/* ---- Просмотр изображения ---- */

.modal__box--lightbox {
  max-width: 900px;
  padding: 48px 20px 20px;
  background-color: var(--white);
  text-align: center;
}

.lightbox__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
  margin: 0 auto;
}

.lightbox__caption {
  margin-top: 16px;
  line-height: 1.4;
  color: var(--text-primary);
}

.lightbox__caption:empty {
  display: none;
}

/* ============================================
   МОБАЙЛ ≤ 768px
   ============================================ */

@media (max-width: 768px) {
  .modal {
    padding: 10px;
  }

  .modal__close {
    top: 20px;
    right: 20px;
  }
}
