/* ==========================================================================
   base.css — современный слой механики темы (v1.2.0)
   Полностью заменяет bootstrap.min.css, swiper-bundle.min.css, animate.css,
   photoswipe.css и drift-basic.min.css. Сторонних зависимостей нет.
   Словарь классов дизайн-системы сохранён (см. README.md раздел Stack).
   Иконки — Font Awesome 5.15.4, локально (assets/vendor/fontawesome/).
   Загружается ПОСЛЕ styles.css.
   ========================================================================== */

/* --- 0. View Transitions отключены: на страницах с iframe навигация кидает
   "Transition was aborted ... ViewTransition opt-in disabled" (Chromium).
   Не стоит ошибок в консоли — пересмотреть после отказа ядра от iframes. ---- */

/* --- 1. База ------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

img,
svg,
video,
iframe { max-width: 100%; }

img,
video { height: auto; }

table { border-collapse: collapse; }

[hidden] { display: none !important; }

/* --- 2. Сетка: .row как grid + gap (вместо bootstrap-желобов) ------------ */
.row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
  margin-right: 0;
  margin-left: 0;
}

.row > * {
  min-width: 0;
  grid-column: span 12;
  padding-left: 0;
  padding-right: 0;
}

.row.g-3 { gap: 16px; }

.col-3  { grid-column: span 3; }
.col-6  { grid-column: span 6; }
.col-12 { grid-column: span 12; }

@media (min-width: 576px) {
  .col-sm-6 { grid-column: span 6; }
}

@media (min-width: 768px) {
  .col-md-4 { grid-column: span 4; }
  .col-md-6 { grid-column: span 6; }
}

@media (min-width: 992px) {
  .col-lg-12 { grid-column: span 12; }
}

@media (min-width: 1200px) {
  .col-xl-2  { grid-column: span 2; }
  .col-xl-3  { grid-column: span 3; }
  .col-xl-4  { grid-column: span 4; }
  .col-xl-5  { grid-column: span 5; }
  .col-xl-7  { grid-column: span 7; }
  .col-xl-8  { grid-column: span 8; }
  .col-xl-9  { grid-column: span 9; }
  .col-xl-12 { grid-column: span 12; }
}

/* --- 3. Утилиты ---------------------------------------------------------- */
.d-flex { display: flex; }
.d-none { display: none; }

@media (min-width: 1200px) {
  .d-xl-block { display: block; }
  .d-xl-none  { display: none; }
}

@media (min-width: 1400px) {
  .d-xxl-flex { display: flex; }
}

.justify-content-center { justify-content: center; }
.justify-content-end    { justify-content: end; }
.align-items-center     { align-items: center; }
.text-center            { text-align: center; }
.position-relative      { position: relative; }
.overflow-hidden        { overflow: hidden; }
.m-auto                 { margin: auto; }
.mt-0                   { margin-top: 0; }
.mt-4                   { margin-top: 24px; }
.mt-5                   { margin-top: 48px; }
.pt-0                   { padding-top: 0; }
.gap-3                  { gap: 16px; }
.w-100                  { width: 100%; }
.h-100                  { height: 100%; }
.object-fit-cover       { object-fit: cover; }
.fw-medium              { font-weight: 500; }
.fw-normal              { font-weight: 400; }
.text-transform-none    { text-transform: none; }
.d-block                { display: block; }
.text-left              { text-align: left; }
.m-0                    { margin: 0; }

/* Триггер мобильного подменю — button вместо старого <a> */
.nav-ul-mb button.mb-menu-link {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: inherit;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* Крестик внутри позиционируемых кнопок закрытия */
.icon-close .fa-times,
.icon-close-popup .fa-times { font-size: 14px; line-height: 1; }

/* --- 4. Уведомления ------------------------------------------------------ */
.alert {
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
}

.alert-warning {
  background: rgba(176, 58, 58, 0.06);
  border-color: rgba(176, 58, 58, 0.25);
  color: var(--primary);
}

/* --- 5. Аккордеоны на <details> (вместо bootstrap collapse) -------------- */
summary.accordion-title { list-style: none; }

summary.accordion-title::-webkit-details-marker { display: none; }

details.widget-accordion > summary.accordion-title .icon,
details > summary .facet-title-icon {
  transition: transform 0.35s linear;
}

details[open] > summary.accordion-title .icon,
details[open] > summary .facet-title-icon {
  transform: rotate(180deg);
}

/* Плавное раскрытие (Baseline 2025; без поддержки — мгновенно) */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }

  details::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 0.3s ease, content-visibility 0.3s;
  }

  details[open]::details-content { block-size: auto; }
}

