/**
 * AT Elementor Elements — Creative Card Experiences CSS
 *
 * 3D Flip Card, 3D Tilt Card, Spotlight Card, Expand Accordion Cards.
 * Unified with the AT Design System (Global Tokens, Light & Dark Presets).
 *
 * @package AT_Elementor_Elements
 * @version 3.0.0
 */

.at-flip-card,
.at-tilt-card,
.at-spotlight-card,
.at-expand-card {
	--at-card-primary: var(--at-color-primary, #2563eb);
	--at-card-bg-surface: var(--at-color-card-bg, #ffffff);
	--at-card-heading-color: var(--at-color-heading, #0f172a);
	--at-card-text-color: var(--at-color-text, #334155);
	--at-card-border-color: var(--at-color-border, rgba(15, 23, 42, 0.1));
	--at-card-radius-val: var(--at-radius-lg, 24px);

	position: relative;
	display: block;
	text-decoration: none;
	color: inherit;
	border-radius: var(--at-card-radius-val);
	box-sizing: border-box;
}

.at-tilt-card,
.at-spotlight-card,
.at-expand-card {
	overflow: hidden;
	isolation: isolate;
	transform-style: preserve-3d;
	will-change: transform;
}

/* Dark Mode Theme Variant for Creative Cards */
.at-flip-card--dark,
.at-tilt-card--dark,
.at-spotlight-card--dark,
.at-expand-card--dark,
.at-expand-cards--dark .at-expand-card,
.at-flip-card--has-media,
.at-tilt-card--has-media,
.at-spotlight-card--has-media,
.at-expand-card--has-media {
	--at-card-bg-surface: #14151b;
	--at-card-heading-color: #ffffff;
	--at-card-text-color: rgba(255, 255, 255, 0.85);
	--at-card-border-color: rgba(255, 255, 255, 0.12);
}

.at-flip-card:focus-visible,
.at-tilt-card:focus-visible,
.at-spotlight-card:focus-visible,
.at-expand-card:focus-visible {
	outline: 2px solid var(--at-card-primary);
	outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   3D Flip Card
   -------------------------------------------------------------------------- */
.at-flip-card {
	perspective: var(--at-flip-perspective, 1200px);
	-webkit-perspective: var(--at-flip-perspective, 1200px);
	min-height: 420px;
	background: transparent;
	border: 0;
	overflow: visible !important;
	isolation: auto !important;
}

.at-flip-card__inner {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	-webkit-transform-style: preserve-3d;
	transition: transform var(--at-flip-duration, 0.85s) cubic-bezier(0.25, 0.8, 0.25, 1);
	border-radius: inherit;
	will-change: transform;
}

.at-flip-card:hover .at-flip-card__inner,
.at-flip-card:focus-within .at-flip-card__inner,
.at-flip-card.is-flipped .at-flip-card__inner {
	transform: rotateY(180deg);
}

.at-flip-card--vertical:hover .at-flip-card__inner,
.at-flip-card--vertical:focus-within .at-flip-card__inner,
.at-flip-card--vertical.is-flipped .at-flip-card__inner {
	transform: rotateX(180deg);
}

.at-flip-card--trigger-click:hover .at-flip-card__inner,
.at-flip-card--vertical.at-flip-card--trigger-click:hover .at-flip-card__inner {
	transform: none;
}

.at-flip-card__face {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: flex-end;
	padding: clamp(24px, 4vw, 44px);
	overflow: hidden;
	backface-visibility: hidden !important;
	-webkit-backface-visibility: hidden !important;
	transform-style: preserve-3d;
	-webkit-transform-style: preserve-3d;
	background-color: var(--at-card-bg-surface);
	color: var(--at-card-text-color);
	border-radius: inherit;
	border: 1px solid var(--at-card-border-color);
	box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.12);
	box-sizing: border-box;
}

.at-flip-card__front {
	transform: rotateY(0deg);
	-webkit-transform: rotateY(0deg);
}

.at-flip-card__back {
	transform: rotateY(180deg);
	-webkit-transform: rotateY(180deg);
	background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
	color: #ffffff;
	border-color: rgba(255, 255, 255, 0.15);
	box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.3);
}

.at-flip-card--vertical .at-flip-card__front {
	transform: rotateX(0deg);
	-webkit-transform: rotateX(0deg);
}

.at-flip-card--vertical .at-flip-card__back {
	transform: rotateX(180deg);
	-webkit-transform: rotateX(180deg);
}

.elementor .at-flip-card__image,
.elementor .at-tilt-card__image,
.elementor .at-spotlight-card__image,
.elementor .at-expand-card__image,
.at-flip-card__image,
.at-tilt-card__image,
.at-spotlight-card__image,
.at-expand-card__image {
	position: absolute !important;
	inset: 0 !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	min-width: 100% !important;
	min-height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: var(--at-card-image-fit, cover);
	object-position: var(--at-card-image-position, center center);
	z-index: 1;
	border-radius: inherit;
	transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.at-flip-card:hover .at-flip-card__image,
.at-tilt-card:hover .at-tilt-card__image,
.at-spotlight-card:hover .at-spotlight-card__image,
.at-expand-card.is-active .at-expand-card__image {
	transform: scale(1.05);
}

/* Shade & Overlay Gradients */
.at-flip-card__shade,
.at-tilt-card__shade,
.at-spotlight-card__shade,
.at-expand-card__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.65) 60%, rgba(15, 23, 42, 0.92) 100%);
	z-index: 2;
	border-radius: inherit;
	transition: opacity 0.35s ease;
}

.at-card-shade--disabled,
.at-flip-card__shade--disabled,
.at-tilt-card__shade--disabled,
.at-spotlight-card__shade--disabled {
	display: none !important;
}

.at-flip-card__content,
.at-tilt-card__content,
.at-spotlight-card__content {
	position: relative;
	z-index: 3;
	max-width: 600px;
	width: 100%;
	color: inherit;
}

.at-flip-card__eyebrow,
.at-tilt-card__eyebrow,
.at-spotlight-card__eyebrow {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--at-card-primary);
	margin-bottom: 12px;
	padding: 4px 10px;
	background: rgba(37, 99, 235, 0.12);
	border: 1px solid rgba(37, 99, 235, 0.2);
	border-radius: 999px;
}

