/*
 * The person grid and overlay (inc/people.php), used by [up_staff] (About) and [up_people] (the
 * cast). Colors use the role tokens, so a dark page (assets/css/dark.css) recolors them; the dark
 * adjustments are at the end. Rules on headings and buttons start "html body" to outrank Salient's.
 */

/* ---- Grid ---------------------------------------------------------------- */

.up-ds ul.up-people {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 28px 22px;
}

.up-ds .up-people > li {
	list-style: none;
	margin: 0;
	padding: 0;
}

@media (max-width: 540px) {
	.up-ds ul.up-people {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 22px 14px;
	}
}

html body .up-ds .up-person__card {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--up-ink);
	font: inherit;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	line-height: 1.3;
}

html body .up-ds button.up-person__card {
	cursor: pointer;
}

.up-ds .up-person__photo {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	border: 3px solid var(--up-line);
	border-radius: var(--up-radius-tile);
	background: var(--up-surface-soft);
	box-shadow: 0 5px 0 var(--up-line);
	transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

/* A photo fills the box edge to edge: pinned to all four sides, with Salient's 15px image margin
   and height: auto overridden (below; they left a sliver of the box showing), on a dark backing. */
.up-ds .up-person__photo:not(.up-person__photo--none) {
	background: var(--up-black);
}

.up-ds .up-person__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	object-position: 50% 25%;
}

.up-ds .up-person__initials {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--up-font-display);
	font-size: clamp(38px, 6vw, 56px);
	line-height: 1;
	color: var(--up-red);
}

.up-ds .up-person__text {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.up-ds .up-person__name {
	font-size: 19px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--up-ink);
}

.up-ds .up-person__pronouns {
	font-size: 15px;
	line-height: 1.3;
	color: var(--up-muted);
}

.up-ds .up-person__titles {
	font-size: 16px;
	line-height: 1.35;
	color: var(--up-muted);
}

.up-ds button.up-person__card:hover .up-person__photo {
	transform: translateY(-3px);
	box-shadow: 0 8px 0 var(--up-red);
	border-color: var(--up-red);
}

.up-ds button.up-person__card:hover .up-person__name {
	color: var(--up-accent-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* The focus ring goes round the photo and name together. */
.up-ds button.up-person__card:focus-visible {
	outline: 3px solid var(--up-ink);
	outline-offset: 6px;
	border-radius: var(--up-radius-tile);
}

.up-ds .up-people__empty {
	margin: 0;
	padding: 18px 22px;
	background: var(--up-surface-soft);
	border-radius: var(--up-radius-tile);
	color: var(--up-ink);
}

/* ---- Person overlay ------------------------------------------------------ */

/* Salient's own image rules (a 15px bottom margin, height: auto) outrank plain .up-ds ones. */
html body .up-ds .up-person__img,
html body .up-ds .up-person-detail__img {
	margin: 0;
}

html body .up-ds .up-person__img {
	width: 100%;
	height: 100%;
}

html.up-dialog-open,
html.up-dialog-open body {
	overflow: hidden;
}

.up-ds.up-person-dialog {
	width: min(820px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100dvh - 48px);
	margin: auto;
	padding: 0;
	border: 3px solid var(--up-black);
	border-radius: var(--up-radius-card);
	background: var(--up-surface);
	color: var(--up-ink);
	box-shadow: 0 10px 0 var(--up-black);
	overflow: hidden;
}

.up-ds.up-person-dialog[open] {
	display: flex;
	flex-direction: column;
}

.up-ds.up-person-dialog::backdrop {
	background: rgba(20, 20, 20, 0.72);
}

/* The box that scrolls; the close button sits outside it, so it never scrolls away. */
.up-person-dialog__inner {
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	padding: clamp(22px, 4vw, 40px);
}

.up-ds .up-person-dialog__inner:focus-visible {
	outline: 3px solid var(--up-ink);
	outline-offset: -6px;
	border-radius: var(--up-radius-card);
}

html body .up-ds .up-person-dialog__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 2px solid var(--up-black);
	border-radius: 50%;
	background: var(--up-white);
	color: var(--up-black);
	cursor: pointer;
	box-shadow: none;
}

html body .up-ds .up-person-dialog__close:hover {
	background: var(--up-black);
	color: var(--up-white);
}

.up-ds .up-person-detail {
	display: grid;
	grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
	gap: clamp(22px, 4vw, 36px);
	align-items: start;
}

.up-ds .up-person-detail--no-photo {
	grid-template-columns: minmax(0, 1fr);
}

.up-ds .up-person-detail__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	object-position: 50% 25%;
	border: 3px solid var(--up-black);
	border-radius: var(--up-radius-tile);
	background: var(--up-butter);
}

/* Beside a long bio, the photo stays in view while the bio scrolls. */
@media (min-width: 641px) {
	.up-ds .up-person-detail__img {
		position: sticky;
		top: 0;
	}
}

.up-ds .up-person-detail__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-right: 48px; /* clear of the close button */
}

html body .up-ds .up-person-detail__name {
	margin: 0;
	padding: 0;
	font-family: var(--up-font-display);
	font-weight: 400;
	font-size: clamp(28px, 4vw, 38px);
	line-height: 1.1;
	letter-spacing: 0;
	text-transform: none;
	color: var(--up-ink);
}

.up-ds .up-person-detail__pronouns {
	margin: 0;
	padding: 0;
	font-size: 16px;
	color: var(--up-muted);
}

.up-ds .up-person-detail__titles {
	margin: 0;
	padding: 0;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--up-accent-text);
}

.up-ds .up-person-detail__bio {
	margin-top: 10px;
	font-size: 17px;
	line-height: 1.6;
}

.up-ds .up-person-detail__bio p {
	margin: 0 0 0.9em;
	padding: 0;
}

.up-ds .up-person-detail__bio > :last-child {
	margin-bottom: 0;
}

@media (max-width: 640px) {
	.up-ds.up-person-dialog {
		width: calc(100vw - 20px);
		max-height: calc(100dvh - 20px);
	}

	.up-ds .up-person-detail {
		grid-template-columns: minmax(0, 1fr);
	}

	.up-ds .up-person-detail__img {
		width: min(220px, 62%);
	}

	.up-ds .up-person-detail__body {
		padding-right: 0;
	}
}

/* ---- On a dark page ------------------------------------------------------ */

body.up-dark .up-ds .up-person__initials {
	color: var(--up-yellow);
}

body.up-dark .up-ds button.up-person__card:hover .up-person__photo {
	border-color: var(--up-yellow);
	box-shadow: 0 8px 0 var(--up-yellow);
}

body.up-dark .up-ds.up-person-dialog {
	border-color: var(--up-line);
	box-shadow: none;
}

body.up-dark .up-ds .up-person-detail__img {
	border-color: var(--up-line);
	background: var(--up-surface-soft);
}

/* ---- Roster ([up_people]): names only, a little smaller ------------------ */

.up-ds ul.up-people--roster {
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 26px 18px;
}

@media (max-width: 540px) {
	.up-ds ul.up-people--roster {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px 14px;
	}
}

.up-ds .up-people--roster .up-person__name {
	font-size: 17px;
}
