/* Shared content rhythm: native blocks and editor use the same theme roles.
   Components with their own grid/flex layout retain ownership of inner gaps. */
/* A short page gives spare viewport height to the footer's background.
   Its content stays at the top, in normal flow, without moving the wave. */
body > .wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
	min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}
body > .wp-site-blocks > :is(header, main) { flex-shrink: 0; }
body > .wp-site-blocks > footer.wp-block-template-part {
	flex-grow: 1;
	background: var(--wp--custom--footer--background);
}
/* Stacked content gets a wider reading gutter. Inheriting core's root-padding
   variables keeps full-width Groups flush and avoids padding every nested block.
   The header and hero cards retain their outer frame; wide layouts stay 1600px. */
@media (max-width: 64rem) {
 :where(.wp-site-blocks > main, .wp-site-blocks > footer, .editor-styles-wrapper) {
  --wp--style--root--padding-left: var(--wp--custom--spacing--content-gutter);
  --wp--style--root--padding-right: var(--wp--custom--spacing--content-gutter);
 }
 .outloud-hero-band.has-global-padding {
  padding-inline: var(--wp--custom--spacing--page-gutter);
 }
}

:where(.wp-block-post-content, .editor-styles-wrapper) > :is(.wp-block-group, .wp-block-columns, .wp-block-query) + :is(.wp-block-group, .wp-block-columns, .wp-block-query) {
	margin-block-start: var(--wp--custom--spacing--section);
}
.wp-block-group.is-style-outloud-section-stack > * { margin-block: 0; }
.wp-block-group.is-style-outloud-section-stack > * + * {
	margin-block-start: var(--wp--custom--spacing--section);
}
/* A section introduction is separated from its columns or result list. */
:where(.wp-block-post-content, .editor-styles-wrapper) :where(.wp-block-group) > :is(.wp-block-heading, p, .outloud-services-heading) + :is(.wp-block-columns, .wp-block-query) {
	margin-block-start: var(--wp--custom--spacing--subsection);
}
:is(.wp-block-post-content, .editor-styles-wrapper) :where(.is-layout-flow, .is-layout-constrained) > :is(p, ul, ol) + .wp-block-heading {
	margin-block-start: var(--wp--custom--spacing--subsection);
}
:where(.wp-block-post-content, .editor-styles-wrapper) :where(.wp-block-column, .wp-block-group) > .wp-block-heading:first-child {
	margin-block-start: 0;
}
/* A heading and its supporting column content share two tracks across a row.
   Native Group bodies preserve the reading order; no fixed heading heights. */
.wp-block-columns.is-style-outloud-aligned-columns {
	display: grid;
	column-gap: var(--wp--custom--spacing--columns);
	row-gap: var(--wp--custom--spacing--heading);
	align-items: stretch;
	margin-block-end: 0;
}
:where(.wp-block-columns).is-style-outloud-aligned-columns { grid-template-columns: minmax(0, 1fr); }
.wp-block-columns.is-style-outloud-aligned-columns > .wp-block-column {
	display: grid;
	grid-template-rows: subgrid;
	grid-row: span 2;
	row-gap: inherit;
	min-width: 0;
}
.wp-block-columns.is-style-outloud-aligned-columns > .wp-block-column > * { margin: 0; }
:where(.is-style-outloud-aligned-columns > .wp-block-column) > :first-child { align-self: first baseline; }
:where(.is-style-outloud-aligned-columns > .wp-block-column) > :last-child { align-self: start; }
.wp-block-group.outloud-column-body > * { margin-block: 0; }
.wp-block-group.outloud-column-body > * + * { margin-block-start: var(--wp--custom--spacing--content); }
.wp-block-group.outloud-column-body > :is(p, ul, ol) + .wp-block-heading {
	margin-block-start: var(--wp--custom--spacing--subsection);
}
@media (min-width: 64.01rem) {
	:where(.wp-block-columns).is-style-outloud-aligned-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 64rem) {
	.wp-block-columns.is-style-outloud-aligned-columns:not(.outloud-footer-columns) {
		row-gap: var(--wp--custom--spacing--subsection);
	}
	.wp-block-columns.is-style-outloud-aligned-columns:not(.outloud-footer-columns) > .wp-block-column {
		grid-row: auto;
		grid-template-rows: auto auto;
		row-gap: var(--wp--custom--spacing--heading);
	}
}

/* Centre stacked content boxes and media, while retaining left-aligned prose. */
@media (max-width: 48.875rem) {
 main .wp-block-columns > .wp-block-column:not(.outloud-hero-promotion) {
  margin-inline: auto;
  justify-self: center;
  min-width: 0;
 }
 main .wp-block-image,
 main .wp-block-post-featured-image {
  margin-inline: auto;
  justify-self: center;
 }
 main .wp-block-image img,
 main .wp-block-post-featured-image img { display: block; margin-inline: auto; }
 main .outloud-service-cards > .wp-block-column > .wp-block-image { justify-self: center; }
}
