/* Cookie banner (Complianz) in the site's own look.
 * Texts and links: inc/components/cookie-banner.php.
 *
 * Complianz injects its own banner CSS after the theme CSS, so every rule here
 * hangs from the container id (#cmplz-cookiebanner-container or
 * #cmplz-manage-consent) to win on specificity. Buttons also need !important
 * against the theme's global `button { background-color ... !important }`
 * (components.css). Never set `display` on the buttons: Complianz shows and
 * hides "Preferences" and "Save" with inline display.
 *
 * Works with both banner markups: Complianz 7.4.x (categories as <details>)
 * and 7.5.x (categories as <div> with a toggle button).
 */

#cmplz-cookiebanner-container .cmplz-cookiebanner {
	--doit-ck-bg: #14171c;
	--doit-ck-row: rgba(255, 255, 255, 0.035);
	--doit-ck-line: rgba(255, 255, 255, 0.12);
	--doit-ck-line-2: rgba(255, 255, 255, 0.22);
	--doit-ck-text: #f4f3ee;
	--doit-ck-text-2: #b8b4a6;
	--doit-ck-text-3: #807c70;
	--doit-ck-accent: #e8dfc8;
	--doit-ck-ink: #0b0c0e;
	--doit-ck-green: #4ade80;

	/* Complianz's own variables, for anything not restyled below */
	--cmplz_banner_width: 400px;
	--cmplz_banner_background_color: var(--doit-ck-bg);
	--cmplz_banner_border_color: var(--doit-ck-line);
	--cmplz_text_color: var(--doit-ck-text-2);
	--cmplz_hyperlink_color: var(--doit-ck-accent);
	--cmplz_category_header_always_active_color: var(--doit-ck-green);

	top: auto;
	right: auto;
	bottom: 24px;
	left: 24px;
	transform: none;
	width: 400px;
	min-width: 0;
	max-width: calc(100vw - 48px);
	max-height: calc(100vh - 48px);
	padding: 18px 20px 16px;
	grid-gap: 14px;
	background: var(--doit-ck-bg);
	border: 1px solid var(--doit-ck-line);
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
	color: var(--doit-ck-text-2);
	font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
	-webkit-font-smoothing: antialiased;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-show,
#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-show:hover {
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
	#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-show {
		animation: doit-ck-in 0.35s ease-out both;
	}
}

@keyframes doit-ck-in {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: none; }
}

