/* ==========================================================
   ВОДА&ЕДА — POP-UP V2.0
   Стили рекламного окна
   ========================================================== */


/* ==========================================================
   01. СКРЫТЫЕ ЭЛЕМЕНТЫ
   ========================================================== */

#vep-site-overlay[hidden],
.vep-site-toolbar[hidden],
#vep-site-overlay [hidden] {
  display: none !important;
}

#vep-site-overlay,
#vep-site-overlay *,
#vep-site-overlay *::before,
#vep-site-overlay *::after {
  box-sizing: border-box;
}


/* ==========================================================
   02. ЗАТЕМНЕНИЕ СТРАНИЦЫ
   ========================================================== */

#vep-site-overlay.vep-site-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;
  padding: 16px;

  background: rgba(25, 22, 19, 0.65);

  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}


/* ==========================================================
   03. РЕКЛАМНОЕ ОКНО
   ========================================================== */

#vep-site-overlay .vep-site-modal {
  position: relative;

  display: grid;
  grid-template-columns: 43% minmax(0, 57%);

  width: min(900px, 100%);

  height: min(480px, calc(100vh - 32px));
  height: min(480px, calc(100dvh - 32px));

  min-width: 0;
  min-height: 0;

  padding: 0;
  margin: 0;

  overflow: hidden;

  border: none;
  border-radius: 28px;

  background: #f8f4ec;
  color: #30281f;

  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);

  font-family: Montserrat, Arial, sans-serif;
}


/* ==========================================================
   04. ИЗОБРАЖЕНИЕ
   ========================================================== */

#vep-site-overlay .vep-site-media {
  position: relative;

  min-width: 0;
  min-height: 0;

  overflow: hidden;

  background: #e9dfd0;
}

#vep-site-overlay .vep-site-image {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;
}

#vep-site-overlay .vep-site-image img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  border: none;
}


/* ==========================================================
   05. ЗАГЛУШКА ПРИ ОТСУТСТВИИ ИЗОБРАЖЕНИЯ
   ========================================================== */

#vep-site-overlay .vep-site-placeholder {
  display: flex;

  width: 100%;
  height: 100%;

  align-items: center;
  justify-content: center;

  padding: 20px;

  color: #6a523e;

  text-align: center;
  font: 40px/1.2 Georgia, serif;
}


/* ==========================================================
   06. ТЕКСТОВАЯ ЧАСТЬ
   ========================================================== */

#vep-site-overlay .vep-site-content {
  display: flex;
  flex-direction: column;

  justify-content: center;
  justify-content: safe center;

  min-width: 0;
  min-height: 0;

  height: 100%;

  padding: 48px 44px;

  overflow-x: hidden;
  overflow-y: auto;

  scrollbar-width: thin;
  scrollbar-color: #d2c4b3 transparent;

  overscroll-behavior: contain;
}

#vep-site-overlay .vep-site-title {
  margin: 0 0 20px;
  padding: 0;

  color: #30281f;

  font-family: Georgia, serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 500;
  line-height: 1.15;

  letter-spacing: -0.5px;

  overflow-wrap: anywhere;
}

#vep-site-overlay .vep-site-description {
  margin: 0 0 28px;
  padding: 0;

  color: #645b51;

  font-family: Montserrat, Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;

  white-space: pre-line;
  overflow-wrap: anywhere;
}


/* ==========================================================
   07. КНОПКИ РЕКЛАМНОГО ОКНА
   ========================================================== */

#vep-site-overlay .vep-site-actions {
  display: flex;
  flex-direction: column;

  align-items: flex-start;

  flex-shrink: 0;

  gap: 10px;
}

#vep-site-overlay .vep-site-action {
  display: inline-flex;

  align-items: center;
  justify-content: center;
  align-self: flex-start;

  min-height: 48px;
  max-width: 100%;

  margin: 0;
  padding: 12px 26px;

  border: none;
  border-radius: 14px;

  background: #51402f;
  color: #ffffff !important;

  font-family: Montserrat, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;

  text-align: center;
  text-decoration: none !important;

  overflow-wrap: anywhere;

  cursor: pointer;

  transition: background 0.2s ease;
}

#vep-site-overlay .vep-site-action:hover {
  background: #392b20;
}


/* Дополнительная кнопка */

#vep-site-overlay .vep-site-action-secondary {
  background: transparent;

  border: 1px solid #51402f;

  color: #51402f !important;
}

