/**
 * Course detail page – reading layout of the course description (Course_Content, P4).
 *
 *   .abz-course-text                 description (LearnPress .lp-course-description)
 *   .abz-modules-title               H2 of a programme section ("Kursinhalte", "Coaching-Inhalte" …)
 *   .abz-module-nav                  module overview (anchor links), from four modules on
 *   .abz-modules > .abz-module       one module: number label, title, scope ("Umfang"), contents
 *   .abz-hours / .abz-hours-total    overview of teaching units
 *
 * Text measure ~70 characters, body 16/1.65, headings from the type scale, hairlines instead
 * of boxes. The ABZiel diagonal (≈ 8°) marks module numbers – the only accent.
 * Header, sidebar and related courses are not styled here.
 */

.lp-course-description.abz-course-text {
	--abz-measure: 42rem; /* 65–75 characters per line (Inter 16 px) */
	--abz-text-gap: var(--abz-space-4);
	color: var(--abz-text);
	font-family: var(--abz-font-text);
	font-size: var(--abz-fs-16);
	line-height: 1.65;
}

/* ---------- Running text ---------- */
.lp-course-description.abz-course-text p,
.lp-course-description.abz-course-text ul,
.lp-course-description.abz-course-text ol {
	max-width: var(--abz-measure);
	margin: 0 0 var(--abz-text-gap);
}

.lp-course-description.abz-course-text strong {
	font-weight: var(--abz-weight-ui);
	color: var(--abz-text-strong);
}

.lp-course-description.abz-course-text a {
	color: var(--abz-blue-600);
	text-underline-offset: 3px;
}

/* ---------- Headings ---------- */
/* Long German compounds ("Teilnahmevoraussetzungen") never leave the column on small phones. */
.lp-course-description.abz-course-text :is(h2, h3, h4) {
	overflow-wrap: break-word;
	hyphens: auto;
}

.lp-course-description.abz-course-text h2 {
	max-width: var(--abz-measure);
	margin: var(--abz-space-8) 0 var(--abz-space-4);
	font-family: var(--abz-font-heading);
	font-size: var(--abz-fs-h2);
	font-weight: var(--abz-weight-heading);
	line-height: var(--abz-lh-tight);
	letter-spacing: var(--abz-tracking-title);
	color: var(--abz-navy-800);
	text-wrap: balance;
}

.lp-course-description.abz-course-text h3 {
	max-width: var(--abz-measure);
	margin: var(--abz-space-8) 0 var(--abz-space-3);
	font-family: var(--abz-font-heading);
	font-size: clamp(20px, calc(19.26px + .19vw), 22px);
	font-weight: var(--abz-weight-heading);
	line-height: var(--abz-lh-snug);
	color: var(--abz-navy-800);
}

.lp-course-description.abz-course-text h4 {
	margin: var(--abz-space-6) 0 var(--abz-space-2);
	font-family: var(--abz-font-heading);
	font-size: var(--abz-fs-16);
	font-weight: var(--abz-weight-heading);
	line-height: var(--abz-lh-snug);
	color: var(--abz-navy-800);
}

.lp-course-description.abz-course-text > :first-child {
	margin-top: 0;
}

/* ---------- Lists: square markers, comfortable spacing ---------- */
.lp-course-description.abz-course-text ul {
	padding: 0;
	list-style: none;
}

.lp-course-description.abz-course-text ul > li {
	position: relative;
	margin: 0;
	padding-left: var(--abz-space-6);
}

.lp-course-description.abz-course-text ul > li + li {
	margin-top: var(--abz-space-1);
}

.lp-course-description.abz-course-text ul > li::before {
	content: "";
	position: absolute;
	top: calc(.825em - 3px); /* centred on the first line (line height 1.65) */
	left: var(--abz-space-1);
	width: 6px;
	height: 6px;
	background: var(--abz-blue-600);
	border-radius: 1px;
}

.lp-course-description.abz-course-text ol {
	padding-left: var(--abz-space-6);
}

.lp-course-description.abz-course-text ol > li + li {
	margin-top: var(--abz-space-1);
}

.lp-course-description.abz-course-text li > ul,
.lp-course-description.abz-course-text li > ol {
	margin: var(--abz-space-2) 0 0;
}