.at-flip-card--dark .at-flip-card__eyebrow,
.at-tilt-card--dark .at-tilt-card__eyebrow,
.at-spotlight-card--dark .at-spotlight-card__eyebrow,
.at-flip-card--has-media .at-flip-card__eyebrow,
.at-tilt-card--has-media .at-tilt-card__eyebrow,
.at-spotlight-card--has-media .at-spotlight-card__eyebrow {
	color: #93c5fd;
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.18);
}

.at-flip-card h3,
.at-tilt-card h3,
.at-spotlight-card h3 {
	margin: 0 0 10px;
	font-size: clamp(24px, 3.2vw, 38px);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.025em;
	color: var(--at-card-heading-color);
}

.at-flip-card p,
.at-tilt-card p,
.at-spotlight-card p {
	margin: 0;
	max-width: 48ch;
	font-size: 15px;
	line-height: 1.6;
	color: var(--at-card-text-color);
}

.at-flip-card__cta,
.at-tilt-card__cta,
.at-spotlight-card__cta,
.at-expand-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 18px;
	font-size: 13px;
	font-weight: 600;
	color: #ffffff;
	padding: 8px 18px;
	border-radius: 999px;
	background: var(--at-card-primary);
	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-flip-card__cta:hover,
.at-tilt-card__cta:hover,
.at-spotlight-card__cta:hover,
.at-expand-card__cta:hover {
	background: var(--at-color-primary-dark, #1d4ed8);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
	color: #ffffff;
}

.at-flip-card__cta svg,
.at-tilt-card__cta svg,
.at-spotlight-card__cta svg,
.at-expand-card__cta svg {
	transition: transform 0.25s ease;
}

.at-flip-card__cta:hover svg,
.at-tilt-card__cta:hover svg,
.at-spotlight-card__cta:hover svg,
.at-expand-card__cta:hover svg {
	transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   3D Tilt & Spotlight Cards
   -------------------------------------------------------------------------- */
.at-tilt-card,
.at-spotlight-card {
	min-height: 420px;
	background-color: var(--at-card-bg-surface);
	border: 1px solid var(--at-card-border-color);
	box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.1);
	padding: clamp(24px, 4vw, 44px);
	display: flex;
	align-items: flex-end;
}

.at-tilt-card__content {
	transform: translateZ(var(--at-card-depth, 20px));
}

/* --------------------------------------------------------------------------
   AT Tilt Card — Hover Slide Reveal Variant & Backdrop Mask
   -------------------------------------------------------------------------- */
.at-tilt-card--slide-reveal {
	--at-tilt-slide-speed: 0.45s;
	min-height: 480px;
	padding-bottom: clamp(28px, 4vw, 42px);
}

.at-tilt-card--slide-reveal .at-tilt-card__content {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	transform: translateZ(var(--at-card-depth, 26px));
	transform-style: preserve-3d;
	-webkit-transform-style: preserve-3d;
	z-index: 4;
}

.at-tilt-card--slide-reveal .at-tilt-card__eyebrow {
	align-self: flex-start;
	transition: transform var(--at-tilt-slide-speed, 0.45s) cubic-bezier(0.16, 1, 0.3, 1);
	transform: translateZ(10px);
}

.at-tilt-card--slide-reveal .at-tilt-card__title {
	transition: transform var(--at-tilt-slide-speed, 0.45s) cubic-bezier(0.16, 1, 0.3, 1);
	transform: translateZ(14px);
	margin-bottom: 6px;
}

/* Strictly hidden at rest */
.at-tilt-card--slide-reveal .at-tilt-card__reveal-wrap {
	display: grid;
	grid-template-rows: 0fr;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(18px) translateZ(18px);
	transition: grid-template-rows var(--at-tilt-slide-speed, 0.45s) cubic-bezier(0.16, 1, 0.3, 1),
	            opacity calc(var(--at-tilt-slide-speed, 0.45s) * 0.75) ease,
	            transform var(--at-tilt-slide-speed, 0.45s) cubic-bezier(0.16, 1, 0.3, 1),
	            visibility var(--at-tilt-slide-speed, 0.45s) ease;
	will-change: transform, opacity, grid-template-rows;
}

.at-tilt-card--slide-reveal .at-tilt-card__reveal-inner {
	min-height: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding-top: 8px;
}

/* Revealed on Hover or focus-visible or is-revealed class */
.at-tilt-card--slide-reveal:hover .at-tilt-card__reveal-wrap,
.at-tilt-card--slide-reveal:focus-visible .at-tilt-card__reveal-wrap,
.at-tilt-card--slide-reveal.is-revealed .at-tilt-card__reveal-wrap {
	grid-template-rows: 1fr;
	opacity: 1;
	visibility: visible;
	transform: translateY(0) translateZ(18px);
	pointer-events: auto;
}

.at-tilt-card--slide-reveal .at-tilt-card__extra-text {
	font-size: 14px;
	line-height: 1.55;
	color: var(--at-card-text-color, rgba(255, 255, 255, 0.9));
	opacity: 0.95;
}

.at-tilt-card--slide-reveal .at-tilt-card__badge {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 3px 10px;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.16);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.22);
}

