/*
 * ASAE Cohorts — Public shortcode CSS.
 *
 * Card grid with native <dialog>-based bio overlay. The grid stays
 * compact regardless of which cards have long bios, because bios live
 * in a modal overlay rather than expanding inline. Cards with a bio
 * are a plain <div> (so the <h3> name keeps heading semantics) holding
 * a real "Read bio" <button>; its ::after is stretched over the card
 * so the whole card stays clickable. Activating it calls
 * dialog.showModal(). The browser handles focus trap, focus restore,
 * Escape-to-close, and the role="dialog" + aria-modal="true"
 * semantics natively.
 *
 * Layout: 4 columns at desktop, stepping to 3 / 2 / 1 as the
 * container narrows. Stacking below 1200px is the workspace-wide
 * responsive convention.
 */

.asae-cohorts-roster {
	margin: 1em 0;
	color: inherit;
	font-family: inherit;
}

.asae-cohorts-grid {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.25em;
	/*
	 * Default `align-items: stretch` is left in place — every <li>
	 * grid item reaches the same height as its row's tallest sibling.
	 * The card inside each <li> then fills that height via
	 * `height: 100%` (below), so cards in the same row are uniformly
	 * sized. Content stays top-aligned via the card-body flex column
	 * with `justify-content: flex-start`; when a card's content is
	 * shorter than the row, the leftover space sits at the bottom
	 * of the card (inside the bordered surface).
	 */
}

.asae-cohorts-person {
	/* Flex column so the inner card's `height: 100%` resolves against
	 * the grid-stretched LI height. */
	display: flex;
	flex-direction: column;
}

/* Card surface — applied to both the no-bio <div> variant and the
 * has-bio <button> variant so they look identical.
 *
 * Card itself is a flex column: height:100% so it fills the grid-
 * stretched LI; the inner card-body grows via flex:1 to fill the
 * card. Content inside card-body anchors to the top with
 * justify-content:flex-start. Net effect for a row with mixed text
 * lengths: every card is the same height, every photo and text
 * block sits at the same top-aligned position, and any unused
 * vertical space appears uniformly at the bottom of the shorter
 * cards. */
