/**
 * Home "People behind progress": avatar tabs switching a Medical Profile.
 * Markup: template-parts/v2/sections/home-people.php
 */
@layer sections {
	.lb-v2-people__inner {
		display: grid;
		gap: 1.875rem; /* 30px: avatars → portrait */
	}

	.lb-v2-people__intro {
		display: grid;
		align-content: space-between;
		gap: var(--lb-v2-space-7);
	}

	.lb-v2-people__tabs {
		display: flex;
		flex-wrap: wrap;
		gap: var(--lb-v2-people-tabs-gap);
	}

	.lb-v2-people__tab {
		position: relative;
		/* Fit four avatars and three gaps on narrow mobile screens. */
		width: min(5rem, calc((100% - 3 * var(--lb-v2-people-tabs-gap)) / 4));
		height: auto;
		aspect-ratio: 1;
		flex-shrink: 0;
		padding: 0;
		overflow: hidden;
		border: 0;
		border-radius: var(--lb-v2-radius-pill);
		background: var(--lb-v2-color-grey-200);
		cursor: pointer;
	}

	.lb-v2-people__tab img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	/* The pink overlay fades in when an avatar is selected; hover previews it at 60%. */
	.lb-v2-people__tab::after {
		content: "";
		position: absolute;
		inset: 0;
		background: var(--lb-v2-color-accent-overlay);
		opacity: 0;
		pointer-events: none;
		transition: opacity var(--lb-v2-duration-fade-md) var(--lb-v2-ease);
	}

	@media (hover: hover) {
		.lb-v2-people__tab:hover::after {
			opacity: 0.6;
		}
	}

	.lb-v2-people__tab[aria-selected="true"]::after,
	.lb-v2-people__tab[aria-selected="true"]:hover::after {
		opacity: 1;
	}

	/*
	 * All profiles share one grid cell and crossfade. The [hidden] attribute still marks the
	 * inactive ones, but they fade out instead of leaving the layout, so the height never jumps.
	 */
	.lb-v2-people__panel {
		grid-column: 1;
		grid-row: 2;
		display: grid;
		gap: var(--lb-v2-space-7); /* 40px */
		transition: opacity var(--lb-v2-duration-fade-md) var(--lb-v2-ease), visibility var(--lb-v2-duration-fade-md);
	}

	.lb-v2-people__panel[hidden] {
		display: grid;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
	}

	.lb-v2-people__portrait {
		width: 100%;
		max-width: 27.25rem;
		aspect-ratio: 436 / 608;
		object-fit: cover;
		border-radius: var(--lb-v2-radius-md);
		background: var(--lb-v2-color-grey-200);
	}

	.lb-v2-people__profile {
		--lb-v2-people-gap: var(--lb-v2-stack-gap); /* 20px; 24px on desktop */
		display: grid;
		justify-items: start;
		gap: var(--lb-v2-people-gap);
	}

	.lb-v2-people__profile > .lb-v2-link {
		margin-top: calc(var(--lb-v2-cta-gap) - var(--lb-v2-people-gap));
	}

	.lb-v2-people__person {
		display: grid;
	}

	.lb-v2-people__name {
		font-weight: 700;
	}

	.lb-v2-people__role {
		font-style: italic;
	}

	@media (min-width: 48rem) {
		.lb-v2-people__tabs {
			--lb-v2-people-tabs-gap: var(--lb-v2-space-3);
		}

		/* 80px at 1440; shrinks so four avatars stay on one row in the narrower desktop intro column. */
		.lb-v2-people__tab {
			width: clamp(4rem, 5.5vw, 5rem);
			height: clamp(4rem, 5.5vw, 5rem);
		}

		.lb-v2-people__panel {
			grid-template-columns: minmax(0, 27.25rem) minmax(0, 17.5rem);
			align-items: center;
			column-gap: var(--lb-v2-space-7);
		}
	}

	@media (min-width: 80rem) {
		.lb-v2-people {
			padding-bottom: var(--lb-v2-section-space-sm);
		}

		.lb-v2-people__inner {
			grid-template-columns: minmax(0, 1fr) auto;
			align-items: center;
			column-gap: var(--lb-v2-space-7);
		}

		.lb-v2-people__panel {
			grid-column: 2;
			grid-row: 1;
		}

		/* Figma: 80px above and below, 40px on the right, heading at the top and avatars at the bottom. */
		.lb-v2-people__intro {
			align-self: stretch;
			padding: var(--lb-v2-space-10) var(--lb-v2-space-7) var(--lb-v2-space-10) 0;
		}

		.lb-v2-people__profile {
			--lb-v2-people-gap: var(--lb-v2-space-5);
		}

		/*
		 * Solo (one profile, no face tabs): center the heading against the portrait.
		 * Multi keeps space-between so avatars stay at the bottom.
		 */
		.lb-v2-people--solo .lb-v2-people__intro {
			align-content: center;
		}
	}
}
