.wp-block-media-text {
	margin-bottom: 2rem;
}

#main .wp-block-media-text__content>*:first-child {
	margin-top: 0;
}

#main .wp-block-media-text:not(.has-media-on-the-right) .wp-block-media-text__content {
	padding-right: 0;
}

#main .has-media-on-the-right .wp-block-media-text__content {
	padding-left: 0;
}

#main .wp-block-media-text__media {
	aspect-ratio: 1/1;
	max-height: fit-content;
	border-radius: 50%;
	max-width: clamp(14rem, 85vw, 20rem);
	max-height: fit-content;
	margin-right: auto;
	margin-left: auto;
	position: sticky;
	overflow: visible;
}

#main .wp-block-media-text__media img {
	display: block;
}

@media (max-width: 600px) {
	#main .wp-block-media-text__media {
		margin-bottom: 2rem;
		margin-top: 2rem;
	}
}

@media (min-width: 37.51em) {
	.wp-block-media-text__media {
		position: sticky;
		top: 1rem;
	}
}

@media (min-width: 68.5em) {
	.entry-content .wp-block-media-text:not(:last-child) {
		margin-bottom: 4.5rem !important;
	}

	body:has(header.show-sticky) .wp-block-media-text__media {
		top: 4rem;
	}
}

.wp-block-media-text__media {
	position: relative;
}

.wp-block-media-text__media::before {
	content: "";
	position: absolute;
	height: 106%;
	aspect-ratio: 218/426;
	top: 50%;
	right: 50%;
	transform: translate(1.5%, -50%) rotateY(180deg);
	background-image: url('../images/media-text-gradient.svg');
	background-size: cover;
	z-index: 1;
	clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
	transition: clip-path 500ms;
	transition-delay: 1s;
}

.has-media-on-the-right .wp-block-media-text__media::before {
	transform: translate(-1.5%, -50%) rotateY(0deg);
	left: 50%;
	right: unset;
}

@media (prefers-reduced-motion:no-preference) {
	.wp-block-media-text__media {
		opacity: 0;
	}

	.wp-block-media-text__media::after {
		content: '';
		width: calc(100% + 4px);
		aspect-ratio: 1/1;
		border-radius: 50%;
		background: transparent;
		border: 1rem solid var(--white);
		position: absolute;
		top: -2px;
		left: -2px;
		transform: scale(1);
	}

	.wp-block-media-text__media::before {
		content: "";
		position: absolute;
		height: 106%;
		aspect-ratio: 218/426;
		top: 50%;
		right: 50%;
		transform: translate(1.5%, -50%) rotateY(180deg);
		background-image: url('../images/media-text-gradient.svg');
		background-size: cover;
		z-index: 1;
		clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
	}

	.has-media-on-the-right .wp-block-media-text__media::before {
		transform: translate(-1.5%, -50%) rotateY(0deg);
		left: 50%;
		right: unset;
	}

	.wp-block-media-text__media.js-intersected {
		animation: mediaFadeIn 700ms ease 300ms forwards;
	}

	.wp-block-media-text__media.js-intersected::after {
		animation: mediaAperture 500ms ease 300ms forwards;
	}

	.wp-block-media-text__media.js-intersected::before {
		animation: mediaBorderWipe 500ms ease 1000ms forwards;
	}

	@keyframes mediaFadeIn {
		from {
			opacity: 0;
		}

		to {
			opacity: 1;
		}
	}

	@keyframes mediaAperture {
		from {
			transform: scale(1);
		}

		to {
			transform: scale(1.1);
		}
	}

	@keyframes mediaBorderWipe {
		from {
			clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
		}

		to {
			clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
		}
	}
}