/* =========================================================
   Zambezi Utilities — Project Deck
   ---------------------------------------------------------
   A coverflow carousel: one large straight card in the
   middle with up to two narrow cards either side, turned
   away in depth a hairline apart.

   The geometry is solved in zcu-deck.js, which sets --k (the
   scale), the per-card transform and the frame clip. Only
   transform, clip-path and opacity animate, so the whole
   deck stays on the compositor.
   ========================================================= */

.zcu-deck {
	--zcu-deck-gold: var(--zcu-accent, #f6a91a);
	--zcu-deck-gold-deep: #d98f08;
	--zcu-deck-dark: #18200f;
	position: relative;
	width: 100%;

	/*
	 * Hard guard. Cards that are off the deck keep their full offset while
	 * faded out, and an absolutely positioned element at opacity 0 still
	 * counts towards scroll width — below 1024px, where only three cards
	 * show, the two hidden ones pushed the document ~130px wider than the
	 * viewport. A page-level horizontal overflow shows up nowhere near its
	 * cause, so this is clipped at source.
	 *
	 * Clipped on the x axis only: the cards cast drop shadows that must stay
	 * visible above and below. Browsers without overflow:clip fall back to
	 * the hidden declaration, which clips both axes but still prevents the
	 * overflow.
	 */
	max-width: 100%;
	overflow: hidden;
	overflow-x: clip;
	overflow-y: visible;
}

.zcu-deck__stage {
	--k: 1; /* geometry scale, set by the script */
	position: relative;
	height: 565px;
	touch-action: pan-y;
}

.zcu-deck__card {
	position: absolute;
	top: 35px;
	left: calc(50% - 185px);
	display: block;
	width: 370px;
	height: 495px;
	text-decoration: none;
	transform-origin: 50% 50%;
	filter: drop-shadow(0 12px 16px rgba(14, 30, 24, 0.26));
	transition:
		transform 0.9s cubic-bezier(0.25, 0.8, 0.25, 1),
		opacity 0.42s ease,
		filter 0.9s ease;
	will-change: transform;
}

.zcu-deck__card.is-centre {
	filter: drop-shadow(0 20px 26px rgba(14, 30, 24, 0.42));
}

.zcu-deck__card:focus-visible {
	outline: 3px solid var(--zcu-deck-gold);
	outline-offset: 6px;
	border-radius: 12px;
}

.zcu-deck__frame {
	position: absolute;
	inset: 0;
	display: block;
	overflow: hidden;
	background: var(--zcu-deck-dark);
	clip-path: inset(0 0 round 10px);
	transition: clip-path 0.9s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* While the script lays the deck out, nothing animates — otherwise every
   card would slide in from wherever it happened to be. */
.zcu-deck.is-static .zcu-deck__card,
.zcu-deck.is-static .zcu-deck__frame,
.zcu-deck.is-static .zcu-deck__body {
	transition: none;
}

/* The one card that wraps between the two ends jumps while hidden rather
   than sweeping across the middle. */
.zcu-deck__card.no-anim,
.zcu-deck__card.no-anim .zcu-deck__frame {
	transition: none !important;
}

.zcu-deck__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.zcu-deck__veil {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgba(12, 32, 26, 0) 0%,
		rgba(12, 32, 26, 0) 40%,
		rgba(22, 40, 18, 0.65) 66%,
		rgba(10, 18, 8, 0.96) 100%
	);
}

/* ---------- card copy ---------- */

/* Sized against the slot scale, so the side cards read at the same optical
   size as the centre one rather than simply shrinking with it. */
.zcu-deck__body {
	position: absolute;
	inset: auto 0 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0 calc(var(--inset, 0px) + 12px * var(--k)) calc(30px * var(--k));
	text-align: center;
	color: #fff;
	transition: opacity 0.5s ease, transform 0.5s ease;
}

.zcu-deck.is-swapping .zcu-deck__body {
	opacity: 0;
	transform: translateY(8px);
	transition-duration: 0.3s;
}

.zcu-deck__no {
	display: block;
	margin-bottom: calc(8px * var(--k));
	font-family: var(--zc-font-display, var(--zcu-font-display, inherit));
	font-size: max(20px, calc(38px * var(--k)));
	line-height: 1;
	color: var(--zcu-deck-gold);
}

.zcu-deck__title {
	display: block;
	font-family: var(--zc-font-display, var(--zcu-font-display, inherit));
	font-size: max(15px, calc(26px * var(--k)));
	line-height: 1.18;
	color: #fff;
	/* Client names run to three words; let them wrap rather than overflow
	   the clipped frame. */
	overflow-wrap: break-word;
	hyphens: none;
}

.zcu-deck__rule {
	display: block;
	width: calc(30px * var(--k));
	height: 1px;
	margin-top: calc(12px * var(--k));
	background: var(--zcu-deck-gold);
}

/* The description is for the featured card only; on the narrow side cards
   there is no room for it. */
.zcu-deck__desc {
	display: none;
}

/* ---------- featured card ---------- */

.zcu-deck__card.is-centre .zcu-deck__body {
	align-items: flex-start;
	padding: 0 calc(30px * var(--k)) calc(32px * var(--k));
	text-align: left;
}

.zcu-deck__card.is-centre .zcu-deck__no {
	margin-bottom: calc(8px * var(--k));
	font-size: max(30px, calc(56px * var(--k)));
}

.zcu-deck__card.is-centre .zcu-deck__title {
	font-size: max(20px, calc(38px * var(--k)));
}

.zcu-deck__card.is-centre .zcu-deck__desc {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	order: 3;
	max-width: calc(280px * var(--k));
	margin-top: calc(10px * var(--k));
	overflow: hidden;
	font-size: max(11px, calc(16px * var(--k)));
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.9);
}

