/* =====================================================
   Future Minds Consulting — Coaches Grid + Profile Modal
   wfm.tonalli.ro

   Palette matches ../wfm-education-testimonials/ and fm-tnli-coach-map,
   taken from the site's Divi global colors:
     --fmc-cg-primary   #E25F70  coral
     --fmc-cg-secondary #FBB79E  peach
     --fmc-cg-tan       #FAD5A6  warm tan
     --fmc-cg-heading   #4C384A  plum
     --fmc-cg-muted     #866768  mauve

   Typography: --fmc-cg-font-heading / --fmc-cg-font-body are overwritten at
   runtime by wp_add_inline_style() with the families set in Divi -> Theme
   Options -> Typography. The declarations here are the fallback for the
   preview file and for any page where that inline style is missing; they end
   in `inherit`, so the worst case is still the theme's own font rather than
   a hard-coded one.
   ===================================================== */

.fmc-cg-wrapper {
	--fmc-cg-primary: #e25f70;
	--fmc-cg-secondary: #fbb79e;
	--fmc-cg-tan: #fad5a6;
	--fmc-cg-heading: #4c384a;
	--fmc-cg-muted: #866768;
	--fmc-cg-body: rgba(0, 0, 0, 0.78);
	--fmc-cg-white: #ffffff;
	--fmc-cg-surface: #ffffff;
	--fmc-cg-hairline: rgba(134, 103, 104, 0.18);

	--fmc-cg-font-heading: var(--et_global_heading_font, inherit);
	--fmc-cg-font-body: var(--et_global_body_font, inherit);

	--fmc-cg-radius: 18px;
	--fmc-cg-cols: 4;
	--fmc-cg-cols-l: 3;
	--fmc-cg-cols-t: 2;
	--fmc-cg-photo: 78px;

	position: relative;
	max-width: 1200px;
	margin: 0 auto;
	padding: 10px 0;
	box-sizing: border-box;
	font-family: var(--fmc-cg-font-body);
}

.fmc-cg-wrapper *,
.fmc-cg-wrapper *::before,
.fmc-cg-wrapper *::after {
	box-sizing: border-box;
}

.fmc-cg-wrapper .screen-reader-text,
.fmc-cg-modal .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* =====================================================
   GRID
   ===================================================== */

.fmc-cg-grid {
	display: grid;
	grid-template-columns: repeat(var(--fmc-cg-cols), minmax(0, 1fr));
	gap: 24px;
	align-items: stretch;
}

/* The item is the grid child so the card can fill the row's height —
   that's what keeps a row of cards level when one name wraps to two lines. */
.fmc-cg-item {
	display: flex;
	min-width: 0;
}

/* =====================================================
   CARD

   The whole card is a <button>: keyboard-reachable and announced as opening
   a dialog, with no nested interactive elements to trap focus.
   ===================================================== */

.fmc-cg-card {
	display: flex;
	align-items: stretch;
	gap: 16px;
	width: 100%;
	margin: 0;
	padding: 22px 20px;
	text-align: left;
	background: var(--fmc-cg-surface);
	border: 1px solid var(--fmc-cg-hairline);
	border-radius: var(--fmc-cg-radius);
	box-shadow: 0 6px 20px rgba(76, 56, 74, 0.08);
	font-family: var(--fmc-cg-font-body);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.fmc-cg-card:hover,
.fmc-cg-card:focus-visible {
	transform: translateY(-4px);
	border-color: rgba(226, 95, 112, 0.35);
	box-shadow: 0 16px 34px rgba(226, 95, 112, 0.18);
	outline: none;
}

.fmc-cg-card:focus-visible {
	outline: 2px solid var(--fmc-cg-primary);
	outline-offset: 3px;
}

/* Circular photo with a gradient ring in the brand peach/tan. */
.fmc-cg-card__photo {
	position: relative;
	flex: 0 0 auto;
	align-self: flex-start;
	display: block;
	width: var(--fmc-cg-photo);
	height: var(--fmc-cg-photo);
	overflow: hidden;
	border-radius: 50%;
	box-shadow: 0 4px 12px rgba(76, 56, 74, 0.16);
}

.fmc-cg-card__photo img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	background: var(--fmc-cg-white);
}

.fmc-cg-card__photo.is-placeholder {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: var(--fmc-cg-secondary);
}

.fmc-cg-card__photo.is-placeholder svg {
	display: block;
	width: 90%;
	height: 90%;
	fill: var(--fmc-cg-white);
	opacity: 0.75;
	transform: translateY(6%);
}

.fmc-cg-card__body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
	flex: 1 1 auto;
}

