/* Neutrale Basis (v2.30): so sieht das Paket in fremden Themes aus - flacher
   WordPress-Standardlook, 1px-Rahmen in #c3c4c7, keine Tiefenebene, kein
   Anheben, kein dunkles Design. Das A&B-eigene Tiefen-Design und der
   Dunkelmodus stecken in assets/ab-theme-design.css und werden nur bei aktivem
   Theme "A&B Schulungen" nachgeladen.

   Was hier bleibt, weil es nicht am Theme haengen darf: der sichtbare
   Fokusrahmen (WCAG 2.4.7 / 1.4.1), die 44px Mindesthoehe der Schaltflaechen
   und die Konturen im Kontrastmodus.

   Alle Selektoren bleiben einklassig, damit ein Theme sie ueberschreiben kann. */

.stm-materials {
	margin: 24px 0;
}

.stm-material-section {
	margin: 0 0 24px;
}

.stm-material-section h2 {
	margin: 0 0 16px;
}

/* v2.28: gleiches Muster wie die Filterleiste im Admin - umbrechendes Raster
   statt fester Spalten, damit die Schaltflaechen nicht herauslaufen. */
.stm-material-filters {
	align-items: end;
	box-sizing: border-box;
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	margin: 0 0 22px;
	max-width: 100%;
}

.stm-material-filters > * {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
}

.stm-material-filters label {
	display: block;
	margin: 0;
	max-width: 100%;
	min-width: 0;
}

.stm-material-filters span {
	color: #53606f;
	display: block;
	font-size: 0.8125rem;
	margin-bottom: 4px;
}

.stm-material-filters input,
.stm-material-filters select {
	border: 1px solid #8c8f94;
	border-radius: 4px;
	box-sizing: border-box;
	min-height: 44px;
	padding: 8px 10px;
	width: 100%;
}

.stm-material-group {
	margin: 0 0 28px;
}

.stm-material-group h3 {
	font-size: 1.25rem;
	line-height: 1.25;
	margin: 0 0 14px;
}

/* Der Abstand bleibt bei 24px: mit aktivem A&B-Theme traegt die Karte einen
   versetzten Schatten von bis zu 11px, der nicht unter der Nachbarkarte
   verschwinden darf. */
.stm-material-grid {
	display: grid;
	gap: 24px;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* Karten im WordPress-Standardlook: weisse Flaeche, 1px Rahmen, 4px Radius. */
.stm-material-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 16px;
	position: relative;
	text-align: center;
}

.stm-material-image {
	align-items: center;
	display: flex;
	justify-content: center;
	margin: 0 auto 12px;
	min-height: 120px;
}

.stm-material-image img {
	display: block;
	height: auto;
	max-height: 120px;
	max-width: 120px;
	object-fit: contain;
	width: auto;
}

.stm-file-icon {
	align-items: center;
	background: #f6f7f7;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	color: #1d2327;
	display: inline-flex;
	font-weight: 800;
	justify-content: center;
	line-height: 1;
	position: relative;
	text-transform: uppercase;
}

.stm-file-icon::before {
	border-left: 20px solid transparent;
	border-top: 20px solid #dcdcde;
	content: "";
	position: absolute;
	right: -1px;
	top: -1px;
}

.stm-file-icon span {
	position: relative;
	z-index: 1;
}

.stm-file-icon-large {
	font-size: 1.125rem;
	height: 120px;
	width: 120px;
}

.stm-new-badge {
	background: #0a6b22;
	border-radius: 999px;
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
	padding: 5px 8px;
	position: absolute;
	right: 12px;
	top: 12px;
}

.stm-material-card h4 {
	font-size: 1.0625rem;
	line-height: 1.25;
	margin: 0 0 8px;
	overflow-wrap: anywhere;
}

.stm-material-meta {
	color: #53606f;
	font-size: 0.8125rem;
	margin: 0 0 12px;
}

.stm-material-actions {
	display: flex;
	flex-direction: column;
	gap: 7px;
	margin: 12px 0 0;
}

/* Schaltflaechen im WordPress-Standardlook: 3px Radius, flach, ohne Ebene.
   Die 44px Mindesthoehe und der Umbruch bleiben - beides ist Barrierefreiheit
   und darf nicht am Theme haengen. */
.stm-download-button,
.stm-button {
	align-items: center;
	box-sizing: border-box;
	cursor: pointer;
	display: inline-flex;
	font-size: 0.9375rem;
	justify-content: center;
	line-height: 1.4;
	margin: 4px 3px;
	min-height: 44px;
	padding: 10px 16px;
	border-radius: 3px;
	text-align: center;
	text-decoration: none;
	white-space: normal;
}

/* Sekundaerbutton: nachgeordnete Aktionen. */
.stm-button {
	background: #fff;
	border: 1px solid #c3c4c7;
	color: #2271b1;
}

.stm-button:hover,
.stm-button:active {
	background: #f6f7f7;
	border-color: #8c8f94;
	color: #135e96;
}

/* Primaerbutton: zentrale Handlung und Downloads. */
.stm-download-button,
.stm-button-primary {
	background: #2271b1;
	border: 1px solid #2271b1;
	color: #fff;
}

