/*
 * Resilience Academy – Oberfläche.
 * Schrift und Grundfarben kommen vom Theme. Eigene Farben nur über Variablen mit Fallback.
 * Defaults entsprechen der CI der Website (dunkles Moosgrün, Papierton, Tinte).
 */

.vdl-academy {
	--vdl-text: var(--wp--preset--color--contrast, #1d1d1f);
	--vdl-muted: #5f5f64; /* >= 4,5:1 auf #fff und #f5f5f3 */
	--vdl-surface: var(--wp--preset--color--base-2, #f5f5f3);
	--vdl-surface-2: #ebebe7;
	--vdl-bg: var(--wp--preset--color--base, #ffffff);
	--vdl-border: rgba(0, 0, 0, 0.08);
	--vdl-line-strong: #76767b; /* >= 3:1 für Bedienelemente */
	--vdl-accent: var(--wp--preset--color--primary, #4c5344);
	--vdl-accent-contrast: #ffffff;
	--vdl-accent-soft: #6f7763;
	--vdl-ink: #1d1d1f;
	--vdl-warn-bg: #f2ecdc;
	--vdl-warn-line: #7a5c14;
	--vdl-focus: #1d1d1f;
	--vdl-radius: 20px;
	--vdl-radius-pill: 100px;
	--vdl-measure: 72ch;
	color: var(--vdl-text);
	font-family: inherit;
	line-height: 1.65;
}

.vdl-academy *,
.vdl-academy *::before,
.vdl-academy *::after { box-sizing: border-box; }

main.vdl-academy {
	max-width: 64rem;
	margin: 0 auto;
	padding: 1.5rem 1rem 3rem;
}

.vdl-skip {
	position: absolute;
	left: -999px;
	top: 0;
	background: #1d1d1f;
	color: #fff;
	padding: 0.6rem 1rem;
	z-index: 100000;
}
.vdl-skip:focus { left: 0.5rem; top: 0.5rem; }

/* Lesebreite */
.vdl-header,
.vdl-body,
.vdl-notice,
.vdl-toc,
.vdl-solution-link,
.vdl-markdone,
.vdl-prevnext,
.vdl-staging,
.vdl-selfassess,
.vdl-exam-nav,
.vdl-section > p,
.vdl-section > ol,
.vdl-section > ul,
.vdl-noscript,
.vdl-back { max-width: var(--vdl-measure); }

.vdl-title { margin: 0.25rem 0 0.75rem; line-height: 1.2; overflow-wrap: anywhere; }
.vdl-h-small { font-size: 1.125rem; margin: 0 0 0.5rem; }
.vdl-lead-small { color: var(--vdl-muted); margin: 0.25rem 0 1rem; }

.vdl-body { overflow-wrap: break-word; }
.vdl-body h2 { margin-top: 2.25rem; }
.vdl-body h3 { margin-top: 1.75rem; }
.vdl-body h2[id], .vdl-body h3[id], .vdl-body h4[id] { scroll-margin-top: 5rem; }
.vdl-body img { max-width: 100%; height: auto; }
.vdl-body pre {
	overflow-x: auto;
	padding: 1rem;
	background: var(--vdl-surface);
	border: 1px solid var(--vdl-border);
	border-radius: 14px;
}
.vdl-body code { overflow-wrap: anywhere; }
.vdl-body blockquote {
	margin: 1.25rem 0;
	padding: 0.25rem 1rem;
	border-left: 4px solid var(--vdl-accent);
	color: var(--vdl-text);
}

/* details / summary (Hinweise nur, wo im Original vorhanden) */
.vdl-body details {
	margin: 1rem 0;
	padding: 0.75rem 1rem;
	background: var(--vdl-surface);
	border: 1px solid var(--vdl-border);
	border-radius: 14px;
}
.vdl-body summary { cursor: pointer; font-weight: 600; }
.vdl-body details[open] > summary { margin-bottom: 0.5rem; }

/* Tabellen */
.vdl-table-scroll {
	max-width: 100%;
	overflow-x: auto;
	margin: 1.25rem 0;
	border: 1px solid var(--vdl-border);
	border-radius: 14px;
	background:
		linear-gradient(to right, var(--vdl-bg) 30%, rgba(255, 255, 255, 0)) left center / 2rem 100% no-repeat local,
		linear-gradient(to left, var(--vdl-bg) 30%, rgba(255, 255, 255, 0)) right center / 2rem 100% no-repeat local,
		radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0)) left center / 0.7rem 100% no-repeat scroll,
		radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0)) right center / 0.7rem 100% no-repeat scroll,
		var(--vdl-bg);
}
.vdl-scroll-hint { margin: 1rem 0 -0.75rem; font-size: 0.875rem; color: var(--vdl-muted); }
.vdl-table-scroll table { border-collapse: collapse; min-width: 32rem; width: 100%; margin: 0; }
.vdl-table-scroll th,
.vdl-table-scroll td { padding: 0.55rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--vdl-border); }
.vdl-table-scroll th { background: var(--vdl-surface); font-weight: 600; }
.vdl-table-scroll caption { text-align: left; padding: 0.5rem 0.75rem; color: var(--vdl-muted); }

