/* =========================================================
   Общие служебные правила
   ========================================================= */


[hidden] {
  display: none !important;
}

.header-cart__count {
  display: inline-grid;
  place-items: center;
}

.header-cart__count[hidden] {
  display: none !important;
}


/* =========================================================
   Карточка товара
   ========================================================= */

.product-grid {
  align-items: stretch;
}

.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: none;
  transform: none !important;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.product-card:hover,
.product-card:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: none !important;
}

/*
 * Рамка теперь находится вокруг всей карточки,
 * поэтому у самой области фотографии рамки нет.
 */
.product-card__image {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
  text-decoration: none;
}

.product-card__image:hover,
.product-card__image:focus-visible {
  border-color: transparent;
  box-shadow: none !important;
}

/*
 * Фотографии накладываются друг на друга.
 * Показывается только выбранная фотография.
 */
.product-card__gallery-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  visibility: hidden;
  transform: none;
  image-rendering: auto;
  backface-visibility: hidden;
  transition: opacity 0.12s ease;
}

.product-card__gallery-image.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
}

/*
 * Если исходное изображение имеет соотношение 3:4,
 * оно занимает область без обрезания и без увеличения
 * небольшой миниатюры.
 */
.product-card__image > img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center;
}

.product-card__gallery-progress {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 10px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.product-card__image:hover .product-card__gallery-progress,
.product-card__image:focus-visible .product-card__gallery-progress {
  opacity: 1;
}

.product-card__gallery-dot {
  display: block;
  width: 16px;
  height: 3px;
  border-radius: 10px;
  background: rgba(39, 33, 38, 0.25);
  transition:
    width 0.15s ease,
    background-color 0.15s ease;
}

.product-card__gallery-dot.is-active {
  width: 25px;
  background: var(--accent);
}

.product-card__placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #cdb5bf;
  font: 100px Georgia, serif;
}

/*
 * Body растягивается на доступную высоту.
 * Блок покупки прижимается вниз через margin-top:auto.
 */
.product-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 14px;
}

.product-card__title {
  display: block;
  min-height: 0;
  overflow: visible;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-decoration: none;
  -webkit-line-clamp: unset;
  -webkit-box-orient: initial;
}

.product-card__title:hover {
  color: var(--accent);
}

.product-card__purchase {
  margin-top: auto;
  padding-top: 14px;
}

.product-card__price {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.product-card__cart {
  position: relative;
  min-width: 0;
}

.product-card__buy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  color: var(--white);
  background: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.product-card__buy-button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.product-card__buy-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.product-card__quantity {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  width: 100%;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--white);
}

