/* catalog-fixes.css — poli-tika.ru catalog/PDP presentation corrections
   Loaded on tplCategory (id=6) and tplProduct (id=7) only.
   Does not touch style.css or responsive-fixes.css. */

/* B2 — category card meta shown as distinct readable rows (SKU / characteristics) */
.product-card__meta--sku {
  margin: 0 0 2px;
  font-weight: 600;
  color: var(--color-text-muted);
}
.product-card__meta--chars {
  margin: 0 0 var(--space-4);
  color: var(--color-text-faint);
}

/* ── PDP purchase relocated ONTO the image card (cf6) ────────────────────
   The left column is a single product-card = image + price/qty/«В корзину»,
   visually and functionally identical to a category product card.
   cart.js binds via [data-product-id]; apply_group_prices.js via .pc-price__main.
   The right column keeps only Арт./name/specs/description (no purchase dup). */

/* image + card scroll with the page (override style.css sticky) */
.product-section .product-photo-wrap,
.product-photo-wrap { position: static !important; top: auto !important; }

/* narrow left column hugging the ~340px card; right column takes the rest */
.product-section .product-layout {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr) !important;
  align-items: start !important;
  gap: 40px;
}
@media (max-width: 860px) {
  .product-section .product-layout { grid-template-columns: 1fr !important; gap: 24px; }
}

