/*
 * MSH People Filter
 * msh-people-filter.css
 *
 * Scoped to .msh-people-filter-widget — never leaks.
 * Mirrors the visual language of msh-ajax-filter.css.
 *
 * Card layout: photo (grayscale on hover → colour), name, title.
 * No social icons. Grid: responsive, 4 col desktop → 2 col tablet → 1 col mobile.
 */

/* ============================================================================
   Custom properties
   ============================================================================ */
.msh-people-filter-widget {
	--msh-filter-bg:     #f5f5f5;
	--msh-filter-border: #d8d8d8;
	--msh-filter-radius: 4px;
	--msh-filter-text:   #333;
	--msh-accent:        #00704a;   /* MSH green */
	--msh-accent-hover:  #005538;
	--msh-font-size:     14px;
	--msh-transition:    0.2s ease;
}

/* ============================================================================
   Filter bar wrapper
   ============================================================================ */
.msh-people-filter-bar {
	background-color: var( --msh-filter-bg );
	border: 1px solid var( --msh-filter-border );
	border-radius: var( --msh-filter-radius );
	padding: 16px 16px 0;
	margin-bottom: 28px;
}

/* Search + dropdowns row */
.msh-people-filter-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	padding-bottom: 16px;
}

/* Individual filter group */
.msh-people-filter-widget .msh-filter-group {
	display: flex;
	flex-direction: column;
	flex: 1 1 180px;
	min-width: 160px;
	max-width: 280px;
}

/* Search group wider */
.msh-people-filter-widget .msh-filter-group.msh-filter-search {
	flex: 2 1 260px;
	max-width: 360px;
	flex-direction: row;
	align-items: center;
}

/* ============================================================================
   Form controls – inputs & selects
   ============================================================================ */
.msh-people-filter-bar select,
.msh-people-filter-bar input[type="text"] {
	width: 100%;
	padding: 8px 12px;
	font-size: var( --msh-font-size );
	color: var( --msh-filter-text );
	background-color: #fff;
	border: 1px solid var( --msh-filter-border );
	border-radius: var( --msh-filter-radius );
	appearance: none;
	-webkit-appearance: none;
	transition: border-color var( --msh-transition ), box-shadow var( --msh-transition );
	line-height: 1.4;
}

/* ============================================================================
   Technical Area multi-select filter (checkbox listbox)
   Ported from msh-ajax-filter.css — same custom properties, same component,
   so Technical Area filtering looks/behaves identically to /stories/ and
   /resources/. Reuses .msh-filter-group sizing/flex rules defined above.
   ============================================================================ */

/* Don't double up: the generic select-arrow pseudo-element is for native
   <select> groups only — the multiselect draws its own chevron in the button. */
.msh-filter-group.msh-multiselect::after {
	content: none;
}

.msh-multiselect {
	position: relative;
}

.msh-multiselect-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	padding: 8px 12px;
	font-size: var( --msh-font-size );
	font-family: inherit;
	color: var( --msh-filter-text );
	background-color: #fff;
	border: 1px solid var( --msh-filter-border );
	border-radius: var( --msh-filter-radius );
	cursor: pointer;
	line-height: 1.4;
	transition: border-color var( --msh-transition ), box-shadow var( --msh-transition );
}

.msh-multiselect-toggle:hover {
	border-color: var( --msh-accent );
}

.msh-multiselect-toggle:focus-visible {
	outline: 2px solid var( --msh-accent );
	outline-offset: 2px;
	border-color: var( --msh-accent );
	box-shadow: 0 0 0 3px rgba( 0, 112, 74, 0.25 );
}

.msh-multiselect-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.msh-multiselect-count {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	background-color: var( --msh-accent );
	border-radius: 999px;
}

.msh-multiselect-chevron {
	flex-shrink: 0;
	color: var( --msh-filter-text );
	transition: transform var( --msh-transition );
}

.msh-multiselect-toggle[aria-expanded="true"] .msh-multiselect-chevron {
	transform: rotate( 180deg );
}

.msh-multiselect-panel {
	position: absolute;
	top: calc( 100% + 4px );
	left: 0;
	z-index: 20;
	width: max( 100%, 240px );
	max-height: 320px;
	display: flex;
	flex-direction: column;
	background-color: #fff;
	border: 1px solid var( --msh-filter-border );
	border-radius: var( --msh-filter-radius );
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.12 );
	overflow: hidden;
}

.msh-multiselect-search {
	padding: 8px;
	border-bottom: 1px solid var( --msh-filter-border );
}

.msh-multiselect-search-input {
	width: 100%;
	padding: 6px 10px;
	font-size: var( --msh-font-size );
	border: 1px solid var( --msh-filter-border );
	border-radius: var( --msh-filter-radius );
}

.msh-multiselect-search-input:focus-visible {
	outline: 2px solid var( --msh-accent );
	outline-offset: 1px;
	border-color: var( --msh-accent );
}

.msh-multiselect-options {
	margin: 0;
	padding: 4px 0;
	list-style: none;
	overflow-y: auto;
}

