/* CEH Lesson Library 1.5 — scoped under .ceh-lib */

.ceh-lib {
	--lib-navy: #123151;
	--lib-orange: #F78F28;
	--lib-blue: #379FD3;
	--lib-ink: #1d2a38;
	--lib-muted: #5a6a7b;
	--lib-line: #dbe3ec;
	--lib-soft: #f3f7fb;
	--lib-blue-soft: #e6f3fa;
	--lib-blue-ink: #1a6690;
	--lib-orange-soft: #fff1e2;
	--lib-orange-ink: #9a4c05;
	font-family: 'League Spartan', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	color: var(--lib-ink);
	line-height: 1.45;
	box-sizing: border-box;
	margin: 8px 0 32px;
}
/* Wide layout: break out of the theme's narrow reading column, up to 1320px, centred on the page. */
@media (min-width: 900px) {
	div.ceh-lib.ceh-lib--wide {
		width: min(1320px, calc(100vw - 64px)) !important;
		max-width: none !important;
		margin-left: calc(50% - min(660px, calc(50vw - 32px))) !important;
		margin-right: 0 !important;
	}
}
.ceh-lib *, .ceh-lib *::before, .ceh-lib *::after { box-sizing: inherit; }
.ceh-lib a { text-decoration: none; box-shadow: none; }
.ceh-lib [hidden] { display: none !important; }
.ceh-lib .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ceh-lib-notice { padding: 10px 14px; background: #fff8e5; border-left: 4px solid #dba617; }
.ceh-lib :focus-visible { outline: 3px solid var(--lib-blue); outline-offset: 2px; }

/* ---------- filter bar ---------- */
.ceh-lib-filters {
	display: grid; gap: 14px; padding: 18px 20px; margin-bottom: 14px;
	background: var(--lib-soft); border: 1px solid var(--lib-line); border-radius: 14px;
}
.ceh-lib-filters > * { min-width: 0; }
.ceh-lib-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ceh-lib-search {
	flex: 1 1 240px; display: flex; align-items: center; gap: 8px; min-height: 44px;
	padding: 0 12px; background: #fff; border: 1px solid #c9d5e1; border-radius: 10px; color: var(--lib-muted);
}
.ceh-lib-search:focus-within { border-color: var(--lib-blue); box-shadow: 0 0 0 3px rgba(55,159,211,.2); }
.ceh-lib .ceh-lib-search input {
	flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; box-shadow: none;
	font: inherit; font-size: 16px; color: var(--lib-ink); padding: 10px 0 8px; margin: 0;
}
.ceh-lib-select select {
	min-height: 44px; padding: 10px 34px 8px 12px; font: inherit; font-size: 15px; font-weight: 600; color: var(--lib-navy);
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23123151' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
	border: 1px solid #c9d5e1; border-radius: 10px; appearance: none; -webkit-appearance: none; cursor: pointer; margin: 0;
}
.ceh-lib-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; font-size: 15px; color: var(--lib-navy); cursor: pointer; }
.ceh-lib-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--lib-navy); }
.ceh-lib-toggle em { font-style: normal; font-weight: 400; color: var(--lib-muted); }

