/* ==========================================================================
   Programs Grid Component
   Enqueued from inc/program-grid/program-grid.php only when the
   [moerlina_program_grid] shortcode renders.
   ========================================================================== */
/* Card 2 & 3 photo grid */
.moerlina-program-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 36px;
}

.moerlina-program-card {
	position: relative;
	display: block;
	height: 376px;
	border-radius: 2px;
	overflow: hidden;
	color: var(--color-white);
	text-decoration: none;
	background-color: var(--color-mauve);
	background-size: cover;
	background-position: center;
}

.moerlina-program-card:focus-visible {
	outline: 2px solid var(--color-coral);
	outline-offset: 3px;
}

/* Hover zoom on the background photo (subtle — no over-scale, unlike the
   native WPBakery post-grid's scale(1.5) rotate). The card's inline
   background-image is inherited onto a pseudo layer so only it animates,
   leaving the bottom panel (opaque, higher stacking) free to expand on top. */
.moerlina-program-card::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 0;
	background-image: inherit;
	background-size: inherit;
	background-position: inherit;
	transform: scale(1);
	transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
	will-change: transform;
}

.moerlina-program-card:hover::before,
.moerlina-program-card:focus-within::before {
	transform: scale(1.08);
}

/* Bottom panel: closed = title strip; open = fills the card */
.moerlina-program-card__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	height: 80px;              /* fits title (30px pad + 31.5px line) when closed */
	background: var(--color-mauve);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	padding: 24px 22px;
	transition: height 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.moerlina-program-card:hover .moerlina-program-card__panel,
.moerlina-program-card:focus-within .moerlina-program-card__panel {
	height: 100%;
}

/* Centres the title + details group; auto margins clamp while the group
   is taller than the closed strip, then ease it into centre as the panel
   grows (no discrete jumps). `!important` needed because WPBakery's
   `#content .wpb_text_column :last-child { margin-bottom: 0 }` (id-weighted)
   otherwise zeroes margin-bottom. */
.moerlina-program-card .moerlina-program-card__panel .moerlina-program-card__body {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	width: 100%;
	margin-top: auto !important;
	margin-bottom: auto !important;
	margin-left: 0;
	margin-right: 0;
}

.moerlina-program-card__title {
	font-family: var(--font-heading);
	font-weight: 500;
	font-size: 35px;
	line-height: .9;
	margin: 0;
	text-transform: uppercase;
	text-align: center;
	color: var(--color-white);
	flex-shrink: 0;
}

.moerlina-program-card__details {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: var(--color-white);
	opacity: 0;
	margin-top: 6px;
	transition: opacity 0.25s ease;
}

.moerlina-program-card:hover .moerlina-program-card__details,
.moerlina-program-card:focus-within .moerlina-program-card__details {
	opacity: 1;
	transition-delay: 0.15s;
}

.moerlina-program-card__years {
	font-family: var(--font-heading);
	font-weight: 500;
	font-size: 28px;
	line-height: .9;
	text-transform: uppercase;
	display: block;
	color: var(--color-white);
	margin: 0 0 16px;
}

.moerlina-program-card__excerpt {
	font-family: var(--font-body);
	font-weight: 400;
	font-size: 24px;
	line-height: 1.4;
	margin: 0 0 16px;
	max-width: 320px;
	color: var(--color-white);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.moerlina-program-card__link {
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 18px;
	line-height: 1.5;
	color: var(--color-white);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: color 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.moerlina-program-card__link svg {
	width: 19px;
	height: 16px;
	flex-shrink: 0;
	transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.moerlina-program-card__link:hover,
.moerlina-program-card__link:focus-visible {
	color: var(--color-yellow);
}

.moerlina-program-card__link:hover svg {
	transform: translateX(6px);
}

.moerlina-program-grid__loadmore {
	display: flex;
	justify-content: center;
	margin-top: 56px;
}

.moerlina-program-grid__loadmore-btn.is-loading {
	opacity: 0.6;
	pointer-events: none;
	position: relative;
	color: transparent;
}

.moerlina-program-grid__loadmore-btn.is-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: moerlina-spin 0.7s linear infinite;
	color: var(--color-yellow);
}

@keyframes moerlina-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
	.moerlina-program-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 36px;
	}
}

@media (max-width: 640px) {
	.moerlina-program-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.moerlina-program-card {
		height: 300px;
	}

	.moerlina-program-card__title {
		font-size: 30px;
	}

	.moerlina-program-card__panel {
		padding: 24px 18px;
	}
}