/**
 * AtomCAE — блок «CTA-заявка» (Figma 233:3330 / 287:2553). Тёмная секция с фото-фоном:
 * слева заголовок + сетка контактов, справа белая карточка формы (Contact Form 7,
 * ADR-0013). Грузится после layout.css. Десктоп-first. Значения из макета.
 *
 * Разметку CF7 стилизуем классами .cta__* (заданы в шаблоне формы через class:).
 */

.cta {
  position: relative;
  background: var(--color-dark);
  color: var(--color-on-dark);
  overflow: hidden;
  padding-block: 100px;
}

/* фон-фото (АЭС) + navy-затемнение слева для контраста текста (десктоп) */
.cta__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.cta__bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center right;
}

.cta__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(22, 34, 56, 0.96) 0%,
    rgba(22, 34, 56, 0.7) 55%,
    rgba(22, 34, 56, 0.35) 100%
  );
}

.cta__inner {
  position: relative;
  z-index: 1;
  width: min(1400px, 100% - 2 * 40px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 687fr 600fr;
  column-gap: clamp(40px, 7vw, 113px);
  align-items: start;
}

/* --- Левая колонка: шапка + контакты --- */
.cta__left {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.cta__head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cta__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  font-size: var(--font-size-eyebrow);
  line-height: var(--font-size-eyebrow);
  letter-spacing: var(--letter-spacing-tight);
  white-space: nowrap;
}

.cta__eyebrow-arrow {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background-color: var(--color-primary);
  -webkit-mask: url("../icons/arrow-down-right.svg") center / contain no-repeat;
  mask: url("../icons/arrow-down-right.svg") center / contain no-repeat;
}

.cta__eyebrow-text {
  opacity: 0.4;
}

/* Хлебные крошки в шапке CTA (страница «Контакты» — вместо надзаголовка): те же
   пропорции, что page-intro__crumbs, но под ТЁМНЫЙ фон (светлый текст ссылок). */
.cta__crumbs {
  margin: 0;
  font-family: var(--font-family-base);
  font-size: 17px;
  line-height: 17px;
  letter-spacing: var(--letter-spacing-tight);
  /* Yoast разделяет пункты пробелами — расширяем до зазора ~16px (как page-intro). */
  word-spacing: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.cta__crumbs .breadcrumb_last {
  word-spacing: normal;
}

.cta__crumbs a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: underline;
  transition: color 0.18s ease;
}

.cta__crumbs a:hover {
  color: var(--color-on-dark);
}

.cta__crumb-sep {
  margin-inline: 8px;
}

.cta__title {
  margin: 0;
  max-width: 687px;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-h2);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-heading);
}

.cta__desc {
  margin: 0;
  max-width: 687px;
  font-size: var(--font-size-nav);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-tight);
  opacity: 0.7;
}

/* контакты — сетка 2×2 (Figma 250:7782); общие границы через border-collapse-приём */
.cta__contacts {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 647px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--color-border-on-dark);
  border-left: 1px solid var(--color-border-on-dark);
}

.cta__contact-item {
  border-right: 1px solid var(--color-border-on-dark);
  border-bottom: 1px solid var(--color-border-on-dark);
}

/* карточка-контакт: тело (заголовок + подпись) + стрелка ↗ / иконка копирования.
   Почта выводится <button class="cta__contact copy-email">, а сброс в copy-email.css
   (селектор из трёх классов + элемент) сильнее этого правила и раньше съедал padding 24:
   карточка почты прижималась к верхнему левому углу, остальные — с отступом (R04).
   Теперь .cta__contact исключён из сброса, поэтому дефолтный вид <button> гасим здесь. */
.cta__contact {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 21px;
  height: 100%;
  padding: 24px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.18s ease;
}

a.cta__contact:hover {
  background: rgba(255, 255, 255, 0.04);
}

@media (prefers-reduced-motion: reduce) {
  .cta__contact {
    transition: none;
  }
}

.cta__contact-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}

.cta__contact-title {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-medium);
  font-size: 26px;
  line-height: var(--line-height-heading);
  letter-spacing: -0.25px;
  word-break: break-word;
}

.cta__contact-note {
  font-size: var(--font-size-nav);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-tight);
  opacity: 0.8;
}

