html {
	// コアのデフォルトマージンの打ち消し
	:where(.wp-block),
	:where(.editor-styles-wrapper) p {
		margin-top: 0;
		margin-bottom: 0;
	}
}

/*
 * ブロック間のマージン設定
 *   コアは .editor-styles-wrapper xxx でmarginつけてくるので詳細度に注意。
 *   Arkhe Blockは ark-keep-mtクラスで一括処理
 */
.is-root-container {
	> .wp-block {
		margin-top: var(--ark-mt);
		margin-bottom: 0;
	}
	> .wp-block:first-child {
		margin-top: 0 !important;
	}

	// fullが連続する時は余白 0 に。
	> [data-align="full"] + [data-align="full"],
	> [data-align="full"] + style + [data-align="full"] {
		margin-top: 0;
	}

	// headingは特殊幅を使う
	[data-type="core/heading"] {
		--ark-mt: var(--ark-mt--h);
	}

	/*
	* 余白を小さく維持するエリア。
	*   - カラムブロック・details・アコーディオンパネル・メディアと文章ブロック
	*   - カバー・通常幅のグループブロックの中
	*/
	:is(
			.wp-block-details,
			.wp-block-accordion-panel,
			.wp-block-quote,
			.wp-block-column,
			.wp-block-media-text__content,
			.wp-block-cover__inner-container,
			.wp-block-group:where(:not(.is-layout-flex):not(.is-layout-grid)),
			.wp-block-group__inner-container
		) {
		> .wp-block:not(:first-child) {
			margin-top: var(--ark-mt--inner, var(--ark-mt--s));
		}

		// :first-childの mt0 化は全体的には行わず、ここで具体的にブロックを指定してる
		> .wp-block:first-child {
			margin-top: 0;
			// --ark-mt--inner: 0;
		}
	}

	// 全幅の時は、インナーのmtを通常幅へ
	[data-align="full"] {
		--ark-mt--inner: var(--ark-mt);
	}
}

// ウィジェット は .is-root-containerはついていない
.wp-block-widget-area__inner-blocks {
	> div {
		> .wp-block {
			margin-top: var(--ark-mt);
			margin-bottom: 0;
		}
		> .wp-block:first-child {
			margin-top: 0 !important;
		}
	}

	// ウィジェットグループブロック
	.wp-block-widget-group {
		.widget-title {
			margin-top: 0;
			margin-bottom: 1.25rem;
		}

		> .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block {
			margin-top: 0;
		}
	}
}
