/* Карточка товара (single-products.php). Образец — карточка 1peptidmos.ru: галерея с миниатюрами слева,
   название, цена и одна кнопка справа, описание ниже одной колонкой. Токены и кнопка — ep-base.css. */

.ep-pdp { padding: 20px 0 72px; }
.ep-nw { white-space: nowrap; }

/* ---------- Верх: крошки, галерея, покупка ---------- */
.ep-pdp__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "crumbs" "gal" "info";
  gap: 16px 56px;
}
.ep-pdp__crumbs { grid-area: crumbs; }
.ep-gal { grid-area: gal; }
.ep-pdp__info { grid-area: info; }

@media (min-width: 900px) {
  .ep-pdp { padding-top: 28px; }
  .ep-pdp__top {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "gal crumbs" "gal info";
    align-items: start;
  }
}

/* Крошки */
.ep-pdp__crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 0; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.45; color: var(--ep-muted); }
.ep-pdp__crumbs li:not(:last-child)::after { content: "›" / ""; margin: 0 8px; color: var(--ep-muted); } /* при переносе знак остаётся в конце строки */
.ep-pdp__crumbs a { color: inherit; text-decoration: none; transition: color .15s var(--ep-ease); }
.ep-pdp__crumbs a:hover { color: var(--ep-ink); text-decoration: underline; text-underline-offset: 3px; }
.ep-pdp__crumbs [aria-current] { color: var(--ep-ink-2); }

/* ---------- Галерея ---------- */
.ep-gal { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .ep-gal:not(.ep-gal--single) { grid-template-columns: 76px minmax(0, 1fr); }
}

.ep-gal__thumbs { display: none; }
@media (min-width: 900px) {
  .ep-gal__thumbs { display: flex; flex-direction: column; gap: 10px; }
}
.ep-gal__thumb {
  position: relative;
  width: 76px; height: 96px; padding: 0;
  background: var(--ep-soft);
  border: 1px solid transparent; border-radius: var(--ep-radius);
  cursor: pointer;
  transition: border-color .15s var(--ep-ease);
}
.ep-gal__thumb img { position: absolute; inset: 7px; width: calc(100% - 14px); height: calc(100% - 14px); object-fit: contain; }
.ep-gal__thumb--doc img { inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); }
.ep-gal__thumb:hover { border-color: var(--ep-muted); }
.ep-gal__thumb[aria-current="true"] { border-color: var(--ep-ink); box-shadow: inset 0 0 0 1px var(--ep-ink); }

.ep-gal__stage { position: relative; min-width: 0; }
/* Подложка как у плитки каталога: товар выглядит одинаково в сетке и в карточке. */
.ep-gal__track { background: var(--ep-soft); border-radius: var(--ep-radius); }
.ep-gal__track {
  display: flex;
  aspect-ratio: 1 / 1;
  max-height: 560px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ep-gal__track::-webkit-scrollbar { display: none; }
.ep-gal__track:focus-visible { outline-offset: -2px; }
.ep-gal__slide {
  flex: 0 0 100%;
  display: grid; place-items: center;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr); /* строка определённой высоты: max-height: 100% у фото срабатывает */
  min-height: 0;
  margin: 0; padding: 20px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.ep-gal__slide img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
/* Флакон на фото узкий и высокий: держим его по высоте кадра, но не крупнее исходника вдвое. */
.ep-gal__slide--photo img { max-height: min(100%, 460px); }

.ep-gal__doc {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  height: 100%; max-height: 100%; min-height: 0;
  color: var(--ep-muted); font-size: 14px; text-align: center; text-decoration: none;
}
.ep-gal__doc img { flex: 1 1 auto; min-height: 0; border: 1px solid var(--ep-line); outline: 1px solid oklch(0 0 0 / 0.04); transition: border-color .15s var(--ep-ease); }
.ep-gal__doc figcaption { flex: none; text-wrap: balance; }
.ep-gal__doc:hover img { border-color: var(--ep-muted); }
.ep-gal__doc:hover figcaption { color: var(--ep-ink); text-decoration: underline; text-underline-offset: 3px; }

/* Стрелки — только на ПК, проявляются при наведении на кадр и при фокусе. */
.ep-gal__nav {
  position: absolute; top: 50%; z-index: 1;
  display: none; place-items: center;
  width: 44px; height: 44px; margin-top: -22px; padding: 0;
  background: var(--ep-bg); color: var(--ep-ink);
  border: 1px solid var(--ep-line); border-radius: var(--ep-radius);
  cursor: pointer; opacity: 0;
  transition: opacity .2s var(--ep-ease), border-color .15s var(--ep-ease), color .15s var(--ep-ease);
}
.ep-gal__nav--prev { left: 12px; }
.ep-gal__nav--prev .ep-ico { transform: scaleX(-1); }
.ep-gal__nav--next { right: 12px; }
.ep-gal__nav:hover { border-color: var(--ep-ink); }
.ep-gal__nav:disabled { opacity: 0 !important; pointer-events: none; }
@media (min-width: 900px) {
  .ep-gal__nav { display: grid; }
  .ep-gal__stage:hover .ep-gal__nav, .ep-gal__nav:focus-visible { opacity: 1; }
}

/* Точки — только на смартфоне: листают пальцем, точки показывают, где ты. */
.ep-gal__dots { display: flex; justify-content: center; gap: 10px; padding-top: 6px; }
.ep-gal__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ep-line); transition: background-color .2s var(--ep-ease); }
.ep-gal__dot.is-on { background: var(--ep-ink); }
@media (min-width: 900px) { .ep-gal__dots { display: none; } }

