/* ==========================================================================
   Страница модели (лендинг одной поломоечной машины).
   Дополняет style.css, палитра та же.
   ========================================================================== */

/* ---------- Хлебные крошки (десктоп) и кнопка «назад» (телефон) ---------- */
.crumbs { padding: var(--sp-4) 0; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.crumbs ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13.5px; color: var(--ink-400);
}
.crumbs li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.crumbs li + li::before { content: '/'; color: var(--line); }
.crumbs a { color: var(--ink-500); }
.crumbs a:hover { color: var(--brand-600); }
.crumbs [aria-current] { color: var(--ink-800); font-weight: 600; }

.back-link { display: none; }

/* телефон: вместо крошек — круглая кнопка «назад», висит поверх контента */
@media (max-width: 860px) {
  .crumbs { display: none; }
  .back-link {
    position: fixed; top: 78px; left: 12px;
    z-index: calc(var(--z-sticky) - 10);
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    border: 1px solid var(--line); border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-md);
    color: var(--ink-900);
  }
  .back-link .ic { width: 22px; height: 22px; margin-right: 2px; }
  .back-link:active { background: var(--surface-2); }
}

/* ---------- Верх страницы ---------- */
.m-hero { padding: clamp(24px, 3.4vw, 48px) 0 clamp(32px, 4vw, 56px); }
.m-hero__grid { display: grid; grid-template-columns: 1.06fr .94fr; gap: clamp(24px, 3.4vw, 52px); align-items: start; }
@media (max-width: 960px) { .m-hero__grid { grid-template-columns: 1fr; } }

/* галерея */
.m-gallery__main {
  position: relative;
  aspect-ratio: 5 / 4;   /* выше, чем 4/3: машине нужно больше места по вертикали */
  background: #fff;   /* подложка под фото белая — как сами фото моделей */
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: block; width: 100%; cursor: zoom-in;
}
.m-gallery__main img {
  position: absolute; inset: clamp(16px, 2.4vw, 32px);
  width: auto; height: auto;
  max-width: calc(100% - clamp(16px, 2.4vw, 32px) * 2);
  max-height: calc(100% - clamp(16px, 2.4vw, 32px) * 2);
  margin: auto;
  object-fit: contain;
}
.m-gallery__zoom {
  position: absolute; right: 10px; bottom: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  color: var(--ink-500); font-size: 11.5px; font-weight: 600;
  pointer-events: none;
}
.m-gallery__zoom .ic { width: 13px; height: 13px; }

/* Полоса миниатюр со стрелками. На ПК мышью строку иначе не прокрутить:
   колесо переводит в горизонтальную прокрутку не во всех браузерах. */
.m-gallery__strip { position: relative; }

.m-gallery__arrow {
  position: absolute; top: calc(50% - 18px); z-index: 2;
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: #fff; color: var(--ink-900);
  box-shadow: var(--shadow-md);
  transition: background-color .2s ease, opacity .2s ease;
}
.m-gallery__arrow[hidden] { display: none; }
.m-gallery__arrow:hover { background: var(--surface-2); }
.m-gallery__arrow .ic { width: 20px; height: 20px; }
.m-gallery__arrow--prev { left: -8px; }
.m-gallery__arrow--next { right: -8px; }

/* Миниатюры — одна строка с горизонтальной прокруткой.
   Ширина взята так, чтобы влезало 5,5 кадра: половина шестого выглядывает
   и сразу видно, что строку можно прокрутить. */
