/* Brand directory (/catalog/brands) and brand landing (/catalog/brands/:slug). */

.brands-page,
.brand-page {
  gap: var(--store-space-8);
}

.brands-page .catalog-breadcrumbs,
.brand-page .catalog-breadcrumbs {
  font-size: 14px;
  color: var(--store-muted);
}

.brands-page .catalog-breadcrumbs a,
.brand-page .catalog-breadcrumbs a {
  color: inherit;
  text-decoration: none;
  transition: color var(--store-transition);
}

.brands-page .catalog-breadcrumbs a:hover,
.brand-page .catalog-breadcrumbs a:hover {
  color: var(--store-blue);
}

.brands-page .catalog-breadcrumbs [aria-current="page"],
.brand-page .catalog-breadcrumbs [aria-current="page"] {
  color: var(--store-text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Directory ---------- */

.brands-page__head {
  display: flex;
  flex-direction: column;
  gap: var(--store-space-3);
  width: 100%;
}

.brands-page__title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--store-space-3) var(--store-space-4);
}

.brands-page__count {
  font-size: 15px;
  font-weight: 600;
  color: var(--store-muted);
  font-variant-numeric: tabular-nums;
}

.brands-page__lead {
  margin: 0;
  max-width: 62ch;
  font-size: 16px;
  line-height: 1.55;
  color: var(--store-muted);
}

.brands-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--store-space-3);
  width: 100%;
}

.brands-search {
  position: relative;
  flex: 1 1 360px;
  max-width: 560px;
}

.brands-search__icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--store-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.brands-search__input {
  width: 100%;
  height: var(--store-control-height);
  padding: 0 16px 0 46px;
  font-size: 16px;
  color: var(--store-text);
  background: var(--store-field);
  border: 1px solid var(--store-field-border);
  border-radius: var(--store-radius-md);
  box-sizing: border-box;
  transition: border-color var(--store-transition), background-color var(--store-transition);
}

.brands-search__input::placeholder {
  color: var(--store-muted);
}

.brands-search__input:focus {
  outline: none;
  background: var(--store-surface);
  border-color: var(--store-blue);
}

.brands-sort {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--store-field);
  border: 1px solid var(--store-field-border);
  border-radius: var(--store-radius-md);
}

.brands-sort__btn {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--store-muted);
  background: transparent;
  border: 0;
  border-radius: var(--store-radius-sm);
  cursor: pointer;
  transition: background-color var(--store-transition), color var(--store-transition);
}

.brands-sort__btn:hover {
  color: var(--store-text);
}

.brands-sort__btn.is-active {
  color: var(--store-text);
  background: var(--store-surface);
  box-shadow: 0 1px 2px rgba(26, 26, 26, 0.08);
}

.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--store-space-4);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.brand-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--store-surface);
  border: 1px solid var(--store-border);
  border-radius: var(--store-radius-lg);
  transition: border-color var(--store-transition), transform var(--store-transition), box-shadow var(--store-transition);
}

.brand-card__link:hover {
  border-color: var(--store-field-border);
  box-shadow: 0 12px 28px -18px rgba(47, 47, 187, 0.35);
  transform: translateY(-2px);
}

.brand-card__link:active {
  transform: translateY(0) scale(0.99);
}

.brand-card__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 5 / 3;
  padding: var(--store-space-4);
  background: #f5f5f7;
}

.brand-card__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-card__logo--text {
  font-size: 22px;
  font-weight: 700;
  color: var(--store-text);
}

.brand-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--store-space-4);
}

.brand-card__name {
  font-size: 17px;
  font-weight: 700;
  color: var(--store-text);
}

.brand-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--store-blue);
  font-variant-numeric: tabular-nums;
}

.brand-card__meta span + span {
  color: var(--store-muted);
  font-weight: 500;
}

.brand-card__cats {
  font-size: 13px;
  line-height: 1.45;
  color: var(--store-muted);
}

.brands-empty {
  width: 100%;
  margin: 0;
  padding: var(--store-space-10) var(--store-space-4);
  font-size: 16px;
  text-align: center;
  color: var(--store-muted);
  background: var(--store-field);
  border-radius: var(--store-radius-lg);
}

/* ---------- Brand landing ---------- */

.brand-hero {
  display: grid;
  grid-template-columns: minmax(240px, 380px) minmax(0, 1fr);
  align-items: center;
  gap: var(--store-space-10);
  width: 100%;
  padding: var(--store-space-6);
  background: var(--store-field);
  border: 1px solid var(--store-field-border);
  border-radius: var(--store-radius-xl);
  box-sizing: border-box;
}

