/* AM-UX-D2-20261122 — этап 2 Impeccable: normalize/polish витрины
   Цвета и шрифты только из DESIGN.md. Без новых радиусов и без анимаций (этап 3).
   Поля и CTA: шрифт ≥16px, тап ≥44px. */
:root {
  --am-ux-d2-black: #000000;
  --am-ux-d2-white: #ffffff;
  --am-ux-d2-green: #8a9b6e;
  --am-ux-d2-mute: #888888;
  --am-ux-d2-rule: #e6e6e6;
  --am-ux-d2-field: #e3e3e3;
  --am-ux-d2-gray: #333333;
}

/* ---------- 4. Тёмная шапка и лого на светлом hero главной ---------- */
/* На / и 404 класс header--black не ставится (white-иконки «под тёмный баннер»). Герой светлый. */
.header:not(.header--black) {
  color: var(--am-ux-d2-black);
}
.header:not(.header--black) .header__menu-link .header__icon {
  fill: var(--am-ux-d2-black);
}
.header:not(.header--black) .header__menu-link span {
  color: var(--am-ux-d2-black);
}
.header:not(.header--black) .header__menu-list li:first-child svg path,
.header:not(.header--black) .header__menu-list li:nth-child(2) svg path,
.header:not(.header--black) .header__menu-list li:nth-child(5) svg path {
  fill: currentColor;
}
.header:not(.header--black) .header__menu-list li:nth-child(3) svg path,
.header:not(.header--black) .header__menu-list li:nth-child(4) svg path,
.header:not(.header--black) .header__menu-list li:nth-child(4) svg rect {
  stroke: currentColor;
}

/* ---------- 5. Видимое поле поиска, шапка и лого не пропадают ---------- */
.search.search-mobile__active,
.header .search.search-mobile__active {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  max-height: none;
  height: auto;
  overflow: visible;
  z-index: 21;
  opacity: 1;
  padding: 0;
  background: var(--am-ux-d2-white);
  border-bottom: 1px solid var(--am-ux-d2-rule);
}
.search.search-mobile__active form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 121rem;
  margin: 0 auto;
  padding: 10px 16px 12px;
  border-bottom: 0;
  background: var(--am-ux-d2-white);
  box-sizing: border-box;
}
.search.search-mobile__active input,
.search.search-mobile__active input[name="q"] {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  font-size: 16px !important;
  line-height: 1.3;
  color: var(--am-ux-d2-black);
  background: var(--am-ux-d2-white);
  border: 1px solid var(--am-ux-d2-field);
  border-radius: 0;
  padding: 8px 12px;
  box-sizing: border-box;
}
.search.search-mobile__active button[type="submit"] {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  font-size: 16px !important;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--am-ux-d2-white);
  background: var(--am-ux-d2-black);
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.am-ux-d2-search-close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 16px;
  line-height: 1;
  color: var(--am-ux-d2-black);
  background: transparent;
  border: 1px solid var(--am-ux-d2-field);
  border-radius: 0;
  cursor: pointer;
}
.header.am-ux-d2-search-open .logo {
  visibility: visible;
  opacity: 1;
}

/* ---------- 3. Мобильный каталог: 2 колонки ---------- */
@media (max-width: 500px) {
  .catalog-content-cards {
    margin-left: -8px;
  }
  .catalog-content__card {
    width: calc(50% - 8px);
    margin-left: 8px;
    margin-bottom: 16px;
  }
  .catalog-content__card-img,
  .catalog-content__card-img img {
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
  }
  .catalog-content__card-info {
    margin-top: 8px;
  }
  .catalog-content__card-title {
    font-size: 13px;
    line-height: 1.3;
    max-width: none;
  }
  .catalog-content__card-subtitle {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
  }
  .catalog-content__card-price {
    font-size: 16px !important;
    line-height: 1.2 !important;
    font-weight: 700;
  }
  .catalog-content__card-price--discount {
    font-size: 12px !important;
    line-height: 1.2 !important;
  }
  .catalog-content__card-favourites label {
    width: 36px;
    height: 36px;
  }
  .catalog-content__card-info-bottom {
    margin-top: 6px;
  }
  .catalog-content__card--discount .catalog-content__card-info-bottom {
    margin-top: 6px;
  }
}

