/* ==========================================================================
   Блок: 3 — Каталог по брендам
   Figma: 50:933   — десктоп 1320 × 611 (собственных вертикальных полей нет)
          270:3064 — мобильный 375 × 1024
   ========================================================================== */

/* Заголовок и блок «не нашли материал» стоят в одном ряду,
   вкладки переносятся на следующий. На мобильном порядок меняется
   через order — там блок «не нашли» уходит под панель */
.brands__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-pad);
}

.brands .section-head {
    flex: 0 1 645px;
}

/* --------------------------------------------------------------------------
   Блок «не нашли материал»
   -------------------------------------------------------------------------- */

.brands__aside {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 21px;
    flex: 0 0 448px;
    margin-left: auto;
    padding-left: 24px;
    border-left: 1px solid var(--c-grey-300);
}

.brands__aside-text {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--c-grey-500);
}

/* --------------------------------------------------------------------------
   Вкладки брендов
   -------------------------------------------------------------------------- */

.brands__tabs {
    display: flex;
    flex: 0 0 100%;
    flex-direction: column;
    /* иначе минимальная ширина содержимого распирает блок
       и страница начинает ездить по горизонтали */
    min-width: 0;
    margin-top: 56px;
}

.brands__tabs-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    width: fit-content;
    max-width: 100%;
    background-color: var(--c-grey-200);
}

.brands__tab {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 48px;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 700;
    line-height: normal;
    white-space: nowrap;
    color: var(--c-grey-500);
    transition: background-color var(--transition), color var(--transition);
}

.brands__tab:hover {
    color: var(--c-grey-800);
}

.brands__tab.is-active {
    background-color: var(--c-grey-800);
    color: var(--c-white);
}

/* --------------------------------------------------------------------------
   Тёмная панель бренда
   Фон: сплошная заливка + радиальное свечение из макета
   -------------------------------------------------------------------------- */

.brands__panel {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 40px;
    background-color: #1a1a1c;
    background-image: url("../../img/brands-panel-glow.svg");
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.brands__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brands__brand-name {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 32px;
    font-weight: 700;
    line-height: normal;
    color: #ffffff;
}

/* По правке заказчика логотипы приводим к фирменным цветам. Панель тёмная,
   поэтому под каждый знак кладём светлую плашку (как в каталоге), чтобы цвет
   читался. */
.brands__brand-logo {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    height: 56px;
    padding: 0 18px;
    background-color: var(--c-grey-200);
    border-radius: 8px;
}

/* Квадратный знак (Tikkurila) собран из трёх слоёв (logo-stack из common.css):
   плашку делаем пошире, а сам знак центрируем фиксированным квадратом, чтобы
   рядом с широкими логотипами он не казался мелким */
.brands__brand-logo--stack {
    min-width: 96px;
}

.brands__brand-mark {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.brands__brand-mark img {
    width: 100%;
    height: 100%;
}

/* Горизонтальные логотипы остальных брендов — в них уже есть название,
   поэтому текстовый заголовок рядом не выводим */
.brands__brand-logo--wide img {
    width: auto;
    height: auto;
    max-width: 200px;
    max-height: 32px;
}

/* Растровые логотипы на белом фоне: режим darken сливает белое с плашкой
   Grey 200 и оставляет только сам знак — так же, как в каталоге */
.brands__brand-logo--blend img {
    mix-blend-mode: darken;
}

.brands__brand-name--logo-only .brands__brand-title {
    display: none;
}

/* Заголовок бренда: показывается только активный */
.brands__brand-name[hidden] {
    display: none;
}

/* В макете у этой кнопки боковые отступы 16px */
.brands__brand .btn {
    padding-left: 16px;
    padding-right: 16px;
}

/* --------------------------------------------------------------------------
   Колонки направлений
   -------------------------------------------------------------------------- */

.brands__cols {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 24px;
}

/* flex-basis держит удобную ширину колонки: у брендов с 2-3 направлениями
   они заполняют ряд, а у Primatek (5 направлений) лишние переносятся вниз */
.brand-col {
    display: flex;
    flex: 1 1 240px;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
    padding: 24px;
    background-color: #2f2f32;
}

.brand-col__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Заголовок направления — ссылка в каталог с выбранной поверхностью/видом */
.brand-col__title {
    font-size: 24px;
    font-weight: 700;
    line-height: normal;
    color: var(--c-white);
    text-decoration: none;
    transition: color var(--transition);
}

.brand-col__title:hover,
.brand-col__title:focus-visible {
    color: var(--c-red-400, #ff8e8e);
}

/* Разделитель: отрицательный отступ компенсирует высоту линии,
   чтобы шаг совпал с макетом (24 / 1 / 24) */
.brand-col__divider {
    height: 1px;
    margin-top: -1px;
    background-color: rgba(255, 255, 255, 0.2);
}

.brand-col__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Вложенная ссылка направления — ведёт в каталог с набором параметров */
.brand-col__link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 400;
    line-height: normal;
    color: var(--c-white);
    text-decoration: none;
    transition: color var(--transition);
}

.brand-col__link:hover,
.brand-col__link:focus-visible {
    color: var(--c-red-400, #ff8e8e);
}

.brand-col__list img {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
}

/* Только активная панель бренда видна; остальные переключает brands.js */
.brands__panel[hidden] {
    display: none;
}

/* --------------------------------------------------------------------------
   Планшет
   -------------------------------------------------------------------------- */

@media (max-width: 1279px) {
    .brands__aside {
        flex-basis: 360px;
    }

    .brand-col__title {
        font-size: 20px;
    }
}

@media (max-width: 1023px) {
    .brands__cols {
        flex-direction: column;
    }
}

/* --------------------------------------------------------------------------
   Мобильная версия — 375 × 1024
   Ритм: H2 (105) → 32 → вкладки (40) → 16 → панель (700) → 24 → «не нашли»
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    /* Блок «не нашли материал» уходит вниз, под панель */
    .brands__aside {
        order: 3;
        flex-basis: 100%;
        margin-top: 24px;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }

    .brands__tabs {
        order: 2;
        gap: 16px;
        margin-top: 32px;
    }

    /* Лента вкладок начинается по сетке, а справа уходит под край
       экрана и прокручивается по горизонтали */
    .brands__tabs-bar {
        gap: 4px;
        width: calc(100% + var(--container-pad));
        max-width: none;
        margin-right: calc(-1 * var(--container-pad));
        overflow-x: auto;
        scrollbar-width: none;
    }

    .brands__tabs-bar::-webkit-scrollbar {
        display: none;
    }

    .brands__tab {
        height: 40px;
        padding: 12px;
        font-size: 14px;
    }

    .brands__panel {
        gap: 24px;
        padding: 40px 16px;
    }

    .brands__brand-logo {
        height: 48px;
        padding: 0 14px;
    }

    .brands__brand-logo--stack {
        min-width: 80px;
    }

    .brands__brand-mark {
        width: 36px;
        height: 36px;
    }

    .brands__brand-logo--wide img {
        max-width: 140px;
        max-height: 28px;
    }

    .brands__brand-name {
        font-size: 20px;
    }

    .brands__brand .btn {
        height: 32px;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 12px;
    }

    .brands__cols {
        gap: 16px;
    }

    .brand-col {
        gap: 12px;
        padding: 16px;
    }

    .brand-col__title {
        font-size: 20px;
    }

    .brand-col__list li {
        font-size: 14px;
    }
}