/* ---------- Покупка ---------- */
.ep-pdp__info { min-width: 0; }
.ep-pdp__h1 { margin: 4px 0 12px; font-size: var(--ep-h1); line-height: 1.18; letter-spacing: -.005em; }
.ep-pdp__pack { margin: 0 0 20px; font-size: 15px; color: var(--ep-muted); }
.ep-pdp__pack b { color: var(--ep-ink); font-weight: 700; }
/* «Ещё пишут» идёт сразу за фасовкой — отбиваем их друг от друга, но не от цены ниже */
.ep-pdp__pack + .ep-pdp__alias { margin-top: -14px; }

.ep-pdp__buy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; margin: 0 0 18px; }
.ep-pdp__price { margin: 0; font-size: 34px; line-height: 1.1; color: var(--ep-ink); }
.ep-pdp__stock { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 15px; font-weight: 700; color: var(--ep-ok); }
.ep-pdp__stock .ep-ico { position: relative; top: -1px; }

.ep-pdp__cta { max-width: 520px; }
.ep-pdp__cta .ep-btn-tg { min-height: 58px; font-size: 18px; }
.ep-pdp__next { margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--ep-muted); }

.ep-pdp__trust {
  display: grid; gap: 10px;
  max-width: 520px; margin: 24px 0 0; padding: 20px 0 0;
  border-top: 1px solid var(--ep-line);
  list-style: none; font-size: 15px; line-height: 1.45; color: var(--ep-ink-2);
}
.ep-pdp__trust li { display: flex; align-items: flex-start; gap: 10px; }
.ep-pdp__trust .ep-ico { margin-top: 1px; color: var(--ep-tg); }
.ep-pdp__trust a { color: var(--ep-ink); text-decoration: underline; text-decoration-color: var(--ep-line); text-underline-offset: 3px; transition: text-decoration-color .15s var(--ep-ease); }
.ep-pdp__trust a:hover { text-decoration-color: currentColor; }

.ep-pdp__cat { margin: 16px 0 0; font-size: 14px; color: var(--ep-muted); }
.ep-pdp__cat a { color: var(--ep-ink-2); text-underline-offset: 3px; text-decoration-color: var(--ep-line); }
.ep-pdp__cat a:hover { color: var(--ep-ink); text-decoration-color: currentColor; }

/* ---------- Описание и характеристики ---------- */
.ep-pdp__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; margin-top: 56px; }
/* На ПК та же сетка, что у верхнего блока: текст под галереей, блок с ценой под кнопкой. */
@media (min-width: 1024px) {
  .ep-pdp__body { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: start; margin-top: 72px; }
}
.ep-pdp__text { min-width: 0; padding-top: 32px; border-top: 1px solid var(--ep-line); }
@media (min-width: 1024px) { .ep-pdp__text { padding-top: 40px; } }

