/* Mineral City AI - team grid (flip on desktop, accordion on tablet/phone)
 *
 * Every rule that touches a <button> is written with a two-class selector.
 * The kit stylesheet carries `.elementor-kit-5 button { background-color:
 * var(--e-global-color-6a5f335); padding:10px 30px; border:1px solid;
 * border-radius:20px; font-size:20px }` at (0,1,1), which beats a single
 * class, so `.mcai-team .mcai-member__front` (0,2,0) is the minimum that wins.
 */

.mcai-team {
	--mcai-team-cols: 4;
	--mcai-card-h: 434px;
	--mcai-photo-h: 320px;
	--mcai-photo-img-h: 295px;
	--mcai-col-gap: 32px;
	--mcai-row-gap: 38px;
	--mcai-team-bg: #1C1C1C;
	--mcai-team-pink: #00B8D4;
	--mcai-name-size: 20px;
	--mcai-role-size: 16px;
	--mcai-bio-size: 16px;
	--mcai-arrow: 46px;
	/* The eight cut-outs are pre-cropped to the subject's alpha bounds at the
	   photo box's own 304:295 ratio, so the photo runs edge to edge and `cover`
	   has nothing left to crop. */
	--mcai-photo-pad: 0px;
}

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

/* z-index is pinned at rest and only changes VALUE when a card opens - a card
   that gains a stacking context mid-transition makes the browser re-layer and
   the neighbours flash over it (same lesson as the process timeline). */
.mcai-team .mcai-member {
	position: relative;
	z-index: 1;
	margin: 0;
	padding: 0;
	list-style: none;
}
.mcai-team .mcai-member.is-open { z-index: 2; }

.mcai-team .mcai-member__card {
	position: relative;
	height: var(--mcai-card-h);
	perspective: 1400px;
}

.mcai-team .mcai-member__inner {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform .62s cubic-bezier(.2, .7, .2, 1);
}
.mcai-team .mcai-member.is-open .mcai-member__inner { transform: rotateY(180deg); }

/* ------------------------------------------------------------ both faces */
.mcai-team .mcai-member__front,
.mcai-team .mcai-member__back {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background: var(--mcai-team-bg);
	border: 0;
	border-radius: 10px;
	margin: 0;
	padding: 0;
	color: #FFFFFF;
	font-family: inherit;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	/* hello-elementor's reset.css sets `white-space: nowrap` on every button,
	   which stops the longer roles from wrapping and clips them at the edge. */
	white-space: normal;
	box-shadow: none;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	overflow: hidden;
}

/* ------------------------------------------------------------ front face */
.mcai-team .mcai-member__front,
.mcai-team .mcai-member__front:hover,
.mcai-team .mcai-member__front:focus,
.mcai-team .mcai-member__front:active {
	appearance: none;
	-webkit-appearance: none;
	background: var(--mcai-team-bg);
	background-color: var(--mcai-team-bg);
	border: 0;
	border-radius: 10px;
	color: #FFFFFF;
	cursor: pointer;
	font-size: var(--mcai-role-size);
	outline: none;
	padding: 0;
}
.mcai-team .mcai-member__front:focus-visible,
.mcai-team .mcai-member__close:focus-visible {
	outline: 2px solid var(--mcai-team-pink);
	outline-offset: 3px;
}

.mcai-team .mcai-member__photo {
	flex: 0 0 auto;
	height: var(--mcai-photo-h);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 0 var(--mcai-photo-pad);
	overflow: hidden;
}
/* (0,2,1) - beats the theme reset's `img { height: auto }`.
   The eight cut-outs range from 320x340 to 2201x2454, so the box is filled
   rather than fitted - `contain` would render each head at a different size. */
.mcai-team .mcai-member__photo img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: var(--mcai-photo-img-h);
	object-fit: cover;
	object-position: center top;
	border-radius: 0;
	/* per-member crop: the sources are framed differently (David's is a
	   full-body shot), and Figma crops each fill by hand. */
	transform: translateY(var(--mcai-shift, 0px)) scale(var(--mcai-zoom, 1));
	transform-origin: center top;
}

.mcai-team .mcai-member__meta {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	padding: 24px 16px;
}
.mcai-team .mcai-member__text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	/* 248px on a 304px card, as in Figma - the last 7px slide under the arrow
	   square, which no role is long enough to reach. Sizing it to clear the
	   arrow entirely (220px) pushes the longer roles onto a third line, and the
	   meta band is only tall enough for two. */
	width: calc(100% - 24px);
	word-break: break-word;
}
.mcai-team .mcai-member__name {
	font-size: var(--mcai-name-size);
	font-weight: 600;
	line-height: normal;
	text-transform: uppercase;
	color: #FFFFFF;
}
.mcai-team .mcai-member__role {
	font-size: var(--mcai-role-size);
	font-weight: 400;
	line-height: normal;
	color: #FFFFFF;
}

.mcai-team .mcai-member__arrow {
	position: absolute;
	top: 1px;
	right: 1px;
	width: var(--mcai-arrow);
	height: var(--mcai-arrow);
	display: block;
	pointer-events: none;
}
.mcai-team .mcai-member__arrow svg,
.mcai-team .mcai-member__close svg {
	display: block;
	width: 100%;
	height: 100%;
}
.mcai-team .mcai-member__arrow .mcai-arrow--up { display: none; }
.mcai-team .mcai-member.is-open .mcai-member__arrow .mcai-arrow--down { display: none; }
.mcai-team .mcai-member.is-open .mcai-member__arrow .mcai-arrow--up { display: block; }

