/*
 * Шапка: раскладка, меню каталога (store navigation), карусель товаров,
 * переключатель валют YayCurrency. Перенесено 1:1 из FSE-шаблона Header (P2-1).
 */

.uc-header,
header.wp-block-template-part {
  width: 100vw;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 100;
}
.uc-header__content {
  grid-template-columns: 1fr repeat(3, 1px) auto;
  grid-template-rows: minmax(0, auto);
}
@media screen and (min-width: 640px) {
  .uc-header__content {
    grid-template-columns: 1fr repeat(2, 1px) 1fr auto;
  }
}
@media screen and (min-width: 960px) {
  .uc-header__content {
    grid-template-columns: repeat(2, minmax(25px, auto)) 1fr repeat(2, minmax(25px, auto));
    grid-template-rows: minmax(0, auto);
  }
}
.uc-header__navigation_desktop {
  display: none;
}
@media screen and (min-width: 960px) {
  .uc-header__navigation_desktop {
    display: flex;
  }
  .uc-header__navigation_mobile {
    display: none !important;
  }
}
.uc-header__currency-switch_desktop {
  justify-content: flex-end;
}
.uc-header__currency-switch_desktop .yay-currency-single-page-switcher {
  display: none;
}
@media screen and (min-width: 640px) {
  .uc-header__currency-switch_desktop .yay-currency-single-page-switcher {
    display: block;
  }
}

/* ---------- Store navigation (меню каталога в шапке) ---------- */

.uc-store-navigation {
  margin-right: -2.5vw !important;
  margin-left: -2.5vw !important;
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  position: relative;
}
.uc-store-navigation__content {
  padding: 0 2.5vw !important;
  gap: 1.5rem;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
  z-index: 40;
}
@media screen and (min-width: 1320px) {
  .uc-store-navigation__content_desktop {
    display: grid !important;
    grid-template: 1fr / auto 1fr auto;
    grid-template-areas: "sort nav count";
    justify-content: space-between;
  }
  .uc-store-navigation__content_desktop .uc-store-navigation__sorting-wrap {
    grid-area: sort;
  }
  .uc-store-navigation__content_desktop .uc-store-navigation__nav-list {
    justify-self: center;
    grid-area: nav;
  }
  .uc-store-navigation__content_desktop .uc-store-navigation__count {
    grid-area: count;
  }
}
.uc-store-navigation .wp-block-navigation-item__label,
.uc-store-navigation .yay-currency-selected-option,
.uc-store-navigation .woocommerce-result-count,
.uc-store-navigation .screen-reader-text,
.uc-store-navigation .orderby {
  white-space: nowrap;
  word-break: keep-all;
}
.uc-store-navigation__sorting-wrap .orderby {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: none;
  margin: 0;
  font: inherit;
  color: var(--wp--preset--color--contrast-3);
  cursor: pointer;
  font-style: normal;
  font-weight: 400;
  text-transform: uppercase !important;
  letter-spacing: 6% !important;
  /* Справа зарезервировано место под стрелку — текст под неё не залезает
     даже при самом длинном значении. Ширину под текущее значение
     подгоняет скрипт в store-nav.js (стрелка «прилипает» к тексту);
     24px должны совпадать с ARROW_SPACE в этом скрипте. */
  padding: 0 24px 0 0;
}
/* inline-flex + центрирование: текст и стрелка сортировки сидят на одной
   оси с фильтрами и счётчиком результатов (правка после переноса —
   inline-block прижимал select к верху ряда). */
.uc-store-navigation__sorting-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-height: 1rem;
}
.uc-store-navigation__sorting-wrap .orderby {
  align-self: center;
  vertical-align: middle; /* перебивает vertical-align: top из woocommerce.css */
}
/* woocommerce.css даёт форме сортировки margin: 0 0 1em — он и уводил
   select с оси фильтров. Сбрасываем все отступы. */
