/* Buttons: one hover system. Every button wipes to its hover colour from the left; text and
   icon follow. Variants and surfaces only set the tokens, so no rule can override another. */
/* theme.json styles.elements.button prints `:root :where(.wp-block-button__link)` after this
   file with the same specificity, so it must read the same tokens (--b-bg, --b-fg) or it wins. */

.wp-block-button__link {
	--b-bg: var(--btn-bg);
	--b-fg: var(--btn-fg);
	--b-hbg: var(--btn-hover-bg);
	--b-hfg: var(--btn-hover-fg);
	position: relative;
	isolation: isolate;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 56px;
	padding: 0 28px;
	font-size: 1.0625rem;
	font-weight: 500;
	line-height: 1;
	background: var(--b-bg);
	color: var(--b-fg);
	border: 1px solid transparent;
	text-decoration: none !important;
	cursor: pointer;
	transition: background 0.35s, color 0.3s var(--ease), border-color 0.3s, transform 0.6s var(--ease);
}

.wp-block-button__link::before {
	content: "";
	position: absolute;
	inset: -1px;
	z-index: -1;
	background: var(--b-hbg);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.4s var(--ease);
}

.wp-block-button__link:hover,
.wp-block-button__link:focus-visible {
	color: var(--b-hfg);
	background: var(--b-bg);
}

.wp-block-button__link:hover::before,
.wp-block-button__link:focus-visible::before {
	transform: scaleX(1);
}

/* Icons inside buttons, drawn from the theme's own icon files. */
.wp-block-button__link::after,
.is-style-get-in-touch .wp-block-button__link > .cn-btn-icon {
	flex: none;
}

/* "Get in touch" (D16): envelope before the label. */
.wp-block-button.is-style-get-in-touch .wp-block-button__link {
	flex-direction: row;
}

.wp-block-button.is-style-get-in-touch .wp-block-button__link::after {
	content: "";
	order: -1;
	width: 20px;
	height: 20px;
	background-color: currentColor;
	-webkit-mask: url("../icons/email.svg") no-repeat center / contain;
	mask: url("../icons/email.svg") no-repeat center / contain;
	transition: transform 0.4s var(--ease);
}

/* Ice Cyan button (hero, overlay header, mobile menu). */
.wp-block-button.is-style-ice .wp-block-button__link {
	--b-bg: var(--ice);
	--b-fg: var(--purple);
	--b-hbg: #fff;
	--b-hfg: var(--purple);
}

/* Ghost: outline in the text colour with an arrow, fills white on hover. For dark surfaces.
   AU2-M3: the label used to turn purple the moment the pointer arrived while the white wipe was
   still crossing, so for about 150 ms its tail was purple on the photo. The label is now painted by
   a two-colour gradient clipped to the glyphs that slides in step with the wipe (same distance,
   duration and curve): every glyph is white on the photo and purple on the wipe at every frame.
   The element colour stays the surface colour for the border and the arrow, and the arrow switches
   to purple when the wipe reaches it. */
.wp-block-button.is-style-ghost .wp-block-button__link {
	--b-bg: transparent;
	--b-hbg: #fff;
	--b-hfg: var(--purple);
	color: inherit;
	border-color: currentColor;
	-webkit-text-fill-color: transparent;
	/* Two layers: the label gradient clipped to the glyphs on top, the white wipe under it. The wipe
	   cannot be the ::before pseudo-element here, because a child paints over the element's own
	   background and would cover the clipped label. */
	background-image: linear-gradient(90deg, var(--b-hfg) 50%, currentColor 50%), linear-gradient(90deg, var(--b-hbg) 50%, transparent 50%);
	background-size: 200% 100%, 200% 100%;
	background-position: 100% 0, 100% 0;
	background-repeat: no-repeat, no-repeat;
	-webkit-background-clip: text, border-box;
	background-clip: text, border-box;
	transition: background-position 0.4s var(--ease), border-color 0.3s, transform 0.6s var(--ease);
}

.wp-block-button.is-style-ghost .wp-block-button__link::before {
	display: none;
}

.wp-block-button.is-style-ghost .wp-block-button__link:is(:hover, :focus-visible) {
	background-position: 0 0, 0 0;
	border-color: #fff;
}

.wp-block-button.is-style-ghost .wp-block-button__link::after {
	content: "";
	width: 20px;
	height: 20px;
	background-color: currentColor;
	-webkit-mask: url("../icons/ui-arrow-right.svg") no-repeat center / contain;
	mask: url("../icons/ui-arrow-right.svg") no-repeat center / contain;
	transition: transform 0.4s var(--ease), background-color 0s linear 0.04s;
}

