/*
 * core/query-pagination — rules scoped to the units that place it.
 */

/* -------------------------------------------------------------------------- news-listing
 *
 * Unit: news-listing (templates/home.html). Hook class .wm-news-listing on the
 * core/query root; this block is its second child.
 *
 * THE PAGER'S OWN 60px TOP MARGIN, AND WHY IT CANNOT BE A BLOCK ATTRIBUTE. The contract
 * measures `nav.pager` at 1200x51 at x=120 y=1786 with `margin: 60px 0`, and says in the
 * same breath that the value must not be written as `style.spacing.margin`:
 * core/query-pagination's block.json declares `supports` as anchor, align, reusable, html,
 * color, layout, typography and interactivity, with NO `spacing`, so a margin attribute on
 * that node validates against the schema, emits nothing, and leaves the 60px unaccounted
 * for. A scoped rule is the remaining mechanism and the contract hands the choice here.
 *
 * 60px AND NOT 90px, WITH THE OTHER 30px SOMEWHERE ELSE. The measured gap between the last
 * card row and the pager is 90px: row two ends at y=1696 and the pager starts at 1786. It is
 * two numbers, not one. 60 is the pager's own margin, quoted above. The other 30 is the card
 * row's bottom gutter — row one ends at 1255 and row two begins at 1284, so every row in the
 * source carries it, the last one included. A CSS grid puts its gap BETWEEN rows and nothing
 * after the last, so that trailing 30px is written as `padding.bottom` on core/post-template
 * in templates/home.html, where it belongs to the grid rather than to the pager. 30 + 60 = 90,
 * and each half is traceable to the rule that produces it in the source.
 *
 * Written as `margin-block-start` rather than `margin-block` deliberately: the bottom half of
 * the source's `margin: 60px 0` is the root's `padding-block-end` in query.css, because a last
 * child's bottom margin collapses out of a root that has no padding or border. That note is
 * the one home for the reasoning; it is not repeated here.
 *
 * THE PAGER IS 30px WIDER THAN THE UNIT ROOT AND STARTS 15px TO ITS LEFT, WHICH IS ARITHMETIC
 * ON TWO CONTRACT MEASUREMENTS AND NOT AN INFERENCE ABOUT THE SOURCE'S FRAMEWORK. The root is
 * measured at 1170 wide at x=135; `nav.pager` is measured at 1200 wide at x=120 -- inside that
 * root, wider than it, and hanging 15px past it on each side. (1170 - 1200) / 2 = -15, and a
 * negative inline margin is the only thing that produces a box wider than its own containing
 * block without a new element.
 *
 * `align: "wide"` WAS TRIED FIRST AND CANNOT DO IT, measured rather than assumed. It is the
 * obvious core answer and it is inert here: core's constrained layout gives an `.alignwide` child
 * a LARGER `max-width` (the theme's 1200px wideSize), but the child's `width` is still `auto`, so
 * it resolves to the containing block's width. The containing block is the 1170px unit root, 1170
 * is under the 1200 cap, and the nav measured 1170x30 at x=135 with the class on it. A wider
 * container would fix it -- but the container IS the unit root, and the root's own measured 1170
 * at x=135 is worth more to a comparison than the pager's 30px, since every other box is read
 * relative to it.
 *
 * IT CARRIES `!important` BECAUSE THE DECLARATION IT OVERRIDES DOES, which is the same reason
 * columns.css carries it on this unit's siblings. core's constrained layout writes
 * `.wp-container-... > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: ...;
 * margin-left: auto !important; margin-right: auto !important }` -- the `!important` is core's own,
 * in layout.php, and a plain declaration at any specificity loses to it. Measured, not assumed: the
 * rule below was written without `!important` first and the nav still measured 1170x30 at x=135.
 *
 * THE `max-width` IS THE OTHER HALF OF THE SAME BOX AND WAS ALSO MEASURED RATHER THAN REASONED.
 * The same core rule that writes the `!important` margins writes `max-width: 1170px` beside them,
 * and that one is NOT important. With the negative margins alone the nav moved to x=120 and stayed
 * 1170 wide -- left edge right, right edge 30px short -- because the cap still applied. The 1200px
 * below is the contract's measured `nav.pager` width, and a plain 0,2,0 declaration beats core's
 * 0,1,0 one with no `!important` needed.
 *
 * SPECIFICITY, CHECKED RATHER THAN ASSUMED. core's constrained layout emits
 * `.wp-container-... > * + * { margin-block-start: <gap> }` at one class of specificity, and
 * only when the container carries an explicit `blockGap` — which core/query here does not. The
 * two-class selector below wins in either case, so this rule does not depend on that gate
 * staying as it is.
 */
