/*
 * Image block.
 *
 * The Rounded style draws a thin ring in Color 6, offset from the image.
 * Tune the ring in theme.json → settings.custom.imageRing.
 */

.wp-block-image.is-style-rounded {
	position: relative;
	width: fit-content;
}

/* Full and wide images stretch, so the figure must not hug the image. */
.wp-block-image.is-style-rounded.alignfull,
.wp-block-image.is-style-rounded.alignwide {
	width: auto;
}

.wp-block-image.is-style-rounded::after {
	border: var(--wp--custom--image-ring--width) solid var(--wp--custom--image-ring--color);
	border-radius: 9999px;
	content: "";
	inset: 0;
	pointer-events: none;
	position: absolute;
	transform: translate(var(--wp--custom--image-ring--offset-x), var(--wp--custom--image-ring--offset-y));
}

/* With a caption the figure is taller than the image, so size the ring to the image. */
.wp-block-image.is-style-rounded:has(> figcaption)::after {
	aspect-ratio: 1;
	bottom: auto;
}

/* Hover: the ring slides into alignment with the image. */
.wp-block-image.is-style-rounded::after {
	transition: transform 0.9s cubic-bezier(0.45, 0, 0.2, 1);
}

@media (hover: hover) {
	.wp-block-image.is-style-rounded:hover::after {
		transform: translate(0, 0);
	}
}
