/* Е-Пептиды: каталог /shop/, рубрики и плитка товара (она же на главной, в «Похожих» карточки и в поиске).
   Вид как у 1peptidmos: товар на светлой подложке, название, цена; без бейджей, скруглений и теней.
   Токены — из ep-base.css. */

/* ===== Плитка товара ===== */

.ep-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px 20px;
}

.ep-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ep-tile__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--ep-soft);
  border-radius: var(--ep-radius);
}
.ep-tile__img {
  position: absolute;
  inset: 7%;
  width: 86%;
  height: 86%;
  object-fit: contain;
  transition: transform .4s var(--ep-ease);
}
.ep-tile__noimg { font-size: var(--ep-small); color: var(--ep-muted); }
/* «В наличии» зелёным над названием, как отметка в карточке товара (.ep-pdp__stock). */
.ep-tile__stock { margin: 0 0 4px; color: var(--ep-ok); font-size: 14px; font-weight: 700; line-height: 1.3; }

.ep-tile__title {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  text-wrap: pretty;
  /* два ряда: длинное название обрезается, цены в ряду стоят на одной линии */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: 2.8em;
}
.ep-tile__link {
  color: var(--ep-ink);
  text-decoration: none;
}
/* Растянутая ссылка: вся плитка ведёт в карточку, «Заказать» лежит поверх. */
.ep-tile__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.ep-tile__link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ep-tile__link:focus-visible { outline: none; }
.ep-tile__link:focus-visible::after { outline: 2px solid var(--ep-tg); outline-offset: 6px; }
.ep-tile__lat { color: var(--ep-muted); }
.ep-nw { white-space: nowrap; } /* «БПЦ-157», «МОТС-си» не рвутся на дефисе */

.ep-tile__purpose {
  margin: 2px 0 0;
  font-size: var(--ep-small);
  line-height: 1.4;
  color: var(--ep-muted);
}

/* Цена прижата к низу плитки: в ряду она на одной линии, даже если у соседа нет строки назначения. */
.ep-tile__buy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin: auto 0 0;
  padding-top: 8px;
}
.ep-tile__price { font-size: 18px; color: var(--ep-ink); }
.ep-tile__dose { font-size: var(--ep-small); color: var(--ep-muted); }

/* Текст ссылки темнее фирменного голубого: мелкий кегль на светлом фоне должен держать контраст 4.5:1
   (--ep-tg даёт 3.2:1, --ep-tg-hover 4.2:1, этот — 5.3:1). Значок остаётся фирменным голубым. Зона нажатия — 44 px. */
.ep-tile__tg {
  --ep-tile-tg-text: oklch(0.52 0.13 240);
  position: relative;
  z-index: 2;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: var(--ep-tile-tg-text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.ep-tile__tg .ep-ico { color: var(--ep-tg); }
.ep-tile__tg:hover { --ep-tile-tg-text: oklch(0.45 0.12 242); }
.ep-tile__tg:hover span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ПК с мышью: «Заказать» проявляется при наведении на плитку и при фокусе с клавиатуры, место под неё занято всегда. */
@media (hover: hover) and (pointer: fine) {
  .ep-tile__tg {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .2s var(--ep-ease), transform .2s var(--ep-ease), color .2s var(--ep-ease);
  }
  .ep-tile:hover .ep-tile__tg,
  .ep-tile:focus-within .ep-tile__tg { opacity: 1; transform: none; }
  .ep-tile:hover .ep-tile__img { transform: scale(1.04); }
}

/* ===== Страница каталога и рубрики ===== */

.ep-cat { padding-bottom: 72px; }

/* Крошки — как в карточке товара (.ep-pdp__crumbs). */
.ep-cat__crumbs { margin: 20px 0 14px; font-size: var(--ep-small); line-height: 1.45; color: var(--ep-muted); }
.ep-cat__crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 0; margin: 0; padding: 0; list-style: none; }
.ep-cat__crumbs li + li::before { content: "›" / ""; margin: 0 8px; color: var(--ep-muted); }
.ep-cat__crumbs a { color: inherit; text-decoration: none; transition: color .15s var(--ep-ease); }
.ep-cat__crumbs a:hover { color: var(--ep-ink); text-decoration: underline; text-underline-offset: 3px; }
.ep-cat__crumbs [aria-current] { color: var(--ep-ink-2); }

.ep-cat__head { max-width: 880px; }
.ep-cat__h1 { margin: 0 0 10px; }
.ep-cat__lead { margin: 0; color: var(--ep-ink-2); }
.ep-cat__lead a { color: inherit; text-decoration-color: var(--ep-line); text-underline-offset: 3px; }
.ep-cat__lead a:hover { text-decoration-color: currentColor; }

/* Переключатель рубрик: подчёркнутые вкладки, как у 1peptidmos; справа — сколько товаров. */
.ep-cat__bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin: 28px 0 32px;
  border-bottom: 1px solid var(--ep-line);
}
.ep-cat__tabs { display: flex; flex-wrap: wrap; gap: 0 28px; margin: 0 0 -1px; padding: 0; list-style: none; }
.ep-cat__tab {
  display: block;
  padding: 10px 0 12px;
  border-bottom: 2px solid transparent;
  color: var(--ep-ink-2);
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s var(--ep-ease), border-color .15s var(--ep-ease);
}
.ep-cat__tab:hover { color: var(--ep-ink); border-bottom-color: var(--ep-line); }
.ep-cat__tab[aria-current] { color: var(--ep-ink); border-bottom-color: var(--ep-ink); }
.ep-cat__count { flex: none; margin: 0; padding-bottom: 13px; font-size: var(--ep-small); color: var(--ep-muted); font-variant-numeric: tabular-nums; }

