/**
 * Frontend-only styles for the gating blocks (restricted-content,
 * scheduled-content). Enqueued via view_style_handles, so this file never
 * loads in the editor canvas — the editor keeps each block's wrapper box
 * (and its dashed enclosure from editorStyle) for selection affordances.
 *
 * Gating must never affect rendering: the saved wrapper div otherwise
 * becomes the grid/flex item in place of the content it wraps (e.g. cards
 * in a section grid stop stretching to equal height). display:contents
 * removes the wrapper's box so layout treats the inner content as if the
 * gate were not there.
 */
.wp-block-iac-restricted-content,
.wp-block-iac-scheduled-content {
	display: contents;
}

/*
 * display:contents removes the wrapper from the box tree but not the DOM,
 * so core's constrained-layout rules — which reach only DIRECT children
 * via `>` — skip the gated content entirely (it is a grandchild), and it
 * stretches to the container's full width. Mirror core's two rules one
 * level deeper, scoped to constrained parents so grid/flex contexts
 * (e.g. gated cards in a section grid) are unaffected. The wrapper
 * classes sit inside :where() to keep core's exact selector specificity.
 */
.is-layout-constrained
	> :where(.wp-block-iac-restricted-content, .wp-block-iac-scheduled-content)
	> :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	max-width: var(--wp--style--global--content-size);
	margin-left: auto !important;
	margin-right: auto !important;
}

/*
 * Gates may legitimately nest (e.g. restricted-content inside
 * scheduled-content). Each extra boxless wrapper pushes the content one
 * DOM level deeper, so mirror the constraint through one nested gate as
 * well. Deeper nesting than two gates is not covered.
 */
.is-layout-constrained
	> :where(.wp-block-iac-restricted-content, .wp-block-iac-scheduled-content)
	> :where(.wp-block-iac-restricted-content, .wp-block-iac-scheduled-content)
	> :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	max-width: var(--wp--style--global--content-size);
	margin-left: auto !important;
	margin-right: auto !important;
}

.is-layout-constrained
	> :where(.wp-block-iac-restricted-content, .wp-block-iac-scheduled-content)
	> .alignwide {
	max-width: var(--wp--style--global--wide-size);
}
