/*
 * Brand switcher of the brand pages (shop-brands.js): the shop brands grouped in Gioielli and Orologi, shown as
 * unframed uniform navy logos.
 */

.brand-chooser.mb-ready {
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  border-bottom: 1px solid #e4dfd6 !important;
  background: #fff !important;
}

.brand-chooser.mb-ready > .chooser-heading,
.brand-chooser.mb-ready > .brand-tabs {
  display: none !important;
}

.mb-switcher {
  --mb-navy: #202043;
  --mb-line: #e4dfd6;
  --mb-beige: #f6f3ee;
  --mb-gold: #c6a856;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: end;
  max-width: 1400px;
  margin: 0 auto;
  padding: 26px max(20px, 4vw) 26px;
}

.mb-groups {
  display: grid;
  grid-template-columns: 4fr 2fr;
  gap: 20px;
  min-width: 0;
}

.mb-group {
  min-width: 0;
}

.mb-group-label {
  margin: 0 0 8px;
  color: #8a8069;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.mb-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
}

.mb-group--orologi .mb-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mb-row li {
  display: flex;
  min-width: 0;
}

.mb-tab {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 82px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--mb-navy);
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.mb-tab img {
  display: block;
  width: min(100%, 180px);
  height: 60px;
  aspect-ratio: auto;
  object-fit: contain;
  opacity: 0.5;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mb-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--mb-gold);
  transform: scaleX(0);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mb-tab:hover img,
.mb-tab:focus-visible img {
  opacity: 1;
  transform: scale(1.04);
}

.mb-tab:hover::after,
.mb-tab:focus-visible::after {
  transform: scaleX(0.4);
}

.mb-tab.is-active {
  background: transparent;
}

.mb-tab.is-active img {
  opacity: 1;
}

.mb-tab.is-active::after {
  transform: scaleX(1);
}

.mb-tab:focus-visible {
  outline: 2px solid var(--mb-gold);
  outline-offset: -2px;
}

@media (max-width: 1100px) {
  .mb-switcher {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

}

@media (max-width: 750px) {
  .mb-switcher {
    padding: 20px 16px 22px;
  }

  .mb-groups {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .mb-row {
    grid-template-columns: none;
    grid-auto-columns: 132px;
    grid-auto-flow: column;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .mb-row::-webkit-scrollbar {
    display: none;
  }

  .mb-row li {
    scroll-snap-align: start;
  }

  /* Two watch brands: they share the row instead of leaving an empty space. */
  .mb-group--orologi .mb-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-columns: auto;
    grid-auto-flow: row;
  }

  /* The section on screen comes first. */
  .mb-area-orologi .mb-group--orologi {
    order: -1;
  }

  .mb-tab {
    min-height: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mb-tab,
  .mb-tab img,
  .mb-tab::after {
    transition: none;
  }
}
