/*
 * Homepage faculty cards (Divi 5 Loop over Workshop Teachers).
 * Layering only; typography and spacing stay in the builder.
 * Background per card comes from the inline rules printed by
 * includes/faculty-cards.php (data-loop-item cycling).
 *
 * Classes to set in the builder:
 *   cr-faculty-card    the looped Group module
 *   cr-faculty-cutout  the Image module holding the cut-out PNG
 *   cr-faculty-text    name and byline modules (kept above the portrait)
 *
 * In the carousel layout Divi puts the module class on the carousel wrapper
 * (.et_pb_group_carousel), and each looped card is a .et_pb_group with
 * data-loop-item inside a slide. In other layouts the class lands on the
 * looped group itself. Both are covered below.
 */
.cr-faculty-card[data-loop-item],
.cr-faculty-card .et_pb_group[data-loop-item] {
	position: relative;
	overflow: hidden;
	border-radius: 14px;
	background-color: #0b0b14;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	/* the card keeps the cut-out canvas ratio (1176x709); content can still grow it */
	aspect-ratio: 1176 / 709;
	color: #fff;
	/* Divi already lays the looped group out as a flex column; the Group loses
	   its Design > Layout controls in carousel mode, so bottom alignment,
	   padding and the gap between name and bylines are set here */
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: var(--cr-card-pad, 20px);
	gap: var(--cr-card-gap, 0px);
	box-sizing: border-box;
}

/* small tab, top left */
.cr-faculty-card[data-loop-item]::before,
.cr-faculty-card .et_pb_group[data-loop-item]::before {
	content: "";
	position: absolute;
	top: 0;
	left: 28px;
	width: 70px;
	height: 7px;
	border-radius: 0 0 4px 4px;
	background: var(--cr-card-tab, #8e44ad);
	z-index: 3;
}

/* cut-out portrait: the PNG has the card's own aspect ratio (tools/cutout
   composes it onto a 1176x709 canvas, person bottom-right), so it simply
   covers the card and scales with it */
.cr-faculty-card .cr-faculty-cutout {
	position: absolute !important;
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--cr-cutout-width, 100%);
	margin: 0 !important;
	padding: 0 !important;
	z-index: 1;
	pointer-events: none;
}
.cr-faculty-card .cr-faculty-cutout .et_pb_image_wrap,
.cr-faculty-card .cr-faculty-cutout img {
	display: block;
	width: 100%;
	height: 100%;
}
.cr-faculty-card .cr-faculty-cutout img {
	object-fit: contain;
	object-position: right bottom;
}

/* name and byline sit above the portrait; the column may overlap the
   person a little */
.cr-faculty-card .cr-faculty-text {
	position: relative;
	z-index: 2;
	max-width: var(--cr-text-width, 64%);
}

/* The name scales with the card width (container query units) so a long
   name never overflows, whatever the slides-per-view: about 5.7% of the card
   width between 14 and 22px. This overrides the builder's font size on the
   name module on purpose; change it with --cr-name-size on the module
   (Advanced > Custom CSS). Bylines keep the size set in the builder. */
.cr-faculty-card .et_pb_group[data-loop-item] {
	container-type: inline-size;
}
.cr-faculty-card .cr-faculty-text {
	overflow-wrap: normal;
}
.cr-faculty-card .cr-faculty-cutout + .cr-faculty-text,
.cr-faculty-card .cr-faculty-cutout + .cr-faculty-text .et_pb_text_inner,
.cr-faculty-card .cr-faculty-cutout + .cr-faculty-text p {
	font-size: var(--cr-name-size, clamp(14px, 5.7cqw, 22px)) !important;
	line-height: 1.1 !important;
}
/* space under the name only; the bylines stack with no gap */
.cr-faculty-card .cr-faculty-cutout + .cr-faculty-text {
	margin-bottom: var(--cr-name-gap, 4px) !important;
}

/* Divi's group carousel has no slide gap (slides are flex 0 0 25% and the
   track moves in whole-page translateX steps, so a flex gap would break the
   maths). Space the cards with slide padding and pull the container out by
   the same amount so the outer cards stay flush with the row. */
.cr-faculty-card .et_pb_group_carousel_slide {
	padding: 0 calc(var(--cr-slide-gap, 16px) / 2);
}
.cr-faculty-card .et_pb_group_carousel_container {
	margin: 0 calc(var(--cr-slide-gap, 16px) / -2);
}

/* Right-side peek: the next card bleeds past the row's right edge (Figma),
   the left edge stays clipped. Divi has no setting for this; it only tags
   the slides outside the window. The section clips the horizontal overflow
   so the page never gets a horizontal scrollbar. */
.cr-faculty-card .et_pb_group_carousel_container {
	overflow: visible;
	clip-path: inset(0 -100vw 0 0);
}
.et_pb_section:has(.cr-faculty-card) {
	overflow-x: clip;
}
