figure.wp-block-image:not(.wp-block) {
	margin: 0;
}

.wp-block-image {
	position: relative;

	.is-applying img,
	&.is-transient img {
		opacity: 0.3;
	}

	figcaption img {
		display: inline;
	}

	// Shown while image is being uploaded
	.components-spinner {
		position: absolute;
		top: 50%;
		left: 50%;
		margin-top: -9px;
		margin-left: -9px;
	}

	&:not(.is-style-rounded) > div:not(.components-placeholder) {
		border-radius: inherit;
	}
}

// This is necessary for the editor resize handles to accurately work on a non-floated, non-resized, small image.
.wp-block-image .components-resizable-box__container {
	display: inline-block;
	img {
		display: block;
		width: inherit;
		height: inherit;
	}
}

.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
	position: absolute;
	left: 0;
	right: 0;
	margin: -$border-width 0;

	@include break-small() {
		margin: -$border-width;
	}
}

[data-align="wide"] > .wp-block-image,
[data-align="full"] > .wp-block-image {
	img {
		height: auto;
		width: 100%;
	}
}

.wp-block[data-align="left"],
.wp-block[data-align="center"],
.wp-block[data-align="right"] {
	> .wp-block-image {
		display: table;

		> figcaption {
			display: table-caption;
			caption-side: bottom;
		}
	}
}

.wp-block[data-align="left"] > .wp-block-image {
	margin-right: 1em;
	margin-left: 0;
	margin-top: 0.5em;
	margin-bottom: 0.5em;
}

.wp-block[data-align="right"] > .wp-block-image {
	margin-left: 1em;
	margin-right: 0;
	margin-top: 0.5em;
	margin-bottom: 0.5em;
}

.wp-block[data-align="center"] > .wp-block-image {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

.wp-block-image__crop-area {
	position: relative;
	max-width: 100%;
	width: 100%;
}

.wp-block-image__crop-icon {
	padding: 0 8px;
	min-width: 48px;
	display: flex;
	justify-content: center;
	align-items: center;

	svg {
		fill: currentColor;
	}
}

.wp-block-image__zoom {
	.components-popover__content {
		overflow: visible;
		min-width: 260px;
	}

	.components-range-control {
		flex: 1;
	}

	.components-base-control__field {
		display: flex;
		margin-bottom: 0;
		flex-direction: column;
		align-items: flex-start;
	}
}

.wp-block-image__aspect-ratio {
	height: $grid-unit-60 - $border-width - $border-width;
	margin-bottom: -$grid-unit-10;
	display: flex;
	align-items: center;

	.components-button {
		width: $button-size;
		padding-left: 0;
		padding-right: 0;
	}
}