#vep-site-overlay .vep-site-action-secondary:hover {
  background: #ebe1d4;
}


/* Состояние недоступной кнопки */

#vep-site-overlay .vep-site-action.is-disabled {
  opacity: 0.45;

  pointer-events: none;
  cursor: not-allowed;
}


/* ==========================================================
   08. QR-КОДЫ В РЕКЛАМНОМ ОКНЕ
   ========================================================== */

#vep-site-stores {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  align-items: start;

  gap: 16px;

  width: 100%;
  max-width: 320px;

  flex-shrink: 0;
}

#vep-site-stores .ve-app-store {
  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: 8px;

  min-width: 0;

  color: #51402f !important;

  font-family: Montserrat, Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;

  text-align: center;
  text-decoration: none !important;
}

#vep-site-stores .ve-app-store img {
  display: block;

  width: 100%;
  max-width: 148px;
  height: auto;

  aspect-ratio: 1;

  padding: 8px;

  border: none;
  border-radius: 10px;

  background: #ffffff;

  object-fit: contain;
}

#vep-site-stores .ve-app-store span {
  padding: 6px 0;
}

#vep-site-stores .ve-app-store:hover span {
  text-decoration: underline;
}


/* ==========================================================
   09. КНОПКА ЗАКРЫТИЯ
   ========================================================== */

#vep-site-overlay .vep-site-close {
  position: absolute;

  top: 14px;
  right: 14px;
  left: auto;

  z-index: 5;

  display: flex;

  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;

  margin: 0;
  padding: 0;

  border: 1px solid rgba(70, 55, 42, 0.1);
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.96);
  color: #30281f;

  font: 26px/1 Arial, sans-serif;

  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);

  cursor: pointer;

  transition: background 0.2s ease;
}

#vep-site-overlay .vep-site-close:hover {
  background: #ebe1d4;
}

#vep-site-overlay .vep-site-close:focus-visible,
#vep-site-overlay .vep-site-action:focus-visible,
#vep-site-stores .ve-app-store:focus-visible {
  outline: 2px solid #b68e61;
  outline-offset: 3px;
}


/* ==========================================================
   10. ПАНЕЛЬ ЗАКРЫТОГО ПРЕДПРОСМОТРА

   Отображается только при открытии специальной
   ссылки авторизованным редактором.
   ========================================================== */

.vep-site-toolbar {
  position: fixed;

  left: 16px;
  bottom: 16px;

  z-index: 2147483001;

  display: flex;
  flex-wrap: wrap;

  align-items: center;

  gap: 12px;

  max-width: calc(100vw - 32px);

  padding: 12px 16px;

  border-radius: 12px;

  background: #29251f;
  color: #ffffff;

  font: 12px/1.5 Arial, sans-serif;

  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

.vep-site-toolbar button {
  padding: 7px 12px;

  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;

  background: transparent;
  color: #ffffff;

  font: inherit;

  cursor: pointer;
}


/* ==========================================================
   11. ПЛАНШЕТЫ
   ========================================================== */

@media (min-width: 768px) and (max-width: 900px) {

  #vep-site-overlay .vep-site-modal {
    grid-template-columns: 42% minmax(0, 58%);
  }

  #vep-site-overlay .vep-site-content {
    padding: 36px 28px;
  }

  #vep-site-overlay .vep-site-title {
    font-size: 31px;
  }
}


/* ==========================================================
   12. МОБИЛЬНАЯ ВЕРСИЯ

   Рекламное окно располагается внизу экрана.
   Высота определяется количеством содержимого.

   Минимальная высота: 160 px.
   Максимальная высота: треть доступного экрана.

   При большом количестве текста используется
   внутренняя прокрутка.
   ========================================================== */

