/* Tiefenstruktur der A&B-Familie: versetzte harte Ebene statt weichem Schatten.
   Auf Theme-Seiten gewinnt das Theme: einklassige Selektoren, und der Schatten
   wird nur im Kontrastmodus zurueckgenommen. */
.stm-materials,
.stm-account {
	--stm-depth-outline: #1d2327;
	--stm-depth-shadow: 7px 7px 0 rgba(29, 35, 39, 0.18);
	--stm-depth-shadow-hover: 11px 11px 0 rgba(29, 35, 39, 0.18);
	--stm-depth-lift: translate(-2px, -2px);
}

.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 {
	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;
}

/* Abstand so gewaehlt, dass der versetzte Schatten (bis 11px im Hover) nicht
   unter der Nachbarkarte verschwindet: eigenstaendige Kanten statt geteilter. */
.stm-material-grid {
	display: grid;
	gap: 24px;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.stm-material-card {
	background: #fff;
	border: 2px solid var(--stm-depth-outline);
	border-radius: 4px;
	box-shadow: var(--stm-depth-shadow);
	padding: 16px;
	position: relative;
	text-align: center;
	transition:
		transform 150ms ease,
		box-shadow 150ms ease,
		border-color 150ms ease,
		background-color 150ms ease;
}

/* Tastaturbedienung hebt die Karte genauso an wie die Maus. */
.stm-material-card:focus-within {
	border-color: #2271b1;
	box-shadow: var(--stm-depth-shadow-hover);
	transform: var(--stm-depth-lift);
}

.stm-material-card:focus-within h4,
.stm-material-card:focus-within h4 a {
	color: #135e96;
}

/* Wo der Browser es kann, hebt sich die Karte nur bei Tastaturbedienung an.
   Nach einem Mausklick auf den Titel bliebe sie sonst angehoben stehen. */
@supports selector(:has(:focus-visible)) {
	.stm-material-card:focus-within {
		border-color: var(--stm-depth-outline);
		box-shadow: var(--stm-depth-shadow);
		transform: none;
	}

	.stm-material-card:has(:focus-visible) {
		border-color: #2271b1;
		box-shadow: var(--stm-depth-shadow-hover);
		transform: var(--stm-depth-lift);
	}
}

@media (hover: hover) {
	.stm-material-card:hover {
		border-color: #2271b1;
		box-shadow: var(--stm-depth-shadow-hover);
		transform: var(--stm-depth-lift);
	}

	.stm-material-card:hover h4,
	.stm-material-card:hover h4 a {
		color: #135e96;
	}
}

.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: 8px;
	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;
}

/* Schaltflächen: Familienstandard 44px Mindesthöhe, 4px Radius,
   Primärfläche in der Akzentfarbe #2271b1 mit weißer Schrift. */
.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: 4px;
	box-shadow: 3px 3px 0 rgba(29, 35, 39, 0.28);
	text-align: center;
	text-decoration: none;
	transition:
		transform 120ms ease,
		box-shadow 120ms ease,
		background-color 150ms ease,
		border-color 150ms ease,
		color 150ms ease;
	white-space: normal;
}

/* Tastaturfokus hebt die Schaltflaeche ebenso an wie der Mauszeiger. */
.stm-download-button:focus-visible,
.stm-button:focus-visible,
.stm-account-actions .button:focus-visible {
	box-shadow: 5px 5px 0 rgba(29, 35, 39, 0.24);
	transform: translate(-1px, -1px);
}

@media (hover: hover) {
	.stm-download-button:hover,
	.stm-button:hover,
	.stm-account-actions .button:hover {
		box-shadow: 5px 5px 0 rgba(29, 35, 39, 0.24);
		transform: translate(-1px, -1px);
	}
}

.stm-account-actions .button {
	box-shadow: 3px 3px 0 rgba(29, 35, 39, 0.28);
	transition:
		transform 120ms ease,
		box-shadow 120ms ease,
		background-color 150ms ease,
		border-color 150ms ease,
		color 150ms ease;
}