.msh-multiselect-option label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	font-size: var( --msh-font-size );
	color: var( --msh-filter-text );
	cursor: pointer;
	transition: background-color var( --msh-transition );
}

.msh-multiselect-option label:hover {
	background-color: var( --msh-filter-bg );
}

.msh-multiselect-checkbox {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	accent-color: var( --msh-accent );
	cursor: pointer;
}

.msh-multiselect-option-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Focus indicator for Technical Area checkboxes (WCAG 2.4.7).
   Mirrors the fix in msh-ajax-filter.css – keep both in sync. */
.msh-people-filter-widget .msh-multiselect-checkbox:focus-visible {
	outline: 2px solid var( --msh-accent ) !important;
	outline-offset: 2px !important;
}

.msh-people-filter-widget .msh-multiselect-option label:has( .msh-multiselect-checkbox:focus-visible ) {
	background-color: var( --msh-filter-bg );
}

/* Mobile: stack the multiselect panel to full width so it doesn't overflow */
@media ( max-width: 480px ) {
	.msh-multiselect-panel {
		position: fixed;
		top: auto;
		left: 12px;
		right: 12px;
		width: auto;
	}
}

/* ============================================================================
   Active-filter pills row — "Clear All ×  Term Name ×  Term Name ×"
   Ported from msh-ajax-filter.css — same component as /stories/ and /resources/.
   ============================================================================ */
.msh-active-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 12px 16px 16px;
}

.msh-active-filters[hidden] {
	display: none;
}

.msh-clear-all-pill,
.msh-filter-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	background-color: #fff;
	border: 1px solid var( --msh-accent );
	border-radius: 999px;
	color: var( --msh-accent );
	cursor: pointer;
	transition: background-color var( --msh-transition ), color var( --msh-transition );
	white-space: nowrap;
}

.msh-clear-all-pill:hover,
.msh-filter-pill:hover {
	background-color: var( --msh-accent );
	color: #fff;
}

.msh-clear-all-pill:focus-visible,
.msh-filter-pill:focus-visible {
	outline: 2px solid var( --msh-accent );
	outline-offset: 2px;
}

.msh-clear-all-pill {
	font-weight: 600;
	border-style: dashed;
}

.msh-filter-pill svg,
.msh-clear-all-pill svg {
	flex-shrink: 0;
}

.msh-people-filter-bar select:focus-visible,
.msh-people-filter-bar input[type="text"]:focus-visible {
	outline: 2px solid var( --msh-accent );
	outline-offset: 2px;
	border-color: var( --msh-accent );
	box-shadow: 0 0 0 3px rgba( 0, 112, 74, 0.25 );
}
/* Fallback */
.msh-people-filter-bar select:focus,
.msh-people-filter-bar input[type="text"]:focus {
	outline: 2px solid var( --msh-accent );
	outline-offset: 2px;
	border-color: var( --msh-accent );
}

/* Search input fills row, button attached */
.msh-people-filter-widget .msh-filter-search input[type="text"] {
	flex: 1;
	border-radius: var( --msh-filter-radius ) 0 0 var( --msh-filter-radius );
	border-right: none;
}

/* Search button */
.msh-people-search-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px 14px;
	background-color: var( --msh-accent );
	color: #fff;
	border: 1px solid var( --msh-accent );
	border-radius: 0 var( --msh-filter-radius ) var( --msh-filter-radius ) 0;
	cursor: pointer;
	transition: background-color var( --msh-transition );
	line-height: 1;
}
.msh-people-search-btn:hover,
.msh-people-search-btn:focus,
.msh-people-search-btn:focus-visible {
	background-color: var( --msh-accent-hover );
	outline: none;
}
.msh-people-search-btn svg {
	display: block;
	pointer-events: none;
}

/* ============================================================================
   Category tabs
   ============================================================================ */
.msh-people-category-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	border-top: 1px solid var( --msh-filter-border );
	margin: 0 -16px;   /* bleed to filter bar edges */
	padding: 0 16px;
}

.msh-people-tab-btn {
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 500;
	color: #555;
	cursor: pointer;
	transition: color var( --msh-transition ), border-color var( --msh-transition );
	line-height: 1.2;
	margin-bottom: -1px;   /* sit on top of filter bar bottom border */
}

.msh-people-tab-btn:hover {
	color: var( --msh-accent );
}

.msh-people-tab-btn:focus-visible {
	outline: 2px solid var( --msh-accent );
	outline-offset: 2px;
	border-radius: 2px;
}

.msh-people-tab-btn.msh-tab-active {
	color: var( --msh-accent );
	border-bottom-color: var( --msh-accent );
	font-weight: 600;
}

/* ============================================================================
   Results meta row
   ============================================================================ */
.msh-people-results-wrapper .msh-results-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
	font-size: 13px;
	color: #666;
	min-height: 24px;
}

.msh-people-results-count {
	font-weight: 500;
}

.msh-people-clear-filters {
	background: none;
	border: none;
	color: var( --msh-accent );
	font-size: 13px;
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
}
.msh-people-clear-filters:hover {
	color: var( --msh-accent-hover );
}