/* Остаточные div-аккордеоны (чекаут — статичные секции) */
.accordion-collapse.collapse { display: none; }
.accordion-collapse.collapse.show { display: block; }

/* --- 6. Слайдеры: нативный scroll-snap (вместо Swiper) -------------------- */
.swiper {
  position: relative;
  overflow: hidden;
}

.swiper-wrapper {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.swiper-wrapper::-webkit-scrollbar { display: none; }

.swiper-slide {
  flex-shrink: 0;
  width: 100%;
  scroll-snap-align: start;
}

/* Вертикальный слайдер (миниатюры галереи товара) */
.swiper-vertical,
.swiper-vertical .swiper-wrapper { height: 100%; }

.swiper-vertical .swiper-wrapper {
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
}

.swiper-vertical .swiper-slide { scroll-snap-align: center; }

/* Миниатюры товара: фиксированные квадраты (раньше их размерял swiper-bundle.css) */
.tf-product-media-thumbs .swiper-slide {
  width: 100px !important;
  height: 100px !important;
  flex: 0 0 100px;
}

.tf-product-media-thumbs .swiper-slide .item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Активная миниатюра: подсветка (styles.css ждёт класс swiper-slide-thumb-active) */
.tf-product-media-thumbs .swiper-slide.is-active .item::after { opacity: 1; }

/* Стрелки навигации */
:where(.swiper-button-next, .swiper-button-prev) {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--dark);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 0.2s, border-color 0.2s, opacity 0.2s;
}

:where(.swiper-button-next) { right: 16px; }
:where(.swiper-button-prev) { left: 16px; }

:where(.swiper-button-next, .swiper-button-prev)::after {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
}

.swiper-button-next::after  { content: "\f061"; }
.swiper-button-prev::after  { content: "\f060"; }

.swiper-button-next:hover,
.swiper-button-prev:hover { color: var(--primary); border-color: var(--primary); }

:where(.swiper-button-prev, .swiper-button-next).swiper-button-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Точки пагинации: разметка отдаёт <button>, внешний вид — в styles.css
   (размер задан здесь: раньше его давал swiper-bundle.min.css) */
button.swiper-pagination-bullet {
  appearance: none;
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

/* Hero-слайдер с эффектом fade: слайды стопкой, активный по .is-active */
.swiper.slider-effect-fade > .swiper-wrapper {
  display: block;
  overflow: hidden;
  scroll-snap-type: none;
}

.swiper.slider-effect-fade .swiper-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s;
}

.swiper.slider-effect-fade .swiper-slide.is-active {
  position: relative;
  opacity: 1;
  visibility: visible;
}

/* --- 7. Появление при скролле (вместо WOW.js + animate.css) --------------- */
html.js .wow {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}

html.js .wow.in-view {
  opacity: 1;
  transform: none;
}

/* Каскад подписей в hero-слайдере */
.fade-item {
  opacity: 1;
  transform: none;
}

html.js .fade-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.js .is-active .fade-item,
html.js .in-view .fade-item {
  opacity: 1;
  transform: none;
}

html.js .is-active .fade-item-2 { transition-delay: 0.15s; }
html.js .is-active .fade-item-3 { transition-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  html.js .wow,
  html.js .fade-item {
    opacity: 1;
    transform: none;
    transition: none;
  }

  @view-transition { navigation: none; }
}

/* --- 8. Offcanvas (мобильное меню; визуал — в styles.css) ------------------ */
.offcanvas {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1600;
  width: min(360px, 86vw);
  background: var(--white, #fff);
  visibility: hidden;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out, visibility 0.3s;
}

.offcanvas.show {
  visibility: visible;
  transform: none;
}

.offcanvas-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: var(--backdrop, rgba(13, 13, 13, 0.55));
  border: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.offcanvas-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* --- 9. Лайтбокс на <dialog> (вместо PhotoSwipe) --------------------------- */
dialog.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: 0;
  padding: 24px;
  background: rgba(13, 13, 13, 0.92);
  color: var(--white, #fff);
}

dialog.lightbox:not([open]) { display: none; }

dialog.lightbox[open] {
  display: grid;
  grid-template: "stage stage stage" 1fr "prev close next" auto / auto auto auto;
  gap: 12px;
  align-items: center;
  justify-items: center;
}

dialog.lightbox::backdrop { background: rgba(13, 13, 13, 0.92); }

dialog.lightbox .lightbox-stage {
  grid-area: stage;
  display: grid;
  place-items: center;
  min-height: 0;
}

dialog.lightbox .lightbox-stage img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
}

