/*
 * kabuchtel Tabellen
 *
 * Grundform fuer jeden Tabellenblock: dunkle Kopfzeile, warme blasse Streifen,
 * Zellen oben ausgerichtet. Farben und Schriftgroessen kommen aus dem Theme
 * beaumont, die Werte dahinter sind der Stand vom September 2026.
 * Die doppelte Klasse hebt die Regeln ueber WordPress und das Theme.
 */

.wp-block-table.wp-block-table {
	--kbt-kopf: var(--wp--preset--color--foreground, #1d201f);
	--kbt-kopf-text: var(--wp--preset--color--background, #f7f5f3);
	--kbt-text: var(--wp--preset--color--foreground, #1d201f);
	--kbt-linie: var(--wp--preset--color--secondary, #d6d5d3);
	--kbt-grund: #fff;
	--kbt-streifen: var(--wp--preset--color--background, #f7f5f3);
	--kbt-kopfspalte: #ecebe8;
	--kbt-kopfspalte-streifen: #e4e2de;
	--kbt-verbund: #fbfaf8;
	margin-block: 1.5em;
	overflow-x: auto;
	border: 0;
}

body .wp-block-table.wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid var(--kbt-linie);
	background: var(--kbt-grund);
	/* Die Figur erbt im Theme die Serifenschrift, die mitlaufende Kopie braucht die Angabe auch. */
	font-family: var(--wp--preset--font-family--default-sans, sans-serif);
	font-size: var(--wp--preset--font-size--small, 17px);
	font-weight: 400;
	line-height: 1.55;
}

body .wp-block-table.wp-block-table thead,
body .wp-block-table.wp-block-table tfoot {
	border: 0;
}

body .wp-block-table.wp-block-table th,
body .wp-block-table.wp-block-table td {
	padding: 12px 16px;
	border: 0;
	border-bottom: 1px solid var(--kbt-linie);
	text-align: left;
	vertical-align: top;
	color: var(--kbt-text);
}

/* Kopfzeile */
body .wp-block-table.wp-block-table thead th,
body .wp-block-table.wp-block-table thead td {
	background: var(--kbt-kopf);
	color: var(--kbt-kopf-text);
	font-size: var(--wp--preset--font-size--tiny, 15px);
	font-weight: 600;
	letter-spacing: 0.01em;
	vertical-align: bottom;
	border-bottom: 0;
}

body .wp-block-table.wp-block-table thead a {
	color: var(--kbt-kopf-text);
}

/* Fusszeile */
body .wp-block-table.wp-block-table tfoot th,
body .wp-block-table.wp-block-table tfoot td {
	background: var(--kbt-kopfspalte);
	font-weight: 600;
	border-top: 1px solid var(--kbt-kopf);
}

/* Streifen, auch fuer Bloecke mit dem alten Stil "Streifen" */
body .wp-block-table.wp-block-table.is-style-stripes {
	border-bottom: 0;
}

body .wp-block-table.wp-block-table.is-style-stripes tbody tr {
	background: none;
}

body .wp-block-table.wp-block-table tbody tr:nth-child(even) > * {
	background: var(--kbt-streifen);
}

body .wp-block-table.wp-block-table tbody tr:last-child > * {
	border-bottom: 0;
}

/* Zeilenkoepfe, die im Editor als th angelegt sind */
body .wp-block-table.wp-block-table tbody th {
	font-weight: 600;
}

/* Option: erste Spalte als Kopfspalte */
body .wp-block-table.wp-block-table.wct-kopfspalte:not(.wct-hat-verbund) tbody tr > :first-child,
body .wp-block-table.wp-block-table.wct-kopfspalte.wct-hat-verbund tbody .wct-sp1 {
	background: var(--kbt-kopfspalte);
	font-weight: 600;
	border-right: 1px solid var(--kbt-linie);
}

body .wp-block-table.wp-block-table.wct-kopfspalte:not(.wct-hat-verbund) tbody tr:nth-child(even) > :first-child {
	background: var(--kbt-kopfspalte-streifen);
}

/*
 * Verbundene Zellen: Streifen passen nicht zu Zellen ueber mehrere Zeilen.
 * Stattdessen trennen feine Linien jede Zelle, damit die Verbindung lesbar bleibt.
 */
body .wp-block-table.wp-block-table.wct-hat-verbund tbody tr > * {
	background: var(--kbt-grund);
	border: 1px solid var(--kbt-linie);
}

body .wp-block-table.wp-block-table.wct-hat-verbund tbody [rowspan],
body .wp-block-table.wp-block-table.wct-hat-verbund tbody [colspan] {
	background: var(--kbt-verbund);
}

body .wp-block-table.wp-block-table.wct-hat-verbund tbody [colspan] {
	text-align: center;
}

/* Option: mitlaufende Kopfzeile. Die Kopie legt tabellen.js an. */
.wct-kopf-klon {
	position: fixed;
	z-index: 90;
	display: none;
	overflow: hidden;
	pointer-events: none;
}

.wct-kopf-klon.ist-sichtbar {
	display: block;
}

body .wp-block-table.wp-block-table .wct-kopf-klon table {
	table-layout: fixed;
	border-bottom: 0;
}

body .wp-block-table.wp-block-table .wct-kopf-klon th,
body .wp-block-table.wp-block-table .wct-kopf-klon td {
	box-sizing: border-box;
}

/* Bildunterschrift: Farbe und Schrift setzt das Theme. */
body .wp-block-table.wp-block-table figcaption {
	margin-top: 8px;
	text-align: left;
}

@media (max-width: 600px) {
	body .wp-block-table.wp-block-table table {
		font-size: 15px;
	}

	body .wp-block-table.wp-block-table thead th,
	body .wp-block-table.wp-block-table thead td {
		font-size: 14px;
	}

	/* Lange Woerter werden getrennt, damit weniger Tabellen seitlich scrollen. */
	body .wp-block-table.wp-block-table th,
	body .wp-block-table.wp-block-table td {
		padding: 10px 12px;
		hyphens: auto;
		-webkit-hyphens: auto;
		hyphenate-limit-chars: 14 6 6;
	}
}
