/* Ampersand Team — grid + detail popup.
   Everything is themeable through the custom properties below.
   The grid itself stays transparent so it inherits the section background. */

.amp-team {
	--amp-team-cols: 4;
	--amp-team-cols-md: 3;
	--amp-team-cols-sm: 2;
	--amp-team-gap: 2rem;
	--amp-team-ratio: 3 / 4;
	--amp-team-radius: 10px;
	--amp-team-align: center;
	--amp-team-accent: currentColor;
	--amp-team-name-size: 1.0625rem;
	--amp-team-role-size: 0.875rem;
	--amp-team-muted: color-mix(in srgb, currentColor 65%, transparent);
	--amp-team-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--amp-team-duration: 320ms;

	background: none;
}

.amp-team__grid {
	display: grid;
	grid-template-columns: repeat(var(--amp-team-cols), minmax(0, 1fr));
	gap: var(--amp-team-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.amp-team__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* --- Card ---------------------------------------------------------------- */

.amp-team .amp-team__card,
.amp-team .amp-team__card:hover,
.amp-team .amp-team__card:focus,
.amp-team .amp-team__card:active {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	text-align: var(--amp-team-align);
	text-decoration: none;
	transform: none;
	filter: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.amp-team .amp-team__meta,
.amp-team .amp-team__card:hover .amp-team__meta {
	background: none;
}

.amp-team__media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: var(--amp-team-ratio);
	border-radius: var(--amp-team-radius);
	background: color-mix(in srgb, currentColor 8%, transparent);
}

.amp-team__photo {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--amp-team-duration) var(--amp-team-ease);
}

.amp-team__card:hover .amp-team__photo,
.amp-team__card:focus-visible .amp-team__photo {
	transform: scale(1.04);
}

.amp-team__initials {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	font-weight: 600;
	letter-spacing: 0.06em;
	opacity: 0.45;
}

.amp-team .amp-team__card:focus-visible {
	outline: 2px solid var(--amp-team-accent);
	outline-offset: 4px;
	border-radius: var(--amp-team-radius);
}

.amp-team__meta {
	display: block;
	padding-top: 0.85rem;
}

.amp-team__name {
	display: block;
	font-size: var(--amp-team-name-size);
	font-weight: 600;
	line-height: 1.3;
}

.amp-team__role {
	display: block;
	margin-top: 0.15rem;
	font-size: var(--amp-team-role-size);
	color: var(--amp-team-muted);
	line-height: 1.4;
}

@media (max-width: 1024px) {
	.amp-team__grid {
		grid-template-columns: repeat(var(--amp-team-cols-md), minmax(0, 1fr));
	}
}

@media (max-width: 700px) {
	.amp-team {
		--amp-team-gap: 1.25rem;
	}
	.amp-team__grid {
		grid-template-columns: repeat(var(--amp-team-cols-sm), minmax(0, 1fr));
	}
}

/* --- Group sections ------------------------------------------------------ */

.amp-team__group {
	display: block;
}

.amp-team__group + .amp-team__group {
	margin-top: clamp(2.5rem, 6vw, 4rem);
}

.amp-team__group-title {
	margin: 0 0 1.75rem;
	padding-bottom: 0.9rem;
	border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent);
	font-size: clamp(1.05rem, 1.8vw, 1.3rem);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1.2;
	opacity: 0.85;
}

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

.amp-team-modal {
	/* The popup photo is deliberately wider than the card photo. */
	--amp-team-popup-photo: clamp(240px, 40%, 380px);
	--amp-team-popup-ratio: 4 / 5;
	--amp-team-radius: 10px;
	--amp-team-accent: currentColor;
	--amp-team-surface: #fff;
	--amp-team-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--amp-team-duration: 320ms;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(1rem, 4vw, 3rem);
}

.amp-team-modal[hidden] {
	display: none;
}

.amp-team-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(12, 14, 18, 0.55);
	opacity: 0;
	transition: opacity var(--amp-team-duration) var(--amp-team-ease);
	cursor: pointer;
}

.amp-team-modal.is-open .amp-team-modal__backdrop {
	opacity: 1;
}

.amp-team-modal__panel {
	position: relative;
	display: flex;
	gap: clamp(1.25rem, 3vw, 2.5rem);
	width: 100%;
	max-width: 980px;
	max-height: min(88vh, 760px);
	padding: clamp(1.25rem, 3vw, 2rem);
	border-radius: calc(var(--amp-team-radius) + 6px);
	background: var(--amp-team-surface);
	box-shadow: 0 30px 80px -20px rgba(10, 12, 16, 0.45);
	color: #14181f;
	opacity: 0;
	transform: translateY(14px) scale(0.985);
	transition:
		opacity var(--amp-team-duration) var(--amp-team-ease),
		transform var(--amp-team-duration) var(--amp-team-ease);
}

.amp-team-modal.is-open .amp-team-modal__panel {
	opacity: 1;
	transform: none;
}

.amp-team-modal__media {
	position: relative;
	flex: 0 0 auto;
	width: var(--amp-team-popup-photo);
	aspect-ratio: var(--amp-team-popup-ratio);
	overflow: hidden;
	border-radius: var(--amp-team-radius);
	background: rgba(20, 24, 31, 0.08);
}

.amp-team-modal__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.amp-team-modal__body {
	flex: 1 1 auto;
	min-width: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding-right: 0.5rem;
}

.amp-team-modal__close {
	position: absolute;
	top: 0.65rem;
	right: 0.65rem;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(20, 24, 31, 0.06);
	color: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background 150ms ease;
}

.amp-team-modal__close:hover {
	background: rgba(20, 24, 31, 0.12);
}

.amp-team-modal__close:focus-visible {
	outline: 2px solid var(--amp-team-accent);
	outline-offset: 2px;
}

/* --- Detail content ------------------------------------------------------ */

.amp-team-detail__name {
	margin: 0;
	padding-right: 2.5rem;
	font-size: clamp(1.35rem, 2.4vw, 1.75rem);
	line-height: 1.2;
}

.amp-team-detail__role {
	margin: 0.35rem 0 1.1rem;
	font-size: 0.95rem;
	letter-spacing: 0.02em;
	opacity: 0.7;
}

.amp-team-detail__text > :first-child {
	margin-top: 0;
}

.amp-team-detail__text > :last-child {
	margin-bottom: 0;
}

.amp-team-detail__text p {
	margin: 0 0 0.9rem;
	line-height: 1.65;
}

.amp-team-detail__linkedin {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1.25rem;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	color: inherit;
	border-bottom: 2px solid var(--amp-team-accent);
	padding-bottom: 2px;
}

.amp-team-detail__linkedin:hover {
	opacity: 0.7;
}

/* --- Mobile layout ------------------------------------------------------- */

@media (max-width: 700px) {
	.amp-team-modal__panel {
		flex-direction: column;
		gap: 1.1rem;
		max-height: 90vh;
		overflow: hidden;
	}

	.amp-team-modal__media {
		width: 100%;
		aspect-ratio: 3 / 2;
	}
}

/* --- Body scroll lock ---------------------------------------------------- */

body.amp-team-modal-open {
	overflow: hidden;
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.amp-team__photo,
	.amp-team-modal__panel,
	.amp-team-modal__backdrop {
		transition-duration: 1ms !important;
	}
}
