/* ==========================================================================
   CMD Team Grid v3 — Frontend Styles
   Card: full-bleed photo + dark gradient overlay.
   Popup: two-column photo/bio layout.
   Button: full Elementor-style sizing scale + hover states.
   ADA: focus rings, reduced-motion, high-contrast.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Screen reader only
   -------------------------------------------------------------------------- */
.cmd-tg-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */
.cmd-tg-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	width: 100%;
}

/* --------------------------------------------------------------------------
   Card — full-bleed photo overlay
   Technique: card is position:relative with aspect-ratio.
   The inner __photo-wrap uses the padding-bottom trick as a cross-browser
   fallback so absolute children always have a resolved height, which fixes
   the mobile collapse issue (Image 2 screenshot).
   -------------------------------------------------------------------------- */
.cmd-tg-card {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 8px;
	background-color: #1a1a1a;
	/* aspect-ratio for modern browsers */
	aspect-ratio: 3 / 4;
}

/* Padding-bottom fallback for browsers that don't honour aspect-ratio
   when children are position:absolute. 3:4 ratio = 133.33% */
@supports not (aspect-ratio: 3 / 4) {
	.cmd-tg-card::before {
		content: '';
		display: block;
		padding-bottom: 133.33%;
	}
}

/* Static cards (action = none) — no pointer */
.cmd-tg-card--static {
	cursor: default;
}

/* Photo fills entire card absolutely */
.cmd-tg-card__photo {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
	display: block;
	transition: transform 0.4s ease;
}

.cmd-tg-card__photo--placeholder {
	background-color: #333;
}

.cmd-tg-card:not(.cmd-tg-card--static):hover .cmd-tg-card__photo,
.cmd-tg-card:not(.cmd-tg-card--static):focus-within .cmd-tg-card__photo {
	transform: scale(1.05);
}

/* Gradient overlay */
.cmd-tg-card__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0)    0%,
		rgba(0, 0, 0, 0.75) 100%
	);
	transition: opacity 0.3s ease;
}

.cmd-tg-card:not(.cmd-tg-card--static):hover .cmd-tg-card__overlay,
.cmd-tg-card:not(.cmd-tg-card--static):focus-within .cmd-tg-card__overlay {
	opacity: 0.9;
}

/* Text body — sits above overlay, below trigger */
.cmd-tg-card__body {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 24px 20px 20px;
	z-index: 2;
	pointer-events: none; /* clicks pass through to the trigger */
}

.cmd-tg-card__name {
	margin: 0 0 4px;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
	/* Reset h2 browser/theme defaults */
	padding: 0;
	border: none;
	background: none;
	text-transform: none;
	letter-spacing: normal;
}

.cmd-tg-card__position {
	margin: 0;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	color: rgba(255, 255, 255, 0.85);
}

/* Full-card trigger — covers entire card, sits above everything */
.cmd-tg-card__trigger {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: transparent !important;
	border: none !important;
	color: transparent !important;
	cursor: pointer;
	padding: 0;
	margin: 0;
	z-index: 4; /* above body (2) and overlay (1) */
	-webkit-appearance: none;
	appearance: none;
	text-decoration: none;
	display: block;
	font-size: 0;
}

.cmd-tg-card__trigger:focus {
	outline: none;
}

.cmd-tg-card__trigger:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -3px;
	border-radius: inherit;
}

@media (forced-colors: active) {
	.cmd-tg-card__trigger:focus-visible {
		outline: 3px solid ButtonText;
	}
}

/* --------------------------------------------------------------------------
   Popup — backdrop
   -------------------------------------------------------------------------- */
.cmd-tg-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.cmd-tg-popup[hidden] {
	display: none !important;
}

.cmd-tg-popup__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.65);
	cursor: pointer;
	animation: cmd-tg-fade-in 0.22s ease forwards;
}