.ep-prose { max-width: 68ch; font-size: var(--ep-fs); line-height: 1.6; }
.ep-prose + .ep-prose { margin-top: 48px; }
.ep-prose h2 { margin: 0 0 16px; font-size: var(--ep-h2); }
.ep-prose h3 { margin: 28px 0 10px; font-size: var(--ep-h3); }
.ep-prose h2 + h3 { margin-top: 0; }
.ep-prose h4 { margin: 20px 0 8px; font-size: 17px; }
.ep-prose p { margin: 0 0 14px; }
.ep-prose ul, .ep-prose ol { margin: 0 0 16px; padding-left: 1.25em; }
.ep-prose li { margin: 0 0 8px; padding-left: 2px; }
.ep-prose li::marker { color: var(--ep-muted); }
.ep-prose strong, .ep-prose b { font-weight: 700; color: var(--ep-ink); }
.ep-prose sub, .ep-prose sup { font-size: .72em; line-height: 0; }
.ep-prose a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: color-mix(in oklch, var(--ep-tg) 55%, transparent); text-underline-offset: 3px; transition: color .15s var(--ep-ease), text-decoration-color .15s var(--ep-ease); }
.ep-prose a:hover { color: var(--ep-tg-hover); text-decoration-color: currentColor; }

/* Таблица характеристик: «параметр — значение». Шапку «Параметр | Значение» видят только читалки (ep_pdp_html),
   шапка с названиями пептидов у комплекса видна. */
.ep-prose .mv-tw { margin: 0 0 16px; overflow-x: auto; }
.ep-prose table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.5; }
.ep-prose td, .ep-prose th { padding: 11px 16px 11px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--ep-line); }
.ep-prose th { font-size: 15px; font-weight: 700; color: var(--ep-ink); }
.ep-prose th:first-child { font-weight: 400; color: var(--ep-muted); }
.ep-prose td:first-child { width: 38%; color: var(--ep-muted); }
.ep-prose table:has(th:nth-child(3)) td:first-child,
.ep-prose .mv-tw:has(th:nth-child(3)) ~ .mv-tw td:first-child { width: 28%; }
/* Две таблицы подряд (комплекс: по пептидам, затем общее) читаются одним списком, без двойной линии. */
.ep-prose .mv-tw + .mv-tw { margin-top: -16px; }
.ep-prose .mv-tw + .mv-tw tr:first-child > td, .ep-prose .mv-tw + .mv-tw .ep-sr-row + tr > td { border-top: 0; }
.ep-prose td:last-child, .ep-prose th:last-child { padding-right: 0; }
.ep-prose tr:first-child > td, .ep-prose .ep-sr-row + tr > td { border-top: 1px solid var(--ep-line); }
.ep-prose .ep-sr-row > th { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ep-prose--spec > p { font-size: 15px; color: var(--ep-muted); }
@media (max-width: 599px) {
  .ep-prose td:first-child { width: 42%; }
  .ep-prose table { font-size: 15px; }
}

/* Закреплённый блок с ценой рядом с описанием — только на ПК. */
.ep-pdp__aside { display: none; }
@media (min-width: 1024px) {
  .ep-pdp__aside { display: block; position: sticky; top: calc(var(--ep-sticky-top, 0px) + 24px); }
}
.ep-pdp__aside-in {
  max-width: 520px;
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px 14px; align-items: center;
  padding: 18px;
  border: 1px solid var(--ep-line); border-radius: var(--ep-radius);
  background: var(--ep-bg);
}
.ep-pdp__aside-img { width: 40px; height: 64px; object-fit: contain; }
.ep-pdp__aside-txt { min-width: 0; }
.ep-pdp__aside-name { margin: 0 0 2px; font-size: 15px; line-height: 1.35; color: var(--ep-ink-2); }
.ep-pdp__aside-price { margin: 0; font-size: 22px; line-height: 1.2; }
.ep-pdp__aside-in .ep-btn-tg { grid-column: 1 / -1; min-height: 50px; padding: 0 16px; font-size: 16px; }
/* Одна главная кнопка на экран: блок проявляется, когда кнопка у цены ушла вверх (ep-product.js). */
.ep-pdp--js .ep-pdp__aside-in {
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .25s var(--ep-ease), transform .25s var(--ep-ease), visibility 0s linear .25s;
}
.ep-pdp--js.ep-pdp--past .ep-pdp__aside-in {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .25s var(--ep-ease), transform .25s var(--ep-ease), visibility 0s;
}

/* ---------- Похожие товары ---------- */
.ep-pdp__related { margin-top: 72px; }
.ep-pdp__related-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 20px; }
.ep-pdp__related-head h2 { margin: 0; }
.ep-pdp__related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
@media (min-width: 900px) { .ep-pdp__related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 24px; } }
.ep-pdp__related-link { margin: 0; }

