/*
 * Spacing for single-child Gutenberg sections flattened from legacy
 * m-flexibleContainer groups.
 *
 * The canonical source is scss/styles/_modules.scss. This small compatibility
 * sheet remains loaded while the migration is active, so the same rhythm is
 * present in the local render even when the generated bundle is cached.
 */
.alinoa-section-lead {
	margin-top: 6rem;
}

/* Keep migrated editorial actions in the same regular anchor weight as the
 * reference site until CodeKit recompiles the canonical SCSS bundle. */
.m-action {
	font-weight: 400;
}

@media all and (min-width: 1100px) {
	.alinoa-section-lead {
		margin-top: 9rem;
	}
}

.l-content__body--s1 > .l-content__child > :first-child.wp-block-heading.alinoa-section-lead,
.l-content__body--s1 > .l-content__child > :first-child.wp-block-paragraph.alinoa-section-lead,
.l-content__body--s1 > .l-content__child > :first-child.wp-block-list.alinoa-section-lead,
.l-content__body--s1 > .l-content__child > :first-child.wp-block-quote.alinoa-section-lead,
.l-content__body--s1 > .l-content__child > :first-child.wp-block-buttons.alinoa-section-lead {
	margin-top: 0;
}

/* Older articles can contain semantic HTML without Gutenberg classes. Keep
 * their first visible editorial element on the same lead as migrated posts. */
.l-content__body--s1 > .l-content__child > :first-child:is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure):not(.alinoa-section-lead) {
	margin-top: 6rem;
}

@media all and (min-width: 1100px) {
	.l-content__body--s1 > .l-content__child > :first-child:is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure):not(.alinoa-section-lead) {
		margin-top: 9rem;
	}
}

/*
 * Keep a predictable breathing space after every top-level module. The
 * canonical rule lives in scss/styles/_layout.scss; this compatibility sheet
 * mirrors it because it is still enqueued during the migration. It is pure
 * CSS: the rendered wrapper is enough for native blocks, patterns, custom
 * compositions and ACF blocks alike.
 */
.l-content__child > [class*="wp-block-"]:not(.wp-block-heading):not(.wp-block-paragraph):not(.wp-block-list):not(.wp-block-quote):not(.wp-block-pullquote):not(.wp-block-spacer),
.l-content__child > .m-flexible,
.l-content__child > .m-flexibleContainer,
.l-content__child > .m-splash,
.l-content__child > [class*="alinoa-wrapper"] {
	margin-bottom: 4rem;
}

@media all and (min-width: 1100px) {
	.l-content__child > [class*="wp-block-"]:not(.wp-block-heading):not(.wp-block-paragraph):not(.wp-block-list):not(.wp-block-quote):not(.wp-block-pullquote):not(.wp-block-spacer),
	.l-content__child > .m-flexible,
	.l-content__child > .m-flexibleContainer,
	.l-content__child > .m-splash,
	.l-content__child > [class*="alinoa-wrapper"] {
		margin-bottom: 6rem;
	}
}

/* A full-width pagesList with `space-none` is intentionally attached to the
 * splash only when it is the first block in the following article. Looking
 * for the class anywhere in the article would remove the intro breathing
 * space when a pagesList appears at the end of a page. */
.l-content__child > .m-splash:has(+ .l-content__body > .alinoa-pages-list--space-none:first-child) {
	margin-bottom: 0;
}

.l-content__child > .m-splash:has(+ .l-content__body > .alinoa-pages-list--space-none:first-child) + .l-content__body {
	padding-top: 0;
}

.l-content__child > * + [class*="wp-block-"]:not(.wp-block-heading):not(.wp-block-paragraph):not(.wp-block-list):not(.wp-block-quote):not(.wp-block-pullquote):not(.wp-block-spacer):not(.alinoa-cta),
.l-content__child > * + .m-flexible:not(.alinoa-cta),
.l-content__child > * + .m-flexibleContainer:not(.alinoa-cta),
.l-content__child > * + .m-splash,
.l-content__child > * + [class*="alinoa-wrapper"] {
	margin-top: 4rem;
}