/* ------------------------------------------------------------- back face */
.mcai-team .mcai-member__back {
	transform: rotateY(180deg);
	border: 1px solid var(--mcai-team-pink);
	padding: 24px 16px;
	gap: 16px;
}
.mcai-team .mcai-member__backhead {
	position: relative;
	flex: 0 0 auto;
}
/* pulled back out over the face's 24/16 padding + 1px border so the square
   lands on the card edge exactly where the front arrow sits. */
.mcai-team .mcai-member__close,
.mcai-team .mcai-member__close:hover,
.mcai-team .mcai-member__close:focus,
.mcai-team .mcai-member__close:active {
	position: absolute;
	top: -24px;
	right: -16px;
	width: var(--mcai-arrow);
	height: var(--mcai-arrow);
	appearance: none;
	-webkit-appearance: none;
	background: none;
	background-color: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
	font-size: inherit;
	margin: 0;
	outline: none;
	padding: 0;
}

.mcai-team .mcai-member__biowrap {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
}
.mcai-team .mcai-member__bio {
	height: 100%;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding-right: 8px;
	font-size: var(--mcai-bio-size);
	font-weight: 400;
	line-height: 1.4;
	color: #FFFFFF;
	scrollbar-width: thin;
	scrollbar-color: var(--mcai-team-pink) rgba(255, 255, 255, .14);
}
.mcai-team .mcai-member__bio p { margin: 0 0 12px; }
.mcai-team .mcai-member__bio p:last-child { margin-bottom: 0; }
.mcai-team .mcai-member__bio::-webkit-scrollbar { width: 4px; }
.mcai-team .mcai-member__bio::-webkit-scrollbar-track { background: rgba(255, 255, 255, .14); border-radius: 2px; }
.mcai-team .mcai-member__bio::-webkit-scrollbar-thumb { background: var(--mcai-team-pink); border-radius: 2px; }

/* only drawn while there is more bio below the fold */
.mcai-team .mcai-member__biowrap::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 40px;
	background: linear-gradient(to bottom, rgba(28, 28, 28, 0), var(--mcai-team-bg));
	opacity: 0;
	transition: opacity .2s ease;
	pointer-events: none;
}
.mcai-team .mcai-member__biowrap.is-scrollable:not(.is-at-end)::after { opacity: 1; }

/* ------------------------------------------- tablet + phone: accordion */
@media (max-width: 1024px) {
	/* --mcai-photo-h / --mcai-photo-img-h are NOT set here: Elementor's own
	   desktop rule for those controls is (0,3,0) and would win. They come from
	   the widget's tablet_default / mobile_default instead. */
	.mcai-team {
		--mcai-arrow: 52px;
	}
	/* card width varies by device here, so the photo is sized by its own ratio
	   rather than a fixed height - that way nothing is ever cropped */
	.mcai-team .mcai-member__photo {
		height: auto;
		padding: 9px 0 0;
	}
	.mcai-team .mcai-member__photo img { height: auto; }
	.mcai-team .mcai-member__card {
		height: auto;
		perspective: none;
	}
	.mcai-team .mcai-member__inner {
		position: static;
		height: auto;
		transform: none !important;
		transform-style: flat;
		transition: none;
		background: var(--mcai-team-bg);
		border-radius: 10px;
		overflow: hidden;
	}
	.mcai-team .mcai-member__front {
		position: static;
		width: 100%;
		backface-visibility: visible;
		-webkit-backface-visibility: visible;
		border-radius: 10px 10px 0 0;
	}
	.mcai-team .mcai-member__meta { padding: 20px 16px; }
	.mcai-team .mcai-member__arrow { top: 0; right: 0; }

	/* The 0fr -> 1fr grid trick does NOT work here: in this auto-height
	   container Chrome leaves the interpolated track at 0 and the panel never
	   opens. The height is measured and set by mcai-team.js instead. */
	.mcai-team .mcai-member__back {
		position: static;
		display: block;
		height: 0;
		transform: none;
		backface-visibility: visible;
		-webkit-backface-visibility: visible;
		border: 0;
		border-radius: 0 0 10px 10px;
		padding: 0 16px;
		gap: 0;
		transition: height .45s ease;
		overflow: hidden;
	}
	.mcai-team .mcai-member__backhead { display: none; }
	.mcai-team .mcai-member__biowrap {
		min-height: 0;
		overflow: hidden;
	}
	.mcai-team .mcai-member__biowrap::after { display: none; }
	.mcai-team .mcai-member__bio {
		height: auto;
		overflow: visible;
		padding: 0 0 24px;
	}
}

@media (max-width: 1024px) and (prefers-reduced-motion: reduce) {
	.mcai-team .mcai-member__back { transition: none; }
}

/* Flip is desktop-only, so the reduced-motion swap is scoped there too -
   unscoped it would fade the photo out of the mobile card. */
@media (prefers-reduced-motion: reduce) and (min-width: 1025px) {
	.mcai-team .mcai-member__inner {
		transform: none !important;
		transform-style: flat;
		transition: none;
	}
	.mcai-team .mcai-member__front,
	.mcai-team .mcai-member__back {
		backface-visibility: visible;
		-webkit-backface-visibility: visible;
		transition: opacity .15s ease;
	}
	.mcai-team .mcai-member__back {
		transform: none;
		opacity: 0;
		pointer-events: none;
		z-index: 2;
	}
	.mcai-team .mcai-member.is-open .mcai-member__back {
		opacity: 1;
		pointer-events: auto;
	}
	.mcai-team .mcai-member.is-open .mcai-member__front {
		opacity: 0;
		pointer-events: none;
	}
}
