/*
 * The cookie banner (inc/analytics.php, assets/js/consent.js), on every
 * page: the redesign reads its tokens (tokens.css); the Google Ads landings,
 * which do not load tokens.css, fall back to the same values. Colours are
 * always the theme.json presets. "Reject" and "Accept" are identical.
 *
 * Where it sits, so it never covers a title, a WhatsApp button or the
 * homepage's own buttons:
 * - computer: bottom right; on the homepage above "Explore our services";
 *   on the Google Ads landings top right, under their header (their title
 *   runs along the bottom of the cover photograph);
 * - phone: bottom, full width, at most 20% of the screen; just above the
 *   landings' fixed WhatsApp bar while it shows.
 */

.wsme-consent {
	--wsme-consent-m: var(--m, clamp(20px, 2.4vw, 40px));
	position: fixed;
	z-index: 400; /* above the header, the menu and the pre-homepage (300) */
	inset-inline-end: var(--wsme-consent-m);
	inset-block-end: max(var(--wsme-consent-m), env(safe-area-inset-bottom));
	box-sizing: border-box;
	inline-size: min(34rem, calc(100vw - 2 * var(--wsme-consent-m)));
	padding: 24px;
	border: 1px solid var(--wp--preset--color--graphite);
	border-radius: var(--r, 22px);
	background: var(--wp--preset--color--carbon);
	color: var(--wp--preset--color--cement);
	font-family: var(--wp--preset--font-family--jost, inherit);
	opacity: 0;
	transform: translateY(16px);
	transition: opacity var(--dur-2, 0.6s) var(--ease-out, ease-out), transform var(--dur-2, 0.6s) var(--ease-out, ease-out);
}

.wsme-consent[hidden] {
	display: none;
}

.wsme-consent.is-in {
	opacity: 1;
	transform: none;
}

.wsme-consent__title {
	margin: 0 0 12px;
	font-family: inherit;
	font-size: var(--fs-label, 0.75rem);
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: var(--ls-label, 0.16em);
	text-transform: uppercase;
	color: var(--wp--preset--color--cement-grey);
}

.wsme-consent__text {
	margin: 0 0 20px;
	font-size: var(--fs-body, 1.0625rem);
	font-weight: 400;
	line-height: 1.5;
}

.wsme-consent__text a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.wsme-consent__buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.wsme-consent .wsme-consent__button { /* beats the redesign's ".wsme-v2 button" reset */
	min-block-size: var(--btn-h-sm, 44px);
	padding: 0 20px;
	border: 0;
	border-radius: var(--r-round, 999px);
	background: var(--wp--preset--color--cement);
	color: var(--wp--preset--color--carbon);
	font-family: inherit;
	font-size: var(--fs-button, 0.95rem);
	font-weight: 500;
	cursor: pointer;
	transition: background-color var(--dur-1, 0.3s);
}

.wsme-consent .wsme-consent__button:hover {
	background: var(--wp--preset--color--base);
}

.wsme-consent .wsme-consent__button:focus-visible,
.wsme-consent__text a:focus-visible {
	outline: 2px solid var(--wp--preset--color--stone);
	outline-offset: 3px;
}

/* "Cookie settings" in the footers: a button that looks like the Privacy link beside it. */
.wsme-consent-open {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.wsme-consent-open[hidden] {
	display: none;
}

.wsme-consent__short {
	display: none;
}

/* Homepage, computer: above "Explore our services" (24px from the bottom, one button high). */
.wsme-consent--home {
	inset-block-end: calc(env(safe-area-inset-bottom, 0px) + 24px + var(--btn-h, 50px) + 16px);
}

/* Landings, computer: top right, under the header (83.55px, see page-category.css). */
.wsme-consent--landing {
	inset-block-start: calc(84px + 16px);
	inset-block-end: auto;
}

/* Phone: compact — the short sentence, no visible title, at most 20% of a 390x844 screen. */
@media (max-width: 760px) {
	.wsme-consent {
		--wsme-consent-m: 12px;
		padding: 16px;
	}

	.wsme-consent__title {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.wsme-consent__text {
		margin-block-end: 12px;
		font-size: var(--fs-button, 0.95rem);
		line-height: 1.45;
	}

	.wsme-consent__long {
		display: none;
	}

	.wsme-consent__short {
		display: inline;
	}

	.wsme-consent .wsme-consent__button {
		block-size: var(--btn-h-sm, 44px);
		min-block-size: 0;
	}
}

/* Phone: always at the bottom, the same distance from it on every page
   (above the iPhone's home indicator: safe area). Where a fixed WhatsApp bar
   is showing (the landings, after their cover), just above it instead:
   consent.js measures the bar and sets --wsme-consent-lift. */
@media (max-width: 760px) {
	.wsme-consent,
	.wsme-consent--home,
	.wsme-consent--landing {
		inset-block-start: auto;
		inset-block-end: calc(12px + env(safe-area-inset-bottom, 0px));
	}

	.wsme-consent.is-lifted {
		inset-block-end: calc(var(--wsme-consent-lift, 0px) + 8px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wsme-consent {
		transition: none;
	}
}
