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

.catalog-page {
  min-height: 100vh;
  background: #fbfaf8;
}

.brand-rail {
  display: flex;
  justify-content: center;
  gap: clamp(28px, 4.5vw, 66px);
  min-height: 280px;
  padding: 58px 40px 42px;
  overflow-x: auto;
  scrollbar-width: none;
}

.brand-rail::-webkit-scrollbar {
  display: none;
}

.brand-filter {
  flex: 0 0 94px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 0 auto 16px;
  padding: 17px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
  transition: border-color 160ms ease, transform 160ms ease;
}

.brand-logo img {
  width: 100%;
  max-height: 45px;
  object-fit: contain;
}

.brand-filter:hover .brand-logo,
.brand-filter.is-active .brand-logo {
  border-color: var(--blue);
  transform: translateY(-2px);
}

.brand-filter span:last-child {
  display: block;
  font-size: 17px;
  line-height: 1.25;
}

.catalog-controls {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 0 40px;
  background: rgba(251, 250, 248, 0.96);
  border-top: 1px solid #e9e7e3;
  border-bottom: 1px solid #e9e7e3;
}

.filter-group,
.catalog-meta,
.sort-control {
  display: flex;
  align-items: center;
}

.filter-group {
  gap: 25px;
}

.catalog-meta {
  gap: 25px;
  font-size: 14px;
}

.filter-menu {
  position: relative;
}

.filter-menu summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  font-size: 14px;
  cursor: pointer;
}

.filter-menu summary::-webkit-details-marker {
  display: none;
}

.filter-menu summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.filter-menu[open] summary::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.filter-popover {
  position: absolute;
  top: calc(100% + 18px);
  left: -14px;
  min-width: 235px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.filter-popover label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  white-space: nowrap;
}

.filter-popover input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.price-filter .filter-popover {
  display: grid;
  gap: 10px;
}

.price-filter input {
  width: 105px;
  margin-left: auto;
  padding: 7px 8px;
  border: 1px solid var(--line);
}

.clear-filters {
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.sort-control {
  gap: 8px;
}

.sort-control select {
  max-width: 155px;
  padding: 6px 26px 6px 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 34px 20px;
  padding: 42px 40px 90px;
}

.catalog-card {
  position: relative;
  min-width: 0;
  text-align: center;
}

.catalog-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.catalog-media > a {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.catalog-media img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  transition: transform 220ms ease;
}

.catalog-card:hover .catalog-media img {
  transform: scale(1.035);
}

.catalog-add {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-height: 36px;
  padding: 0 15px;
  background: #fff;
  border: 1px solid #bbb8b2;
  border-radius: 2px;
  opacity: 0;
  cursor: pointer;
  transform: translateY(7px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.catalog-card:hover .catalog-add,
.catalog-add:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.catalog-card h2 {
  min-height: 44px;
  margin: 12px 0 3px;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.catalog-card > p {
  margin: 0;
  font-size: 17px;
}

.catalog-empty {
  padding: 80px 20px 140px;
  text-align: center;
}

.catalog-footer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 40px;
  min-height: 150px;
  padding: 35px 40px;
  background: #111;
  color: #fff;
}

.footer-brand {
  color: #fff;
}

.catalog-footer nav {
  display: flex;
  gap: 25px;
}

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

  .brand-rail {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .brand-rail {
    min-height: 176px;
    gap: 22px;
    padding: 27px 20px 24px;
  }

  .brand-filter {
    flex-basis: 74px;
  }

  .brand-logo {
    width: 66px;
    height: 66px;
    margin-bottom: 10px;
    padding: 13px;
  }

  .brand-filter span:last-child {
    font-size: 13px;
  }

  .catalog-controls {
    align-items: stretch;
    min-height: 0;
    padding: 0;
  }

  .filter-group {
    width: 100%;
    gap: 0;
  }

  .filter-menu {
    flex: 1;
  }

  .filter-menu summary {
    justify-content: center;
    min-height: 52px;
    border-right: 1px solid var(--line);
    font-size: 12px;
  }

  .filter-popover {
    position: fixed;
    top: 79px;
    right: 12px;
    left: 12px;
    min-width: 0;
  }

  .clear-filters,
  .catalog-meta > span {
    display: none;
  }

  .catalog-meta {
    border-left: 1px solid var(--line);
  }

  .sort-control span {
    display: none;
  }

  .sort-control select {
    width: 104px;
    height: 52px;
    font-size: 12px;
  }

  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 10px;
    padding: 24px 12px 60px;
  }

  .catalog-add {
    right: 7px;
    bottom: 7px;
    min-height: 32px;
    padding: 0 10px;
    opacity: 1;
    font-size: 12px;
    transform: none;
  }

  .catalog-card h2 {
    min-height: 40px;
    margin-top: 8px;
    font-size: 14px;
  }

  .catalog-card > p {
    font-size: 14px;
  }

  .catalog-footer {
    grid-template-columns: 1fr;
    gap: 22px;
    text-align: center;
  }

  .catalog-footer .brand,
  .catalog-footer nav {
    justify-content: center;
  }

  .catalog-footer nav {
    flex-wrap: wrap;
  }
}
