/* Всплывающие окна сайта (theme/popup.php, assets/js/popup.js).
   Тот же файл подключает предпросмотр в админке — что видно там, то и на сайте. */

.pp {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--font, 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif);
  color: #282828;
}
.pp[hidden] { display: none; }

.pp__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 28, 28, .45);
  opacity: 0;
  transition: opacity .35s ease;
}

.pp__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 60px rgba(28, 28, 28, .18);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2, .7, .2, 1);
}
.pp__dialog:focus { outline: none; }

.pp.is-open .pp__backdrop { opacity: 1; }
.pp.is-open .pp__dialog { opacity: 1; transform: none; }

/* Фото слева/справа — окно шире, текст рядом */
.pp--left .pp__dialog,
.pp--right .pp__dialog { max-width: 780px; flex-direction: row; }
.pp--right .pp__dialog { flex-direction: row-reverse; }

.pp__media { flex: 0 0 auto; background: #f7f6f4; overflow: hidden; }
.pp__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pp--top .pp__media { max-height: 300px; }
.pp--top .pp__img { max-height: 300px; }
.pp--left .pp__media,
.pp--right .pp__media { width: 44%; min-height: 380px; }

.pp__body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 40px 44px 42px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pp--left .pp__body,
.pp--right .pp__body { align-self: center; }

.pp__title {
  margin: 0 0 14px;
  padding-right: 18px;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.25;
  color: #1c1c1c;
  letter-spacing: 0;
  text-transform: none;
}

.pp__text { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.pp__text > :first-child { margin-top: 0; }
.pp__text > :last-child { margin-bottom: 0; }
.pp__text p { margin: 0 0 .8em; }
.pp__text h3 { margin: 1.1em 0 .5em; font-size: 20px; font-weight: 500; line-height: 1.3; color: #1c1c1c; }
.pp__text ul,
.pp__text ol { margin: 0 0 .8em; padding-left: 1.3em; }
.pp__text ul { list-style: disc; }
.pp__text ol { list-style: decimal; }
.pp__text li { margin: .2em 0; }
.pp__text a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.pp__text a:hover { color: #767676; }

/* Кнопки, вставленные в текст */
.pp__text .pp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: .5em 0 0;
  padding: 0 32px;
  border: 1px solid #ada3a0;
  background: #ada3a0;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}
.pp__text .pp-btn:hover { background: #9e9591; border-color: #9e9591; color: #fff; }
.pp__text .pp-btn--outline { background: transparent; border-color: #1c1c1c; color: #1c1c1c; }
.pp__text .pp-btn--outline:hover { background: #1c1c1c; border-color: #1c1c1c; color: #fff; }

/* ---------- Форма в окне ---------- */
.pp-form { display: grid; gap: 12px; margin-top: 22px; }
.pp-form[hidden],
.pp__text[hidden] { display: none; }
.pp-field { display: grid; gap: 6px; margin: 0; }
.pp-field__label { font-size: 13px; color: #767676; }
.pp-field__label i { font-style: normal; color: #a14a3b; }
.pp-field__input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #d9d6d3;
  border-radius: 0;
  background: #fff;
  color: #1c1c1c;
  font: inherit;
  font-size: 16px; /* меньше 16px — iPhone увеличивает страницу при вводе */
  transition: border-color .2s ease;
}
.pp-field__input:focus { outline: none; border-color: #1c1c1c; }
.pp-field__input.is-invalid,
.pp-check input.is-invalid + span { border-color: #a14a3b; color: #a14a3b; }
.pp-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pp-check { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: #767676; cursor: pointer; }
.pp-check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 1px 0 0; accent-color: #1c1c1c; }
.pp-check a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pp-form__error { margin: 0; font-size: 14px; color: #a14a3b; }
.pp-form__error[hidden] { display: none; }

/* Кнопки формы и экрана «готово» — как основная кнопка сайта */
.pp-form__submit,
.pp-done__go {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  padding: 0 24px;
  border: 1px solid #ada3a0;
  background: #ada3a0;
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .3s ease, border-color .3s ease;
}
.pp-form__submit:hover,
.pp-done__go:hover { background: #9e9591; border-color: #9e9591; color: #fff; }
.pp-form__submit:disabled { opacity: .6; cursor: progress; }

.pp-done { margin-top: 6px; }
.pp-done[hidden] { display: none; }
.pp-done__title { margin: 0 0 14px; font-size: 20px; color: #1c1c1c; }
.pp-code {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 18px;
  border: 1px dashed #ada3a0;
  background: #faf8f7;
}
.pp-code[hidden] { display: none; }
.pp-code__value { flex: 1 1 auto; font-size: 22px; font-weight: 500; letter-spacing: .08em; color: #1c1c1c; overflow-wrap: anywhere; }
.pp-code__copy {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #1c1c1c;
  background: transparent;
  color: #1c1c1c;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.pp-code__copy:hover { background: #1c1c1c; color: #fff; }
.pp-done__offer { margin: 12px 0 0; font-size: 15px; color: #1c1c1c; }
.pp-done__offer:empty { display: none; }
.pp-done__text { margin: 8px 0 18px; font-size: 14px; color: #767676; }

.pp__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  color: #1c1c1c;
  cursor: pointer;
  transition: background-color .2s ease;
}
.pp__close:hover { background: #f1eeec; }
.pp__close:focus-visible { outline: 2px solid #1c1c1c; outline-offset: 2px; }
.pp__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }

html.pp-lock { overflow: hidden; }

/* Телефон: окно выезжает снизу, фото всегда сверху */
@media (max-width: 767px) {
  .pp { align-items: flex-end; padding: 0; }
  .pp__dialog,
  .pp--left .pp__dialog,
  .pp--right .pp__dialog {
    flex-direction: column;
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    transform: translateY(100%);
  }
  .pp.is-open .pp__dialog { transform: none; }
  .pp__media,
  .pp--left .pp__media,
  .pp--right .pp__media { width: auto; min-height: 0; max-height: 38vh; max-height: 38dvh; }
  .pp__img,
  .pp--top .pp__img { max-height: 38vh; max-height: 38dvh; }
  .pp__body { padding: 28px 20px calc(28px + env(safe-area-inset-bottom)); }
  .pp--left .pp__body,
  .pp--right .pp__body { align-self: stretch; }
  .pp__title { font-size: 24px; }
  .pp__text .pp-btn { display: flex; width: 100%; }
  /* С формой фото поменьше — полям нужно место */
  .pp:has(.pp-form) .pp__media,
  .pp:has(.pp-form) .pp__img { max-height: 24vh; max-height: 24dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .pp__backdrop, .pp__dialog { transition: none; }
}
