/**
 * ALR-141 — one button family for every CTA (customer feedback on v1.4.0-rc.4).
 *
 * Four variants, all driven by the --allure-ds-button-* tokens:
 *   primary    dark  → brown on hover            (default CTA on light surfaces)
 *   secondary  outline → dark fill on hover      (second action next to a primary)
 *   on-dark    white → light brown on hover      (+ white outline secondary) in dark bands
 *   accent     brown → dark brown on hover       ("Book tid" in header and mobile drawer only)
 *
 * Presentation only: no markup, link target, text or tracking attribute changes.
 * The existing button classes are mapped here instead of page by page:
 *   K2 closing band / 2.0 pages  .allure-homepage__button (+ --outline)
 *   K7 error paths               .allure-errorpath__button (+ --secondary), __search-button, __about
 *   special pages                .allure-special__button (+ --secondary)
 *   treatments overview / K9     .allure-treatments__button, __about, .k9-card__button (+ --secondary)
 *   treatment pages              .allure-button (+ --primary / --secondary)
 *   Pagebuilder + CTA component  .btn_item.btn-primary / .btn-orange (primary), .btn-secondary / .btn-third (secondary)
 *   WooCommerce                  add to cart, cart, checkout, mini-cart (colours only)
 * Earlier rules are spread over style.css, page CSS, component CSS and allure-site's C4 CSS,
 * so every selector is scoped with body:not(#allure-buttons) (ID-level specificity); only
 * WooCommerce rules that already use !important are mirrored with !important.
 */

/* ---- Shared shape and type (not the compact header/drawer booking buttons) ---------------- */
body:not(#allure-buttons) :is(
	.allure-homepage__button, .allure-errorpath__button, .allure-errorpath__search-button, .allure-errorpath__about,
	.allure-special__button, .allure-treatments__button, .allure-treatments__about, .k9-card__button, .allure-button,
	.btn_item.btn-primary, .btn_item.btn-orange, .btn_item.btn-secondary, .btn_item.btn-third, .single_add_to_cart_button
) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--allure-ds-button-min-height);
	padding: var(--allure-ds-button-padding-block) var(--allure-ds-button-padding-inline);
	border: var(--allure-ds-border-width) solid var(--allure-ds-button-border);
	border-radius: var(--allure-ds-radius-control);
	font-family: var(--allure-ds-font-body);
	font-size: var(--allure-ds-button-font-size);
	font-weight: var(--allure-ds-button-font-weight);
	letter-spacing: var(--allure-ds-button-letter-spacing);
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	text-transform: var(--allure-ds-button-text-transform);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
/* Wide screens: a label never breaks over two lines (phones may wrap long labels). */
@media (min-width: 48rem) {
	body:not(#allure-buttons) :is(
		.allure-homepage__button, .allure-errorpath__button, .allure-errorpath__search-button, .allure-errorpath__about,
		.allure-special__button, .allure-treatments__button, .allure-treatments__about, .k9-card__button, .allure-button,
		.btn_item.btn-primary, .btn_item.btn-orange, .btn_item.btn-secondary, .btn_item.btn-third
	) {
		white-space: nowrap;
	}
}

/* ---- Primary ------------------------------------------------------------------------------ */
body:not(#allure-buttons) :is(
	.allure-homepage__button, .allure-errorpath__button, .allure-errorpath__search-button, .allure-special__button,
	.allure-treatments__button, .k9-card__button, .allure-button, .btn_item.btn-primary, .btn_item.btn-orange,
	.single_add_to_cart_button
):is(*, :link, :visited) {
	border-color: var(--allure-ds-button-primary-background);
	background: var(--allure-ds-button-primary-background);
	color: var(--allure-ds-button-primary-text);
}
body:not(#allure-buttons) :is(
	.allure-homepage__button, .allure-errorpath__button, .allure-errorpath__search-button, .allure-special__button,
	.allure-treatments__button, .k9-card__button, .allure-button, .btn_item.btn-primary, .btn_item.btn-orange,
	.single_add_to_cart_button
):is(:hover, :active) {
	border-color: var(--allure-ds-button-primary-hover-background);
	background: var(--allure-ds-button-primary-hover-background);
	color: var(--allure-ds-button-primary-hover-text);
}