/* Brotkrumen */
.vdl-breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0 0 1rem; padding: 0; font-size: 0.875rem; color: var(--vdl-muted); }
.vdl-breadcrumbs li + li::before { content: "›"; margin-right: 0.5rem; }
.vdl-breadcrumbs a { color: var(--vdl-text); }

/* Meta-Chips */
.vdl-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; padding: 0; }
.vdl-chip {
	display: inline-flex;
	gap: 0.4rem;
	align-items: baseline;
	padding: 0.2rem 0.75rem;
	font-size: 0.875rem;
	background: var(--vdl-surface);
	border: 1px solid var(--vdl-line-strong);
	border-radius: var(--vdl-radius-pill);
}
.vdl-chip-label { color: var(--vdl-muted); }
.vdl-chip-value { font-weight: 600; }
.vdl-chip-plain { border-color: var(--vdl-border); }
.vdl-phase { margin: 0; font-weight: 600; color: var(--vdl-accent); letter-spacing: 0.02em; }

/* Hinweisboxen */
.vdl-notice,
.vdl-staging {
	margin: 1rem 0;
	padding: 0.85rem 1.1rem;
	background: var(--vdl-surface);
	border: 1px solid var(--vdl-border);
	border-left: 4px solid var(--vdl-accent);
	border-radius: 12px;
}
.vdl-notice p,
.vdl-staging p { margin: 0; }
.vdl-notice-warn,
.vdl-staging { background: var(--vdl-warn-bg); border-left-color: var(--vdl-warn-line); }
.vdl-staging-chip {
	display: inline-block;
	margin: 0 0 0.5rem;
	padding: 0.1rem 0.6rem;
	font-size: 0.8125rem;
	background: var(--vdl-warn-bg);
	border: 1px solid var(--vdl-warn-line);
	border-radius: var(--vdl-radius-pill);
}
.vdl-noscript { color: var(--vdl-muted); font-size: 0.9375rem; }

/* Sprungmarken */
.vdl-toc { margin: 1.25rem 0; padding: 0.75rem 1rem; background: var(--vdl-surface); border: 1px solid var(--vdl-border); border-radius: 14px; }
.vdl-toc-title { font-size: 1rem; margin: 0 0 0.4rem; }
.vdl-toc ul { margin: 0; padding-left: 1.1rem; }
.vdl-toc .vdl-toc-l3 { margin-left: 1rem; list-style-type: circle; }
.vdl-toc a { color: var(--vdl-text); }

/* Buttons (Pill-Stil der Site) */
.vdl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 0 26px;
	font: inherit;
	font-size: 0.906rem;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	border: 0;
	border-radius: var(--vdl-radius-pill);
	transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}
.vdl-btn-dark { background: var(--vdl-ink); color: #fff; }
.vdl-btn-ghost { background: transparent; color: var(--vdl-text); box-shadow: inset 0 0 0 1px var(--vdl-line-strong); }
.vdl-btn-ghost:hover { background: var(--vdl-surface); }
.vdl-btn:hover { transform: translateY(-2px); opacity: 0.92; }
.vdl-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.vdl-btn[aria-pressed="true"] { background: var(--vdl-accent); color: var(--vdl-accent-contrast); box-shadow: none; }
.vdl-btn[hidden], [data-vdl-js-only][hidden]:not(.vdl-js-on) { display: none; }
.vdl-exam-actions,
.vdl-exam-nav,
.vdl-card-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* Fokus */
.vdl-academy pre:focus-visible,
.vdl-academy a:focus-visible,
.vdl-academy button:focus-visible,
.vdl-academy input:focus-visible,
.vdl-academy select:focus-visible,
.vdl-academy summary:focus-visible,
.vdl-academy [tabindex]:focus-visible {
	outline: 3px solid var(--vdl-focus);
	outline-offset: 3px;
	border-radius: 6px;
}

/* Abschnitte */
.vdl-section { margin: 2.25rem 0; }
.vdl-section h2 { margin-bottom: 0.5rem; }
.vdl-linklist { padding-left: 1.2rem; }

/* Modulliste */
.vdl-modules { list-style: none; counter-reset: vdl-mod; margin: 0; padding: 0; max-width: 48rem; }
.vdl-module-item {
	counter-increment: vdl-mod;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	justify-content: space-between;
	align-items: baseline;
	padding: 0.85rem 1rem;
	margin-bottom: 0.5rem;
	background: var(--vdl-surface);
	border: 1px solid var(--vdl-border);
	border-radius: 14px;
}
.vdl-module-link { font-weight: 600; color: var(--vdl-text); }
.vdl-module-link::before { content: counter(vdl-mod) ". "; color: var(--vdl-muted); font-weight: 500; }
.vdl-module-meta { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.vdl-status { font-size: 0.875rem; color: var(--vdl-muted); }
.vdl-status.is-done { color: var(--vdl-accent); font-weight: 600; }

/* Karten */
.vdl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1.25rem; }
.vdl-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.4rem;
	background: var(--vdl-surface);
	border: 1px solid var(--vdl-border);
	border-radius: var(--vdl-radius);
}
.vdl-card-title { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.vdl-card-title a { color: var(--vdl-text); text-decoration: none; }
.vdl-card-title a:hover { text-decoration: underline; }
.vdl-facts { margin: 0; }
.vdl-facts div { margin-bottom: 0.5rem; }
.vdl-facts dt { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--vdl-muted); }
.vdl-facts dd { margin: 0; }
.vdl-card-actions { margin-top: auto; }
.vdl-card-progress { margin: 0; font-size: 0.875rem; color: var(--vdl-muted); }
.vdl-order li { margin-bottom: 0.4rem; }