dialog.lightbox .lightbox-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: transparent;
  color: var(--white, #fff);
  cursor: pointer;
}

dialog.lightbox .lightbox-btn:hover { border-color: var(--primary); color: var(--primary); }

dialog.lightbox .lightbox-prev { grid-area: prev; }
dialog.lightbox .lightbox-next { grid-area: next; }
dialog.lightbox .lightbox-close { grid-area: close; }

dialog.lightbox .lightbox-count {
  grid-area: stage;
  align-self: end;
  justify-self: center;
  font-size: 13px;
  opacity: 0.7;
}

/* --- 10. Зум изображения товара (вместо drift) ----------------------------- */
.tf-image-zoom {
  transition: transform 0.45s ease;
  will-change: transform;
}

.section-image-zoom .tf-image-zoom:hover { transform: scale(1.3); }

/* --- 11. Формы (минимум, что давал bootstrap reboot) ------------------------ */
.form-cart input:not([type="checkbox"]):not([type="radio"]),
.form-cart textarea,
.shop-filter-form input,
.shop-filter-form select,
.shop-checkout-form input:not([type="checkbox"]):not([type="radio"]),
.shop-checkout-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.form-cart input:focus,
.form-cart textarea:focus,
.shop-filter-form input:focus,
.shop-checkout-form input:focus,
.shop-checkout-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.shop-filter-form {
  flex-wrap: wrap;
}

.shop-filter-form select {
  display: block;
  background-color: var(--surface-2);
  color: var(--text-2);
}

.shop-layout {
  flex-wrap: wrap;
  gap: 4px;
  margin-block: 4px 12px;
}

.shop-layout[hidden],
.shop-layout button[hidden] {
  display: none;
}