/* ---------- Programme sections: module overview ---------- */
.lp-course-description.abz-course-text .abz-module-nav {
	margin: 0 0 var(--abz-space-8);
	padding: var(--abz-space-4) 0;
	border-top: 1px solid var(--abz-line);
	border-bottom: 1px solid var(--abz-line);
}

.lp-course-description.abz-course-text .abz-module-nav__list {
	max-width: none;
	margin: 0;
	padding: 0;
	list-style: none;
	column-gap: var(--abz-space-8);
}

.lp-course-description.abz-course-text .abz-module-nav__list > li {
	margin: 0;
	padding: 0;
	break-inside: avoid;
}

.lp-course-description.abz-course-text .abz-module-nav__list > li::before {
	content: none;
}

.lp-course-description.abz-course-text .abz-module-nav__link {
	display: flex;
	gap: var(--abz-space-3);
	align-items: baseline;
	padding: var(--abz-space-1) 0;
	font-size: var(--abz-fs-15);
	line-height: 1.45;
	color: var(--abz-navy-800);
	text-decoration: none;
}

.lp-course-description.abz-course-text .abz-module-nav__number {
	flex: 0 0 auto;
	min-width: 5.5em;
	font-variant-numeric: tabular-nums;
	color: var(--abz-text-muted);
}

.lp-course-description.abz-course-text .abz-module-nav__list--digits .abz-module-nav__number {
	min-width: 2ch;
}

