/* An icon-only button hides its label with font-size: 0, which collapses every em inside it, so
   grave-core sizes that mode in rem. This pair is what lands the square on the height a text
   button gets from its own 0.75em padding and 1.5 line-height. */
.wp-element-button.is-icon-only,
.wp-block-button.grave-has-icon.is-icon-only .wp-block-button__link {
	--grave-btn-icon-size: 1rem;
	--grave-btn-icon-only-padding: 1rem;
}

.wp-block-button.is-style-contrast,
.wp-element-button.is-style-contrast {
	--grave-button-background: var(--wp--custom--button--contrast--background);
	--grave-button-background-hover: var(--wp--custom--button--contrast--background-hover);
	--grave-button-text: var(--wp--custom--button--contrast--text);
	--grave-button-text-hover: var(--wp--custom--button--contrast--text);
}

:is(a, button).wp-element-button,
.grave-button__visual,
.grave-post-card__read {
	transition: background-color var(--wp--custom--motion--duration--fast)
		var(--wp--custom--motion--easing--out);
}

.wp-block-button .wp-block-button__link.grave-button-global-link,
.wp-block-button.grave-has-icon.is-icon-only .grave-button-global-link {
	display: inline-block;
	padding: 0;
	border: 0;
	background: transparent;
	text-decoration: none;
}

.wp-block-button.grave-has-icon .grave-button-global-link::after {
	content: none;
}

@media (hover: hover) and (pointer: fine) {
	:is(a, button).wp-element-button:hover,
	.grave-button-global-link:hover > .grave-button__visual,
	.grave-post-card__link:hover .grave-post-card__read {
		background-color: var(--wp--custom--button--background-hover);
	}

	.wp-block-button.is-style-secondary .wp-block-button__link:not(.grave-button-global-link):hover,
	.wp-block-button.is-style-secondary .grave-button-global-link:hover > .grave-button__visual,
	.grave-header__account .wp-block-button__link:not(.grave-button-global-link):hover {
		background-color: var(--wp--custom--button--secondary--background-hover);
	}

	.wp-block-button.is-style-contrast .wp-block-button__link:not(.grave-button-global-link):hover,
	.wp-block-button.is-style-contrast .grave-button-global-link:hover > .grave-button__visual {
		background-color: var(--wp--custom--button--contrast--background-hover);
	}

	.wp-block-button__link.has-primary-background-color:hover,
	.grave-button-global-link:hover > .has-primary-background-color {
		background-color: var(--wp--custom--button--background-hover) !important;
	}
}

.grave-button-global-link:active > .grave-button__visual {
	box-shadow: inset 0 0 0 calc(var(--wp--custom--border--width) + var(--wp--custom--border--width)) currentColor;
}

@media (prefers-reduced-motion: no-preference) {
	:is(a, button).wp-element-button,
	.grave-button__visual,
	.grave-post-card__read {
		transition:
			background-color var(--wp--custom--motion--duration--fast) var(--wp--custom--motion--easing--out),
			transform var(--wp--custom--motion--duration--button) var(--wp--custom--motion--easing-in-out);
	}

	:is(a, button).wp-element-button:active {
		transform: scale(var(--wp--custom--button--press-scale));
		transition-duration: var(--wp--custom--motion--duration--fast), 0ms;
	}

	@media (hover: hover) and (pointer: fine) {
		:is(a, button).wp-element-button:hover,
		.grave-button-global-link:hover > .grave-button__visual,
		.grave-post-card__link:hover .grave-post-card__read {
			transform: scale(var(--wp--custom--button--hover-scale));
		}

		:is(a, button).wp-element-button:active,
		.grave-button-global-link:active > .grave-button__visual,
		.grave-post-card__link:active .grave-post-card__read {
			transform: scale(var(--wp--custom--button--press-scale));
			transition-duration: var(--wp--custom--motion--duration--fast), 0ms;
		}
	}
}