/* Sekundärbutton: 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;
}

/* Primärbutton: 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. */
.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: 2px solid var(--stm-depth-outline);
	border-radius: 4px;
	box-shadow: var(--stm-depth-shadow);
	padding: 14px 16px;
}

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

.stm-account-intro {
	background: #fff;
	border: 2px solid var(--stm-depth-outline);
	border-radius: 4px;
	box-shadow: var(--stm-depth-shadow);
	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: 2px solid var(--stm-depth-outline);
	border-radius: 4px;
	box-shadow: var(--stm-depth-shadow);
	padding: 18px;
	transition:
		transform 150ms ease,
		box-shadow 150ms ease,
		border-color 150ms ease,
		background-color 150ms ease;
}

.stm-account-card:focus-within {
	border-color: #2271b1;
	box-shadow: var(--stm-depth-shadow-hover);
	transform: var(--stm-depth-lift);
}

/* Auch hier: angehoben nur bei Tastaturbedienung, nicht nach einem Mausklick. */
@supports selector(:has(:focus-visible)) {
	.stm-account-card:focus-within {
		border-color: var(--stm-depth-outline);
		box-shadow: var(--stm-depth-shadow);
		transform: none;
	}

	.stm-account-card:has(:focus-visible) {
		border-color: #2271b1;
		box-shadow: var(--stm-depth-shadow-hover);
		transform: var(--stm-depth-lift);
	}
}

@media (hover: hover) {
	.stm-account-card:hover {
		border-color: #2271b1;
		box-shadow: var(--stm-depth-shadow-hover);
		transform: var(--stm-depth-lift);
	}
}

.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"] {
	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 im Familien-Muster: Statusfläche, 1px Statusrahmen,
   4px linker Rand, 8px Radius. Neutral ist die Grundvariante. */
.stm-account-notice {
	background: #eef2f5;
	border: 1px solid #1d2327;
	border-left-width: 4px;
	border-radius: 8px;
	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;
}

/* Auf schmalen Displays ist die Ebene flacher, damit sie nicht drueckt. */
@media (max-width: 700px) {
	.stm-materials,
	.stm-account {
		--stm-depth-shadow: 5px 5px 0 rgba(29, 35, 39, 0.18);
		--stm-depth-shadow-hover: 7px 7px 0 rgba(29, 35, 39, 0.18);
	}
}

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

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

/* Nutzereinstellung "weniger Bewegung": keine Uebergaenge, kein Anheben. */
@media (prefers-reduced-motion: reduce) {
	.stm-material-card,
	.stm-account-card,
	.stm-download-button,
	.stm-button,
	.stm-account-actions .button {
		transition: none;
	}

	.stm-material-card:hover,
	.stm-material-card:focus-within,
	.stm-account-card:hover,
	.stm-account-card:focus-within,
	.stm-download-button:hover,
	.stm-download-button:focus-visible,
	.stm-button:hover,
	.stm-button:focus-visible,
	.stm-account-actions .button:hover,
	.stm-account-actions .button:focus-visible {
		transform: none;
	}
}

/* Kontrastmodus: die Kontur traegt die Tiefe, nicht der Schatten. */
@media (forced-colors: active) {
	.stm-material-card,
	.stm-account-card,
	.stm-account-intro,
	.stm-empty,
	.stm-login-required,
	.stm-download-button,
	.stm-button,
	.stm-account-actions .button {
		box-shadow: none;
	}

	.stm-material-card,
	.stm-account-card,
	.stm-account-intro,
	.stm-empty,
	.stm-login-required {
		border: 2px solid CanvasText;
	}

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

/* 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;
	}

	.stm-download-button:focus,
	.stm-button:focus,
	.stm-account-actions .button:focus {
		box-shadow: 5px 5px 0 rgba(29, 35, 39, 0.24);
		transform: translate(-1px, -1px);
	}
}