/* стрелка ↗ — переиспользуем arrow-down-right, повёрнутую на -90° */
.cta__contact-arrow {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background-color: var(--color-on-dark);
  -webkit-mask: url("../icons/arrow-down-right.svg") center / 14px no-repeat;
  mask: url("../icons/arrow-down-right.svg") center / 14px no-repeat;
  transform: rotate(-90deg);
  opacity: 0.7;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

a.cta__contact:hover .cta__contact-arrow {
  opacity: 1;
  transform: rotate(-90deg) translateX(2px);
}

/* --- Правая колонка: белая карточка формы --- */
.cta__form-card {
  background: var(--color-surface);
  /* ТЗ п.104 (Task 93): форма компактнее по высоте — кнопка без скролла. Интервалы
     режем здесь и в .wpcf7-form/.cta__field ниже; textarea min-height:150 НЕ трогаем
     (заказчик раньше просил БОЛЬШЕ строк — экономим на промежутках, не на поле). */
  padding: 24px;
  color: var(--color-dark);
}

.cta__form-missing {
  margin: 0;
  color: var(--color-dark);
  font-size: var(--font-size-nav);
}

/* Honeypot-ловушка (ADR-0023): вне экрана, недоступна с клавиатуры/скринридера (tabindex=-1,
   aria-hidden в разметке) — живой юзер не видит и не трогает; бот заполняет → сервер спам. */
.cf7-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ===== Стилизация Contact Form 7 под макет ===== */
.cta__form-card .wpcf7-form {
  display: flex;
  flex-direction: column;
  /* ТЗ п.104 (Task 93): 16 → 10 — компактнее по высоте. */
  gap: 10px;
}

/* группа поля: подпись + контрол (Figma Frame386) */
.cta__field {
  display: flex;
  flex-direction: column;
  /* ТЗ п.104 (Task 93): 16 → 8 — компактнее по высоте. */
  gap: 8px;
}

.cta__label {
  margin: 0;
  font-size: 14px;
  line-height: 14px;
  letter-spacing: -0.2px;
  opacity: 0.8;
}

/* инпут/текстареа/файл: серый фон, hairline-рамка, высота 55 (Figma 233:3345) */
.cta__form-card .cta__input,
.cta__form-card textarea.cta__input,
.cta__form-card input[type="file"].cta__file {
  width: 100%;
  height: 55px;
  padding: 0 15px;
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border-light);
  border-radius: 0;
  color: var(--color-dark);
  font-family: var(--font-family-base);
  font-size: 16px;
  letter-spacing: var(--letter-spacing-tight);
  -webkit-appearance: none;
  appearance: none;
}

.cta__form-card textarea.cta__input {
  /* 4–5 строк видно сразу (правка заказчика): min-height ~4.5 строки (26px × 4.5 + 32px паддинга).
     Базовый height:55px (выше) перебивает rows=10 CF7-формы, а min-height поднимает пол до 150 —
     без height:auto, иначе rows=10 растянул бы поле до ~294px. resize:vertical тянется больше. */
  min-height: 150px;
  padding: 16px 15px;
  resize: vertical;
  line-height: var(--line-height-relaxed);
}

.cta__form-card .cta__input::placeholder {
  color: var(--color-dark);
  opacity: 0.7;
}

.cta__form-card .cta__input:focus,
.cta__form-card .cta__file:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* файл: серый бокс + нативная кнопка выбора, стилизованная под «Прикрепить файл» */
.cta__form-card input[type="file"].cta__file {
  display: flex;
  align-items: center;
  padding: 9px 15px;
  font-size: 14px;
}

.cta__form-card input[type="file"].cta__file::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  color: var(--color-dark);
  font-family: var(--font-family-base);
  font-size: 14px;
  letter-spacing: -0.2px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.cta__form-card input[type="file"].cta__file::file-selector-button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* согласие на обработку ПДн — кастомный чекбокс + текст */
.cta__form-card .cta__consent .wpcf7-list-item {
  margin: 0;
}

.cta__form-card .cta__consent .wpcf7-list-item-label {
  font-size: 14px;
  line-height: 18px;
  letter-spacing: -0.2px;
  color: #556788;
}