/* Long names: wrap rather than truncate — a clipped name reads as a bug.
   `balance` evens the two lines out, and `anywhere` stops a single very long
   surname from pushing the card wider than its column. */
.fmc-cg-card__name {
	font-family: var(--fmc-cg-font-heading);
	font-size: 16.5px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--fmc-cg-heading);
	overflow-wrap: anywhere;
	word-break: break-word;
	hyphens: auto;
	text-wrap: balance;
}

.fmc-cg-card__cred {
	margin-top: 2px;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0.03em;
	color: var(--fmc-cg-primary);
	overflow-wrap: anywhere;
}

.fmc-cg-card__loc {
	display: flex;
	align-items: flex-start;
	gap: 5px;
	margin-top: 3px;
	font-size: 12.5px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--fmc-cg-muted);
	min-width: 0;
}

.fmc-cg-card__loc svg {
	flex: 0 0 auto;
	width: 12px;
	height: 12px;
	margin-top: 2px;
	fill: var(--fmc-cg-secondary);
}

.fmc-cg-card__loc span {
	min-width: 0;
	overflow-wrap: anywhere;
}

/* Kept in the layout at all times so hovering can't shift the card's height. */
.fmc-cg-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: auto;
	padding-top: 10px;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--fmc-cg-primary);
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.fmc-cg-card:hover .fmc-cg-card__cta,
.fmc-cg-card:focus-visible .fmc-cg-card__cta {
	opacity: 1;
	transform: none;
}

.fmc-cg-card__cta svg {
	width: 11px;
	height: 11px;
	stroke: currentColor;
}

/* ---- Vertical variant: photo above centred text ---- */

.fmc-cg-wrapper--vertical {
	--fmc-cg-photo: 112px;
}

.fmc-cg-wrapper--vertical .fmc-cg-card {
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 30px 20px 24px;
	text-align: center;
}

/* Stretch so margin-top:auto on the CTA still reaches the card's bottom edge
   — otherwise the column layout sizes the body to its content and the CTA
   floats mid-card in a row levelled by a taller neighbour. */
.fmc-cg-wrapper--vertical .fmc-cg-card__body {
	align-self: stretch;
	align-items: center;
	text-align: center;
}

.fmc-cg-wrapper--vertical .fmc-cg-card__loc {
	justify-content: center;
}

.fmc-cg-empty {
	padding: 20px;
	color: #866768;
	text-align: center;
}

/* The server-rendered profile copy, cloned into the dialog on open. */
.fmc-cg-detail[hidden] {
	display: none;
}

/* =====================================================
   MODAL

   A native <dialog>, so it sits in the browser's top layer — above Divi's
   fixed header and section stacking with no z-index fight — and brings focus
   trapping, Esc-to-close and an inert background for free.

   The variables are repeated here because the dialog is appended to <body>,
   outside .fmc-cg-wrapper's scope.
   ===================================================== */

.fmc-cg-modal {
	--fmc-cg-primary: #e25f70;
	--fmc-cg-secondary: #fbb79e;
	--fmc-cg-tan: #fad5a6;
	--fmc-cg-heading: #4c384a;
	--fmc-cg-muted: #866768;
	--fmc-cg-body: rgba(0, 0, 0, 0.78);
	--fmc-cg-white: #ffffff;
	--fmc-cg-surface: #ffffff;
	--fmc-cg-hairline: rgba(134, 103, 104, 0.18);
	--fmc-cg-font-heading: var(--et_global_heading_font, inherit);
	--fmc-cg-font-body: var(--et_global_body_font, inherit);
	--fmc-cg-radius: 18px;

	width: min(720px, calc(100vw - 32px));
	max-height: min(88vh, 820px);
	padding: 0;
	border: 0;
	border-radius: var(--fmc-cg-radius);
	background: var(--fmc-cg-surface);
	color: var(--fmc-cg-body);
	box-shadow: 0 30px 70px rgba(76, 56, 74, 0.35);
	overflow: visible;
	font-family: var(--fmc-cg-font-body);
}

.fmc-cg-modal *,
.fmc-cg-modal *::before,
.fmc-cg-modal *::after {
	box-sizing: border-box;
}

.fmc-cg-modal::backdrop {
	background: rgba(76, 56, 74, 0.55);
	backdrop-filter: blur(3px);
}

.fmc-cg-modal__inner {
	position: relative;
	max-height: min(88vh, 820px);
	padding: 44px 44px 38px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-radius: inherit;
}

