/* Styles: gradient = Gradient, download = Download, link = Link, round-arrow = Round arrow (next), round-arrow-prev = Round arrow (previous) */
/* Buttons (prototype cmc.css 8b). Default = charcoal, white label, arrow after it. The arrow and the ripple are
   pseudo-elements, so the editor keeps a plain text button: ::after = arrow (a mask, so it takes the text colour),
   ::before = the ripple (white dot that grows on hover, z-index -1 so the label stays crisp). */
.wp-block-button .wp-block-button__link {
	--cmc-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E");
	--btn-ripple: rgba(255, 255, 255, 0.16);
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	overflow: hidden;
	isolation: isolate;
	font-size: var(--wp--preset--font-size--text-8);
	line-height: 1.3;
	transition: transform 300ms var(--wp--custom--ease);
}

.wp-block-button .wp-block-button__link:hover,
.wp-block-button .wp-block-button__link:focus-visible {
	transform: translateY(-2px);
}

.wp-block-button .wp-block-button__link::before {
	content: "";
	position: absolute;
	z-index: -1;
	top: 50%;
	left: 50%;
	width: 6px;
	height: 6px;
	margin: -3px 0 0 -3px;
	border-radius: 50%;
	background: var(--btn-ripple);
	opacity: 0;
	pointer-events: none;
}

.wp-block-button .wp-block-button__link:hover::before,
.wp-block-button .wp-block-button__link:focus-visible::before {
	animation: cmc-btn-ripple 900ms ease-out;
}

/* scale 45 on a 6px dot is a 270px circle: clears the corners of the widest button */
@keyframes cmc-btn-ripple {
	0%   { transform: scale(0); opacity: 1; }
	20%  { transform: scale(25); opacity: 1; }
	100% { transform: scale(45); opacity: 0; }
}

.wp-block-button .wp-block-button__link::after {
	content: "";
	flex: none;
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: var(--cmc-arrow) center / contain no-repeat;
	mask: var(--cmc-arrow) center / contain no-repeat;
	transition: transform 300ms var(--wp--custom--ease);
}

.wp-block-button .wp-block-button__link:hover::after,
.wp-block-button .wp-block-button__link:focus-visible::after {
	transform: translateX(3px);
}

/* Gradient: warm preset, charcoal label, stronger ripple */
.wp-block-button.is-style-gradient .wp-block-button__link {
	--btn-ripple: rgba(255, 255, 255, 0.45);
	background: var(--wp--preset--gradient--warm);
	color: var(--wp--preset--color--charcoal);
}

/* Download: the arrow becomes a download glyph in front of the label (the PDF row) */
.wp-block-button.is-style-download .wp-block-button__link::after {
	order: -1;
	--cmc-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' x2='12' y1='15' y2='3'/%3E%3C/svg%3E");
}

.wp-block-button.is-style-download .wp-block-button__link:hover::after,
.wp-block-button.is-style-download .wp-block-button__link:focus-visible::after {
	transform: none;
}

/* Link: the animated underline ("link-rule"). Text colour comes from the surrounding block. */
.wp-block-button.is-style-link .wp-block-button__link {
	width: fit-content;
	gap: 8px;
	padding: 0 0 2px;
	overflow: visible;
	border-radius: 0;
	background: none;
	color: inherit;
	font-size: var(--wp--preset--font-size--text-11);
}

.wp-block-button.is-style-link .wp-block-button__link:hover,
.wp-block-button.is-style-link .wp-block-button__link:focus-visible {
	transform: none;
}

.wp-block-button.is-style-link .wp-block-button__link::before {
	inset: auto 0 0 0;
	z-index: auto;
	width: auto;
	height: 2px;
	margin: 0;
	border-radius: 0;
	background: currentColor;
	opacity: 1;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.35s var(--wp--custom--ease);
}

.wp-block-button.is-style-link .wp-block-button__link:hover::before,
.wp-block-button.is-style-link .wp-block-button__link:focus-visible::before {
	animation: none;
	transform: scaleX(1);
}

/* Round arrow: 52px circle, the label is read by screen readers only. Next = solid, previous = outline. */
.wp-block-button:is(.is-style-round-arrow, .is-style-round-arrow-next) .wp-block-button__link,
.wp-block-button.is-style-round-arrow-prev .wp-block-button__link {
	box-sizing: border-box;
	width: 52px;
	height: 52px;
	padding: 0;
	border-radius: 50%;
	font-size: 0;
	line-height: 0;
}

.wp-block-button:is(.is-style-round-arrow, .is-style-round-arrow-next) .wp-block-button__link::before,
.wp-block-button.is-style-round-arrow-prev .wp-block-button__link::before {
	display: none;
}

.wp-block-button:is(.is-style-round-arrow, .is-style-round-arrow-next) .wp-block-button__link::after,
.wp-block-button.is-style-round-arrow-prev .wp-block-button__link::after {
	width: 22px;
	height: 22px;
	--cmc-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
	transition: none;
}

.wp-block-button:is(.is-style-round-arrow, .is-style-round-arrow-next) .wp-block-button__link:hover::after,
.wp-block-button:is(.is-style-round-arrow, .is-style-round-arrow-next) .wp-block-button__link:focus-visible::after,
.wp-block-button.is-style-round-arrow-prev .wp-block-button__link:hover::after,
.wp-block-button.is-style-round-arrow-prev .wp-block-button__link:focus-visible::after {
	transform: none;
}

.wp-block-button.is-style-round-arrow-prev .wp-block-button__link {
	border: 1px solid var(--wp--preset--color--charcoal);
	background: var(--wp--preset--color--off-white);
	color: var(--wp--preset--color--charcoal);
	transition: background-color 300ms var(--wp--custom--ease), color 300ms var(--wp--custom--ease);
}

.wp-block-button.is-style-round-arrow-prev .wp-block-button__link:hover,
.wp-block-button.is-style-round-arrow-prev .wp-block-button__link:focus-visible {
	transform: none;
	background: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--off-white);
}

.wp-block-button.is-style-round-arrow-prev .wp-block-button__link::after {
	--cmc-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-button .wp-block-button__link,
	.wp-block-button .wp-block-button__link::after,
	.wp-block-button.is-style-link .wp-block-button__link::before {
		transition: none;
	}

	.wp-block-button .wp-block-button__link:hover::before,
	.wp-block-button .wp-block-button__link:focus-visible::before {
		animation: none;
	}

	.wp-block-button .wp-block-button__link:hover,
	.wp-block-button .wp-block-button__link:focus-visible,
	.wp-block-button .wp-block-button__link:hover::after,
	.wp-block-button .wp-block-button__link:focus-visible::after {
		transform: none;
	}
}