.cta__form-card .cta__consent label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.cta__form-card .cta__consent input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  background: rgba(22, 34, 56, 0.06);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.cta__form-card .cta__consent input[type="checkbox"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  -webkit-mask: none;
  mask: none;
}

.cta__form-card .cta__consent input[type="checkbox"]:checked::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--color-on-dark);
  -webkit-mask: url("../icons/check.svg") center / 11px no-repeat;
  mask: url("../icons/check.svg") center / 11px no-repeat;
}

.cta__form-card .cta__consent input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.cta__form-card .cta__consent a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: rgba(6, 79, 188, 0.3);
}

/* кнопка отправки — синяя h55 + уголок-стрелка (оверлей-спан, т.к. у input нет ::after) */
.cta__submit-wrap {
  position: relative;
}

.cta__form-card .cta__submit {
  width: 100%;
  height: 55px;
  background: var(--color-primary);
  border: 1.5px solid rgba(255, 255, 255, 0.05);
  border-radius: 0;
  color: var(--color-on-dark);
  font-family: var(--font-family-base);
  font-size: 16px;
  font-weight: var(--font-weight-medium);
  letter-spacing: -0.25px;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.cta__form-card .cta__submit:hover {
  background: var(--color-primary-hover);
}

.cta__submit-arrow {
  position: absolute;
  inset-block-end: 6.5px;
  inset-inline-end: 6.5px;
  width: 7px;
  height: 7px;
  opacity: 0.6;
  pointer-events: none;
  background-color: var(--color-on-dark);
  -webkit-mask: url("../icons/cta-arrow.svg") center / contain no-repeat;
  mask: url("../icons/cta-arrow.svg") center / contain no-repeat;
}

@media (prefers-reduced-motion: reduce) {
  .cta__form-card .cta__submit {
    transition: none;
  }
}

/* Неактивная кнопка (CF7 держит submit disabled, пока не отмечено согласие). */
.cta__form-card .cta__submit:disabled,
.cta__form-card .cta__submit:disabled:hover {
  background: var(--color-primary);
  opacity: 0.5;
  cursor: not-allowed;
}

/* Тултип-подсказка над кнопкой отправки (текст задаёт cta-form.js). Висит на
   .cta__submit-wrap, т.к. на disabled-кнопке события ховера не срабатывают. */
.cta__submit-tip {
  position: absolute;
  inset-block-end: calc(100% + 10px);
  inset-inline: 0;
  z-index: 3;
  max-width: 320px;
  margin: 0 auto;
  padding: 10px 14px;
  background: var(--color-dark);
  color: var(--color-on-dark);
  font-family: var(--font-family-base);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(11, 18, 32, 0.18);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cta__submit-tip[hidden] {
  display: none;
}

.cta__submit-wrap.is-tip-visible .cta__submit-tip {
  opacity: 1;
  transform: translateY(0);
}

.cta__submit-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-block-start-color: var(--color-dark);
}

@media (prefers-reduced-motion: reduce) {
  .cta__submit-tip {
    transition: none;
  }
}

/* Бейдж рейтинга Яндекса (п. 2.14/50.5/51.3) — под сеткой контактов слева,
   iframe 150×50 от Яндекс Справочника (тёмная тема под фон CTA). */
.cta__rating {
  margin-top: 32px;
}

.cta__rating-frame {
  display: block;
  border: 0;
}

/* ответ/ошибки валидации CF7 */
/* Баннер-уведомление CF7 скрыт: успех уводит на /spasibo (cta-popup.js), ошибки
   валидации показываются на полях (.wpcf7-not-valid-tip ниже). */
.cta__form-card .wpcf7-response-output {
  display: none;
}

/* ...НО при сбое отправки письма (mail_failed/spam/aborted — CF7 вешает класс на
   форму) баннер показываем: иначе пользователь не узнаёт, что заявка НЕ ушла.
   Тексты сообщений — русские (tools/cf7-messages-ru.php). */
.cta__form-card form.failed .wpcf7-response-output,
.cta__form-card form.spam .wpcf7-response-output,
.cta__form-card form.aborted .wpcf7-response-output {
  display: block;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
  color: #d63638;
  font-size: 14px;
  line-height: 1.4;
}

.cta__form-card .wpcf7-not-valid-tip {
  margin-top: 6px;
  color: #d63638;
  font-size: 13px;
}

.cta__form-card .wpcf7-not-valid {
  border-color: #d63638;
}

/* телефон — intl-tel-input: контейнер на всю ширину, поле сохраняет стиль .cta__input,
   но с увеличенным левым отступом под флаг страны (lib-CSS грузится до cta.css) */
.cta__form-card .iti {
  display: block;
  width: 100%;
}

.cta__form-card .iti input.cta__phone {
  width: 100%;
  padding-left: 52px;
}

.cta__form-card .iti__dropdown-content {
  z-index: 5;
}

/* до 5 файлов: один input[multiple] — выбор нескольких сразу + список имён */
.cta__files {
  gap: 10px;
}

.cta__file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cta__file-item {
  padding-left: 16px;
  position: relative;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: -0.2px;
  color: #556788;
  word-break: break-all;
}

.cta__file-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 9px;
  height: 9px;
  background-color: var(--color-primary);
  -webkit-mask: url("../icons/check.svg") center / contain no-repeat;
  mask: url("../icons/check.svg") center / contain no-repeat;
}

