/*
 * Page layout — how the top-level blocks of a page sit on the page.
 * Applies to pages on Astra's full-width container (`ast-page-builder-template`, set per page), which have no padding
 * of their own. Every top-level block is centred; Wide blocks (and Cover/Group set to Wide) get the wide column,
 * Full-width blocks run to the screen edge, and every section gets the same vertical space above and below it.
 * Tokens: --sc-gutter, --sc-section-gap, --sc-content, --sc-wide in tokens.css.
 */
body.ast-page-builder-template.ast-no-sidebar .entry-content > * {
	box-sizing: border-box;
	width: 100%;
	max-width: min(var(--sc-content), 100% - 2 * var(--sc-gutter));
	margin-inline: auto;
}

body.ast-page-builder-template.ast-no-sidebar .entry-content > .alignwide {
	max-width: min(var(--sc-wide), 100% - 2 * var(--sc-gutter));
	margin-inline: auto;   /* Astra sets 0 on .alignwide for this layout */
}

body.ast-page-builder-template.ast-no-sidebar .entry-content > .alignfull {
	max-width: none;
	margin-inline: 0;
}

/* Same space between every pair of sections; margins collapse, so two neighbours never add up. */
body.ast-page-builder-template.ast-no-sidebar .entry-content > :is(.wp-block-group, .wp-block-columns, .wp-block-cover, .wp-block-gallery, .wp-block-media-text, .wp-block-image) {
	margin-block: var(--sc-section-gap);
}

body.ast-page-builder-template.ast-no-sidebar .entry-content > :first-child {
	margin-block-start: 0;
}

/* Pages that open with a title block instead of a hero photo (info pages, coaches, FAQ, legal): same space under the
   header as between sections. Covers and Full-width blocks (heroes) start at the header edge. */
body.ast-page-builder-template.ast-no-sidebar .entry-content > :first-child:not(.wp-block-cover):not(.wp-block-spacer):not(.alignfull) {
	padding-block-start: var(--sc-section-gap);
}

/* Inside a Wide section, headings and blocks use the whole wide column (so they line up with the cards below);
   running text keeps a readable line length. */
body.ast-page-builder-template.ast-no-sidebar .entry-content > .alignwide.is-layout-constrained:not(.is-style-band):not(.is-style-card) > * {
	max-width: none;
	margin-inline: 0;
}

body.ast-page-builder-template.ast-no-sidebar .entry-content > .alignwide.is-layout-constrained > p {
	max-width: 62ch;
}

/* Space between a section's own heading block and its content. */
body.ast-page-builder-template.ast-no-sidebar .entry-content > .alignwide.is-layout-constrained > * + * {
	margin-block-start: 1rem;
}

body.ast-page-builder-template.ast-no-sidebar .entry-content > .alignwide.is-layout-constrained > .wp-block-heading + :is(.wp-block-group, .wp-block-columns, .wp-block-accordion) {
	margin-block-start: 1.5rem;
}

/* Grid groups: WordPress writes `auto-fill`, which leaves empty columns and makes 3-4 cards huddle on the left.
   `auto-fit` stretches the cards across the whole row. Minimum card width: --sc-col (15rem; stat tiles 10rem).
   container-type: WordPress also writes `inline-size` on these grids. Together with `auto-fit` that collapses every
   column in Safari before the WebKit fix of May 2025 (bug 256047): cards pile up in one thin column. Nothing here
   uses container queries, so it is switched off. Keep it off for as long as this rule uses `auto-fit`. */
.wp-block-group.is-layout-grid {
	grid-template-columns: repeat(auto-fit, minmax(min(var(--sc-col, 15rem), 100%), 1fr));
	container-type: normal;
}

.wp-block-group.is-layout-grid:has(> .is-style-stat) {
	--sc-col: 10rem;
}

/* Photo cards: three across on a wide screen (six cards make two even rows), two on a tablet, one on a phone. */
.wp-block-group.is-layout-grid:has(> .is-style-photo-card) {
	--sc-col: 18rem;
}

/* Query Loop grids (coaches list): WordPress renders the post template as a <ul> with default list padding, which
   pushes the cards in from the section edge. Cards line up with the headings and the other grids. */
.entry-content .wp-block-post-template {
	padding: 0;
	margin: 0;
	list-style: none;
}