/* Lösung, Navigation */
.vdl-solution-link { margin: 2.25rem 0 1.5rem; padding: 1rem 1.25rem; border: 1px dashed var(--vdl-line-strong); border-radius: 14px; }
.vdl-markdone { margin: 1.5rem 0; }
.vdl-status-line { margin: 0.5rem 0 0; font-size: 0.9375rem; color: var(--vdl-muted); min-height: 1.4em; }
.vdl-prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2rem 0; }
.vdl-prevnext a {
	display: flex;
	flex-direction: column;
	padding: 0.85rem 1rem;
	text-decoration: none;
	color: var(--vdl-text);
	border: 1px solid var(--vdl-line-strong);
	border-radius: 14px;
}
.vdl-prevnext a:hover { background: var(--vdl-surface); }
.vdl-nav-next { grid-column: 2; text-align: right; }
.vdl-nav-prev { grid-column: 1; }
.vdl-nav-label { font-size: 0.8125rem; color: var(--vdl-muted); }
.vdl-nav-title { font-weight: 600; }
.vdl-back { margin-top: 2rem; }

/* Selbstbewertung */
.vdl-selfassess { margin: 2rem 0; padding: 1.25rem; background: var(--vdl-surface); border: 1px solid var(--vdl-border); border-radius: var(--vdl-radius); }
.vdl-selfassess[hidden] { display: none; }
.vdl-sa-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--vdl-border); }
.vdl-sa-row label { overflow-wrap: anywhere; }
.vdl-sa-row input[type="number"] {
	width: 5.5rem;
	min-height: 2.5rem;
	padding: 0 0.5rem;
	font: inherit;
	color: var(--vdl-text);
	background: var(--vdl-bg);
	border: 1px solid var(--vdl-line-strong);
	border-radius: 10px;
}
.vdl-sa-max { color: var(--vdl-muted); font-size: 0.875rem; }
.vdl-sa-critical { margin: 1rem 0; padding: 0; border: 0; }
.vdl-sa-critical legend { font-weight: 600; margin-bottom: 0.35rem; }
.vdl-sa-critical label { display: block; margin-bottom: 0.35rem; }
.vdl-selfassess-result { margin: 1rem 0 0; font-weight: 600; }

