/*
 * Team — Dentist Cards
 * Card structure from the 21st.dev glassmorphism profile card; the stats panel follows
 * the reference screenshot.
 *
 * Root modifiers (cw-team--shadow, cw-team--snap) sit on the same element as .cw-w, so
 * they are written compound, never as a descendant.
 */

.cw-team {
	--cw-fg: #18181b;
	--cw-muted: #71717a;
	--cw-accent: #2f5fbf;
	--cw-border: rgba(0, 0, 0, 0.1);

	--cw-card-bg: #ffffff;
	--cw-card-width: 340px;
	--cw-card-radius: 1.5rem;
	--cw-card-padding: 2rem;
	--cw-photo: 96px;
	--cw-gap: 1.5rem;

	position: relative;
	width: 100%;
	color: var(--cw-fg);
}

.cw-team__inner {
	width: 100%;
	max-width: 1152px;
	margin-inline: auto;
}

/* --------------------------------------------------------------------- Title block */

.cw-team__header {
	margin-bottom: 3rem;
	text-align: center;
}

.cw-team__eyebrow {
	display: block;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.08em;
	color: var(--cw-accent);
}

.cw-team__heading {
	display: block;
	margin-top: 0.75rem;
}

.cw-team__title {
	/* inline-block so a capped width follows the alignment instead of staying left. */
	display: inline-block;
	font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.25rem);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--cw-fg);
	text-wrap: balance;
}

.cw-w .cw-team__description {
	display: inline-block;
	margin-top: 0.75rem;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--cw-muted);
	text-wrap: pretty;
}

/* ------------------------------------------------------------- Overflow-only rail */

.cw-team__viewport {
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
	/* overflow-x also clips vertically, which cropped the card shadow top and bottom.
	   The default clearance covers the shadow's 8px offset plus its 32px blur; the
	   negative margin cancels it so spacing is unchanged. Horizontal clearance stays
	   small so the rail doesn't push past its container. */
	padding: var(--cw-rail-y, 40px) var(--cw-rail-x, 8px);
	margin: calc(var(--cw-rail-y, 40px) * -1) calc(var(--cw-rail-x, 8px) * -1);
}

.cw-team__viewport::-webkit-scrollbar {
	display: none;
}

.cw-w.cw-team--snap .cw-team__viewport {
	scroll-snap-type: x proximity;
}

/* width:max-content plus auto inline margins is what makes this scroll only when
   needed: while the cards fit, the auto margins centre the row; once they overflow,
   auto resolves to 0 and the row scrolls from the start instead of clipping the first
   card, which is what justify-content:center would do. */
.cw-team__track {
	display: flex;
	align-items: stretch;
	gap: var(--cw-gap);
	width: max-content;
	max-width: 100%;
	margin-inline: auto;
}

/* -------------------------------------------------------------------------- Cards */

.cw-team__card {
	display: flex;
	flex: 0 0 var(--cw-card-width);
	max-width: var(--cw-card-width);
	flex-direction: column;
	align-items: center;
	padding: var(--cw-card-padding);
	border-width: 1px;
	border-color: var(--cw-border);
	border-radius: var(--cw-card-radius);
	background-color: var(--cw-card-bg);
	text-align: center;
	scroll-snap-align: center;
}

.cw-w.cw-team--shadow .cw-team__card {
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.cw-team__photo {
	display: block;
	width: var(--cw-photo);
	height: var(--cw-photo);
	margin-bottom: 1rem;
	padding: 4px;
	border-width: 2px;
	border-color: rgba(0, 0, 0, 0.08);
	border-radius: 9999px;
	flex: 0 0 auto;
}

.cw-w .cw-team__photo img {
	width: 100%;
	height: 100%;
	border-radius: 9999px;
	object-fit: cover;
}

.cw-team__name-heading {
	display: block;
}

.cw-team__name {
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
	color: var(--cw-fg);
}

.cw-team__role {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.4;
	color: var(--cw-accent);
}

.cw-team__bio-wrap {
	position: relative;
	width: 100%;
	margin-top: 1rem;
}

/* The fade sits on the wrapper, not the scrolling element, so it stays pinned to the
   bottom edge instead of scrolling away with the text. The script adds is-scrollable
   only when the text actually overflows, and is-end once it has been read to the
   bottom — so a short bio never shows a fade, and a fully scrolled one stops showing it.
   With scripts blocked no fade appears, which is the safe direction to fail. */
.cw-team__bio-wrap::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: var(--cw-bio-fade, 2rem);
	background-image: linear-gradient(to top, var(--cw-card-bg), transparent);
	opacity: 0;
	transition: opacity 200ms ease;
	pointer-events: none;
}