@media (max-width: 767px) {

  /* Расположение рекламного окна */

  #vep-site-overlay.vep-site-overlay {
    align-items: flex-end;
    justify-content: center;

    padding: 0;
  }


  /* Основное рекламное окно */

  #vep-site-overlay .vep-site-modal {

    /* Единые параметры высоты мобильного окна */

    --vep-mobile-max-height: 33.333vh;
    --vep-mobile-min-height: 160px;

    position: relative;

    display: block;

    width: 100%;
    max-width: none;

    height: auto;

    min-height: min(
      var(--vep-mobile-min-height),
      var(--vep-mobile-max-height)
    );

    max-height: var(--vep-mobile-max-height);

    border-radius: 22px 22px 0 0;

    overflow: hidden;
  }


  /* Учитываем фактическую высоту мобильного браузера */

  @supports (height: 100dvh) {

    #vep-site-overlay .vep-site-modal {
      --vep-mobile-max-height: 33.333dvh;
    }
  }


  /* Изображение не участвует в расчёте высоты окна */

  #vep-site-overlay .vep-site-media {
    position: absolute;

    top: 0;
    bottom: 0;
    left: 0;

    width: 38%;
    height: auto;

    min-height: 0;

    overflow: hidden;
  }


  /* Заглушка при отсутствии изображения */

  #vep-site-overlay .vep-site-placeholder {
    position: absolute;
    inset: 0;

    padding: 8px;

    font-size: 22px;
  }


  /* Текстовая часть определяет высоту окна */

  #vep-site-overlay .vep-site-content {
    position: relative;

    align-items: stretch;
    justify-content: flex-start;

    gap: 15px;

    width: 62%;
    margin-left: 38%;

    height: auto;

    min-height: 0;
    max-height: var(--vep-mobile-max-height);

    padding:
      42px
      14px
      max(12px, env(safe-area-inset-bottom));

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior: contain;
  }


  /* Заголовок */

  #vep-site-overlay .vep-site-title {
    margin: 0;

    font-size: clamp(19px, calc(4.8vw + 2px), 25px);
    line-height: 1.15;

    flex-shrink: 0;
  }


  /* Описание */

  #vep-site-overlay .vep-site-description {
    display: block;

    margin: 0;

    font-size: 13px;
    line-height: 1.4;

    overflow: visible;

    flex-shrink: 0;
  }


  /* Контейнер кнопок */

  #vep-site-overlay .vep-site-actions {
    align-items: stretch;

    gap: 6px;
  }


  /* Основная и дополнительная кнопки */

  #vep-site-overlay .vep-site-action {
    align-self: stretch;

    width: 100%;
    min-height: 38px;

    padding: 6px 10px;

    font-size: 13px;
    line-height: 1.3;

    flex-shrink: 0;
  }


  /* Кнопка закрытия */

  #vep-site-overlay .vep-site-close {
    top: 8px;
    right: 8px;
    left: auto;

    width: 34px;
    height: 34px;
  }


  /* Магазины приложений */

  #vep-site-stores {
    gap: 8px;
  }

  #vep-site-stores .ve-app-store {
    font-size: 13px;
  }

  #vep-site-stores .ve-app-store img {
    max-width: 90px;

    padding: 4px;
  }
}


/* ==========================================================
   13. МАЛЕНЬКИЕ И НИЗКИЕ ЭКРАНЫ

   Уменьшаем отступы, сохраняя читаемость текста.
   ========================================================== */

@media (max-width: 320px),
       (max-width: 767px) and (max-height: 540px) {

  /* Минимальная высота для компактных экранов */

  #vep-site-overlay .vep-site-modal {
    --vep-mobile-min-height: 150px;
  }


  /* Компактные отступы текстовой части */

  #vep-site-overlay .vep-site-content {
    padding-right: 10px;
    padding-left: 10px;

    gap: 6px;
  }


  /* Заголовок */

  #vep-site-overlay .vep-site-title {
    font-size: 18px;
  }


  /* Описание */

  #vep-site-overlay .vep-site-description {
    font-size: 12px;
  }


  /* Контейнер кнопок */

  #vep-site-overlay .vep-site-actions {
    gap: 4px;
  }


  /* Кнопки */

  #vep-site-overlay .vep-site-action {
    min-height: 32px;

    font-size: 12px;
  }
}


/* Очень узкие экраны */

@media (max-width: 280px) {

  #vep-site-overlay .vep-site-action {
    border-radius: 10px;
  }

  #vep-site-overlay .vep-site-close {
    font-size: 22px;
  }

  .vep-site-toolbar {
    left: 7px;
    bottom: 7px;

    max-width: calc(100vw - 14px);

    gap: 6px;

    padding: 8px;

    font-size: 11px;
  }
}


/* ==========================================================
   14. УМЕНЬШЕНИЕ АНИМАЦИИ
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

  #vep-site-overlay .vep-site-action,
  #vep-site-overlay .vep-site-close {
    transition: none;
  }
}


/* ==========================================================
   КОНЕЦ ФАЙЛА
   ========================================================== */