/* Site-wide UI components: icons, buttons, text links, the free shipping bar. */

/* ========================================
   Icons
======================================== */

/* Single-colour SVGs masked to currentColor. */

/* Shared */

.icon-arrow,
.icon-download,
.icon-pause,
.icon-play,
.icon-zoom,
.icon-close {
	display: inline-block;
	flex: 0 0 20px;
	inline-size: 20px;
	block-size: 20px;

	background-color: currentColor;
	pointer-events: none;

	mask-repeat: no-repeat;
	mask-size: contain;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	-webkit-mask-position: center;
}

/* Shapes */

.icon-arrow {
	mask-image: url(../../../images/icons/icon-arrow.svg);
	-webkit-mask-image: url(../../../images/icons/icon-arrow.svg);
}

.icon-download {
	mask-image: url(../../../images/icons/icon-download.svg);
	-webkit-mask-image: url(../../../images/icons/icon-download.svg);
}

.icon-pause {
	mask-image: url(../../../images/icons/icon-pause.svg);
	-webkit-mask-image: url(../../../images/icons/icon-pause.svg);
}

.icon-play {
	mask-image: url(../../../images/icons/icon-play.svg);
	-webkit-mask-image: url(../../../images/icons/icon-play.svg);
}

.icon-zoom {
	mask-image: url(../../../images/icons/icon-zoom.svg);
	-webkit-mask-image: url(../../../images/icons/icon-zoom.svg);
}

.icon-close {
	mask-image: url(../../../images/icons/icon-close.svg);
	-webkit-mask-image: url(../../../images/icons/icon-close.svg);
}

/* Arrow direction */

/* The SVG points right; other directions rotate it. */
.icon-arrow--down {
	transform: rotate(90deg);
}

.icon-arrow--left {
	transform: rotate(180deg);
}

.icon-arrow--up {
	transform: rotate(-90deg);
}

/* ========================================
   Buttons
======================================== */

/* Also covers WooCommerce, CF7 and Minimax form markup. */

/* Size tokens */

:root {
	--bc-btn-height: 3.5rem; /* 56px */
	--bc-btn-min-width: 12.5rem; /* 200px */
	--bc-btn-pad-inline: var(--space-6); /* 24px */
	--bc-btn-pad-block: var(--space-4); /* 16px */
	--bc-btn-gap: var(--space-2); /* 8px */
	--bc-btn-font-size: var(--text-ui-l); /* 17px */
}

/* Base */

.btn,
.button,
.woocommerce .button,
.woocommerce div.product form.cart .button,
.single_add_to_cart_button,
.wc-block-components-checkout-place-order-button,
.wpcf7-submit,
.mx-cw-form .mx-cw-button {
	display: inline-flex;
	align-items: center;
	align-content: center;
	justify-content: center;
	gap: var(--bc-btn-gap);

	/* Fills a flex row by default; a button that keeps its own width says so locally. */
	flex: 1 1 0;

	block-size: var(--bc-btn-height);
	min-inline-size: var(--bc-btn-min-width);
	padding-block: var(--bc-btn-pad-block);
	padding-inline: var(--bc-btn-pad-inline);

	border: var(--border-width) solid var(--color-action);
	border-radius: var(--radius-pill);
	background-color: var(--color-action);
	color: var(--color-action-text);

	font-size: var(--bc-btn-font-size);
	font-weight: var(--font-medium);
	line-height: var(--leading-slim);
	text-align: center;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	vertical-align: middle;

	cursor: pointer;
	transition: background-color var(--duration-fast) var(--ease);
}

.btn:hover,
.button:hover,
.woocommerce .button:hover,
.woocommerce div.product form.cart .button:hover,
.wc-block-components-checkout-place-order-button:hover,
.wpcf7-submit:hover,
.mx-cw-form .mx-cw-button:hover {
	border-color: var(--color-action-hover);
	background-color: var(--color-action-hover);
	color: var(--color-action-text);
}

/* Colour variants */

/* Compound .btn.btn--ghost on purpose: a bare class would tie with a page's own a { color: inherit }. */
.btn.btn--ghost,
.button.btn--ghost,
.woocommerce .button.btn--ghost,
.mx-cw-form .mx-cw-button.mx-cw-button-secondary {
	border-color: var(--color-text);
	background-color: transparent;
	color: var(--color-text);
}