/* --------------------------------------------------------------------------
   Hover Backdrop Mask Styles
   -------------------------------------------------------------------------- */
.at-tilt-card__mask {
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: inherit;
	pointer-events: none;
	opacity: 0;
	transform: translateZ(6px);
	background: var(
		--at-tilt-mask-bg,
		linear-gradient(180deg, rgba(10, 15, 30, 0.05) 0%, rgba(10, 15, 30, 0.72) 32%, rgba(10, 15, 30, 0.94) 70%, rgba(10, 15, 30, 0.98) 100%)
	);
	backdrop-filter: blur(var(--at-tilt-mask-blur, 8px));
	-webkit-backdrop-filter: blur(var(--at-tilt-mask-blur, 8px));
	transition: opacity var(--at-tilt-slide-speed, 0.45s) cubic-bezier(0.16, 1, 0.3, 1),
	            transform var(--at-tilt-slide-speed, 0.45s) cubic-bezier(0.16, 1, 0.3, 1);
	will-change: opacity, transform;
}

.at-tilt-card--mask-frosted .at-tilt-card__mask {
	background: var(--at-tilt-mask-bg, rgba(10, 15, 30, 0.82));
	backdrop-filter: blur(var(--at-tilt-mask-blur, 14px));
	-webkit-backdrop-filter: blur(var(--at-tilt-mask-blur, 14px));
}

