/* Prompt 7: Galoshin catalogue geometry, Warmth for You tokens.
 * Integrator: load AFTER reference.css and drupal.css. No global typography/reset.
 * Purchase UI is omitted by Twig; the final block is defence in depth only.
 */
.vesta-inner .vesta-products-grid.p7-products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 30px;
  align-items: stretch;
}
.vesta-product-card.p7-product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
  max-width: 270px;
  justify-self: center;
  padding: 0 0 18px;
  border: 0;
  border-radius: 0;
  background: var(--bg-white);
  color: var(--text-dark);
  font-family: inherit;
  overflow-wrap: anywhere;
}
.p7-product-card .p7-product-card__media {
  width: 100%;
  max-width: 270px;
  aspect-ratio: 270 / 340;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-light);
}
.p7-product-card__media > .p9-product-image-link,
.p7-product-card__media > .p9-product-image-link > .field,
.p7-product-card__media .field__items,
.p7-product-card__media .field__item,
.p7-product-card__media .field__item > a { display: block; width: 100%; height: 100%; margin: 0; }
.p7-product-card__media .field__label,
.p7-product-card__media .field__item:not(:first-child) { display: none; }
.vesta-product-card.p7-product-card .vesta-product-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 270 / 340;
  object-fit: contain;
  transition: transform .2s ease;
}
.p7-product-card__media a:hover img { transform: scale(1.03); }
.p7-product-card .p7-product-card__title { margin: 0; min-height: 2.6em; font: 500 16px/1.3 var(--font-family); }
.p7-product-card__title a { color: var(--text-dark); text-decoration: none; }
.p7-product-card__title a:hover { color: var(--nav-blue); text-decoration: underline; }
.p7-product-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 80px;
  padding: 24px;
  color: var(--text-muted);
  background: var(--bg-light);
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}
.p7-product-price { color: var(--text-dark); font-size: 22px; font-weight: 700; line-height: 1.3; }
.p7-product-price .field__label { display: none; }
.p7-product-price :is(.field, .field__item) { display: inline; }
.p7-product-card > .contextual,
.p7-product > .contextual { z-index: 600; }
.p7-product { position: relative; min-width: 0; color: var(--text-dark); overflow-wrap: anywhere; }
/* Flowing text wraps the left gallery and naturally fills the full width
 * below it. The later structured sections clear the float explicitly. */
.vesta-product .vesta-product-layout.p7-product-layout { display: flow-root; }
.p7-product-copy { min-width: 0; }
.p7-product-gallery { float: left; margin: 0 50px 24px 0; min-width: 0; width: 100%; max-width: 500px; }
.p7-product-gallery > .p7-product-placeholder { height: auto; aspect-ratio: 1; border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.p7-product-gallery .field { margin: 0; }
.p7-product-gallery .field__label { display: none; }
.p7-product-gallery .field__items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.p7-product-gallery .field__item { min-width: 0; }
.p7-product-gallery .field__items > .field__item:first-child { grid-column: 1 / -1; }
/* The installed PhotoSwipe formatter outputs .elements/.current-slide/.nav-slide,
 * not .field__items. With no Slick dependency it otherwise stacks all images. */
.p7-product-gallery .photoswipe-gallery > .elements > .current-slide { margin-bottom: 10px; }
.p7-product-gallery .photoswipe-gallery .current-slide > .element:not(:first-child) { display: none; }
.p7-product-gallery .photoswipe-gallery > .elements > .nav-slide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.p7-product-gallery .photoswipe-gallery > .elements > .nav-slide.slick-initialized { display: block; }
.p7-product-gallery .photoswipe-gallery .nav-slide.slick-initialized .slick-slide { padding-inline: 5px; box-sizing: border-box; cursor: pointer; }
.p7-product-gallery .photoswipe-gallery .nav-slide.slick-initialized .slick-current img { border-color: var(--nav-blue); }
.p7-product-gallery .photoswipe-gallery .nav-slide > .element:nth-child(n+5) { display: none; }
.p7-product-gallery .photoswipe-gallery .element { min-width: 0; }
.p7-product-gallery .photoswipe-gallery .element a { display: block; width: 100%; }
.p7-product-gallery a { display: block; max-width: 100%; }
.p7-product-gallery img {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-light);
}
.p7-product-copy > :is(.p7-product-category, .p7-product-sku, .p7-product-price) { margin-bottom: 16px; }
.p7-product-category { color: var(--text-muted); font-size: 14px; }
.p7-product-category a { color: var(--nav-blue); }
.p7-product-sku { color: var(--text-muted); font-size: 14px; }
.p7-product .p7-product__title { margin: 0 0 24px; }
.p7-product .p7-product-section { margin: 24px 0 0; padding: 0; line-height: 1.25; }
/* Core's field clearfix would clear the gallery inside the description,
 * leaving an artificial blank column rather than wrapping naturally. */