/* Header: small eyebrow on the left, close on the right */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-header {
	grid-template-columns: 1fr auto;
	gap: 12px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-logo {
	display: none;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	grid-column: 1;
	justify-self: start;
	margin: 0;
	color: var(--doit-ck-text-3);
	font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.14em;
	line-height: 1;
	text-transform: uppercase;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-title::before {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--doit-ck-accent);
	box-shadow: 0 0 0 3px rgba(232, 223, 200, 0.12);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close {
	grid-column: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: -6px -8px -6px 0;
	border-radius: 8px;
	color: var(--doit-ck-text-3);
	font-size: 0;
	line-height: 0;
	transition: color 0.15s ease, background-color 0.15s ease;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close svg {
	width: 13px;
	height: 13px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close:hover {
	color: var(--doit-ck-text);
	background: rgba(255, 255, 255, 0.06);
	font-size: 0;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close:focus-visible {
	outline: 2px solid var(--doit-ck-accent);
	outline-offset: 2px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-divider {
	display: none;
}

/* Message */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-body {
	min-width: 0;
	max-height: 50vh;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-message,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories {
	width: auto;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-message {
	margin: 0;
	color: var(--doit-ck-text-2);
	font-size: 14px;
	line-height: 1.55;
}

/* Categories (after "Preferences") */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories.cmplz-fade-in {
	margin-top: 14px;
	animation: none;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category {
	background: var(--doit-ck-row);
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 10px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category:not(:last-child) {
	margin-bottom: 8px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-category-header {
	padding: 11px 12px;
	cursor: pointer;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-category-title {
	color: var(--doit-ck-text);
	font-size: 14px;
	font-weight: 600;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-always-active {
	color: var(--doit-ck-green);
	font-size: 12px;
	font-weight: 500;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-description {
	padding: 0 12px 12px;
	color: var(--doit-ck-text-2);
	font-size: 13px;
	line-height: 1.5;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-icon svg {
	width: 14px;
	height: 14px;
	fill: var(--doit-ck-text-3);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-icon.cmplz-open {
	width: 14px;
	height: 14px;
}

/* 7.5.x: the chevron is a <button>; undo the theme's green button */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories button.cmplz-category-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 6px;
	background: transparent !important;
	color: var(--doit-ck-text-3) !important;
	box-shadow: none !important;
	transform: none !important;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories button.cmplz-category-toggle:focus-visible {
	outline: 2px solid var(--doit-ck-accent);
	outline-offset: 1px;
}

/* Switches: off = grey track, light knob; on = cream track, dark knob */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label::before {
	top: -9px;
	width: 34px;
	height: 18px;
	padding: 0;
	border-radius: 999px;
	background-color: rgba(255, 255, 255, 0.16);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label::after {
	top: -7px;
	left: 2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--doit-ck-text-2);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox input.cmplz-consent-checkbox:checked + .cmplz-label::before {
	background-color: var(--doit-ck-accent);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox input.cmplz-consent-checkbox:checked + .cmplz-label::after {
	left: 18px;
	background: var(--doit-ck-ink);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox input.cmplz-consent-checkbox {
	width: 34px;
	height: 18px;
	margin-top: -9px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox input.cmplz-consent-checkbox:focus + .cmplz-label::before {
	box-shadow: 0 0 0 2px var(--doit-ck-bg), 0 0 0 4px var(--doit-ck-accent);
}

/* Buttons: [Preferences]   [Reject] [Accept], Reject as easy as Accept */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
	flex: 1 1 0;
	width: auto;
	min-width: 0;
	height: 40px;
	margin: 0;
	padding: 0 14px;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 38px;
	letter-spacing: 0;
	text-align: center;
	text-transform: none;
	box-shadow: none !important;
	transform: none !important;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept {
	order: 3;
	border: 1px solid var(--doit-ck-accent);
	background-color: var(--doit-ck-accent) !important;
	color: var(--doit-ck-ink) !important;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept:hover {
	border-color: var(--doit-ck-text);
	background-color: var(--doit-ck-text) !important;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny {
	order: 2;
	border: 1px solid var(--doit-ck-line-2);
	background-color: transparent !important;
	color: var(--doit-ck-text) !important;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny:hover {
	border-color: rgba(255, 255, 255, 0.4);
	background-color: rgba(255, 255, 255, 0.05) !important;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences {
	order: 1;
	flex: 0 0 auto;
	margin-right: auto;
	padding: 0 2px;
	border: 0;
	background-color: transparent !important;
	color: var(--doit-ck-text-2) !important;
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: rgba(184, 180, 166, 0.45);
	text-underline-offset: 4px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences:hover,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences:hover {
	color: var(--doit-ck-text) !important;
	text-decoration-color: currentColor;
}

/* Once the categories are open, "Save" is a real button next to the others */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences {
	flex: 1 1 0;
	margin-right: 0;
	padding: 0 14px;
	border: 1px solid var(--doit-ck-line-2);
	color: var(--doit-ck-text) !important;
	text-decoration: none;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn:focus-visible {
	outline: 2px solid var(--doit-ck-accent);
	outline-offset: 2px;
}

/* Legal links */
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links.cmplz-documents {
	justify-content: flex-start;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links.cmplz-documents ul {
	justify-content: flex-start;
	gap: 14px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links.cmplz-documents li:has(> a:empty),
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links.cmplz-documents li:has(> a.cmplz-hidden) {
	display: none;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links .cmplz-link {
	color: var(--doit-ck-text-3);
	font-size: 12px;
	text-decoration: underline;
	text-decoration-color: rgba(128, 124, 112, 0.5);
	text-underline-offset: 3px;
}

#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links .cmplz-link:hover {
	color: var(--doit-ck-text-2);
}

/* Phones: a sheet at the bottom with side gutters, buttons in one row */
@media (max-width: 768px) {
	#cmplz-cookiebanner-container .cmplz-cookiebanner {
		left: 10px;
		right: 10px;
		bottom: 10px;
		width: auto;
		max-width: none;
		max-height: calc(100vh - 20px);
		padding: 16px 16px 14px;
		grid-gap: 12px;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-message {
		margin-right: 0;
		font-size: 13.5px;
		line-height: 1.5;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons {
		flex-direction: row;
	}
}

@media (max-width: 425px) {
	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-header .cmplz-title {
		display: inline-flex;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-category .cmplz-category-header {
		grid-template-columns: 1fr auto 15px !important;
	}

	/* "Preferences" on its own line under Reject / Accept */
	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences {
		order: 4;
		flex: 1 0 100%;
		height: 30px;
		margin: 0;
		line-height: 30px;
	}
}

/* Button over a blocked YouTube video (text: doit_cookie_banner_video_text).
   The product templates reset every <button> to transparent with !important,
   which left white text straight on the thumbnail: two classes and the
   element beat those resets. */
body .cmplz-blocked-content-container button.cmplz-blocked-content-notice,
body .cmplz-wp-video button.cmplz-blocked-content-notice {
	width: auto;
	max-width: min(340px, calc(100% - 32px));
	padding: 12px 18px;
	border: 1px solid rgba(255, 255, 255, 0.2) !important;
	border-radius: 10px;
	background: rgba(11, 12, 14, 0.86) !important;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	color: #f4f3ee !important;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
	font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.45;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

body .cmplz-blocked-content-container button.cmplz-blocked-content-notice:hover,
body .cmplz-wp-video button.cmplz-blocked-content-notice:hover {
	border-color: rgba(232, 223, 200, 0.6) !important;
	background: rgba(11, 12, 14, 0.94) !important;
	transform: translate(-50%, -50%) !important;
}

body .cmplz-blocked-content-container button.cmplz-blocked-content-notice:focus-visible,
body .cmplz-wp-video button.cmplz-blocked-content-notice:focus-visible {
	outline: 2px solid #e8dfc8;
	outline-offset: 2px;
}

/* Complianz's floating "manage consent" tab: hidden. It peeked 15px out of
   the bottom edge with its text cut in half; the footer link
   (doit_cookie_settings_button) reopens the banner from every page instead. */
#cmplz-manage-consent .cmplz-btn.cmplz-manage-consent {
	display: none !important;
}

/* Footer link that reopens the banner (inc/footer/custom-footer.php),
   styled like the other links of .footer-legal-list (footer.css) */
button.doit-cookie-settings {
	display: inline;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none !important;
	background-color: transparent !important;
	color: var(--doit-text, #E5E5E5) !important;
	box-shadow: none !important;
	transform: none !important;
	font-family: inherit;
	font-size: var(--font-size-sm, 0.85rem);
	font-weight: inherit;
	line-height: inherit;
	text-align: left;
	cursor: pointer;
	transition: color 0.3s ease;
}

button.doit-cookie-settings:hover,
button.doit-cookie-settings:focus-visible {
	color: #ffffff !important;
	text-decoration: underline;
}
