/* ===========================================================================
   Footer section styles
   =========================================================================== */

.footer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 1920px;
  margin-inline: auto;
  background: var(--bg-dark-primary);
  border: 1px solid var(--border-main-quarteary);
  padding: clamp(80px, 6.25vw, 120px) clamp(60px, 5.2vw, 100px);
  border-radius: var(--radius-xxxl) var(--radius-xxxl) 0 0;
  color: var(--text-constant-light);
  overflow: hidden;
  box-shadow: var(--shadow-main);
}

/* --- Background image ------------------------------------------ */

.footer__bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.footer__bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Экспорт узла footer-bg из Figma уже содержит финальную заливку,
     дополнительная прозрачность его гасит. */
  opacity: 1;
  pointer-events: none;
}

/* --- Main content wrapper ------------------------------------ */

.footer__wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(60px, 5vw, 77px);
  width: 100%;
}

/* --- Top section: CTA + Form --------------------------------- */

.footer__top {
  display: flex;
  gap: var(--space-xl);
  align-items: stretch;
  width: 100%;
}

/* --- CTA column (left) ---------------------------------------- */

.footer__cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  flex: 0 1 auto;
  max-width: 50%;
}

.footer__cta .badge.badge--on-dark {
  width: fit-content;
  align-self: flex-start;
  backdrop-filter: blur(8px);
}

.footer__title {
  font-size: 64px;
  line-height: 1.1;
  color: var(--text-constant-light);
  letter-spacing: -0.01em;
}

.footer__subtitle {
  color: var(--text-constant-light);
  font-size: clamp(18px, 1.25vw, 24px);
}

/* --- Form column (right) -------------------------------------- */

.footer__form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: var(--space-xxxl);
  min-width: 0;
}

/* --- Fields grid 2x3 ------------------------------------------ */

.footer__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
  width: 100%;
}

.footer__fields .field__label {
  font-size: var(--scale-03);
}

.footer__fields .field__hint {
  font-size: 16px;
  font-weight: var(--weight-400);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #888;
  display: block;
  margin-top: 2px;
  margin-bottom: 4px;
}

.footer__fields .field__control {
  letter-spacing: 0;
}

.footer__fields select.field__control {
  letter-spacing: 0.01em;
}

/* --- Checkbox ------------------------------------------------- */

.footer__checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xxs);
  cursor: pointer;
  grid-column: 1 / -1;
}

.footer__checkbox-text {
  flex: 1;
  font-size: var(--scale-03);
  font-weight: var(--weight-500);
  line-height: 1.2;
  color: var(--input-title);
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* --- Divider in form ------------------------------------------ */

.footer__divider {
  width: 100%;
  height: 1px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.footer__divider-svg {
  width: 100%;
  height: 1px;
  display: block;
}

/* --- Buttons -------------------------------------------------- */

.footer__buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  width: 100%;
}

.footer__button {
  width: 100%;
  font-size: var(--scale-05);
  padding: var(--space-m) var(--space-xl);
  height: auto;
  min-height: 61px;
}

/* --- Main divider between sections ----------------------------- */

.footer__divider-main {
  width: 100%;
  height: 1px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.footer__divider-main svg {
  width: 100%;
  height: 1px;
  display: block;
}

/* --- Bottom section: Contacts & Links ------------------------- */

.footer__bottom {
  display: flex;
  flex-direction: column;
  gap: 48px;
  width: 100%;
}

/* --- Contacts (email & phone) --------------------------------- */

.footer__contacts {
  /* Макет: row 1720px, две колонки по 860px, gap 40. Телефон начинается
     на x=960 и выровнен по левому краю своей колонки, а не по правому краю. */
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-max);
  width: 100%;
}

.footer__contacts > * {
  justify-self: start;
}

.footer__contact-link {
  font-size: clamp(32px, 5.208vw, 82px);
  font-weight: var(--weight-500);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-constant-light);
  text-decoration: underline;
  text-decoration-skip-ink: none;
  /* Линия должна идти ПОД выносными элементами (@, скобки), а не сквозь них. */
  /* Зазор до глифа при кегле 82px ~25px. */
  text-underline-offset: 0.17em;
  text-decoration-thickness: 7px;
  transition: opacity 0.2s ease;
}

.footer__contact-link:hover {
  opacity: 0.8;
}

/* --- Social icons & Nav links --------------------------------- */

.footer__links-section {
  /* Макет: две колонки по 860px, соцсети в левой, меню в правой — обе от
     левого края своей колонки. */
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
  width: 100%;
}

