/* All People directory — Isotope grid with filter/sort toolbar */

/* Page layout */
.ap-page {
	min-height: 100vh;
	background: #fff;
	color: #000;
}

.ap-container {
	width: min(94vw, 1200px);
	margin: 0 auto;
	padding-left: 1rem;
	padding-right: 1rem;
}

/* Header */
.ap-header {
	padding: 2rem 0 1.25rem;
	border-bottom: 1px solid #000;
}
/* Typography moved to the shared `.pm-title, .ap-header__title` block
 * in `css/generic.css` (v0.6.16) — this selector is preserved as a
 * hook in case we ever need All People-specific page-title tweaks. */
.ap-header__title { /* typography inherited from generic.css */ }
.ap-header__intro {
	max-width: 640px;
	color: #444;
	line-height: 1.6;
}
.ap-header__intro p:last-child { margin-bottom: 0; }

/* Toolbar */
.ap-toolbar {
	position: sticky;
	top: 0;
	z-index: 10;
	background: #fff;
	border-bottom: 1px solid #000;
	padding: 0.75rem 0;
}

/* Top bar: count + toggle button */
.ap-toolbar__top {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

/* Toggle button (always visible, primarily useful on small screens) */
.ap-toolbar__toggle {
	display: none;
	align-items: center;
	gap: 0.5rem;
	padding: 0.375rem 0.75rem;
	border: 1px solid #000;
	border-radius: 0;
	background: #fff;
	color: #000;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
}
.ap-toolbar__toggle:hover { background: #f2f2f2; }
.ap-toolbar__toggle-icon {
	width: 10px;
	height: 10px;
	border-right: 2px solid #000;
	border-bottom: 2px solid #000;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
	margin-top: -3px;
}
.ap-toolbar__toggle[aria-expanded="false"] .ap-toolbar__toggle-icon {
	transform: rotate(-135deg);
	margin-top: 2px;
}

/* Collapsible body */
.ap-toolbar__body {
	display: grid;
	gap: 0.75rem;
	margin-top: 0.75rem;
	overflow: hidden;
	transition: grid-template-rows 0.25s ease, opacity 0.2s ease;
}

/* Row 1: filters */
.ap-toolbar__row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1rem;
}

/* Row 2: search left, sort right */
.ap-toolbar__row--controls {
	justify-content: space-between;
}

/* Filter groups */
.ap-filter-group {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}
.ap-filter-group__label {
	font-size: 0.7rem;
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #555;
}
.ap-filter-group__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}
.ap-filter-btn {
	padding: 0.375rem 0.75rem;
	border: 1px solid #000;
	border-radius: 0;
	background: #fff;
	color: #000;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.12s, color 0.12s;
	white-space: nowrap;
}
.ap-filter-btn:hover { background: #f2f2f2; }
.ap-filter-btn.is-active {
	background: #000;
	color: #fff;
}

/* Search */
.ap-search {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}
.ap-search__label {
	font-size: 0.7rem;
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #555;
}
.ap-search__input {
	padding: 0.375rem 0.75rem;
	border: 1px solid #000;
	border-radius: 0;
	background: #fff;
	color: #000;
	font-size: 0.85rem;
	width: 180px;
	outline: none;
}
.ap-search__input:focus {
	box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}
.ap-search__input::placeholder { color: #999; }

/* Sort */
.ap-sort {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}
.ap-sort__label {
	font-size: 0.7rem;
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #555;
}
.ap-sort__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}
.ap-sort-btn {
	padding: 0.375rem 0.75rem;
	border: 1px solid #000;
	border-radius: 0;
	background: #fff;
	color: #000;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.12s, color 0.12s;
	white-space: nowrap;
}
.ap-sort-btn:hover { background: #f2f2f2; }
.ap-sort-btn.is-active {
	background: #000;
	color: #fff;
}

/* Results count */
.ap-results-count {
	margin: 0;
	font-size: 0.8rem;
	color: #888;
	font-weight: 700;
}

/* Grid */
.ap-grid {
	padding: 1.5rem 0;
}

/* Sizer elements — Isotope measures these for column + gutter widths */
.ap-grid-sizer,
.ap-card {
	width: calc(20% - 16px);
}
.ap-gutter-sizer {
	width: 20px;
}

.ap-card {
	margin-bottom: 20px;
	background: #fff;
	border: 1px solid rgba(0,0,0,0.1);
	overflow: hidden;
	transition: box-shadow 0.2s ease;
	text-align: center;
}
.ap-card:hover {
	box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.ap-card__link {
	display: block;
	text-decoration: none;
	color: inherit;
	padding: 1rem 0.75rem 0.75rem;
	transition: transform 0.2s ease;
}
.ap-card:hover .ap-card__link {
	transform: translateY(-3px);
}

/* Circular image */
.ap-card__image {
	width: 80px;
	height: 80px;
	border-radius: 999px;
	overflow: hidden;
	background: #eee;
	margin: 0 auto 0.75rem;
	border: 2px solid rgba(0,0,0,0.08);
}
.ap-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Card body — centred text */
.ap-card__body {
	display: flex;
	flex-direction: column;
	align-items: center;
}
.ap-card__name {
	font-size: 0.85rem;
	font-weight: 900;
	margin: 0 0 0.2rem;
	line-height: 1.2;
}
.ap-card__cats {
	margin: 0 0 0.2rem;
	font-size: 0.7rem;
	color: #555;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.ap-card__years {
	margin: 0 0 0.3rem;
	font-size: 0.75rem;
	color: #777;
}

.ap-card__stats {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.375rem;
	margin-top: 0.25rem;
}
.ap-card__stat {
	font-size: 0.7rem;
	font-weight: 700;
	color: #999;
	white-space: nowrap;
}

/* Connections button */
.ap-card__connections-btn {
	appearance: none;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 999px;
	background: transparent;
	padding: 0.2rem 0.6rem;
	cursor: pointer;
	color: #555;
	transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ap-card__connections-btn:hover {
	background: #000;
	color: #fff;
	border-color: #000;
}

/* Footer */
.ap-footer {
	padding: 2rem 0;
	border-top: 1px solid rgba(0,0,0,0.08);
}

/* -------------------------------------------------------
   Connections Modal
------------------------------------------------------- */
.ap-modal {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	pointer-events: none;
	z-index: 100;
}
.ap-modal[aria-hidden="false"] {
	pointer-events: auto;
}

.ap-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.5);
	opacity: 0;
	transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.ap-modal[data-state="opening"] .ap-modal__backdrop,
.ap-modal[data-state="open"]    .ap-modal__backdrop { opacity: 1; }
.ap-modal[data-state="closing"] .ap-modal__backdrop { opacity: 0; }

.ap-modal__panel {
	position: relative;
	width: min(92vw, 560px);
	max-height: 80vh;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #000;
	padding: 1.5rem;
	box-shadow: 0 18px 60px rgba(0,0,0,0.2);
	transform: translateY(16px) scale(0.98);
	opacity: 0;
	transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1), opacity 300ms cubic-bezier(0.22, 1, 0.36, 1);
	-webkit-overflow-scrolling: touch;
}
.ap-modal[data-state="opening"] .ap-modal__panel,
.ap-modal[data-state="open"]    .ap-modal__panel { transform: translateY(0) scale(1); opacity: 1; }
.ap-modal[data-state="closing"] .ap-modal__panel { transform: translateY(16px) scale(0.98); opacity: 0; }

.ap-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 36px;
	height: 36px;
	border: 1px solid #000;
	border-radius: 0;
	background: #fff;
	color: #000;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.ap-modal__close:hover { background: #f2f2f2; }

.ap-modal__title {
	margin: 0 0 1rem;
	font-size: 1rem;
	font-weight: 900;
	padding-right: 2rem;
}

/* Connection avatars grid */
.ap-modal__avatars {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: center;
}
.ap-modal__avatar {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.375rem;
	text-decoration: none;
	color: #000;
	width: 72px;
}
.ap-modal__avatar:hover .ap-modal__avatar-img { border-color: #000; }
.ap-modal__avatar-img {
	width: 60px;
	height: 60px;
	border-radius: 999px;
	overflow: hidden;
	border: 2px solid rgba(0,0,0,0.1);
	background: #eee;
	flex-shrink: 0;
}
.ap-modal__avatar-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.ap-modal__avatar-name {
	font-size: 0.7rem;
	font-weight: 700;
	text-align: center;
	line-height: 1.2;
}

/* Responsive */
@media (max-width: 1100px) {
	.ap-grid-sizer, .ap-card { width: calc(25% - 15px); }
}
@media (max-width: 860px) {
	.ap-grid-sizer, .ap-card { width: calc(33.333% - 14px); }

	/* Show toggle button, collapse toolbar by default */
	.ap-toolbar__toggle { display: inline-flex; }
	.ap-toolbar__body {
		margin-top: 0;
		max-height: 0;
		opacity: 0;
		overflow: hidden;
		transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.2s ease;
	}
	.ap-toolbar__body.is-open {
		max-height: 500px;
		opacity: 1;
		margin-top: 0.75rem;
	}
	.ap-toolbar__row--controls {
		flex-direction: column;
		gap: 0.75rem;
	}
	.ap-search__input { width: 100%; }
}
@media (max-width: 580px) {
	.ap-grid-sizer, .ap-card { width: calc(50% - 10px); }
}
@media (max-width: 340px) {
	.ap-grid-sizer, .ap-card { width: 100%; }
	.ap-gutter-sizer { width: 0; }
}