/* ============================================================================
   Loading overlay
   ============================================================================ */
.msh-people-filter-widget .msh-loading-overlay {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 32px;
}

.msh-people-filter-widget .msh-spinner {
	display: inline-block;
	width: 32px;
	height: 32px;
	border: 3px solid #ddd;
	border-top-color: var( --msh-accent );
	border-radius: 50%;
	animation: msh-spin 0.7s linear infinite;
}

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

/* ============================================================================
   People grid
   ============================================================================ */
.msh-people-grid-inner > .row {
	display: flex;
	flex-wrap: wrap;
	margin-left: -12px;
	margin-right: -12px;
}

.msh-person-col {
	padding-left: 12px;
	padding-right: 12px;
	margin-bottom: 28px;
}

/* ============================================================================
   Person card
   ============================================================================ */
.msh-person-card {
	background: #fff;
	border: 1px solid #e8e8e8;
	border-radius: 6px;
	overflow: hidden;
	text-align: center;
	transition: box-shadow var( --msh-transition ), transform var( --msh-transition );
	height: 100%;
	display: flex;
	flex-direction: column;
}

.msh-person-card:hover {
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.10 );
	transform: translateY( -2px );
}

/* Photo area */
.msh-person-photo-link {
	display: block;
	line-height: 0;
}

.msh-person-photo {
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f0f0f0;
}

.msh-person-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	display: block;
	/* Grayscale → colour on card hover, matching theme demo */
	filter: grayscale( 100% );
	transition: filter 0.3s ease;
}

.msh-person-card:hover .msh-person-photo img,
.msh-person-card:focus-within .msh-person-photo img {
	filter: grayscale( 0% );
}

/* Info area */
.msh-person-info {
	padding: 14px 12px 16px;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
}

.msh-person-name {
	font-size: 15px;
	font-weight: 700;
	margin: 0 0 6px;
	line-height: 1.3;
}

.msh-person-name a {
	color: #222;
	text-decoration: none;
}

.msh-person-name a:hover,
.msh-person-name a:focus {
	color: var( --msh-accent );
	text-decoration: underline;
}

.msh-person-name a:focus-visible {
	outline: 2px solid var( --msh-accent );
	outline-offset: 2px;
	border-radius: 2px;
}

.msh-person-title {
	font-size: 13px;
	color: var( --msh-accent );
	margin: 0;
	line-height: 1.3;
	font-weight: 500;
}

/* ============================================================================
   No results / error
   ============================================================================ */
.msh-people-grid .msh-no-results,
.msh-people-grid .msh-error {
	padding: 32px 16px;
	text-align: center;
	color: #666;
	font-size: 15px;
	grid-column: 1 / -1;
}

/* ============================================================================
   Pagination
   ============================================================================ */
.msh-people-pagination .msh-pagination-nav {
	display: flex;
	justify-content: center;
	margin: 32px 0 0;
}

.msh-people-pagination .msh-page-numbers {
	display: flex;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.msh-people-pagination .msh-page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	font-size: 13px;
	color: #555;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color var( --msh-transition ), color var( --msh-transition );
}

.msh-people-pagination .msh-page-btn:hover {
	background: var( --msh-accent );
	color: #fff;
	border-color: var( --msh-accent );
}

.msh-people-pagination .msh-page-btn:focus-visible {
	outline: 2px solid var( --msh-accent );
	outline-offset: 2px;
}

.msh-people-pagination .msh-page-btn.msh-page-current {
	background: var( --msh-accent );
	color: #fff;
	border-color: var( --msh-accent );
	font-weight: 600;
	cursor: default;
}

.msh-people-pagination .msh-page-ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	color: #aaa;
	font-size: 13px;
}

/* ============================================================================
   Screen reader only utility
   ============================================================================ */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
	border: 0;
}

/* ============================================================================
   Responsive
   ============================================================================ */

/* Tablet: 2-col for 4-col layout */
@media ( max-width: 991px ) {
	.msh-people-filter-widget .col-md-3 {
		width: 50%;
	}
	.msh-people-tab-btn {
		padding: 10px 14px;
		font-size: 13px;
	}
}

/* Mobile */
@media ( max-width: 576px ) {
	.msh-people-filter-widget .col-md-3,
	.msh-people-filter-widget .col-md-4,
	.msh-people-filter-widget .col-sm-6 {
		width: 100%;
	}
	.msh-people-filter-widget .msh-filter-group {
		max-width: 100%;
	}
	.msh-people-category-tabs {
		gap: 0;
	}
	.msh-people-tab-btn {
		font-size: 12px;
		padding: 10px 10px;
	}
}

/* ============================================================================
   Loading state fade-out on grid
   ============================================================================ */
.msh-people-filter-widget.msh-is-loading .msh-people-grid {
	opacity: 0.4;
	transition: opacity 0.15s ease;
}
/* Technical Area filter is hidden on untagged tabs via the [hidden] attribute.
   `.msh-filter-group { display:flex }` would otherwise override the browser's
   default [hidden] { display:none }. */
.msh-people-filter-widget .msh-multiselect[hidden] {
	display: none !important;
}