.uc-store-navigation__sorting-wrap .woocommerce-ordering {
  margin: 0 !important;
}
.uc-store-navigation__sorting-wrap::after {
  content: "";
  position: absolute;
  /* Позицию стрелки задаёт store-nav.js через переменную — сразу за текстом
     текущего значения. Без JS переменной нет → left: auto → работает
     запасной right: 10px (стрелка у правого края, текст под неё не залезает
     благодаря padding-right селекта). */
  left: var(--mit-sort-arrow-left, auto);
  right: 10px;
  top: 40%;
  width: .35rem;
  height: .35rem;
  border-right: .08rem solid var(--wp--preset--color--contrast-3);
  border-bottom: .08rem solid var(--wp--preset--color--contrast-3);
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
}
.uc-store-navigation__sorting-wrap .orderby,
.uc-store-navigation_desktop .wp-block-navigation-item__content {
  border-radius: 0;
  box-sizing: border-box;
}
/*
 * Полоса каталога прокручивается вбок, а системную полосу прокрутки прячем.
 * Раньше правило было написано на саму секцию, но прокручивается не она,
 * а `__content` — на WebKit полоса всё это время оставалась видимой.
 */
.uc-store-navigation__content::-webkit-scrollbar {
  display: none;
}

/*
 * Здесь были два градиента-подтая по краям полосы (`::after` и `::before`):
 * они подсказывали, что ряд прокручивается вбок, и обрезались ровно по
 * 3.5vw с каждой стороны.
 *
 * Подсказывать больше нечего. Ряд собирали меню разделов — десяток пунктов,
 * который заведомо не помещался; меню сняты (inc/catalog-legacy-nav.php),
 * и сегодня в полосе две вещи, которые помещаются на любой ширине. Подтай
 * при этом продолжал закрашивать края собственным фоном и обрезать по
 * высоте первый ряд в 1rem.
 *
 * Отступы полосы этим не затронуты: их держит `padding: 0 2.5vw` у
 * `__content` — те же 2.5vw, что и у остальных блоков страницы.
 */
@media screen and (min-width: 960px) {
  .uc-store-navigation_mobile {
    display: none !important;
  }
}

/* ---------- Карусель товаров ---------- */

.uc-product-carousel {
  margin-right: -2.5vw !important;
  margin-left: -2.5vw !important;
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  position: relative;
}
.uc-product-carousel__header,
.uc-product-carousel__item-list {
  padding-right: 2.5vw !important;
  padding-left: 2.5vw !important;
  box-sizing: border-box;
}
.uc-product-carousel__item-list {
  display: grid !important;
  grid-template: 1fr / repeat(4, 64vw);
  grid-auto-flow: column;
  align-items: stretch;
}
.uc-product-carousel__item-list .wc-block-product {
  min-width: 64vw !important;
}
@media screen and (min-width: 480px) {
  .uc-product-carousel__item-list {
    grid-template: 1fr / repeat(4, 43vw);
  }
  .uc-product-carousel__item-list .wc-block-product {
    min-width: 43vw !important;
  }
}
@media screen and (min-width: 960px) {
  .uc-product-carousel__item-list {
    grid-template: 1fr / repeat(4, 22vw);
  }
  .uc-product-carousel__item-list .wc-block-product {
    min-width: 22vw !important;
  }
}

/* ---------- Переключатель валют YayCurrency ---------- */

.yay-currency-custom-select__trigger {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  height: auto !important;
}
.yay-currency-custom-select-wrapper.only-currency-name-and-something {
  width: auto !important;
}
.yay-currency-custom-select {
  width: fit-content !important;
}
.yay-currency-selected-option {
  font-size: 12px !important;
  font-style: normal;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 6%;
}
.yay-currency-selected-option > br {
  display: none !important;
}
.yay-currency-custom-options {
  left: auto !important;
  right: 5px !important;
}
.yay-currency-custom-options .yay-currency-custom-option-row {
  min-height: 1.25rem !important;
}
.yay-currency-custom-option-row > p {
  height: 14px !important;
  width: 14px !important;
  margin: 0 !important;
}
