/* Result count and sort control (inc/loop-tools.php). Values from the
   Figma "Results bar" of the Memorial page. */

.ipmba-results-count {
	margin: 0;
	min-height: 16px;
	font-family: Roboto, sans-serif;
	font-size: 14px;
	line-height: 16px;
	color: #667085;
}

.ipmba-results-count strong {
	font-weight: 600;
	color: #22215f;
}

.ipmba-sort {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: Roboto, sans-serif;
	font-size: 14px;
	line-height: 16px;
}

.ipmba-sort__label {
	margin: 0;
	color: #667085;
	white-space: nowrap;
}

.ipmba-sort__select {
	appearance: none;
	min-width: 161px;
	height: 32px;
	padding: 0 32px 0 12px;
	border: 1px solid #dde3ec;
	border-radius: 4px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%2322215F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
	font: inherit;
	font-weight: 600;
	color: #22215f;
	cursor: pointer;
}

.ipmba-sort__select:hover,
.ipmba-sort__select:focus-visible {
	border-color: #0786c8;
	outline: none;
}

/* style="boxed" (Figma Resource Hub): label and value share one bordered
   box. loop-tools.js swaps the native option list (unstyleable, placed by the
   browser) for a listbox (.is-enhanced); without JS the borderless select
   still works inside the box. Child rules carry the .ipmba-sort--boxed
   prefix to outrank the theme's global button reset. */
.ipmba-sort--boxed {
	position: relative;
	height: 40px;
	padding: 0 12px 0 14px;
	gap: 10px;
	border: 1px solid #d8e3ea;
	border-radius: 5px;
	background: #fff;
	transition: border-color .2s;
}

.ipmba-sort--boxed:hover,
.ipmba-sort--boxed:focus-within {
	border-color: #0786c8;
}

.ipmba-sort--boxed .ipmba-sort__label {
	color: #687387;
	cursor: pointer;
}

.ipmba-sort--boxed .ipmba-sort__select {
	min-width: 0;
	height: 38px;
	padding-left: 0;
	border: 0;
	background-color: transparent;
	font-weight: 700;
}

.ipmba-sort--boxed.is-enhanced .ipmba-sort__select {
	display: none;
}

.ipmba-sort--boxed .ipmba-sort__trigger,
.ipmba-sort--boxed .ipmba-sort__trigger:hover,
.ipmba-sort--boxed .ipmba-sort__trigger:focus {
	display: flex;
	align-items: center;
	height: 38px;
	padding: 0 22px 0 0;
	border: 0;
	border-radius: 0;
	background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%2322215F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right center;
	color: #22215f;
	font: inherit;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
	outline: none;
}