.ep-cat__empty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 32px 0; color: var(--ep-ink-2); }

/* «Не знаете, что выбрать?» — одна строка с кнопкой в Telegram. */
.ep-cat__help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 40px;
  margin-top: 64px;
  padding: 28px 32px;
  background: var(--ep-soft);
  border-radius: var(--ep-radius);
}
.ep-cat__help-title { margin: 0 0 4px; font-size: 22px; }
.ep-cat__help p { margin: 0; max-width: 72ch; color: var(--ep-ink-2); }
.ep-cat__help p a { color: var(--ep-ink); font-weight: 700; text-underline-offset: 3px; }
.ep-cat__help .ep-btn-tg { flex: none; }

/* ===== Адаптив ===== */

@media (max-width: 1199px) {
  .ep-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .ep-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .ep-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 12px; }
  .ep-tile__media { margin-bottom: 10px; }
  .ep-tile__title { font-size: 15px; }
  .ep-tile__price { font-size: 17px; }
  .ep-tile__tg { font-size: 14px; gap: 6px; }

  .ep-cat__crumbs { margin: 14px 0 10px; font-size: 13px; }
  .ep-cat { padding-bottom: 48px; }

  /* На смартфоне вкладки — кнопки в несколько рядов: все рубрики видны, текущая залита. */
  .ep-cat__bar { display: block; margin: 20px 0 24px; border-bottom: 0; }
  .ep-cat__tabs { gap: 8px; margin: 0; }
  .ep-cat__tab {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 6px 12px;
    border: 1px solid var(--ep-line);
    border-radius: var(--ep-radius);
    font-size: 15px;
    line-height: 1.3;
  }
  .ep-cat__tab:hover { border-color: var(--ep-line); }
  .ep-cat__tab[aria-current] { background: var(--ep-ink); border-color: var(--ep-ink); color: var(--ep-on-dark); }
  .ep-cat__count { display: none; }

  .ep-cat__help { flex-direction: column; align-items: stretch; margin-top: 48px; padding: 24px 20px; }
  .ep-cat__help .ep-btn-tg { width: 100%; }
}

/* Самые узкие экраны (до 359 px): в плитку не влезает «Заказать в Telegram» — остаётся «Заказать» со значком. */
@media (max-width: 359px) {
  .ep-tile__tg-tail { display: none; }
}