/* ---- Secondary (outline) ------------------------------------------------------------------ */
body:not(#allure-buttons) :is(
	.allure-homepage__button--outline, .allure-errorpath__button--secondary, .allure-special__button--secondary,
	.k9-card__button--secondary, .allure-button--secondary, .btn_item.btn-secondary, .btn_item.btn-third
):is(*, :link, :visited) {
	border-color: var(--allure-ds-button-border);
	background: var(--allure-ds-button-secondary-background);
	color: var(--allure-ds-button-secondary-text);
}
body:not(#allure-buttons) :is(
	.allure-homepage__button--outline, .allure-errorpath__button--secondary, .allure-special__button--secondary,
	.k9-card__button--secondary, .allure-button--secondary, .btn_item.btn-secondary, .btn_item.btn-third
):is(:hover, :active) {
	border-color: var(--allure-ds-button-secondary-hover-background);
	background: var(--allure-ds-button-secondary-hover-background);
	color: var(--allure-ds-button-secondary-hover-text);
}

/* ---- On dark bands --------------------------------------------------------------------------
 * K2 on 404/search, /behandlinger/, Exclusive sign-up, Find klinik; the treatment pages'
 * closing hand-off and next step; the before/after closure; the front page's Exclusive band and
 * the closing bands on Priser, Kontakt, Om os and Finansiering (DEV QA rc.5, 2026-10-22). */
body:not(#allure-buttons) :is(
	.allure-errorpath__handoff, .allure-treatments__handoff, .allure-exclusive__handoff, .allure-location-page__closing,
	.allure-treatment-experience__closing-handoff, .allure-treatment-experience__next-step, .allure-before-after__closure,
	.allure-homepage__exclusive, .allure-prices-page__handoff, .allure-contact__handoff, .allure-about__handoff, .allure-financing__handoff
) :is(.allure-homepage__button, .allure-button):not(.allure-homepage__button--outline, .allure-button--secondary):is(*, :link, :visited) {
	border-color: var(--allure-ds-button-on-dark-background);
	background: var(--allure-ds-button-on-dark-background);
	color: var(--allure-ds-button-on-dark-text);
}
body:not(#allure-buttons) :is(
	.allure-errorpath__handoff, .allure-treatments__handoff, .allure-exclusive__handoff, .allure-location-page__closing,
	.allure-treatment-experience__closing-handoff, .allure-treatment-experience__next-step, .allure-before-after__closure,
	.allure-homepage__exclusive, .allure-prices-page__handoff, .allure-contact__handoff, .allure-about__handoff, .allure-financing__handoff
) :is(.allure-homepage__button, .allure-button):not(.allure-homepage__button--outline, .allure-button--secondary):is(:hover, :active) {
	border-color: var(--allure-ds-button-on-dark-hover-background);
	background: var(--allure-ds-button-on-dark-hover-background);
	color: var(--allure-ds-button-on-dark-text);
}
body:not(#allure-buttons) :is(
	.allure-errorpath__handoff, .allure-treatments__handoff, .allure-exclusive__handoff, .allure-location-page__closing,
	.allure-treatment-experience__closing-handoff, .allure-treatment-experience__next-step, .allure-before-after__closure,
	.allure-homepage__exclusive, .allure-prices-page__handoff, .allure-contact__handoff, .allure-about__handoff, .allure-financing__handoff
) :is(.allure-homepage__button--outline, .allure-button--secondary, .allure-errorpath__about, .allure-treatments__about):is(*, :link, :visited) {
	border-color: var(--allure-ds-button-on-dark-background);
	background: transparent;
	color: var(--allure-ds-button-on-dark-background);
}
body:not(#allure-buttons) :is(
	.allure-errorpath__handoff, .allure-treatments__handoff, .allure-exclusive__handoff, .allure-location-page__closing,
	.allure-treatment-experience__closing-handoff, .allure-treatment-experience__next-step, .allure-before-after__closure,
	.allure-homepage__exclusive, .allure-prices-page__handoff, .allure-contact__handoff, .allure-about__handoff, .allure-financing__handoff
) :is(.allure-homepage__button--outline, .allure-button--secondary, .allure-errorpath__about, .allure-treatments__about):is(:hover, :active) {
	border-color: var(--allure-ds-button-on-dark-background);
	background: var(--allure-ds-button-on-dark-background);
	color: var(--allure-ds-button-on-dark-text);
}