/* the unified left card */
.product-section .pdp-card {
  max-width: 340px;
  width: 100%;
  margin: 0;
  cursor: default;
}
@media (max-width: 860px) {
  .product-section .pdp-card { margin-left: auto; margin-right: auto; }
}
.product-section .pdp-card:hover { box-shadow: none; border-color: var(--color-border); }
.product-section .pdp-card .product-card__img-wrap { aspect-ratio: 1 / 1; background: #fff; }
.product-section .pdp-card .product-card__img-wrap img {
  width: 100%; height: 100%; object-fit: contain; padding: 12px; box-sizing: border-box; background: #fff;
}
.product-section .pdp-card:hover .product-card__img-wrap img { transform: none; }
.product-section .pdp-card .product-card__badges {
  position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 1;
}
.product-section .pdp-card .product-badge--new {
  background: var(--color-primary); color: #fff; font-size: 12px; font-weight: 700;
  padding: 3px 12px; border-radius: 12px;
}

/* Compact typography (mobile) — align PDP with the catalog scale, no giant lines */
@media (max-width: 600px) {
  .product-hero .page-hero__title { font-size: 1.5rem; line-height: 1.2; }
  .product-info__name { font-size: 1.25rem; line-height: 1.25; }
  .product-info__price .pc-price__main { font-size: 1.5rem; }
}

/* B3 — PDP summary metadata stays on one line at desktop; may wrap on mobile */
@media (min-width: 1024px) {
  .product-hero .page-hero__subtitle { white-space: nowrap; max-width: none; }
}
@media (max-width: 1023px) {
  .product-hero .page-hero__subtitle { white-space: normal; }
}

/* B6 — >=44px touch targets on mobile (category cards + PDP purchase block) */
@media (max-width: 900px) {
  .product-card__qty { height: 44px; }
  .product-card__qty-btn { width: 44px; height: 44px; }
  .product-card__qty-input { height: 44px; font-size: 16px; } /* 16px avoids iOS zoom */
  .product-card__add-full { min-height: 44px; padding: 12px; font-size: 14px; }
}

/* ===== catalog category switcher (16 top-level tiles) — cf4 ===== */
.cat-tabs {
  grid-template-columns: repeat(8, 1fr) !important;
  gap: 14px !important;
}
.cat-tab {
  aspect-ratio: auto !important;
  min-height: 150px;
  padding: 18px 10px !important;
  gap: 12px !important;
  font-size: 13px !important;
}
.cat-tab__icon {
  width: 58px !important;
  height: 58px !important;
  padding: 11px !important;
  border-radius: 14px !important;
}
.cat-tab__label {
  font-size: 13px !important;
  font-weight: 600;
  line-height: 1.25;
}
.cat-active-header { padding-top: 10px; }
@media (max-width: 1199px) { .cat-tabs { grid-template-columns: repeat(6, 1fr) !important; } }
@media (max-width: 991px)  { .cat-tabs { grid-template-columns: repeat(4, 1fr) !important; } }
@media (max-width: 679px)  {
  .cat-tabs { grid-template-columns: repeat(3, 1fr) !important; }
  .cat-tab { min-height: 122px; padding: 14px 8px !important; }
  .cat-tab__icon { width: 50px !important; height: 50px !important; }
}
@media (max-width: 459px)  { .cat-tabs { grid-template-columns: repeat(2, 1fr) !important; } }



/* ============================================================
   Phase 3 — category heading w/ icon + fixed 3-line card titles
   (supersedes the earlier min-height clamp)
   ============================================================ */

/* Заголовок активной/текущей категории над сеткой: иконка + название,
   без счётчика позиций и без CTA. Цвет иконки берётся из .cat-icon--{color}. */
.cat-active-header {
  display: flex !important;
  align-items: center !important;
  gap: 16px;
  padding: 6px 0 24px !important;
}
.cat-active-header__icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  padding: 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.cat-active-header__icon svg { width: 100%; height: 100%; display: block; }
.cat-active-header__title { margin: 0; }
@media (max-width: 679px) {
  .cat-active-header__icon { width: 48px; height: 48px; padding: 10px; border-radius: 14px; }
}

/* E — фиксированная область названия ровно под 3 строки на всех карточках.
   Детерминированные px (не em/clamp), чтобы высота не «плавала» с font-size:
   14px × line-height 19px × 3 = 57px. flex:none снимает рост из style.css. */
.product-card__name {
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  flex: none !important;
  font-size: 14px !important;
  line-height: 19px !important;
  height: 57px !important;
  min-height: 57px !important;
  max-height: 57px !important;
  margin: 0 0 8px !important;
}

/* Ссылка-обёртка растягивается → footer (sibling) прижат к низу карточки,
   а фиксированная высота названия выравнивает meta/цену/кнопку по вертикали. */
.product-card__link {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
}
.product-card__body {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
}

/* ── PDP description lists kept inside the text column (cf7) ───────────
   Global reset (*{padding:0}) strips ul/ol padding, so default outside
   markers render left of the zero-padding list box and protrude past the
   left edge of .product-info__desc. Restore an indent so markers + text
   sit fully inside the container; keep long lines aligned under the text. */
.product-info__desc { overflow-wrap: break-word; }
.product-info__desc ul,
.product-info__desc ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
  list-style-position: outside;
}
.product-info__desc ul { list-style-type: disc; }
.product-info__desc ol { list-style-type: decimal; }
.product-info__desc li { margin: 0.25em 0; line-height: 1.6; }
/* nested lists: extra indent + distinct marker, still inside the column */
.product-info__desc ul ul,
.product-info__desc ul ol,
.product-info__desc ol ul,
.product-info__desc ol ol { margin: 0.25em 0; padding-left: 1.25em; }
.product-info__desc ul ul { list-style-type: circle; }
.product-info__desc ul ul ul { list-style-type: square; }
@media (max-width: 600px) {
  .product-info__desc ul,
  .product-info__desc ol { padding-left: 1.35em; }
}

/* ─────────────────────────────────────────────────────────────
   ГЛАВНАЯ: карточки категорий — счётчик прижат к нижнему краю.
   Одинаковая высота карточек в ряду (grid stretch), название
   занимает свободное место, счётчик всегда внизу независимо от
   длины названия. Desktop/mobile, без overflow.
   ───────────────────────────────────────────────────────────── */
