/**
 * AT Elementor Elements — Creative Stacking Cards
 *
 * Cinematic scroll-driven stacking card stage with layered depth,
 * tiered scale, editor-safe static preview, and responsive mobile flow.
 * Unified with the AT Design System (Global Tokens, Light & Dark Presets).
 *
 * @package AT_Elementor_Elements
 * @version 3.0.0
 */

.at-stacking-cards {
	--at-stack-accent: var(--at-color-primary, #2563eb);
	--at-card-bg: var(--at-color-card-bg, #ffffff);
	--at-stack-heading: var(--at-color-heading, #0f172a);
	--at-stack-text: var(--at-color-text, #334155);
	--at-stack-border: var(--at-color-border, rgba(15, 23, 42, 0.12));
	--at-stack-scrim: linear-gradient(180deg, rgba(15, 23, 42, 0.1) 0%, rgba(15, 23, 42, 0.72) 60%, rgba(15, 23, 42, 0.94) 100%);

	position: relative;
	width: 100%;
	box-sizing: border-box;
	padding: clamp(40px, 6vw, 80px) 0;
}

/* Light Theme Preset */
.at-stacking-cards--light {
	--at-card-bg: #ffffff;
	--at-stack-heading: #0f172a;
	--at-stack-text: #334155;
	--at-stack-border: rgba(15, 23, 42, 0.12);
	--at-stack-scrim: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.75) 60%, rgba(255, 255, 255, 0.96) 100%);
}

.at-stacking-cards--light .at-stacking-card {
	background: #ffffff;
	color: #334155;
	border-color: rgba(15, 23, 42, 0.12);
	box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.at-stacking-cards--light .at-stacking-card__title {
	color: #0f172a;
}

.at-stacking-cards--light .at-stacking-card__text {
	color: #475569;
}

.at-stacking-cards--light .at-stacking-card__step {
	color: var(--at-stack-accent, #2563eb);
	background: rgba(37, 99, 235, 0.09);
	border-color: rgba(37, 99, 235, 0.18);
}

/* Dark variant or cards with background imagery / placeholders */
.at-stacking-cards--dark,
.at-stacking-card--has-media,
.at-stacking-card--placeholder {
	--at-card-bg: #14151b;
	--at-stack-heading: #ffffff;
	--at-stack-text: rgba(255, 255, 255, 0.88);
	--at-stack-border: rgba(255, 255, 255, 0.12);
	--at-stack-scrim: linear-gradient(180deg, rgba(15, 23, 42, 0.1) 0%, rgba(15, 23, 42, 0.72) 60%, rgba(15, 23, 42, 0.94) 100%);
}

.at-stacking-stage {
	position: relative;
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
}

.at-stacking-track {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 48px;
	padding-bottom: 80px;
}

.at-stacking-card {
	position: sticky;
	top: clamp(80px, 14vh, 140px);
	min-height: 440px;
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	border-radius: var(--at-radius-lg, 24px);
	background: var(--at-card-bg);
	color: var(--at-stack-text);
	border: 1px solid var(--at-stack-border);
	box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.05);
	transform-origin: center top;
	will-change: transform;
	transition: box-shadow 0.35s ease;
	box-sizing: border-box;
}

.at-stacking-card__media {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
	border-radius: inherit;
}

.at-stacking-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.at-stacking-card__scrim {
	position: absolute;
	inset: 0;
	z-index: 2;
	background: var(--at-stack-scrim);
	border-radius: inherit;
}

.at-stacking-card--shade-disabled .at-stacking-card__scrim {
	display: none !important;
}

.at-stacking-card__content {
	position: relative;
	z-index: 3;
	padding: clamp(28px, 5vw, 60px);
	max-width: 680px;
	width: 100%;
	box-sizing: border-box;
	color: inherit;
}

.at-stacking-card__meta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
}

.at-stacking-card__step {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--at-stack-accent);
	padding: 4px 12px;
	background: rgba(37, 99, 235, 0.12);
	border: 1px solid rgba(37, 99, 235, 0.2);
	border-radius: 999px;
}

.at-stacking-cards--dark .at-stacking-card__step,
.at-stacking-card--has-media .at-stacking-card__step,
.at-stacking-card--placeholder .at-stacking-card__step {
	color: #93c5fd;
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.18);
}

.at-stacking-card__title {
	margin: 0 0 14px;
	font-size: clamp(24px, 3.5vw, 40px);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.025em;
	color: var(--at-stack-heading);
}

.at-stacking-card__text {
	margin: 0 0 22px;
	font-size: 15px;
	line-height: 1.65;
	color: var(--at-stack-text);
	max-width: 54ch;
}

.at-stacking-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 22px;
	border-radius: 999px;
	background: var(--at-stack-accent);
	color: #ffffff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
	transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.at-stacking-card__cta:hover {
	background: var(--at-color-primary-dark, #1d4ed8);
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
	color: #ffffff;
}

.at-stacking-card__cta svg {
	transition: transform 0.25s ease;
}

.at-stacking-card__cta:hover svg {
	transform: translateX(4px);
}

/* ==========================================================================
   Elementor Editor Safe Preview (Sequential Flow - All Cards Visible & Editable)
   ========================================================================== */
.at-stacking-cards--editor .at-stacking-track,
.elementor-editor-active .at-stacking-cards .at-stacking-track,
.elementor-editor-preview .at-stacking-cards .at-stacking-track {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 36px;
	height: auto;
	min-height: auto;
	padding-bottom: 40px;
}

.at-stacking-cards--editor .at-stacking-card,
.elementor-editor-active .at-stacking-cards .at-stacking-card,
.elementor-editor-preview .at-stacking-cards .at-stacking-card {
	position: relative;
	top: 0;
	left: 0;
	width: 100%;
	transform: none !important;
	opacity: 1 !important;
	transition: box-shadow 0.3s ease;
}

/* ==========================================================================
   Mobile Responsive Rules (Clean Vertical Stack - No Trapped Pinning)
   ========================================================================== */
@media (max-width: 767px) {
	.at-stacking-cards {
		padding: 32px 0;
	}
	.at-stacking-track {
		gap: 20px;
		padding-bottom: 20px;
	}
	.at-stacking-card {
		position: relative !important;
		top: 0 !important;
		min-height: 380px;
		transform: none !important;
	}
	.at-stacking-card__content {
		padding: 24px;
	}
	.at-stacking-card__title {
		font-size: 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.at-stacking-card {
		transform: none !important;
		transition: none !important;
	}
}
