/*
 * Sobrio Consent — riquadro in angolo.
 * Personalizzazione dal tema, senza toccare il plugin, ad esempio:
 * .sobrio-consent { --sobrio-font: var(--wp--preset--font-family--lato); --sobrio-accent: #444; }
 */

.sobrio-consent {
	--sobrio-bg: #fff;
	--sobrio-text: #2b2b2b;
	--sobrio-muted: #6b6b6b;
	--sobrio-border: #dcdcdc;
	--sobrio-accent: #2b2b2b;
	--sobrio-accent-text: #fff;
	--sobrio-font: inherit;
	--sobrio-size: 13px;
	--sobrio-radius: 0;
	--sobrio-width: 340px;
	--sobrio-offset: 20px;

	position: fixed;
	bottom: var(--sobrio-offset);
	left: var(--sobrio-offset);
	z-index: 99999;
	box-sizing: border-box;
	width: min(var(--sobrio-width), calc(100vw - 2 * var(--sobrio-offset)));
	max-height: calc(100vh - 2 * var(--sobrio-offset));
	overflow: auto;
	padding: 20px 20px 18px;
	background: var(--sobrio-bg);
	color: var(--sobrio-text);
	border: 1px solid var(--sobrio-border);
	border-radius: var(--sobrio-radius);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
	font-family: var(--sobrio-font);
	font-size: var(--sobrio-size);
	line-height: 1.55;
}

.sobrio-consent[hidden],
.sobrio-consent [hidden] {
	display: none !important;
}

.sobrio-consent--bottom-right {
	left: auto;
	right: var(--sobrio-offset);
}

.sobrio-consent *,
.sobrio-consent *::before,
.sobrio-consent *::after {
	box-sizing: border-box;
}

.sobrio-consent p {
	margin: 0;
}

.sobrio-consent__title {
	margin: 0 24px 8px 0 !important;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.sobrio-consent__text {
	color: var(--sobrio-text);
}

.sobrio-consent__policy {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.sobrio-consent__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--sobrio-muted);
	font: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.sobrio-consent__close:hover,
.sobrio-consent__close:focus-visible {
	color: var(--sobrio-text);
}

/* Preferenze */
.sobrio-consent__prefs {
	margin-top: 14px;
	padding-top: 6px;
	border-top: 1px solid var(--sobrio-border);
}

.sobrio-consent__cat {
	padding: 10px 0;
	border-bottom: 1px solid var(--sobrio-border);
}

.sobrio-consent__cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	cursor: pointer;
}

.sobrio-consent__cat-title {
	font-weight: 700;
}

.sobrio-consent__always {
	color: var(--sobrio-muted);
	font-size: 11px;
}

.sobrio-consent__cat-desc {
	margin-top: 4px !important;
	color: var(--sobrio-muted);
	font-size: 12px;
}

/* Interruttore: checkbox nativa, quindi accessibile da tastiera e lettori di schermo */
.sobrio-consent__toggle {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	flex: none;
	width: 30px;
	height: 16px;
	margin: 0;
	border: 1px solid var(--sobrio-muted);
	border-radius: 16px;
	background: var(--sobrio-bg);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.sobrio-consent__toggle::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--sobrio-muted);
	transition: transform 0.15s ease, background 0.15s ease;
}

.sobrio-consent__toggle:checked {
	border-color: var(--sobrio-accent);
	background: var(--sobrio-accent);
}

.sobrio-consent__toggle:checked::after {
	background: var(--sobrio-accent-text);
	transform: translateX(14px);
}

.sobrio-consent__toggle:focus-visible,
.sobrio-consent__button:focus-visible,
.sobrio-consent__close:focus-visible {
	outline: 2px solid var(--sobrio-accent);
	outline-offset: 2px;
}

/* Pulsanti: stesso peso visivo per accettare e rifiutare */
.sobrio-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.sobrio-consent__button {
	flex: 1 1 auto;
	min-height: 36px;
	padding: 8px 12px;
	border: 1px solid var(--sobrio-accent);
	border-radius: var(--sobrio-radius);
	background: transparent;
	color: var(--sobrio-accent);
	font: inherit;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.sobrio-consent__button:hover {
	background: var(--sobrio-accent);
	color: var(--sobrio-accent-text);
}

@media (max-width: 480px) {
	.sobrio-consent {
		--sobrio-offset: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sobrio-consent__toggle,
	.sobrio-consent__toggle::after,
	.sobrio-consent__button {
		transition: none;
	}
}

/* Video bloccati in attesa del consenso */
iframe[data-sobrio-src] {
	display: none;
}

.sobrio-embed-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	box-sizing: border-box;
	width: 100%;
	aspect-ratio: 16 / 9;
	padding: 24px;
	background: #f1f1f1;
	color: #3a3a3a;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
}

.sobrio-embed-placeholder p {
	max-width: 36em;
	margin: 0;
}

/* Nei blocchi "Incorpora" con proporzioni fisse il segnaposto occupa lo spazio del video */
.wp-has-aspect-ratio .wp-block-embed__wrapper > .sobrio-embed-placeholder {
	position: absolute;
	inset: 0;
	aspect-ratio: auto;
}

.sobrio-embed-placeholder__button {
	padding: 8px 16px;
	border: 1px solid currentColor;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
}

.sobrio-embed-placeholder__button:hover,
.sobrio-embed-placeholder__button:focus-visible {
	background: #3a3a3a;
	color: #fff;
}

/* Tabella della cookie policy */
.sobrio-cookie-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875em;
}

.sobrio-cookie-table th,
.sobrio-cookie-table td {
	padding: 8px 10px;
	border-bottom: 1px solid #e2e2e2;
	text-align: left;
	vertical-align: top;
}
