.brands-section {
  width: var(--page-container-fluid);
  max-width: 100%;
  margin: var(--brands-section-offset-desktop) auto 0;
  color: var(--text-primary);
  background: var(--brands-section-background);
}

.brands-section__inner {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-inline: auto;
}

.alphabet-filter {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  min-height: 49px;
  padding-inline: var(--space-20);
  border: var(--stroke-1) solid var(--brands-border);
  border-radius: var(--radius-10);
  background: var(--brands-alphabet-background);
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.alphabet-filter::-webkit-scrollbar {
  display: none;
}

.alphabet-filter__indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: var(--radius-4);
  background: var(--brands-alphabet-active);
  opacity: 0;
  pointer-events: none;
  transform: translate(0, 0);
  transition: width var(--brands-transition) ease,
    height var(--brands-transition) ease,
    opacity var(--brands-transition) ease,
    transform var(--brands-transition) ease;
}

.alphabet-filter__indicator.is-positioning {
  transition: none;
}

.alphabet-filter__indicator.is-ready {
  opacity: 1;
}

.alphabet-filter__button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius-4);
  color: var(--text-primary);
  background: transparent;
  font-family: var(--font-main);
  font-size: 24px;
  font-style: normal;
  font-weight: 400;
  line-height: 100%;
  letter-spacing: 0;
  cursor: pointer;
  transition: color var(--brands-transition) ease,
    background-color var(--brands-transition) ease;
}

.alphabet-filter__button[data-brand-filter='popular'] {
  min-height: 40px;
  margin-left: calc(var(--space-10) * -1);
  margin-right: var(--space-8);
  padding: var(--space-6) var(--space-10);
  font-weight: 600;
}

.alphabet-filter__button:last-child {
  margin-right: calc(var(--space-10) * -1);
  padding-right: var(--space-10);
}

.alphabet-filter__button:hover:not(:disabled) {
  background: var(--brands-alphabet-hover);
}

.alphabet-filter__button.is-active,
.alphabet-filter__button[aria-pressed='true'] {
  color: var(--brands-alphabet-active-text);
  background: var(--brands-alphabet-active);
}

.brands-section.has-filter-indicator .alphabet-filter__button.is-active,
.brands-section.has-filter-indicator .alphabet-filter__button[aria-pressed='true'] {
  background: transparent;
}

.alphabet-filter__button:disabled {
  opacity: 0.35;
  cursor: default;
}

.alphabet-filter__button:focus-visible,
.brand-card:focus-visible {
  outline: 2px solid var(--brands-focus);
  outline-offset: 2px;
}

.brands-section__grid {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  align-content: start;
  min-height: 0;
  margin-top: 25px;
  gap: var(--space-22) var(--space-15);
  overflow: hidden;
  opacity: 1;
  transform: translateX(0);
  transition: height 320ms ease,
    opacity var(--brands-transition) ease,
    transform var(--brands-transition) ease;
}

.brands-section__grid.is-filtering {
  opacity: 0;
  transform: translateX(var(--space-8));
}

.brand-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  height: 70px;
  min-width: 0;
  padding: var(--space-12) var(--space-16);
  overflow: hidden;
  border: var(--stroke-1) solid var(--brands-border);
  border-radius: var(--radius-10);
  color: var(--text-primary);
  background: var(--brand-card-background);
  text-decoration: none;
  transition: background-color var(--brands-transition) ease,
    transform var(--brands-transition) ease;
}

.brand-card[hidden] {
  display: none;
}

.brand-card:hover {
  background: var(--brand-card-hover);
  transform: translateY(-2px);
}

.brand-card.is-active {
  color: var(--brand-card-active-text);
  background: var(--brand-card-active);
}

.brand-card__name {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font: 600 24px/1.1 var(--font-main);
  line-height: normal;
  text-align: center;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.brand-card__name.is-long {
  font-size: 20px;
}

.brand-card__name.is-very-long {
  width: 100%;
  max-width: 150px;
  font-size: 18px;
}

.brand-card__logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 80%;
  max-height: 36px;
  object-fit: contain;
}

.brands-section__empty {
  margin: 25px 0 0;
  color: var(--text-secondary);
  font: var(--desktop-small-regular);
}

@media (max-width: 1150px) and (min-width: 768px) {
  .brands-section__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .alphabet-filter {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: var(--space-4);
  }
}

@media (max-width: 767px) {
  .brands-section {
    width: var(--page-container-fluid);
    margin-top: var(--brands-section-offset-mobile);
  }

  .alphabet-filter {
    justify-content: flex-start;
    width: 100%;
    min-height: 40px;
    padding-block: var(--space-3);
    padding-inline: var(--space-3);
    flex-wrap: nowrap;
    gap: var(--space-3);
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: var(--radius-3);
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .alphabet-filter::-webkit-scrollbar {
    display: none;
  }

  .alphabet-filter__button {
    flex: 0 0 auto;
    min-width: 32px;
    min-height: 32px;
    padding: var(--space-0);
    border-radius: var(--radius-3);
    font: 400 14px/1 var(--font-main);
  }

  .alphabet-filter__button[data-brand-filter='popular'] {
    min-width: 88px;
    min-height: 32px;
    margin-left: 0;
    margin-right: 0;
    padding: var(--space-0) var(--space-3);
    font-weight: 600;
    white-space: nowrap;
  }

  .alphabet-filter__button:last-child {
    margin-right: 0;
    padding-right: var(--space-3);
  }

  .brands-section__grid {
    width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    margin-top: 10px;
    gap: var(--space-5);
  }

  .brand-card {
    min-width: 0;
    width: 100%;
    min-height: 52px;
    height: auto;
    padding: var(--space-8);
    border-radius: var(--radius-3);
  }

  .brand-card__name,
  .brand-card__name.is-long,
  .brand-card__name.is-very-long {
    font: 600 14px/1.2 var(--font-main);
  }

  .brand-card__name.is-very-long {
    font-size: 12px;
  }

  .brand-card__logo {
    max-height: 12px;
  }

  .brands-section__empty {
    margin-top: var(--space-20);
    font: var(--mobile-caption);
  }

.alphabet-filter__indicator {
  border-radius: var(--space-4);
}
}

@media (max-width: 336px) {
  .brands-section__grid {
    grid-template-columns: repeat(4, minmax(0, 57px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .alphabet-filter__indicator,
  .alphabet-filter__button,
  .brands-section__grid,
  .brand-card {
    transition: none;
  }
}
