/* ==========================================================
   custom.css — правки без пересборки assets
   Подключается после application.css и перекрывает его
   ========================================================== */

/* ============================================================
   ШАПКА
   ============================================================ */

.top_header ul { width: 28%; }

@media screen and (max-width: 1150px) {
  .top_header ul { width: 30%; }
}

@media screen and (max-width: 1000px) {
  .top_header ul { width: 44%; }
}

/* ============================================================
   ФУТЕР — полная grid-раскладка
   ============================================================ */

/* Обёртка футера */
.footer-wrap {
  height: auto !important;
  padding-bottom: 50px;
}

/* Базовая сетка футера > 1150px */
.footer-wrap footer {
  display: grid !important;
  grid-template-columns: 25% 25% 50% !important;
  grid-template-rows: auto 1fr !important;
  grid-template-areas:
    "copyright contact links"
    "pay       .       links" !important;
  float: none !important;
}

/* grid-area для каждого блока */
.footer-wrap footer .footer-copyright { grid-area: copyright; float: none !important; width: auto !important; }
.footer-wrap footer .footer-contact   { grid-area: contact;   float: none !important; width: auto !important; }
.footer-wrap footer .footer-pay       { grid-area: pay;       float: none !important; width: auto !important; display: block !important; padding-top: 30px !important; }
.footer-wrap footer .obertka_footera  { grid-area: links; }

/* Колонки ссылок — grid 2×2 */
.footer-wrap footer .obertka_footera {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 24px 10px !important;
  align-content: start !important;
  float: none !important;
  width: auto !important;
  margin-top: 0 !important;
}

/* Каталог — 3-я позиция визуально */
.footer-wrap footer .obertka_footera .footer-link:nth-child(1) { order: 3; }
.footer-wrap footer .obertka_footera .footer-link:nth-child(2) { order: 1; }
.footer-wrap footer .obertka_footera .footer-link:nth-child(3) { order: 2; }
.footer-wrap footer .obertka_footera .footer-link:nth-child(4) { order: 4; }

/* Сброс старых float/width на footer-link внутри obertka */
.footer-wrap footer .footer-link {
  float: none !important;
  width: auto !important;
  display: block !important;
}

/* Онлайн-сервисы — убираем старый margin-left */
.footer-wrap footer .footer-service { margin-left: 0 !important; display: block !important; }

/* Clearfix больше не нужен */
.footer-wrap footer .cb { display: none !important; }

.footer-wrap footer .footer-link ul {
    padding: 0;
    max-width: 200px;
}

.footer-wrap footer .footer-link ul li a {
    padding: 0;
}

/* ≤ 1000px: 2 колонки сверху + ссылки на всю ширину */
@media screen and (max-width: 1000px) {
  .footer-wrap {
    height: auto !important;
  }
  .footer-wrap footer {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
      "copyright contact"
      "links     links"
      "pay       ." !important;
    padding: 40px 20px 30px !important;
  }
  .footer-wrap footer .footer-contact { text-align: left !important; }
  .footer-wrap footer .footer-link    { display: block !important; }
  .footer-wrap footer .footer-pay     { display: block !important; }
  .footer-wrap footer .footer-service { display: block !important; }
}

/* ≤ 767px: 1 колонка, копирайт скрыт */
@media screen and (max-width: 767px) {
  .footer-wrap footer {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
      "contact"
      "links"
      "pay" !important;
    padding: 30px 20px 20px !important;
  }
  .footer-wrap footer .footer-copyright { display: none !important; }
  .footer-wrap footer .footer-contact   { width: 100% !important; text-align: center !important; margin: 0 !important; }
  .footer-wrap footer .footer-link      { display: block !important; }
  .footer-wrap footer .footer-pay       { display: block !important; }
  .footer-wrap footer .footer-service   { display: block !important; }
  .footer-wrap { height: auto !important; padding-bottom: 10px; }
  /* Центрирование текста и элементов на мобилке */
  .footer-link p, .footer-pay p        { text-align: center !important; }
  .footer-wrap footer                  { justify-items: center !important; }
}

/* ≤ 470px: ссылки в 1 колонку, сброс order */
@media screen and (max-width: 470px) {
  .footer-wrap footer .obertka_footera {
    grid-template-columns: 1fr !important;
  }
  .footer-wrap footer .obertka_footera .footer-link {
    order: unset !important;
    text-align: center;
    margin: 10px 0;
  }
}
