/**
 * Consentum – Dialog und Platzhalter.
 * Farben kommen als CSS-Variablen aus der Style-Variation des Themes.
 *
 * Copyright (c) 2026 Smart Artist / Benjamin Hartwich
 * License: GPL-2.0-or-later
 */

.cst {
	/* Feste px statt rem: Themes mit html{font-size:62.5%} verkleinern sonst alles. */
	--cst-abstand: clamp(20px, 3.5vw, 32px);
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgb(0 0 0 / 0.45);
	font: inherit;
	font-size: 16px;
	line-height: 1.55;
}

.cst[hidden] {
	display: none;
}

.cst--box-unten {
	align-items: flex-end;
	background: none;
	pointer-events: none;
}

.cst--leiste {
	inset: auto 0 0;
	padding: 0;
	background: none;
}

.cst__box {
	box-sizing: border-box;
	min-width: 0;
	width: min(100%, 600px);
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow: auto;
	padding: var(--cst-abstand);
	background: var(--cst-bg);
	color: var(--cst-text);
	border-radius: 12px;
	box-shadow: 0 12px 48px rgb(0 0 0 / 0.25);
	pointer-events: auto;
	outline: none;
}

.cst--leiste .cst__box {
	width: 100%;
	max-height: 70vh;
	border-radius: 0;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0 var(--cst-abstand);
	align-items: center;
}

.cst--leiste .cst__logo,
.cst--leiste .cst__titel {
	grid-column: 1 / -1;
}

.cst--leiste.cst--details .cst__box {
	display: block;
}

.cst__logo {
	display: block;
	width: auto;
	max-width: 160px;
	height: 40px;
	object-fit: contain;
	margin-bottom: 16px;
}

.cst__titel {
	margin: 0 0 8px;
	font-size: 22px;
	line-height: 1.3;
	font-weight: 600;
}

.cst__text p {
	margin: 0 0 12px;
}

.cst a {
	color: inherit;
	text-decoration-color: var(--cst-akzent);
	text-underline-offset: 0.15em;
}

