/*
 * Unimm-LGPD: consent modal, floating button, preferences link and the
 * "facade" boxes that stand in for third-party players.
 *
 * Every selector starts with .unimm-lgpd, .unimm-lgpd-embed, .unimm-lgpd-flutuante,
 * .unimm-lgpd-link or html.unimm-lgpd-*, so nothing leaks into the theme.
 * Dark mode follows the theme: <html data-theme="dark"> (unimm-theme/theme-toggle.css).
 */

/* ---------- Tokens ---------- */

.unimm-lgpd,
.unimm-lgpd-embed,
.unimm-lgpd-flutuante,
.unimm-lgpd-link {
	--ul-primaria: #3f4b64;
	--ul-destaque: #f15b2a;
	--ul-ligado: #2fa4a9;
	--ul-superficie: #f4f6f8;
	--ul-fundo: #fff;
	--ul-texto: #1a1a1a;
	--ul-texto-suave: #555;
	--ul-linha: #eef1f4;
	--ul-trilho: #cfd6df;
	--ul-travado: #6b7a93;
	--ul-fonte: 'Poppins', sans-serif;
}

html[data-theme="dark"] .unimm-lgpd,
html[data-theme="dark"] .unimm-lgpd-embed,
html[data-theme="dark"] .unimm-lgpd-flutuante,
html[data-theme="dark"] .unimm-lgpd-link {
	--ul-fundo: #191e28;
	--ul-texto: #ddd;
	--ul-texto-suave: #b8c7d7;
	--ul-superficie: #232a38;
	--ul-linha: #2f3748;
	--ul-trilho: #4a5468;
	--ul-travado: #8fa1bb;
}

/* ---------- Page state (set on <html> by cabecalho.js) ---------- */

/* Locked page: no scrolling behind the modal. */
html.unimm-lgpd-trava,
html.unimm-lgpd-trava body {
	overflow: hidden;
}

/* ---------- Modal root ---------- */

/* Hidden until cabecalho.js finds no valid consent cookie. */
.unimm-lgpd {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100000;
	box-sizing: border-box;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: var(--ul-fonte);
	font-size: 16px;
	line-height: 1.5;
	color: var(--ul-texto);
}

html.unimm-lgpd-pendente .unimm-lgpd {
	display: flex;
}

