/*
 * Wortlinie Editor – Live-Vorschau des Definitions-Posters (Wörterbuch-Stil).
 * Maße kommen als CSS-Variablen aus wl_druck_regeln() (includes/satz.php) – dieselben wie in der Druck-PDF.
 * 1cqw = 1 % der Blattbreite.
 */

.wl-vorschau {
	position: sticky;
	top: 100px;
	margin-bottom: 30px;
}

/* Wand hinter dem Poster: neutrales Grau, damit Weiß, Naturweiß, Sand und Nebelgrau unterscheidbar bleiben */
.wl-vorschau__wand {
	background: linear-gradient(180deg, #cdcdcb 0%, #c2c2c0 100%);
	border-radius: 24px;
	padding: 9% 14%;
	display: flex;
	justify-content: center;
}

.wl-poster {
	width: 100%;
	max-width: 520px;
	aspect-ratio: 210 / 297;
	background: var(--wl-papier, #fff);
	color: var(--wl-schrift, #1f1b18);
	/* Von vorschau.js gesetzt: Schrift, Textgröße (Kundenwahl), Wortgröße, Einpass-Faktor, Abstand oben */
	--wl-font: 'WL Baskerville', Georgia, serif;
	--wl-groesse: 1;
	--wl-fit: 1;
	--wl-wort-groesse: 12.5cqw;
	--wl-oben: 40cqw;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 12px 32px rgba(31, 27, 24, .16);
	transition: background-color .3s ease, box-shadow .3s ease;
	box-sizing: border-box;
}

/* Bilderrahmen schwarz */
.wl-poster[data-rahmen="1"] {
	border: 14px solid #1b1917;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 2px 4px rgba(0, 0, 0, .2), 0 18px 40px rgba(31, 27, 24, .28);
}

/* Blatt = Bezug für alle Maße */
.wl-poster__blatt {
	container-type: size;
	position: relative;
	height: 100%;
	overflow: hidden; /* Sicherheitsnetz – vorschau.js verkleinert den Text, bevor es greift */
	font-family: var(--wl-font);
	-webkit-font-smoothing: antialiased;
}

.wl-poster__inhalt {
	position: absolute;
	left: var(--wl-rand-x);
	right: var(--wl-rand-x);
	top: var(--wl-oben);
}

.wl-poster p {
	margin: 0;
	color: inherit;
	font-family: inherit;
}

.wl-poster__wort {
	font-size: calc(var(--wl-wort-groesse) * var(--wl-fit));
	font-weight: 700;
	line-height: var(--wl-wort-zeile);
	letter-spacing: var(--wl-wort-ls);
	white-space: nowrap;
	hyphens: manual;
	-webkit-hyphens: manual;
}

/* Zu lang für eine Zeile: an Silben umbrechen (vorschau.js setzt data-umbruch) */
.wl-poster[data-umbruch="1"] .wl-poster__wort {
	white-space: normal;
}

.wl-poster__grammatik {
	margin-top: var(--wl-gram-oben) !important;
	font-size: calc(var(--wl-gram-groesse) * var(--wl-groesse) * var(--wl-fit));
	line-height: var(--wl-gram-zeile);
	white-space: nowrap;
}

/* Lautschrift: eigene Schrift mit IPA-Zeichen. line-height 0, damit ihre hohen Ober-/Unterlängen die Zeile nicht aufblähen. */
.wl-poster__aussprache {
	font-family: 'WL Lautschrift', 'Gentium Book Plus', Cambria, serif;
	font-size: var(--wl-gram-ipa);
	line-height: 0;
}

.wl-poster__wortart {
	font-style: italic;
}

.wl-poster__linie {
	border: 0;
	border-top: var(--wl-linie-dicke) solid var(--wl-schrift, #1f1b18); /* nicht currentColor: das Theme färbt <hr> grau */
	margin: var(--wl-linie-oben) 0 var(--wl-linie-unten);
	width: 100%;
	height: 0;
	opacity: 1;
}

.wl-poster__definition {
	font-size: calc(var(--wl-def-groesse) * var(--wl-groesse) * var(--wl-fit));
	line-height: var(--wl-def-zeile);
	text-align: justify;
	text-align-last: left;
	hyphens: auto;
	-webkit-hyphens: auto;
	white-space: pre-line;
}

.wl-poster__zitat {
	margin-top: var(--wl-zitat-oben) !important;
	padding-left: var(--wl-zitat-einzug);
	border-left: var(--wl-zitat-balken) solid var(--wl-schrift, #1f1b18);
	font-size: calc(var(--wl-zitat-groesse) * var(--wl-groesse) * var(--wl-fit));
	font-style: italic;
	line-height: var(--wl-zitat-zeile);
	white-space: pre-line; /* je Satz eine Zeile (vorschau.js) */
	hyphens: manual;
	-webkit-hyphens: manual;
}

.wl-poster__synonyme {
	display: flex;
	align-items: baseline;
	column-gap: var(--wl-syn-abstand);
	margin-top: var(--wl-syn-oben);
	padding-top: var(--wl-syn-innen);
	border-top: var(--wl-syn-linie) solid color-mix(in srgb, var(--wl-schrift, #1f1b18) var(--wl-syn-deckkraft), var(--wl-papier, #fff));
	font-size: calc(var(--wl-syn-groesse) * var(--wl-groesse) * var(--wl-fit));
	line-height: var(--wl-syn-zeile);
	hyphens: manual; /* schmale Spalte: lieber ganze Wörter umbrechen */
	-webkit-hyphens: manual;
}

.wl-poster__syn-label {
	flex: none;
	font-size: var(--wl-syn-label);
	letter-spacing: var(--wl-syn-label-ls);
}

/* Leere Teile ausblenden (Grammatikzeile ohne Name/Wortart, keine Synonyme, kein Zitat) */
.wl-poster__grammatik[data-leer="1"],
.wl-poster__synonyme[data-leer="1"],
.wl-poster__zitat[data-leer="1"] {
	display: none;
}

/* Beispiel, solange noch kein Wort eingegeben ist */
.wl-poster.is-beispiel .wl-poster__inhalt {
	opacity: .45;
}

.wl-vorschau__hinweis {
	margin-top: 12px;
	font-size: 12px;
	text-align: center;
	opacity: .6;
}

@media (max-width: 849px) {
	.wl-vorschau {
		position: static;
	}

	.wl-vorschau__wand {
		padding: 8% 18%;
	}

	.wl-poster[data-rahmen="1"] {
		border-width: 9px;
	}
}

/* Formular: Schrift-Optionen in ihrer eigenen Schrift zeigen */
[data-uniqid="wl_schrift"] label[for] { font-size: 17px; }
[data-uniqid="wl_schrift"] li:nth-child(1) label { font-family: 'WL Playfair', serif; }
[data-uniqid="wl_schrift"] li:nth-child(2) label { font-family: 'WL Cormorant', serif; font-size: 19px; }
[data-uniqid="wl_schrift"] li:nth-child(3) label { font-family: 'WL Baskerville', serif; }
[data-uniqid="wl_schrift"] li:nth-child(4) label { font-family: 'WL Montserrat', sans-serif; }
[data-uniqid="wl_silben"] label[for] { font-family: 'WL Baskerville', serif; font-size: 17px; }

/* Warnung: Zeichen, die wir nicht drucken können (z. B. Emojis) */
.wl-vorschau__warnung {
	margin: 12px 0 0;
	padding: 8px 12px;
	border-radius: 8px;
	background: #fbeaea;
	color: #8a1f11;
	font-size: 13px;
	text-align: center;
}

/* Farbauswahl (EPO-Feld wl_farbe): runde Farbtupfer mit Namen, Auswahl als Ring */
[data-uniqid="wl_farbe"] .tmhexcolorimage {
	display: block;
	width: 46px !important;
	height: 46px !important;
	margin: 4px auto 6px;
}
[data-uniqid="wl_farbe"] .tc-image {
	display: block;
	width: 46px !important;
	height: 46px !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
	outline: 2px solid transparent;
	outline-offset: 3px;
	transition: outline-color .15s;
}
[data-uniqid="wl_farbe"] li:hover .tc-image {
	outline-color: rgba(31, 27, 24, .3);
}
[data-uniqid="wl_farbe"] li.tc-active .tc-image {
	outline-color: #1f1b18;
}
[data-uniqid="wl_farbe"] .tc-label-text {
	font-size: 13px;
	font-weight: 500;
}