@keyframes cmd-tg-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes cmd-tg-slide-up {
	from { opacity: 0; transform: translateY(20px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --------------------------------------------------------------------------
   Popup — panel  (Image 2 style: sharp corners, white bg, shadow)
   -------------------------------------------------------------------------- */
.cmd-tg-popup__panel {
	position: relative;
	z-index: 1;
	background-color: #fff;
	border-radius: 4px;
	width: 100%;
	max-width: 800px;
	max-height: 90vh;
	overflow-y: auto;
	overflow-x: hidden;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
	animation: cmd-tg-slide-up 0.25s ease forwards;
}

/* --------------------------------------------------------------------------
   Close button — top-right, red background (Image 2 style)
   -------------------------------------------------------------------------- */
.cmd-tg-popup__close {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 10;
	width: 36px;
	height: 36px;
	border: none;
	background-color: #cc0000;
	border-radius: 0 4px 0 4px;
	cursor: pointer;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease;
	padding: 0;
	line-height: 1;
}

.cmd-tg-popup__close:hover {
	background-color: #aa0000;
	color: #fff;
}

.cmd-tg-popup__close:focus { outline: none; }

.cmd-tg-popup__close:focus-visible {
	outline: 3px solid #cc0000;
	outline-offset: 2px;
}

/* Icon inside close button */
.cmd-tg-popup__close i,
.cmd-tg-popup__close [class*="fa-"],
.cmd-tg-popup__close [class*="eicon-"] {
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	font-size: inherit;
	width: auto;
	height: auto;
}

.cmd-tg-popup__close svg {
	display: block;
	flex-shrink: 0;
	stroke: currentColor;
}

.cmd-tg-popup__close .cmd-tg-close-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	font-size: inherit;
	width: 1em;
	height: 1em;
	line-height: 1;
}

.cmd-tg-popup__close .cmd-tg-close-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
	stroke: none;
}

/* --------------------------------------------------------------------------
   Popup — two-column layout  (Image 2: fixed photo left, content right)
   -------------------------------------------------------------------------- */
.cmd-tg-popup__layout {
	display: grid;
	grid-template-columns: 320px 1fr;
	min-height: 400px;
}

.cmd-tg-popup__photo-col {
	position: relative;
	overflow: hidden;
	border-radius: 4px 0 0 4px;
	background-color: #e8e8e8;
	flex-shrink: 0;
}

.cmd-tg-popup__photo {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	display: block;
}

.cmd-tg-popup__content-col {
	padding: 32px 44px 36px 36px;
	position: relative;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}

/* --------------------------------------------------------------------------
   Popup — skeleton loader  (Image 1 style: card shimmer)
   -------------------------------------------------------------------------- */

/* Shimmer keyframe */
@keyframes cmd-tg-shimmer {
	0%   { background-position: -600px 0; }
	100% { background-position: 600px 0; }
}

/* Mixin-style base for all skeleton lines */
.cmd-tg-skeleton-line {
	display: block;
	border-radius: 6px;
	background-color: #e8e8e8;
	background-image: linear-gradient(
		90deg,
		#e8e8e8 0px,
		#f4f4f4 80px,
		#e8e8e8 160px
	);
	background-size: 600px 100%;
	animation: cmd-tg-shimmer 1.4s ease-in-out infinite;
}

/* Skeleton photo block */
.cmd-tg-popup__skeleton-photo {
	width: 100%;
	height: 100%;
	min-height: 400px;
	border-radius: 4px 0 0 4px;
	background-color: #e0e0e0;
	background-image: linear-gradient(
		90deg,
		#e0e0e0 0px,
		#ebebeb 80px,
		#e0e0e0 160px
	);
	background-size: 600px 100%;
	animation: cmd-tg-shimmer 1.4s ease-in-out infinite;
}

/* Skeleton content area */
.cmd-tg-popup__skeleton-content {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 32px 44px 36px 36px;
}

/* Individual skeleton lines — vary widths for realism */
.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line {
	height: 18px;
	margin-bottom: 12px;
}

.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line:nth-child(1) { width: 60%; height: 28px; margin-bottom: 14px; } /* name */
.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line:nth-child(2) { width: 40%; height: 16px; margin-bottom: 28px; } /* position */
.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line:nth-child(3) { width: 75%; height: 14px; margin-bottom: 10px; } /* bio line 1 */
.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line:nth-child(4) { width: 85%; height: 14px; margin-bottom: 10px; } /* bio line 2 */
.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line:nth-child(5) { width: 65%; height: 14px; margin-bottom: 10px; } /* bio line 3 */
.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line:nth-child(6) { width: 80%; height: 14px; margin-bottom: 10px; } /* bio line 4 */
.cmd-tg-popup__skeleton-content .cmd-tg-skeleton-line:nth-child(7) { width: 55%; height: 14px; margin-bottom: 0; }    /* bio line 5 */

/* Loading wrapper uses grid so it matches real layout */
.cmd-tg-popup__skeleton {
	display: grid;
	grid-template-columns: 320px 1fr;
	min-height: 400px;
}

.cmd-tg-popup__loading[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Popup — error state
   -------------------------------------------------------------------------- */
.cmd-tg-popup__error { padding: 20px; color: #c0392b; font-size: 15px; }
.cmd-tg-popup__error[hidden] { display: none; }
.cmd-tg-popup__data[hidden]  { display: none; }

/* --------------------------------------------------------------------------
   Popup — content typography  (Image 2 style)
   -------------------------------------------------------------------------- */
/* cmd-tg-content-empty: applied to layout while data hasn't loaded yet.
   Hides placeholder "Loading…" text visually but keeps it in DOM for WAVE. */
.cmd-tg-content-empty .cmd-tg-popup__name,
.cmd-tg-content-empty .cmd-tg-popup__position {
	color: transparent !important;
	user-select: none;
}

/* Typography props have NO !important so Elementor style controls work.
   Only display/visibility/opacity use !important to defeat Elementor
   entrance-animation inline styles that hide elements. */
.cmd-tg-popup__name {
	margin: 0 0 6px;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	color: #1a1a1a;
	padding: 0 44px 0 0;
	border: none;
	background: none;
	text-transform: none;
	letter-spacing: normal;
	/* Keep these !important — defeat Elementor animation opacity/display */
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.cmd-tg-popup__position {
	margin: 0 0 20px;
	font-size: 15px;
	font-weight: 400;
	color: #555;
	line-height: 1.4;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.cmd-tg-popup__bio {
	font-size: 15px;
	line-height: 1.75;
	color: #333;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.cmd-tg-popup__bio p { margin: 0 0 14px; }
.cmd-tg-popup__bio p:last-child { margin-bottom: 0; }

/* Heading styles inside bio (rich content from WP editor) */
.cmd-tg-popup__bio h2,
.cmd-tg-popup__bio h3,
.cmd-tg-popup__bio h4 {
	margin: 20px 0 8px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
}

.cmd-tg-popup__bio h2 { font-size: 18px; }
.cmd-tg-popup__bio h3 { font-size: 16px; }
.cmd-tg-popup__bio h4 { font-size: 15px; }

/* Links inside bio — ensure they render as links, not plain text */
.cmd-tg-popup__bio a {
	color: #003087;
	text-decoration: underline;
	text-underline-offset: 2px;
	word-break: break-word;
}

.cmd-tg-popup__bio a:hover {
	color: #00204f;
}

/* --------------------------------------------------------------------------
   Popup button — base
   -------------------------------------------------------------------------- */
.cmd-tg-popup__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 24px;
	background-color: #003087;
	color: #fff;
	text-decoration: none;
	border: 2px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	padding: 12px 24px;
	align-self: flex-start;
}

.cmd-tg-popup__btn:hover {
	background-color: #00204f;
	color: #fff;
	text-decoration: none;
}

.cmd-tg-popup__btn:focus { outline: none; }

.cmd-tg-popup__btn:focus-visible {
	outline: 3px solid #003087;
	outline-offset: 2px;
}

/* Elementor size scale */
.cmd-tg-popup__btn--xs { font-size: 12px; padding: 6px 14px; }
.cmd-tg-popup__btn--sm { font-size: 13px; padding: 9px 18px; }
.cmd-tg-popup__btn--md { font-size: 15px; padding: 12px 24px; }
.cmd-tg-popup__btn--lg { font-size: 17px; padding: 14px 30px; }
.cmd-tg-popup__btn--xl { font-size: 19px; padding: 17px 38px; }

/* Icon sizing */
.cmd-tg-popup__btn i,
.cmd-tg-popup__btn svg {
	width: 1em;
	height: 1em;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Body scroll lock
   -------------------------------------------------------------------------- */
body.cmd-tg-popup-open { overflow: hidden; }

/* --------------------------------------------------------------------------
   Responsive — tablet
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
	.cmd-tg-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.cmd-tg-popup__layout,
	.cmd-tg-popup__skeleton {
		grid-template-columns: 1fr;
		grid-template-rows: 260px 1fr;
	}

	.cmd-tg-popup__photo-col {
		border-radius: 4px 4px 0 0;
	}

	.cmd-tg-popup__skeleton-photo {
		min-height: 260px;
		border-radius: 4px 4px 0 0;
	}

	.cmd-tg-popup__photo {
		position: static;
		width: 100%;
		height: 260px;
		object-fit: cover;
	}

	.cmd-tg-popup__content-col,
	.cmd-tg-popup__skeleton-content {
		padding: 24px 20px 28px;
	}

	.cmd-tg-popup__name { font-size: 22px; }
}

/* --------------------------------------------------------------------------
   Responsive — mobile
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
	.cmd-tg-grid {
		grid-template-columns: 1fr;
	}

	.cmd-tg-popup {
		padding: 12px;
		align-items: flex-end;
	}

	.cmd-tg-popup__panel {
		border-radius: 16px 16px 0 0;
		max-height: 92vh;
	}
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.cmd-tg-card__photo,
	.cmd-tg-card__overlay,
	.cmd-tg-popup__btn { transition: none; }

	.cmd-tg-popup__panel,
	.cmd-tg-popup__backdrop { animation: none; }

	.cmd-tg-popup__spinner {
		animation: none;
		border-color: #003087;
	}
}

/* --------------------------------------------------------------------------
   High-contrast (Windows)
   -------------------------------------------------------------------------- */
@media (forced-colors: active) {
	.cmd-tg-card__overlay {
		forced-color-adjust: none;
		background: rgba(0, 0, 0, 0.7);
	}

	.cmd-tg-popup__panel {
		border: 2px solid ButtonText;
	}

	.cmd-tg-popup__btn {
		forced-color-adjust: none;
		border-color: ButtonText;
	}
}

/* --------------------------------------------------------------------------
   Load More button
   -------------------------------------------------------------------------- */
.cmd-tg-loadmore-wrap {
	display: flex;
	justify-content: center;
	margin-top: 40px;
}

.cmd-tg-loadmore {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 40px;
	background-color: #003087;
	color: #ffffff;
	border: 2px solid transparent;
	border-radius: 4px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.cmd-tg-loadmore:hover {
	background-color: #00204f;
	color: #ffffff;
}

.cmd-tg-loadmore:focus {
	outline: none;
}

.cmd-tg-loadmore:focus-visible {
	outline: 3px solid #003087;
	outline-offset: 2px;
}

.cmd-tg-loadmore[disabled],
.cmd-tg-loadmore[aria-busy="true"] {
	opacity: 0.65;
	cursor: wait;
}

/* Loading spinner inside button */
.cmd-tg-loadmore[aria-busy="true"]::before {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: cmd-tg-spin 0.7s linear infinite;
	flex-shrink: 0;
}

@media (forced-colors: active) {
	.cmd-tg-loadmore {
		border-color: ButtonText;
	}
}

/* --------------------------------------------------------------------------
   Numbered pagination
   -------------------------------------------------------------------------- */
.cmd-tg-pager {
	margin-top: 40px;
	display: flex;
	justify-content: center;
}

.cmd-tg-pager ul {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.cmd-tg-pager li {
	margin: 0;
	padding: 0;
}

.cmd-tg-pager a,
.cmd-tg-pager span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 1px solid currentColor;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	color: #003087;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cmd-tg-pager a:hover {
	background-color: #003087;
	color: #ffffff;
	border-color: #003087;
}

.cmd-tg-pager .cmd-tg-pager__current,
.cmd-tg-pager .current {
	background-color: #003087;
	color: #ffffff;
	border-color: #003087;
	pointer-events: none;
}

.cmd-tg-pager a:focus {
	outline: none;
}

.cmd-tg-pager a:focus-visible {
	outline: 3px solid #003087;
	outline-offset: 2px;
}

/* dots */
.cmd-tg-pager .dots {
	border: none;
	background: transparent;
	color: inherit;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Card visible button
   Sits inside .cmd-tg-card__body. Pointer-events none — the invisible
   .cmd-tg-card__trigger (z-index:4) sits above it and handles all clicks.
   -------------------------------------------------------------------------- */
.cmd-tg-card__body--has-btn {
	padding-bottom: 16px;
}

.cmd-tg-card__btn {
	display: inline-block;
	margin-top: 12px;
	padding: 10px 22px;
	background-color: #003087;
	color: #ffffff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	border-radius: 4px;
	border: 2px solid transparent;
	text-decoration: none;
	pointer-events: none; /* trigger above handles clicks */
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
	white-space: nowrap;
}

/* Visual hover driven by the card hover (trigger is transparent overlay) */
.cmd-tg-card:hover .cmd-tg-card__btn,
.cmd-tg-card:focus-within .cmd-tg-card__btn {
	background-color: #00204f;
}
