/* Team Section Styles */

.team-section {
	position: relative;
	overflow: hidden;
	padding: 100px 0 150px;
	background: #fff;
	min-height: 800px;
}

/* Background Large Text */
.team-bg-text {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: max-content;
	font-size: clamp(48px, 10vw, 160px);
	font-weight: 800;
	color: rgba(0, 0, 0, 0.03);
	white-space: nowrap;
	z-index: 1;
	pointer-events: none;
	text-transform: uppercase;
	letter-spacing: -2px;
	transition: opacity 0.5s ease;
}

/* Background Image (faded) */
.team-bg-image-container {
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 70%;
	max-width: 900px;
	height: 100%;
	z-index: 0;
	pointer-events: none;
	opacity: 0.25; /* Made it more visible */
	transition: opacity 0.6s ease;
}

.team-bg-image-container img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: bottom;
	mask-image: linear-gradient(to top, transparent 0%, black 20%);
	-webkit-mask-image: linear-gradient(to top, transparent 0%, black 20%);
}

.team-section-title {
	position: relative;
	z-index: 3;
	color: var(--uptrail-primary-700);
	margin-bottom: 50px;
	text-align: center;
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
}

.team-section-title--split {
	display: block;
	text-align: left;
}

.team-section-title--split .team-section-title__lead,
.team-section-title--split .accent-text {
	display: block;
}

.team-section-title--split .accent-text {
	margin-top: 0.08em;
}

.team-carousel-wrapper {
	position: relative;
	width: 100%;
	height: 450px;
	z-index: 5;
	max-width: 1200px;
	margin: 0 auto;
}

/* The curved dashed line */
.team-arc-svg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
	pointer-events: none;
}

/* Avatars along the curve */
.team-avatars-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 2;
	pointer-events: none; /* Let clicks pass through empty space */
}

.team-avatar {
	position: absolute;
	width: 110px;
	height: 110px;
	border-radius: 50%;
	overflow: hidden;
	background: #fff;
	transform: translate(-50%, -50%) scale(1);
	transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
	cursor: pointer;
	box-shadow: 0 5px 15px rgba(0,0,0,0.05);
	filter: grayscale(100%);
	opacity: 0;
	pointer-events: auto;
}

.team-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.team-avatar.active {
	transform: translate(-50%, -50%) scale(1.2);
	filter: grayscale(0%);
	box-shadow: 0 10px 25px rgba(0,0,0,0.15);
	opacity: 0 !important; /* Hide the central avatar because it's in the card */
	pointer-events: none;
}

/* Active Card (Center) */
.team-active-area {
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
}

.team-active-card {
	background: #fff;
	border-radius: 12px;
	padding: 20px;
	width: 380px;
	box-shadow: 0 20px 50px rgba(0,150,255,0.15);
	display: flex;
	gap: 20px;
	align-items: flex-start;
	opacity: 1;
	transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	margin-bottom: 20px;
	cursor: pointer;
}

.team-active-card::after {
	content: "Xem hồ sơ";
	position: absolute;
	right: 16px;
	bottom: 11px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--uptrail-primary-600, #1f5a49);
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.team-active-card:hover,
.team-active-card:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 24px 60px rgba(31, 90, 73, 0.22);
}

.team-active-card:hover::after,
.team-active-card:focus-visible::after {
	opacity: 1;
	transform: translateY(0);
}

