/*
 * Lesson player (single-ah_lesson.php), loaded after content.css on lesson pages only. A main column
 * (video, title, lesson text, files, finished button, ask, previous/next) and a sticky sidebar with
 * the course, the progress and the curriculum by module. Up to 1024px the sidebar gives way to a
 * "Course lessons" <details> drawer under the video. Focus mode (html.ahpl-focus, set by player.js
 * and by the head script from the viewer's stored choice) hides the site header and footer and
 * widens the player.
 *
 * Classes start with "ahpl-". Tokens are the --aht-* aliases (fallbacks in templates.css). Logical
 * properties only; breakpoints 1366 / 1200 / 1024 / 767. Everything works without JS: modules and
 * the drawer are <details>; the focus button stays hidden until player.js shows it.
 */

.ahpl {
	--ahpl-w: var(--aht-wrap-w, 1240px);
	--ahpl-side: 360px;
	--ahpl-gap: 40px;
	--ahpl-top: calc(var(--aht-top, 136px) - 24px);
	--ahpl-stick: 96px;
	padding-block: var(--ahpl-top) clamp(56px, 6vw, 88px);
	background: var(--aht-ivory);
	color: var(--aht-ink);
	font-family: var(--aht-f-body);
	font-size: 17px;
	line-height: 1.75;
	letter-spacing: 0;
}
.admin-bar .ahpl { --ahpl-stick: 128px; }

.ahpl .ahpl-wrap {
	box-sizing: border-box;
	max-width: var(--ahpl-w);
	margin-inline: auto;
	padding-inline: var(--aht-gutter);
	transition: max-width .45s var(--aht-ease);
}

/* ---------- top bar: breadcrumb and the focus button ---------- */
.ahpl .ahpl-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-block-end: 20px; }
.ahpl .ahpl-top .aht-crumbs { min-width: 0; }
.ahpl .ahpl-focus-btn {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 6px 14px;
	border: 1px solid var(--aht-card-line);
	border-radius: 999px;
	background: var(--aht-card);
	color: var(--aht-ink);
	box-shadow: var(--aht-shadow);
	font-family: var(--aht-f-body);
	font-size: .84rem;
	font-weight: 700;
	line-height: 1.5;
	cursor: pointer;
	transition: border-color .25s, background-color .25s, color .25s;
}
.ahpl .ahpl-focus-btn[hidden] { display: none; }
.ahpl .ahpl-focus-btn:hover,
.ahpl .ahpl-focus-btn:focus-visible { border-color: var(--aht-tint-line); background: var(--aht-tint); color: var(--aht-ink-gold); }
.ahpl .ahpl-focus-btn[aria-pressed="true"] { border-color: var(--aht-navy); background: var(--aht-navy); color: var(--aht-on-navy); }
.ahpl .ahpl-focus-btn[aria-pressed="true"]:hover,
.ahpl .ahpl-focus-btn[aria-pressed="true"]:focus-visible { border-color: var(--aht-navy-2); background: var(--aht-navy-2); color: var(--aht-gold-hi); }
.ahpl .ahpl-focus-btn svg { flex: none; width: 16px; height: 16px; }
.ahpl .ahpl-focus-btn .ahpl-focus-btn__off,
.ahpl .ahpl-focus-btn[aria-pressed="true"] .ahpl-focus-btn__on { display: none; }
.ahpl .ahpl-focus-btn[aria-pressed="true"] .ahpl-focus-btn__off { display: block; }

/* ---------- grid ---------- */
.ahpl .ahpl-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--ahpl-side); gap: var(--ahpl-gap); align-items: start; }
.ahpl .ahpl-grid.ahpl-grid--solo { grid-template-columns: minmax(0, 1fr); max-width: calc(980px + 2 * var(--aht-gutter)); }
.ahpl .ahpl-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; min-width: 0; }
.ahpl .ahpl-main > * { min-width: 0; }

/* video */
.ahpl .ahpl-video .ahcn-video__btn,
.ahpl .ahpl-video .ahcn-video__frame { border-radius: var(--aht-r); }