.at-tilt-card--mask-solid .at-tilt-card__mask {
	background: var(--at-tilt-mask-bg, #090d16);
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
}

.at-tilt-card--mask-curtain .at-tilt-card__mask {
	transform: translateY(100%) translateZ(6px);
	opacity: 1;
	background: var(
		--at-tilt-mask-bg,
		linear-gradient(180deg, rgba(10, 15, 30, 0.35) 0%, rgba(10, 15, 30, 0.92) 50%, #090d16 100%)
	);
}

/* Hover Mask Reveal */
.at-tilt-card--has-mask:hover .at-tilt-card__mask,
.at-tilt-card--has-mask:focus-visible .at-tilt-card__mask,
.at-tilt-card--has-mask.is-revealed .at-tilt-card__mask {
	opacity: 1;
}

.at-tilt-card--mask-curtain:hover .at-tilt-card__mask,
.at-tilt-card--mask-curtain:focus-visible .at-tilt-card__mask,
.at-tilt-card--mask-curtain.is-revealed .at-tilt-card__mask {
	transform: translateY(0) translateZ(6px);
	opacity: 1;
}

.at-spotlight-card::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	border-radius: inherit;
	background: radial-gradient(
		var(--at-spotlight-size, 380px) circle at var(--at-spotlight-x, 50%) var(--at-spotlight-y, 50%),
		var(--at-spotlight-color, rgba(37, 99, 235, 0.22)),
		transparent 70%
	);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.at-spotlight-card:hover::before,
.at-spotlight-card.at-spotlight-active::before {
	opacity: 1;
}

.at-spotlight-card__content {
	transform: translateZ(16px);
}

/* --------------------------------------------------------------------------
   Expand Cards (Accordion Grid)
   -------------------------------------------------------------------------- */
.at-expand-cards {
	display: flex;
	min-height: 460px;
	width: 100%;
	overflow: hidden;
	gap: 12px;
	box-sizing: border-box;
}

.at-expand-card {
	flex: 1 1 0;
	min-width: 0;
	cursor: pointer;
	overflow: hidden;
	color: var(--at-card-text-color);
	background-color: var(--at-card-bg-surface);
	border: 1px solid var(--at-card-border-color);
	box-shadow: 0 14px 36px -10px rgba(0, 0, 0, 0.12);
	transition: flex 0.65s cubic-bezier(0.25, 1, 0.5, 1), transform 0.35s ease;
	display: flex;
	align-items: stretch;
	position: relative;
}

.at-expand-card.is-active {
	flex: 2.8 1 0;
}

.at-expand-card__content {
	position: relative;
	z-index: 3;
	padding: 24px;
	display: flex;
	gap: 16px;
	align-items: flex-end;
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	transition: padding 0.35s ease;
}

.at-expand-card__number {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.14em;
	color: var(--at-card-primary);
	padding-bottom: 6px;
	line-height: 1;
	flex-shrink: 0;
	transition: color 0.3s ease;
}

.at-expand-card__body {
	flex: 1;
	min-width: 0;
}

.at-expand-card h3,
.at-expand-card__title {
	margin: 0 0 8px;
	font-size: clamp(20px, 2.6vw, 34px);
	font-weight: 700;
	line-height: 1.15;
	white-space: nowrap;
	color: var(--at-card-heading-color);
	transition: font-size 0.3s ease, margin 0.3s ease, color 0.3s ease;
}

.at-expand-card p,
.at-expand-card__desc {
	margin: 0;
	max-width: 44ch;
	opacity: 0;
	font-size: 14px;
	line-height: 1.55;
	color: var(--at-card-text-color);
	transform: translateY(8px);
	transition: opacity 0.35s ease 0.08s, transform 0.35s ease 0.08s;
}

.at-expand-card.is-active p,
.at-expand-card.is-active .at-expand-card__desc {
	opacity: 1;
	transform: none;
}

.at-expand-card__cta {
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease 0.12s, transform 0.3s ease 0.12s;
}

.at-expand-card.is-active .at-expand-card__cta {
	opacity: 1;
	transform: none;
}

/* --------------------------------------------------------------------------
   Expand Cards — Rotated Collapsed Text & Vertical Alignment
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
	/* When collapsed, rotate title vertically to fit full text without clipping */
	.at-expand-cards--rotate-collapsed .at-expand-card:not(.is-active) {
		align-items: stretch;
	}

	.at-expand-cards--rotate-collapsed .at-expand-card:not(.is-active) .at-expand-card__content {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: center;
		height: 100%;
		width: 100%;
		padding: 30px 10px 24px;
		box-sizing: border-box;
	}

	.at-expand-cards--rotate-collapsed .at-expand-card:not(.is-active) .at-expand-card__number {
		order: 2;
		padding: 0;
		margin: 0;
		font-size: 13px;
		font-weight: 700;
		letter-spacing: 0.14em;
		text-align: center;
		color: #93c5fd;
		line-height: 1;
		flex-shrink: 0;
	}

	.at-expand-cards--rotate-collapsed .at-expand-card:not(.is-active) .at-expand-card__body {
		order: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		flex: 1;
		width: 100%;
		min-height: 0;
	}

	/* Bottom to Top (-90° / book spine reading orientation) */
	.at-expand-cards--rotate-collapsed:not(.at-expand-cards--dir-top_to_bottom) .at-expand-card:not(.is-active) .at-expand-card__title,
	.at-expand-cards--rotate-collapsed:not(.at-expand-cards--dir-top_to_bottom) .at-expand-card:not(.is-active) h3 {
		writing-mode: vertical-rl;
		transform: rotate(180deg);
		white-space: nowrap;
		margin: 0;
		font-size: clamp(16px, 1.8vw, 22px);
		font-weight: 700;
		letter-spacing: 0.04em;
		line-height: 1;
		text-align: center;
		cursor: pointer;
		color: #ffffff !important;
		text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
	}

	/* Top to Bottom (90°) */
	.at-expand-cards--dir-top_to_bottom .at-expand-card:not(.is-active) .at-expand-card__title,
	.at-expand-cards--dir-top_to_bottom .at-expand-card:not(.is-active) h3 {
		writing-mode: vertical-rl;
		transform: none;
		white-space: nowrap;
		margin: 0;
		font-size: clamp(16px, 1.8vw, 22px);
		font-weight: 700;
		letter-spacing: 0.04em;
		line-height: 1;
		text-align: center;
		cursor: pointer;
		color: #ffffff !important;
		text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
	}

	.at-expand-cards--rotate-collapsed .at-expand-card:not(.is-active) p,
	.at-expand-cards--rotate-collapsed .at-expand-card:not(.is-active) .at-expand-card__desc,
	.at-expand-cards--rotate-collapsed .at-expand-card:not(.is-active) .at-expand-card__cta {
		display: none !important;
		opacity: 0 !important;
		pointer-events: none !important;
	}

	/* Active card resets cleanly to horizontal */
	.at-expand-cards .at-expand-card.is-active .at-expand-card__content {
		display: flex;
		flex-direction: row;
		align-items: flex-end;
		gap: 16px;
		padding: 24px;
		width: 100%;
		height: 100%;
		justify-content: flex-start;
	}

	.at-expand-cards .at-expand-card.is-active .at-expand-card__title,
	.at-expand-cards .at-expand-card.is-active h3 {
		writing-mode: horizontal-tb !important;
		transform: none !important;
		white-space: normal;
		margin: 0 0 8px;
	}
}

/* Responsive Rules */
@media (max-width: 767px) {
	.at-expand-cards {
		display: flex;
		flex-direction: column;
		min-height: auto;
		gap: 16px;
	}

	.at-expand-card,
	.at-expand-card.is-active {
		display: flex;
		min-height: 200px;
		flex: none;
		width: 100%;
		transition: min-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
	}

	.at-expand-card.is-active {
		min-height: 360px;
	}

	.at-flip-card {
		min-height: 380px;
		padding: 0;
	}

	.at-tilt-card,
	.at-spotlight-card {
		min-height: 360px;
		padding: 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.at-flip-card__inner,
	.at-expand-card,
	.at-expand-card__image,
	.at-expand-card p,
	.at-expand-card__cta {
		transition: none !important;
	}
	.at-flip-card__inner {
		transform: none !important;
	}
	.at-expand-card,
	.at-expand-card.is-active {
		flex: 1;
	}
	.at-expand-card p,
	.at-expand-card__cta {
		opacity: 1;
		transform: none;
	}
	.at-tilt-card--slide-reveal .at-tilt-card__reveal-wrap {
		transition: none !important;
		grid-template-rows: 1fr !important;
		opacity: 1 !important;
		transform: none !important;
		pointer-events: auto !important;
	}
}