/* Brand gradient accent bar, matching the testimonials modal. */
.fmc-cg-modal__inner::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	border-radius: var(--fmc-cg-radius) var(--fmc-cg-radius) 0 0;
	background: linear-gradient(90deg, var(--fmc-cg-primary), var(--fmc-cg-secondary), var(--fmc-cg-tan));
}

.fmc-cg-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--fmc-cg-hairline);
	border-radius: 50%;
	background: var(--fmc-cg-white);
	color: var(--fmc-cg-heading);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.fmc-cg-modal__close svg {
	width: 15px;
	height: 15px;
}

.fmc-cg-modal__close:hover,
.fmc-cg-modal__close:focus-visible {
	background: var(--fmc-cg-primary);
	border-color: var(--fmc-cg-primary);
	color: var(--fmc-cg-white);
	transform: rotate(90deg);
	outline: none;
}

/* ---- Profile header ---- */

.fmc-cg-profile__head {
	display: flex;
	align-items: flex-start;
	gap: 24px;
	padding-bottom: 26px;
	border-bottom: 1px solid var(--fmc-cg-hairline);
}

.fmc-cg-profile__photo {
	position: relative;
	flex: 0 0 auto;
	display: block;
	width: 132px;
	height: 132px;
	overflow: hidden;
	border-radius: 50%;
	box-shadow: 0 8px 22px rgba(76, 56, 74, 0.2);
}

.fmc-cg-profile__photo img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	background: var(--fmc-cg-white);
}

.fmc-cg-profile__photo.is-placeholder {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: var(--fmc-cg-secondary);
}

.fmc-cg-profile__photo.is-placeholder svg {
	display: block;
	width: 90%;
	height: 90%;
	fill: var(--fmc-cg-white);
	opacity: 0.75;
	transform: translateY(6%);
}

.fmc-cg-profile__identity {
	flex: 1 1 auto;
	min-width: 0;
	/* Clears the close button so a long name can't run underneath it. */
	padding-right: 34px;
}

.fmc-cg-profile__name {
	margin: 0;
	font-family: var(--fmc-cg-font-heading);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--fmc-cg-heading);
	overflow-wrap: anywhere;
	text-wrap: balance;
}

.fmc-cg-profile__role {
	margin: 7px 0 0;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--fmc-cg-muted);
	overflow-wrap: anywhere;
}

.fmc-cg-profile__loc {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin: 8px 0 0;
	font-size: 13.5px;
	line-height: 1.4;
	color: var(--fmc-cg-muted);
}

.fmc-cg-profile__loc svg {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	margin-top: 2px;
	fill: var(--fmc-cg-primary);
}

/* Credential pills */
.fmc-cg-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin-top: 14px;
}

.fmc-cg-pill {
	display: inline-block;
	padding: 5px 13px;
	border-radius: 999px;
	background: rgba(226, 95, 112, 0.1);
	color: var(--fmc-cg-primary);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.4;
	text-transform: uppercase;
}

/* Social links */
.fmc-cg-links {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
	margin-top: 16px;
}

.fmc-cg-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid var(--fmc-cg-hairline);
	border-radius: 50%;
	background: var(--fmc-cg-white);
	color: var(--fmc-cg-heading);
	text-decoration: none;
	transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.fmc-cg-link svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.fmc-cg-link:hover,
.fmc-cg-link:focus-visible {
	background: var(--fmc-cg-primary);
	border-color: var(--fmc-cg-primary);
	color: var(--fmc-cg-white);
	transform: translateY(-2px);
	outline: none;
}

/* ---- Profile sections ---- */

.fmc-cg-profile__body {
	padding-top: 4px;
}

.fmc-cg-section {
	margin-top: 26px;
}

.fmc-cg-section__title {
	margin: 0 0 10px;
	font-family: var(--fmc-cg-font-heading);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	line-height: 1.4;
	text-transform: uppercase;
	color: var(--fmc-cg-primary);
}

.fmc-cg-prose {
	font-size: 15.5px;
	line-height: 1.75;
	color: var(--fmc-cg-body);
}

.fmc-cg-prose p {
	margin: 0 0 12px;
}

.fmc-cg-prose p:last-child {
	margin-bottom: 0;
}

.fmc-cg-prose strong {
	color: var(--fmc-cg-heading);
	font-weight: 700;
}

.fmc-cg-prose a {
	color: var(--fmc-cg-primary);
	text-decoration: none;
	border-bottom: 1px solid rgba(226, 95, 112, 0.4);
}

.fmc-cg-prose a:hover {
	border-color: var(--fmc-cg-primary);
}

.fmc-cg-prose ul,
.fmc-cg-prose ol {
	margin: 0 0 12px;
	padding-left: 1.15em;
}

