/*
 * Cookie banner and cookie policy (Complianz) in the site's fonts and palette.
 * Colours come from the theme presets, so the banner follows the corporate style (blue or burgundy) on its own.
 * Complianz declares its look as --cmplz_* variables on :root; they are redefined here on the banner itself.
 * Selectors start with "body" to outrank Complianz's own stylesheet, which loads later with equal specificity.
 */

/* ---------- Banner ---------- */

body .cmplz-cookiebanner {
	--cmplz_banner_width: 26rem;
	--cmplz_banner_background_color: var(--wp--preset--color--blanco);
	--cmplz_banner_border_color: var(--rc-borde);
	--cmplz_banner_border_width: 1px;
	--cmplz_banner_border_radius: var(--wp--custom--radio);
	--cmplz_banner_margin: 0.625rem;
	--cmplz_text_color: var(--wp--preset--color--texto);
	--cmplz_hyperlink_color: var(--wp--preset--color--marino-boton);
	--cmplz_title_font_size: 1.25rem;
	--cmplz_text_font_size: 0.9375rem;
	--cmplz_text_line_height: 1.6;
	--cmplz_link_font_size: 0.875rem;
	--cmplz_category_body_font_size: 0.875rem;
	--cmplz_category_header_title_font_size: 0.9375rem;
	--cmplz_category_header_active_font_size: 0.8125rem;
	--cmplz_category_header_always_active_color: var(--wp--preset--color--dorado-texto);
	--cmplz_button_font_size: 0.9375rem;
	--cmplz_button_border_radius: var(--wp--custom--radio);
	/* Accept and reject carry the same weight (AEPD guidance); settings is the secondary action. */
	--cmplz_button_accept_background_color: var(--wp--preset--color--marino-boton);
	--cmplz_button_accept_border_color: var(--wp--preset--color--marino-boton);
	--cmplz_button_accept_text_color: var(--wp--preset--color--blanco);
	--cmplz_button_deny_background_color: var(--wp--preset--color--marino-boton);
	--cmplz_button_deny_border_color: var(--wp--preset--color--marino-boton);
	--cmplz_button_deny_text_color: var(--wp--preset--color--blanco);
	--cmplz_button_settings_background_color: transparent;
	--cmplz_button_settings_border_color: var(--wp--preset--color--marino-boton);
	--cmplz_button_settings_text_color: var(--wp--preset--color--marino-boton);
	--cmplz_slider_active_color: var(--wp--preset--color--marino-boton);

	font-family: var(--wp--preset--font-family--sans);
	border-top: 3px solid var(--wp--preset--color--marino-boton);
	box-shadow: var(--wp--custom--sombra), 0 2px 8px rgba(0, 0, 0, 0.08) !important;
	padding: 1.25rem 1.5rem 1.125rem;
	max-width: calc(100vw - 2rem);
}

@media (min-width: 768px) {
	body .cmplz-cookiebanner.cmplz-bottom-left {
		left: 1.5rem;
		bottom: 1.5rem;
		min-width: 0;
		width: var(--cmplz_banner_width);
	}

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

@media (max-width: 767px) {
	body .cmplz-cookiebanner {
		max-width: 100vw;
		border-radius: 0;
		border-width: 3px 0 0;
		padding: 1rem 1.25rem;
	}
}

body .cmplz-cookiebanner .cmplz-header {
	grid-template-columns: 1fr auto;
}

body .cmplz-cookiebanner .cmplz-logo {
	display: none;
}

body .cmplz-cookiebanner .cmplz-title {
	grid-column-start: 1;
	justify-self: start;
	font-family: var(--wp--preset--font-family--serif);
	font-weight: 600;
	color: var(--wp--preset--color--marino);
}

/* The title says what the dialog is about: keep it on small screens too. */
@media (max-width: 425px) {
	body .cmplz-cookiebanner .cmplz-header .cmplz-title {
		display: block;
	}
}

body .cmplz-cookiebanner .cmplz-close {
	grid-column-start: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: -0.625rem -0.75rem -0.625rem 0;
	border-radius: var(--wp--custom--radio);
	color: var(--wp--preset--color--texto);
}

body .cmplz-cookiebanner .cmplz-close:hover {
	font-size: 20px;
	color: var(--wp--preset--color--marino-boton);
}

body .cmplz-cookiebanner .cmplz-divider-header {
	display: none;
}

body .cmplz-cookiebanner .cmplz-body {
	min-width: 0;
}

body .cmplz-cookiebanner .cmplz-categories .cmplz-category {
	background-color: var(--wp--preset--color--crema);
	border: 1px solid var(--rc-borde);
	border-radius: var(--wp--custom--radio);
}

body .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-category-title {
	font-weight: 700;
	color: var(--wp--preset--color--marino);
}

body .cmplz-cookiebanner .cmplz-buttons {
	flex-wrap: wrap;
	margin-top: 0.25rem;
}

body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
	flex: 1 1 0;
	min-height: 2.75rem;
	padding: 0.625rem 1rem;
	font-family: var(--wp--preset--font-family--sans);
	font-weight: 700;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences,
body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences {
	flex-basis: 100%;
}

body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept:hover,
body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny:hover {
	background-color: var(--wp--preset--color--marino);
	border-color: var(--wp--preset--color--marino);
}

body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences:hover,
body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences:hover {
	background-color: var(--wp--preset--color--marino-boton);
	color: var(--wp--preset--color--blanco);
}

@media (max-width: 767px) {
	body .cmplz-cookiebanner .cmplz-buttons {
		flex-direction: row;
	}
}

body .cmplz-cookiebanner .cmplz-linksbody #cmplz-documents ul {
	flex-wrap: wrap;
	column-gap: 1rem;
	row-gap: 0.25rem;
	justify-content: flex-start;
}

