/*
 * TEAM-5: the team by department.
 * One group for each department: its name over a hairline, then its people
 * as small portrait cards with the name, the role and the letters after the
 * name. The theme repeats the group for every department of the site
 * (inc/team-departments.php); people who have no department come first,
 * without a name over them. Two cards side by side on a phone and three on a
 * tablet, under the department's name. On a desktop the name stands beside
 * its people, so a department of one or two does not leave the line half
 * empty.
 */

/* ---------- One department ---------- */

.wprk-team-5 .wprk-team-5__group > * {
	margin-block: 0;
}

/* The space between two departments. */
.wprk-team-5 .wprk-team-5__group + .wprk-team-5__group {
	margin-block-start: var(--wp--preset--spacing--60);
}

.wprk-team-5 .wprk-team-5__group > .wprk-team-5__department {
	border-block-end: 1px solid var(--wprk-border);
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.2;
	margin-block-end: var(--wp--preset--spacing--40);
	overflow-wrap: break-word;
	padding-block-end: var(--wp--preset--spacing--20);
}

/* ---------- Its people ---------- */

.wprk-team-5 .wprk-team-5__list {
	display: grid;
	gap: var(--wp--preset--spacing--40) var(--wp--preset--spacing--30);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.wprk-team-5 .wprk-team-5__list > li {
	margin: 0;
	min-width: 0;
}

.wprk-team-5 .wprk-team-5__person > * {
	margin-block: 0;
}

.wprk-team-5 .wprk-team-5__person > .wp-block-post-featured-image {
	margin-block-end: var(--wp--preset--spacing--20);
}

/* A portrait that is taller than its frame keeps its top, so a head is never cut off. */
.wprk-team-5 .wp-block-post-featured-image img {
	border-radius: var(--wprk-picture-radius, var(--wp--custom--radius--md));
	object-position: top center;
	width: 100%;
}

.wprk-team-5 .wprk-team-5__person > .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.25;
	overflow-wrap: break-word;
}

.wprk-team-5 .wprk-team-5__person > .wprk-team-5__role {
	color: var(--wprk-accent-text);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.4;
	margin-block-start: var(--wp--preset--spacing--10);
	overflow-wrap: break-word;
}

.wprk-team-5 .wprk-team-5__person > .wprk-team-5__letters {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
	margin-block-start: 0.15rem;
	overflow-wrap: break-word;
}

/*
 * Front end only: a person without a role or without letters leaves no gap.
 * In the editor the empty field stays in place, so it can still be reached.
 */
.wprk-team-5 .wprk-team-5__person > :where(.wprk-team-5__role, .wprk-team-5__letters):not(.block-editor-block-list__block):empty {
	display: none;
}

/*
 * A person without a portrait, among people who have one, gets a quiet frame
 * of the same size, so the names stay on one line. Where nobody has a
 * portrait there are no frames: the list is names only.
 */
.wprk-team-5:has(.wp-block-post-featured-image) .wprk-team-5__list > li:not(:has(.wp-block-post-featured-image)) .wprk-team-5__person::before {
	aspect-ratio: 4 / 5;
	background:
		radial-gradient(ellipse 17% 13.6% at 50% 40%, var(--wprk-border) 0 97%, transparent 100%),
		radial-gradient(ellipse 34% 30% at 50% 100%, var(--wprk-border) 0 98%, transparent 100%),
		var(--wprk-soft);
	border-radius: var(--wprk-picture-radius, var(--wp--custom--radius--md));
	content: "";
	display: block;
	margin-block-end: var(--wp--preset--spacing--20);
}

/* ---------- Wider screens ---------- */

@media (min-width: 600px) {
	.wprk-team-5 .wprk-team-5__list {
		gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/*
 * Desktop: the department's name in a column of its own, its people beside
 * it, three to a line, and one hairline over both. A list that has no name
 * (people without a department, a site without departments) takes the full
 * width, four to a line, with no hairline.
 */
@media (min-width: 1024px) {
	.wprk-team-5 .wprk-team-5__group {
		align-items: start;
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
	}

	.wprk-team-5 .wprk-team-5__group > .wprk-team-5__department,
	.wprk-team-5 .wprk-team-5__group > .wprk-team-5__people {
		border-block-end: 0;
		border-block-start: 1px solid var(--wprk-border);
		margin-block-end: 0;
		padding-block: var(--wp--preset--spacing--40) 0;
	}

	.wprk-team-5 .wprk-team-5__group > .wprk-team-5__department {
		align-self: stretch;
		padding-inline-end: var(--wp--preset--spacing--40);
	}

	.wprk-team-5 .wprk-team-5__group > .wprk-team-5__people {
		grid-column: 2;
	}

	.wprk-team-5 .wprk-team-5__group > .wprk-team-5__people:first-child {
		border-block-start: 0;
		grid-column: 1 / -1;
		padding-block-start: 0;
	}

	.wprk-team-5 .wprk-team-5__group > .wprk-team-5__people:first-child .wprk-team-5__list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