.wm-news-listing > .wp-block-query-pagination {
	margin-block-start: var(--wp--preset--spacing--70);
	margin-inline: -15px !important;
	max-width: 1200px;
}

/* ------------------------------------------------------------------ products-listing
 *
 * Unit: products-listing (templates/archive-product.html). Hook class
 * .wm-products-listing__pager on the core/query-pagination; its one child is the "View More
 * Products" next link.
 *
 * THE LINK IS THE SOURCE'S FILLED CTA, AND CORE GIVES IT NONE OF THE CLASSES THAT STYLE ONE.
 * Measured on the live source (Playwright, 1440x900): `a.button` in `ul.pager` computes
 * rgb(219, 36, 11) fill, 21px/700 uppercase text, padding 20px 0 20px 30px, 270x61, with a
 * `::after` offset plate (the `%cta-button` mechanism) and `margin: 60px 0` on the list.
 * core/query-pagination-next renders a bare `<a class="wp-block-query-pagination-next">` and the
 * theme's button element style compiles to `.wp-element-button, .wp-block-button__link` only, so
 * the template puts `wp-element-button` on the anchor (className lands on the anchor for this
 * block) to inherit fill, type and padding from theme.json, and this rule supplies what only a
 * `core/button` gets from button.css: the plate. The plate rule there is keyed on
 * `.wp-block-button:not(.is-style-outline) > .wp-block-button__link`, which this anchor does not
 * match, so it is restated here for this one anchor rather than widening the theme-wide rule.
 *
 * THE 60px ABOVE THE PAGER IS THE SAME 60 the news-listing pager carries, plus the 30px card-row
 * gutter written as post-template `padding-bottom` in the template (30 + 60 = the 90 measured
 * between the last card and the pager on the source).
 */
/* Two classes, not one: core's constrained layout writes `> * + * { margin-block-start }` at one
   class of specificity and a bare hook class ties with it and loses on source order. */
.wm-products-listing > .wm-products-listing__pager {
	margin-block-start: var(--wp--preset--spacing--70);
	/* No blockGap is written on this flex layout, so core's own default (spacing|20, 10px) applies
	   between the previous/next links when both render. Snapped up to the theme's 16px step
	   (spacing-standard.md 2026-09-25) rather than left at the smaller default. */
	row-gap: var( --wp--preset--spacing--25 );
}

.wm-products-listing__pager .wp-block-query-pagination-next {
	position: relative;
	isolation: isolate;
	text-decoration: none;
}

.wm-products-listing__pager .wp-block-query-pagination-next::after {
	content: "";
	position: absolute;
	top: 0;
	left: 30px;
	z-index: -1;
	width: 100%;
	height: 100%;
	background-color: var(--wp--preset--color--primary);
	transition: all 0.3s ease-in-out;
}

.wm-products-listing__pager .wp-block-query-pagination-next:hover::after {
	transform: skew(15deg);
}

/* The source's `a.button` measures 61px tall: 21px type at line-height 1 plus 20px above and below.
   Inherited line-height would make it 71.5px. */
.wm-products-listing__pager .wp-block-query-pagination-next {
	line-height: 1;
}