@media all and (min-width: 1100px) {
	.l-content__child > * + [class*="wp-block-"]:not(.wp-block-heading):not(.wp-block-paragraph):not(.wp-block-list):not(.wp-block-quote):not(.wp-block-pullquote):not(.wp-block-spacer):not(.alinoa-cta),
	.l-content__child > * + .m-flexible:not(.alinoa-cta),
	.l-content__child > * + .m-flexibleContainer:not(.alinoa-cta),
	.l-content__child > * + .m-splash,
	.l-content__child > * + [class*="alinoa-wrapper"] {
		margin-top: 6rem;
	}
}

/* A heading and the following module must not contribute two spaces to the
 * same relation. Keep the module's large token and remove the heading's small
 * bottom margin. */
.l-content__body > .wp-block-heading:has(+ .alinoa-section-lead),
.l-content__body > .wp-block-paragraph:has(+ .alinoa-section-lead),
.l-content__body > .wp-block-list:has(+ .alinoa-section-lead),
.l-content__body > .wp-block-quote:has(+ .alinoa-section-lead),
.l-content__body > .wp-block-pullquote:has(+ .alinoa-section-lead),
.l-content__child > .wp-block-heading:has(+ .alinoa-section-lead),
.l-content__child > .wp-block-paragraph:has(+ .alinoa-section-lead),
.l-content__child > .wp-block-list:has(+ .alinoa-section-lead),
.l-content__child > .wp-block-quote:has(+ .alinoa-section-lead),
.l-content__child > .wp-block-pullquote:has(+ .alinoa-section-lead) {
	margin-bottom: 0;
}

/* Native media defaults to the large rhythm relation. Explicit little/none
 * tokens remain available; the browser's default 18px figure margin does not. */
.l-content__body > figure.wp-block-image:not(.alinoa-migrated-media):not([class*="--space-little"]):not([class*="--space-none"]),
.l-content__child > figure.wp-block-image:not(.alinoa-migrated-media):not([class*="--space-little"]):not([class*="--space-none"]) {
	margin-bottom: 6rem;
}

.l-content__body > figure.wp-block-image:not(.alinoa-migrated-media)[class*="--space-little"],
.l-content__child > figure.wp-block-image:not(.alinoa-migrated-media)[class*="--space-little"] {
	margin-bottom: 2rem;
}

.l-content__body > figure.wp-block-image:not(.alinoa-migrated-media)[class*="--space-none"],
.l-content__child > figure.wp-block-image:not(.alinoa-migrated-media)[class*="--space-none"] {
	margin-bottom: 0;
}

/* Standalone media follows the shared maximum module rail and is centred.
 * Explicit full-width, floated and composition media remain intentional
 * exceptions. */
.l-content__body > figure.wp-block-image:not(.alignfull):not(.alignleft):not(.alignright):not(.alinoa-medias--layout-fullwidth),
.l-content__child > figure.wp-block-image:not(.alignfull):not(.alignleft):not(.alignright):not(.alinoa-medias--layout-fullwidth) {
	box-sizing: border-box;
	margin-left: auto;
	margin-right: auto;
	max-width: 1260px;
	text-align: center;
	width: 100%;
}

@media all and (min-width: 1100px) {
	.l-content__body > figure.wp-block-image:not(.alinoa-migrated-media):not([class*="--space-little"]):not([class*="--space-none"]),
	.l-content__child > figure.wp-block-image:not(.alinoa-migrated-media):not([class*="--space-little"]):not([class*="--space-none"]) {
		margin-bottom: 9rem;
	}

	.l-content__body > figure.wp-block-image:not(.alinoa-migrated-media)[class*="--space-little"],
	.l-content__child > figure.wp-block-image:not(.alinoa-migrated-media)[class*="--space-little"] {
		margin-bottom: 3rem;
	}
}