/* Locked page: dimmed and blurred background over everything. */
html.unimm-lgpd-trava .unimm-lgpd {
	background: rgba(25, 30, 40, 0.55);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

/* Policy page: a card in the bottom-right corner, no backdrop, page stays usable. */
.unimm-lgpd[data-modo="canto"] {
	inset: auto 16px 16px auto;
	width: min(440px, calc(100vw - 32px));
	padding: 0;
	background: none;
}

.unimm-lgpd *,
.unimm-lgpd *::before,
.unimm-lgpd *::after {
	box-sizing: border-box;
}

.unimm-lgpd [hidden] {
	display: none !important;
}

.unimm-lgpd__cartao {
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	padding: 22px 24px;
	border-radius: 14px;
	background: var(--ul-fundo);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.unimm-lgpd[data-modo="canto"] .unimm-lgpd__cartao {
	max-width: none;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .unimm-lgpd__cartao {
	border: 1px solid #2f3748;
}

/* ---------- Screens ---------- */

.unimm-lgpd__cabeca {
	display: flex;
	align-items: center;
	gap: 10px;
}

.unimm-lgpd .unimm-lgpd__titulo {
	margin: 0;
	padding: 0;
	font: 600 18px/1.3 var(--ul-fonte);
	letter-spacing: 0;
	text-transform: none;
	color: var(--ul-texto);
}

.unimm-lgpd .unimm-lgpd__texto {
	margin: 10px 0 0;
	font: 400 13.5px/1.65 var(--ul-fonte);
	color: var(--ul-texto-suave);
}

.unimm-lgpd .unimm-lgpd__voltar {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: var(--ul-superficie);
	color: var(--ul-primaria);
	font: 400 16px/1 var(--ul-fonte);
	cursor: pointer;
}

html[data-theme="dark"] .unimm-lgpd .unimm-lgpd__voltar {
	color: var(--ul-texto);
}

/* ---------- First screen: two-column strip of small toggles ---------- */

.unimm-lgpd__faixa {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px 20px;
	margin: 14px 0 0;
	padding: 12px 14px;
	border-radius: 10px;
	background: var(--ul-superficie);
}

.unimm-lgpd .unimm-lgpd__rapido {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font: 500 13px/1.3 var(--ul-fonte);
	color: var(--ul-primaria);
	cursor: pointer;
	user-select: none;
}

html[data-theme="dark"] .unimm-lgpd .unimm-lgpd__rapido {
	color: var(--ul-texto);
}

.unimm-lgpd .unimm-lgpd__rapido--travado {
	color: var(--ul-travado);
	cursor: default;
}

/* ---------- Toggle: hidden checkbox over a drawn track ---------- */

.unimm-lgpd__chave {
	position: relative;
	flex: none;
	display: inline-block;
	width: 36px;
	height: 20px;
}

.unimm-lgpd__chave input {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.unimm-lgpd__chave input:disabled {
	cursor: default;
}

.unimm-lgpd__trilho {
	position: absolute;
	inset: 0;
	border-radius: 24px;
	background: var(--ul-trilho);
	transition: background-color 0.2s;
}

.unimm-lgpd__trilho::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.2s;
}

.unimm-lgpd__chave input:checked + .unimm-lgpd__trilho {
	background: var(--ul-ligado);
}

.unimm-lgpd__chave input:checked + .unimm-lgpd__trilho::before {
	transform: translateX(16px);
}

.unimm-lgpd__chave input:disabled + .unimm-lgpd__trilho {
	opacity: 0.55;
}

.unimm-lgpd__chave input:focus-visible + .unimm-lgpd__trilho {
	outline: 2px solid var(--ul-destaque);
	outline-offset: 2px;
}

/* Larger toggle on the preferences screen. */
.unimm-lgpd__chave-grande {
	flex: none;
	margin: 2px 0 0;
}

.unimm-lgpd__chave-grande .unimm-lgpd__chave {
	width: 44px;
	height: 24px;
}

.unimm-lgpd__chave-grande .unimm-lgpd__trilho::before {
	width: 18px;
	height: 18px;
}

.unimm-lgpd__chave-grande input:checked + .unimm-lgpd__trilho::before {
	transform: translateX(20px);
}

/* ---------- Buttons ---------- */

.unimm-lgpd__botoes {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 14px 0 0;
}

.unimm-lgpd .unimm-lgpd-btn {
	flex: 1 1 120px;
	min-height: 44px;
	margin: 0;
	padding: 10px 12px;
	border: 2px solid var(--ul-primaria);
	border-radius: 8px;
	font: 600 13.5px/1.3 var(--ul-fonte);
	letter-spacing: 0;
	text-transform: none;
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
	transition: filter 0.15s;
}

.unimm-lgpd .unimm-lgpd-btn:hover {
	filter: brightness(1.12);
}

.unimm-lgpd .unimm-lgpd-btn:focus-visible {
	outline: 3px solid var(--ul-destaque);
	outline-offset: 2px;
}

/* Recusar tudo and Aceitar tudo share this class on purpose: same weight. */
.unimm-lgpd .unimm-lgpd-btn--cheio {
	background: var(--ul-primaria);
	color: #fff;
}

.unimm-lgpd .unimm-lgpd-btn--contorno {
	background: var(--ul-fundo);
	color: var(--ul-primaria);
}

html[data-theme="dark"] .unimm-lgpd .unimm-lgpd-btn--cheio {
	border-color: #5a6a8c;
}

html[data-theme="dark"] .unimm-lgpd .unimm-lgpd-btn--contorno {
	border-color: var(--ul-texto-suave);
	background: transparent;
	color: var(--ul-texto);
}

/* First screen: 2x2. Top row outline, bottom row solid. */
.unimm-lgpd__botoes--quatro {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

/* ---------- Preferences screen ---------- */

.unimm-lgpd__lista {
	max-height: min(480px, calc(100vh - 190px));
	max-height: min(480px, calc(100dvh - 190px));
	margin: 6px 0 0;
	overflow-y: auto;
}

.unimm-lgpd__categoria {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 14px 0;
	border-bottom: 1px solid var(--ul-linha);
}

.unimm-lgpd__categoria:last-child {
	border-bottom: 0;
}

.unimm-lgpd__categoria-texto {
	flex: 1;
	min-width: 0;
}

.unimm-lgpd .unimm-lgpd__categoria-titulo {
	margin: 0 0 4px;
	padding: 0;
	font: 600 14.5px/1.4 var(--ul-fonte);
	letter-spacing: 0;
	text-transform: none;
	color: var(--ul-texto);
}

.unimm-lgpd .unimm-lgpd__categoria-texto p {
	margin: 0;
	font: 400 12.5px/1.55 var(--ul-fonte);
	color: var(--ul-texto-suave);
}

.unimm-lgpd .unimm-lgpd__sempre {
	flex: none;
	margin-top: 3px;
	font: 600 11.5px/1.3 var(--ul-fonte);
	white-space: nowrap;
	color: var(--ul-ligado);
}

/* ---------- Small phones: buttons in one column ---------- */

@media (max-width: 380px) {
	.unimm-lgpd {
		padding: 10px;
	}

	.unimm-lgpd__cartao {
		padding: 18px 16px;
	}

	.unimm-lgpd__botoes--quatro {
		grid-template-columns: 1fr;
	}

	.unimm-lgpd__botoes {
		flex-direction: column;
	}

	.unimm-lgpd .unimm-lgpd-btn {
		flex: none;
		width: 100%;
	}

	.unimm-lgpd__faixa {
		gap: 10px 12px;
		padding: 12px;
	}
}

/* ---------- Floating "preferences" button ---------- */

/* Sits above the theme's dark-mode toggle (fixed, bottom-left) on wide screens. */
.unimm-lgpd-flutuante {
	position: fixed;
	left: 13px;
	bottom: 72px;
	z-index: 9990;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ul-primaria);
	color: #fff;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

.unimm-lgpd-flutuante[hidden] {
	display: none;
}

.unimm-lgpd-flutuante:hover {
	filter: brightness(1.12);
}

.unimm-lgpd-flutuante:focus-visible {
	outline: 3px solid var(--ul-destaque);
	outline-offset: 2px;
}

html[data-theme="dark"] .unimm-lgpd-flutuante {
	border: 1px solid #5a6a8c;
}

/* The theme moves its toggle to the top at this width. */
@media (max-width: 1024px) {
	.unimm-lgpd-flutuante {
		bottom: 16px;
	}
}

/* ---------- [preferencias_cookies] link ---------- */

.unimm-lgpd-link {
	color: var(--ul-destaque);
	text-decoration: underline;
	cursor: pointer;
}

.unimm-lgpd-link:hover,
.unimm-lgpd-link:focus-visible {
	text-decoration: none;
}

/* ---------- Facade boxes (third-party players) ---------- */

.unimm-lgpd-embed {
	position: relative;
	box-sizing: border-box;
	max-width: 100%;
	margin: 0 0 20px;
	font-family: var(--ul-fonte);
	color: var(--ul-texto);
}

.unimm-lgpd-embed *,
.unimm-lgpd-embed *::before,
.unimm-lgpd-embed *::after {
	box-sizing: border-box;
}

.unimm-lgpd-embed .unimm-lgpd-embed__ativar {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	box-shadow: none;
	cursor: pointer;
}

.unimm-lgpd-embed .unimm-lgpd-embed__ativar:focus-visible {
	outline: 3px solid var(--ul-destaque);
	outline-offset: 2px;
}

.unimm-lgpd-embed .unimm-lgpd-embed__capa {
	display: block;
	max-width: none;
	object-fit: cover;
}

.unimm-lgpd-embed .unimm-lgpd-embed__aviso {
	margin: 0;
	font: 400 11.5px/1.45 var(--ul-fonte);
}

/* The "Ouvir" / "Carregar conteúdo" pill, shared by Spotify and the neutral box. */
.unimm-lgpd-embed .unimm-lgpd-embed__ouvir {
	display: inline-block;
	justify-self: start;
	padding: 7px 16px;
	border-radius: 999px;
	background: var(--ul-destaque);
	color: #fff;
	font: 600 13px/1.3 var(--ul-fonte);
}

/* YouTube: 16:9 box, cover behind, centered play, notice strip at the bottom. */
.unimm-lgpd-embed--youtube {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 10px;
	background: linear-gradient(135deg, #3f4b64 0%, #191e28 70%);
	color: #fff;
}

.unimm-lgpd-embed--youtube .unimm-lgpd-embed__ativar {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}

/* Darkens the top so the title reads over any cover. */
.unimm-lgpd-embed--youtube .unimm-lgpd-embed__ativar::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 45%);
}

.unimm-lgpd-embed--youtube .unimm-lgpd-embed__capa {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.unimm-lgpd-embed--youtube .unimm-lgpd-embed__titulo {
	position: absolute;
	top: 14px;
	left: 16px;
	right: 16px;
	font: 600 15px/1.35 var(--ul-fonte);
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.unimm-lgpd-embed--youtube .unimm-lgpd-embed__play {
	position: absolute;
	top: 46%;
	left: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 48px;
	border-radius: 14px;
	background: var(--ul-destaque);
	color: #fff;
	font-size: 22px;
	transform: translate(-50%, -50%);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.unimm-lgpd-embed--youtube .unimm-lgpd-embed__aviso {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	padding: 10px 16px;
	background: rgba(0, 0, 0, 0.6);
	color: #e8edf3;
}

.unimm-lgpd-embed--youtube .unimm-lgpd-embed__aviso a {
	color: #fff;
	text-decoration: underline;
}

/* Inside a core responsive embed the wrapper already reserves the 16:9 space. */
.wp-has-aspect-ratio .wp-block-embed__wrapper > .unimm-lgpd-embed {
	position: absolute;
	inset: 0;
	height: 100%;
	margin: 0;
	aspect-ratio: auto;
}

.wp-has-aspect-ratio .wp-block-embed__wrapper > .unimm-lgpd-embed--spotify,
.wp-has-aspect-ratio .wp-block-embed__wrapper > .unimm-lgpd-embed--outro {
	overflow: auto;
}

/* Spotify: cover and text side by side, notice underneath. */
.unimm-lgpd-embed--spotify,
.unimm-lgpd-embed--outro {
	padding: 14px;
	border: 1px solid #e3e8ee;
	border-radius: 12px;
	background: var(--ul-superficie);
}

html[data-theme="dark"] .unimm-lgpd-embed--spotify,
html[data-theme="dark"] .unimm-lgpd-embed--outro {
	border-color: var(--ul-linha);
}

.unimm-lgpd-embed--spotify .unimm-lgpd-embed__ativar {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	width: 100%;
}

.unimm-lgpd-embed--spotify .unimm-lgpd-embed__capa {
	grid-column: 1;
	grid-row: 1 / span 3;
	width: 92px;
	height: 92px;
	margin-right: 14px;
	border-radius: 8px;
}

.unimm-lgpd-embed--spotify .unimm-lgpd-embed__titulo,
.unimm-lgpd-embed--spotify .unimm-lgpd-embed__tipo,
.unimm-lgpd-embed--spotify .unimm-lgpd-embed__ouvir {
	grid-column: 2;
}

.unimm-lgpd-embed--spotify .unimm-lgpd-embed__titulo {
	font: 600 14.5px/1.35 var(--ul-fonte);
}

.unimm-lgpd-embed--spotify .unimm-lgpd-embed__tipo {
	margin: 2px 0 8px;
	font: 400 12px/1.4 var(--ul-fonte);
	color: var(--ul-texto-suave);
}

.unimm-lgpd-embed--spotify .unimm-lgpd-embed__aviso,
.unimm-lgpd-embed--outro .unimm-lgpd-embed__aviso {
	margin-top: 10px;
	font-size: 11px;
	color: var(--ul-texto-suave);
}

.unimm-lgpd-embed--spotify .unimm-lgpd-embed__aviso a,
.unimm-lgpd-embed--outro .unimm-lgpd-embed__aviso a {
	color: var(--ul-destaque);
}

/* Neutral box: no cover, just the pill and the notice. */
.unimm-lgpd-embed--outro .unimm-lgpd-embed__ativar {
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	.unimm-lgpd__trilho,
	.unimm-lgpd__trilho::before,
	.unimm-lgpd .unimm-lgpd-btn {
		transition: none;
	}
}