.cst__knoepfe {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

/* Alle Knöpfe gleich gewichtet: keine Wahl wird optisch bevorzugt. */
.cst__knopf {
	flex: 1 1 160px;
	min-height: 48px;
	padding: 12px 20px;
	border: 2px solid var(--cst-akzent);
	border-radius: 6px;
	background: var(--cst-akzent);
	color: var(--cst-akzent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.cst__knopf:hover,
.cst__knopf:focus-visible {
	filter: brightness(0.92);
}

.cst__knopf:focus-visible,
.cst input:focus-visible,
.cst summary:focus-visible {
	outline: 3px solid var(--cst-akzent);
	outline-offset: 2px;
}

.cst__knopf[hidden] {
	display: none;
}

.cst__links {
	margin: 12px 0 0;
	font-size: 0.85em;
}

.cst__details {
	margin-top: 16px;
}

.cst__gruppe {
	margin: 0 0 12px;
	padding: 12px 16px;
	border: 1px solid color-mix(in srgb, var(--cst-text) 20%, transparent);
	border-radius: 6px;
}

.cst__gruppe legend {
	padding: 0 4px;
	font-weight: 600;
}

.cst__gruppe p,
.cst__gruppe dl {
	margin: 4px 0;
	font-size: 0.9em;
}

.cst__gruppe ul {
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

.cst__gruppe li {
	padding: 8px 0;
	border-top: 1px solid color-mix(in srgb, var(--cst-text) 12%, transparent);
}

.cst__gruppe dt {
	float: left;
	clear: left;
	width: 104px;
	opacity: 0.75;
}

.cst__gruppe dd {
	margin-left: 104px;
}

/* Formular-Stile von Themes (Rahmen, Linien unter legend) im Dialog zurücksetzen. */
.cst fieldset {
	min-width: 0;
	margin: 0;
	background: none;
	box-shadow: none;
}

.cst legend {
	width: auto;
	margin: 0;
	border: 0;
	font-family: inherit;
	line-height: inherit;
	color: inherit;
}

.cst input[type="checkbox"]::before,
.cst input[type="checkbox"]::after {
	/* OceanWP & Co. malen das Häkchen per ::before – im Dialog gilt nur das echte Feld. */
	content: none !important;
	display: none !important;
}

.cst input[type="checkbox"] {
	/* Themes zeichnen Häkchen oft selbst (appearance:none + ::before). Hier das echte Feld. */
	-webkit-appearance: auto !important;
	appearance: auto !important;
	background: none;
	box-shadow: none;
	width: 18px;
	height: 18px;
	accent-color: var(--cst-akzent);
	vertical-align: -0.15em;
}

.cst summary {
	cursor: pointer;
	font-size: 0.9em;
}

/* Platzhalter für gesperrte Inhalte */
.cst-cb {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 192px;
	padding: 24px;
	background: color-mix(in srgb, currentColor 6%, transparent);
	border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
	border-radius: 6px;
	text-align: center;
}

.cst-cb__ph {
	max-width: 512px;
	font-size: 15px;
}

.cst-cb__ph p {
	margin: 0 0 12px;
}

.cst-cb__titel {
	font-weight: 600;
}

.cst-cb__knoepfe {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.cst-cb .cst__knopf {
	flex: 0 1 auto;
	--cst-akzent: var(--wp--preset--color--primary, #1f1f1f);
	--cst-akzent-text: var(--wp--preset--color--base, #fff);
}

.cst__knopf--leise {
	background: transparent;
	color: inherit;
}

.cst-oeffnen {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* Kleine Schaltflächen im Dialog: Kreuz oben, „Cookie-Details“ in der Fußzeile. */
.cst__zu {
	display: none;
	position: absolute;
	top: 14px;
	right: 14px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--cst-akzent);
	font: 400 28px/1 sans-serif;
	cursor: pointer;
}

.cst__linkknopf {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

/*
 * Layout „groß“: breiter Dialog, Titel mit Linie, links der Text, rechts die Gruppen
 * zum direkten Anhaken; Dienste-Liste erst über „Individuelle Einstellungen“.
 */
.cst--gross .cst__box {
	position: relative;
	width: min(100%, 960px);
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	column-gap: 40px;
	padding: 32px 30px 24px;
}

.cst--gross .cst__zu {
	display: block;
}

.cst--gross .cst__logo {
	grid-column: 1 / -1;
	justify-self: center;
}

.cst--gross .cst__titel {
	grid-column: 1 / -1;
	margin: 0 0 24px;
	padding: 0 40px 20px;
	border-bottom: 1px solid color-mix(in srgb, var(--cst-text) 35%, transparent);
	text-align: center;
	font-size: 26px;
}

.cst--gross .cst__text {
	grid-column: 1;
	font-size: 15px;
}

.cst--gross .cst__details,
.cst--gross .cst__details[hidden] {
	display: block;
	grid-column: 2;
	margin: 0;
}

.cst--gross .cst__gruppe {
	position: relative;
	margin: 0 0 14px;
	padding: 0 0 0 40px;
	border: 0;
}

.cst--gross .cst__gruppe legend {
	padding: 0;
	font-size: 17px;
}

.cst--gross .cst__gruppe legend input {
	position: absolute;
	left: 0;
	top: 50%;
	width: 22px;
	height: 22px;
	margin: -11px 0 0;
}

.cst--gross .cst__gruppe p {
	margin: 2px 0 0;
	font-size: 15px;
}

.cst--gross:not(.cst--details) .cst__gruppe details {
	display: none;
}

.cst--gross.cst--details .cst__text {
	display: none;
}

.cst--gross.cst--details .cst__details {
	grid-column: 1 / -1;
}

.cst--gross .cst__knoepfe {
	grid-column: 1 / -1;
	gap: 16px;
	margin-top: 28px;
}

.cst--gross .cst__knopf {
	flex: 1 1 100%;
	min-height: 56px;
	font-size: 17px;
}

.cst--gross .cst__knopf[data-cst="speichern"],
.cst--gross .cst__knopf[data-cst="speichern"][hidden] {
	display: block;
	order: 1;
	flex-basis: calc(50% - 8px);
}

.cst--gross .cst__knopf[data-cst="alle"] {
	order: 2;
	flex-basis: calc(50% - 8px);
}

.cst--gross .cst__knopf[data-cst="notwendig"] {
	order: 3;
}

.cst--gross .cst__knopf[data-cst="einstellungen"] {
	order: 4;
}

.cst--gross .cst__links {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
	gap: 8px 24px;
	margin: 28px 0 0;
	font-size: 15px;
}

.cst--gross .cst__links a {
	text-decoration: none;
}

@media (max-width: 720px) {
	.cst--gross .cst__box {
		grid-template-columns: minmax(0, 1fr);
		padding: 24px 18px 18px;
	}

	.cst--gross .cst__titel,
	.cst--klassisch .cst__titel {
		padding: 0 32px 14px;
		font-size: clamp(17px, 5vw, 20px);
		-webkit-hyphens: auto;
		hyphens: auto;
	}

	.cst--gross .cst__details,
	.cst--gross .cst__details[hidden] {
		grid-column: 1;
		margin-top: 16px;
	}

	.cst--gross .cst__knopf[data-cst="speichern"],
	.cst--gross .cst__knopf[data-cst="alle"] {
		flex-basis: 100%;
	}
}

/*
 * Layout „klassisch“: einspaltig, oben mittig, vier gleich große Knöpfe untereinander,
 * Gruppen als Häkchen in einer Zeile, graue Fußleiste. Details: breiter, Gruppen als Karten.
 */
.cst--klassisch {
	align-items: flex-start;
	padding: 16px;
	background: rgb(0 0 0 / 0.6);
}

.cst--klassisch .cst__box {
	position: relative;
	width: min(100%, 576px);
	padding: 24px 24px 0;
	border-radius: 4px;
	box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
	font-size: 14px;
}

.cst--klassisch.cst--details .cst__box {
	width: min(100%, 896px);
}

.cst--klassisch .cst__zu {
	display: block;
	top: 10px;
	right: 10px;
}

.cst--klassisch .cst__logo {
	margin: 0 auto 12px;
}

.cst--klassisch .cst__titel {
	margin: 0 0 16px;
	padding: 0 36px 16px;
	border-bottom: 1px solid color-mix(in srgb, var(--cst-text) 15%, transparent);
	text-align: center;
	font-size: 21px;
	font-weight: 700;
}

.cst--klassisch .cst__text {
	font-size: 13px;
}

.cst--klassisch .cst__details,
.cst--klassisch .cst__details[hidden] {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 16px;
	margin: 16px 0 0;
	padding: 12px 0;
	border-block: 1px solid color-mix(in srgb, var(--cst-text) 15%, transparent);
}

.cst--klassisch:not(.cst--details) .cst__gruppe {
	margin: 0;
	padding: 0;
	border: 0;
}

.cst--klassisch:not(.cst--details) .cst__gruppe > p,
.cst--klassisch:not(.cst--details) .cst__gruppe details {
	display: none;
}

.cst--klassisch.cst--details .cst__text {
	display: none;
}

.cst--klassisch.cst--details .cst__details {
	display: block;
	border: 0;
}

.cst--klassisch.cst--details .cst__gruppe {
	margin: 0 0 12px;
	padding: 14px 16px;
	border: 0;
	border-radius: 4px;
	background: color-mix(in srgb, var(--cst-text) 6%, var(--cst-bg));
}

.cst--klassisch .cst__gruppe legend {
	font-size: 15px;
	font-weight: 700;
}

.cst--klassisch .cst__knoepfe {
	gap: 8px;
	margin-top: 16px;
}

.cst--klassisch .cst__knopf {
	flex: 1 1 100%;
	min-height: 45px;
	padding: 10px 16px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 700;
}

.cst--klassisch .cst__knopf[data-cst="speichern"],
.cst--klassisch .cst__knopf[data-cst="speichern"][hidden] {
	display: block;
	order: 1;
}

.cst--klassisch .cst__knopf[data-cst="alle"] {
	order: 2;
}

.cst--klassisch .cst__knopf[data-cst="notwendig"] {
	order: 3;
}

.cst--klassisch .cst__knopf[data-cst="einstellungen"] {
	order: 4;
}

.cst--klassisch.cst--details .cst__knopf {
	flex: 1 1 calc(33% - 8px);
	min-height: 60px;
}

.cst--klassisch .cst__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
	gap: 6px 16px;
	margin: 24px -24px 0;
	padding: 12px 24px;
	background: color-mix(in srgb, var(--cst-text) 7%, var(--cst-bg));
	border-radius: 0 0 4px 4px;
	font-size: 12px;
}

.cst--klassisch .cst__links a {
	text-decoration: none;
}

.cst__uid {
	grid-column: 1 / -1;
	margin: 16px 0 0;
	font-size: 12px;
	opacity: 0.75;
	text-align: center;
	word-break: break-all;
}

/* Detailansicht: „Individuelle …“ ist dort überflüssig, zurück über „Cookie-Details“ oder das Kreuz. */
.cst--gross.cst--details .cst__knoepfe [data-cst="einstellungen"],
.cst--klassisch.cst--details .cst__knoepfe [data-cst="einstellungen"] {
	display: none;
}

/* Gruppenkarten: Überschrift in die Karte, nicht auf den Rand. */
.cst--klassisch.cst--details .cst__gruppe legend {
	float: left;
	width: 100%;
	padding: 0;
}

.cst--klassisch.cst--details .cst__gruppe legend + * {
	clear: left;
}

/* Schwebendes Symbol: Datenschutzeinstellungen jederzeit wieder öffnen. */
.cst-symbol {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 2147482999;
	width: 72px;
	height: 72px;
	padding: 16px;
	border: 0;
	border-radius: 50%;
	background: var(--cst-bg, #fff);
	color: var(--cst-text, #333);
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
	line-height: 0;
	cursor: pointer;
}

.cst-symbol--rechts {
	left: auto;
	right: 20px;
}

.cst-symbol svg {
	width: 40px;
	height: 40px;
	fill: currentColor;
}

.cst-symbol:focus-visible {
	outline: 3px solid var(--cst-akzent, #333);
	outline-offset: 2px;
}

html.cst-offen .cst-symbol,
#consentum:not([hidden]) ~ .cst-symbol {
	/* Zweite Regel: Manche Themes überschreiben die Klassen am <html> per Skript. */
	display: none;
}

@media (prefers-reduced-motion: no-preference) {
	.cst__box {
		animation: cst-ein 0.2s ease-out;
	}

	@keyframes cst-ein {
		from {
			opacity: 0;
			transform: translateY(8px);
		}
	}
}
