/**
 * Revita: core/button block styles.
 * Purple pill, outline pill, light outline (for dark sections), arrow and honey shine.
 * Styles combine: "is-style-pill-purple is-style-arrow" gives a purple pill with an arrow.
 * Colours chosen in the editor (has-background / has-text-color) always win.
 */

/* Pill variants: shared geometry. */
.wp-block-button:is(.is-style-pill-purple, .is-style-pill-outline, .is-style-pill-light) > .wp-block-button__link {
	border-radius: var(--wp--custom--radius--pill);
}

/* Purple pill */
.wp-block-button.is-style-pill-purple > .wp-block-button__link:not(.has-background) {
	background-color: var(--revita-pill-purple, var(--wp--preset--color--primary));
}

.wp-block-button.is-style-pill-purple > .wp-block-button__link:not(.has-text-color) {
	color: var(--wp--custom--color--on-primary);
}

.wp-block-button.is-style-pill-purple > .wp-block-button__link:not(.has-background):is(:hover, :focus-visible) {
	background-color: var(--revita-pill-purple-hover, var(--wp--preset--color--primary-deep));
}

/* Outline pill: 2px current-colour border, inherits the surrounding text colour. */
.wp-block-button.is-style-pill-outline > .wp-block-button__link {
	border: 2px solid currentColor;
	padding-block: calc(0.9em - 2px);
	padding-inline: calc(1.7em - 2px);
}

.wp-block-button.is-style-pill-outline > .wp-block-button__link:not(.has-background) {
	background-color: transparent;
	background-image: none;
}

.wp-block-button.is-style-pill-outline > .wp-block-button__link:not(.has-text-color) {
	color: inherit;
}

.wp-block-button.is-style-pill-outline > .wp-block-button__link:not(.has-background):is(:hover, :focus-visible) {
	background-color: color-mix(in srgb, currentColor 10%, transparent);
}

/* Light outline: white border and text, for purple, night and photo backgrounds. */
.wp-block-button.is-style-pill-light > .wp-block-button__link {
	border: 2px solid var(--wp--custom--color--on-dark);
	padding-block: calc(0.9em - 2px);
	padding-inline: calc(1.7em - 2px);
}

.wp-block-button.is-style-pill-light > .wp-block-button__link:not(.has-background) {
	background-color: transparent;
	background-image: none;
}

.wp-block-button.is-style-pill-light > .wp-block-button__link:not(.has-text-color) {
	color: var(--wp--custom--color--on-dark);
}

.wp-block-button.is-style-pill-light > .wp-block-button__link:not(.has-background):is(:hover, :focus-visible) {
	background-color: var(--wp--custom--color--on-dark);
}

.wp-block-button.is-style-pill-light > .wp-block-button__link:not(.has-text-color):is(:hover, :focus-visible) {
	color: var(--wp--preset--color--primary-dark);
}

/* Arrow: a masked arrow icon that nudges 4px on hover. */
.wp-block-button.is-style-arrow > .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.6em;
}

.wp-block-button.is-style-arrow > .wp-block-button__link::after {
	content: "";
	flex: none;
	inline-size: 1.15em;
	block-size: 1.15em;
	background-color: currentColor;
	-webkit-mask: url(../../images/icons/arrow-right.svg) center / contain no-repeat;
	mask: url(../../images/icons/arrow-right.svg) center / contain no-repeat;
}

[dir="rtl"] .wp-block-button.is-style-arrow > .wp-block-button__link::after {
	scale: -1 1;
}

/* Honey shine: a sheen sweeps across on hover. */
.wp-block-button.is-style-shine > .wp-block-button__link {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.wp-block-button.is-style-shine > .wp-block-button__link::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 0.55) 46%, rgb(255 241 194 / 0.85) 50%, transparent 66%);
	pointer-events: none;
	translate: -110% 0;
}

@media (prefers-reduced-motion: no-preference) {
	body:not(.revita-motion-off) .wp-block-button.is-style-arrow > .wp-block-button__link::after {
		transition: translate var(--wp--custom--motion--duration--base) var(--wp--custom--motion--easing--honey);
	}

	body:not(.revita-motion-off) .wp-block-button.is-style-arrow > .wp-block-button__link:is(:hover, :focus-visible)::after {
		translate: 4px 0;
	}

	[dir="rtl"] body:not(.revita-motion-off) .wp-block-button.is-style-arrow > .wp-block-button__link:is(:hover, :focus-visible)::after {
		translate: -4px 0;
	}

	body:not(.revita-motion-off) .wp-block-button.is-style-shine > .wp-block-button__link:is(:hover, :focus-visible)::before {
		translate: 110% 0;
		transition: translate var(--wp--custom--motion--duration--slower) var(--wp--custom--motion--easing--honey);
	}

	body.revita-motion-subtle .wp-block-button.is-style-shine > .wp-block-button__link:is(:hover, :focus-visible)::before {
		transition-duration: var(--wp--custom--motion--duration--base);
	}
}
