/* LearnDash layer 5/6: focus mode (header, sidebar, content, bottom actions). See base.css for the cascade strategy.
   Tier A = `.learndash-wrapper .ld-focus` (LD30's own focus rules may win by specificity), tier B = boosted (LD inline colour CSS). */
.ld-focus .ld-focus-sidebar-wrapper { background: var(--wp--preset--color--surface-raised); color: var(--wp--preset--color--contrast); border-color: var(--wp--preset--color--border); }
.ld-focus .ld-focus-content { background: var(--wp--preset--color--base); color: var(--wp--preset--color--contrast); }
.ld-focus .ld-focus-sidebar { color: var(--wp--preset--color--contrast); border-color: var(--wp--preset--color--border); }
.ld-focus .ld-focus-sidebar .ld-is-current-item { background: var(--wp--preset--color--surface); box-shadow: inset 3px 0 0 var(--wp--preset--color--accent); }
.ld-focus .ld-focus-sidebar :where(.ld-lesson-title, .ld-topic-title, .ld-lesson-section-heading) { color: var(--wp--preset--color--heading); }
.ld-focus .ld-focus-header .ld-brand-logo,
.ld-focus .ld-focus-header :where(a, .ld-course-navigation-heading, .ld-content-action) { color: var(--wp--preset--color--heading); }
.ld-focus .ld-focus-sidebar .ld-progress-bar { background: var(--wp--preset--color--border); }

