/**
 * Per-tier section padding and side gutter (Spec 32 FR-32-15).
 *
 * Each client's snapshot sets six tokens in `settings.custom`, printed by WordPress as
 * `--wp--custom--section--padding--{mobile,tablet,desktop}` and `--wp--custom--gutter--{mobile,tablet,desktop}`.
 * This file is their only reader, so a section's padding and the site gutter change at each device tier
 * (Mobile < 768px, Tablet 768-1023px, Desktop >= 1024px) with no per-block setting.
 *
 * GUTTER. WordPress prints `--wp--style--root--padding-left/right` on `body` from `styles.spacing.padding`,
 * and its `.has-global-padding` rule (printed when `useRootPaddingAwareAlignments` is on) reads them;
 * `SGS_Container_Wrapper` gives that class to a container with a content band. Redefining the two properties
 * per tier here moves every gutter at once. `:root:root body` (0,2,1) beats the `body` declaration on
 * specificity, not on enqueue order.
 *
 * SECTION PADDING. `SGS_Container_Wrapper` gives `sgs-container--section-pad` to a block whose role is a page
 * section (it declares `supports.sgs.sectionPadding`: sgs/container) when it has a content band. Only a top-level
 * page section takes it: a container inside the site header or footer, or inside any sgs/container other than the
 * `main` page wrapper, takes none, so an inner box never inherits a section's padding and nesting never compounds.
 * `:where()` keeps the rule at zero specificity: any padding the client sets on the
 * block (a per-instance class rule) wins on every side and tier it sets. Top and bottom are written as longhands
 * so the minifier cannot fold them into a shorthand.
 */

:root:root body {
	--wp--style--root--padding-left: var(--wp--custom--gutter--mobile);
	--wp--style--root--padding-right: var(--wp--custom--gutter--mobile);
}

/*
 * A container whose own side padding paints its band carries `sgs-band-gutter` instead of
 * `has-global-padding` (SGS_Container_Wrapper). It already pays the gutter, so core's nesting reset
 * applies below it too: a banded container inside it pays no second gutter. Same selectors and
 * specificity as core's two reset rules; this file loads after the global styles, so it wins on order.
 */
.sgs-band-gutter :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) {
	padding-right: 0;
	padding-left: 0;
}

.sgs-band-gutter :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull {
	margin-left: 0;
	margin-right: 0;
}

:where(.sgs-container--section-pad:not(.sgs-container--section-pad .sgs-container--section-pad, header *, footer *, .sgs-container:not(main) .sgs-container--section-pad)) {
	padding-top: var(--wp--custom--section--padding--mobile, 0);
	padding-bottom: var(--wp--custom--section--padding--mobile, 0);
}

@media (min-width: 768px) {
	:root:root body {
		--wp--style--root--padding-left: var(--wp--custom--gutter--tablet);
		--wp--style--root--padding-right: var(--wp--custom--gutter--tablet);
	}

	:where(.sgs-container--section-pad:not(.sgs-container--section-pad .sgs-container--section-pad, header *, footer *, .sgs-container:not(main) .sgs-container--section-pad)) {
		padding-top: var(--wp--custom--section--padding--tablet, 0);
		padding-bottom: var(--wp--custom--section--padding--tablet, 0);
	}
}

@media (min-width: 1024px) {
	:root:root body {
		--wp--style--root--padding-left: var(--wp--custom--gutter--desktop);
		--wp--style--root--padding-right: var(--wp--custom--gutter--desktop);
	}

	:where(.sgs-container--section-pad:not(.sgs-container--section-pad .sgs-container--section-pad, header *, footer *, .sgs-container:not(main) .sgs-container--section-pad)) {
		padding-top: var(--wp--custom--section--padding--desktop, 0);
		padding-bottom: var(--wp--custom--section--padding--desktop, 0);
	}
}