.brand-hero__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 5 / 3;
  padding: var(--store-space-6);
  background: var(--store-surface);
  border-radius: var(--store-radius-lg);
  box-shadow: 0 1px 2px rgba(26, 26, 26, 0.05);
}

.brand-hero__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-hero__logo--text {
  font-size: 36px;
  font-weight: 800;
}

.brand-hero__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--store-space-3);
  min-width: 0;
}

.brand-hero__eyebrow {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--store-blue);
  background: var(--store-surface);
  border-radius: 999px;
}

.brand-page .brand-hero__title {
  white-space: normal;
}

.brand-hero__lead {
  margin: 0;
  max-width: 64ch;
  font-size: 16px;
  line-height: 1.55;
  color: var(--store-muted);
}

.brand-hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--store-space-3);
  margin: var(--store-space-2) 0 0;
}

.brand-hero__fact {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  min-width: 120px;
  padding: var(--store-space-3) var(--store-space-4);
  background: var(--store-surface);
  border-radius: var(--store-radius-md);
}

.brand-hero__fact dd {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--store-text);
  font-variant-numeric: tabular-nums;
}

.brand-hero__fact dt {
  font-size: 13px;
  color: var(--store-muted);
}

.brand-hero__back {
  margin-top: var(--store-space-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--store-blue);
  text-decoration: none;
}

.brand-hero__back:hover {
  text-decoration: underline;
}

.brand-products,
.brand-about {
  display: flex;
  flex-direction: column;
  gap: var(--store-space-5);
  width: 100%;
}

.brand-section__title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--store-text);
}

.brand-chips {
  display: flex;
  gap: var(--store-space-2);
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.brand-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--store-text);
  background: var(--store-surface);
  border: 1px solid var(--store-field-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--store-transition), border-color var(--store-transition), color var(--store-transition);
}

.brand-chip:hover {
  border-color: var(--store-blue);
}

.brand-chip.is-active {
  color: #fff;
  background: var(--store-blue);
  border-color: var(--store-blue);
}

.brand-chip__count {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.brand-page .catalog-products {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.brand-products__more {
  align-self: center;
  height: var(--store-control-height);
  padding: 0 32px;
  font-size: 15px;
  font-weight: 700;
  color: var(--store-blue);
  background: var(--store-surface);
  border: 1px solid var(--store-blue);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--store-transition), color var(--store-transition);
}

.brand-products__more:hover {
  color: #fff;
  background: var(--store-blue);
}

.brand-products__more:disabled {
  opacity: 0.6;
  cursor: progress;
}

.brand-about {
  max-width: var(--store-readable);
}

.brand-about__text {
  font-size: 16px;
  line-height: 1.65;
  color: var(--store-text);
}

.brand-about__text p {
  margin: 0 0 var(--store-space-3);
}

.brand-about__text h3 {
  margin: var(--store-space-6) 0 var(--store-space-3);
  font-size: 18px;
  font-weight: 700;
}

.brand-about__range {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--store-border);
}

.brand-about__range li {
  display: flex;
  justify-content: space-between;
  gap: var(--store-space-4);
  padding: var(--store-space-3) 0;
  border-bottom: 1px solid var(--store-border);
}

.brand-about__cat {
  font-weight: 600;
}

.brand-about__cat-meta {
  color: var(--store-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.brand-about__popular {
  margin: 0;
  padding-left: 20px;
}

.brand-about__popular li + li {
  margin-top: 6px;
}

.brand-about__popular a {
  color: var(--store-blue);
  text-decoration: none;
}

.brand-about__popular a:hover {
  text-decoration: underline;
}

@media (max-width: 1440px) {
  .brand-page .catalog-products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

@media (max-width: 900px) {
  .brands-page,
  .brand-page {
    gap: var(--store-space-6);
  }

  .brand-hero {
    grid-template-columns: 1fr;
    gap: var(--store-space-5);
    padding: var(--store-space-4);
  }

  .brand-hero__logo {
    max-width: 360px;
    width: 100%;
    justify-self: center;
  }

  .brands-search {
    flex-basis: 100%;
    max-width: none;
  }

  .brand-section__title {
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  .brands-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--store-space-3);
  }

  .brand-card__body {
    padding: var(--store-space-3);
  }

  .brand-card__cats {
    display: none;
  }

  .brand-page .catalog-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-hero__fact {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: var(--store-space-3);
  }

  .brand-hero__fact dd {
    font-size: 16px;
    white-space: nowrap;
  }

  .brand-about__range li {
    flex-direction: column;
    gap: 2px;
  }

  .brand-about__cat-meta {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-card__link {
    transition: none;
  }

  .brand-card__link:hover {
    transform: none;
  }
}
