/**
 * King-Media: core/button.
 *
 * Primair: glans + lift. Outline: vult van links + lift. Tekstknop (km-text): groeiende lijn + pijl.
 * De vulling van outline staat hier zonder beweging, zodat die ook in de editor en bij
 * beweging verminderen klopt; de beweging zelf staat in de media query.
 */

/* Outline: vulling + primair: glans-laag en uitlijning */
.wp-block-button.is-style-outline>.wp-block-button__link {
	background-image: linear-gradient(var(--wp--preset--color--brand-600),var(--wp--preset--color--brand-600));
	background-repeat: no-repeat;
	background-position: left center;
	background-size: 0% 100%;
}

.wp-block-button.is-style-outline>.wp-block-button__link:is(:hover,:active) {
	background-size: 100% 100%;
}

.wp-block-button:not(.is-style-outline,.is-style-km-text)>.wp-block-button__link {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	vertical-align: top;
}

/* Tekstknop met pijl (km-text) */
.wp-block-button.is-style-km-text .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	text-align: left;
	background-image: linear-gradient(currentColor, currentColor);
	background-repeat: no-repeat;
	background-position: left calc(100% - .35rem);
	background-size: 0% 2px;
	transition: background-size .35s cubic-bezier(.2, .7, .2, 1);
}

.wp-block-button.is-style-km-text .wp-block-button__link::after {
	content: "";
	flex: none;
	width: 1.25rem;
	height: 1.25rem;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M5%2012h14M13%206l6%206-6%206'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M5%2012h14M13%206l6%206-6%206'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}

.wp-block-button.is-style-km-text .wp-block-button__link:hover {
	background-size: calc(100% - 1.75rem) 2px;
}

.wp-block-button.is-style-km-text .wp-block-button__link:hover::after {
	transform: translateX(.375rem);
}

/* Beweging: glans, sweep, lift, indrukken */
@media (prefers-reduced-motion: no-preference) {
	.wp-block-button:not(.is-style-outline, .is-style-km-text) > .wp-block-button__link {
		transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.2s;
	}
	.wp-block-button:not(.is-style-outline, .is-style-km-text) > .wp-block-button__link::before {
		content: "";
		position: absolute;
		inset: 0 auto 0 -60%;
		z-index: -1;
		width: 50%;
		background: linear-gradient(100deg, transparent, rgb(255 255 255 / 0.35), transparent);
		transform: skewX(-20deg);
		transition: left 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
		pointer-events: none;
	}
	.wp-block-button.is-style-outline > .wp-block-button__link {
		transition: background-size 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.25s, transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
	}

	@media (hover: hover) {
		.wp-block-button:not(.is-style-outline, .is-style-km-text) > .wp-block-button__link:hover {
			transform: translateY(-2px);
			box-shadow: 0 10px 24px rgb(0 89 255 / 0.35);
		}
		.wp-block-button:not(.is-style-outline, .is-style-km-text) > .wp-block-button__link:hover::before {
			left: 120%;
		}
		.wp-block-button.is-style-outline > .wp-block-button__link:hover {
			transform: translateY(-2px);
			box-shadow: 0 10px 24px rgb(0 89 255 / 0.25);
		}
	}

	.wp-block-button:not(.is-style-km-text) > .wp-block-button__link:active {
		transform: scale(0.98);
		box-shadow: none;
	}
}