/* Сравнение товаров рубрики (ep_catalog_compare) */
.ep-cmp { margin: 56px 0 0; }
.ep-cmp__h { margin: 0 0 16px; font-size: var(--ep-h2); }
.ep-cmp__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ep-cmp__scroll:focus-visible { outline: 2px solid var(--ep-tg); outline-offset: 2px; }
.ep-cmp__table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.ep-cmp__table th, .ep-cmp__table td { padding: 12px 14px; border-bottom: 1px solid var(--ep-line); text-align: left; vertical-align: top; }
.ep-cmp__table thead th { padding-top: 0; color: var(--ep-muted); font-size: 14px; font-weight: 400; border-bottom-color: var(--ep-ink); }
.ep-cmp__table tbody th { font-weight: 700; }
.ep-cmp__table tbody th a { color: var(--ep-ink); text-underline-offset: 3px; text-decoration-color: var(--ep-line); }
.ep-cmp__table tbody th a:hover { text-decoration-color: currentColor; }
.ep-cmp__table td { color: var(--ep-ink-2); }
.ep-cmp__num { text-align: right !important; font-variant-numeric: tabular-nums; }
.ep-cmp__table td.ep-cmp__num { color: var(--ep-ink); font-weight: 700; }
.ep-cmp__nw { white-space: nowrap; }
.ep-cmp__table th:first-child, .ep-cmp__table td:first-child { padding-left: 0; }
.ep-cmp__table th:last-child, .ep-cmp__table td:last-child { padding-right: 0; }
@media (max-width: 767px) {
  .ep-cmp { margin-top: 40px; }
  .ep-cmp__scroll { overflow: visible; }
  .ep-cmp__table, .ep-cmp__table tbody, .ep-cmp__table tr { display: block; min-width: 0; }
  .ep-cmp__table thead { display: none; }
  .ep-cmp__table tr { padding: 14px 0; border-bottom: 1px solid var(--ep-line); }
  .ep-cmp__table tbody th, .ep-cmp__table td { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; border: 0; text-align: left; }
  .ep-cmp__table tbody th { display: block; margin-bottom: 6px; font-size: 16px; }
  .ep-cmp__table td::before { content: attr(data-label); flex: none; color: var(--ep-muted); font-weight: 400; }
  .ep-cmp__table td { font-size: 14px; }
  .ep-cmp__table td[data-label="Мишени и класс"] { text-align: right; }
  .ep-cmp__nw { white-space: normal; }
}

/* Текст рубрики и её вопросы (inc/rubriki.php, файлы content/rubriki/). Аккордеон .ep-faq__* — в ep-base.css. */
.ep-cat__text { margin-top: 64px; }
.ep-cat__text-h { margin: 0 0 20px; font-size: var(--ep-h2); }
.ep-cat__prose { font-size: 17px; line-height: 1.65; max-width: none; }
.ep-cat__prose > p, .ep-cat__prose > ul, .ep-cat__prose > ol, .ep-cat__prose > h2, .ep-cat__prose > h3 { max-width: 70ch; }
.ep-cat__prose h2 { font-size: 21px; }
.ep-cat__prose h3 { font-size: 18px; }
.ep-cat__faq { margin-top: 36px; }
.ep-cat__faq-h { margin: 0 0 12px; font-size: 21px; }
@media (max-width: 767px) {
  .ep-cat__text { margin-top: 44px; }
  .ep-cat__prose { font-size: 16px; }
}

/* Товары «нет в наличии»: отдельная серая панель под нашими товарами, мелкие плитки без фото, цены и кнопки */
.ep-out { margin-top: 64px; padding: 28px 28px 30px; background: var(--ep-soft); border-radius: var(--ep-radius); }
.ep-out__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; margin-bottom: 18px; }
.ep-out__h { margin: 0; font-size: 22px; line-height: 1.2; }
.ep-out__note { margin: 0; max-width: 62ch; font-size: var(--ep-small); line-height: 1.45; color: var(--ep-muted); }
.ep-out__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.ep-out__item { display: flex; }
.ep-out__link {
  display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 11px 12px 10px;
  background: var(--ep-bg); border: 1px solid var(--ep-line); border-radius: var(--ep-radius);
  color: var(--ep-ink-2); text-decoration: none; transition: border-color .15s var(--ep-ease), color .15s var(--ep-ease);
}
.ep-out__name { font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.ep-out__lat { margin-top: 2px; font-size: 12px; line-height: 1.3; color: var(--ep-muted); overflow-wrap: anywhere; }
.ep-out__stock { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; font-size: 12px; line-height: 1.2; color: var(--ep-muted); }
.ep-out__stock::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
@media (hover: hover) and (pointer: fine) {
  .ep-out__link:hover { border-color: var(--ep-muted); color: var(--ep-ink); }
}
.ep-srch__grid[hidden] + .ep-out { margin-top: 20px; }
@media (max-width: 1199px) { .ep-out__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1023px) { .ep-out__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .ep-out { margin: 44px calc(-1 * var(--ep-gap)) 0; padding: 22px var(--ep-gap) 24px; border-radius: 0; }
  .ep-out__h { font-size: 20px; }
  .ep-out__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ep-out__name { font-size: 14px; }
}