.fmc-cg-prose li {
	margin-bottom: 6px;
}

.fmc-cg-prose ul {
	list-style: none;
	padding-left: 0;
}

.fmc-cg-prose ul li {
	position: relative;
	padding-left: 20px;
}

.fmc-cg-prose ul li::before {
	content: '';
	position: absolute;
	top: 0.62em;
	left: 2px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--fmc-cg-primary), var(--fmc-cg-secondary));
}

/* Specialities read as a short set of labels, so a list there becomes chips.
   Prose written as paragraphs instead falls through to the styles above. */
.fmc-cg-section--specialities .fmc-cg-prose ul {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
	margin: 0;
}

.fmc-cg-section--specialities .fmc-cg-prose ul li {
	margin: 0;
	padding: 8px 16px;
	border: 1px solid rgba(226, 95, 112, 0.28);
	border-radius: 999px;
	background: rgba(251, 183, 158, 0.14);
	color: var(--fmc-cg-heading);
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.4;
}

.fmc-cg-section--specialities .fmc-cg-prose ul li::before {
	content: none;
}

/* ---- Motion ---- */

.fmc-cg-modal[open] {
	animation: fmc-cg-modal-in 0.25s ease-out;
}

.fmc-cg-modal[open]::backdrop {
	animation: fmc-cg-backdrop-in 0.25s ease-out;
}

@keyframes fmc-cg-modal-in {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes fmc-cg-backdrop-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Fallback for any browser without <dialog>; the JS adds .is-fallback. */
.fmc-cg-modal.is-fallback {
	position: fixed;
	top: 50%;
	left: 50%;
	z-index: 999999;
	transform: translate(-50%, -50%);
	display: block;
}

.fmc-cg-modal.is-fallback[hidden] {
	display: none;
}

.fmc-cg-modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 999998;
	background: rgba(76, 56, 74, 0.55);
}

.fmc-cg-modal-backdrop[hidden] {
	display: none;
}

body.fmc-cg-modal-open {
	overflow: hidden;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

/* Columns step down rather than shrink: a 4-up grid becomes 3, then 2, then 1,
   so the card never gets narrower than its content reads well at. */
@media (max-width: 1100px) {
	.fmc-cg-grid {
		grid-template-columns: repeat(var(--fmc-cg-cols-l), minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.fmc-cg-grid {
		grid-template-columns: repeat(var(--fmc-cg-cols-t), minmax(0, 1fr));
		gap: 20px;
	}

	.fmc-cg-modal__inner {
		padding: 40px 30px 32px;
	}

	.fmc-cg-profile__photo {
		width: 112px;
		height: 112px;
	}

	.fmc-cg-profile__name {
		font-size: 23px;
	}
}

@media (max-width: 620px) {
	.fmc-cg-wrapper {
		--fmc-cg-photo: 68px;
	}

	.fmc-cg-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.fmc-cg-card {
		padding: 18px 16px;
		gap: 14px;
	}

	/* Touch has no hover, so the affordance is always visible on mobile. */
	.fmc-cg-card__cta {
		opacity: 1;
		transform: none;
	}

	.fmc-cg-wrapper--vertical {
		--fmc-cg-photo: 96px;
	}

	.fmc-cg-modal {
		width: calc(100vw - 20px);
		max-height: 90vh;
	}

	.fmc-cg-modal__inner {
		max-height: 90vh;
		padding: 34px 20px 28px;
	}

	/* Stack and centre the header — a 132px circle beside text is too tight. */
	.fmc-cg-profile__head {
		flex-direction: column;
		align-items: center;
		gap: 16px;
		text-align: center;
		padding-bottom: 22px;
	}

	.fmc-cg-profile__identity {
		padding-right: 0;
	}

	.fmc-cg-profile__photo {
		width: 104px;
		height: 104px;
	}

	.fmc-cg-profile__name {
		font-size: 21px;
	}

	.fmc-cg-profile__loc,
	.fmc-cg-pills,
	.fmc-cg-links {
		justify-content: center;
	}

	.fmc-cg-prose {
		font-size: 15px;
	}
}

@media (hover: none) {
	.fmc-cg-card__cta {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fmc-cg-card,
	.fmc-cg-card__cta,
	.fmc-cg-link,
	.fmc-cg-modal__close {
		transition: none;
	}

	.fmc-cg-card:hover,
	.fmc-cg-card:focus-visible {
		transform: none;
	}

	.fmc-cg-modal[open],
	.fmc-cg-modal[open]::backdrop {
		animation: none;
	}
}
