/* Sections with a background butt flush against the block above them (no body-color gap).
   Templates wrap patterns in a constrained-layout <main>, so the default blockGap margin
   (24px) is applied by core's `.is-layout-constrained > *` rule, not `.wp-site-blocks > *`.
   Uses core's own .has-background class, added automatically whenever a block sets
   backgroundColor or a background image. Editors can still override per-instance via the
   block's own Dimensions > Margin control in the editor -- an inline style="margin-top:..."
   on the element always wins over this class selector, so no extra mechanism is needed. */
.is-layout-constrained > .has-background {
	margin-block-start: 0;
}

/* The footer template part (tagName "footer") is a direct child of the root .wp-site-blocks
   wrapper (not of the <main> is-layout-constrained group), so it gets core's generic
   `:where(.wp-site-blocks) > *` blockGap margin instead. Always butt it flush against
   whatever section precedes it, regardless of whether its own inner group has a background. */
.wp-site-blocks > footer {
	margin-block-start: 0;
}

/* Figma mobile frames (e.g. 4788:27588) inset every section's content 16px (Space/400) from the
   viewport edge. Several patterns only pad their alignfull wrapper top/bottom, relying on their
   contentSize-constrained children to stay narrower than the viewport -- true on desktop, false
   below this breakpoint. Provide a horizontal-padding floor here; a pattern's own inline left/right
   padding (e.g. the `gutter` token) always wins over this class selector, so it's a no-op wherever
   a pattern already sets one.

   :not(.wp-block-post-content) because templates/page.html renders post-content as alignfull (so
   its sections can go edge-to-edge). That makes the wrapper itself match this selector, and padding
   on the wrapper insets every section's *background* rather than its content -- the exact opposite
   of the intent. The wrapper is structure, not a section; its children each carry their own floor. */
@media (max-width: 781px) {
	.alignfull.is-layout-constrained:not(.wp-block-post-content) {
		padding-left: var(--wp--preset--spacing--400);
		padding-right: var(--wp--preset--spacing--400);
	}
}

/* Section bands carry their 100px vertical rhythm as an inline style, which no rule can override
   without !important, so the token itself is retargeted below the breakpoint. Space/2500 is only
   ever used vertically -- patterns pair it with `gutter` for the horizontal sides -- so nothing
   moves sideways. */
@media (max-width: 781px) {
	:root {
		--wp--preset--spacing--2500: var(--wp--preset--spacing--1500);
	}
}