.wp-block-button.is-style-ghost .wp-block-button__link:is(:hover, :focus-visible)::after {
	background-color: var(--b-hfg);
	transform: translateX(4px);
	transition: transform 0.4s var(--ease), background-color 0s linear 0.18s;
}

/* White button (kept for the sub-page banners). */
.wp-block-button.is-style-white .wp-block-button__link {
	--b-bg: #fff;
	--b-fg: var(--purple);
	--b-hbg: var(--ice);
	--b-hfg: var(--purple);
}

/* Arrow link: a text link with an arrow; the underline grows from the left, the arrow nudges. */
.wp-block-button.is-style-arrow-link .wp-block-button__link {
	background: none !important;
	color: inherit;
	padding: 0 0 4px;
	min-width: 0;
	min-height: 0;
	border: 0;
	overflow: visible;
	font-size: var(--t-body);
	font-weight: 500;
	gap: 10px;
	justify-content: flex-start;
	text-align: left; /* a wrapped label stays left-aligned on phones */
}

.wp-block-button.is-style-arrow-link .wp-block-button__link::before {
	inset: auto 0 0 0;
	height: 1px;
	background: currentColor;
	z-index: 0;
	transition: transform 0.35s var(--ease);
}

.wp-block-button.is-style-arrow-link .wp-block-button__link::after {
	content: "";
	width: 22px;
	height: 22px;
	background-color: currentColor;
	-webkit-mask: url("../icons/ui-arrow-right.svg") no-repeat center / contain;
	mask: url("../icons/ui-arrow-right.svg") no-repeat center / contain;
	transition: transform 0.3s var(--ease);
}

.wp-block-button.is-style-arrow-link.is-external .wp-block-button__link::after {
	-webkit-mask-image: url("../icons/ui-arrow-up-right.svg");
	mask-image: url("../icons/ui-arrow-up-right.svg");
}

/* Download link: the arrow points down into a tray, and dips on hover instead of nudging right. */
.wp-block-button.is-style-arrow-link.is-download .wp-block-button__link::after {
	-webkit-mask-image: url("../icons/ui-download.svg");
	mask-image: url("../icons/ui-download.svg");
}

.wp-block-button.is-style-arrow-link.is-download .wp-block-button__link:hover::after {
	transform: translateY(4px);
}

.wp-block-button.is-style-arrow-link.is-download .wp-block-button__link:active::after {
	transform: translateY(6px);
}

/* AU-L4: an email link shows the envelope, not the external arrow. */
.wp-block-button.is-style-arrow-link .wp-block-button__link[href^="mailto:"]::after,
.wp-block-button.is-style-arrow-link.is-external .wp-block-button__link[href^="mailto:"]::after {
	-webkit-mask-image: url("../icons/email.svg");
	mask-image: url("../icons/email.svg");
}

/* AU-L5: a document row that opens another site (Companies House) shows the external arrow. */
.wp-block-button.is-style-arrow-link.is-download .wp-block-button__link:is([href^="http://"], [href^="https://"]):not([href*="computenordic.com"])::after {
	-webkit-mask-image: url("../icons/ui-arrow-up-right.svg");
	mask-image: url("../icons/ui-arrow-up-right.svg");
}

.wp-block-button.is-style-arrow-link.is-download .wp-block-button__link:is([href^="http://"], [href^="https://"]):not([href*="computenordic.com"]):is(:hover, :active)::after {
	transform: translateX(6px);
}

.wp-block-button.is-style-arrow-link .wp-block-button__link:hover,
.wp-block-button.is-style-arrow-link .wp-block-button__link:focus-visible {
	color: inherit;
}

.wp-block-button.is-style-arrow-link .wp-block-button__link:hover::after {
	transform: translateX(6px);
}

.wp-block-button.is-style-arrow-link .wp-block-button__link:active::after {
	transform: translateX(8px);
}

/* Buttons on purple bands and photo covers. */
.is-style-section-purple .wp-block-button:not(.is-style-arrow-link) .wp-block-button__link,
.wp-block-cover .wp-block-button:not(.is-style-arrow-link, .is-style-ghost) .wp-block-button__link {
	--b-bg: var(--ice);
	--b-fg: var(--purple);
	--b-hbg: #fff;
	--b-hfg: var(--purple);
}

/* Buttons on cyan bands. */
.is-style-section-ice-cyan .wp-block-button:not(.is-style-arrow-link) .wp-block-button__link,
.is-style-section-sky-blue .wp-block-button:not(.is-style-arrow-link) .wp-block-button__link {
	--b-hbg: #fff;
	--b-hfg: var(--purple);
}
