/**
 * PWD Animations - Stacked Deck widget stylesheet.
 * Loaded together with pwd-animations-core.css.
 *
 * HTML and CSS only. Each card knows its place in the deck (--pwd-sd-i, 1 is
 * the back card) and the deck knows the card count (--pwd-sd-n), both written
 * by the PHP render. Collapsed, every card behind the front one is pushed back
 * in 3D, lifted to overlap, blurred and faded in proportion to how far back it
 * is. On hover or keyboard focus every card returns to a plain list.
 *
 * Elementor and themes style bare ul, li, img and a elements, so every rule is
 * scoped under .pwd-sd and goes two or three classes deep.
 */

.pwd-sd {
	--pwd-sd-ov: 26px;
	--pwd-sd-dz: 55px;
	--pwd-sd-persp: 500px;
	--pwd-sd-bs: 1.5px;
	--pwd-sd-os: 0.12;
	--pwd-sd-gap: 20px;
	--pwd-sd-dur: 0.5s;
	--pwd-sd-stagger: 50ms;
	--pwd-sd-n: 1;
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	max-width: 450px;
	margin-right: auto;
	margin-left: auto;
}

.pwd-sd .pwd-sd__list {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	perspective: var(--pwd-sd-persp);
	transform-style: preserve-3d;
	transition: gap var(--pwd-sd-dur) ease;
}

.pwd-sd .pwd-sd__item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
	transform: translateZ(calc((var(--pwd-sd-i) - var(--pwd-sd-n)) * var(--pwd-sd-dz))) translateY(calc((var(--pwd-sd-i) - 1) * var(--pwd-sd-ov) * -1));
	opacity: max(0.3, calc(1 - (var(--pwd-sd-n) - var(--pwd-sd-i)) * var(--pwd-sd-os)));
	filter: blur(calc((var(--pwd-sd-n) - var(--pwd-sd-i)) * var(--pwd-sd-bs)));
	transition: transform var(--pwd-sd-dur) ease, opacity var(--pwd-sd-dur) ease, filter var(--pwd-sd-dur) ease;
	transition-delay: calc(var(--pwd-sd-i) * var(--pwd-sd-stagger));
}

.pwd-sd .pwd-sd__card {
	display: flex;
	align-items: center;
	gap: 20px;
	box-sizing: border-box;
	min-height: 96px;
	padding: 16px;
	border-radius: 10px;
	background-color: #fff;
	box-shadow: 0 0 12px rgba(0, 0, 0, 0.24);
	color: inherit;
	text-decoration: none;
}

.pwd-sd a.pwd-sd__card {
	cursor: pointer;
}

.pwd-sd .pwd-sd__card .pwd-sd__img {
	display: block;
	flex: 0 0 auto;
	width: 64px;
	max-width: none;
	height: 64px;
	margin: 0;
	border-radius: 8px;
	object-fit: cover;
}

.pwd-sd .pwd-sd__text {
	flex: 1 1 auto;
	min-width: 0;
}

.pwd-sd .pwd-sd__title {
	margin: 0 0 6px;
	color: #111;
	font-weight: 600;
	line-height: 1;
}

.pwd-sd .pwd-sd__sub {
	margin: 0;
	color: #777;
	line-height: 1;
}

/* Spread out: hover, keyboard focus, or the always-open option */
.pwd-sd:hover .pwd-sd__list,
.pwd-sd:focus .pwd-sd__list,
.pwd-sd:focus-within .pwd-sd__list,
.pwd-sd.pwd-sd--open .pwd-sd__list {
	gap: var(--pwd-sd-gap);
}

.pwd-sd:hover .pwd-sd__item,
.pwd-sd:focus .pwd-sd__item,
.pwd-sd:focus-within .pwd-sd__item,
.pwd-sd.pwd-sd--open .pwd-sd__item {
	transform: none;
	opacity: 1;
	filter: none;
}

.pwd-sd:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 6px;
}

/* A stack hides most of the text, so reduced motion gets the plain list */
@media (prefers-reduced-motion: reduce) {
	.pwd-sd .pwd-sd__list {
		gap: var(--pwd-sd-gap);
		transition: none;
	}

	.pwd-sd .pwd-sd__item {
		transform: none;
		opacity: 1;
		filter: none;
		transition: none;
	}
}
