/*
 * LOPL eLibrary — styled to the site's Elementor global kit.
 * Uses Elementor global color vars with hard fallbacks, and is specific enough
 * to beat the kit's h3 / a / button rules (37px uppercase Oswald, pink buttons).
 */
.lopl-elib {
	--elib-primary: var(--e-global-color-primary, #003B5C);
	--elib-secondary: var(--e-global-color-secondary, #006152);
	--elib-accent: var(--e-global-color-accent, #428226);
	--elib-text: var(--e-global-color-text, #2E2E2E);
	--elib-muted: #5f6b68;
	--elib-panel: #eef3f1;
	--elib-border: #d5dedb;
	--elib-radius: 6px;
	color: var(--elib-text);
	font-size: 16px;
}
.lopl-elib *, .lopl-elib *::before, .lopl-elib *::after { box-sizing: border-box; }

/* ---------- Controls panel ---------- */
.lopl-elib .lopl-elib__controls {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
	gap: 16px;
	align-items: end;
	margin: 0 0 20px;
	padding: 20px;
	background: var(--elib-panel);
	border-radius: var(--elib-radius);
}
.lopl-elib .lopl-elib__field--search { grid-column: 1 / -1; }
.lopl-elib .lopl-elib__field label {
	display: block;
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--elib-primary);
}
.lopl-elib .lopl-elib__field input,
.lopl-elib .lopl-elib__field select {
	width: 100%;
	height: 46px;
	margin: 0;
	padding: 0 14px;
	font: inherit;
	font-size: 16px; /* 16px stops iOS zoom-on-focus */
	color: var(--elib-text);
	background-color: #fff;
	border: 1px solid var(--elib-border);
	border-radius: var(--elib-radius);
	box-shadow: none;
}
.lopl-elib .lopl-elib__field select {
	padding-right: 36px;
	text-overflow: ellipsis;
	appearance: none;
	-webkit-appearance: none;
	background-image: 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 1l5 5 5-5' fill='none' stroke='%23003B5C' stroke-width='2'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	cursor: pointer;
}
.lopl-elib .lopl-elib__field--search input {
	height: 52px;
	padding-left: 46px;
	font-size: 17px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23003B5C' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: 16px center;
}
.lopl-elib .lopl-elib__field input:focus,
.lopl-elib .lopl-elib__field select:focus {
	outline: none;
	border-color: var(--elib-secondary);
	box-shadow: 0 0 0 3px rgba(0, 97, 82, .2);
}

/* Clear filters: quiet text button, not the kit's pink outline */
.lopl-elib .lopl-elib__controls .lopl-elib__reset {
	height: 46px;
	padding: 0 4px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	color: var(--elib-secondary);
	background: none;
	border: 0;
	border-radius: 0;
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
	cursor: pointer;
}
.lopl-elib .lopl-elib__controls .lopl-elib__reset:hover,
.lopl-elib .lopl-elib__controls .lopl-elib__reset:focus {
	color: var(--elib-primary);
	background: none;
}

/* ---------- A–Z bar ---------- */
.lopl-elib .lopl-elib__alpha {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0 0 8px;
}
.lopl-elib .lopl-elib__alpha button {
	flex: 0 0 auto;
	min-width: 36px;
	height: 36px;
	margin: 0;
	padding: 0 8px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0;
	text-transform: uppercase;
	color: var(--elib-primary);
	background: #fff;
	border: 1px solid var(--elib-border);
	border-radius: 4px;
	cursor: pointer;
	transition: background-color .15s, color .15s, border-color .15s;
}
.lopl-elib .lopl-elib__alpha button:hover:not(:disabled):not([aria-pressed="true"]) {
	color: var(--elib-primary);
	background: var(--elib-panel);
	border-color: var(--elib-primary);
}
.lopl-elib .lopl-elib__alpha button[aria-pressed="true"],
.lopl-elib .lopl-elib__alpha button[aria-pressed="true"]:hover {
	color: #fff;
	background: var(--elib-primary);
	border-color: var(--elib-primary);
}
.lopl-elib .lopl-elib__alpha button:disabled {
	color: #b7c0bd;
	background: transparent;
	border-color: transparent;
	cursor: default;
}

/* ---------- Results ---------- */
.lopl-elib .lopl-elib__count {
	margin: 16px 0 0;
	padding-bottom: 10px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--elib-muted);
	border-bottom: 2px solid var(--elib-primary);
}

.lopl-elib .lopl-elib__list { list-style: none; margin: 0; padding: 0; }
.lopl-elib .lopl-elib__item {
	margin: 0;
	padding: 20px 0;
	border-bottom: 1px solid var(--elib-border);
}
.lopl-elib .lopl-elib__item[hidden] { display: none; }

.lopl-elib .lopl-elib__title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	margin: 0 0 6px;
	padding: 0;
	font-family: "Oswald", sans-serif;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: .01em;
	text-transform: uppercase;
	color: var(--elib-primary);
}
.lopl-elib .lopl-elib__title a {
	font: inherit;
	color: var(--elib-primary);
	text-decoration: none;
	text-transform: inherit;
}
.lopl-elib .lopl-elib__title a:hover,
.lopl-elib .lopl-elib__title a:focus {
	color: var(--elib-secondary);
	text-decoration: underline;
	text-underline-offset: 4px;
	text-decoration-thickness: 2px;
}

.lopl-elib .lopl-elib__badge {
	display: inline-block;
	margin: 0;
	padding: 3px 8px;
	font-family: "Montserrat", sans-serif;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--elib-primary);
	background: #fff;
	border: 1px solid var(--elib-primary);
	border-radius: 999px;
}
.lopl-elib .lopl-elib__badge--featured {
	color: #fff;
	background: var(--elib-accent);
	border-color: var(--elib-accent);
}

