/**
 * The "Ajánlott termékek" row under a single product.
 *
 * The cards themselves are the Product Card component and bring their own
 * styling; the grid is `.product-grid__items`, the same one the archive uses,
 * so the four cards here sit exactly as they do on a category page. What is
 * left for this file is the section around them — width, spacing, and the
 * heading rule that the description and winery blocks above already use.
 */

/*
 * If the row ends up with no cards at all, take the whole section with it.
 *
 * The four are picked in PHP and that walk cannot come back short, but the step
 * after it can: an `etch/loop` whose preset has gone missing draws nothing and
 * says nothing, which is how this row emptied once already when the Etch editor
 * wrote back an older `etch_loops`. The heading and its rule would stay behind
 * and announce a section that is not there. This is the second line of defence,
 * not the first — see innowine-etch-loops.php for the one that keeps the preset
 * alive.
 */
.ajanlott-section:not(:has(.product-card)) {
  display: none;
}

/*
 * 1300px is the width of `.single-product__inner` above it, so the row lines up
 * with the product it belongs to rather than with the wider category grid.
 */
.ajanlott-inner {
  inline-size: 100%;
  max-inline-size: 1300px;
}

.ajanlott-section {
  inline-size: 100%;
  padding-block: var(--space-m, 3rem) var(--space-l, 4.5rem);
  padding-inline: var(--space-s, 2rem);
}

@media (width <= 767px) {
  .ajanlott-section {
    padding-inline: var(--space-xs, 1.33rem);
  }
}

/* Same size and rule as `.leiras-head`, so the three headings down the page
   read as one set. */
.ajanlott-head {
  margin: 0;
  font-size: calc(var(--text-m) + 8px);
}

.ajanlott-inner > .border-bottom {
  margin-block: var(--space-xs, 1.33rem) var(--space-s, 2rem);
  border-block-end: 1px solid #ccc;
}

/*
 * The grid draws four columns with no gap because the card pads itself, and
 * that padding disappears under 991px, where the shared rules put a 20px
 * gutter back.
 */
.ajanlott-grid .product-grid__items {
  --_pg-columns: 4;
}

/*
 * The shared grid drops to three columns under 992px, which is right for an
 * archive of sixteen and wrong for a row of exactly four: it would leave one
 * card alone on a second row. Two by two instead, all the way down — two
 * classes in the selector, because the rule being overridden is one class and
 * a media query.
 */
@media (width <= 991px) {
  .ajanlott-grid .product-grid__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
