/* ==========================================================================
   Бренды в секции материалов
   ========================================================================== */

.brands-showcase {
    position: relative;
    isolation: isolate;
    overflow: hidden;

    margin-top: 48px;
    padding: 28px;

    border: 1px solid rgba(15, 94, 170, 0.14);
    border-radius: 28px;

    background:
        radial-gradient(
            circle at 92% 0%,
            rgba(112, 184, 239, 0.17),
            transparent 34%
        ),
        linear-gradient(145deg, #ffffff, #f7fbfe);

    box-shadow: 0 18px 48px rgba(16, 63, 98, 0.075);
}

.brands-showcase::before {
    content: "";

    position: absolute;
    z-index: -1;
    top: -110px;
    right: -80px;

    width: 260px;
    height: 260px;

    border: 1px solid rgba(15, 94, 170, 0.08);
    border-radius: 50%;
}

.brands-showcase__heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.62fr);
    align-items: end;
    gap: 36px;

    margin-bottom: 24px;
}

.brands-showcase__label {
    display: block;
    margin-bottom: 6px;

    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brands-showcase__heading h3 {
    max-width: 650px;
    margin: 0;

    font-size: clamp(1.35rem, 2.1vw, 2rem);
    line-height: 1.16;
}

.brands-showcase__heading p {
    margin: 0;

    font-size: 0.9rem;
    line-height: 1.55;
}

.brand-logo-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;

    margin: 0;
    padding: 0;

    list-style: none;
}

.brand-logo-card {
    position: relative;
    overflow: hidden;

    display: grid;
    place-items: center;

    min-width: 0;
    min-height: 118px;
    padding: 16px;

    border: 1px solid #d9e6ef;
    border-radius: 18px;

    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 7px 22px rgba(16, 63, 98, 0.045);

    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        background 0.22s ease;
}

.brand-logo-card::after {
    content: "";

    position: absolute;
    inset: auto 18px 0;

    height: 2px;

    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);

    opacity: 0;
    transform: scaleX(0.35);

    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

.brand-logo-card img {
    width: 100%;
    max-width: 190px;
    height: 76px;

    object-fit: contain;

    opacity: 0.82;
    filter: saturate(0.78);

    transition:
        opacity 0.22s ease,
        filter 0.22s ease,
        transform 0.22s ease;
}

@media (hover: hover) and (pointer: fine) {
    .brand-logo-card:hover {
        border-color: rgba(15, 94, 170, 0.26);
        background: #ffffff;
        box-shadow: 0 15px 34px rgba(16, 63, 98, 0.1);

        transform: translateY(-4px);
    }

    .brand-logo-card:hover::after {
        opacity: 1;
        transform: scaleX(1);
    }

    .brand-logo-card:hover img {
        opacity: 1;
        filter: saturate(1);
        transform: scale(1.045);
    }
}

@media (max-width: 1080px) {
    .brand-logo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .brands-showcase {
        margin-top: 36px;
        padding: 23px 20px 20px;
        border-radius: 22px;
    }

    .brands-showcase__heading {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .brand-logo-grid {
        grid-auto-flow: column;
        grid-auto-columns: minmax(168px, 72vw);
        grid-template-columns: none;
        gap: 10px;

        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: inline mandatory;
        scrollbar-width: thin;

        margin-inline: -4px;
        padding: 4px 4px 12px;
    }

    .brand-logo-card {
        min-height: 108px;
        scroll-snap-align: start;
    }

    .brand-logo-card img {
        max-width: 175px;
        height: 70px;
        opacity: 1;
        filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .brand-logo-card,
    .brand-logo-card::after,
    .brand-logo-card img {
        transition: none !important;
    }

    .brand-logo-card:hover,
    .brand-logo-card:hover img {
        transform: none !important;
    }
}

/* ==========================================================================
   Ассортимент: мобильная сетка брендов
   ========================================================================== */

/*
 * На компьютере сохраняем прежний вид:
 * дополнительные подписи не отображаются.
 */
#materials .brands-showcase--mobile-grid .brand-logo-card__name {
  display: none;
}

@media (max-width: 760px) {
  /* Внешний блок */
  #materials .brands-showcase--mobile-grid {
    padding: 20px 16px 16px;

    border-radius: 20px;

    background: #ffffff;
    box-shadow: none;
  }

  #materials .brands-showcase--mobile-grid::before {
    display: none;
  }

  /* Заголовок и пояснение */
  #materials .brands-showcase--mobile-grid .brands-showcase__heading {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 10px;

    margin-bottom: 16px;
  }

  #materials .brands-showcase--mobile-grid .brands-showcase__heading h3 {
    margin: 0;

    font-size: clamp(1.25rem, 5vw, 1.6rem);
    line-height: 1.2;
    text-wrap: balance;
  }

  #materials .brands-showcase--mobile-grid .brands-showcase__heading p {
    margin: 0;

    font-size: 0.875rem;
    line-height: 1.55;
  }

  /*
   * Две колонки вместо горизонтальной ленты.
   * Все бренды размещаются в обычных строках.
   */
  #materials .brands-showcase--mobile-grid .brand-logo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 10px;

    min-width: 0;
    width: 100%;

    margin: 0;
    padding: 0;

    overflow: visible;
    scroll-snap-type: none;

    list-style: none;
  }

  /* Одинаковое оформление карточек */
  #materials .brands-showcase--mobile-grid .brand-logo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;

    grid-column: auto;

    min-width: 0;
    min-height: 104px;

    margin: 0;
    padding: 12px 10px;

    border: 1px solid #dce6ef;
    border-radius: 14px;

    background: #ffffff;

    box-shadow: none;
    transform: none;
    transition: none;

    cursor: default;
  }

  #materials .brands-showcase--mobile-grid .brand-logo-card::after {
    display: none;
  }

  /* Логотипы сразу цветные, без эффектов наведения */
  #materials .brands-showcase--mobile-grid .brand-logo-card img {
    width: 100%;
    max-width: 180px;
    height: 50px;

    object-fit: contain;

    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }

  /* Подпись помогает распознать даже небольшой логотип */
  #materials .brands-showcase--mobile-grid .brand-logo-card__name {
    display: block;

    max-width: 100%;

    color: var(--color-text-muted);

    font-size: 0.75rem;
    font-weight: 650;
    line-height: 1.35;

    text-align: center;
    overflow-wrap: anywhere;
  }
}

/* Более узкие телефоны */
@media (max-width: 380px) {
  #materials .brands-showcase--mobile-grid {
    padding: 18px 12px 12px;
  }

  #materials .brands-showcase--mobile-grid .brand-logo-grid {
    gap: 8px;
  }
}