.ipmba-sort--boxed .ipmba-sort__trigger[aria-expanded="true"] {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 7.5l3-3 3 3' fill='none' stroke='%2322215F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* The sort list opens right-aligned with its box (shared rules below). */
.ipmba-sort--boxed .ipmba-sort__list.ipmba-dropdown__list {
	right: -1px;
	left: auto;
	min-width: calc(100% + 2px);
}

/* Styled dropdowns (loop-tools.js enhanceSelect): an ARIA listbox replaces
   the native option list of the boxed sort and the filter selects. The
   native select stays hidden as the source of truth. */
.ipmba-dropdown {
	position: relative;
}

.ipmba-dropdown .ipmba-dropdown__list {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 30;
	min-width: 100%;
	max-height: 320px;
	margin: 0;
	padding: 6px;
	overflow-y: auto;
	border: 1px solid #d8e3ea;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 16px 32px -12px rgba(34, 33, 95, .3);
	list-style: none;
	outline: none;
}

.ipmba-dropdown .ipmba-dropdown__list[hidden],
.ipmba-dropdown .ipmba-dropdown__option[hidden] {
	display: none;
}

.ipmba-dropdown .ipmba-dropdown__option {
	margin: 0;
	padding: 9px 36px 9px 12px;
	border-radius: 6px;
	color: #22215f;
	font: 400 14px/18px Roboto, sans-serif;
	white-space: nowrap;
	cursor: pointer;
}

.ipmba-dropdown .ipmba-dropdown__option.is-child {
	padding-left: 26px;
}

.ipmba-dropdown .ipmba-dropdown__option:hover,
.ipmba-dropdown .ipmba-dropdown__option.is-active {
	background-color: #f1f7fb;
}

.ipmba-dropdown .ipmba-dropdown__option[aria-selected="true"] {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.5l2.5 2.5L11 4.5' fill='none' stroke='%230786C8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	color: #0786c8;
	font-weight: 700;
}

.ipmba-dropdown .ipmba-dropdown__option[aria-disabled="true"] {
	opacity: .45;
	cursor: default;
}

/* Filter selects once enhanced: the trigger keeps the select's look.
   Prefixed with .ipmba-filters to outrank the theme's button reset. */
.ipmba-filters__field.is-enhanced .ipmba-filters__select {
	display: none;
}

.ipmba-filters .ipmba-filters__trigger,
.ipmba-filters .ipmba-filters__trigger:hover,
.ipmba-filters .ipmba-filters__trigger:focus {
	display: block;
	width: 100%;
	height: 38px;
	padding: 0 34px 0 12px;
	overflow: hidden;
	border: 1px solid #d8e3ea;
	border-radius: 5px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 5.25 7 8.75l3.5-3.5' fill='none' stroke='%2322215F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
	color: #2a2e45;
	font: 400 14px/36px Roboto, sans-serif;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
	outline: none;
	transition: border-color .2s;
}

.ipmba-filters .ipmba-filters__trigger:hover,
.ipmba-filters .ipmba-filters__trigger:focus-visible,
.ipmba-filters .ipmba-filters__trigger[aria-expanded="true"] {
	border-color: #0786c8;
}

.ipmba-filters .ipmba-filters__trigger[aria-expanded="true"] {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 8.75 7 5.25l3.5 3.5' fill='none' stroke='%2322215F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.ipmba-filters .ipmba-filters__trigger.is-active {
	border-color: #0786c8;
	color: #0786c8;
	font-weight: 700;
}

.ipmba-filters .ipmba-filters__label {
	cursor: pointer;
}

.ipmba-filters .ipmba-filters__list {
	top: calc(100% + 4px);
	width: 100%;
}

.ipmba-filters .ipmba-filters__list .ipmba-dropdown__option {
	white-space: normal;
}

/* Count, "total" format: "6 resources in Videos" (Figma Resource Hub). */
.ipmba-results-count[data-format="total"] {
	color: #687387;
}

.ipmba-results-count[data-format="total"] strong {
	font-size: 18px;
	line-height: 21px;
	font-weight: 700;
	color: #22215f;
}

.ipmba-results-count__context {
	margin-left: 4px;
	font-size: 14px;
}

/* [ipmba_filters] */
.ipmba-filters {
	display: flex;
	flex-direction: column;
	gap: 22px;
	padding: 24px;
	border: 1px solid #d8e3ea;
	border-radius: 16px;
	background: #fff;
	font-family: Roboto, sans-serif;
}

.ipmba-filters__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.ipmba-filters__title {
	margin: 0;
	font-size: 20px;
	line-height: 23px;
	font-weight: 700;
	color: #22215f;
}

.ipmba-filters__clear {
	padding: 0;
	border: 0;
	background: none;
	font: 600 13px/15px Roboto, sans-serif;
	color: #0786c8;
	cursor: pointer;
}

.ipmba-filters__clear:hover,
.ipmba-filters__clear:focus-visible {
	text-decoration: underline;
	background: none;
	color: #145494;
}

.ipmba-filters__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ipmba-filters__label {
	font-size: 12px;
	line-height: 14px;
	font-weight: 700;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: #1b2b5e;
}

.ipmba-filters__select {
	appearance: none;
	width: 100%;
	height: 38px;
	padding: 0 34px 0 12px;
	border: 1px solid #d8e3ea;
	border-radius: 5px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 5.25 7 8.75l3.5-3.5' fill='none' stroke='%2322215F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
	font: 400 14px/16px Roboto, sans-serif;
	color: #2a2e45;
	cursor: pointer;
}

.ipmba-filters__select:hover,
.ipmba-filters__select:focus-visible {
	border-color: #0786c8;
	outline: none;
}

.ipmba-filters__select.is-active {
	border-color: #0786c8;
	font-weight: 700;
	color: #0786c8;
}

/* [ipmba_search] */
.ipmba-search {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	max-width: 980px;
	min-height: 64px;
	padding: 8px 8px 8px 20px;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .25);
	font-family: Roboto, sans-serif;
}

.ipmba-search__icon {
	flex: none;
	width: 22px;
	height: 22px;
	color: #0786c8;
}

/* Prefixed with .ipmba-search to outrank the theme reset for
   input[type="search"] (border, radius, padding). */
.ipmba-search .ipmba-search__input {
	flex: 1;
	min-width: 0;
	height: 46px;
	padding: 0;
	border: 0;
	background: transparent;
	font: 400 16px/19px Roboto, sans-serif;
	color: #22215f;
}

.ipmba-search .ipmba-search__input::placeholder {
	color: #687387;
}

.ipmba-search .ipmba-search__input:focus {
	outline: none;
}

.ipmba-search:focus-within {
	box-shadow: 0 0 0 3px rgba(7, 134, 200, .45), 0 10px 24px -8px rgba(0, 0, 0, .25);
}

.ipmba-search__button {
	flex: none;
	height: 46px;
	padding: 0 26px;
	border: 0;
	border-radius: 5px;
	background: #e63a46;
	font: 700 14px/16px Roboto, sans-serif;
	text-transform: uppercase;
	color: #fff;
	cursor: pointer;
	transition: background-color .2s;
}

.ipmba-search__button:hover,
.ipmba-search__button:focus-visible {
	background: #c92f3a;
	color: #fff;
}

@media (max-width: 767px) {
	.ipmba-search {
		flex-wrap: wrap;
		padding: 12px;
	}

	.ipmba-search__icon {
		display: none;
	}

	.ipmba-search .ipmba-search__input {
		flex-basis: 100%;
		padding: 0 4px;
	}

	.ipmba-search__button {
		width: 100%;
	}
}

/* [ipmba_filter_heading] */
.ipmba-filter-heading {
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-family: Roboto, sans-serif;
}

.ipmba-filter-heading__title {
	margin: 0;
	font-size: 48px;
	line-height: 56px;
	font-weight: 700;
	color: #22215f;
}

.ipmba-filter-heading__description {
	margin: 0;
	font-size: 16px;
	line-height: 22px;
	color: #2a2e45;
}

@media (max-width: 1024px) {
	.ipmba-filter-heading__title {
		font-size: 40px;
		line-height: 48px;
	}
}

@media (max-width: 767px) {
	.ipmba-filter-heading__title {
		font-size: 32px;
		line-height: 40px;
	}
}

/* [ipmba_view_toggle] */
.ipmba-view-toggle {
	display: flex;
	gap: 8px;
}

.ipmba-view-toggle__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid #d8e3ea;
	border-radius: 5px;
	background: #fff;
	color: #0786c8;
	cursor: pointer;
}

