/* ==========================================================================
   Kaissa Animated Hero Cards - Frontend Stylesheet
   Replicating the dynamic card deck fan-out, word stagger, and speech badges
   ========================================================================== */

.kaissa-hero-showcase {
	position: relative;
	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	padding: 50px 20px 70px 20px;
	text-align: center;
	box-sizing: border-box;
	overflow: visible;
}

.kaissa-hero-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: relative;
}

/* --------------------------------------------------------------------------
   1. Headline & Staggered Word Reveal
   -------------------------------------------------------------------------- */
.kaissa-hero-headline {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: clamp(2rem, 5vw, 3.75rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.03em;
	color: #09090b;
	margin: 0 0 35px 0;
	max-width: 820px;
	text-wrap: balance;
}

.kaissa-hero-headline.is-split-words .kaissa-hero-word {
	display: inline-block;
	opacity: 0;
	transform: translateY(22px) scale(0.96);
	filter: blur(6px);
	transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
	            transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
	            filter 0.55s cubic-bezier(0.16, 1, 0.3, 1);
	will-change: transform, opacity, filter;
}

.kaissa-hero-showcase.is-animated .kaissa-hero-headline.is-split-words .kaissa-hero-word {
	opacity: 1;
	transform: translateY(0) scale(1);
	filter: blur(0);
	transition-delay: calc(0.2s + var(--word-index, 0) * 0.1s);
}

/* --------------------------------------------------------------------------
   2. Deck & Badges Stage
   -------------------------------------------------------------------------- */
.kaissa-hero-stage {
	position: relative;
	width: 100%;
	max-width: 1100px;
	height: clamp(230px, 26vw, 290px);
	margin: 15px 0 25px 0;
	display: flex;
	align-items: center;
	justify-content: center;
	perspective: 1200px;
	transform-style: preserve-3d;
}

/* Speech Bubble Badges */
.kaissa-hero-badge {
	position: absolute;
	z-index: 50;
	padding: 7px 16px;
	border-radius: 9999px;
	background: var(--badge-bg, #3b82f6);
	color: var(--badge-color, #ffffff);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: -0.01em;
	box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.1);
	display: inline-flex;
	align-items: center;
	opacity: 0;
	transform: scale(0) translateY(12px);
	transform-origin: center bottom;
	will-change: transform, opacity;
	pointer-events: auto;
	cursor: default;
	transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.kaissa-hero-badge .badge-arrow {
	position: absolute;
	bottom: -7px;
	width: 12px;
	height: 8px;
}

/* Left Badge: sits above left cards */
.kaissa-hero-badge.kaissa-badge-left {
	top: -16px;
	left: 14%;
}

.kaissa-hero-badge.kaissa-badge-left .badge-arrow {
	left: 18px;
}

/* Right Badge: sits above right card */
.kaissa-hero-badge.kaissa-badge-right {
	top: 0px;
	right: 14%;
}

.kaissa-hero-badge.kaissa-badge-right .badge-arrow {
	right: 18px;
}

/* Badges Pop-in Animation */
.kaissa-hero-showcase.is-animated:not(.is-collapsed) .kaissa-hero-badge.kaissa-badge-left {
	animation: kaissaBadgePop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) 1.5s forwards;
}

.kaissa-hero-showcase.is-animated:not(.is-collapsed) .kaissa-hero-badge.kaissa-badge-right {
	animation: kaissaBadgePop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) 1.65s forwards;
}

@keyframes kaissaBadgePop {
	0% {
		opacity: 0;
		transform: scale(0) translateY(15px);
	}
	70% {
		opacity: 1;
		transform: scale(1.18) translateY(-3px);
	}
	100% {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

/* When collapsed / closed on scroll: badges tuck away */
.kaissa-hero-showcase.is-collapsed .kaissa-hero-badge {
	opacity: 0 !important;
	transform: scale(0) translateY(10px) !important;
	animation: none !important;
}

/* --------------------------------------------------------------------------
   3. The Cards Deck Container & Fan-Out Motion
   -------------------------------------------------------------------------- */
.kaissa-hero-deck {
	position: relative;
	width: 0;
	height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transform-style: preserve-3d;
	opacity: 0;
	transform: translateY(120px) rotate(-6deg) scale(0.9);
	transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
	            transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
	will-change: transform, opacity;
}

.kaissa-hero-showcase.is-animated .kaissa-hero-deck {
	opacity: 1;
	transform: translateY(0) rotate(0deg) scale(1);
	transition-delay: 0.35s;
}

/* Individual Card */
.kaissa-hero-card {
	position: absolute;
	width: clamp(140px, 17vw, 195px);
	aspect-ratio: 1 / 1;
	display: block;
	text-decoration: none;
	outline: none;
	user-select: none;
	z-index: var(--card-z, 1);
	transform-origin: center bottom;
	cursor: pointer;

	/* Default stacked state */
	transform: translate3d(0, 0, 0) rotate(0deg);
	transition: transform 0.85s cubic-bezier(0.34, 1.35, 0.64, 1),
	            box-shadow 0.35s ease;
	will-change: transform, box-shadow;
}

/* Animated Fan-out state during entrance */
.kaissa-hero-showcase.is-animated:not(.is-collapsed) .kaissa-hero-card {
	transform: translate3d(var(--card-x, 0), var(--card-y, 0), 0) rotate(var(--card-rot, 0deg));
	transition-delay: calc(0.9s + var(--card-delay, 0s));
}

/* Ready State: Once entrance is done, remove transition-delay for INSTANT, silky smooth hover! */
.kaissa-hero-showcase.is-ready:not(.is-collapsed) .kaissa-hero-card {
	transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1),
	            box-shadow 0.35s ease !important;
	transition-delay: 0s !important;
}

/* Collapsed State on Scroll-down: Cards gracefully fold back into a neat stack */
.kaissa-hero-showcase.is-collapsed .kaissa-hero-card {
	transform: translate3d(0, 0, 0) rotate(-4deg) !important;
	transition: transform 0.65s cubic-bezier(0.34, 1.25, 0.64, 1) !important;
	transition-delay: calc(0.04s * var(--card-z, 1)) !important;
	box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.2) !important;
}

.kaissa-hero-card .card-inner {
	width: 100%;
	height: 100%;
	border-radius: clamp(14px, 2vw, 20px);
	overflow: hidden;
	background: #ffffff;
	border: 1.5px solid rgba(255, 255, 255, 0.85);
	box-shadow: 0 18px 34px -8px rgba(0, 0, 0, 0.22),
	            0 6px 12px -3px rgba(0, 0, 0, 0.1);
	position: relative;
	transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.kaissa-hero-card img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

/* Subtle glare overlay */
.kaissa-hero-card .card-glare {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.05) 40%, rgba(0,0,0,0.15) 100%);
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   4. Silky Smooth Interactive Hover Lift (Desktop)
   -------------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
	.kaissa-hero-showcase.has-hover-lift.is-ready:not(.is-collapsed) .kaissa-hero-card:hover {
		transform: translate3d(var(--card-x, 0), calc(var(--card-y, 0) - 30px), 80px) 
		           rotate(calc(var(--card-rot, 0deg) * 0.3)) 
		           scale(1.12) !important;
		z-index: 1000 !important;
		transition: transform 0.28s cubic-bezier(0.2, 1, 0.3, 1),
		            box-shadow 0.28s ease !important;
		transition-delay: 0s !important;
	}

	.kaissa-hero-showcase.has-hover-lift.is-ready:not(.is-collapsed) .kaissa-hero-card:hover .card-inner {
		border-color: rgba(255, 255, 255, 1);
		box-shadow: 0 32px 60px -12px rgba(0, 0, 0, 0.4),
		            0 12px 24px -4px rgba(0, 0, 0, 0.2);
	}
}

