/* Team member (docs/widgets/team-member.md), in the design language (spec §3.7). This is Soft, the
   default: white cards with a thin border and a soft shadow, round photos, profile links on pale
   accent circles. Fonts come from the theme. team-member-outline.css and team-member-solid.css change
   only the --hafe-team-d-* tokens below, so a Style control's own property always wins.

   Each card holds four parts in rows shared with the cards beside it (subgrid): photo, name and
   role, text, links. So every name, text and row of links starts at the same height; the role
   stays right under its name. */
.hafe-team {
	--hafe-team-d-bg: var(--hafe-surface);
	--hafe-team-d-line: var(--hafe-line);
	--hafe-team-d-shadow: var(--hafe-shadow);
	--hafe-team-d-radius: var(--hafe-radius);
	--hafe-team-d-photo-line: transparent;
	--hafe-team-d-photo-radius: 50%;
	--hafe-team-d-cover-radius: var(--hafe-radius-sm);
	--hafe-team-d-link: var(--hafe-tint);
	--hafe-team-d-link-ink: var(--hafe-accent-ink);
	--hafe-team-d-link-line: transparent;
	--hafe-team-d-link-hover: var(--hafe-accent);
	--hafe-team-d-link-hover-ink: var(--hafe-on-accent);
	--hafe-team-d-align: center;
	--hafe-team-d-items: center;
	color: var(--hafe-ink);
}

.hafe-team--photo-side {
	--hafe-team-d-align: start;
	--hafe-team-d-items: flex-start;
}

.hafe-team__items {
	display: grid;
	grid-template-columns: repeat(var(--hafe-team-columns, 3), minmax(0, 1fr));
	gap: var(--hafe-team-gap, 1.5rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.hafe-team__item,
.hafe-team__card {
	display: grid;
	grid-row: span 4;
	grid-template-rows: subgrid;
	grid-template-columns: minmax(0, 1fr);
	row-gap: 0;
	min-inline-size: 0;
	margin: 0;
	padding: 0;
}

/* Positioned, so the text hidden for screen readers stays inside the card. */
.hafe-team__card {
	position: relative;
	box-sizing: border-box;
	padding: var(--hafe-team-padding, 1.75em);
	border: var(--hafe-team-line-width, 1px) solid var(--hafe-team-line, var(--hafe-team-d-line));
	border-radius: var(--hafe-team-radius, var(--hafe-team-d-radius));
	background: var(--hafe-team-bg, var(--hafe-team-d-bg));
	box-shadow: var(--hafe-team-d-shadow);
	text-align: var(--hafe-team-align, var(--hafe-team-d-align));
}

.hafe-team__photo {
	box-sizing: border-box;
	display: block;
	grid-row: 1;
	justify-self: var(--hafe-team-items, var(--hafe-team-d-items));
	inline-size: var(--hafe-team-photo-size, 7.5em);
	max-inline-size: 100%;
	aspect-ratio: 1;
	margin-block-end: 1.25em;
	overflow: hidden;
	border: 2px solid var(--hafe-team-d-photo-line);
	border-radius: var(--hafe-team-photo-radius, var(--hafe-team-d-photo-radius));
}

.hafe-team--photo-cover .hafe-team__photo {
	justify-self: stretch;
	inline-size: 100%;
	aspect-ratio: var(--hafe-team-ratio, 1);
	border-radius: var(--hafe-team-photo-radius, var(--hafe-team-d-cover-radius));
}

.hafe-team__photo img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	max-inline-size: none;
	margin: 0;
	object-fit: cover;
}

.hafe-team__head {
	grid-row: 2;
}

.hafe-team .hafe-team__name {
	margin: 0;
	color: var(--hafe-team-name-color, var(--hafe-ink));
	font-size: 1.1875em;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: break-word;
}

.hafe-team .hafe-team__name a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.hafe-team .hafe-team__role {
	margin: 0.25em 0 0;
	color: var(--hafe-team-role-color, var(--hafe-ink-soft));
	font-size: 0.9375em;
	overflow-wrap: break-word;
}

.hafe-team__bio {
	grid-row: 3;
	margin-block-start: 0.875em;
	color: var(--hafe-team-bio-color, var(--hafe-ink));
}

.hafe-team .hafe-team__bio p {
	margin: 0 0 0.75em;
}

.hafe-team .hafe-team__bio p:last-child {
	margin: 0;
}

.hafe-team .hafe-team__links {
	display: flex;
	flex-wrap: wrap;
	grid-row: 4;
	justify-content: var(--hafe-team-items, var(--hafe-team-d-items));
	gap: 0.5em;
	margin: 1.25em 0 0;
	padding: 0;
	list-style: none;
}

.hafe-team .hafe-team__links li {
	margin: 0;
	padding: 0;
}

/* Each link is at least a 36 px target (WCAG 2.5.8 asks 24 px). */
.hafe-team .hafe-team__link {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	inline-size: var(--hafe-team-link-size, 2.25rem);
	block-size: var(--hafe-team-link-size, 2.25rem);
	border: 1px solid var(--hafe-team-d-link-line);
	border-radius: 50%;
	background: var(--hafe-team-link-bg, var(--hafe-team-d-link));
	color: var(--hafe-team-link-ink, var(--hafe-team-d-link-ink));
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s;
}

.hafe-team .hafe-team__link:hover {
	background: var(--hafe-team-link-hover-bg, var(--hafe-team-d-link-hover));
	color: var(--hafe-team-link-hover-ink, var(--hafe-team-d-link-hover-ink));
}

.hafe-team__link svg {
	inline-size: 58%;
	block-size: 58%;
	fill: currentColor;
}

/* Email and phone written out: a line each, above the icons, the address itself as the link. */
.hafe-team .hafe-team__contact {
	flex-basis: 100%;
}

.hafe-team .hafe-team__text-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	color: var(--hafe-team-bio-color, var(--hafe-ink));
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	overflow-wrap: anywhere;
}

.hafe-team__text-link svg {
	flex: none;
	inline-size: 1.1em;
	block-size: 1.1em;
	fill: var(--hafe-team-link-ink, var(--hafe-accent-ink));
	color: var(--hafe-team-link-ink, var(--hafe-accent-ink));
}

/* Stated here too: some packs take the outline off every focused link or button, site-wide. */
.hafe-team .hafe-team__text-link:focus-visible,
.hafe-team .hafe-team__link:focus-visible,
.hafe-team .hafe-team__name a:focus-visible {
	outline: 2px solid var(--hafe-accent);
	outline-offset: 2px;
}

/* Beside the name: the photo in its own column, down the first three rows. */
.hafe-team--photo-side .hafe-team__card {
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 1.25em;
}

.hafe-team--photo-side .hafe-team__photo {
	grid-row: 1 / span 3;
	grid-column: 1;
	align-self: start;
	inline-size: var(--hafe-team-photo-size, 5em);
	margin: 0;
}

.hafe-team--photo-side .hafe-team__head,
.hafe-team--photo-side .hafe-team__bio,
.hafe-team--photo-side .hafe-team__links {
	grid-column: 2;
}

.hafe-team--photo-side .hafe-team__head {
	grid-row: 1;
}

.hafe-team--photo-side .hafe-team__bio {
	grid-row: 2;
}

.hafe-team--photo-side .hafe-team__links {
	grid-row: 3;
}

.hafe-team__sr {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.hafe-team .hafe-team__link {
		transition: none;
	}
}

.hafe-empty {
	margin: 0;
	padding: 1em;
	border: 1px dashed currentColor;
	opacity: 0.7;
}