.cta__file-note {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: #d63638;
}

/* --- Планшет/мобайл (≤1100): одна колонка, порядок шапка → форма → контакты --- */
@media (max-width: 1100px) {
  .cta {
    padding-block: 56px;
  }

  /* солидный navy-фон без фото (Figma mobile 287:2553) */
  .cta__bg {
    display: none;
  }

  .cta__inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  /* .cta__left раскрывается → его дети (шапка, контакты) попадают в flex-поток
     рядом с формой; order расставляет шапка → форма → контакты */
  .cta__left {
    display: contents;
  }

  .cta__head {
    order: 1;
  }

  .cta__right {
    order: 2;
  }

  .cta__contacts {
    order: 3;
    max-width: none;
  }

  .cta__rating {
    order: 4;
  }

  .cta__title {
    max-width: none;
    font-size: 40px;
  }

  .cta__desc {
    max-width: none;
  }
}

/* --- Смартфон (Figma 287:2553) --- */
@media (max-width: 640px) {
  .cta {
    padding-block: 40px;
  }

  .cta__inner {
    width: min(1400px, 100% - 2 * 15px);
  }

  .cta__eyebrow {
    font-size: 16px;
    line-height: 16px;
  }

  .cta__title {
    font-size: 28px;
    letter-spacing: -1px;
  }

  .cta__desc {
    font-size: 16px;
    line-height: 22px;
  }

  /* контакты — в одну колонку */
  .cta__contacts {
    grid-template-columns: 1fr;
  }

  .cta__contact-title {
    font-size: 22px;
  }

  .cta__contact-note {
    font-size: 16px;
    line-height: 22px;
  }

  .cta__form-card {
    padding: 24px 16px;
  }
}

/* ============================================================================
   R75 (ТЗ [886–887]): блок карты на странице «Контакты» — под тёмным CTA.
   §805–808: строка «Адрес: …» над статичной картой (WebP из ТЗ) вместо iframe
   Яндекс.Карт — в веб-версии карты показывалась реклама. Светлая секция:
   карта в белой рамке, hairline #eee; кадрирование — как у прежнего iframe.
   ============================================================================ */
.contacts-map {
  padding-block: 64px 88px;
  background: var(--color-surface);
  color: var(--color-dark);
}

.contacts-map__inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(1402px, 100% - 2 * 40px);
  margin-inline: auto;
}

.contacts-map__address {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  font-size: var(--font-size-nav);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-tight);
}

/* «Адрес:» — акцент (как подписи фактуры проекта), сам адрес — обычный текст */
.contacts-map__address-label {
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}

.contacts-map__frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 21 / 9;
  min-height: 320px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-light);
}

.contacts-map__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 43% 50%;
}

@media (max-width: 1100px) {
  .contacts-map {
    padding-block: 48px 64px;
  }

  .contacts-map__frame {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 640px) {
  .contacts-map {
    padding-block: 32px 40px;
  }

  .contacts-map__inner {
    width: min(100% - 2 * 16px, 1402px);
    gap: 16px;
  }

  .contacts-map__address {
    font-size: 16px;
    line-height: 22px;
  }

  .contacts-map__frame {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }
}