/* ============================================================================
   ARGO · tpgargo.ru и tpgargo.com · форма «Связаться с нами» / Contact form
   ИП Карпачёв В. · 24.09.2026 · договор № 17 от 12.09.2026

   Только внешний вид. Поля, их имена, скрытые поля и обработчик (AjaxForm +
   FormIt) не тронуты. Подключается после style.css в чанке footer.

   Что здесь: сама форма в модальном окне (#modal), состояния полей — покой,
   наведение, фокус, ошибка, отправка, — кнопка и всплывающее сообщение
   AjaxForm (jGrowl), которое иначе выглядит как зелёный прямоугольник 2012 года.

   Цвета — палитра сайта: синий #017199, оранжевый #f26722. Шрифт — DINPro,
   он уже подключён в style.css.

   ОТКАТ: убрать <link> на этот файл из чанка footer и вернуть прежнюю
   разметку чанка модала (копия лежит рядом, в chunks/*.orig.html).
   ========================================================================== */

/* ── Окно ──────────────────────────────────────────────────────────────── */

/* fancybox оборачивает содержимое в свою «кожу» с серым фоном и радиусом 4px.
   :has — чтобы переопределить её только для нашего окна, не трогая галереи. */
.fancybox-skin:has(> .fancybox-outer > .fancybox-inner > :is(#modal, #order-analog, #other-analogs)) {
  background: #fff;
  border-radius: 16px;
  padding: 0 !important;
  box-shadow: 0 24px 64px -16px rgba(17, 24, 32, .45), 0 0 0 1px rgba(17, 24, 32, .06);
}

:is(#modal, #order-analog, #other-analogs) {
  --af-ink: #1c2126;
  --af-muted: #5f6a73;
  --af-line: #d7dde3;
  --af-line-hover: #aeb8c2;
  --af-blue: #017199;
  --af-blue-ring: rgba(1, 113, 153, .18);
  --af-orange: #f26722;
  --af-orange-dark: #d9560f;
  --af-error: #c8322b;
  --af-error-ring: rgba(200, 50, 43, .16);
  --af-ok: #2b8a4b;
  --af-radius: 10px;
  --af-ease: cubic-bezier(.23, 1, .32, 1);

  box-sizing: border-box;
  width: 460px;
  max-width: 100%;
  padding: 32px 36px 36px;
  color: var(--af-ink);
  font-family: 'DINPro-Light', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
:is(#modal, #order-analog, #other-analogs) *, #modal *::before, #modal *::after { box-sizing: border-box; }

/* Заголовок — свой цвет вместо ссылочного синего: синий здесь оставлен
   фокусу, чтобы глаз читал его как «где я сейчас». */
:is(#modal, #order-analog, #other-analogs) h3 {
  margin: 0 0 22px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--af-ink);
  font-family: 'DINPro-Medium', Arial, sans-serif;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-align: left;
  text-transform: none;
}

/* ── Сетка полей ───────────────────────────────────────────────────────── */

:is(#modal, #order-analog, #other-analogs) .af-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px 14px;
  margin: 0 0 22px;
}
@media (min-width: 560px) {
  :is(#modal, #order-analog, #other-analogs) .af-fields { grid-template-columns: 1fr 1fr; }
  :is(#modal, #order-analog, #other-analogs) .af-field--wide { grid-column: 1 / -1; }
}

:is(#modal, #order-analog, #other-analogs) .af-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

:is(#modal, #order-analog, #other-analogs) .af-label {
  font-family: 'DINPro-Medium', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: .01em;
  color: var(--af-muted);
}
:is(#modal, #order-analog, #other-analogs) .af-label b {
  font-weight: inherit;
  color: var(--af-orange);
  margin-left: 2px;
}

/* ── Поля ──────────────────────────────────────────────────────────────── */

/* Перебиваем правила style.css для input[type="text"] (отступы под иконку,
   внешние поля 12px, авто-outline) и правила #modal input на .com. */
:is(#modal, #order-analog, #other-analogs) input[type="text"],
:is(#modal, #order-analog, #other-analogs) input[type="tel"],
:is(#modal, #order-analog, #other-analogs) input[type="email"],
:is(#modal, #order-analog, #other-analogs) textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border: 1.5px solid var(--af-line);
  border-radius: var(--af-radius);
  background: #fff;
  color: var(--af-ink);
  font: inherit;
  font-size: 16px;            /* меньше 16px iOS увеличивает страницу при фокусе */
  line-height: 22px;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .16s var(--af-ease), box-shadow .16s var(--af-ease);
}
:is(#modal, #order-analog, #other-analogs) textarea {
  min-height: 112px;
  height: auto;
  resize: vertical;
}
:is(#modal, #order-analog, #other-analogs) input::placeholder,
:is(#modal, #order-analog, #other-analogs) textarea::placeholder { color: #9aa4ad; opacity: 1; }

@media (hover: hover) {
  :is(#modal, #order-analog, #other-analogs) input[type="text"]:hover,
  :is(#modal, #order-analog, #other-analogs) input[type="tel"]:hover,
  :is(#modal, #order-analog, #other-analogs) input[type="email"]:hover,
  :is(#modal, #order-analog, #other-analogs) textarea:hover { border-color: var(--af-line-hover); }
}

:is(#modal, #order-analog, #other-analogs) input[type="text"]:focus,
:is(#modal, #order-analog, #other-analogs) input[type="tel"]:focus,
:is(#modal, #order-analog, #other-analogs) input[type="email"]:focus,
:is(#modal, #order-analog, #other-analogs) textarea:focus {
  border-color: var(--af-blue);
  box-shadow: 0 0 0 3px var(--af-blue-ring);
  outline: none;
}

/* Ошибка. Класс error ставит AjaxForm на само поле; текст кладёт в .error_<имя>. */
:is(#modal, #order-analog, #other-analogs) input.error,
:is(#modal, #order-analog, #other-analogs) textarea.error {
  border-color: var(--af-error);
  color: var(--af-ink);
}
:is(#modal, #order-analog, #other-analogs) input.error:focus,
:is(#modal, #order-analog, #other-analogs) textarea.error:focus {
  border-color: var(--af-error);   /* иначе обводка фокуса (синяя) перебивает красную: у неё выше специфичность */
  box-shadow: 0 0 0 3px var(--af-error-ring);
}

:is(#modal, #order-analog, #other-analogs) .af-error {
  display: none;
  margin: 0;
  color: var(--af-error);
  font-family: 'DINPro-Medium', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.3;
}
:is(#modal, #order-analog, #other-analogs) .af-error.error { display: block; }
/* style.css/.com красили текст ошибки в чёрный с !important — снимаем. */
:is(#modal, #order-analog, #other-analogs) .ajax_form .error.af-error { color: var(--af-error) !important; }

/* Ловушка для роботов остаётся невидимой, как и была. */
:is(#modal, #order-analog, #other-analogs) .field_check { display: none !important; }

/* Пока AjaxForm отправляет, поля выключены — показываем это, а не притворяемся. */
:is(#modal, #order-analog, #other-analogs) input:disabled,
:is(#modal, #order-analog, #other-analogs) textarea:disabled { background: #f4f6f8; color: var(--af-muted); }

/* ── Кнопка ────────────────────────────────────────────────────────────── */

:is(#modal, #order-analog, #other-analogs) .btn,
:is(#modal, #order-analog, #other-analogs) .btn-main,
:is(#modal, #order-analog, #other-analogs) input[type="submit"] {
  display: block;
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 13px 20px;
  border: 0;
  border-radius: var(--af-radius);
  background: var(--af-orange);
  color: #fff;
  font-family: 'DINPro-Medium', Arial, sans-serif;
  font-size: 15px;
  line-height: 24px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .16s var(--af-ease), transform .12s var(--af-ease), box-shadow .16s var(--af-ease);
}
@media (hover: hover) {
  :is(#modal, #order-analog, #other-analogs) .btn:hover,
  :is(#modal, #order-analog, #other-analogs) .btn-main:hover,
  :is(#modal, #order-analog, #other-analogs) input[type="submit"]:hover { background: var(--af-orange-dark); color: #fff; }
}
:is(#modal, #order-analog, #other-analogs) .btn:active,
:is(#modal, #order-analog, #other-analogs) .btn-main:active,
:is(#modal, #order-analog, #other-analogs) input[type="submit"]:active { transform: scale(.98); }
:is(#modal, #order-analog, #other-analogs) .btn:focus-visible,
:is(#modal, #order-analog, #other-analogs) .btn-main:focus-visible,
:is(#modal, #order-analog, #other-analogs) input[type="submit"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--af-blue);
}
:is(#modal, #order-analog, #other-analogs) input[type="submit"]:disabled {
  background: #f7a071;
  cursor: progress;
  transform: none;
}

/* Мелкая подпись под кнопкой — что значит звёздочка. */
:is(#modal, #order-analog, #other-analogs) .af-note {
  margin: 12px 0 0;
  color: var(--af-muted);
  font-size: 13px;
  line-height: 1.35;
}
:is(#modal, #order-analog, #other-analogs) .af-note b { font-weight: inherit; color: var(--af-orange); }

/* ── Телефон ───────────────────────────────────────────────────────────── */

@media (max-width: 559px) {
  :is(#modal, #order-analog, #other-analogs) { width: auto; padding: 24px 20px 24px; }
  :is(#modal, #order-analog, #other-analogs) h3 { font-size: 22px; margin-bottom: 18px; }
  :is(#modal, #order-analog, #other-analogs) .af-fields { gap: 14px; margin-bottom: 18px; }
}

/* ── Сообщение AjaxForm (jGrowl) ───────────────────────────────────────── */

/* Ответ сервера приходит всплывающей плашкой в углу. Делаем её карточкой в
   духе формы; тон — полоса слева, а не заливка на весь блок. */
#jGrowl .jGrowl-notification,
.jGrowl .jGrowl-notification {
  width: 320px;
  max-width: calc(100vw - 32px);
  margin: 12px 12px 0 0;
  padding: 14px 40px 14px 16px;
  border-radius: 12px;
  border-left: 4px solid var(--af-blue, #017199);
  background: #fff !important;
  color: #1c2126 !important;
  font-family: 'DINPro-Light', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  opacity: 1 !important;
  box-shadow: 0 16px 40px -12px rgba(17, 24, 32, .35), 0 0 0 1px rgba(17, 24, 32, .06);
}
.jGrowl .af-message-success { border-left-color: #2b8a4b !important; }
.jGrowl .af-message-error   { border-left-color: #c8322b !important; }
.jGrowl .af-message-info    { border-left-color: #017199 !important; }
.jGrowl .jGrowl-notification .jGrowl-close {
  position: absolute; top: 8px; right: 10px;
  color: #5f6a73; font-size: 18px; line-height: 1;
}
.jGrowl .jGrowl-closer { display: none; }

@media (prefers-reduced-motion: reduce) {
  :is(#modal, #order-analog, #other-analogs) input, #modal textarea, #modal .btn, #modal .btn-main, #modal input[type="submit"] { transition: none; }
}

/* «Заказать аналог» — второй строкой идёт название позиции: тише и мельче. */
#order-analog h3 { font-size: 22px; }

/* Сообщения FormIt без AJAX (если JS выключен): по-прежнему видны, но в тоне формы. */
:is(#modal, #order-analog, #other-analogs) .alert {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}
:is(#modal, #order-analog, #other-analogs) .alert-success { background: #e9f6ee; color: #1f6b3a; }
:is(#modal, #order-analog, #other-analogs) .alert-danger  { background: #fbeae9; color: #a3261f; }

/* ──────────────────────────────────────────────────────────────────────────
   Окно не выше экрана.

   Когда под полями появляются тексты ошибок, форма становится выше. fancybox
   считает размеры при открытии и с fitToView: false не ужимает окно под экран:
   нижний край с кнопкой «Отправить» уходит за границу, и вернуть его прокруткой
   не получается. Скрипт просит fancybox пересчитать размеры, а эти правила —
   вторая опора на случай маленького экрана: содержимое прокручивается внутри
   окна, а не убегает вниз.

   max-height ограничивает высоту, которую fancybox проставляет инлайном:
   максимум всегда сильнее заданной высоты, поэтому !important не нужен.
   ────────────────────────────────────────────────────────────────────────── */
.fancybox-inner:has(> :is(#modal, #order-analog, #other-analogs)) {
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