.zcu-deck__card.is-centre .zcu-deck__rule {
	order: 4;
	width: calc(36px * var(--k));
	margin-top: calc(14px * var(--k));
}

/* ---------- controls ---------- */

.zcu-deck__arrow {
	position: absolute;
	top: calc(var(--stage-h, 440px) / 2 - 29px);
	z-index: 60;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	padding-bottom: 4px;
	font-size: 28px;
	line-height: 1;
	color: #fff;
	background: var(--zcu-deck-gold);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 8px 20px rgba(20, 49, 42, 0.3);
	cursor: pointer;
	transition: background 0.35s ease, transform 0.35s ease;
}

.zcu-deck__arrow:hover {
	background: var(--zcu-deck-gold-deep);
	transform: scale(1.07);
}

.zcu-deck__arrow:focus-visible {
	outline: 3px solid var(--zcu-deck-dark);
	outline-offset: 3px;
}

.zcu-deck__arrow--prev {
	left: 0;
}

.zcu-deck__arrow--next {
	right: 0;
}

.zcu-deck__dots {
	display: flex;
	gap: 9px;
	justify-content: center;
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
}

.zcu-deck__dots li {
	margin: 0;
	list-style: none;
}

.zcu-deck__dots button {
	width: 9px;
	height: 9px;
	padding: 0;
	background: #cfc6b6;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.3s ease, transform 0.3s ease;
}

.zcu-deck__dots button.is-active {
	background: var(--zcu-deck-gold);
	transform: scale(1.18);
}

.zcu-deck__dots button:focus-visible {
	outline: 2px solid var(--zcu-deck-dark);
	outline-offset: 3px;
}

/* ---------- responsive ---------- */

@media (max-width: 1023px) {
	.zcu-deck__arrow {
		top: calc(var(--stage-h, 440px) / 2 - 23px);
		width: 46px;
		height: 46px;
		font-size: 22px;
	}
}

@media (max-width: 767px) {
	.zcu-deck__arrow {
		top: calc(var(--stage-h, 440px) / 2 - 22px);
		width: 44px;
		height: 44px;
	}
}

/*
 * Without JavaScript the script never runs, so no card is ever placed and the
 * deck would be a stack of absolutely positioned cards on top of each other.
 * Fall back to a plain readable column.
 */
.zcu-deck:not(.is-ready) .zcu-deck__stage {
	height: auto;
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.zcu-deck:not(.is-ready) .zcu-deck__card {
	position: relative;
	top: auto;
	left: auto;
	width: 100%;
	height: 420px;
}

.zcu-deck:not(.is-ready) .zcu-deck__arrow,
.zcu-deck:not(.is-ready) .zcu-deck__dots {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.zcu-deck__card,
	.zcu-deck__frame,
	.zcu-deck__body,
	.zcu-deck__arrow,
	.zcu-deck__dots button {
		transition: none;
	}
}