/* ================= tier A ================= */
.learndash-wrapper .ld-focus {
	--sddsg-focus-header: 4rem; background: var(--wp--preset--color--surface);
	.ld-focus-main { background: var(--wp--preset--color--surface); min-block-size: 100dvb; }
	/* Sidebar starts below our taller fixed header (LD30 reserves only 50px -> the course title slid under the header). */
	.ld-focus-sidebar { padding-block-start: var(--sddsg-focus-header) !important; }

	.ld-focus-header {
		background: var(--wp--preset--color--hero) !important; color: var(--wp--preset--color--on-hero); border: 0; min-block-size: var(--sddsg-focus-header);
		display: flex; align-items: center; gap: 1rem; padding-inline: 1.25rem; box-shadow: 0 1px 0 rgb(255 255 255 / .06);
		:where(.ld-content-actions, .ld-content-action, .ld-user-menu, .ld-progress, .ld-brand-logo) { border-color: transparent; }
		.ld-brand-logo { background: none; border: 0; flex: none; }
		.ld-brand-logo img { max-block-size: 2.5rem; inline-size: auto; }
		:where(a, .ld-text, .ld-user-welcome-text, .ld-icon) { color: var(--wp--preset--color--on-hero) !important; }
		.ld-progress { background: none; border: 0; box-shadow: none; padding: 0; margin: 0; flex: 1 1 12rem; max-inline-size: 28rem; }
		.ld-progress .ld-progress-stats { color: var(--wp--preset--color--on-hero); }
		.ld-progress :where(.ld-progress-percentage, .ld-progress-steps) { color: var(--wp--preset--color--on-hero) !important; font-size: var(--wp--preset--font-size--x-small); }
		.ld-progress .ld-progress-bar { background: rgb(255 255 255 / .22); }
		.ld-content-actions { border: 0; padding: 0; margin-inline-start: auto; gap: .5rem; }
		.ld-content-actions .ld-button.ld-button-transparent .ld-icon { color: inherit !important; }
		.ld-user-menu .ld-user-welcome-text { display: none; }
	}
	.ld-focus-sidebar { background: var(--wp--preset--color--surface-raised); border-inline-end: 1px solid var(--wp--preset--color--border); }
	.ld-focus-sidebar {
		.ld-course-navigation-heading { background: var(--wp--preset--color--surface-raised) !important; color: var(--wp--preset--color--muted); border-block-end: 1px solid var(--wp--preset--color--border); }
		.ld-course-navigation-heading :where(h3, a, .ld-icon) { color: var(--wp--preset--color--muted) !important; font-size: var(--wp--preset--font-size--x-small); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
		.ld-lesson-item { border: 0; border-block-end: 1px solid var(--wp--preset--color--border); }
		.ld-lesson-item-preview-heading { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.25rem; text-decoration: none; }
		.ld-lesson-title { font-size: var(--wp--preset--font-size--small); font-weight: 500; line-height: 1.35; color: var(--wp--preset--color--heading); }
		.ld-lesson-item.ld-is-current-lesson { background: var(--wp--preset--color--surface); box-shadow: inset 3px 0 0 var(--wp--preset--color--accent); }
		.ld-lesson-item.ld-is-current-lesson .ld-lesson-title { font-weight: 700; }
		/* lesson list inherits the raised surface (LD paints it white) */
		:where(.ld-course-navigation, .ld-course-navigation-list, .ld-lesson-navigation, .ld-lesson-items, .ld-lesson-item, .ld-lesson-item-preview, .ld-lesson-item-section-heading) { background: transparent; }
		.ld-lesson-item-preview-heading:hover .ld-lesson-title { text-decoration: underline; text-underline-offset: 3px; }
		.ld-course-navigation .ld-lesson-navigation .ld-lesson-items .ld-lesson-item:not(.ld-is-current-lesson) { background: transparent !important; }
		/* topics nested under the open lesson */
		.ld-course-navigation .ld-topic-list.ld-table-list { background: var(--wp--preset--color--surface); border: 0; border-radius: 0; box-shadow: none; padding-block: .25rem; }
		.ld-course-navigation .ld-topic-list .ld-table-list-item { background: transparent; border: 0; }
		.ld-topic-list .ld-table-list-item-preview { display: flex; align-items: center; gap: .65rem; padding: .5rem 1.25rem .5rem 2.5rem; text-decoration: none; }
		.ld-topic-list .ld-topic-title { font-size: var(--wp--preset--font-size--x-small); color: var(--wp--preset--color--contrast); font-weight: 500; }
		.ld-topic-list :is(.ld-table-list-item.ld-is-current-item .ld-table-list-item-preview, .ld-table-list-item-preview.ld-is-current-item) { background: var(--wp--preset--color--info-bg); }
		.ld-topic-list .ld-is-current-item .ld-topic-title { color: var(--wp--preset--color--heading); font-weight: 700; }
		.ld-topic-list .ld-status-icon { inline-size: 1.15rem; block-size: 1.15rem; }
		.ld-lesson-item, .ld-lesson-item.ld-is-current-lesson, .ld-lesson-item-preview { border-color: var(--wp--preset--color--border); }
	}
	.ld-focus-content {
		background: var(--wp--preset--color--surface); padding-block: clamp(1rem, 3vw, 2.5rem); padding-inline: clamp(1rem, 4vw, 2.5rem);
		/* Phones: small enough that long German compounds ("Datenschutzgrundverordnung") fit on a line instead of breaking mid-word
		   where the browser has no hyphenation dictionary; balanced lines, hyphenation stays on (responsive.css). */
		> h1 { font-size: clamp(1.3125rem, .95rem + 1.4vw, 2rem); text-wrap: balance; line-height: 1.2; margin-block: 0 1rem; color: var(--wp--preset--color--heading); max-inline-size: 56rem; }
		.learndash-wrapper { max-inline-size: 56rem; }
		:is(.learndash-wrapper, .learndash, .ld-tabs, .ld-tabs-content) { background: transparent; }
		.ld-tabs .ld-tabs-content { border: 0; padding-inline: 0; }
		.ld-lesson-status { margin-block-end: 1rem; }
		.ld-video :is(.wp-video, .mejs-container, video) { border-radius: var(--wp--custom--radius--lg); }
		.ld-video :is(.wp-video, .mejs-container) { aspect-ratio: 16 / 9; inline-size: 100% !important; block-size: auto !important; background: #0f2538; } /* reserve space: no layout jump (letterbox colour of the player: always dark, see player.css) */
		.ld-video video { inline-size: 100% !important; block-size: 100% !important; object-fit: cover; }
		:where(.ld-tab-content > p, .ld-tab-content li) { font-size: var(--wp--preset--font-size--medium); line-height: 1.7; color: var(--wp--preset--color--muted); }
		.ld-tab-content :where(h2, h3) { margin-block: 1.5rem .5rem; }
	}
	/* Kadence progress bar embedded in video lessons: thin gold pill instead of default blue */
	.kb-progress-bar-container {
		.kb-progress-bar { border-radius: var(--wp--custom--radius--pill); overflow: hidden; block-size: 0.5rem !important; }
		.kb-progress-bar > div, .kb-progress-bar .kb-progress-bar-inner-wrap > * { background: var(--wp--preset--color--accent) !important; }
		.kb-progress-label-wrap { font-size: var(--wp--preset--font-size--x-small); color: var(--wp--preset--color--muted); }
		.kb-progress-bar svg path:last-child { stroke: var(--wp--preset--color--accent) !important; }
	}
	@media (max-width: 768px) { /* LD30 switches to the mobile header at <= 768px (same breakpoint as responsive.css) */
		.ld-focus-header { padding-inline: .75rem; gap: .75rem; flex-wrap: nowrap; block-size: var(--sddsg-focus-header); }
		.ld-focus-header .ld-mobile-nav .ld-trigger-mobile-nav span { background: var(--wp--preset--color--on-hero) !important; }
		.ld-focus-header .ld-progress { flex: 1 1 auto; max-inline-size: none; min-inline-size: 0; }
		.ld-focus-header .ld-content-actions { display: none; } /* same actions are repeated below the content */
		.ld-focus-header .ld-user-menu { flex: none; }
		.ld-focus-content .ld-content-actions { flex-wrap: wrap; }
		.ld-focus-content .ld-content-actions .ld-content-action, .ld-focus-content .ld-content-actions .ld-content-action > * { inline-size: 100%; }
	}
}
.ld-focus .ld-focus-content :is(.ld-quiz-status, .ld-topic-status) { margin-block-end: 1rem; }

/* ================= tier B (boosted) ================= */
.learndash-wrapper:not(.sddsg-b) .ld-focus {
	.ld-focus-header {
		.ld-content-actions .ld-content-action { padding: 0; border: 0 !important; } /* LD separator line between prev and mark-complete */
		.ld-content-action.ld-empty { display: none; }
		.sfwd-mark-complete .learndash_mark_complete_button { /* header mark-complete = small gold CTA; LD inline CSS sets it transparent */
			background: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; border: 0 !important; min-block-size: 2.25rem; padding-block: 0; padding-inline: 1.1em;
		}
		.sfwd-mark-complete .learndash_mark_complete_button { background-image: none !important; padding-inline: 1.25rem !important; } /* label only, centered */
		.ld-user-menu { border: 0; padding-inline: .5rem 1rem; }
		.ld-user-menu .ld-profile-avatar {
			inline-size: 2.75rem; block-size: 2.75rem; border-radius: 50%; border: 2px solid var(--wp--preset--color--accent); background-color: var(--wp--preset--color--navy); /* fixed brand navy, same as the sddsg-core initials avatar */
			overflow: hidden; flex: none; position: relative; margin: 0;
		}
		.ld-user-menu .ld-profile-avatar { position: relative; display: block; overflow: hidden; box-sizing: border-box; flex: none; }
		.ld-user-menu .ld-profile-avatar img { position: absolute; inset: 0; inline-size: 100% !important; block-size: 100% !important; max-inline-size: none; object-fit: cover; display: block; border-radius: 50%; margin: 0; }
		.ld-user-menu .ld-profile-avatar:not(:has(img))::before { /* fallback glyph: get_avatar() returns false because esc_url strips the data: URL */
			content: ""; position: absolute; inset: 0; -webkit-mask: none; mask: none; background-color: transparent;
			background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e9a13b'%3E%3Ccircle cx='12' cy='9' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7z'/%3E%3C/svg%3E");
			background-repeat: no-repeat; background-position: center 60%; background-size: 70%;
		}
		.ld-user-menu .ld-user-menu-items { /* readable links on a rounded navy panel (both modes) */
			background: var(--wp--preset--color--header) !important; border: 1px solid var(--sddsg-hairline, rgb(255 255 255 / .14));
			border-radius: var(--wp--custom--radius--md); padding: 0.375rem; min-inline-size: 12rem; box-shadow: var(--wp--preset--shadow--md); overflow: hidden;
			&::before { display: none; }
			a { display: block; padding: 0.625rem 0.875rem; border-radius: var(--wp--custom--radius--sm); background: transparent !important; color: var(--wp--preset--color--on-hero) !important; text-decoration: none; font-weight: 600; font-size: 0.9375rem; }
			a:is(:hover, :focus-visible) { background: rgb(255 255 255 / .12) !important; color: var(--wp--preset--color--accent) !important; }
		}
		.ld-content-actions .ld-content-action a.ld-button.ld-button-transparent {
			background: transparent !important; border: 1px solid rgb(255 255 255 / .4) !important; color: var(--wp--preset--color--on-hero) !important; min-block-size: 2.25rem; padding-block: 0; box-shadow: none;
			&:hover { background: rgb(255 255 255 / .12) !important; }
		}
	}

	.ld-focus-sidebar {
		.ld-lesson-item.ld-is-current-lesson .ld-status-icon { border-color: var(--wp--preset--color--accent); border-width: 2px; }
		/* Open steps: LD paints the ring #e2e7ed (bright in dark, 1.2:1 in light) and the current one with its inline primary colour
		   (!important, navy -> invisible in dark). Tokens instead: upcoming = border-strong, current = primary, both >= 3:1 in both schemes. */
		.ld-status-icon.ld-status-incomplete { border-color: var(--wp--preset--color--border-strong); }
		.ld-lesson-item.ld-is-current-lesson .ld-status-icon.ld-status-incomplete { border-color: var(--wp--preset--color--primary) !important; }
		/* LD30's focus-mode rule re-sets the row separator to #e2e7ed (white lines across the dark sidebar). */
		.ld-course-navigation .ld-lesson-item { border-block-end-color: var(--wp--preset--color--border); }
		/* Hover feedback: wash on the row link (the current row already carries it), underline on the course title. */
		.ld-lesson-item:not(.ld-is-current-lesson) a.ld-lesson-item-preview-heading { border-radius: var(--wp--custom--radius--sm); transition: background-color var(--sddsg-ease); }
		.ld-lesson-item:not(.ld-is-current-lesson) a.ld-lesson-item-preview-heading:hover { background: var(--wp--preset--color--surface); }
		.ld-lesson-item a.ld-lesson-item-preview-heading:active { background: var(--wp--preset--color--border); }
		.ld-course-navigation-heading a:active, .ld-focus-sidebar-trigger:active { opacity: .7; }
		.ld-course-navigation-heading h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
		.ld-course-navigation-heading {
			display: flex; align-items: center; gap: .75rem; min-block-size: 4.5rem; padding: .5rem 4rem .5rem 1.25rem; position: relative; overflow: visible;
			h3 { flex: 1 1 auto; min-inline-size: 0; margin: 0; padding: 0; display: flex; align-items: center; align-self: center; line-height: 1.35; height: auto !important; min-height: 0 !important; }
			h3 a {
				display: block; position: relative; inline-size: 100%; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline-start: 1.875rem;
				font-size: var(--wp--preset--font-size--small); line-height: 1.5; font-weight: 700; text-transform: none; letter-spacing: 0; text-decoration: none; color: var(--wp--preset--color--heading) !important;
			}
			h3 a .ld-icon {
				position: absolute !important; inset-inline-start: 0; inset-block-start: 50%; transform: translateY(-50%); flex: none; inline-size: 1.25rem; block-size: 1.25rem; margin: 0;
				display: inline-flex; align-items: center; justify-content: center; font-size: 1.125rem; line-height: 1; letter-spacing: 0; color: var(--wp--preset--color--accent) !important;
			}
		}
		.ld-expand-button .ld-text { color: var(--wp--preset--color--muted) !important; font-size: var(--wp--preset--font-size--x-small); }
		.ld-focus-sidebar-trigger { /* plain icon button, no ring; 44px hit area */
			position: absolute; inset-block: 0; margin-block: auto; inset-inline-end: .25rem; transform: none; inline-size: 2.75rem; block-size: 2.75rem; border-radius: var(--wp--custom--radius--sm);
			display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; z-index: 3;
			transition: background-color var(--sddsg-ease), border-color var(--sddsg-ease);
			&:focus-visible { outline: 3px solid var(--wp--preset--color--focus); outline-offset: 2px; }
			.ld-icon { position: static; transform: none; padding: 0; background: none; border-radius: 0; font-size: 1.125rem; line-height: 1; display: inline-flex; }
			&:hover .ld-icon::before { opacity: 1; }
		}
		.ld-course-navigation-heading .ld-focus-sidebar-trigger {
			background: transparent !important; color: var(--wp--preset--color--heading) !important; border: 0; box-shadow: none;
			&:hover { background: var(--wp--preset--color--surface) !important; }
			.ld-icon { color: var(--wp--preset--color--heading) !important; }
		}
	}
	&.ld-focus-sidebar-collapsed .ld-focus-sidebar-wrapper .ld-focus-sidebar-trigger .ld-icon { transform: rotate(180deg); }

	.ld-focus-content {
		:is(.ld-lesson-status, .ld-topic-status, .ld-quiz-status) { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
		.ld-breadcrumbs {
			background: var(--wp--preset--color--surface-raised); border: 0; border-radius: var(--wp--custom--radius--lg); box-shadow: none; outline: 0;
			padding: .625rem 1rem; gap: .5rem 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between;
		}
		.ld-breadcrumbs .ld-breadcrumbs-segments { font-size: var(--wp--preset--font-size--small); }
		.ld-breadcrumbs .ld-breadcrumbs-segments a:hover { text-decoration: underline; text-decoration-thickness: var(--sddsg-link-thickness-hover, 2px); text-underline-offset: var(--sddsg-link-offset, .2em); }
		.ld-breadcrumbs .ld-breadcrumbs-segments a:active { opacity: .7; }
		/* Single-panel "tabs": LD keeps tabindex="0" on the tabpanel -> no ring around the whole lesson content. */
		.ld-tabs.ld-tab-count-1 .ld-tab-content:focus-visible { outline: none; }
		.ld-breadcrumbs .ld-status { display: inline-flex; align-items: center; align-self: flex-start; font-size: .875rem; line-height: 1.3; font-weight: 700; padding: .4rem 1rem; text-transform: none; letter-spacing: .01em; border-radius: var(--wp--custom--radius--pill); border: 0; }
		.ld-breadcrumbs .ld-status::before { content: ""; inline-size: .5rem; block-size: .5rem; border-radius: 50%; background: currentColor; margin-inline-end: .5rem; }
		.ld-course-step-back { display: inline-flex; align-items: center; justify-content: center; min-block-size: 2.75rem; padding-inline: .5rem; font-size: var(--wp--preset--font-size--small); font-weight: 600; color: var(--wp--preset--color--link) !important; text-decoration: underline; text-underline-offset: .2em; }
		.ld-course-step-back:hover { text-decoration-thickness: 2px; }
		.learndash_mark_complete_button { white-space: nowrap; min-block-size: var(--sddsg-btn-h); padding-block: .5rem; padding-inline: 1.75rem; justify-content: center; gap: .625rem; line-height: 1.2; font-size: var(--sddsg-btn-size); font-weight: var(--sddsg-btn-weight); text-align: center; }
	}
	form.sfwd-mark-complete::after { display: none !important; content: none !important; } /* check icon is the button background instead */
	.learndash_mark_complete_button {
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2b3e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") !important;
		background-repeat: no-repeat !important; background-position: 1.1rem 50% !important; background-size: 1.1rem !important; padding-inline-start: 2.9rem !important; white-space: nowrap;
	}

	/* bottom actions (prev/next/back/mark complete): fixed 2x2 grid, see responsive.css */

	/* Skip link sits inside .learndash-wrapper: the wrapper's link colour painted it navy on navy (light) / blue on gold (dark). */
	a.sddsg-skip-link:is(:link, :visited) { color: var(--wp--preset--color--on-primary); }
	a.sddsg-skip-link:focus-visible { outline-color: var(--sddsg-ring-on-dark); } /* it lands on the navy header */
	/* (Header is navy in both schemes: its gold ring comes from the focus token scope in components.css.) */
}
/* LD paints the body white behind .ld-focus: shows as a white strip on overscroll / horizontal overflow in dark. */
body.ld-in-focus-mode { background: var(--wp--preset--color--surface); }

/* Video: round all four corners (controls bar + poster were square at the bottom, user 2026-11-07). */
.learndash-wrapper .ld-focus-content :is(.wp-video, .mejs-container, .ld-video iframe, .wp-block-embed iframe) { border-radius: var(--wp--custom--radius--lg); overflow: hidden; }
.learndash-wrapper .ld-focus-content :is(.mejs-container .mejs-controls, .mejs-container .mejs-layers, .mejs-container video, .mejs-container .mejs-poster) { border-radius: 0; }

/* Theme footer inside focus mode: LD's link colours would paint the footer links navy-on-navy. */
.ld-focus .sddsg-footer a { color: var(--wp--preset--color--on-hero) !important; background: none !important; }
/* ...and the same hover as in the normal footer (accent + underline), which the !important above had removed. */
.ld-focus .sddsg-footer a:is(:hover, :focus-visible) { color: var(--wp--preset--color--accent) !important; text-decoration: underline; text-decoration-thickness: var(--sddsg-link-thickness-hover, 2px); }
.ld-focus .sddsg-footer a:active { color: var(--wp--preset--color--accent) !important; opacity: 0.8; }
/* Logo links (focus header + footer): same feedback as the site header logo. */
.ld-focus :is(.ld-brand-logo a, .sddsg-footer .custom-logo-link):hover { opacity: 0.88; }
.ld-focus :is(.ld-brand-logo a, .sddsg-footer .custom-logo-link):active { opacity: 0.7; }

/* Focus mode: theme footer is the last element of .ld-focus-main -> column layout, footer pushed to the bottom on short lessons. */
.learndash-wrapper .ld-focus .ld-focus-main { display: flex; flex-direction: column; min-block-size: calc(100dvb - var(--wp-admin--admin-bar--height, 0px)); }
.learndash-wrapper .ld-focus .ld-focus-main > .ld-focus-content { flex: 1 0 auto; inline-size: 100%; box-sizing: border-box; }
.learndash-wrapper .ld-focus .ld-focus-main > :is(footer, .wp-block-template-part, .sddsg-footer):last-child { margin-block-start: auto; }