/* --------------------------------------------------------------------------
   5. Subtitle & Call-to-Action Buttons
   -------------------------------------------------------------------------- */
.kaissa-hero-subtitle {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: clamp(0.95rem, 2vw, 1.125rem);
	font-weight: 400;
	color: #64748b;
	line-height: 1.6;
	max-width: 650px;
	margin: 0 0 28px 0;
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
	            transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
	will-change: transform, opacity;
}

.kaissa-hero-showcase.is-animated .kaissa-hero-subtitle {
	opacity: 1;
	transform: translateY(0);
	transition-delay: 1.7s;
}

.kaissa-hero-actions {
	display: inline-flex;
	align-items: center;
	gap: 20px;
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
	            transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
	will-change: transform, opacity;
}

.kaissa-hero-showcase.is-animated .kaissa-hero-actions {
	opacity: 1;
	transform: translateY(0);
	transition-delay: 1.85s;
}

/* Primary Button (Dark Pill) */
.kaissa-hero-btn.kaissa-btn-primary {
	background: #09090b;
	color: #ffffff !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	font-weight: 600;
	padding: 12px 28px;
	border-radius: 9999px;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.kaissa-hero-btn.kaissa-btn-primary:hover {
	background: #27272a;
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

/* Secondary Button (Clean Link) */
.kaissa-hero-btn.kaissa-btn-secondary {
	background: transparent;
	color: #09090b !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	font-weight: 500;
	padding: 12px 16px;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease, transform 0.2s ease;
}

.kaissa-hero-btn.kaissa-btn-secondary:hover {
	color: #3b82f6 !important;
	transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   6. Mobile & Responsive Adaptations
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.kaissa-hero-showcase {
		padding: 40px 15px 50px 15px;
	}

	.kaissa-hero-stage {
		height: 210px;
		margin: 5px 0 25px 0;
	}

	.kaissa-hero-card {
		width: 125px;
	}

	.kaissa-hero-badge.kaissa-badge-left {
		top: -20px;
		left: 8%;
	}

	.kaissa-hero-badge.kaissa-badge-right {
		top: -5px;
		right: 6%;
	}

	.kaissa-hero-actions {
		flex-direction: column;
		gap: 12px;
		width: 100%;
	}

	.kaissa-hero-btn.kaissa-btn-primary {
		width: 100%;
		max-width: 260px;
	}
}