/* Reset, Bestätigung */
.vdl-reset { margin: 2.5rem 0; padding-top: 1rem; border-top: 1px solid var(--vdl-border); }
.vdl-confirm-inline { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* JS-Hinweis zum Speichern */
.vdl-storage-note { margin: 1rem 0; padding: 0.7rem 1rem; background: var(--vdl-warn-bg); border: 1px solid var(--vdl-warn-line); border-radius: 12px; font-size: 0.9375rem; max-width: var(--vdl-measure); }
.vdl-storage-note a, .vdl-storage-note button { color: var(--vdl-text); }
.vdl-storage-note button { font: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* Schmale Bildschirme */
@media (max-width: 40rem) {
	main.vdl-academy { padding: 1rem 0.75rem 2.5rem; }
	.vdl-prevnext { grid-template-columns: 1fr; }
	.vdl-nav-next { grid-column: 1; text-align: left; }
	.vdl-sa-row { grid-template-columns: 1fr; }
	.vdl-btn { width: 100%; }
	.vdl-exam-actions .vdl-btn,
	.vdl-exam-nav .vdl-btn,
	.vdl-card-actions .vdl-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.vdl-academy *, .vdl-academy *::before, .vdl-academy *::after {
		transition: none !important;
		animation: none !important;
		scroll-behavior: auto !important;
	}
	.vdl-btn:hover { transform: none; }
}

@media print {
	.vdl-breadcrumbs,
	.vdl-prevnext,
	.vdl-exam-nav,
	.vdl-exam-actions,
	.vdl-markdone,
	.vdl-reset,
	.vdl-card-actions,
	.vdl-toc,
	.vdl-selfassess,
	.vdl-storage-note,
	.vdl-skip,
	.vdl-btn,
	[data-vdl-js-only] { display: none !important; }
	main.vdl-academy { max-width: none; padding: 0; }
	.vdl-academy { color: #000; }
	.vdl-body a[href]::after,
	.vdl-linklist a[href]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
	.vdl-table-scroll { overflow: visible; border: 0; }
	.vdl-body details > * { display: block; }
	.vdl-body h2, .vdl-body h3 { break-after: avoid; }
	.vdl-body table, .vdl-body pre { break-inside: avoid; }
}

.vdl-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Überschriften: Fließtext-tauglich, keine Brüche mitten im Wort (lang="de" an den Wrappern) */
.vdl-academy h1,
.vdl-academy .vdl-title,
.vdl-body > h1:first-child,
body.vdl-academy-page .entry-title,
body.vdl-academy-page h1.wp-block-post-title {
	font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.6rem) !important;
	line-height: 1.2;
	hyphens: auto;
	-webkit-hyphens: auto;
	overflow-wrap: break-word;
	word-break: normal;
}
.vdl-academy h2, .vdl-academy h3 { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.vdl-content-title { margin: 0 0 0.75rem; font-weight: 700; font-size: 1.25rem; line-height: 1.3; hyphens: auto; overflow-wrap: break-word; }

/* Kein horizontaler Seiten-Scroll */
.vdl-academy { max-width: 100%; }
.vdl-selfassess, .vdl-selfassess * { min-width: 0; overflow-wrap: anywhere; }
.vdl-selfassess h2 { overflow-wrap: break-word; hyphens: auto; }
.vdl-sa-row { grid-template-columns: minmax(0, 1fr) auto; }
.vdl-prevnext { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.vdl-prevnext a, .vdl-module-item, .vdl-card { min-width: 0; overflow-wrap: anywhere; }
.vdl-body, .vdl-header, .vdl-toc { min-width: 0; }
.vdl-toc a { overflow-wrap: anywhere; }
body.vdl-academy-page .post-navigation .nav-links { display: flex; flex-wrap: wrap; gap: 1rem; }
body.vdl-academy-page .post-navigation .nav-previous,
body.vdl-academy-page .post-navigation .nav-next { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
	.vdl-sa-row { grid-template-columns: minmax(0, 1fr); }
	.vdl-prevnext { grid-template-columns: minmax(0, 1fr); }
}

/* Druck: Theme-Kopf, -Fuß und -Navigation ausblenden (nur Academy-Seiten) */
@media print {
	body.vdl-academy-page .site-header,
	body.vdl-academy-page .site-footer,
	body.vdl-academy-page #masthead,
	body.vdl-academy-page #colophon,
	body.vdl-academy-page #site-header,
	body.vdl-academy-page #site-footer,
	body.vdl-academy-page > header,
	body.vdl-academy-page > footer,
	body.vdl-academy-page #page > header,
	body.vdl-academy-page #page > footer,
	body.vdl-academy-page .wp-site-blocks > header,
	body.vdl-academy-page .wp-site-blocks > footer,
	body.vdl-academy-page .wp-block-template-part,
	body.vdl-academy-page .widget-area,
	body.vdl-academy-page .search-form,
	body.vdl-academy-page .post-navigation,
	body.vdl-academy-page .comments-area,
	body.vdl-academy-page nav,
	body.vdl-academy-page #wpadminbar,
	.vdl-scroll-hint { display: none !important; }
}

/* Phasenhinweis (Oberfläche) und Dossierhinweis */
.vdl-phase-hint { border-left: 4px solid currentColor; }
.vdl-dossier-link { margin-block: 1.25rem; }

/* Wiki-Rahmen (rscwiki): Inhalt darf nie breiter als die Spalte werden */
.rscwiki-main, .rscwiki-prose, .rscwiki-prose .vdl-academy { min-width: 0; max-width: 100%; }
.rscwiki-prose .vdl-academy { margin: 0; padding: 0; }
.rscwiki-h1, .rscwiki-toc a, .rscwiki-crumb a, .rscwiki-crumb span { overflow-wrap: anywhere; }
