/**
 * Blueprint rhythm narrowing for Core layout / flex / blockGap.
 * Does NOT strip Canvas section-content inner rhythm.
 *
 * Loaded on frontend + editor iframe when blueprint_rhythm_fix is on.
 */

/* Flex / grid: let Gutenberg gap & margins win over Blueprint blanket 32px. */
.cs-main-content .entry-content .is-layout-flex > *,
.cs-main-content .entry-content .is-layout-flex > .wp-block,
.cs-main-content .entry-content .is-layout-grid > *,
.cs-main-content .entry-content .is-layout-grid > .wp-block,
.entry-content .is-layout-flex > *,
.entry-content .is-layout-flex > .wp-block,
.entry-content .is-layout-grid > *,
.entry-content .is-layout-grid > .wp-block {
	margin-top: 0;
	margin-bottom: 0;
}

/* Editor iframe: Blueprint editor-style sets margin 32px on every .wp-block */
.editor-styles-wrapper .block-editor-block-list__layout.is-layout-flex > .wp-block,
.editor-styles-wrapper .block-editor-block-list__layout.is-layout-grid > .wp-block,
.editor-styles-wrapper .is-layout-flex > .wp-block,
.editor-styles-wrapper .is-layout-grid > .wp-block,
.editor-styles-wrapper .is-layout-flex > .block-editor-block-list__block,
.editor-styles-wrapper .is-layout-grid > .block-editor-block-list__block {
	margin-top: 0;
	margin-bottom: 0;
}

/*
 * Editor-only: Blueprint forces consecutive Core headings to margin-top: 64px
 * (.block-editor-block-list__layout > .wp-block[data-type="core/heading"]:not(:first-child)).
 * That selector also matches headings inside Core Row/flex and breaks align-items.
 * Must beat that rule (attribute + :not) — use !important only here.
 */
.editor-styles-wrapper .block-editor-block-list__layout.is-layout-flex > .wp-block[data-type="core/heading"],
.editor-styles-wrapper .block-editor-block-list__layout.is-layout-grid > .wp-block[data-type="core/heading"],
.editor-styles-wrapper .is-layout-flex > .wp-block[data-type="core/heading"],
.editor-styles-wrapper .is-layout-grid > .wp-block[data-type="core/heading"] {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

/*
 * Editor + front: heading elements keep margin-bottom: 1rem from Blueprint.
 * Inside flex/grid, that padding-like margin skews vertical alignment vs icon/siblings.
 * Gap (blockGap) owns rhythm between flex items.
 */
.is-layout-flex > .wp-block-heading,
.is-layout-flex > h1,
.is-layout-flex > h2,
.is-layout-flex > h3,
.is-layout-flex > h4,
.is-layout-flex > h5,
.is-layout-flex > h6,
.is-layout-flex .wp-block[data-type="core/heading"] > .wp-block-heading,
.is-layout-flex .wp-block[data-type="core/heading"] > h1,
.is-layout-flex .wp-block[data-type="core/heading"] > h2,
.is-layout-flex .wp-block[data-type="core/heading"] > h3,
.is-layout-flex .wp-block[data-type="core/heading"] > h4,
.is-layout-flex .wp-block[data-type="core/heading"] > h5,
.is-layout-flex .wp-block[data-type="core/heading"] > h6,
.editor-styles-wrapper .is-layout-flex .wp-block[data-type="core/heading"] .wp-block-heading,
.editor-styles-wrapper .block-editor-block-list__layout.is-layout-flex > .wp-block[data-type="core/heading"] .wp-block-heading {
	margin-top: 0;
	margin-bottom: 0;
}

/*
 * Editor: full-bleed Canvas Section forces nested .wp-block { width:100%!important },
 * which collapses Core horizontal flex (Row) item sizing / align-items.
 */
.editor-styles-wrapper
	.cnvs-block-section-layout-align-full
	.wp-block[data-type="canvas/section-content"]
	.block-editor-block-list__layout.is-layout-flex:not(.is-vertical)
	> .wp-block,
.editor-styles-wrapper
	.cnvs-block-section-layout-align-full
	.wp-block[data-type="canvas/section-content"]
	.is-layout-flex:not(.is-vertical)
	> .wp-block {
	width: fit-content !important;
	max-width: 100% !important;
}

/*
 * Preserve Canvas shell rhythm — do not override:
 * .cnvs-block-section-content-inner > *
 * .cnvs-block-section-sidebar-inner > *
 * .cnvs-block-column-inner > div > *
 */