.stm-download-button {
	font-weight: 700;
	overflow-wrap: anywhere;
}

.stm-download-button:hover,
.stm-download-button:active,
.stm-button-primary:hover,
.stm-button-primary:active {
	background: #135e96;
	border-color: #135e96;
	color: #fff;
}

/* Sichtbarer Fokusrahmen (WCAG 2.4.7 / 1.4.1): nicht nur Farbwechsel,
   sondern ein Umriss mit ~6:1 Kontrast auf allen fokussierbaren Elementen.
   Nur :focus-visible: so erscheint der Rahmen bei Tastaturbedienung, bleibt aber
   nach einem Mausklick oder einem per JavaScript gesetzten Fokus nicht stehen.
   Die :focus-Regeln als Rueckfallebene stehen am Dateiende im @supports-Block.
   Beides gehoert in die Basis: Barrierefreiheit gilt in jedem Theme. */
.stm-materials a:focus-visible,
.stm-materials button:focus-visible,
.stm-materials input:focus-visible,
.stm-materials select:focus-visible,
.stm-materials textarea:focus-visible,
.stm-account a:focus-visible,
.stm-account button:focus-visible,
.stm-account input:focus-visible,
.stm-account select:focus-visible,
.stm-account textarea:focus-visible,
.stm-button:focus-visible,
.stm-download-button:focus-visible {
	outline: 3px solid #005fcc;
	outline-offset: 2px;
}

.stm-empty,
.stm-login-required {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 14px 16px;
}

.stm-account {
	margin: 24px 0;
	max-width: 980px;
}

.stm-account-intro {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	margin: 0 0 20px;
	padding: 18px;
}

.stm-account-intro h2 {
	margin: 0 0 10px;
}

.stm-account-intro p {
	margin: 0 0 8px;
}

.stm-account-intro p:last-child {
	margin-bottom: 0;
}

.stm-account-trust-links {
	align-items: center;
	color: #53606f;
	display: flex;
	flex-wrap: wrap;
	font-size: 0.875rem;
	gap: 6px 12px;
}

.stm-account-grid {
	display: grid;
	gap: 24px;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stm-account-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 18px;
}

.stm-account-card h2 {
	margin: 0 0 14px;
}

.stm-account-card label {
	display: block;
	margin: 0 0 12px;
}

.stm-account-card input[type="text"],
.stm-account-card input[type="email"],
.stm-account-card input[type="password"] {
	border: 1px solid #8c8f94;
	border-radius: 4px;
	box-sizing: border-box;
	max-width: 100%;
	width: 100%;
}

.stm-account-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 14px 0 0;
}

/* Hinweisboxen flach: Statusflaeche, 1px Statusrahmen, 4px linker Rand,
   4px Radius. Neutral ist die Grundvariante. */
.stm-account-notice {
	background: #eef2f5;
	border: 1px solid #1d2327;
	border-left-width: 4px;
	border-radius: 4px;
	color: #1d2327;
	margin: 0 0 16px;
	padding: 12px 14px;
}

.stm-account-notice-success {
	background: #edfaef;
	border-color: #0a6b22;
	color: #0a6b22;
}

.stm-account-notice-error {
	background: #fcf0f1;
	border-color: #b32d2e;
	color: #b32d2e;
}

.stm-account-notice-warning {
	background: #fff7e6;
	border-color: #7a4b00;
	color: #7a4b00;
}

.stm-account .description {
	color: #53606f;
	font-size: 0.8125rem;
	margin: 0 0 12px;
}

.stm-account-hidden {
	height: 1px;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	top: auto;
	width: 1px;
}

@media (max-width: 520px) {
	.stm-material-grid {
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	}

	.stm-material-filters {
		grid-template-columns: 1fr;
	}
}

/* Kontrastmodus: die Kontur sichert die Kanten der Flaechen, auch ohne
   Theme-Zusatz. Gehoert in die Basis - Barrierefreiheit gilt immer. */
@media (forced-colors: active) {
	.stm-material-card,
	.stm-account-card,
	.stm-account-intro,
	.stm-empty,
	.stm-login-required {
		border: 1px solid CanvasText;
	}

	.stm-material-card:hover,
	.stm-material-card:focus-within,
	.stm-account-card:hover,
	.stm-account-card:focus-within {
		border-color: Highlight;
	}
}

/* Rueckfallebene fuer Browser ohne :focus-visible: dort traegt :focus den Rahmen.
   Aktuelle Browser ueberspringen diesen Block, deshalb bleibt der Rahmen dort
   nach einem Mausklick oder einem per Skript gesetzten Fokus unsichtbar. */
@supports not selector(:focus-visible) {
	.stm-materials a:focus,
	.stm-materials button:focus,
	.stm-materials input:focus,
	.stm-materials select:focus,
	.stm-materials textarea:focus,
	.stm-account a:focus,
	.stm-account button:focus,
	.stm-account input:focus,
	.stm-account select:focus,
	.stm-account textarea:focus,
	.stm-button:focus,
	.stm-download-button:focus {
		outline: 3px solid #005fcc;
		outline-offset: 2px;
	}
}