.team-active-card:focus-visible {
	outline: 3px solid var(--uptrail-gold-500, #c9923e);
	outline-offset: 4px;
}

.team-card-image {
	width: 100px;
	height: 100px;
	border-radius: 8px;
	overflow: hidden;
	flex-shrink: 0;
	box-shadow: 0 5px 15px rgba(0,0,0,0.1);
	margin-top: -40px; /* Overlap effect */
	background: #fff;
}

.team-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.team-card-content {
	flex-grow: 1;
}

.team-card-name {
	font-size: 18px;
	font-weight: 700;
	color: #000;
	margin: 0 0 5px;
}

.team-card-role {
	font-size: 14px;
	color: #888;
	margin: 0 0 15px;
}

.team-card-socials {
	display: flex;
	gap: 12px;
	margin-bottom: 15px;
}

.team-card-socials a {
	color: #555;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #f5f5f5;
	transition: all 0.3s ease;
}

.team-card-socials a:hover,
.team-card-socials a:focus-visible {
	color: var(--uptrail-primary-800, #123b32);
	background: var(--color-gold, var(--uptrail-gold-500, #c9923e));
	box-shadow: 0 6px 16px rgba(201, 146, 62, 0.34);
	transform: translateY(-2px);
}

.team-card-socials a:focus-visible {
	outline: 2px solid var(--uptrail-primary-600, #1f5a49);
	outline-offset: 2px;
}

.team-card-socials svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
}

.team-card-bio {
	font-size: 13px;
	line-height: 1.6;
	color: #666;
	margin: 0;
}

.team-card-profile-link {
	margin: -10px 0 14px;
	color: var(--uptrail-primary-600, #1f5a49);
	font-size: 12px;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.team-card-profile-link:focus-visible {
	outline: 2px solid var(--uptrail-gold-500, #c9923e);
	outline-offset: 3px;
}

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

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

.team-profile-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: grid;
	place-items: center;
	padding: clamp(20px, 5vw, 64px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.24s ease, visibility 0.24s ease;
}

.team-profile-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.team-profile-modal__backdrop {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(circle at 24% 22%, rgba(255, 255, 255, 0.8), transparent 36%),
		rgba(225, 238, 235, 0.88);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	cursor: pointer;
}

.team-profile-modal__dialog {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
	gap: clamp(26px, 5vw, 54px);
	width: min(780px, calc(100vw - 80px));
	max-height: min(680px, calc(100vh - 80px));
	padding: clamp(34px, 5vw, 58px);
	background: #fff;
	border: 1px solid rgba(31, 90, 73, 0.1);
	border-radius: 26px;
	box-shadow: 0 30px 90px rgba(14, 47, 39, 0.24);
	outline: none;
	overflow: visible;
	transform: translateY(18px) scale(0.97);
	transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.team-profile-modal.is-open .team-profile-modal__dialog {
	transform: translateY(0) scale(1);
}

.team-profile-modal__close {
	position: absolute;
	top: 18px;
	right: 18px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: var(--uptrail-primary-800, #123b32);
	background: #eef4f1;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.team-profile-modal__close:hover,
.team-profile-modal__close:focus-visible {
	color: #fff;
	background: var(--uptrail-primary-600, #1f5a49);
	transform: rotate(5deg);
}

.team-profile-modal__close:focus-visible {
	outline: 3px solid var(--uptrail-gold-300, #e8c254);
	outline-offset: 3px;
}

.team-profile-modal__close svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

.team-profile-modal__visual {
	position: relative;
	align-self: start;
	margin-left: -84px;
}

.team-profile-modal__visual img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	border: 7px solid #fff;
	border-radius: 20px;
	box-shadow: 0 18px 42px rgba(14, 47, 39, 0.22);
}

.team-profile-modal__photo-mark {
	position: absolute;
	right: -12px;
	bottom: 18px;
	padding: 7px 11px;
	border-radius: 999px;
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.12em;
	color: var(--uptrail-primary-800, #123b32);
	background: var(--uptrail-gold-300, #e8c254);
}

.team-profile-modal__content {
	min-width: 0;
	max-height: calc(100vh - 196px);
	padding-right: 8px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(31, 90, 73, 0.4) transparent;
}

.team-profile-modal__name {
	margin: 0 48px 7px 0;
	font-size: clamp(26px, 3vw, 38px);
	line-height: 1.08;
	letter-spacing: -0.035em;
	color: var(--uptrail-primary-900, #0d2f28);
}

.team-profile-modal__role {
	margin: 0 0 18px;
	font-size: 15px;
	font-weight: 600;
	color: #7a8581;
}

.team-profile-modal__socials {
	margin-bottom: 22px;
}

.team-profile-modal__socials a {
	width: 34px;
	height: 34px;
}

.team-profile-modal__socials svg {
	width: 16px;
	height: 16px;
}

.team-profile-modal__bio {
	font-size: 15px;
	line-height: 1.75;
	color: #4f5e59;
}

.team-profile-modal__bio > :first-child {
	margin-top: 0;
}

.team-profile-modal__bio > :last-child {
	margin-bottom: 0;
}

.team-profile-modal__bio a {
	color: var(--uptrail-primary-600, #1f5a49);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

/* Nav Buttons */
.team-nav-buttons {
	display: flex;
	align-items: center;
	background: var(--uptrail-primary-600, #1f5a49);
	border-radius: 30px;
	padding: 5px 15px;
	box-shadow: 0 10px 24px rgba(31, 90, 73, 0.28);
	transition: background-color var(--duration-fast, 200ms) ease,
		box-shadow var(--duration-fast, 200ms) ease;
}

.team-nav-buttons:hover {
	background: var(--uptrail-primary-700, #17332d);
	box-shadow: 0 12px 28px rgba(31, 90, 73, 0.34);
}

.team-nav-btn {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease;
}

.team-nav-btn:hover {
	transform: scale(1.1);
}

.team-nav-btn:focus-visible {
	outline: 2px solid var(--uptrail-gold-300, #e8c254);
	outline-offset: 2px;
	border-radius: 50%;
}

.team-nav-btn svg {
	width: 20px;
	height: 20px;
}

.team-nav-divider {
	width: 1px;
	height: 20px;
	background: rgba(255,255,255,0.3);
	margin: 0 10px;
}

/* Responsive */
@media (max-width: 768px) {
	.team-active-card {
		width: 90%;
		max-width: 320px;
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
	
	.team-card-image {
		margin-top: -50px;
		margin-bottom: 15px;
	}
	
	.team-card-socials {
		justify-content: center;
	}
	
	.team-arc-line {
		bottom: 180px;
	}
	
	.team-active-card::after {
		display: none;
	}

	.team-profile-modal {
		align-items: end;
		padding: 72px 12px 12px;
	}

	.team-profile-modal__dialog {
		grid-template-columns: 1fr;
		gap: 16px;
		width: 100%;
		max-height: calc(100dvh - 84px);
		padding: 72px 24px 28px;
		border-radius: 24px;
		overflow: visible;
	}

	.team-profile-modal__visual {
		position: absolute;
		top: -54px;
		left: 24px;
		width: 108px;
		margin: 0;
	}

	.team-profile-modal__visual img {
		aspect-ratio: 1;
		border-width: 5px;
		border-radius: 16px;
	}

	.team-profile-modal__photo-mark {
		display: none;
	}

	.team-profile-modal__content {
		max-height: calc(100dvh - 184px);
		padding-right: 3px;
	}

	.team-profile-modal__name {
		margin-right: 34px;
	}

	.team-profile-modal__name {
		font-size: 28px;
	}

	.team-profile-modal__bio {
		font-size: 14px;
		line-height: 1.7;
	}
}

@media (prefers-reduced-motion: reduce) {
	.team-profile-modal,
	.team-profile-modal__dialog {
		transition: none;
	}
}
