/* ============================================================================
   YEMMA CORE — the USP band

   Three rules, and they fix something that was already broken.

   The theme's `.usp` is `grid-template-columns: repeat(4, 1fr)`, and its own
   template skips a column with no heading and no text. Those two facts do not
   agree: a shop showing three columns got three columns in a four-column grid
   and an empty cell where the fourth had been, with a stray divider rule beside
   it. The template's comment says a cleared column "still occupies its cell",
   which is what it was designed to do and not what the code does.

   Nothing in the plugin can change that markup — the band is drawn by the
   theme's template — so the count is read off the DOM instead. `:has()` asks
   how many columns actually rendered, which is the one question the stylesheet
   could not previously ask.

   Four needs no rule: it is already the default and the common case.

   ## Why every rule below is inside a media query

   This file shipped without them and was wrong on a phone, silently, from the
   day it landed.

   `sections.css` collapses the band itself — two columns at 900px and one at
   520px — and it does that with a bare `.usp`, which scores 0-1-0. A
   `.usp:has(> .usp__i:nth-child(3):last-child)` scores 0-4-0. Specificity beats
   source order and beats a media query's *position* in the cascade, so a shop
   with three reasons got three columns on a 375px phone: three cells of about
   a hundred pixels each, with the heading wrapping mid-word.

   The fix is not `!important` and it is not reordering. It is saying where each
   rule applies, so the counting rules only ever run at the width where counting
   is the question — and the theme's own breakpoints go on deciding everything
   below it. The two numbers below are read off `sections.css:346-347`; they are
   the theme's, not this file's, and if they move there they move here.
   ========================================================================== */

@media (min-width: 901px) {

	.usp:has(> .usp__i:nth-child(1):last-child) {
		grid-template-columns: minmax(0, 1fr);
	}

	.usp:has(> .usp__i:nth-child(2):last-child) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.usp:has(> .usp__i:nth-child(3):last-child) {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/*
 * Between 521 and 900 the theme already draws two columns, which is right for
 * two items and right for three — the third simply wraps onto a second row,
 * which is what a two-column grid is for. Only a single item needs saying: on
 * its own it would sit in the left half with an empty right half beside it.
 */
@media (min-width: 521px) and (max-width: 900px) {

	.usp:has(> .usp__i:nth-child(1):last-child) {
		grid-template-columns: minmax(0, 1fr);
	}
}

/*
 * Below 520 the theme is already one column and there is nothing to count.
 *
 * A browser without `:has()` gets the four-column grid it always got, with the
 * gap it always had. That is the honest fallback: the band still reads, and
 * nothing about it is worse than it was before this file existed.
 */
