/* =========================================
   ОБЩИЕ ПАРАМЕТРЫ СЕТКИ
   ========================================= */

:root {
  --site-container: 1600px;
  --site-content: 1540px;
  --site-padding: 30px;
}


/* =========================================
   ОБОЛОЧКА ВСЕХ БЛОКОВ
   Кроме блоков с классом uc-defaultblock
   ========================================= */

#allrecords .t-rec:not(.uc-defaultblock) {
  width: 100% !important;
  max-width: var(--site-container) !important;
  margin-inline: auto !important;
  box-sizing: border-box !important;
}


/* =========================================
   ZERO BLOCK
   Ограничение flex-групп по общей сетке
   ========================================= */

#allrecords
.t-rec:not(.uc-defaultblock)
.t396__artboard
> .t396__group.t396__group-flex[data-group-widthmode="fill"] {
  width: 100% !important;
  max-width: var(--site-content) !important;
  margin-inline: auto !important;
  box-sizing: border-box !important;
  align-self: center !important;
}


/* =========================================
   СТАНДАРТНЫЕ БЛОКИ TILDA
   ========================================= */

/* Заголовочные контейнеры стандартных блоков */

#allrecords
.t-rec:not(.uc-defaultblock):not([data-record-type="396"])
.js-block-header {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  box-sizing: border-box !important;
}


/* Колонка внутри заголовочного контейнера */

#allrecords
.t-rec:not(.uc-defaultblock):not([data-record-type="396"])
.js-block-header > .t-col {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  box-sizing: border-box !important;
}


/* Внешние контейнеры стандартных блоков */

#allrecords
.t-rec:not(.uc-defaultblock):not([data-record-type="396"])
.t-container:not(.t-container *) {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: auto !important;
  padding-inline: var(--site-padding) !important;
  box-sizing: border-box !important;
}


/* Убираем дополнительные отступы Tilda,
   если внутри контейнера одна колонка */

#allrecords
.t-rec:not(.uc-defaultblock):not([data-record-type="396"])
.t-container:not(.t-container *)
> .t-col:only-child {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  box-sizing: border-box !important;
}


/* =========================================
   ИСПРАВЛЕНИЕ ОБЁРТКИ ЗАГОЛОВКОВ
   СТАНДАРТНЫХ БЛОКОВ
   ========================================= */

/* Универсальное правило для колонок,
   внутри которых находится заголовок блока */

#allrecords
.t-rec:not(.uc-defaultblock):not([data-record-type="396"])
.t-container:not(.t-container *)
> .t-col:has(.js-block-header) {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  box-sizing: border-box !important;
}


/* Fallback конкретно для FD302N / T2823 */

#allrecords
.t-rec:not(.uc-defaultblock):not([data-record-type="396"])
.t2823__container_header
> .t2823__col {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  box-sizing: border-box !important;
}


/* =========================================
   ИСПРАВЛЕНИЕ ЗАГОЛОВКА КАТАЛОГА T1291
   Страница: /commercheskaya-nedvizhimost
   Блок: #rec4342171301
   Заголовок: «Каталог земельных участков»
   ========================================= */

/*
  Проблема:
  у каталожного блока T1291 внешняя обёртка
  .t-catalog__grid-cont имеет стандартный padding 20px.

  Внутри неё находится .js-block-header,
  который уже получает нашу сетку через --site-padding.

  Получалось:
  20px от Tilda + наш site-padding.

  Поэтому заголовок съезжал вправо.
*/

#rec4342171301
.t1291
> .t-catalog__grid-cont:first-child {
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}


/*
  Сам заголовочный контейнер ставим на нашу сетку:
  30px / 20px / 16px.
*/

#rec4342171301
.t1291
> .t-catalog__grid-cont:first-child
> .js-block-header {
  width: 100% !important;
  max-width: 100% !important;

  padding-left: var(--site-padding) !important;
  padding-right: var(--site-padding) !important;

  margin-left: 0 !important;
  margin-right: 0 !important;

  box-sizing: border-box !important;
}


/*
  Убираем стандартные margin/padding у t-col
  внутри заголовка каталога.
*/

#rec4342171301
.t1291
> .t-catalog__grid-cont:first-child
> .js-block-header
> .t-col {
  width: 100% !important;
  max-width: 100% !important;

  margin-left: 0 !important;
  margin-right: 0 !important;

  padding-left: 0 !important;
  padding-right: 0 !important;

  box-sizing: border-box !important;
}


/* =========================================
   НОУТБУКИ И ПЛАНШЕТЫ
   ========================================= */

@media screen and (max-width: 1599px) {
  :root {
    --site-padding: 20px;
  }
}


/* =========================================
   МОБИЛЬНЫЕ
   ========================================= */

@media screen and (max-width: 639px) {
  :root {
    --site-padding: 16px;
  }
}


/* =========================================
   БЛОКИ-ИСКЛЮЧЕНИЯ
   ========================================= */

#allrecords .t-rec.uc-defaultblock {
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
  box-sizing: border-box !important;
}