.lopl-elib .lopl-elib__desc {
	max-width: 75ch;
	font-size: 15px;
	line-height: 1.6;
	overflow-wrap: anywhere;
}
.lopl-elib .lopl-elib__desc p { margin: 0 0 6px; }
.lopl-elib .lopl-elib__desc > :last-child { margin-bottom: 0; }
.lopl-elib .lopl-elib__desc a {
	color: var(--elib-secondary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.lopl-elib .lopl-elib__desc a:hover { color: var(--elib-primary); }

.lopl-elib .lopl-elib__empty {
	margin: 0;
	padding: 32px 20px;
	text-align: center;
	color: var(--elib-muted);
	background: var(--elib-panel);
	border-radius: var(--elib-radius);
}
.lopl-elib .lopl-elib__empty[hidden] { display: none; }

/* Keyboard focus */
.lopl-elib a:focus-visible,
.lopl-elib button:focus-visible {
	outline: 3px solid var(--elib-secondary);
	outline-offset: 2px;
}

.lopl-elib .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.lopl-elib .lopl-elib__controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.lopl-elib .lopl-elib__controls .lopl-elib__reset { grid-column: 1 / -1; justify-self: start; height: auto; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.lopl-elib .lopl-elib__controls {
		grid-template-columns: 1fr;
		gap: 8px;
		padding: 12px;
		margin-bottom: 16px;
	}
	/* Placeholder + "All Subjects/Types/Vendors" defaults are self-describing;
	   keep labels for screen readers, reclaim ~90px of vertical space. */
	.lopl-elib .lopl-elib__field label {
		position: absolute !important;
		width: 1px; height: 1px;
		overflow: hidden;
		clip: rect(1px, 1px, 1px, 1px);
		white-space: nowrap;
	}
	.lopl-elib .lopl-elib__field--search input { height: 50px; }
	.lopl-elib .lopl-elib__controls .lopl-elib__reset { padding: 4px 2px 0; }

	/* A–Z becomes one swipeable row instead of 3–4 wrapped rows */
	.lopl-elib .lopl-elib__alpha {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
		margin: 0 0 8px;
		padding: 2px 0 6px;
		/* right-edge fade hints that the row scrolls */
		-webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent 100%);
		mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent 100%);
	}
	.lopl-elib .lopl-elib__alpha::-webkit-scrollbar { display: none; }
	.lopl-elib .lopl-elib__alpha button {
		min-width: 40px;
		height: 40px;
		scroll-snap-align: start;
	}
	.lopl-elib .lopl-elib__alpha button:disabled { display: none; }

	.lopl-elib .lopl-elib__item { padding: 16px 0; }
	.lopl-elib .lopl-elib__title { font-size: 19px; }
	.lopl-elib .lopl-elib__desc { font-size: 15px; }
}
