/*
 * Cookie consent (Complianz) in the theme's language.
 *
 * Colours, radii, border, position and font size are set in Complianz's own
 * banner settings (Consent Banner → Appearance/Colours; record in
 * manager/facts/consent-setup.md) and reach the page as its --cmplz_* custom
 * properties. This file is only what those settings cannot say: the type,
 * the button treatment the site uses everywhere, the phone layout next to
 * the villa booking bar, and the map placeholder.
 *
 * Complianz's banner stylesheet may load after this one, so every rule is
 * scoped under #cmplz-cookiebanner-container to win on specificity rather
 * than on order.
 *
 * Loaded by inc/site/consent.php, only while Complianz is active.
 */

/* ------------------------------------------------------------- banner */

#cmplz-cookiebanner-container .cmplz-cookiebanner {
	font-family: var(--wp--preset--font-family--body);
	box-shadow: 0 18px 48px rgba( 29, 36, 46, 0.18 ), 0 2px 6px rgba( 29, 36, 46, 0.08 );
}

#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-show:hover {
	box-shadow: 0 18px 48px rgba( 29, 36, 46, 0.18 ), 0 2px 6px rgba( 29, 36, 46, 0.08 );
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-s);
	font-weight: 400;
	line-height: 1;
	color: var(--wp--preset--color--ink);
	justify-self: start;
	grid-column-start: 1;
	grid-column-end: 3;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close {
	color: var(--wp--preset--color--muted);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close:hover,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close:focus-visible {
	color: var(--wp--preset--color--ink);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-message {
	line-height: 1.6;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-category-title {
	font-weight: 600;
	color: var(--wp--preset--color--ink);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-always-active {
	color: var(--wp--preset--color--muted);
}

/* The site's button: 13px body face, 600, tracked uppercase, 2px corners. */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1.2;
	min-height: 48px;
	padding: 13px 18px;
	white-space: normal;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept:hover,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept:focus-visible {
	background-color: var(--wp--preset--color--brand-deep);
	border-color: var(--wp--preset--color--brand-deep);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn:not(.cmplz-accept):hover,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn:not(.cmplz-accept):focus-visible {
	background-color: var(--wp--preset--color--mist);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-btn:focus-visible,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-link:focus-visible,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links .cmplz-link {
	font-size: var(--wp--preset--font-size--body-xs);
	text-underline-offset: 3px;
}

/* ----------------------------------------------------------- phone */

@media ( max-width: 768px ) {
	#cmplz-cookiebanner-container .cmplz-cookiebanner {
		padding: 18px 16px 14px;
		border-left-width: 0;
		border-right-width: 0;
		border-bottom-width: 0;
		border-radius: 0;
		row-gap: 10px;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-message {
		font-size: var(--wp--preset--font-size--body-xs);
		line-height: 1.55;
	}

	/* Accept | Deny side by side, preferences beneath: three rows became two. */
	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
		min-height: 44px;
		padding: 11px 10px;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences,
	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences {
		grid-column: 1 / -1;
	}

	/* Villa pages carry a fixed 72px booking bar (blocks/villa-body, ≤781px):
	   the banner sits on it instead of over it, so "Book" stays reachable. */
	body:has( .mvr-villa-bar ) #cmplz-cookiebanner-container .cmplz-cookiebanner {
		bottom: 72px;
		max-height: calc( 100vh - 72px - 16px );
		max-height: calc( 100dvh - 72px - 16px );
	}
}

/* ---------------------------------------------------- map placeholder */

/*
 * Complianz replaces each Google Maps iframe with src="about:blank", wraps
 * it in .cmplz-placeholder-parent (→ .cmplz-blocked-content-container) and
 * appends its accept button (.cmplz-blocked-content-notice). Its default
 * picture is a stock map of somewhere else, and its script sets the wrapper's
 * height from that picture's aspect ratio (863px on Contact). Here the
 * wrapper fills the map box the theme already sizes (.mvr-map: 420/460/240/
 * 220px), shows a card with a pin instead of the picture, and the button is
 * a brand button (sentence case: its text is Complianz's translated
 * sentence, too long for the tracked capitals). After consent Complianz removes the notice and the
 * container class, and the real map fills the same box.
 */

.mvr-map > .cmplz-placeholder-parent {
	position: relative;
	width: 100%;
	height: 100% !important; /* beats Complianz's generated .cmplz-placeholder-N { height } */
}

.mvr-map > .cmplz-blocked-content-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 24px;
	box-sizing: border-box;
	background-color: var(--wp--preset--color--card) !important;
	background-image:
		repeating-linear-gradient( 0deg, transparent 0 47px, rgba( 56, 72, 94, 0.07 ) 47px 48px ),
		repeating-linear-gradient( 90deg, transparent 0 47px, rgba( 56, 72, 94, 0.07 ) 47px 48px ) !important;
	background-size: auto !important;
	background-position: center !important;
}

/* The pin, drawn above the button. */
.mvr-map > .cmplz-blocked-content-container::before {
	content: "";
	width: 40px;
	height: 40px;
	flex: none;
	background: no-repeat center / contain url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A5A31' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E" );
}

/* The blocked iframe is invisible while it is about:blank; keep it out of layout and clicks. */
.mvr-map > .cmplz-blocked-content-container > iframe.cmplz-iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	visibility: hidden;
	pointer-events: none;
}

.mvr-map > .cmplz-blocked-content-container .cmplz-blocked-content-notice {
	/* Complianz centres it absolutely over the picture; here it sits in the flex column. */
	position: static !important;
	transform: none !important;
	top: auto !important;
	left: auto !important;
	max-width: min( 360px, 100% );
	width: auto;
	margin: 0;
	padding: 13px 22px;
	border: 1px solid var(--wp--preset--color--brand);
	border-radius: 2px;
	background: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--body-xs);
	font-weight: 600;
	line-height: 1.45;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.mvr-map > .cmplz-blocked-content-container .cmplz-blocked-content-notice:hover,
.mvr-map > .cmplz-blocked-content-container .cmplz-blocked-content-notice:focus-visible {
	background: var(--wp--preset--color--brand-deep);
	border-color: var(--wp--preset--color--brand-deep);
}

.mvr-map > .cmplz-blocked-content-container .cmplz-blocked-content-notice:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

@media ( max-width: 781px ) {
	.mvr-map > .cmplz-blocked-content-container {
		gap: 12px;
		padding: 16px;
	}

	.mvr-map > .cmplz-blocked-content-container::before {
		width: 32px;
		height: 32px;
	}

	.mvr-map > .cmplz-blocked-content-container .cmplz-blocked-content-notice {
		padding: 11px 16px;
	}
}

/* ------------------------------------------- Cookie Policy document */

/*
 * The Cookie Policy page is the theme's legal page (page-legal.css: one
 * 760px column) with Complianz's generated document (#cmplz-document, the
 * complianz/document block) under its H1. Complianz's document.css gives the
 * document 800px, auto margins and 14px type by id, which beats the legal
 * column's class rules; bring it back into the column and the site's type.
 */
.wp-block-group.mvr-legal > #cmplz-document {
	max-width: 760px;
	margin-top: 16px;
	font-size: inherit;
}

#cmplz-document .cmplz-dropdown,
#cmplz-document .cmplz-dropdown summary,
#cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category,
#cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header {
	background-color: var(--wp--preset--color--card);
}

/*
 * Complianz's document.css sizes a service's description and "sharing data"
 * blocks width: 100% plus 15px side padding in the content box, so each runs
 * 30px wider than its dropdown — about 6px past a 390px screen. Count the
 * padding inside the width, and let long words (URLs, cookie names) break
 * rather than push the column.
 */
#cmplz-document .cmplz-dropdown > div,
#cmplz-document .cmplz-dropdown .cmplz-service-description,
#cmplz-document .cmplz-dropdown .cmplz-sharing-data {
	box-sizing: border-box;
	max-width: 100%;
}

#cmplz-document {
	overflow-wrap: anywhere;
}

#cmplz-document .cmplz-dropdown .cookies-per-purpose {
	border-color: var(--wp--preset--color--line);
	background-color: var(--wp--preset--color--line);
}

#cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-always-active {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--caption);
}

/* Revoking happens here: the category checkboxes save on change. */
#cmplz-manage-consent-container input.cmplz-consent-checkbox {
	width: 18px;
	height: 18px;
	accent-color: var(--wp--preset--color--brand);
	cursor: pointer;
}

/* ------------------------------------------- "Manage consent" tab */

/* Complianz's re-open tab (desktop only; hidden ≤768px by Complianz). */
#cmplz-manage-consent .cmplz-manage-consent {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--brand);
}