body .cmplz-cookiebanner .cmplz-links .cmplz-link {
	text-underline-offset: 0.2em;
}

body .cmplz-cookiebanner .cmplz-links .cmplz-link:hover {
	color: var(--wp--preset--color--marino);
}

body .cmplz-cookiebanner :is(.cmplz-btn, .cmplz-close, .cmplz-link, .cmplz-category-toggle):focus-visible {
	outline: 2px solid var(--wp--preset--color--dorado-texto);
	outline-offset: 2px;
}

/* «Gestionar cookies» lives in the footer: no floating tab over the page. */
#cmplz-manage-consent {
	display: none;
}

/* ---------- Cookie policy (/politica-de-cookies/) ---------- */

/*
 * Complianz's own document stylesheet is off (config/03-cookies.php, use_document_css), so the policy already uses the
 * site's body text; these rules give it the measure, headings and details of a legal document.
 * Scoped to body #cmplz-document: Complianz also puts that class on <body> of the policy page.
 */
body #cmplz-document {
	max-width: 46rem;
	color: var(--wp--preset--color--texto);
}

body #cmplz-document > p:first-child {
	padding: 0.875rem 1.125rem;
	background: var(--wp--preset--color--crema-oscuro);
	border-left: 3px solid var(--wp--preset--color--dorado);
	border-radius: 0 var(--wp--custom--radio) var(--wp--custom--radio) 0;
	font-size: 0.9375rem;
}

body #cmplz-document h2 {
	margin: 2.75rem 0 1rem;
	font-size: clamp(1.5rem, 1.3rem + 0.6vw, 1.875rem);
	line-height: 1.25;
}

body #cmplz-document h3 {
	margin: 2rem 0 0.75rem;
	font-size: 1.25rem;
	line-height: 1.3;
}

body #cmplz-document h4,
body #cmplz-document h5 {
	margin: 0;
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--marino);
}

body #cmplz-document p,
body #cmplz-document li {
	line-height: 1.7;
}

body #cmplz-document ul {
	padding-left: 1.25rem;
}

body #cmplz-document li + li {
	margin-top: 0.375rem;
}

body #cmplz-document a {
	color: var(--wp--preset--color--marino-boton);
	text-underline-offset: 0.2em;
}

