/* ==========================================================================
   UC Stacking Cards — Frontend Styles
   Mechanic ported from "Stacking Cards on Scroll" (Taha Shashtari,
   codepen.io/tahazsh/pen/WNYKage): CSS Grid rows + position: sticky +
   per-adjacent-card scroll-driven scale/brightness.
   ========================================================================== */

.ucsc_stacking_cards_widget {
	width: 100%;
	margin: 0 auto;
	--card-height: 480px;
	--text-width: 42%;
	--stack-offset: 20px;  /* extra padding-top added per successive card */
	--base-offset: 20px;   /* padding-top of the first card               */
	--grid-gap: 24px;      /* vertical gap between grid rows              */
}

@media (max-width: 767px) {
	.ucsc_stacking_cards_widget {
		--card-height: 640px;
		--text-width: 100%;
	}
}

.ucsc_cards_wrapper {
	width: 100%;
	display: grid;
	grid-template-rows: repeat(
		var(--cards-count),
		calc(var(--card-height) + var(--base-offset) + (var(--cards-count) - 1) * var(--stack-offset))
	);
	gap: var(--grid-gap) 0;
}

/* Sticky "slot" for each card. Its own padding-top increases per index,
   which is what creates the cascading/peeking stack effect. */
.ucsc_stacking_card_item {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	width: 100%;
	box-sizing: border-box;
	padding-top: calc(var(--base-offset) + (var(--ucsc-i, 0) * var(--stack-offset)));
}

.ucsc_card_content {
	will-change: scale, filter;
	height: var(--card-height);
	min-height: var(--card-height);
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
	overflow: hidden;
	display: flex !important;
	flex-direction: row;
	align-items: stretch;
	background-color: #17181c;
	box-shadow: 0px 25px 50px -12px rgba(0, 0, 0, 0.35);
	border-radius: 20px;
	box-sizing: border-box;
	transform-origin: center top;
}

/* Text panel (left) */
.ucsc_content_left {
	flex: 0 0 var(--text-width);
	max-width: var(--text-width);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 6px;
	padding: 60px 56px;
	box-sizing: border-box;
	min-width: 0;
}

@media (max-width: 767px) {
	.ucsc_content_left {
		flex-basis: 100%;
		max-width: 100%;
		padding: 32px 28px;
	}
}

.ucsc_sc_title {
	font-weight: 700;
	font-size: 1.9em;
	line-height: 1.25;
	color: #ffffff;
	margin: 0;
}

.ucsc_sc_title_underline {
	display: block;
	width: 46px;
	height: 3px;
	background: #ffffff;
	border-radius: 2px;
	margin: 14px 0 18px;
}

.ucsc_sc_desc {
	font-weight: 400;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.55);
	font-size: 1em;
}

.ucsc_sc_desc p {
	margin: 0 0 0.6em;
}

.ucsc_sc_button {
	display: inline-block;
	height: fit-content;
	text-decoration: none;
	font-weight: 500;
	margin-top: 18px;
	color: #ffffff;
}

/* Image panel (right) — fills remaining space, edge-to-edge */
.ucsc_card_content > figure {
	overflow: hidden !important;
	flex: 1 1 auto !important;
	margin: 0 !important;
	min-width: 0;
	position: relative;
	display: block !important;
	height: 100% !important;
}

.ucsc_card_content > figure .ucsc_sc_img,
.ucsc_card_content > figure img.ucsc_sc_img {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover !important;
	object-position: center !important;
}

@media (max-width: 767px) {
	.ucsc_card_content {
		flex-direction: column;
		height: auto;
		min-height: 0;
	}

	.ucsc_card_content > figure {
		display: none !important; /* hide image on mobile so text panel is fully readable */
	}
}

/* --------------------------------------------------------------------
   Glassmorphism modifier — enabled per card via the "Enable
   Glassmorphism" checkbox in the Card Settings meta box, or forced
   on/off from the Elementor widget's Style tab.
   -------------------------------------------------------------------- */
.ucsc_stacking_card_item.ucsc_glass .ucsc_card_content {
	background: rgba(255, 255, 255, 0.18);
	backdrop-filter: blur(20px) saturate(180%);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	border: 1px solid rgba(255, 255, 255, 0.35);
	box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.2);
}

.ucsc_stacking_card_item.ucsc_glass .ucsc_sc_title,
.ucsc_stacking_card_item.ucsc_glass .ucsc_sc_desc {
	color: #fff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.ucsc_stacking_card_item.ucsc_glass .ucsc_sc_button {
	color: #fff;
}

/* --------------------------------------------------------------------
   Defensive fix: position: sticky silently stops working if ANY
   ancestor has overflow other than visible, or has a transform
   applied (very common with Elementor Containers, entrance
   animations, or motion effects). This forces every ancestor that
   contains our widget back to a sticky-safe state, without touching
   unrelated elements elsewhere on the page.
   -------------------------------------------------------------------- */
.e-con:has(.ucsc_stacking_cards_widget),
.e-con-inner:has(.ucsc_stacking_cards_widget),
.elementor-element:has(.ucsc_stacking_cards_widget),
.elementor-widget-wrap:has(.ucsc_stacking_cards_widget),
.elementor-column:has(.ucsc_stacking_cards_widget),
.elementor-row:has(.ucsc_stacking_cards_widget),
.elementor-container:has(.ucsc_stacking_cards_widget),
.elementor-section:has(.ucsc_stacking_cards_widget),
section:has(.ucsc_stacking_cards_widget),
main:has(.ucsc_stacking_cards_widget) {
	overflow: visible !important;
	transform: none !important;
}

/* --------------------------------------------------------------------
   Text-panel-only glassmorphism (independent from whole-card glass,
   controlled via the "Apply Glass To" option in the Elementor widget).
   -------------------------------------------------------------------- */
.ucsc_content_left.ucsc_glass_text {
	background: rgba(255, 255, 255, 0.12);
	backdrop-filter: blur(16px) saturate(180%);
	-webkit-backdrop-filter: blur(16px) saturate(180%);
	border: 1px solid rgba(255, 255, 255, 0.25);
}