.asae-cohorts-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	background: var(--nv-site-bg, #fff);
	border: 1px solid var(--asae-border-subtle, #dddddd);
	border-radius: var(--asae-radius, 3px);
	overflow: hidden;
	color: inherit;
	font: inherit;
	text-align: left;
	padding: 0;
}
/*
 * Interactive card (has a bio).
 *
 * The card is a positioned <div>; the "Read bio" <button> inside it
 * stretches an ::after over the whole card so the click target is the
 * full card, exactly as before — without nesting the heading/text
 * inside the button.
 *
 * Hover is deliberately quiet: white card → light-grey background,
 * no shadow, no lift, no scale. "Read bio" gains an underline on
 * hover/focus. Selectors are scoped under .asae-cohorts-roster for
 * 0,2,0+ specificity, and the button re-declares colour AND a
 * transparent background on every state so theme button rules (Neve
 * paints its primary-button fill on button:hover) can't override it.
 */
.asae-cohorts-roster .asae-cohorts-card.has-trigger {
	position: relative;
	cursor: pointer;
	transition: background-color 0.12s ease;
}
.asae-cohorts-roster .asae-cohorts-card.has-trigger:hover,
.asae-cohorts-roster .asae-cohorts-card.has-trigger:focus-within {
	background: var(--asae-surface, #f7f7f7);
}
.asae-cohorts-roster .asae-cohorts-card-trigger,
.asae-cohorts-roster .asae-cohorts-card-trigger:hover,
.asae-cohorts-roster .asae-cohorts-card-trigger:focus,
.asae-cohorts-roster .asae-cohorts-card-trigger:active {
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: 0;
	min-height: 0;
	text-transform: none;
	letter-spacing: normal;
	color: var(--nv-primary-accent, #bd491e);
	font-family: inherit;
	font-weight: 600;
	font-size: 0.92em;
	line-height: inherit;
	text-align: left;
	cursor: pointer;
}
/* Stretched hit area: covers the whole card. */
.asae-cohorts-roster .asae-cohorts-card-trigger::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}
.asae-cohorts-roster .asae-cohorts-card.has-trigger:hover .asae-cohorts-card-trigger,
.asae-cohorts-roster .asae-cohorts-card-trigger:focus-visible {
	text-decoration: underline;
}
/* Focus ring: drawn around the whole card (as before) when the button
 * has keyboard focus; falls back to a ring on the button itself where
 * :has() isn't supported. */
.asae-cohorts-roster .asae-cohorts-card-trigger:focus-visible {
	outline: 2px solid var(--nv-primary-accent, #bd491e);
	outline-offset: 2px;
}
@supports selector(:has(*)) {
	.asae-cohorts-roster .asae-cohorts-card.has-trigger:has(.asae-cohorts-card-trigger:focus-visible) {
		outline: 2px solid var(--nv-primary-accent, #bd491e);
		outline-offset: 2px;
	}
	.asae-cohorts-roster .asae-cohorts-card-trigger:focus-visible {
		outline: none;
	}
}

/* Visually hidden; still read by screen readers. */
.asae-cohorts-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.asae-cohorts-card-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	gap: 0.75em;
	padding: 1em;
}

/*
 * Square-cropped photo. Matches the asae-staff-roster /
 * asae-group-rosters convention: `aspect-ratio` lives on a wrapper
 * <div> (a block element where the rule is unambiguous) and the
 * inner <img> fills 100%/100% with object-fit:cover. Putting
 * aspect-ratio on the <img> directly can be defeated by theme rules
 * that set explicit dimensions or `object-fit: contain` on every
 * img — which left some cards (portrait sources like 251×300) with
 * extra vertical chrome inside the card on the live site.
 */
.asae-cohorts-photo-wrap {
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: var(--asae-radius-media, 3px);
	overflow: hidden;
	background: var(--asae-surface, #f7f7f7);
}
.asae-cohorts-photo-wrap img,
.asae-cohorts-photo-wrap .asae-cohorts-photo {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.asae-cohorts-photo-wrap.is-empty {
	background: repeating-linear-gradient(
		45deg,
		var(--asae-surface, #f7f7f7),
		var(--asae-surface, #f7f7f7) 8px,
		var(--nv-light-bg, #ededed) 8px,
		var(--nv-light-bg, #ededed) 16px
	);
}

.asae-cohorts-text {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
}

.asae-cohorts-name {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
	line-height: 1.25;
}
.asae-cohorts-job-title {
	margin: 0;
	font-weight: 600;
}
.asae-cohorts-organization {
	margin: 0;
	color: var(--nv-text-color, #2b2b2b);
}
.asae-cohorts-bio-indicator {
	margin-top: 0.4em;
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	color: var(--nv-primary-accent, #bd491e);
	font-weight: 600;
	font-size: 0.92em;
}
.asae-cohorts-bio-indicator {
	align-self: flex-start;
}
.asae-cohorts-bio-chevron {
	display: inline-block;
	font-size: 1.2em;
	line-height: 1;
}

.asae-cohorts-empty {
	padding: 1em 1.25em;
	background: var(--asae-surface, #f7f7f7);
	border-left: 4px solid var(--asae-border-subtle, #dddddd);
	margin: 1em 0;
}

/* ── Bio dialog overlay ─────────────────────────────────────────────── */

/* The <dialog> element. Closed state hides it; .showModal() reveals it.
 * Centered by the browser by default for modal dialogs; we just size and
 * decorate. The backdrop is styled via the ::backdrop pseudo. */
.asae-cohorts-dialog {
	padding: 0;
	border: 0;
	border-radius: var(--asae-radius, 3px);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	max-width: min(640px, 92vw);
	max-height: 88vh;
	width: 100%;
	background: var(--nv-site-bg, #fff);
	color: inherit;
	font: inherit;
	overflow: hidden; /* let the inner scroll instead of the dialog */
}
.asae-cohorts-dialog::backdrop {
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(2px);
}
.asae-cohorts-dialog-inner {
	display: flex;
	flex-direction: column;
	max-height: 88vh;
	overflow-y: auto;
	position: relative;
}

/*
 * Close button: rounded square (10px), light-grey base with a dark
 * X, inverting to dark-with-white-X on hover/focus. Strong contrast
 * is preserved in BOTH states. Selectors are scoped via .asae-cohorts-
 * dialog to push specificity past theme `.button:hover` rules that
 * could otherwise repaint the icon to whatever the theme's button
 * color happens to be (which previously rendered the X white on a
 * near-white background). The `transition` covers the same three
 * properties theme rules typically animate, so the swap stays smooth
 * even when a theme rule wins on a property we didn't expect.
 */
.asae-cohorts-dialog .asae-cohorts-dialog-close {
	position: sticky;
	top: 0;
	align-self: flex-end;
	margin: 0.5em 0.5em -2.5em 0; /* negative margin so content can flow under it */
	z-index: 2;
	width: 2.25em;
	height: 2.25em;
	font-size: 1.5em;
	line-height: 1;
	border: 1px solid var(--asae-border-control, #767676);
	background: var(--asae-surface, #f7f7f7);
	border-radius: var(--asae-radius-sm, 2px);
	cursor: pointer;
	color: var(--nv-text-color, #2b2b2b);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.asae-cohorts-dialog .asae-cohorts-dialog-close:hover,
.asae-cohorts-dialog .asae-cohorts-dialog-close:focus-visible {
	background: var(--nv-secondary-accent, #333333);
	color: #fff;
	border-color: var(--nv-secondary-accent, #333333);
}
.asae-cohorts-dialog .asae-cohorts-dialog-close:focus-visible {
	outline: 2px solid var(--nv-primary-accent, #bd491e);
	outline-offset: 2px;
}

/* Header section: photo on the left, name / job / org on the right. */
.asae-cohorts-dialog-header {
	display: flex;
	gap: 1em;
	padding: 1.5em 1.5em 0.75em;
	align-items: flex-start;
}
.asae-cohorts-dialog-photo {
	flex-shrink: 0;
	width: 120px;
	height: 120px;
	object-fit: cover;
	border-radius: var(--asae-radius-media, 3px);
	background: var(--asae-surface, #f7f7f7);
}
.asae-cohorts-dialog-meta {
	flex: 1;
	min-width: 0;
	padding-right: 2em; /* keep clear of the absolute close button */
}
.asae-cohorts-dialog-name {
	margin: 0 0 0.25em;
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.2;
}
.asae-cohorts-dialog-job-title {
	margin: 0 0 0.15em;
	font-weight: 600;
}
.asae-cohorts-dialog-organization {
	margin: 0;
	color: var(--nv-text-color, #2b2b2b);
}

.asae-cohorts-dialog-bio {
	padding: 0.75em 1.5em 1.5em;
	border-top: 1px solid var(--asae-border-subtle, #dddddd);
	margin-top: 1em;
}
.asae-cohorts-dialog-bio p:first-child {
	margin-top: 1em;
}
.asae-cohorts-dialog-bio p:last-child {
	margin-bottom: 0;
}
.asae-cohorts-dialog-bio a {
	color: var(--nv-primary-accent, #bd491e);
}

/* Mobile / narrow viewports: dialog goes near-full-width, header
 * stacks photo above the meta block. */
@media (max-width: 600px) {
	.asae-cohorts-dialog {
		max-width: 96vw;
		max-height: 92vh;
		border-radius: var(--asae-radius, 3px);
	}
	.asae-cohorts-dialog-header {
		flex-direction: column;
		align-items: center;
		text-align: center;
		padding-top: 1em;
	}
	.asae-cohorts-dialog-photo {
		width: 96px;
		height: 96px;
	}
	.asae-cohorts-dialog-meta {
		padding-right: 0;
	}
}

@media (max-width: 1199px) {
	.asae-cohorts-grid {
		grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	}
}
@media (max-width: 600px) {
	.asae-cohorts-grid {
		grid-template-columns: 1fr;
	}
}