/* Дубль длинного H1 в крошках на мобиле */
@media (max-width: 767px) {
  .breadcrumb li:last-child,
  .breadcrumb__page {
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- 6. Размеры не заезжают под липкую шапку ---------- */
.product-page__form,
.product-page__form-wrap,
.product-page__form-title,
.product-page__form-cards,
.product-page__form-card {
  scroll-margin-top: calc(var(--am-ux-m2-header-h, 71px) + var(--am-ux-m2-strip-h, 0px) + 12px);
}
.product-page__form-card,
.product-page__form-card label {
  position: relative;
  z-index: 1;
}
@media (max-width: 767px) {
  .product-page__form,
  .product-page__form-cards {
    padding-bottom: 24px;
    scroll-margin-bottom: 90px;
  }
}
.product-page__form-card label {
  min-height: 44px;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.2;
}

/* ---------- 1. Липкая чёрная кнопка оформления в мобильной корзине ---------- */
.am-ux-d2-cart-bar {
  display: none;
}
@media (max-width: 767px) {
  body.am-ux-d2-cart-has-items .am-ux-d2-cart-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    background: var(--am-ux-d2-white);
    border-top: 1px solid var(--am-ux-d2-rule);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  body.am-ux-d2-cart-has-items .am-ux-d2-cart-bar__sum {
    flex: 1 1 auto;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--am-ux-d2-black);
    letter-spacing: 0.03em;
  }
  body.am-ux-d2-cart-has-items .am-ux-d2-cart-bar__btn {
    flex: 0 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
    background: var(--am-ux-d2-black);
    color: var(--am-ux-d2-white);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 0;
    box-sizing: border-box;
  }
  body.am-ux-d2-cart-has-items .cart-products,
  body.am-ux-d2-cart-has-items .cart-wrap {
    padding-bottom: 88px;
  }
  /* Шильдик #staging-badge (только dev) не должен перекрывать итог и CTA */
  body:has(#staging-badge).am-ux-d2-cart-has-items .am-ux-d2-cart-bar,
  html:has(#staging-badge) body.am-ux-d2-cart-has-items .am-ux-d2-cart-bar {
    bottom: 44px;
  }
  body:has(#staging-badge).am-ux-d2-cart-has-items .cart-products,
  body:has(#staging-badge).am-ux-d2-cart-has-items .cart-wrap,
  html:has(#staging-badge) body.am-ux-d2-cart-has-items .cart-products,
  html:has(#staging-badge) body.am-ux-d2-cart-has-items .cart-wrap {
    padding-bottom: 132px;
  }
  body.am-ux-d2-cart-has-items .cart-products-order-wrap--stock > a.cart__button {
    /* оригинал остаётся в потоке для десктопа; на мобиле прячем, чтобы не дублировать */
    display: none;
  }
}

/* ---------- 7. Пустая корзина — кнопка «В каталог» ---------- */
.cart-products__empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.am-ux-d2-empty-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 20px;
  background: var(--am-ux-d2-black);
  color: var(--am-ux-d2-white) !important;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 0;
  box-sizing: border-box;
}
body.am-ux-d2-cart-empty .cart-products-order-wrap--stock {
  display: none;
}
body.am-ux-d2-cart-empty .footer__top {
  display: none !important;
}

/* ---------- 10. Заметка о доставке, промокод, логотипы оплаты в корзине ---------- */
.am-ux-d2-cart-note {
  margin: 16px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--am-ux-d2-rule);
  color: var(--am-ux-d2-gray);
  font-size: 14px;
  line-height: 1.45;
}
.am-ux-d2-cart-note p {
  margin: 0 0 8px;
}
.am-ux-d2-cart-note a {
  color: var(--am-ux-d2-black);
  text-decoration: underline;
}
.am-ux-d2-pay-logos {
  display: block;
  margin: 8px 0 0;
  max-width: 220px;
  width: 100%;
  height: auto;
}
.am-ux-d2-pay-caption {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--am-ux-d2-mute);
}

/* ---------- 2. Оформление: рассылка и подвал не сразу после города ---------- */
body.am-ux-m5-checkout .footer__top,
body.am-ux-d2-checkout .footer__top {
  display: none !important;
}
body.am-ux-m5-checkout .cart-wrap,
body.am-ux-d2-checkout .cart-wrap {
  min-height: calc(100vh - 80px);
}
body.am-ux-m5-checkout .footer,
body.am-ux-d2-checkout .footer {
  margin-top: 48px;
}
.am-ux-d2-checkout-next {
  margin: 12px 0 0;
  padding: 12px 0 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--am-ux-d2-gray);
}

/* ---------- 8. Тост «Перейти к оформлению» ---------- */
.am-ux-d2-toast-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--am-ux-d2-black);
  color: var(--am-ux-d2-white) !important;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 0;
  box-sizing: border-box;
}
.Vue-Toastification__toast .am-ux-d2-toast-cta,
.Vue-Toastification__toast-body .am-ux-d2-toast-cta {
  display: inline-flex;
}

/* ---------- 9. FAQ аккордеон ---------- */
.am-ux-d2-faq-group {
  font-family: Montserrat, sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--am-ux-d2-black);
  margin: 28px 0 8px;
}
.am-ux-d2-faq-group:first-child {
  margin-top: 0;
}
details.am-ux-d2-faq {
  border-bottom: 1px solid var(--am-ux-d2-rule);
  margin: 0;
  padding: 0;
}
details.am-ux-d2-faq > summary {
  position: relative;
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  padding: 12px 40px 12px 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--am-ux-d2-black);
  box-sizing: border-box;
}
details.am-ux-d2-faq > summary::-webkit-details-marker,
details.am-ux-d2-faq > summary::marker {
  display: none;
  content: "";
}
details.am-ux-d2-faq > summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}
details.am-ux-d2-faq[open] > summary::after {
  content: "\2212";
}
.am-ux-d2-faq__body {
  padding: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--am-ux-d2-black);
}
details.am-ux-d2-faq .answer,
details.am-ux-d2-faq h3 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

/* Общая нормализация CTA на затронутых страницах */
.am-ux-d2-empty-cta:focus,
.am-ux-d2-cart-bar__btn:focus,
.am-ux-d2-toast-cta:focus,
.search.search-mobile__active input:focus,
.search.search-mobile__active button:focus,
.am-ux-d2-search-close:focus,
details.am-ux-d2-faq > summary:focus {
  outline: 2px solid var(--am-ux-d2-black);
  outline-offset: 2px;
}