.ipmba-view-toggle__button svg {
	width: 18px;
	height: 18px;
}

.ipmba-view-toggle__button:hover,
.ipmba-view-toggle__button:focus-visible {
	border-color: #0786c8;
	background: #fff;
	color: #0786c8;
}

.ipmba-view-toggle__button.is-active {
	border-color: #0786c8;
	background: #0786c8;
	color: #fff;
}

/* Grid view of a Loop Grid toggled by [ipmba_view_toggle]. Figma only draws
   the list; the grid reuses the "Related resource card" look: three columns
   and the card's row layout turned into a column. Cards opt in with the
   .ipmba-resource-card class on their root container. */
.ipmba-view-grid .elementor-loop-container {
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* Stretch, not flex-start: in a column, flex-start shrinks the text block to
   its content width and leaves half the card empty. Icon and button keep
   their own size. */
.ipmba-view-grid .ipmba-resource-card {
	flex-direction: column !important;
	align-items: stretch !important;
	height: 100%;
}

.ipmba-view-grid .ipmba-resource-card .ipmba-resource-card__icon,
.ipmba-view-grid .ipmba-resource-card .ipmba-resource-card__thumb {
	align-self: flex-start;
}

.ipmba-view-grid .ipmba-resource-card .ipmba-resource-card__action {
	align-self: flex-start;
	margin-top: auto;
}

@media (max-width: 1024px) {
	.ipmba-view-grid .elementor-loop-container {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 767px) {
	.ipmba-view-grid .elementor-loop-container {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}

/* Loop Grid loading state. Our refreshes (sort, filters, search) and
   Elementor's AJAX pagination both toggle .e-loading-overlay on the widget.
   Instead of Elementor's whole-widget pulse: dimmed, inert results and a
   spinner that stays in view (sticky) while the list scrolls. */
.elementor-widget-loop-grid.e-loading-overlay {
	animation: none;
	cursor: progress;
}

.elementor-widget-loop-grid.e-loading-overlay > * {
	opacity: .35;
	pointer-events: none;
	transition: opacity .2s;
}

.elementor-widget-loop-grid.e-loading-overlay::before {
	content: "";
	position: sticky;
	top: calc(50vh - 22px);
	z-index: 2;
	display: block;
	width: 44px;
	height: 44px;
	margin: 24px auto -68px;
	border: 4px solid #d8e3ea;
	border-top-color: #0786c8;
	border-radius: 50%;
	background: #fff;
	/* White halo so the spinner reads over the dimmed cards. */
	box-shadow: 0 0 0 10px #fff, 0 10px 28px -6px rgba(34, 33, 95, .35);
	animation: ipmba-spin .8s linear infinite;
}

@keyframes ipmba-spin {
	to {
		transform: rotate(360deg);
	}
}