/* title block */
.ahpl .ahpl-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; justify-items: start; }
.ahpl .ahpl-head > * { max-width: 100%; min-width: 0; }
.ahpl .ahpl-head .ahpl-title {
	margin: 0;
	font-family: var(--aht-f-display);
	font-weight: 800;
	font-size: clamp(1.6rem, 2.6vw, 2.25rem);
	line-height: 1.35;
	letter-spacing: 0;
	color: var(--aht-ink);
	text-wrap: balance;
}
.ahpl .ahpl-head .aht-meta { margin: 0; }
.ahpl .ahpl-head .aht-meta li[hidden] { display: none; }

/* lesson text (the prose sits at the start of the column, not centred) */
.ahpl .ahpl-body .aht-prose { width: auto; max-width: var(--aht-prose-w, 720px); margin-inline: 0; }
/* copy deterrent for viewers who cannot edit (player.js also blocks the menu and copying here);
   code blocks stay selectable, and player.js gives each a copy button */
.ahpl .ahpl-guard { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ahpl .ahpl-guard pre,
.ahpl .ahpl-guard pre * { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.ahpl .aht-prose .ahpl-code { position: relative; margin: 1.8em 0; }
.ahpl .aht-prose .ahpl-code > pre { margin: 0; padding-top: 46px; }
.ahpl .ahpl-copy {
	position: absolute;
	top: 10px;
	right: 10px;
	padding: 4px 12px;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 999px;
	background: rgba(255, 255, 255, .06);
	color: var(--aht-on-navy);
	font: 500 .78rem/1.6 var(--aht-f-body);
	cursor: pointer;
	transition: background-color .2s, border-color .2s;
}
.ahpl .ahpl-copy:hover { background: rgba(255, 255, 255, .14); }
.ahpl .ahpl-copy:focus-visible { outline: 2px solid var(--aht-gold, #C5A572); outline-offset: 2px; }
.ahpl .ahpl-copy.is-done { border-color: var(--aht-gold-hi, #E8C988); color: var(--aht-gold-hi, #E8C988); }

/* ---------- cards: files, ask ---------- */
.ahpl .ahpl-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 12px;
	justify-items: start;
	padding: clamp(20px, 2.4vw, 28px);
	border: 1px solid var(--aht-card-line);
	border-radius: var(--aht-r);
	background: var(--aht-card);
	box-shadow: var(--aht-shadow);
}
.ahpl .ahpl-card > * { max-width: 100%; }
.ahpl .ahpl-card .ahpl-card__t { margin: 0; font-family: var(--aht-f-display); font-weight: 800; font-size: 1.15rem; line-height: 1.45; letter-spacing: 0; color: var(--aht-ink); }
.ahpl .ahpl-card .ahpl-card__x { margin: 0; max-width: 64ch; font-size: .95rem; line-height: 1.75; color: var(--aht-muted); }
.ahpl .ahpl-ask { border-color: var(--aht-tint-line); background: var(--aht-tint); box-shadow: none; }

.ahpl .ahpl-files__list { display: grid; gap: 8px; width: 100%; margin: 0; padding: 0; list-style: none; }
.ahpl .ahpl-files__list li { margin: 0; }
.ahpl .ahpl-file {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr) auto 20px;
	gap: 14px;
	align-items: center;
	padding: 10px 14px;
	border: 1px solid var(--aht-line);
	border-radius: var(--aht-r-sm);
	background: var(--aht-paper);
	color: var(--aht-ink);
	text-decoration: none;
	transition: border-color .25s, background-color .25s;
}
.ahpl .ahpl-file:hover { border-color: var(--aht-tint-line); background: var(--aht-tint); color: var(--aht-ink); }
.ahpl .ahpl-file .ahpl-file__ic { display: grid; place-items: center; height: 40px; border-radius: 10px; background: var(--aht-navy); color: var(--aht-gold-hi); font-family: var(--aht-f-mono); font-weight: 600; font-size: .64rem; letter-spacing: .06em; line-height: 1; }
.ahpl .ahpl-file .ahpl-file__n { overflow: hidden; font-weight: 600; font-size: .95rem; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.ahpl .ahpl-file .ahpl-file__s { font-family: var(--aht-f-mono); font-size: .78rem; white-space: nowrap; color: var(--aht-soft); direction: ltr; unicode-bidi: isolate; }
.ahpl .ahpl-file .ahpl-file__dl { display: grid; place-items: center; color: var(--aht-ink-gold); }
.ahpl .ahpl-files .ahpl-files__note { margin: 0; font-size: .8rem; line-height: 1.6; color: var(--aht-soft); }

/* ---------- finished button and next lesson ---------- */
.ahpl .ahpl-act {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 14px;
	padding: 18px 22px;
	border: 1px solid var(--aht-card-line);
	border-radius: var(--aht-r);
	background: var(--aht-card);
	box-shadow: var(--aht-shadow);
}

/* ---------- previous / next ---------- */
.ahpl .ahpl-nav.aht-postnav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 8px 0 0; }
.ahpl .ahpl-nav .ahcn-lnav__back { grid-column: 1 / -1; justify-self: center; margin: 4px 0 0; }

/* the lock panel fills the column */
.ahpl .ahpl-main .ahcn-lock { width: 100%; max-width: none; margin-inline: 0; box-sizing: border-box; }

/* ---------- sidebar ---------- */
.ahpl .ahpl-side {
	position: sticky;
	top: var(--ahpl-stick);
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - var(--ahpl-stick) - 24px);
	overflow: hidden;
	border: 1px solid var(--aht-card-line);
	border-radius: var(--aht-r);
	background: var(--aht-card);
	box-shadow: var(--aht-shadow);
}
@supports (height: 100dvh) {
	.ahpl .ahpl-side { max-height: calc(100dvh - var(--ahpl-stick) - 24px); }
}
.ahpl .ahpl-side__head {
	display: grid;
	flex: none;
	gap: 8px;
	padding: 18px 20px;
	background: radial-gradient(120% 150% at 85% 0%, #17284F 0%, var(--aht-deep) 72%);
	color: var(--aht-on-navy);
}
[dir="rtl"] .ahpl .ahpl-side__head { background: radial-gradient(120% 150% at 15% 0%, #17284F 0%, var(--aht-deep) 72%); }
.ahpl .ahpl-side__k { margin: 0; font-size: .76rem; font-weight: 700; line-height: 1.5; color: var(--aht-gold-hi); }
.ahpl .ahpl-side__t { font-family: var(--aht-f-display); font-weight: 800; font-size: 1.06rem; line-height: 1.5; color: var(--aht-on-navy); text-decoration: none; }
.ahpl .ahpl-side__t:hover { color: var(--aht-gold-hi); }
.ahpl .ahpl-side__n { margin: 0; font-size: .84rem; line-height: 1.6; color: var(--aht-on-navy-muted); }
.ahpl .ahpl-side .ahpl-curr { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

/* progress inside the navy head */
.ahpl .ahpl-prog { display: grid; gap: 8px; margin-block-start: 4px; }
.ahpl .ahpl-prog .ahpl-prog__k { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; font-size: .86rem; font-weight: 600; line-height: 1.5; color: var(--aht-on-navy-muted); }
.ahpl .ahpl-prog .ahpl-prog__k b { font-weight: 700; color: var(--aht-on-navy); }
.ahpl .ahpl-prog .ahpl-prog__k .ahpl-prog__pct { font-family: var(--aht-f-mono); font-weight: 600; color: var(--aht-gold-hi); direction: ltr; unicode-bidi: isolate; }

/* ---------- curriculum: modules ---------- */
.ahpl .ahpl-mod { border-block-end: 1px solid var(--aht-line); }
.ahpl .ahpl-mod:last-child { border-block-end: 0; }
.ahpl .ahpl-mod > .ahpl-mod__h {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto 14px;
	gap: 10px;
	align-items: center;
	padding: 12px 18px;
	background: rgba(238, 236, 228, .55);
	list-style: none;
	cursor: pointer;
	transition: background-color .2s;
}
.ahpl .ahpl-mod > .ahpl-mod__h::-webkit-details-marker { display: none; }
.ahpl .ahpl-mod > .ahpl-mod__h:hover { background: rgba(232, 201, 136, .18); }
.ahpl .ahpl-mod[open] > .ahpl-mod__h { border-block-end: 1px solid var(--aht-line); }
.ahpl .ahpl-mod .ahpl-mod__no { display: grid; place-items: center; min-width: 30px; height: 24px; padding-inline: 4px; border-radius: 7px; background: var(--aht-navy); color: var(--aht-gold-hi); font-family: var(--aht-f-mono); font-size: .7rem; line-height: 1; }
.ahpl .ahpl-mod .ahpl-mod__t { font-family: var(--aht-f-display); font-weight: 700; font-size: .92rem; line-height: 1.5; color: var(--aht-ink); }
.ahpl .ahpl-mod .ahpl-mod__c { font-size: .76rem; white-space: nowrap; color: var(--aht-soft); }
.ahpl .ahpl-mod .ahpl-mod__c:lang(en) { font-family: var(--aht-f-mono); direction: ltr; unicode-bidi: isolate; }
.ahpl .ahpl-chev { flex: none; color: var(--aht-ink-gold); transition: rotate .25s var(--aht-ease); }
.ahpl details[open] > summary .ahpl-chev { rotate: 180deg; }

/* ---------- curriculum: lessons ---------- */
.ahpl .ahpl-list { margin: 0; padding: 0; list-style: none; }
.ahpl .ahpl-les { margin: 0; }
.ahpl .ahpl-les .ahpl-les__a {
	position: relative;
	display: grid;
	grid-template-columns: 28px minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	padding: 11px 18px;
	border-block-start: 1px solid var(--aht-line);
	color: var(--aht-ink);
	text-decoration: none;
	transition: background-color .2s;
}
.ahpl .ahpl-list > .ahpl-les:first-child .ahpl-les__a { border-block-start: 0; }
.ahpl .ahpl-les .ahpl-les__a:hover { background: rgba(232, 201, 136, .12); }
.ahpl .ahpl-les.is-current .ahpl-les__a { background: var(--aht-tint); }
.ahpl .ahpl-les.is-current .ahpl-les__a::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--aht-gold); }

.ahpl .ahpl-les .ahpl-les__st {
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	box-sizing: border-box;
	border: 1px solid var(--aht-line);
	border-radius: 50%;
	color: var(--aht-soft);
	font-family: var(--aht-f-mono);
	font-size: .68rem;
	line-height: 1;
}
.ahpl .ahpl-les .ahpl-les__st svg { width: 14px; height: 14px; margin: 0; }
.ahpl .ahpl-les .ahpl-les__st .ahcn-check { width: 18px; height: 18px; color: currentColor; }
.ahpl .ahpl-les .ahpl-les__st.ahpl-les__st--lock { border-color: transparent; }
.ahpl .ahpl-les .ahpl-les__st.ahpl-les__st--ok { border-color: #1F7A4D; background: #1F7A4D; color: #fff; }
.ahpl .ahpl-les .ahpl-les__st.ahpl-les__st--cur { border-color: var(--aht-navy); background: var(--aht-navy); color: var(--aht-gold-hi); }
.ahpl .ahpl-les .ahpl-les__st--cur .ahcn-ic { width: 12px; height: 12px; }
.ahpl .ahpl-les .ahpl-les__st--cur .ahcn-check { display: none; }
.ahpl .ahpl-les.is-done .ahpl-les__st.ahpl-les__st--cur { border-color: #1F7A4D; background: #1F7A4D; color: #fff; }
.ahpl .ahpl-les.is-done .ahpl-les__st--cur .ahcn-ic { display: none; }
.ahpl .ahpl-les.is-done .ahpl-les__st--cur .ahcn-check { display: block; }
.ahpl .ahpl-les:not(.is-done) .ahpl-les__srdone { display: none; }

.ahpl .ahpl-les .ahpl-les__b { display: grid; gap: 1px; min-width: 0; padding-block-start: 2px; }
.ahpl .ahpl-les .ahpl-les__t { font-weight: 600; font-size: .9rem; line-height: 1.55; }
.ahpl .ahpl-les.is-locked .ahpl-les__t { color: var(--aht-muted); }
.ahpl .ahpl-les.is-current .ahpl-les__t { font-weight: 700; color: var(--aht-ink); }
.ahpl .ahpl-les .ahpl-les__sub { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: .76rem; line-height: 1.6; color: var(--aht-soft); }
.ahpl .ahpl-les .ahpl-les__tag { font-weight: 700; color: var(--aht-ink-gold); }
.ahpl .ahpl-les .ahpl-les__d { font-family: var(--aht-f-mono); direction: ltr; unicode-bidi: isolate; }

/* ---------- phone drawer ---------- */
.ahpl .ahpl-drawer {
	display: none;
	overflow: hidden;
	border: 1px solid var(--aht-card-line);
	border-radius: var(--aht-r);
	background: var(--aht-card);
	box-shadow: var(--aht-shadow);
}
.ahpl .ahpl-drawer > .ahpl-drawer__h {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto 14px;
	gap: 12px;
	align-items: center;
	padding: 14px 18px;
	list-style: none;
	cursor: pointer;
}
.ahpl .ahpl-drawer > .ahpl-drawer__h::-webkit-details-marker { display: none; }
.ahpl .ahpl-drawer .ahpl-drawer__t { font-family: var(--aht-f-display); font-weight: 800; font-size: 1rem; line-height: 1.5; color: var(--aht-ink); }
.ahpl .ahpl-drawer .ahpl-drawer__pos { font-size: .82rem; white-space: nowrap; color: var(--aht-soft); }
.ahpl .ahpl-drawer .ahpl-curr { max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; }

/* ---------- focus ---------- */
.ahpl :is(a, button, summary):focus-visible { outline: 2px solid var(--aht-gold); outline-offset: 3px; }
.ahpl :is(.ahpl-les__a, .ahpl-mod__h, .ahpl-drawer__h):focus-visible { outline-offset: -2px; }

/* ---------- focus mode: no site header or footer, a wider player ---------- */
html.ahpl-focus :is(.aht-layout--header, .aht-layout--footer, .aht-fh, .aht-ff) { display: none; }
html.ahpl-focus .ahpl { --ahpl-w: 1640px; --ahpl-top: 24px; --ahpl-stick: 24px; }
html.ahpl-focus .admin-bar .ahpl { --ahpl-stick: 56px; }
html.ahpl-focus .ahpl .ahpl-body .aht-prose { max-width: 780px; }

/* ---------- breakpoints ---------- */
@media (max-width: 1366px) {
	.ahpl { --ahpl-side: 330px; --ahpl-gap: 32px; }
}

@media (max-width: 1200px) {
	.ahpl { --ahpl-side: 300px; --ahpl-gap: 24px; }
}

@media (max-width: 1024px) {
	.ahpl .ahpl-grid { grid-template-columns: minmax(0, 1fr); }
	.ahpl .ahpl-side { display: none; }
	.ahpl .ahpl-drawer { display: block; }
	.ahpl .ahpl-main { gap: 24px; }
}

@media (max-width: 767px) {
	.ahpl .aht-prose .ahpl-code { margin-inline: calc(-1 * var(--aht-gutter)); }
	.ahpl { font-size: 16.5px; }
	.ahpl .ahpl-top { margin-block-end: 14px; }
	.ahpl .ahpl-main { gap: 20px; }
	.ahpl .ahpl-head .ahpl-title { font-size: clamp(1.45rem, 6.6vw, 1.9rem); }
	.ahpl .ahpl-act { padding: 16px; }
	.ahpl .ahpl-act :is(.ah-done, .ah-btn[data-ah-next]) { flex: 1 1 100%; }
	.ahpl .ahpl-act .ah-btn { justify-content: center; }
	.ahpl .ahpl-act .ah-done .ah-done__btn { flex: 1 1 auto; justify-content: center; }
	.ahpl .ahpl-file { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; padding: 10px 12px; }
	.ahpl .ahpl-file .ahpl-file__ic { height: 36px; }
	.ahpl .ahpl-file .ahpl-file__dl { display: none; }
	.ahpl .ahpl-nav.aht-postnav { grid-template-columns: minmax(0, 1fr); }
	.ahpl .ahpl-les .ahpl-les__a { padding: 11px 16px; }
	.ahpl .ahpl-mod > .ahpl-mod__h { padding: 12px 16px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.ahpl .ahpl-wrap,
	.ahpl .ahpl-chev,
	.ahpl .ahpl-focus-btn,
	.ahpl .ahpl-file,
	.ahpl .ahpl-mod > .ahpl-mod__h,
	.ahpl .ahpl-les .ahpl-les__a { transition: none; }
}