.lp-course-description.abz-course-text .abz-module-nav__link:hover .abz-module-nav__name,
.lp-course-description.abz-course-text .abz-module-nav__link:focus-visible .abz-module-nav__name {
	color: var(--abz-blue-600);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.lp-course-description.abz-course-text .abz-module-nav__link:focus-visible {
	outline: 2px solid var(--abz-blue-600);
	outline-offset: 2px;
	border-radius: var(--abz-radius-xs);
}

/* Separator ":" stays in the text for screen readers; the layout shows number and name apart. */
.lp-course-description.abz-course-text .abz-module__sep {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Modules ---------- */
.lp-course-description.abz-course-text .abz-modules {
	margin: 0 0 var(--abz-space-8);
	border-top: 1px solid var(--abz-line);
}

.lp-course-description.abz-course-text .abz-module-nav + .abz-modules {
	border-top: 0; /* the overview's lower line separates the first module */
}

.lp-course-description.abz-course-text .abz-module-nav:has(+ .abz-modules) {
	margin-bottom: 0;
}

.lp-course-description.abz-course-text .abz-module {
	padding: var(--abz-space-5) 0;
	border-bottom: 1px solid var(--abz-line);
	scroll-margin-top: calc(var(--abz-sticky-top) + var(--abz-space-6)); /* anchor below the sticky header */
}

/* Logged in: WordPress already adds the admin bar as scroll padding – count it only once. */
body.admin-bar .lp-course-description.abz-course-text .abz-module {
	scroll-margin-top: calc(var(--abz-site-header-height) + var(--abz-space-6));
}

.lp-course-description.abz-course-text .abz-module__title {
	display: flex;
	flex-direction: column;
	gap: var(--abz-space-2);
	margin: 0 0 var(--abz-space-3);
}

.lp-course-description.abz-course-text .abz-module__number {
	display: inline-flex;
	align-items: center;
	gap: var(--abz-space-2);
	font-family: var(--abz-font-text);
	font-size: var(--abz-fs-14);
	font-weight: var(--abz-weight-ui);
	line-height: 1.3;
	letter-spacing: .02em;
	font-variant-numeric: tabular-nums;
	color: var(--abz-blue-700);
}

/* Signature: the ABZiel diagonal. */
.lp-course-description.abz-course-text .abz-module__number::before {
	content: "";
	flex: 0 0 auto;
	width: 3px;
	height: 14px;
	background: var(--abz-blue-600);
	transform: skewX(-8deg);
}

.lp-course-description.abz-course-text .abz-module--digit .abz-module__title {
	flex-direction: row;
	align-items: baseline;
	gap: var(--abz-space-3);
}

/* Plain numbers ("1.", "2." …) stand in front of the name, at title size. */
.lp-course-description.abz-course-text .abz-module--digit .abz-module__number {
	align-self: baseline;
	font-family: var(--abz-font-heading);
	font-size: inherit;
	font-weight: var(--abz-weight-heading);
	letter-spacing: 0;
}

.lp-course-description.abz-course-text .abz-module--digit .abz-module__number::before {
	height: .8em;
}

.lp-course-description.abz-course-text .abz-module__body > :last-child {
	margin-bottom: 0;
}

.lp-course-description.abz-course-text .abz-module__body > .abz-module__label:first-child {
	margin-top: var(--abz-space-4);
}

/* Scope ("Umfang: 20 Unterrichtseinheiten") */
.lp-course-description.abz-course-text .abz-module__scope {
	display: inline-block;
	margin: 0 0 var(--abz-space-1);
	padding: var(--abz-space-1) var(--abz-space-3);
	background: var(--abz-surface);
	border-radius: var(--abz-radius-sm);
	font-size: var(--abz-fs-14);
	line-height: 1.5;
	font-variant-numeric: tabular-nums;
	color: var(--abz-text-strong);
}

.lp-course-description.abz-course-text .abz-module__scope strong {
	font-weight: var(--abz-weight-ui);
}

/* "Inhalte", "Methodik" */
.lp-course-description.abz-course-text .abz-module__label {
	margin: var(--abz-space-4) 0 var(--abz-space-1);
	font-family: var(--abz-font-text);
	font-size: var(--abz-fs-14);
	font-weight: var(--abz-weight-ui);
	letter-spacing: .02em;
	color: var(--abz-text-muted);
}

/* ---------- Overview of teaching units ---------- */
.lp-course-description.abz-course-text ul.abz-hours {
	border-top: 1px solid var(--abz-line);
}

.lp-course-description.abz-course-text ul.abz-hours > li {
	display: flex;
	flex-wrap: wrap; /* narrow screens: the value moves below the name instead of overflowing */
	justify-content: space-between;
	align-items: baseline;
	column-gap: var(--abz-space-4);
	margin: 0;
	padding: var(--abz-space-1) 0;
	border-bottom: 1px solid var(--abz-line);
}

.lp-course-description.abz-course-text ul.abz-hours > li::before {
	content: none;
}

.lp-course-description.abz-course-text ul.abz-hours strong {
	flex: 0 0 auto;
	margin-left: auto;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.lp-course-description.abz-course-text .abz-hours-total {
	margin-top: calc(-1 * var(--abz-space-2));
	padding: var(--abz-space-3) 0 0;
	font-variant-numeric: tabular-nums;
}

.lp-course-description.abz-course-text .abz-hours-total strong {
	font-weight: var(--abz-weight-heading);
	color: var(--abz-navy-800);
}

/* Touch screens: overview links as comfortable tap targets. */
@media (pointer: coarse), (max-width: 1024px) {
	.lp-course-description.abz-course-text .abz-module-nav__link {
		box-sizing: border-box;
		min-height: 44px;
		padding: var(--abz-space-2) 0;
	}
}

/* ---------- Wider screens ---------- */
@media (min-width: 768px) {
	.lp-course-description.abz-course-text .abz-module-nav__list {
		columns: 2;
	}
}

@media (min-width: 1200px) {
	/* Many short items: two columns inside the module. */
	.lp-course-description.abz-course-text ul.abz-list-columns {
		max-width: none;
		columns: 2;
		column-gap: var(--abz-space-8);
	}

	.lp-course-description.abz-course-text ul.abz-list-columns > li {
		break-inside: avoid;
	}

	/* Spacing below each item, so both columns start on the same line. */
	.lp-course-description.abz-course-text ul.abz-list-columns > li,
	.lp-course-description.abz-course-text ul.abz-list-columns > li + li {
		margin: 0;
		padding-bottom: var(--abz-space-1);
	}
}

/* ---------- Small screens ---------- */
@media (max-width: 767px) {
	.lp-course-description.abz-course-text .abz-module {
		padding: var(--abz-space-4) 0;
	}

	.lp-course-description.abz-course-text .abz-module-nav {
		margin-bottom: var(--abz-space-6);
		padding: var(--abz-space-2) 0;
	}
}