.shop-layout button.tf-view-layout-switch {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  background-color: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.shop-layout .tf-view-layout-switch .item span {
  /* Стили донора принудительно красят значок списка в чёрный. */
  background-color: var(--text-2) !important;
}

.shop-layout .tf-view-layout-switch[aria-pressed="true"] {
  border-color: var(--primary);
}

.shop-layout .tf-view-layout-switch:is(:hover, [aria-pressed="true"]) .item span {
  background-color: var(--primary) !important;
}

.shop-layout .tf-view-layout-switch:focus-visible,
.shop-filter-form :is(input, select):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

[data-shop-layout-grid][data-shop-columns="1"] {
  grid-template-columns: minmax(0, 1fr);
}

[data-shop-layout-grid][data-shop-columns="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

[data-shop-layout-grid][data-shop-columns="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

[data-shop-layout-grid][data-shop-columns="4"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

[data-shop-layout-grid][data-shop-columns="1"] .card-product {
  display: grid;
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

@media (max-width: 575px) {
  [data-shop-layout-grid][data-shop-columns="1"] .card-product {
    grid-template-columns: minmax(0, 88px) minmax(0, 1fr);
  }
}

/* --- 12. FA-кодпоинты вместо icomoon в CSS-глифах styles.css ---------------- */
.tf-check::before,
.tf-select::after,
.image-select.style-default > .dropdown-toggle::after,
.footer-bottom-wrap .image-select.style-default > .dropdown-toggle::before,
.swiper-button-next::after,
.swiper-button-prev::after {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

.tf-check::before { content: "\f00c"; }
.tf-select::after,
.image-select.style-default > .dropdown-toggle::after,
.footer-bottom-wrap .image-select.style-default > .dropdown-toggle::before { content: "\f078"; }

.nav-swiper.style-1.swiper-button-prev::after,
.nav-swiper.arrow-1.swiper-button-prev::after { content: "\f060"; }

.nav-swiper.style-1.swiper-button-next::after,
.nav-swiper.arrow-1.swiper-button-next::after { content: "\f061"; }

/* Крестики: glyph теперь внутри кнопки (FA <i>), icomoon-псевдоэлемент глушим */
.icon-close::before,
.icon-close-popup::before { content: none !important; }

/* Диагональная стрелка «вверх-влево» */
.u-arrow-tl { transform: rotate(-45deg); display: inline-block; }

/* --- 13. Кнопка goTop: прогресс через scroll-driven animation --------------- */
@supports (animation-timeline: scroll()) {
  #goTop .border-progress {
    animation: gotop-progress linear both;
    animation-timeline: scroll(root);
  }

  @keyframes gotop-progress {
    from { --progress-angle: 0deg; }
    to   { --progress-angle: 360deg; }
  }

  @property --progress-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
  }
}

/* --- 14. Встраиваемые листинги ---------------------------------------------- */
iframe.listing-embed {
  display: block;
  width: 100%;
  border: 0;
  height: 560px; /* стартовое значение до замера JS */
}

/* --- 15. Главная: компактные интервалы и блог-карусель ---------------------- */
.mch-home .listing-band.flat-spacing-3 {
  padding-top: 48px;
  padding-bottom: 48px;
}

.mch-home .listing-band + .listing-band { border-top: 1px solid var(--line); }

.mch-home .sec-blog { padding-bottom: 96px; }

/* Карточка блога внутри слайда: растёт на всю ширину слайда */
.mch-home .s-blog-grid .swiper-slide .blog-item { width: 100%; }

/* Точки под блог-каруселью */
.mch-home .sw-pagination-blog { margin-top: 32px; }

/* УТП-карусель: одинаковая высота карточек (desc не длиннее 2 строк) */
.mch-home .line-top .swiper-slide { display: flex; }
.mch-home .line-top .tf-icon-box { height: 100%; }
.mch-home .tf-icon-box .desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Блог-карусель: превью строго одной высоты */
.mch-home .s-blog-grid .blog-item .entry_image {
  height: 260px;
  overflow: hidden;
  border-radius: 16px;
}

.mch-home .s-blog-grid .blog-item .entry_image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Блог-листинг 4 в ряд: на планшетах 2 колонки (узкие экраны даёт styles.css: 1) */
@media (max-width: 1199px) and (min-width: 576px) {
  .s-blog-list-grid.grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* --- 16. Блог: шапка раздела (фото слева / текст справа) и типографика статьи --- */

.page-lead.has-hero { align-items: center; }

.page-lead-intro {
  margin: 0 0 20px;
  line-height: 1.5;
  color: var(--text);
}

.s-blog-single .text {
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
}

.s-blog-single .text p {
  font-size: 17px;
  line-height: 1.75;
  margin: 0 0 18px;
}

.s-blog-single .text h2 {
  font-size: 27px;
  line-height: 1.25;
  font-weight: 600;
  margin: 44px 0 18px;
  padding: 0;
  background: none;
}

.s-blog-single .text h3 {
  font-size: 21px;
  line-height: 1.35;
  font-weight: 600;
  margin: 34px 0 14px;
  padding: 0;
  background: none;
}

.s-blog-single .text h4 {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
  margin: 28px 0 12px;
  padding: 0;
  background: none;
}

.s-blog-single .text ul,
.s-blog-single .text ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.s-blog-single .text ul li {
  list-style: disc;
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 9px;
}
.s-blog-single .text ol li {
  list-style: decimal;
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 9px;
}
.s-blog-single .text li::marker { color: var(--primary); }
.s-blog-single .text li > p { margin: 0 0 6px; }

.s-blog-single .text blockquote {
  margin: 26px 0;
  padding: 16px 22px;
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
  background: var(--surface-2);
}

.s-blog-single .text blockquote p { margin: 0; font-size: 16px; line-height: 1.6; }

.s-blog-single .text hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 36px 0;
}

.s-blog-single .text img {
  width: 100%;
  border-radius: 12px;
  margin: 22px 0;
}

.s-blog-single .text strong { color: var(--text-2); }

.pcms-richtext-table {
  margin: 26px 0;
  overflow-x: auto;
}

.pcms-richtext-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.pcms-richtext-table th,
.pcms-richtext-table td {
  border: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.pcms-richtext-table th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.pcms-richtext-table td p { margin: 0; }

.s-blog-single .entry_image img { border-radius: 16px; }

/* Описание товара: строки-абзацы и пункты-списки */
.widget-desc .item { margin: 0 0 12px; }
.widget-desc .item:last-child { margin-bottom: 0; }
.widget-desc p.item,
.widget-desc .desc-li {
  font-size: 16px;
  line-height: 1.7;
  margin: 0 0 10px;
}

.widget-desc .desc-li {
  padding-left: 18px;
  position: relative;
}

.widget-desc .desc-li::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--primary);
}

.mch-copy { white-space: pre-line; }