/* ---- Accent: "Book tid" in the header and the mobile drawer (sizes stay compact) ----------- */
body:not(#allure-buttons) :is(.allure-header-booking, .allure-mobile-drawer__booking):is(*, :link, :visited) {
	border-color: var(--allure-ds-button-accent-background);
	background: var(--allure-ds-button-accent-background);
	color: var(--allure-ds-button-accent-text);
}
body:not(#allure-buttons) :is(.allure-header-booking, .allure-mobile-drawer__booking):is(:hover, :active) {
	border-color: var(--allure-ds-button-accent-hover-background);
	background: var(--allure-ds-button-accent-hover-background);
	color: var(--allure-ds-button-accent-text);
}

/* ---- WooCommerce cart, checkout and mini-cart: colours only (sizes and behaviour untouched) - */
body:not(#allure-buttons) :is(.woocommerce-cart .checkout-button, .woocommerce-checkout #place_order, .woocommerce-mini-cart__buttons .button:last-child, .wc-block-mini-cart__footer-checkout, .wc-block-cart__submit-button, .wc-block-components-checkout-place-order-button) {
	border-color: var(--allure-ds-button-primary-background) !important;
	background: var(--allure-ds-button-primary-background) !important;
	color: var(--allure-ds-button-primary-text) !important;
}
body:not(#allure-buttons) :is(.woocommerce-cart .checkout-button, .woocommerce-checkout #place_order, .woocommerce-mini-cart__buttons .button:last-child, .wc-block-mini-cart__footer-checkout, .wc-block-cart__submit-button, .wc-block-components-checkout-place-order-button):is(:hover, :active, :focus-visible) {
	border-color: var(--allure-ds-button-primary-hover-background) !important;
	background: var(--allure-ds-button-primary-hover-background) !important;
	color: var(--allure-ds-button-primary-hover-text) !important;
}
body:not(#allure-buttons) :is(.woocommerce-mini-cart__buttons .button:first-child, .wc-block-mini-cart__footer-cart, .woocommerce-cart-form .coupon .button, .woocommerce-cart-form button[name="update_cart"]) {
	border: var(--allure-ds-border-width) solid var(--allure-ds-button-border) !important;
	background: var(--allure-ds-button-secondary-background) !important;
	color: var(--allure-ds-button-secondary-text) !important;
}
body:not(#allure-buttons) :is(.woocommerce-mini-cart__buttons .button:first-child, .wc-block-mini-cart__footer-cart, .woocommerce-cart-form .coupon .button, .woocommerce-cart-form button[name="update_cart"]):is(:hover, :active, :focus-visible) {
	border-color: var(--allure-ds-button-secondary-hover-background) !important;
	background: var(--allure-ds-button-secondary-hover-background) !important;
	color: var(--allure-ds-button-secondary-hover-text) !important;
}
/* A disabled add-to-cart (variation not chosen yet) keeps its resting colours on hover. */
body:not(#allure-buttons) .single_add_to_cart_button:is(.disabled, :disabled):is(:hover, :active) {
	border-color: var(--allure-ds-button-primary-background);
	background: var(--allure-ds-button-primary-background);
}