.categories-grid { align-items: stretch; }
.categories-grid .category-card {
  height: 100%;
  justify-content: flex-start;
}
.categories-grid .category-card__name {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-wrap: anywhere;
}
.categories-grid .category-card__count {
  margin-top: auto;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   HERO photo-cards (homepage): pin the "Открыть" badge to the
   bottom edge of every card so all badges share one baseline,
   independent of title length. Cards are equal-height (2×2 grid,
   1fr rows), so a full-height overlay + margin-top:auto suffices. */
.hero__visual .hero__card--photo .hero__card-label {
  top: 0; right: 0; bottom: 0; left: 0;
  justify-content: space-between;
  padding: 18px;
  background: linear-gradient(to bottom,
      rgba(4,12,35,0.85) 0%,
      rgba(4,12,35,0.30) 28%,
      rgba(4,12,35,0.00) 52%,
      rgba(4,12,35,0.55) 100%);
}
.hero__visual .hero__card--photo .hero__card-label__title {
  flex: 0 0 auto;
}
.hero__visual .hero__card--photo .hero__card-label__badge {
  margin-top: auto;
  align-self: flex-start;
}

/* ─────────────────────────────────────────────────────────────
   GLOBAL editorial list fix (cf10) — all internal CMS pages.
   The global reset (*{margin:0;padding:0}) strips ul/ol indent, so
   default outside markers render left of the zero-padding list box
   and protrude past the container's left edge (e.g. ЖКХ, privacy,
   delivery). Editorial lists authored in the WYSIWYG are bare
   <ul>/<ol> with no class inside the standard `.section .container`
   content wrapper; UI lists (nav, footer, category grids, product
   cards, hero, sliders, cart, service UI) always carry component
   classes, so `:not([class])` + the `.section` anchor exclude them.
   `.page-hero`, `.cart-section`, `.product-section` are not `.section`,
   so breadcrumbs/cart/PDP are untouched (PDP keeps its own rule above).
   No !important: author inline padding (where present) still wins;
   this only supplies a safe indent where the author set none. */
.section .container ul:not([class]),
.section .container ol:not([class]) {
  margin: 0.6em 0;
  padding-left: 1.6em;
  list-style-position: outside;
  overflow-wrap: break-word;
}
.section .container ul:not([class]) { list-style-type: disc; }
.section .container ol:not([class]) { list-style-type: decimal; }
.section .container ul:not([class]) li,
.section .container ol:not([class]) li {
  margin: 0.3em 0;
  line-height: 1.7;
  overflow-wrap: break-word;
}
/* nested levels: extra indent + distinct markers, still inside the column */
.section .container ul:not([class]) ul,
.section .container ul:not([class]) ol,
.section .container ol:not([class]) ul,
.section .container ol:not([class]) ol {
  margin: 0.3em 0;
  padding-left: 1.3em;
}
.section .container ul:not([class]) ul { list-style-type: circle; }
.section .container ul:not([class]) ul ul { list-style-type: square; }
@media (max-width: 600px) {
  .section .container ul:not([class]),
  .section .container ol:not([class]) { padding-left: 1.45em; }
}

/* ─────────────────────────────────────────────────────────────
   Общий блок «Перейти к категориям каталога» (cf11) — единый на
   всех 8 страницах секции «Решения для вашего бизнеса» (7 сфер + ЖКХ).
   Явный вертикальный ритм: отступ секции сверху/снизу и гарантированный
   зазор между заголовком и сеткой карточек. Без <br>/пустых <p> —
   всё через этот класс. Сетка и карточки — компонент homeCategories
   (.categories-grid/.category-card), внешний вид идентичен главной. */
.catalog-cats { margin: 40px 0 8px; }
.catalog-cats__title {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 24px;           /* зазор заголовок → сетка (desktop) */
}
.catalog-cats .categories-grid { margin-top: 0; }
@media (max-width: 600px) {
  .catalog-cats { margin: 32px 0 4px; }
  .catalog-cats__title { margin: 0 0 18px; }   /* зазор на mobile */
}

/* cf12: equalize catalog-cats card + name height to ЖКХ reference */
.catalog-cats .category-card { min-height: 194px; }
.catalog-cats .category-card__name { min-height: 42px; }
@media (max-width: 600px) {
  .catalog-cats .category-card { min-height: 187px; }
  .catalog-cats .category-card__name { min-height: 37px; }
}

/* cf13: страница товара — заголовок над блоками + вкладки описания (внедрено по всему каталогу) */
.product-heading { margin-bottom: 24px; }
.product-heading .product-info__sku { font-size: 12px; color: var(--color-text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.product-heading .product-info__name { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 4px 0 0; color: var(--color-text); }

.pdp-tabs { display: flex; gap: 6px; background: var(--color-surface); border: 1.5px solid var(--color-border); border-radius: 16px; padding: 6px; overflow-x: auto; scrollbar-width: none; }
.pdp-tabs::-webkit-scrollbar { display: none; }
.pdp-tab { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; background: transparent; border: none; padding: 10px 18px; border-radius: 11px; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--color-text-muted); cursor: pointer; white-space: nowrap; transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.pdp-tab__icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .55; transition: opacity .2s ease; }
.pdp-tab:hover:not(.is-active) { color: var(--color-text); background: rgba(21,82,212,0.06); }
.pdp-tab:hover:not(.is-active) .pdp-tab__icon { opacity: .8; }
.pdp-tab.is-active { color: #fff; background: var(--color-primary); box-shadow: 0 6px 16px rgba(21,82,212,0.28); }
.pdp-tab.is-active .pdp-tab__icon { opacity: 1; }
.pdp-tab-panels { margin-top: 22px; animation: pdpFadeIn .25s ease; }
.pdp-tab-panel { display: none; }
.pdp-tab-panel.is-active { display: block; }
@keyframes pdpFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 480px) { .pdp-tab { padding: 9px 14px; font-size: 13px; } .pdp-tab__icon { width: 16px; height: 16px; } }

.pdp-tab-panel .product-info__desc > p { margin: 0 0 14px; }
.pdp-tab-panel .product-info__desc > ul { margin: 0 0 14px; }
.pdp-tab-panel .product-info__desc > p:last-child,
.pdp-tab-panel .product-info__desc > ul:last-child { margin-bottom: 0; }

.pdp-delivery-zone__note { font-size: 13px; line-height: 1.65; color: var(--color-text-faint); }
.pdp-delivery-zone__note strong { color: var(--color-text-muted); font-size: 14px; }
.pdp-delivery-zone__note a { color: var(--color-primary); text-decoration: none; border-bottom: 1px dotted rgba(21,82,212,0.45); }
.pdp-delivery-zone__note a:hover { border-bottom-style: solid; }

/* cf14: блок «Другие варианты» под фото/ценой товара */
.pdp-variants { margin-top: 24px; }
.pdp-variants__title { font-family: var(--font-display); font-size: 18px; font-weight: 800; letter-spacing: -0.01em; color: var(--color-text); margin: 0 0 14px; }
.pdp-variants__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pdp-variant-card { display: block; text-decoration: none; border: 1.5px solid var(--color-border); border-radius: 14px; background: var(--color-surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.pdp-variant-card:hover { border-color: var(--color-primary); box-shadow: 0 6px 16px rgba(21,82,212,0.12); }
.pdp-variant-card__img-wrap { position: relative; aspect-ratio: 1 / 1; background: #fff; }
.pdp-variant-card__img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 10px; box-sizing: border-box; }
.pdp-variant-card__badge { display: none; }
.pdp-variant-card__body { padding: 10px 12px 12px; }
.pdp-variant-card__name { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--color-text); line-height: 1.3; }
.pdp-variant-card__meta { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.pdp-variants__more { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--color-primary); text-decoration: none; }
.pdp-variants__more:hover { text-decoration: underline; }
@media (max-width: 480px) { .pdp-variants__grid { grid-template-columns: 1fr 1fr; gap: 8px; } }
