.a8c-template-editor {
	@media (min-width: 600px) {
		.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] {
			margin-left: 0;
			margin-right: 0;
		}
	}

	// Match margins for template parts rendered in the page and template part editor view.
	.block-editor-block-list__block-edit {
		[data-block] {
			margin: 12px 0 0 0;
		}
	}
}

.template-block {
	.fse-template-part {
		padding: #{map-deep-get($config-global, "spacing", "unit")};

		@include media(mobile) {
			padding: #{map-deep-get($config-global, "spacing", "vertical")} 0;
		}

		figure.fse-site-logo {
			width: auto;
		}

		// Hide the (+) icons when rendering the Template Part block inside the Page editor.
		.block-list-appender {
			display: none;
		}

		// Remove the top margin if the Site Title block is the first in a column block
		.wp-block-column .block-editor-block-list__layout [data-type='a8c/site-title']:first-child .site-title {
			margin-top: 0;
		}
	}
}

.fse-template-part {
	.wp-block-cover,
	.wp-block-cover-image {
		.site-title,
		.site-description {
			background: transparent;
			color: inherit;
		}
	}

	.block-editor-block-list__layout .block-editor-block-list__block[data-align='full'] > .block-editor-block-list__block-edit figure.fse-site-logo {
		width: auto;
	}

	// Make sure each column in a Columns block is max width, so that nested FSE blocks can behave as expected.
	.wp-block-column {
		width: 100%;
	}

	// Remove large margins on column children when used in a template part.
	.wp-block-columns .wp-block-column {
		& > * {
			margin: 0 0 5px 0;
		}
	}

	@import '../components/header/site-main-navigation';

	.main-navigation {
		text-align: center;

		.alignwide, .alignfull {
			width: 100%;
		}

		@import "../base/extends";
		.button {
			@extend %button-style
		}

		.main-menu.footer-menu li {
			a {
				font-size: inherit;
			}
			&.menu-item-has-children > a::after {
				font-size: 0.6em;
				vertical-align: middle;
			}
		}
		.has-text-color > .main-menu.footer-menu > li > a {
			color: inherit;
		}
		.has-text-align-left > .main-menu.footer-menu {
			justify-content: flex-start;
		}
		.has-text-align-center > .main-menu.footer-menu {
			justify-content: center;
		}
		.has-text-align-right > .main-menu.footer-menu {
			justify-content: flex-end;
		}
		.has-background > .main-menu.footer-menu {
			padding: #{map-deep-get($config-global, "spacing", "unit")};
		}
	}
}

// Remove top margin/padding from the header if the first block is .alignfull
@include media(mobile) {
	.a8c-template-editor.fse-header .block-editor-block-list__layout > .block-editor-block-list__block {
		&.is-selected:first-child[data-align='full'] > .block-editor-block-list__block-edit > [data-block] {
			margin-top: 14px;
		}
		&:not(.is-selected):first-child[data-align='full'] > .block-editor-block-list__block-edit > [data-block] {
			margin-top: 0;
		}
	}
}
.template-block .fse-header .block-editor-block-list__layout > .block-editor-block-list__block:first-child[data-align='full'] {
	margin-top: -16px;
	@include media(mobile) {
		margin-top: -32px;
	}
}

.post-content__block {
	margin-bottom: 160px;
	margin-top: 36px;

	// Minimum z-index to appear above the Template block overlay.
	// @see https://github.com/WordPress/gutenberg/blob/f198997e2c8e377423beb230ce5283914076d396/packages/block-editor/src/components/block-list/style.scss#L495-L496
	// @see https://github.com/WordPress/gutenberg/blob/f198997e2c8e377423beb230ce5283914076d396/assets/stylesheets/_z-index.scss#L8
	z-index: 20;
}
