/* Поп-ап заказа/предзаказа на один товар. Тот же вид, что в каталоге, только все
   правила ограничены классом .offer-modal, чтобы файл можно было подключить рядом
   с bootstrap на странице товара: там класс .modal занят бутстраповскими окнами.
   Токены объявлены на самой модалке — файл ни от чего не зависит.
   Если правишь вид поп-апа, правь и блок модалки в catalog.css. */

.offer-modal {
  --modal-bg: #f4f2ed;
  --modal-text: #404040;
  --modal-text-soft: #4a4a4a;
  --modal-required: red;
  --modal-muted: #737373;
  --modal-line: #cccccc;
  --modal-field-bg: #e2e2e2;

  --radius-card: 10px;
  --radius-control: 6px;
  --shadow-card: 0 6px 12px rgba(0, 0, 0, 0.32);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --fs-h2: clamp(20px, calc(18.3425px + 0.442vw), 24px);
  --lh-h2: clamp(26px, calc(25.1713px + 0.221vw), 28px);
  --fs-caption: clamp(10px, calc(9.5856px + 0.1105vw), 11px);
  --lh-caption: clamp(14px, calc(13.5856px + 0.1105vw), 15px);
  --fs-price: 14px;
  --fs-button: clamp(13px, calc(14.4144px + -0.1105vw), 14px);
  --lh-button: clamp(16px, calc(18.8287px + -0.221vw), 18px);

  /* счётчик количества берёт эти токены из базовых стилей карточек */
  --white: #ffffff;
  --white-30: rgba(255, 255, 255, 0.3);
  --ctl-h: clamp(32px, calc(30.3425px + 0.442vw), 36px);
}

@media (min-width: 1280px) {
  .offer-modal {
    --ctl-h: clamp(36px, calc(20px + 1.25vw), 40px);
    --fs-h2: clamp(24px, calc(8px + 1.25vw), 28px);
    --lh-h2: clamp(28px, calc(-4px + 2.5vw), 36px);
    --fs-caption: clamp(11px, calc(3px + 0.625vw), 13px);
    --lh-caption: clamp(15px, calc(7px + 0.625vw), 17px);
    --fs-price: clamp(14px, calc(6px + 0.625vw), 16px);
    --fs-button: clamp(13px, calc(5px + 0.625vw), 15px);
    --lh-button: clamp(16px, calc(0px + 1.25vw), 20px);
  }
}

@media (min-width: 1600px) {
  .offer-modal {
    --ctl-h: clamp(40px, calc(20px + 1.25vw), 44px);
    --fs-h2: clamp(28px, calc(8px + 1.25vw), 32px);
    --lh-h2: clamp(36px, calc(16px + 1.25vw), 40px);
    --fs-caption: clamp(13px, calc(8px + 0.3125vw), 14px);
    --lh-caption: clamp(17px, calc(2px + 0.9375vw), 20px);
    --fs-price: clamp(16px, calc(6px + 0.625vw), 18px);
    --fs-button: clamp(15px, calc(10px + 0.3125vw), 16px);
    --lh-button: 20px;
  }
}

@media (min-width: 1920px) {
  .offer-modal {
    --ctl-h: 44px;
    --fs-h2: 32px; --lh-h2: 40px;
    --fs-caption: 14px; --lh-caption: 20px;
    --fs-price: 18px;
    --fs-button: 16px; --lh-button: 20px;
  }
}

.offer-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), visibility 0.22s;
}

.offer-modal.is-open { opacity: 1; visibility: visible; }

.offer-modal .modal__dialog {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 48px);
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--modal-bg);
  box-shadow: var(--shadow-card);
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.22s var(--ease);
}

.offer-modal.is-open .modal__dialog { transform: none; }

.offer-modal .modal__title {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  font-weight: 600;
  color: var(--modal-text);
  text-align: center;
}

.offer-modal .modal__close {
  position: absolute;
  top: 8px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--modal-text);
  cursor: pointer;
  transition: opacity 0.16s var(--ease);
}

.offer-modal .modal__close:hover { opacity: 0.6; }
.offer-modal .modal__close .icon-mask { width: 16px; height: 16px; background-color: var(--modal-text); }

.offer-modal .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.offer-modal .field { display: flex; flex-direction: column; gap: 6px; }

.offer-modal .field__label {
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  color: var(--modal-text);
}

.offer-modal .field__label .req { color: var(--modal-required); }

