/*
 * Umschalter für die Schriftpaarung, übernommen aus final/schriftwahl.css (dort die Begründung je Paarung).
 * Nur zum Vergleichen, fällt mit der Entscheidung weg. Reines CSS über :has().
 * Richtung 3 steuert alle großen Überschriften über --schrift-gross & Co. (basis.css), die Paarungen setzen nur diese
 * Variablen um.
 */

/* Montserrat oben, zweite Schrift für den Text */

:root:has(.schriftwahl [data-montserrat="titel"]:checked) {
	--schrift-gross: "Montserrat Variabel", "Montserrat", Arial, sans-serif;
	--gross-zeile: 1.05;
}

:root:has(#paar-hanken:checked) {
	--schrift-text: "Hanken Grotesk", Arial, sans-serif;
	--gross-gewicht: 600;
	--gross-spur: -0.025em;
}

:root:has(#paar-plex:checked) {
	--schrift-text: "IBM Plex Sans", Arial, sans-serif;
	--gross-gewicht: 500;
	--gross-spur: -0.025em;
}

:root:has(#paar-serif-text:checked) {
	--schrift-text: "Source Serif 4", Georgia, serif;
	--gross-gewicht: 300;
	--gross-spur: -0.035em;
}

/* Montserrat unten: Text in Montserrat, große Überschriften in der zweiten Schrift */

:root:has(.schriftwahl [data-montserrat="text"]:checked) {
	--schrift-text: "Montserrat", Arial, sans-serif;
}

:root:has(#paar-funnel:checked) {
	--schrift-gross: "Funnel Display", Arial, sans-serif;
	--gross-gewicht: 500;
	--gross-spur: -0.02em;
}

:root:has(#paar-serif-titel:checked) {
	--schrift-gross: "Source Serif 4", Georgia, serif;
	--gross-gewicht: 600;
	--gross-spur: -0.015em;
	--gross-zeile: 1.05;
}

:root:has(#paar-archivo:checked) {
	--schrift-gross: "Archivo", Arial, sans-serif;
	--gross-gewicht: 600;
	--gross-breite: 88%;
	--gross-spur: -0.005em;
}

/* Schalter */

.schriftwahl {
	position: fixed;
	bottom: clamp(1rem, 2.5vw, 1.75rem);
	left: clamp(1rem, 2.5vw, 1.75rem);
	z-index: 10;
	display: flex;
	flex-direction: column;
	max-width: calc(100% - 2rem);
	padding: 0.375rem;
	border: 0.0625rem solid var(--wald-20);
	border-radius: var(--ecke-knopf);
	background: var(--weiss);
	box-shadow: 0 0.5rem 1.5rem rgb(17 42 40 / 0.12);
	font-size: 0.8125rem;
	line-height: 1.2;
}

.schriftwahl__reihe {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	align-items: center;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.schriftwahl legend {
	float: left;
	min-width: 9.5rem;
	padding: 0 0.5rem;
	color: var(--wald-80);
	font-family: "Montserrat", Arial, sans-serif;
	font-size: 0.8125rem;
	font-weight: 600;
}

.schriftwahl input {
	position: absolute;
	width: 0.0625rem;
	height: 0.0625rem;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.schriftwahl label {
	display: inline-flex;
	gap: 0.3em;
	align-items: baseline;
	min-height: 2.25rem;
	padding: 0.625rem 0.5625rem 0.5rem;
	border-radius: 0.5rem;
	color: var(--wald);
	cursor: pointer;
	user-select: none;
}

.schriftwahl label:hover {
	background: var(--grund);
}

.schriftwahl label:has(:checked) {
	background: var(--wald);
	color: var(--weiss);
}

.schriftwahl label:has(:focus-visible) {
	outline: 0.1875rem solid var(--wald);
	outline-offset: 0.125rem;
}

/* Schrägstrich zwischen Titel- und Textschrift, leiser als die Namen */
.schriftwahl label > span + span::before {
	content: "/";
	margin-right: 0.3em;
	font-family: "Montserrat", Arial, sans-serif;
	font-weight: 400;
	opacity: 0.5;
}

/* Ausblenden über <details>: zu bleibt nur der Knopf stehen, die Wahl bleibt erhalten */

.schriftwahl__knopf {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.25rem;
	padding: 0.5rem;
	border-radius: 0.5rem;
	color: var(--wald-80);
	font-family: "Montserrat", Arial, sans-serif;
	font-weight: 600;
	list-style: none;
	cursor: pointer;
	user-select: none;
}

.schriftwahl__knopf::-webkit-details-marker {
	display: none;
}

/* Pfeil: zeigt nach oben, solange zu, nach unten zum Einklappen */
.schriftwahl__knopf::after {
	content: "";
	width: 0.4375rem;
	height: 0.4375rem;
	margin-left: auto;
	border-top: 0.125rem solid currentcolor;
	border-left: 0.125rem solid currentcolor;
	transform: translateY(0.125rem) rotate(45deg);
}

.schriftwahl[open] > .schriftwahl__knopf::after {
	transform: translateY(-0.125rem) rotate(225deg);
}

.schriftwahl__knopf:hover {
	background: var(--grund);
}

.schriftwahl__knopf:focus-visible {
	outline: 0.1875rem solid var(--wald);
	outline-offset: 0.125rem;
}

.schriftwahl__aus,
.schriftwahl[open] .schriftwahl__an {
	display: none;
}

.schriftwahl[open] .schriftwahl__aus {
	display: inline;
}

.schriftwahl:not([open]) {
	width: max-content;
}

.schriftwahl__knopf + .schriftwahl__reihe,
.schriftwahl__reihe + .schriftwahl__reihe {
	margin-top: 0.375rem;
	padding-top: 0.375rem;
	border-top: 0.0625rem solid var(--wald-20);
}

/* Jeder Name steht in seiner eigenen Schrift, Titelschriften fett wie auf der Seite */

.s-montserrat {
	font-family: "Montserrat", Arial, sans-serif;
	font-weight: 500;
}

/* Montserrat in den drei Titel-Paarungen im jeweiligen Schnitt */
.s-montserrat[data-gewicht] {
	font-family: "Montserrat Variabel", "Montserrat", Arial, sans-serif;
}

.s-montserrat[data-gewicht="600"] {
	font-weight: 600;
}

.s-montserrat[data-gewicht="300"] {
	font-weight: 300;
}

.s-hanken {
	font-family: "Hanken Grotesk", Arial, sans-serif;
}

.s-plex {
	font-family: "IBM Plex Sans", Arial, sans-serif;
}

.s-serif {
	font-family: "Source Serif 4", Georgia, serif;
}

.s-funnel {
	font-family: "Funnel Display", Arial, sans-serif;
	font-weight: 500;
}

.s-archivo {
	font-family: "Archivo", Arial, sans-serif;
	font-weight: 600;
	font-stretch: 92%;
}

/* Schmal: je Reihe eine waagrecht scrollende Zeile, Titel nur für Screenreader */

@media (max-width: 64rem) {
	.schriftwahl {
		right: clamp(1rem, 2.5vw, 1.75rem);
		max-width: none;
	}

	.schriftwahl:not([open]) {
		right: auto;
	}

	.schriftwahl__reihe {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.schriftwahl legend {
		position: absolute;
		width: 0.0625rem;
		height: 0.0625rem;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.schriftwahl label {
		flex: none;
		white-space: nowrap;
	}
}