/* «Cookies usadas»: one panel per service, each cookie as label / value rows. */
body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy {
	margin: 1rem 0;
	background: var(--wp--preset--color--blanco);
	border: 1px solid var(--rc-borde);
	border-radius: var(--wp--custom--radio);
	box-shadow: var(--wp--custom--sombra);
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > summary {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem 1.25rem;
	cursor: pointer;
	list-style: none;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > summary::-webkit-details-marker {
	display: none;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > summary::after {
	content: "";
	flex: none;
	width: 0.6rem;
	height: 0.6rem;
	margin-left: auto;
	border-right: 2px solid var(--wp--preset--color--marino-boton);
	border-bottom: 2px solid var(--wp--preset--color--marino-boton);
	transform: rotate(45deg) translateY(-2px);
	transition: transform 0.2s ease;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy[open] > summary::after {
	transform: rotate(-135deg) translateY(-2px);
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > summary:focus-visible {
	outline: 2px solid var(--wp--preset--color--dorado-texto);
	outline-offset: 2px;
	border-radius: var(--wp--custom--radio);
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > summary > div {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 1rem;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > summary h3 {
	margin: 0;
	font-size: 1.125rem;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > summary p {
	margin: 0;
	font-size: 0.875rem;
	color: var(--wp--preset--color--dorado-texto);
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > div {
	padding: 0 1.25rem 1rem;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > div h4 {
	margin-top: 0.75rem;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > div p {
	margin: 0.25rem 0 0;
	font-size: 0.9375rem;
}

body #cmplz-document details.cmplz-dropdown.cmplz-dropdown-cookiepolicy > div p:empty {
	display: none;
}

/* The cookie table keeps Complianz's own grid (document-grid.min.css: a table from 600 px, label / value pairs below);
   only its look changes here. */
body #cmplz-document .cmplz-dropdown.cmplz-dropdown-cookiepolicy .cookies-per-purpose {
	margin-top: 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.55;
}

body #cmplz-document .cmplz-dropdown.cmplz-dropdown-cookiepolicy .cookies-per-purpose > div {
	padding-block: 0.375rem;
}

body #cmplz-document .cmplz-dropdown.cmplz-dropdown-cookiepolicy .cookies-per-purpose :is(.name-header, .retention-header, .function-header) h5 {
	line-height: 1.9;
	color: var(--wp--preset--color--texto);
	letter-spacing: 0.08em;
}

body #cmplz-document .cmplz-dropdown.cmplz-dropdown-cookiepolicy .cookies-per-purpose .name {
	font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
	font-size: 0.875rem;
	color: var(--wp--preset--color--marino);
	overflow-wrap: anywhere;
}

/* Consent per service is off: its checkbox and label have nothing to do in the policy. */
body #cmplz-document .cmplz_consent_per_service_label,
body #cmplz-document .cmplz-accept-service {
	display: none;
}

/* «Gestiona tus ajustes de consentimiento»: the same category rows as the banner. */
body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category {
	margin: 0.75rem 0;
	background: var(--wp--preset--color--crema);
	border: 1px solid var(--rc-borde);
	border-radius: var(--wp--custom--radio);
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-category-title {
	margin-right: auto;
	font-weight: 700;
	color: var(--wp--preset--color--marino);
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-always-active {
	font-size: 0.8125rem;
	font-weight: 700;
	/* Not dorado-texto: on the category background it falls under 4.5:1 (tests/accesibilidad.mjs). */
	color: var(--wp--preset--color--marino-boton);
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-always-active .cmplz-banner-checkbox,
body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories input[data-category="cmplz_functional"] {
	display: none;
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-category-toggle {
	display: flex;
	padding: 0.25rem;
	background: none;
	border: 0;
	border-radius: var(--wp--custom--radio);
	color: var(--wp--preset--color--marino-boton);
	cursor: pointer;
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-category-toggle[aria-expanded="true"] .cmplz-icon {
	transform: rotate(180deg);
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-category-toggle:focus-visible {
	outline: 2px solid var(--wp--preset--color--dorado-texto);
	outline-offset: 2px;
}

body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories .cmplz-category .cmplz-description {
	padding: 0 1rem 0.875rem;
	font-size: 0.9375rem;
}

/* Categories the site does not use stay hidden, as in the banner. */
body #cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories :is(.cmplz-preferences, .cmplz-statistics, .cmplz-marketing),
body #cmplz-document .cmplz-hidden,
body #cmplz-document .cmplz-description-statistics-anonymous {
	display: none;
}

/* «Uso» and «Compartir datos» side by side from 600 px, as Complianz lays them out; the table gets room between columns. */
body #cmplz-document .cmplz-dropdown.cmplz-dropdown-cookiepolicy > div.cmplz-service-description,
body #cmplz-document .cmplz-dropdown.cmplz-dropdown-cookiepolicy > div.cmplz-sharing-data {
	box-sizing: border-box;
}

body #cmplz-document .cmplz-dropdown.cmplz-dropdown-cookiepolicy .cookies-per-purpose {
	column-gap: 1.5rem;
}
