/*
 * Staff Directory (mod_staffdirectory) - Wellspring Global Academy
 *
 * Round photo tiles with a bio popup. Loaded only on pages that show the
 * directory, by html/mod_staffdirectory/default.php in this template.
 * The popup reuses the .team-grid__* type styles from template.css.
 * Colors match the template: navy #21314d, teal #80e0d3, mint #f2fcfb.
 */

/* ---- Sections --------------------------------------------------------- */

/* Every section heading gets the same divider, including the Educational
   Concierge intro block in the article, which carries this class too. */
.staff-section__head {
	border-top: 1px solid #e3e7ec;
	margin-top: 1.5rem;
	padding-top: 2.5rem;
}

/* Centered section headings (and the Educational Concierge intro under its
   heading), to line up with the centered photo tiles. */
.staff-section__head,
.staff-section__head .inside-block__title,
.staff-section__head .inside-block__body {
	text-align: center;
}

.staff-section__head .inside-block__body {
	max-width: 760px;
	margin-left: auto;
	margin-right: auto;
}

/* ---- Tile grid -------------------------------------------------------- */

.staff-tiles {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 2.5rem 1.5rem;
	max-width: 1170px;
	margin: 0 auto;
	padding: 0.5rem 2rem 3rem;
}

@media (max-width: 991px) {
	.staff-tiles {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.staff-tiles {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 2rem 1rem;
		padding-left: 1rem;
		padding-right: 1rem;
	}
}

.staff-tile {
	display: flex;
	justify-content: center;
}

.staff-tile__open {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	max-width: 220px;
	margin: 0;
	padding: 0.5rem;
	border: 0;
	border-radius: 8px;
	background: none;
	color: inherit;
	font: inherit;
	text-align: center;
}

button.staff-tile__open {
	cursor: pointer;
}

button.staff-tile__open:focus-visible {
	outline: 3px solid #21314d;
	outline-offset: 2px;
}

.staff-tile__photo {
	display: block;
	width: 160px;
	max-width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	margin-bottom: 0.9rem;
	border: 3px solid #80e0d3;
	border-radius: 50%;
	object-fit: cover;
	transition: transform 0.2s, box-shadow 0.2s;
}

button.staff-tile__open:hover .staff-tile__photo,
button.staff-tile__open:focus-visible .staff-tile__photo {
	transform: translateY(-3px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.staff-tile__name.team-grid__name {
	font-size: 18px !important;
	margin-bottom: 0.2rem;
}

.staff-tile__role.team-grid__role {
	margin-bottom: 0.4rem;
}

.staff-tile__more {
	color: #21314d;
	font-size: 14px;
	font-weight: 700;
	text-decoration: underline;
	text-decoration-color: #80e0d3;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

/* Two tiles per row: keep titles like "Serving Grades K-2" on one line. */
@media (max-width: 767px) {
	.staff-tile__name.team-grid__name {
		font-size: 16px !important;
	}

	.staff-tile__role.team-grid__role {
		font-size: 11px !important;
		letter-spacing: 0.02em;
	}
}

/* ---- Popup ------------------------------------------------------------ */

.staff-dialog {
	width: min(680px, calc(100% - 2rem));
	max-height: calc(100% - 2rem);
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	overflow: auto;
}

.staff-dialog::backdrop {
	background: rgba(33, 49, 77, 0.65);
}

.staff-dialog__inner {
	display: flex;
	align-items: flex-start;
	gap: 1.5rem;
	padding: 2.5rem 2rem 2rem;
	text-align: left;
}

.staff-dialog__photo.team-grid__photo {
	flex-shrink: 0;
	width: 140px;
	height: 140px;
}

.staff-dialog__close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #21314d;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.staff-dialog__close:hover,
.staff-dialog__close:focus-visible {
	background: #f2fcfb;
}

.staff-dialog__close:focus-visible {
	outline: 3px solid #21314d;
}

.staff-dialog .team-grid__contact {
	flex-wrap: wrap;
}

/* Keep the page behind the popup from scrolling. */
body:has(.staff-dialog[open]) {
	overflow: hidden;
}

@media (max-width: 575px) {
	.staff-dialog__inner {
		flex-direction: column;
		align-items: center;
		padding: 2.75rem 1.25rem 1.5rem;
		text-align: center;
	}

	.staff-dialog .team-grid__contact {
		justify-content: center;
	}

	.staff-dialog .team-grid__quote {
		border-left: 0;
		padding-left: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.staff-tile__photo {
		transition: none;
	}
}
