/* handball.net Widgets
 *
 * Farben kommen aus Einstellungen → handball.net (bzw. Shortcode-Attribut farbe/textfarbe)
 * und lassen sich auch im Theme überschreiben:
 *   .hnw { --hnw-primary: #c00000; --hnw-primary-text: #fff; }
 */
.hnw {
	--hnw-primary: #000;
	--hnw-primary-text: #fff;
	--hnw-highlight-bg: color-mix(in srgb, var(--hnw-primary) 10%, transparent);
	--hnw-border: color-mix(in srgb, currentColor 14%, transparent);
	--hnw-stripe: color-mix(in srgb, currentColor 4%, transparent);
	--hnw-win: #2e7d32;
	--hnw-loss: #c62828;
	--hnw-draw: #b7791f;
	--hnw-radius: 6px;
	margin: 0 0 1.5em;
	line-height: 1.4;
}
.hnw *,
.hnw *::before,
.hnw *::after { box-sizing: border-box; }

/* ---------- Liga-Blöcke ---------- */
.hnw-liga + .hnw-liga { margin-top: 1.5em; }
h3.hnw-titel { margin: 0 0 .5em; }
.hnw-liga-inhalt > * + * { margin-top: 1em; }

/* Aufklappbar (<details>) */
details.hnw-liga {
	border: 1px solid var(--hnw-border);
	border-radius: var(--hnw-radius);
	overflow: hidden;
}
details.hnw-liga + details.hnw-liga { margin-top: .75em; }
details.hnw-liga > summary.hnw-titel {
	display: flex;
	align-items: center;
	gap: .6em;
	margin: 0;
	padding: .75em 1em;
	background: var(--hnw-primary);
	color: var(--hnw-primary-text);
	font-weight: 700;
	cursor: pointer;
	list-style: none;
	user-select: none;
}
details.hnw-liga > summary.hnw-titel::-webkit-details-marker { display: none; }
details.hnw-liga > summary.hnw-titel::before {
	content: "";
	flex: none;
	width: .5em;
	height: .5em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform .2s ease;
}
details.hnw-liga[open] > summary.hnw-titel::before { transform: rotate(45deg); }
details.hnw-liga > summary.hnw-titel:focus-visible { outline: 2px solid var(--hnw-primary-text); outline-offset: -4px; }
details.hnw-liga > .hnw-liga-inhalt { padding: 0; }
details.hnw-liga .hnw-scroll { border: 0; border-radius: 0; }
details.hnw-liga .hnw-meta,
details.hnw-liga .hnw-leer { padding: 0 1em .75em; }

/* ---------- Tabellen ---------- */
.hnw-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: var(--hnw-radius);
}
.hnw-table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	margin: 0;
	font-size: .95em;
	font-variant-numeric: tabular-nums;
}
.hnw-table th,
.hnw-table td {
	padding: .5em .6em;
	border: 0;
	border-bottom: 1px solid var(--hnw-border);
	vertical-align: middle;
	white-space: nowrap;
}
.hnw-table thead th {
	background: var(--hnw-primary);
	color: var(--hnw-primary-text);
	font-weight: 600;
	font-size: .85em;
	text-transform: uppercase;
	letter-spacing: .03em;
	border-bottom: 0;
}
.hnw-table tbody tr:nth-child(even) { background: var(--hnw-stripe); }
.hnw-table tbody tr:last-child td { border-bottom: 0; }
.hnw-table td.hnw-mannschaft,
.hnw-table td.hnw-verein,
.hnw-table td.hnw-heim,
.hnw-table td.hnw-gast,
.hnw-table td.hnw-gegner,
.hnw-table td.hnw-halle { white-space: normal; }
.hnw-l { text-align: left; }
.hnw-c { text-align: center; }
.hnw-r { text-align: right; }

/* Eigenes Team */
.hnw-table tbody tr.hnw-eigen { background: var(--hnw-highlight-bg); }
.hnw-table-standings tr.hnw-eigen td { font-weight: 700; }
.hnw-table-standings tr.hnw-eigen td:first-child { box-shadow: inset 4px 0 0 var(--hnw-primary); }

/* Logos */
.hnw-logo-img { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; }
.hnw-table td.hnw-logo,
.hnw-table td.hnw-heimlogo,
.hnw-table td.hnw-gastlogo { width: 36px; padding-left: .3em; padding-right: .3em; }

/* Tabelle: Spalten */
.hnw-table td.hnw-platz { width: 3em; }
.hnw-table td.hnw-punkte,
.hnw-table td.hnw-pluspunkte { font-weight: 700; }

/* ---------- Spielplan ---------- */
.hnw-table-plan .hnw-eigen-name { font-weight: 700; }
.hnw-table-plan tr.hnw-tag th {
	padding-top: .9em;
	background: transparent;
	border-bottom: 2px solid var(--hnw-primary);
	font-weight: 700;
	text-align: left;
}
.hnw-table-plan thead + tbody tr.hnw-tag:first-child th { padding-top: .6em; }
.hnw-table-plan tbody tr.hnw-tag { background: transparent; }
.hnw-table-verein td.hnw-mannschaft { font-weight: 600; white-space: normal; }
.hnw-table-plan td.hnw-datum,
.hnw-table-plan td.hnw-zeit { font-size: .92em; }
.hnw-table-plan td.hnw-ergebnis { font-weight: 700; min-width: 4.5em; }
.hnw-table-plan td.hnw-ergebnis a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.hnw-table-plan td.hnw-ergebnis a:hover { border-bottom-style: solid; }
.hnw-table tr.hnw-sieg td.hnw-ergebnis { color: var(--hnw-win); }
.hnw-table tr.hnw-niederlage td.hnw-ergebnis { color: var(--hnw-loss); }
.hnw-table tr.hnw-remis td.hnw-ergebnis { color: var(--hnw-draw); }
.hnw-table tr.hnw-live td.hnw-ergebnis { color: var(--hnw-loss); animation: hnw-pulse 1.5s ease-in-out infinite; }
.hnw-offen { opacity: .45; font-weight: 400; }
.hnw-table-plan td.hnw-heimgast { font-weight: 700; width: 2.5em; }

@keyframes hnw-pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
	.hnw-table tr.hnw-live td.hnw-ergebnis { animation: none; }
	details.hnw-liga > summary.hnw-titel::before { transition: none; }
}

/* Formkurve */
.hnw-form {
	display: inline-block;
	width: 1.5em;
	line-height: 1.5em;
	margin: 0 1px;
	border-radius: 3px;
	color: #fff;
	font-size: .75em;
	font-weight: 700;
	text-align: center;
}
.hnw-form-w { background: var(--hnw-win); }
.hnw-form-l { background: var(--hnw-loss); }
.hnw-form-d { background: var(--hnw-draw); }

/* ---------- Sonstiges ---------- */
.hnw-meta { margin: .4em 0 0; font-size: .8em; opacity: .65; }
.hnw-leer { margin: .5em 0; opacity: .7; }
.hnw-fehler { padding: .75em 1em; border-left: 4px solid #c62828; background: #fff3f3; color: #000; }

/* ---------- Mobil ---------- */
@media (max-width: 600px) {
	.hnw-table { font-size: .85em; }
	.hnw-table th,
	.hnw-table td { padding: .45em .35em; }
	.hnw-logo-img { width: 20px; height: 20px; }
	.hnw-table-plan td.hnw-datum { white-space: normal; min-width: 5.5em; }
}
