.editor-styles-wrapper {

	.wp-block[data-coblocks-bottom-spacing="1"][data-type="core/image"],
	.wp-block [data-coblocks-bottom-spacing="1"][data-type="core/image"] {

		.block-editor-rich-text {
			display: none;
		}

		.wp-block-image img {
			vertical-align: bottom;
		}
	}

	.wp-block[data-coblocks-top-spacing="1"]:not(:first-child),
	.wp-block:not(:first-child) [data-coblocks-top-spacing="1"] {
		margin-top: 0 !important;

		// Ensure that blocks with custom margin settings using our dimensions control
		// are forced to display without margin.
		[class*="wp-block-"] {

			&.has-margin {
				margin-top: 0 !important;
			}
		}

		> .block-editor-block-list__block-edit {
			margin-top: 0 !important;
		}

		// The image block has margin-top that we need to override.
		.wp-block-image {
			margin-top: 0 !important;
		}
	}

	.wp-block[data-coblocks-bottom-spacing="1"]:not(:last-child),
	.wp-block:not(:last-child) [data-coblocks-bottom-spacing="1"] {
		margin-bottom: 0 !important;

		// Ensure that blocks with custom margin settings using our dimensions control
		// are forced to display without margin.
		[class*="wp-block-"] {

			&.has-margin {
				margin-bottom: 0 !important;
			}
		}

		// The core image and cover blocks have it's own margin added as well that we need to override.
		.wp-block-image,
		.wp-block-cover {
			margin-bottom: 0 !important;
		}

		> .block-editor-block-list__block-edit {
			margin-bottom: 0 !important;
		}

		// Hide the inserter on blocks that follow a vertically resizable block
		// that does not have margin bottom applied.
		&[data-type="coblocks/map"] {

			+ .wp-block[data-coblocks-bottom-spacing="1"],
			.wp-block [data-coblocks-bottom-spacing="1"] {

				> .block-editor-block-list__insertion-point {
					display: none;
				}
			}
		}
	}

	// Remove top and bottom margin from Gutenberg 5.8+ [data-block] margin
	.wp-block[data-coblocks-top-spacing="1"] .block-editor-block-list__block-edit > [data-block],
	.wp-block [data-coblocks-top-spacing="1"] .block-editor-block-list__block-edit > [data-block] {
		margin-top: 0;
	}

	.wp-block[data-coblocks-bottom-spacing="1"] .block-editor-block-list__block-edit > [data-block],
	.wp-block [data-coblocks-bottom-spacing="1"] .block-editor-block-list__block-edit > [data-block] {
		margin-bottom: 0;
	}

	//Make sure block is on the top z-index.
	[class*="wp-block-coblocks-"] {

		&.is-selected {

			&[data-coblocks-top-spacing="1"],
			&[data-coblocks-bottom-spacing="1"] {
				z-index: 29;
			}
		}

		.is-selected {

			&[data-coblocks-top-spacing="1"],
			&[data-coblocks-bottom-spacing="1"] {
				z-index: 29;
			}
		}
	}
}