.btn.btn--ghost:hover,
.button.btn--ghost:hover,
.woocommerce .button.btn--ghost:hover,
.mx-cw-form .mx-cw-button.mx-cw-button-secondary:hover {
	border-color: var(--color-text);
	background-color: var(--color-text-inverse);
	color: var(--color-text);
}

/* White fill for a button on a dark or brand-coloured surface. */
.btn.btn--inverse,
.button.btn--inverse,
.woocommerce .button.btn--inverse {
	border-color: var(--color-surface-raised);
	background-color: var(--color-surface-raised);
	color: var(--color-brand-ink);
}

.btn.btn--inverse:hover,
.button.btn--inverse:hover,
.woocommerce .button.btn--inverse:hover {
	border-color: var(--color-action-soft);
	background-color: var(--color-action-soft);
	color: var(--color-brand-ink);
}

/* Sizes */

/* Override only the size tokens, never colour. */
.btn--mid {
	--bc-btn-height: 3rem; /* 48px */
	--bc-btn-min-width: 10rem; /* 160px */
	--bc-btn-pad-inline: var(--space-5); /* 20px */
	--bc-btn-pad-block: var(--space-3); /* 12px */
	--bc-btn-font-size: var(--text-ui); /* 16px */
}

.btn--small,
.mx-cw-form .mx-cw-button-small {
	--bc-btn-height: 2.5rem; /* 40px */
	--bc-btn-min-width: 8rem; /* 128px */
	--bc-btn-pad-inline: var(--space-4); /* 16px */
	--bc-btn-pad-block: var(--space-2); /* 8px */
	--bc-btn-font-size: var(--text-meta); /* 15px */
}

/* ========================================
   Text links
======================================== */

/* An optional .icon-arrow follows the label; no default font-size, so it reads as the text around it. */

/* Base */

:root {
	--bc-link-gap: var(--space-2); /* 8px */
}

.link {
	display: inline-flex;
	align-items: center;
	gap: var(--bc-link-gap);

	color: inherit;
	font-weight: var(--font-medium);
	line-height: var(--leading-short);
	text-decoration: none;

	transition: color var(--duration-fast) var(--ease);
}

.link:hover {
	color: var(--color-action);
}

/* Underline on the label span only, never under the arrow. */
.link__label {
	text-decoration: underline;
	text-underline-offset: 5px;
}

/* Variants */

.link--plain .link__label {
	text-decoration: none;
}

.link--plain:hover .link__label {
	text-decoration: underline;
}

.link--mid {
	font-size: var(--text-ui-l); /* 17px */
}

.link--small {
	font-size: var(--text-body-s); /* 15px */
}

/* WooCommerce notice links */

/* "View cart" etc. ship as .button; three classes outrank .woocommerce .button whatever the load order. */
.woocommerce :is(.woocommerce-error, .woocommerce-info, .woocommerce-message) .button {
	display: inline;
	flex: none;
	block-size: auto;
	min-inline-size: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background-color: transparent;
	color: inherit;
	font-size: inherit;
	font-weight: var(--font-medium);
	line-height: inherit;
	text-decoration: underline;
	text-underline-offset: 5px;
	white-space: normal;
	vertical-align: baseline;
	transition: color var(--duration-fast) var(--ease);
}

.woocommerce :is(.woocommerce-error, .woocommerce-info, .woocommerce-message) .button:hover {
	background-color: transparent;
	color: var(--color-action);
}

/* ========================================
   Free shipping bar
======================================== */

/* On the cart page and in the add-to-cart drawer. */

.bc-free-shipping {
	display: grid;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-5);
	border-radius: var(--radius);
	background-color: var(--color-action-soft);
	color: var(--color-text);
	line-height: var(--leading-snug);
	text-align: center;
}

.bc-free-shipping__text {
	margin: 0;
}

.bc-free-shipping__text strong {
	font-weight: var(--font-bold);
	white-space: nowrap;
}

.bc-free-shipping__track {
	display: block;
	block-size: var(--space-2);
	border-radius: var(--radius-pill);
	background-color: var(--color-surface-raised);
	overflow: hidden;
}

.bc-free-shipping__fill {
	display: block;
	block-size: 100%;
	inline-size: var(--bc-free-shipping-progress, 0%);
	border-radius: inherit;
	background-color: var(--color-action);
}