.ceh-lib-facet { display: flex; gap: 10px; align-items: baseline; }
.ceh-lib-facet__label {
	flex: 0 0 68px; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--lib-muted);
}
.ceh-lib-facet__opts { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.ceh-lib .ceh-lib-facet button {
	font: inherit; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer;
	padding: 8px 12px 6px; border-radius: 999px; margin: 0;
	background: #fff; color: var(--lib-navy); border: 1px solid #c9d5e1;
	transition: background .15s, border-color .15s, color .15s;
}
.ceh-lib .ceh-lib-facet button:hover { border-color: var(--lib-blue); background: var(--lib-blue-soft); }
.ceh-lib .ceh-lib-facet button[aria-pressed="true"] { background: var(--lib-navy); border-color: var(--lib-navy); color: #fff; }
.ceh-lib-n { font-weight: 400; opacity: .6; margin-left: 2px; }

/* Long options (Related Issue questions on course pages): label on top, buttons wrap their text */
.ceh-lib-facet--wide { display: block; padding-bottom: 6px; border-bottom: 1px solid #dbe3ec; margin-bottom: 4px; }
.ceh-lib-facet--wide .ceh-lib-facet__label { display: block; margin-bottom: 8px; }
.ceh-lib .ceh-lib-facet--wide button { line-height: 1.3; padding: 8px 14px 7px; border-radius: 12px; text-align: left; white-space: normal; max-width: 100%; }

.ceh-lib-status { display: flex; align-items: center; gap: 14px; min-height: 28px; margin: 0 2px 14px; }
.ceh-lib .ceh-lib-count { margin: 0; font-size: 15px; font-weight: 700; color: var(--lib-navy); }
.ceh-lib .ceh-lib-clear {
	font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 0; margin: 0;
	background: none; border: 0; color: var(--lib-blue-ink); border-bottom: 2px solid var(--lib-orange);
}

/* ---------- card grid ---------- */
.ceh-lib ul.ceh-lib-grid {
	list-style: none; margin: 0; padding: 0;
	display: grid; gap: 22px;
	/* Up to --lib-cols across (4 by default); drops a column whenever cards would get narrower than 250px. */
	grid-template-columns: repeat(auto-fill, minmax(max(250px, calc((100% - (var(--lib-cols, 4) - 1) * 22px) / var(--lib-cols, 4))), 1fr));
}
.ceh-lib .ceh-lib-card {
	position: relative; list-style: none; margin: 0; padding: 0;
	display: flex; flex-direction: column;
	background: #fff; border: 1px solid var(--lib-line); border-radius: 14px; overflow: hidden;
	transition: box-shadow .2s, border-color .2s, transform .2s;
}
.ceh-lib-card:hover, .ceh-lib-card:focus-within { border-color: #c3d1df; box-shadow: 0 10px 28px rgba(18,49,81,.11); transform: translateY(-2px); }
.ceh-lib-media { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--lib-navy), var(--lib-blue)); }
.ceh-lib-media img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.ceh-lib-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 14px 18px 16px; }
.ceh-lib-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 13px; color: var(--lib-muted); }
.ceh-lib-meta time { margin-left: auto; }
.ceh-lib-badge { font-size: 12px; font-weight: 700; line-height: 1; letter-spacing: .02em; padding: 5px 8px 4px; border-radius: 6px; }
.ceh-lib-badge--free { background: #e3f5e9; color: #146b36; }
.ceh-lib-badge--new { background: var(--lib-orange); color: var(--lib-navy); }
.ceh-lib .ceh-lib-title { margin: 0 !important; padding: 0; font-family: inherit !important; font-size: 19px !important; line-height: 1.2 !important; font-weight: 700 !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--lib-navy) !important; }
.ceh-lib .ceh-lib-title a { font-weight: 700 !important; }
.ceh-lib .ceh-lib-title a { color: inherit; }
.ceh-lib-title a::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.ceh-lib .ceh-lib-teaser {
	margin: 0; font-size: 15px; line-height: 1.45; color: #3b4a5a;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ceh-lib-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.ceh-lib-chip {
	font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 9px 4px; border-radius: 999px;
	background: var(--lib-blue-soft); color: var(--lib-blue-ink);
}
.ceh-lib-chip--theme { background: var(--lib-orange-soft); color: var(--lib-orange-ink); }
.ceh-lib-foot {
	margin-top: auto; padding-top: 10px; border-top: 1px solid #edf1f5;
	display: grid; gap: 4px; font-size: 13px; color: var(--lib-muted);
}
.ceh-lib-region { display: flex; gap: 6px; align-items: flex-start; }
.ceh-lib-region svg { flex: 0 0 auto; margin-top: 2px; }
.ceh-lib-unit { font-weight: 700; color: var(--lib-navy); }
.ceh-lib-unit::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--lib-orange); margin-right: 7px; vertical-align: 1px; }

/* ---------- empty + more ---------- */
.ceh-lib-empty { text-align: center; padding: 36px 16px; border: 1px dashed #c8d4e0; border-radius: 14px; background: var(--lib-soft); }
.ceh-lib-empty p { margin: 0 0 8px; color: var(--lib-navy); }
.ceh-lib-more-wrap { text-align: center; margin-top: 24px; }
.ceh-lib .ceh-lib-more {
	font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; min-height: 46px; padding: 12px 26px 10px; margin: 0;
	border-radius: 10px; background: var(--lib-navy); color: #fff; border: 2px solid var(--lib-navy);
}
.ceh-lib .ceh-lib-more:hover { background: #1c4570; border-color: #1c4570; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
	.ceh-lib-filters { padding: 14px; border-radius: 12px; }
	.ceh-lib-select, .ceh-lib-select select { flex: 1 1 45%; width: 100%; }
	.ceh-lib-facet { display: block; }
	.ceh-lib-facet__label { display: block; margin-bottom: 6px; }
	.ceh-lib-facet__opts { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 4px; scrollbar-width: none; }
	.ceh-lib-facet__opts::-webkit-scrollbar { display: none; }
	.ceh-lib .ceh-lib-facet button { flex: 0 0 auto; }
	.ceh-lib-facet--wide .ceh-lib-facet__opts { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
	.ceh-lib .ceh-lib-facet--wide button { flex: 1 1 100%; }
	.ceh-lib ul.ceh-lib-grid { grid-template-columns: 1fr; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.ceh-lib * { transition: none !important; }
	.ceh-lib-card:hover { transform: none; }
}

/* Which part of a course a lesson fits (course pages and course searches) */
.ceh-lib-unitchips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.ceh-lib-unitchip {
	display: inline-flex; align-items: flex-start; gap: 6px; padding: 4px 10px 3px; border-radius: 8px; max-width: 100%;
	background: var(--lib-navy); color: #fff; font-size: 13px; font-weight: 600; line-height: 1.3;
}
.ceh-lib-unitchip::before { content: ""; width: 6px; height: 6px; margin-top: .45em; border-radius: 50%; background: var(--lib-orange); flex: 0 0 auto; }