.footer__socials {
  display: flex;
  gap: 10px;
  align-items: center;
}

.footer__social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  color: var(--text-constant-dark);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.footer__social-icon:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.footer__social-icon svg {
  width: 17.23px;
  height: 17.23px;
  display: block;
}

.footer__social-icon-img {
  width: 17.23px;
  height: 17.23px;
  display: block;
  object-fit: contain;
}

.footer__nav {
  display: flex;
  gap: 32px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.footer__nav-link {
  font-size: var(--scale-03);
  font-weight: var(--weight-500);
  line-height: 1.2;
  color: var(--text-constant-light);
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.footer__nav-link:hover {
  opacity: 0.8;
}

/* --- Legal section --------------------------------------------- */

.footer__legal {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-xl);
  width: 100%;
  flex-wrap: wrap;
}

.footer__legal-text {
  font-size: var(--scale-01);
  font-weight: var(--weight-400);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--text-constant-light);
  white-space: nowrap;
}

.footer__legal-link {
  font-size: var(--scale-01);
  font-weight: var(--weight-400);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--text-constant-light);
  text-decoration: underline;
  /* В макете линия проходит ПОД выносными элементами (ф), а не сквозь.
     skip-ink:none делает её сплошной, offset опускает ниже глифов. */
  text-decoration-skip-ink: none;
  text-underline-offset: 0.17em;
  text-decoration-thickness: 1px;
  transition: opacity 0.2s ease;
}

.footer__legal-link:hover {
  opacity: 0.8;
}

/* ===========================================================================
   Responsive: 1440px
   =========================================================================== */

@media (max-width: 1440px) {
  .footer__top {
    gap: 20px;
  }

  .footer__form {
    padding: var(--space-xl);
  }

  .footer__fields {
    gap: 12px;
  }

  .footer__contact-link {
    font-size: clamp(28px, 4.5vw, 82px);
  }
}

/* ===========================================================================
   Responsive: 1024px
   =========================================================================== */



/* ===========================================================================
   Responsive: 768px
   =========================================================================== */



/* ===========================================================================
   Responsive: 480px
   =========================================================================== */



/* ============================================================================
   Планшет (≤1024) — узел 529:3317 (768x1211): колонка с зазором 60,
   форма — белая карточка 688x513 (поля 2x3, кнопки 44), контакты 40px,
   меню футера 2x3, юридическая строка 14px.
   ============================================================================ */

@media (max-width: 1199px) {
  /* Меню футера в макете прижато к правому краю (x326 при 688).
     В базе у блока display: grid — justify-content там распределяет
     колонки, а не элементы, поэтому переводим ряд во flex. */
  .footer__links-section {
    display: flex;
    justify-content: space-between;
  }

  /* Подчёркивание контактов: десктопные 7px на 40px кегле слишком жирные */
  .footer__contact-link {
    text-decoration-thickness: 3px;
  }

  .footer {
    /* 39 + 1px рамки = 40 макетных; иначе заголовок теряет 2px и
       переносится раньше времени */
    padding: 39px;
    border-radius: 32px 32px 0 0;
  }

  .footer__wrapper {
    display: flex;
    flex-direction: column;
    gap: 60px;
  }

  .footer__top {
    flex-direction: column;
    gap: 24px;
  }

  .footer__cta {
    gap: 16px;
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
  }

  .footer__cta .badge { font-size: 16px; }

  .footer__title {
    font-size: 40px;
    /* Chrome набирает строку на ~5px шире Figma и рвёт «складов» вниз;
       −0.004em возвращают макетный перенос, глазу разница не видна */
    letter-spacing: -0.014em;
  }

  .footer__subtitle {
    font-size: 16px;
    line-height: 1.5;
  }

  /* Форма — белая карточка (узел footer-stats) */
  .footer__form {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 20px 24px;
    gap: 16px;
  }

  .footer__checkbox-text {
    font-size: 16px;
    color: var(--text-constant-dark); /* на белой карточке текст тёмный */
  }

  .footer__buttons { gap: 12px; }

  /* Селектор с .btn — иначе базовый .btn--xl (61px) перевешивает */
  .footer__buttons .btn.footer__button {
    width: 100%;
    height: 44px;
    min-height: 0; /* в базе min-height: 61px */
    padding: 8px 24px;
    border-radius: var(--radius-s);
    font-size: 14px;
    font-weight: var(--weight-400);
    letter-spacing: 0.01em;
  }

  /* Ряд поля в макете 91: отступ 12 СВЕРХУ + подпись 19 + 4 + инпут 56 */
  .footer__fields .field {
    gap: 4px;
  }

  .footer__fields .field__label {
    font-size: 16px;
    line-height: 1.2;
    padding: 12px 0 0;
  }

  .footer__contact-link {
    font-size: 40px;
    line-height: 1.2;
  }

  .footer__links-section {
    display: flex;
    align-items: flex-start; /* соцсети и меню в макете начинаются на одном y */
    justify-content: space-between; /* меню у правого края: x326 при ряде 688 */
    gap: 48px;
  }

  /* Текстура: в макете RECT 1920px на x:-976 — показан правый срез */
  .footer__bg-img {
    width: 1920px;
    height: auto;
    max-width: none;
    position: absolute;
    left: -976px;
    top: 0;
  }

  /* Меню футера: 2 колонки x 3 строки (узел 362x115) */
  .footer__nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
    width: 362px;
    max-width: 100%;
    flex-shrink: 0;
  }

  .footer__nav-link { font-size: 14px; }

  .footer__bottom { gap: 48px; }

  .footer__legal {
    gap: 24px;
    /* Легал в разметке — сосед .footer__bottom при зазоре обёртки 60;
       в макете он часть нижнего блока с зазором 48 */
    margin-top: -12px;
  }

  .footer__legal-text,
  .footer__legal-link { font-size: 14px; }
}