.p7-product-section .field--name-body.clearfix::after { display: none; }
.p7-product-specifications { clear: both; }
.p7-product-operation { clear: both; }
.p7-product-section h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.3; }
.p7-product-section .field__label { display: none; }
.p7-product-section p { margin: 0 0 12px; }
.p7-product-section :is(img, video, iframe) { max-width: 100%; }
.p7-product-table-scroll { max-width: 100%; overflow-x: auto; }
.p7-product-specifications table { width: 100%; border-collapse: collapse; font-size: 14px; }
.p7-product-specifications :is(th, td) { padding: 12px; border: 1px solid var(--border-color); text-align: left; vertical-align: top; }
.p7-product-specifications tr:nth-child(even) { background: var(--bg-light); }
.p7-products-group-title { margin: 0 0 24px; color: var(--text-dark); }
.view-id-tovary .pager { margin-top: 32px; }
.view-id-tovary .pager :is(.pagination, .pager__items) { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.view-id-tovary .pager :is(.page-item, .pager__item) { margin: 0; padding: 0; }
.view-id-tovary .pager :is(.page-link, .pager__item a) { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; min-height: 42px; padding: 8px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-white); color: var(--nav-blue); text-decoration: none; font-weight: 500; }
.view-id-tovary .pager :is(.page-link:hover, .page-item.active a, .pager__item.is-active a) { background: var(--nav-blue); color: var(--bg-white); border-color: var(--nav-blue); }
:where(.p7-product-card, .p7-product, .view-id-tovary .pager) :focus-visible { outline: 3px solid var(--nav-blue); outline-offset: 3px; }
/* Explicit selectors, NEVER a blanket button/form rule: contextual tools must work. */
:is(.p7-product-card, .p7-product) :is(
  .commerce-order-item-add-to-cart-form,
  [id^="commerce-order-item-add-to-cart-form"],
  [data-drupal-selector*="add-to-cart"],
  .field--name-variations,
  .field--name-quantity,
  .field--name-add-to-cart,
  .field_one_click,
  .commerce-add-to-cart-popup,
  a[href="/cart"],
  a[href^="/checkout"],
  .field--name-field-nalichie-tovara,
  .field--name-field-stock,
  .field--name-field-labels,
  .field--name-field-badges,
  .product-label,
  .product-badge
) { display: none !important; }
@media (max-width: 1199px) {
  .vesta-inner .vesta-products-grid.p7-products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .p7-product-gallery { margin-right: 30px; }
}
@media (max-width: 991px) {
  .vesta-inner .vesta-products-grid.p7-products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .p7-product-gallery { float: none; margin: 0 auto 28px; }
  .p7-product-gallery .photoswipe-gallery > .elements > .current-slide { margin-bottom: 0; }
  .p7-product-gallery .photoswipe-gallery > .elements > .nav-slide,
  .p7-product-gallery .photoswipe-gallery > .elements > .nav-slide.slick-initialized { display: none; }
}
@media (max-width: 576px) {
  .vesta-inner .vesta-products-grid.p7-products-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .p7-product-card .p7-product-card__title { min-height: 0; }
  .p7-product-section h2 { font-size: 20px; }
  .p7-product-gallery .field__items { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .vesta-product-card.p7-product-card .vesta-product-image img { transition: none; }
}