/* ---------- Нижняя полоса на смартфоне: появляется, когда главная кнопка ушла вверх ---------- */
.ep-pdp-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  padding: 10px var(--ep-gap) calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--ep-bg);
  border-top: 1px solid var(--ep-line);
  box-shadow: 0 -6px 18px oklch(0.2 0.01 250 / 0.06);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform .28s var(--ep-ease), visibility 0s linear .28s;
}
.ep-pdp-bar.is-on { transform: none; visibility: visible; transition: transform .28s var(--ep-ease), visibility 0s; }
.ep-pdp-bar__in { display: flex; align-items: center; gap: 14px; max-width: 640px; margin: 0 auto; }
.ep-pdp-bar__price { flex: none; margin: 0; font-size: 21px; line-height: 1.1; }
.ep-pdp-bar .ep-pdp-bar__btn { flex: 1 1 auto; min-height: 48px; padding: 0 14px; gap: 8px; font-size: 16px; white-space: nowrap; }
body.ep-pdp-bar-on { padding-bottom: var(--ep-bar-h, 70px); }
@media (min-width: 1024px) {
  .ep-pdp-bar { display: none; }
  body.ep-pdp-bar-on { padding-bottom: 0; }
}

/* ---------- Смартфон ---------- */
@media (max-width: 899px) {
  .ep-pdp { padding-top: 12px; padding-bottom: 48px; }
  .ep-pdp__top { gap: 12px; }
  .ep-pdp__crumbs ol { font-size: 13px; }
  .ep-gal { margin: 0 calc(-1 * var(--ep-gap)); }
  /* Ниже квадрата: цена и кнопка должны попасть на первый экран. */
  .ep-gal__track { aspect-ratio: auto; height: min(92vw, 380px); border-radius: 0; }
  .ep-gal__slide { padding: 16px; }
  .ep-pdp__h1 { margin-top: 8px; }
  .ep-pdp__price { font-size: 30px; }
  .ep-pdp__cta, .ep-pdp__trust { max-width: none; }
  .ep-pdp__body { margin-top: 40px; }
  .ep-pdp__text { padding-top: 28px; }
  .ep-pdp__related { margin-top: 56px; }
}

/* Часто задаваемые вопросы — под характеристиками; аккордеон .ep-faq__* в ep-base.css */
.ep-pdp-faq { margin-top: 48px; }
.ep-pdp-faq h2 { margin: 0 0 16px; }
.ep-pdp-faq .ep-faq__q { font-size: 17px; }
.ep-pdp-faq__ask { margin: 18px 0 0; color: var(--ep-muted); font-size: 15px; }
.ep-pdp-faq__ask .ep-link-more { margin-left: 4px; font-size: 16px; }

/* Статьи по теме: список ссылок в блог (inc/blog.php, ep_blog_for_product). */
.ep-pdp-read { margin-top: 48px; }
.ep-pdp-read h2 { margin: 0 0 8px; }
.ep-pdp-read__list { margin: 0; padding: 0; list-style: none; }
.ep-pdp-read__item { padding: 16px 0; border-bottom: 1px solid var(--ep-line); }
.ep-pdp-read__link { font-size: 18px; font-weight: 700; line-height: 1.35; color: var(--ep-ink); text-decoration: underline; text-decoration-color: color-mix(in oklab, currentColor 30%, transparent); text-underline-offset: 3px; }
.ep-pdp-read__ex { margin: 6px 0 0; color: var(--ep-ink-2); max-width: 70ch; }
.ep-pdp-read__meta { margin: 6px 0 0; color: var(--ep-muted); font-size: 14px; }
@media (hover: hover) and (pointer: fine) {
  .ep-pdp-read__link:hover { color: var(--ep-tg); text-decoration-color: currentColor; }
}