.cw-w.cw-team--bio-fade .cw-team__bio-wrap.is-scrollable:not(.is-end)::after {
	opacity: 1;
}

.cw-w .cw-team__bio {
	--cw-bio-lines: 4;

	width: 100%;
	font-size: 0.875rem;
	line-height: 1.65;
	color: var(--cw-muted);
	text-wrap: pretty;
}

/* The line cap only applies in the two limited modes, so "Show it all" is unrestricted. */
.cw-w.cw-team--bio-scroll .cw-team__bio,
.cw-w.cw-team--bio-clamp .cw-team__bio {
	/* em fallback; the lh version below is exact and wins where supported. */
	max-height: calc(var(--cw-bio-lines) * 1.65em);
}

/* 1lh is the element's own computed line-height, so the limit stays correct even when
   line-height is changed in the Elementor panel. */
@supports (height: 1lh) {
	.cw-w.cw-team--bio-scroll .cw-team__bio,
	.cw-w.cw-team--bio-clamp .cw-team__bio {
		max-height: calc(var(--cw-bio-lines) * 1lh);
	}
}

.cw-w.cw-team--bio-scroll .cw-team__bio {
	overflow-y: auto;
	/* Stops a flick inside the bio from scrolling the page behind it. */
	overscroll-behavior-y: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--cw-border) transparent;
	padding-right: 0.375rem;
}

/* Without scrolling, the text is clamped instead of cut mid-line. */
.cw-w.cw-team--bio-clamp .cw-team__bio {
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: var(--cw-bio-lines);
	line-clamp: var(--cw-bio-lines);
	-webkit-box-orient: vertical;
}

/* Mobile browsers use overlay scrollbars that disappear when idle, so there is no
   affordance at rest. Forcing `overflow-y: scroll` plus an explicit track keeps one
   visible; the fade above carries the hint where the platform still hides it. */
.cw-w.cw-team--bio-bar .cw-team__bio {
	overflow-y: scroll;
}

.cw-w .cw-team__bio::-webkit-scrollbar {
	-webkit-appearance: none;
	width: 6px;
}

.cw-w.cw-team--bio-bar .cw-team__bio::-webkit-scrollbar-track {
	background-color: transparent;
}

.cw-w .cw-team__bio::-webkit-scrollbar-thumb {
	background-color: var(--cw-border);
	border-radius: 9999px;
}

.cw-w.cw-team--bio-bar .cw-team__bio::-webkit-scrollbar-thumb {
	/* A minimum length so the thumb is legible on long bios. */
	min-height: 24px;
}

/* Paragraph spacing inside the bio. Two classes deep so it outranks the `.cw-w p`
   reset that zeroes margins. */
.cw-w .cw-team__bio p {
	margin: 0;
}

.cw-w .cw-team__bio p + p {
	margin-top: 0.75em;
}

/* Guards against a stray trailing margin adding blank scrollable space. */
.cw-w .cw-team__bio > :last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------- Stats panel */

/* Bordered box, equal columns, hairline dividers between them — as in the reference. */
.cw-team__stats {
	display: flex;
	align-items: stretch;
	width: 100%;
	margin-top: auto;
	padding: 1rem 0;
	border-width: 1px;
	border-color: var(--cw-border);
	border-radius: 0.875rem;
}

/* Pushes the panel to the bottom so panels line up across cards of unequal text length. */
.cw-team__bio-wrap + .cw-team__stats,
.cw-team__role + .cw-team__stats,
.cw-team__name-heading + .cw-team__stats {
	margin-top: 1.5rem;
}

.cw-team__stat {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.25rem;
	min-width: 0;
	padding-inline: 0.5rem;
}

.cw-w.cw-team--dividers .cw-team__stat + .cw-team__stat {
	border-left-width: 1px;
	border-left-color: var(--cw-border);
}

.cw-team__stat-value {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.01em;
	color: var(--cw-fg);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.cw-team__stat-value .cw-icon {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
}

.cw-team__stat-label {
	font-size: 1rem;
	line-height: 1.4;
	color: var(--cw-muted);
}

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

@media (max-width: 767px) {
	.cw-team__header {
		margin-bottom: 2rem;
	}

	.cw-team__stat-value {
		font-size: 1.25rem;
	}

	.cw-team__stat-label {
		font-size: 0.8125rem;
	}

	.cw-team__stat {
		padding-inline: 0.25rem;
	}
}