/* =========================================
   PROMO-КАТАЛОГ НА ВСЮ ШИРИНУ ЭКРАНА
   + КОНТЕНТ ПО СЕТКЕ
   + СКРЫТИЕ КНОПКИ "ЗАГРУЗИТЬ ЕЩЁ"
   ========================================= */

/*
  Как использовать:

  На каталожный блок Tilda нужно добавить класс:

  uc-catalogpromo

  Этот класс делает:
  1. фон блока на всю ширину экрана;
  2. контент внутри по нашей сетке;
  3. заголовок по одной линии с карточками;
  4. скрывает кнопку "Загрузить ещё".
*/


/* =========================================
   1. САМ БЛОК НА ВСЮ ШИРИНУ ЭКРАНА
   ========================================= */

#allrecords .t-rec.uc-catalogpromo {
  width: 100vw !important;
  max-width: none !important;

  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;

  box-sizing: border-box !important;
}


/* =========================================
   2. ВНУТРЕННИЕ ОБЁРТКИ КАТАЛОГА ПО НАШЕЙ СЕТКЕ
   ========================================= */

/*
  Эти обёртки держат заголовок, фильтры и карточки.
  Они остаются внутри контейнера 1600px,
  а боковые отступы берут из --site-padding:
  30px / 20px / 16px.
*/

#allrecords
.t-rec.uc-catalogpromo
.t1291
> .t-catalog__grid-cont,

#allrecords
.t-rec.uc-catalogpromo
.t-catalog-parts-above__container,

#allrecords
.t-rec.uc-catalogpromo
.t-catalog__cont-w-filter {
  width: 100% !important;
  max-width: var(--site-container) !important;

  margin-left: auto !important;
  margin-right: auto !important;

  padding-left: var(--site-padding) !important;
  padding-right: var(--site-padding) !important;

  box-sizing: border-box !important;
}


/* =========================================
   3. ИСПРАВЛЕНИЕ ЗАГОЛОВКА PROMO-КАТАЛОГА
   ========================================= */

/*
  Важно:
  у .js-block-header в глобальной сетке уже может быть свой padding.
  Внутри uc-catalogpromo этот padding нужно убрать,
  потому что внешний .t-catalog__grid-cont уже имеет site-padding.

  Иначе получается двойной отступ:
  site-padding + site-padding.
*/

#allrecords
.t-rec.uc-catalogpromo
.t1291
> .t-catalog__grid-cont
> .js-block-header {
  width: 100% !important;
  max-width: 100% !important;

  margin-left: 0 !important;
  margin-right: 0 !important;

  padding-left: 0 !important;
  padding-right: 0 !important;

  box-sizing: border-box !important;
}


/*
  Убираем стандартные margin/padding у колонки Tilda внутри заголовка.
*/

#allrecords
.t-rec.uc-catalogpromo
.t1291
> .t-catalog__grid-cont
> .js-block-header
> .t-col {
  width: 100% !important;
  max-width: 100% !important;

  margin-left: 0 !important;
  margin-right: 0 !important;

  padding-left: 0 !important;
  padding-right: 0 !important;

  box-sizing: border-box !important;
}


/*
  Сам заголовок тоже страхуем от лишних отступов.
*/

#allrecords
.t-rec.uc-catalogpromo
.js-block-header-title {
  margin-left: 0 !important;
  margin-right: 0 !important;
}


/* =========================================
   4. СКРЫТИЕ КНОПКИ "ЗАГРУЗИТЬ ЕЩЁ"
   ========================================= */

#allrecords
.t-rec.uc-catalogpromo
.js-catalog-load-more-btn {
  display: none !important;
}


/*
  Скрываем контейнер кнопки,
  чтобы не оставалось пустого места внизу каталога.
*/

#allrecords
.t-rec.uc-catalogpromo
.t-catalog__pagination {
  display: none !important;
}


/* =========================================
   5. ЗАЩИТА ОТ ГОРИЗОНТАЛЬНОГО СКРОЛЛА
   ========================================= */

html,
body {
  overflow-x: hidden;
}


/* =========================================
   КНОПКИ В СТАНДАРТНЫХ КАТАЛОЖНЫХ БЛОКАХ
   Только планшеты и мобильные:
   текст слева, иконка справа
   ========================================= */

@media screen and (max-width: 1279px) {

  #allrecords
  .t-catalog__card__btn {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;

    width: 100% !important;
    max-width: 100% !important;

    box-sizing: border-box !important;

    flex-direction: row-reverse !important;

    padding: 4px 4px 4px 16px !important;
    gap: 8px !important;
  }

  #allrecords
  .t-catalog__card__btn
  .t-btnflex__text {
    flex: 1 1 auto !important;

    text-align: left !important;
    justify-content: flex-start !important;

    margin: 0 !important;
    padding: 0 !important;

    white-space: nowrap !important;
  }

  #allrecords
  .t-catalog__card__btn
  .t-btnflex__icon {
    flex: 0 0 36px !important;

    width: 36px !important;
    height: 36px !important;

    margin: 0 !important;
    padding: 0 !important;
  }

  #allrecords
  .t-catalog__card__btn.t-btnflex {
    justify-content: space-between !important;
  }
}