.m-gallery__thumbs {
  display: flex; gap: var(--sp-2);
  margin-top: var(--sp-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* чтобы рамка активной миниатюры не обрезалась при прокрутке */
  padding-bottom: 2px;
}
.m-gallery__thumbs::-webkit-scrollbar { display: none; }

.m-gallery__thumb {
  flex: 0 0 calc((100% - var(--sp-2) * 4) / 5.5);
  scroll-snap-align: start;
  aspect-ratio: 1; padding: 6px; cursor: pointer;
  background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .2s ease, transform .15s ease;
}
.m-gallery__thumb img { width: 100%; height: 100%; object-fit: contain; }
.m-gallery__thumb:hover { border-color: var(--brand-200); }
.m-gallery__thumb[aria-current="true"] { border-color: var(--brand-600); box-shadow: 0 0 0 1px var(--brand-600) inset; }

/* --- телефон: листаем фото свайпом, сетку миниатюр не показываем --- */
.m-gallery__swipe { display: none; }

@media (max-width: 860px) {
  .m-gallery__main, .m-gallery__strip { display: none; }   /* на телефоне листаем свайпом */

  .m-gallery__swipe {
    display: block; position: relative;
    aspect-ratio: 1 / 1;   /* на телефоне фото во всю ширину — даём высоту */
    background: #fff;
    border: 1px solid var(--line); border-radius: var(--r-lg);
    overflow: hidden;
  }
  .m-gallery__swipe .swiper__track { height: 100%; }
  .m-gallery__swipe .swiper__slide {
    border: 0; padding: 0; background: none; cursor: zoom-in;
  }
  .m-gallery__swipe .swiper__slide img { padding: var(--sp-4); }
  .m-gallery__counter {
    position: absolute; top: 10px; right: 10px;
    padding: 4px 11px; border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
    font-size: 12.5px; font-weight: 600; color: var(--ink-700);
    font-variant-numeric: tabular-nums;
  }
  .m-gallery__swipe .m-gallery__zoom { bottom: 8px; }
}

/* правая колонка */
.m-hero h1 { margin-bottom: var(--sp-2); font-size: clamp(25px, 3.2vw, 40px); }
.m-article { font-size: 14.5px; color: var(--ink-500); margin-bottom: var(--sp-5); }

.m-price {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-3);
  padding: var(--sp-5); margin-bottom: var(--sp-5);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.m-price__now { font-size: clamp(28px, 3.2vw, 38px); font-weight: 800; color: var(--ink-900); letter-spacing: -.025em; line-height: 1; }
.m-price__note { font-size: 13.5px; color: var(--ink-500); flex: 1 1 100%; margin: 0; }
.m-price__vat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--brand-50); color: var(--brand-700);
  font-size: 12.5px; font-weight: 700;
}
.m-price__vat .ic { width: 15px; height: 15px; }

.m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.m-actions .btn--primary { grid-column: 1 / -1; }
@media (max-width: 420px) { .m-actions { grid-template-columns: 1fr; } }

.m-trust { list-style: none; margin: 0; padding: var(--sp-5) 0 0; border-top: 1px solid var(--line-soft); display: grid; gap: 11px; }
.m-trust li {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font-size: 15px; color: var(--ink-700);
}
.m-trust .ic { width: 19px; height: 19px; color: var(--ok-500); }
@media (max-width: 400px) {
  .m-trust { gap: 9px; }
  .m-trust li { font-size: 14.5px; }
}

/* ---------- Полоса ключевых характеристик ---------- */
.m-keyspecs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.m-keyspec { background: #fff; padding: var(--sp-5); text-align: center; }
.m-keyspec__ic {
  width: 42px; height: 42px; margin: 0 auto var(--sp-3);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-600);
}
.m-keyspec__ic .ic { width: 22px; height: 22px; }
.m-keyspec__val { font-size: clamp(19px, 2vw, 24px); font-weight: 800; color: var(--ink-900); line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.m-keyspec__key {
  font-size: 13px; color: var(--ink-500); margin-top: 4px;
  hyphens: auto; overflow-wrap: break-word;
}
@media (max-width: 760px) { .m-keyspecs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Текстовые блоки ---------- */
.prose { max-width: 74ch; }
.prose h2 { font-size: clamp(21px, 2.2vw, 28px); margin-top: var(--sp-8); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 19px; margin-top: var(--sp-6); }
.prose p, .prose li { color: var(--ink-700); }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose ol li { margin-bottom: .7em; }
.prose strong { color: var(--ink-900); }
.prose table { display: block; overflow-x: auto; white-space: nowrap; }
.prose__more { margin: var(--sp-5) 0 0; }
.prose__more .btn { width: 100%; max-width: 340px; }
.prose__more[hidden] { display: none; }

/* Свёрнутое описание. Высоту на десктопе задаёт скрипт по блоку
   характеристик, на телефоне работает запасное значение. */
.m-desc { position: relative; }
.m-desc.is-clamped {
  overflow: hidden;
  max-height: var(--desc-max, 210px);
}
.m-desc.is-clamped::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 96px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 82%);
  pointer-events: none;
}
.m-desc > :last-child { margin-bottom: 0; }

