/* Northern Sky - Projects Stack
   Structural / layout CSS only. Colors, typography, spacing and the
   animation timing are controlled per-instance from the Elementor Style
   tab (see the widget's "selectors" in class-projects-stack-widget.php).

   Stacking mechanic: each .nsm-stack-item is a normal-flow block whose
   height equals the visible card height. As the page scrolls, each item
   pins to the top of the viewport (position: sticky) in DOM order, so a
   later item's sticky position visually slides up and covers the earlier
   (lower z-index) card underneath it - no JS required for the pin/cover
   itself. Note: an ancestor with overflow:hidden/auto between this widget
   and the scrolling viewport will break position: sticky. */

.nsm-projects-stack,
.nsm-projects-stack *,
.nsm-projects-stack *::before,
.nsm-projects-stack *::after {
	box-sizing: border-box;
}

.nsm-projects-stack {
	position: relative;
	width: 100%;
}

.nsm-projects-stack-empty {
	padding: 40px;
	text-align: center;
	opacity: 0.6;
}

.nsm-stack-item {
	position: sticky;
	top: 0;
	width: 100%;
	height: 90vh;
}

.nsm-stack-card {
	position: absolute;
	inset: 20px;
	border-radius: 24px;
	overflow: hidden;
}

.nsm-stack-bg-wrap {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.nsm-stack-bg-image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	opacity: 0;
	transform: translateY(var(--nsm-stack-bg-offset, 40px)) scale(1);
	transition-property: opacity, transform;
	transition-timing-function: cubic-bezier(0.16, 0.84, 0.44, 1);
	transition-duration: var(--nsm-stack-bg-duration, 0.9s);
	transition-delay: var(--nsm-stack-bg-delay, 0.1s);
	will-change: transform, opacity;
}

.nsm-stack-item.nsm-in-view .nsm-stack-bg-image {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.nsm-stack-no-bg-reveal .nsm-stack-bg-image {
	opacity: 1;
	transform: translateY(0) scale(1);
	transition: transform var(--nsm-stack-hover-duration, 0.9s) ease;
}

/* Hover zoom - independent of the entrance transform above; the settled
   translateY(0) position is preserved, only the scale changes. */
.nsm-stack-card:hover .nsm-stack-bg-image {
	transform: translateY(0) scale(var(--nsm-stack-hover-scale, 1.06));
	transition-duration: var(--nsm-stack-hover-duration, 0.9s);
	transition-delay: var(--nsm-stack-hover-delay, 0.4s);
}

.nsm-stack-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.nsm-stack-content {
	position: relative;
	z-index: 1;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	padding: 48px 56px;
}

.nsm-stack-divider {
	width: 100%;
	border: none;
	border-top-style: solid;
	border-top-width: 1px;
	margin: 0 0 24px;
}

.nsm-stack-row {
	display: flex;
	align-items: flex-start;
	gap: 32px;
	width: 100%;
}

.nsm-stack-label-col {
	flex: 0 0 170px;
	max-width: 170px;
}

.nsm-stack-label {
	display: inline-block;
	text-transform: uppercase;
	white-space: nowrap;
}

.nsm-stack-description {
	flex: 1 1 auto;
	min-width: 0;
}

.nsm-stack-description p {
	margin: 0;
}

.nsm-stack-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	border-bottom-style: solid;
	border-bottom-width: 1px;
	padding-bottom: 4px;
	width: fit-content;
	transition: color 0.3s ease, border-color 0.3s ease;
}

.nsm-stack-btn-text {
	display: inline-block;
	transition: color 0.3s ease;
}

.nsm-stack-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	transition: transform 0.3s ease, color 0.3s ease;
}

.nsm-stack-heading {
	flex: 0 1 auto;
	margin: 0;
	margin-left: auto;
	line-height: 1.15;
}

@media (prefers-reduced-motion: reduce) {
	.nsm-stack-bg-image {
		transition: none !important;
		opacity: 1 !important;
		transform: translateY(0) scale(1) !important;
	}

	.nsm-stack-card:hover .nsm-stack-bg-image {
		transform: translateY(0) scale(1) !important;
	}
}

/* Tablet */
@media (max-width: 1024px) {
	.nsm-stack-content {
		padding: 32px;
	}

	.nsm-stack-row {
		gap: 20px;
	}

	.nsm-stack-label-col {
		flex-basis: 120px;
		max-width: 120px;
	}
}

/* Mobile - stack the row into a column so nothing gets crushed */
@media (max-width: 767px) {
	.nsm-stack-item {
		height: auto;
		min-height: 70vh;
	}

	.nsm-stack-card {
		inset: 12px;
		border-radius: 16px;
	}

	.nsm-stack-content {
		padding: 24px 20px;
		justify-content: flex-end;
	}

	.nsm-stack-row {
		flex-direction: column;
		gap: 16px;
	}

	.nsm-stack-label-col {
		flex-basis: auto;
		max-width: 100%;
	}

	.nsm-stack-description {
		max-width: 100% !important;
	}

	.nsm-stack-heading {
		margin-left: 0;
		max-width: 100% !important;
		text-align: left !important;
	}
}