.product-card__quantity-button {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: var(--white);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.product-card__quantity-button:hover {
  color: var(--white);
  background: var(--accent);
}

.product-card__quantity-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.product-card__quantity-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 5px;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.product-card__quantity-input::-webkit-outer-spin-button,
.product-card__quantity-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.product-card__quantity-input:focus {
  position: relative;
  z-index: 2;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.product-card__cart-status {
  display: block;
  min-height: 0;
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.product-card__cart-status:not(:empty) {
  min-height: 17px;
  margin-top: 6px;
}

.product-card__cart-status.is-error {
  color: #a02032;
}

.product-card__unavailable {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.product-card__cart.is-pending {
  cursor: wait;
}


/* =========================================================
   Подкатегории
   ========================================================= */

.subcollections {
  margin-bottom: 30px;
}

.subcollections__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.subcategory-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 80px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--white);
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.subcategory-card:hover,
.subcategory-card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.subcategory-card span:first-child {
  font-weight: 700;
}

.subcategory-card span:last-child {
  color: var(--accent);
  font-size: 20px;
}


/* =========================================================
   Фильтры
   ========================================================= */

.catalog-filter-toggle {
  display: none;
}

.catalog-sidebar {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.catalog-filter {
  display: block;
}

.catalog-filter__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 19px 18px;
  border-bottom: 1px solid var(--line);
}

.catalog-filter__header h2 {
  margin: 0;
  font-size: 18px;
}

.catalog-filter__close {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 28px;
  line-height: 1;
}

.catalog-filter__items {
  padding: 0 18px;
}

.catalog-filter__loading {
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.catalog-filter__controls {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.catalog-filter__controls .button {
  width: 100%;
}

.catalog-filter__reset {
  display: block;
  color: var(--accent);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}

.filter-item {
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.filter-item:last-child {
  border-bottom: 0;
}

.filter-item__head {
  margin-bottom: 12px;
}

.filter-item__name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.filter-item__list {
  display: grid;
  gap: 9px;
}

.filter-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.filter-option__field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.filter-option__content {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-height: 22px;
  padding-left: 30px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.filter-option__content::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 18px;
  height: 18px;
  border: 1px solid #cfc3c8;
  border-radius: 4px;
  background: var(--white);
}

.filter-option__content::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 4px;
  width: 10px;
  height: 6px;
  border-bottom: 2px solid var(--white);
  border-left: 2px solid var(--white);
  opacity: 0;
  transform: rotate(-45deg);
}

.filter-option__field:checked + .filter-option__content::before {
  border-color: var(--accent);
  background: var(--accent);
}

.filter-option__field:checked + .filter-option__content::after {
  opacity: 1;
}

.filter-option__field:focus-visible + .filter-option__content::before {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter-range__values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.filter-range__values-item {
  display: grid;
  gap: 5px;
}

.filter-range__values-label {
  color: var(--muted);
  font-size: 12px;
}

.filter-range__input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 8px 9px;
  border: 1px solid #d7ccd0;
  border-radius: 7px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 13px;
}

.filter-range__input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(120, 46, 73, 0.14);
}

.catalog-filter-overlay {
  display: none;
}


/* =========================================================
   Описание категории после товаров
   ========================================================= */

.collection-description {
  max-width: 900px;
  margin-top: 60px;
  padding-top: 35px;
  border-top: 1px solid var(--line);
}

.collection-description h2 {
  margin: 0 0 20px;
  font: 400 clamp(27px, 3vw, 38px)/1.2 Georgia, serif;
}


/* =========================================================
   Адаптивная версия
   ========================================================= */

@media (max-width: 1050px) {
  .subcollections__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .catalog-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    margin-bottom: 18px;
    padding: 10px 16px;
    border: 1px solid var(--accent);
    border-radius: 9px;
    color: var(--accent);
    background: var(--white);
    font: inherit;
    font-weight: 700;
  }

  .catalog-sidebar {
    position: fixed;
    z-index: 101;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 370px);
    max-height: 100vh;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    box-shadow: 15px 0 40px rgba(39, 33, 38, 0.2);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  .catalog-sidebar.is-open {
    transform: translateX(0);
  }

  .catalog-filter__header {
    position: sticky;
    z-index: 4;
    top: 0;
    background: var(--white);
  }

  .catalog-filter__close {
    display: block;
  }

  .catalog-filter__controls {
    position: sticky;
    z-index: 4;
    bottom: 0;
    background: var(--white);
  }

  .catalog-filter-overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: block;
    background: rgba(39, 33, 38, 0.48);
  }

  .catalog-filter-overlay[hidden] {
    display: none !important;
  }

  body.filter-is-open {
    overflow: hidden;
  }
}

@media (max-width: 520px) {
  .subcollections__grid {
    grid-template-columns: 1fr;
  }

  .subcategory-card {
    min-height: 68px;
  }

  .product-card__body {
    padding: 10px;
  }

  .product-card__title {
    font-size: 13px;
    line-height: 1.4;
  }

  .product-card__purchase {
    padding-top: 11px;
  }

  .product-card__price {
    margin-bottom: 8px;
    font-size: 17px;
  }

  .product-card__buy-button {
    min-height: 40px;
    padding: 8px;
    font-size: 12px;
  }

  .product-card__quantity {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    min-height: 40px;
  }

  .product-card__quantity-input {
    height: 38px;
    font-size: 14px;
  }

  .product-card__quantity-button {
    font-size: 19px;
  }

  .product-card__gallery-progress {
    right: 7px;
    bottom: 6px;
    left: 7px;
    gap: 3px;
  }

  .product-card__gallery-dot {
    width: 9px;
    height: 2px;
  }

  .product-card__gallery-dot.is-active {
    width: 15px;
  }
}

@media (hover: none) {
  .product-card:hover {
    transform: none !important;
  }

  .product-card__gallery-progress {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-card,
  .product-card__gallery-image,
  .catalog-sidebar {
    transition: none;
  }
}
/* Навигация по каталогу в левой колонке */
.sidebar-catalog {
  display: grid;
  gap: 4px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-catalog__title {
  margin: 0 0 10px;
  font-size: 18px;
}

.sidebar-catalog a {
  display: block;
  padding: 7px 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}

.sidebar-catalog a:hover,
.sidebar-catalog a[aria-current="page"] {
  color: var(--accent);
}

.sidebar-catalog a[aria-current="page"] {
  font-weight: 700;
}

.sidebar-catalog .sidebar-catalog__child {
  padding-left: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* До 820 px панель открывается кнопкой — без промежутка 721–820 px */
@media (max-width: 820px) {
  .catalog-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    margin-bottom: 18px;
    border: 1px solid var(--accent);
    border-radius: 9px;
    color: var(--accent);
    background: var(--white);
    font-weight: 700;
  }

  .catalog-sidebar {
    position: fixed;
    z-index: 101;
    top: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: min(88vw, 370px);
    max-height: 100vh;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background: var(--white);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  .catalog-sidebar.is-open {
    transform: translateX(0);
  }

  .catalog-filter__close {
    display: block;
  }

  .catalog-filter-overlay:not([hidden]) {
    display: block;
  }
}
/* =========================================================
   Исправление высоты и обрезания боковой панели
   ========================================================= */

.catalog-layout {
  align-items: start;
}

.catalog-sidebar {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

.catalog-filter {
  display: block;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

.catalog-filter__items {
  display: block;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 18px;
  overflow: visible !important;
}

.filter-item,
.filter-item__content,
.filter-range,
.filter-range__values {
  min-height: 0;
  overflow: visible !important;
}

.filter-item_price {
  padding-bottom: 20px;
}

.filter-range__values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
  width: 100%;
}

.filter-range__values-item {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.filter-range__input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d7ccd0;
  border-radius: 7px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
}

.filter-range__input:disabled {
  color: var(--ink);
  background: var(--white);
  cursor: text;
  opacity: 1;
}

.catalog-filter__controls {
  position: relative;
  z-index: 1;
  clear: both;
  background: var(--white);
}
@media (max-width: 820px) {
  .catalog-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  .catalog-filter {
    min-height: 100%;
    overflow: visible !important;
  }

  .catalog-filter__items {
    overflow: visible !important;
  }

  .catalog-filter__controls {
    position: sticky;
    z-index: 5;
    bottom: 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--white);
  }
}
.header-cart {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* Убирает старый квадратик, если он выводится через псевдоэлемент */
.header-cart::before {
  display: none !important;
  content: none !important;
}

.header-cart__basket-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: currentColor;
}

.header-cart__basket-icon::before,
.header-cart__basket-icon::after {
  display: none !important;
  content: none !important;
}

.header-cart__basket-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Контур и нижние скругления меню каталога */
@media (min-width:721px){
  .catalog-sidebar{
    position:relative!important;
    border:0!important;
    border-radius:14px!important;
    background:#fff!important
  }

  .catalog-sidebar:after{
    content:"";
    position:absolute;
    z-index:50;
    inset:0;
    border:1px solid var(--line,#e9e1e2);
    border-radius:14px;
    pointer-events:none
  }

  .catalog-sidebar__section:last-child,
  .catalog-sidebar__section:last-child .catalog-filter,
  .catalog-sidebar__section:last-child .catalog-filter__actions,
  .catalog-sidebar__section:last-child .catalog-filter__footer{
    border-radius:0 0 13px 13px!important
  }
}