/* выгоды модели */
.m-benefits { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.m-benefits li {
  display: flex; align-items: flex-start; gap: 11px; margin: 0;
  padding: var(--sp-4);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: 15px; color: var(--ink-700);
}
.m-benefits .ic { width: 20px; height: 20px; color: var(--brand-500); margin-top: 2px; }
@media (max-width: 760px) { .m-benefits { grid-template-columns: 1fr; } }

/* ---------- Таблица характеристик ---------- */
.m-specs { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.m-specs__row {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-4);
  padding: 13px var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}
.m-specs__row:last-child { border-bottom: 0; }
.m-specs__row:nth-child(odd) { background: var(--surface-2); }
/* внутри слова не переносим — иначе получается «Производи-тельность» */
.m-specs__key { color: var(--ink-500); min-width: 0; hyphens: manual; overflow-wrap: break-word; }
.m-specs__key .ic { width: 17px; height: 17px; margin-right: 8px; color: var(--brand-500); }
.m-specs__val { font-weight: 600; color: var(--ink-900); text-align: right; font-variant-numeric: tabular-nums; }
/* строки с длинным значением (перечень датчиков, режимы работы):
   значение под подписью и на всю ширину, иначе получается узкий столбик текста */
.m-specs__row--long { grid-template-columns: 1fr; gap: 4px; }
.m-specs__row--long .m-specs__val { text-align: left; }

/* на телефоне подпись и значение в одной строке: значение занимает
   ровно столько, сколько нужно, остальное отдаём подписи */
@media (max-width: 560px) {
  .m-specs__row {
    gap: var(--sp-3);
    padding: 11px var(--sp-4);
    font-size: 14.5px;
  }
  .m-specs__row--long { gap: 4px; }
  .m-specs__key .ic { margin-right: 6px; }
}

/* ---------- Условия поставки ---------- */
.m-terms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
/* Иконка и заголовок в одну строку, текст — под ними на всю ширину */
.m-term {
  padding: var(--sp-5);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  display: grid; grid-template-columns: auto 1fr; gap: 0 var(--sp-4);
  align-items: center;
}
.m-term__ic {
  grid-column: 1; grid-row: 1;
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); background: var(--surface-3); color: var(--ink-700);
}
.m-term__ic .ic { width: 22px; height: 22px; }
.m-term h3 { grid-column: 2; grid-row: 1; font-size: 17px; margin: 0; }
.m-term p {
  grid-column: 1 / -1; grid-row: 2;
  font-size: 14.5px; color: var(--ink-500); margin: var(--sp-4) 0 0;
}
@media (max-width: 860px) { .m-terms { grid-template-columns: 1fr; } }

/* ---------- Закреплённая панель заказа (десктоп) ----------
   Появляется, когда кнопки в шапке товара уходят из вида,
   и прячется у формы заявки, чтобы не дублировать её. */
.m-sticky {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: var(--z-bottombar);
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(23, 24, 26, .07);
  transform: translateY(101%);
  transition: transform .28s cubic-bezier(.22, .68, .36, 1);
}
.m-sticky.is-visible { transform: none; }
.m-sticky__row {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: 12px 0;
}
.m-sticky__img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.m-sticky__info { min-width: 0; flex: 1; }
.m-sticky__name { font-size: 15px; font-weight: 700; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sticky__price { font-size: 19px; font-weight: 800; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.m-sticky__actions { display: flex; gap: var(--sp-2); flex: none; }
@media (max-width: 860px) { .m-sticky { display: none; } }
