@media screen and (min-width: 981px) {
  .t-menuburger {
    display: none !important;
  }
}

/* 1. Скрываем чекбокс, его галочку и цветной кружок Tilda */
.t-catalog__filter__checkbox_color input[type="checkbox"],
.t-catalog__filter__checkbox_color .t-catalog__filter__checkmark_color,
.t-catalog__filter__checkbox_color .t-checkbox__indicator {
    display: none !important;
}

/* 2. Показываем и стилизуем текст названия цвета */
.t-catalog__filter__checkbox_color .t-catalog__filter__title_color {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    text-transform: none !important;
    pointer-events: none;
}

/* 3. Оформляем плашки-кнопки (теперь таргетируемся на label) */
label.t-catalog__filter__checkbox_color {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 9px 16px !important;
    margin: 0 6px 6px 0 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
    user-select: none !important;
}

/* 4. Стили при наведении */
label.t-catalog__filter__checkbox_color:hover {
    border-color: #000000 !important;
    background-color: #f5f5f5 !important;
}

/* 5. ПОДСВЕТКА ВЫБРАННОЙ КНОПКИ */
label.t-catalog__filter__checkbox_color:has(input:checked),
label.t-catalog__filter__checkbox_color.active,
label.t-catalog__filter__checkbox_color.t-catalog__filter__custom-sel_active {
    background-color: #000000 !important;
    border-color: #000000 !important;
}

/* Белый текст внутри выбранной кнопки */
label.t-catalog__filter__checkbox_color:has(input:checked) .t-catalog__filter__title_color,
label.t-catalog__filter__checkbox_color.active .t-catalog__filter__title_color,
label.t-catalog__filter__checkbox_color.t-catalog__filter__custom-sel_active .t-catalog__filter__title_color {
    color: #ffffff !important;
}

/* 6. Выравнивание кнопок */
.t-catalog__filter__item-controls-container_color {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}



document.addEventListener('DOMContentLoaded', function() {
    function bindColorActiveState() {
        // Ищем элементы с новыми классами чекбоксов
        var colorButtons = document.querySelectorAll('label.t-catalog__filter__checkbox_color');
        
        colorButtons.forEach(function(btn) {
            var chk = btn.querySelector('input[type="checkbox"]');
            
            // Проверяем состояние чекбокса и подсвечиваем плашку
            if (chk && chk.checked) {
                btn.classList.add('active');
            } else {
                btn.classList.remove('active');
            }
        });
    }

    bindColorActiveState();
    // Отслеживаем перерисовки DOM от Tilda при кликах
    setInterval(bindColorActiveState, 300);
});

/* 1. Задаем жесткие пропорции 3:4 для контейнера картинки */
.t-catalog__relevants__container .t-catalog__card__imgwrapper {
    padding-bottom: 133.33% !important; /* Ровно соотношение 3:4 */
    position: relative !important;
    overflow: hidden !important;
    background-color: #ffffff !important; /* Цвет фона, если фото узкое */
}

/* 2. Позиционируем само изображение строго внутри контейнера */
.t-catalog__relevants__container .t-catalog__card__bgimg,
.t-catalog__relevants__container .t-bgimg {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: contain !important; /* Полностью вписывает фото по высоте и ширине */
    background-repeat: no-repeat !important;
    background-position: center center !important;
}

.t-catalog__filter__item_color
.t-checkbox__control:nth-of-type(n+6) {
    display: none;
}

.t-catalog__filter__item_color.expanded
.t-checkbox__control:nth-of-type(n+6) {
    display: flex;
}