/* Мобильная версия (max-width: 767px, 375px вьюпорт) */
@media (max-width: 767px) {
  /* Мобильный кроп текстуры подставляет <picture>; сбрасываем планшетный сдвиг */
  .footer__bg-img {
    width: 100%;
    height: auto;
    max-width: 100%;
    position: absolute;
    left: 0;
    top: 2px;
  }

  .footer {
    padding: 40px 24px;
    border-radius: 0;
  }

  .footer__wrapper {
    gap: 48px;
  }

  .footer__top {
    gap: 24px;
    width: 100%;
    flex-direction: column;
  }

  .footer__cta {
    gap: 16px;
    width: 100%;
    max-width: none;
  }

  .footer__cta .badge {
    font-size: 12px;
  }

  .footer__title {
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.01em;
  }

  .footer__subtitle {
    font-size: 14px;
    line-height: 1.5;
  }

  .footer__form {
    padding: 12px 16px;
    gap: 8px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: 100%;
    max-width: none;
  }

  .footer__fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .footer__fields .field {
    gap: 4px;
    width: 100%;
  }

  .footer__fields .field__label {
    font-size: 14px;
    line-height: 1.2;
    padding: 12px 0 0;
  }

  .footer__fields .field__control {
    height: 56px;
    padding: 16px;
    font-size: 14px;
  }

  .footer__checkbox {
    gap: 8px;
  }

  .footer__checkbox-text {
    font-size: 14px;
    color: var(--text-constant-dark);
  }

  .footer__divider {
    height: 1px;
    margin: 0;
  }

  .footer__buttons {
    gap: 8px;
    width: 100%;
  }

  .footer__buttons .btn.footer__button {
    width: 100%;
    height: 44px;
    min-height: 0;
    font-size: 14px;
    padding: 8px 24px;
    border-radius: 12px;
  }

  .footer__contact-link {
    font-size: 32px;
    line-height: 1.2;
    width: fit-content;
    margin: 0;
    text-align: left;
    justify-self: start;
    text-decoration-thickness: 2px; /* десктопные 7px на 32px слишком жирные */
  }

  .footer__contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
  }

  .footer__links-section {
    display: flex;
    flex-direction: column;
    gap: 48px;
    width: 100%;
  }

  .footer__socials {
    gap: 10px;
  }

  /* Меню в мобильном макете — 2 колонки x 3 ряда (узел 328x115, шаг 49) */
  .footer__nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
    width: 100%;
  }

  .footer__nav-link {
    font-size: 14px;
  }

  .footer__bottom {
    gap: 48px;
    width: 100%;
  }

  .footer__legal {
    gap: 24px; /* узел footer-legal: VER g24 */
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 0;
  }

  .footer__legal-text,
  .footer__legal-link {
    font-size: 12px;
    line-height: 1.2;
  }

  .footer__divider-main {
    height: 1px;
  }

}

/* Внутреннее поле полноширинной секции не меньше бокового поля страницы */
@media (min-width: 1200px) and (max-width: 1919px) {
  .footer {
    padding-inline: max(var(--page-gutter), 40px);
  }
}
