/**
 * Creatif Work Essentials — ZZ Background Switcher
 * © 2026 Creatif Work. All rights reserved. Confidential & proprietary.
 *
 * Structure only. Colours, sizes and speeds come from Elementor controls.
 */

/* Own the box model. Most themes set this globally, but a distributable widget
   should not depend on that: without it, height:100% plus padding overflows. */
.zz-bgsw,
.zz-bgsw *,
.zz-bgsw *::before,
.zz-bgsw *::after {
	box-sizing: border-box;
}

.zz-bgsw__row {
	position: relative;
	display: flex;
	width: 100%;
	height: auto;
	min-height: 70vh;
	overflow: hidden;
	background-color: #fff;
}

/* ---------------- background layers ---------------- */

.zz-bgsw__bgs {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.zz-bgsw__bg {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	transition-property: opacity;
	transition-timing-function: ease;
	transition-duration: 400ms;
	will-change: opacity;
}

.zz-bgsw__bg.is-active {
	opacity: 1;
}

.zz-bgsw__bg img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center center;
}

/* Sits above the images, below the column tints. */
.zz-bgsw__wash {
	position: absolute;
	inset: 0;
	display: block;
	pointer-events: none;
}

/* ---------------- columns ---------------- */

.zz-bgsw__col {
	position: relative;
	z-index: 2;
	flex: 1 1 0;
	min-width: 0;
	overflow: hidden;
	border-right-width: 1px;
	border-right-style: solid;
	border-color: rgba(255, 255, 255, 0.3);
	cursor: pointer;
	/* Columns sit above .zz-bgsw__bgs. They must stay transparent on desktop or
	   each one covers the shared layer and the cross-fade is never seen. */
	background-image: none;
	/* The column does the bottom alignment itself. Doing it on the content box
	   instead would need min-height:100%, and a percentage height against a
	   parent whose height is indefinite (which it is once stacked) resolves to
	   zero in Safari, dropping the copy to the top of the item. */
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}

.zz-bgsw__col:last-child {
	border-right-width: 0;
}

.zz-bgsw__tint {
	position: absolute;
	inset: 0;
	display: block;
	transition: background-color 300ms ease;
	pointer-events: none;
}

.zz-bgsw__content {
	position: relative;
	z-index: 1;
	width: 100%;
	padding: 40px 32px;
	color: #fff;
	text-align: left;
}

.zz-bgsw__title-link {
	color: inherit;
	text-decoration: none;
}

.zz-bgsw__title {
	transition: transform 300ms ease;
}

/* Collapsed until the column is active. max-height rather than display, so it
   can transition. */
.zz-bgsw__more {
	overflow: hidden;
	max-height: 0;
	transform-origin: bottom;
	transition: max-height 300ms ease;
}

.zz-bgsw__col.is-active .zz-bgsw__more {
	max-height: 300px;
	overflow: visible;
}

.zz-bgsw__btn {
	display: inline-block;
	margin-top: 24px;
	padding-bottom: 3px;
	border-bottom: 1px solid transparent;
	color: #fff;
	text-decoration: none;
	transition: border-color 300ms ease;
}

.zz-bgsw__col:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

/* ---------------- stacked ----------------
 *
 * The wrapper carries zz-bgsw--stack-mobile / --stack-tablet / --stack-never
 * from the Stack At control. Stacking is done here rather than through an
 * Elementor selector because the per-item background image must only paint
 * while stacked: the columns sit above the shared layer, so painting them at
 * desktop would hide the cross-fade entirely.
 * ------------------------------------------------------------------------ */

@media (max-width: 1024px) {
	.zz-bgsw--stack-tablet .zz-bgsw__row {
		flex-direction: column;
	}

	.zz-bgsw--stack-tablet .zz-bgsw__col {
		border-right-width: 0;
		border-bottom-width: 1px;
		border-bottom-style: solid;
		background-image: var( --zz-bgsw-img, none );
		background-size: cover;
		background-position: var( --zz-bgsw-pos, center center );
	}

	.zz-bgsw--stack-tablet .zz-bgsw__col:last-child {
		border-bottom-width: 0;
	}

	.zz-bgsw--stack-tablet .zz-bgsw__bgs {
		display: none;
	}

}

@media (max-width: 767px) {
	.zz-bgsw--stack-tablet .zz-bgsw__row,
	.zz-bgsw--stack-mobile .zz-bgsw__row {
		flex-direction: column;
	}

	.zz-bgsw--stack-tablet .zz-bgsw__col,
	.zz-bgsw--stack-mobile .zz-bgsw__col {
		border-right-width: 0;
		border-bottom-width: 1px;
		border-bottom-style: solid;
		background-image: var( --zz-bgsw-img, none );
		background-size: cover;
		background-position: var( --zz-bgsw-pos, center center );
	}

	.zz-bgsw--stack-tablet .zz-bgsw__col:last-child,
	.zz-bgsw--stack-mobile .zz-bgsw__col:last-child {
		border-bottom-width: 0;
	}

	.zz-bgsw--stack-tablet .zz-bgsw__bgs,
	.zz-bgsw--stack-mobile .zz-bgsw__bgs {
		display: none;
	}

}

@media (prefers-reduced-motion: reduce) {
	.zz-bgsw__bg,
	.zz-bgsw__tint,
	.zz-bgsw__title,
	.zz-bgsw__more,
	.zz-bgsw__btn {
		transition: none;
	}
}