.offer-modal .field input {
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: var(--modal-field-bg);
  color: var(--modal-text);
  font-family: inherit;
  font-size: var(--fs-button);
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.16s var(--ease);
}

.offer-modal .field input::placeholder { color: var(--modal-muted); }
.offer-modal .field input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--modal-text); }

.offer-modal .btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin-top: 24px;
  border: 1px solid var(--modal-text);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--modal-text);
  font-family: inherit;
  font-size: var(--fs-button);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.offer-modal .btn-submit:hover { background: var(--modal-text); color: var(--modal-bg); }

.offer-modal .policy-note {
  margin-top: 16px;
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  color: var(--modal-muted);
  text-align: center;
}

.offer-modal .policy-note a { color: var(--modal-text); text-decoration: underline; }

.offer-modal .policy-note--phone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: left;
}

.offer-modal .policy-note--phone .icon-mask {
  width: 20px;
  height: 20px;
  flex: none;
  background-color: var(--modal-muted);
  -webkit-mask-image: url("/img/icon-9.svg");
  mask-image: url("/img/icon-9.svg");
}

.offer-modal .cart-line {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--modal-line);
}

.offer-modal .cart-line__media {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 4px;
  background: var(--modal-field-bg) center / cover no-repeat;
}

.offer-modal .cart-line__name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-button);
  line-height: var(--lh-button);
  color: var(--modal-text-soft);
  overflow-wrap: break-word;
}

.offer-modal .cart-line__price {
  flex: 0 0 96px;
  text-align: right;
  font-size: var(--fs-price);
  font-weight: 600;
  color: var(--modal-text-soft);
  white-space: nowrap;
}

.offer-modal .cart-line .qty {
  flex: 0 0 120px;
  gap: 0;
}

/* предзаказ: вместо счётчика — фиксированная единица, бокс тот же */
.offer-modal .cart-line .cart-line__count {
  flex: 0 0 120px;
  text-align: center;
  font-size: var(--fs-price);
  color: var(--modal-text-soft);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .offer-modal .cart-line .cart-line__count { flex-basis: 92px; font-size: 13px; }
}

.offer-modal .cart-line .qty > * { flex: 1 1 0; min-width: 0; }
.offer-modal .cart-line .qty__btn { width: auto; }

@media (max-width: 480px) {
  .offer-modal .cart-line { gap: 8px; }
  .offer-modal .cart-line__media { width: 36px; height: 36px; }
  .offer-modal .cart-line .qty { flex-basis: 92px; }
  .offer-modal .cart-line__price { flex-basis: 68px; font-size: 13px; }
}

.offer-modal .qty {
  border-color: var(--modal-text);
}

.offer-modal .qty__btn { color: var(--modal-text); }
.offer-modal .qty__btn::before,
.offer-modal .qty__btn::after { background: var(--modal-text); }
.offer-modal .qty__btn--minus { border-right-color: var(--modal-text); }
.offer-modal .qty__btn--plus { border-left-color: var(--modal-text); }
.offer-modal .qty__value { color: var(--modal-text); }
.offer-modal .qty__btn:disabled { color: var(--modal-line); }
.offer-modal .qty__btn:disabled::before,
.offer-modal .qty__btn:disabled::after { background: var(--modal-line); }

@media (hover: hover) {
  .offer-modal .qty__btn:hover:not(:disabled) { background: rgba(0, 0, 0, 0.08); }
}
.offer-modal .qty__btn:not(:disabled):active { background: rgba(0, 0, 0, 0.14); }

.offer-modal .field input.error-input {
  border-color: #ff6b6b;
}

/* Окно «Спасибо за заказ» — тот же дом, что у формы */
.offer-modal .confirm-order-caption { margin-top: 12px; }

/* Иконки внутри поп-апа — чтобы файл не зависел от стилей конкретной страницы */
.offer-modal .icon-mask {
  display: block;
  flex: none;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center;  mask-position: center;
  -webkit-mask-size: contain;     mask-size: contain;
}
.offer-modal .icon-phone { -webkit-mask-image: url("/img/phone-gray-icon.svg"); mask-image: url("/img/phone-gray-icon.svg"); }
.offer-modal .icon-close { -webkit-mask-image: url("/img/close-icon.svg");      mask-image: url("/img/close-icon.svg"); }

/* Прокрутка страницы под открытым поп-апом */
body.is-locked { overflow: hidden; }
