.taban-fan {
	--taban-navy: #102e4a;
	--taban-ink: #000418;
	--taban-gold: #bd892f;
	position: relative;
	width: 100%;
	max-width: 100%;
	padding: clamp(24px, 4vw, 52px) 0;
	direction: rtl;
	background: transparent;
	color: var(--taban-ink);
	font-family: "VazirMatn", Sans-serif;
	/* Peeking deck cards must not widen the page and trigger horizontal scroll. */
	overflow-x: hidden;
	overflow-x: clip;
}

.taban-fan,
.taban-fan * {
	box-sizing: border-box;
}

.taban-fan-inner {
	width: 100%;
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 20px;
}

/* ── Header ── */
.taban-fan-header {
	text-align: center;
	margin-bottom: clamp(18px, 3vw, 34px);
}

.taban-fan-badge {
	display: inline-block;
	margin-bottom: 12px;
	padding: 6px 14px;
	border: 1px solid rgba(16, 46, 74, .14);
	border-radius: 999px;
	color: rgba(16, 46, 74, .68);
	font-size: clamp(11px, 1.1vw, 13px);
	font-weight: 700;
}

.taban-fan-title {
	margin: 0;
	color: var(--taban-navy);
	font-size: clamp(22px, 3.2vw, 38px);
	font-weight: 800;
	line-height: 1.4;
}

.taban-fan-subtitle {
	margin: 10px auto 0;
	max-width: 56ch;
	color: rgba(0, 4, 24, .6);
	font-size: clamp(13px, 1.3vw, 16px);
	line-height: 2;
}

/* ── Fan stage ── */
.taban-fan-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 240px;
	direction: ltr;
	overflow: hidden;
}

.taban-fan-card {
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: var(--taban-fan-card-w, 200px);
	margin: calc(var(--taban-fan-card-h, 150px) / -2) 0 0 calc(var(--taban-fan-card-w, 200px) / -2);
	padding: 0;
	font: inherit;
	color: inherit;
	text-align: inherit;
	z-index: var(--taban-fan-z, 1);
	opacity: var(--taban-fan-o, 1);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	will-change: transform;
	transform:
		translate3d(var(--taban-fan-x, 0px), calc(var(--taban-fan-y, 0px) + var(--taban-fan-hover-y, 0px)), 0)
		rotate(var(--taban-fan-r, 0deg))
		scale(calc(var(--taban-fan-s, 1) * var(--taban-fan-hover-s, 1)));
	transition:
		transform .85s cubic-bezier(.16, 1, .3, 1),
		opacity .6s ease,
		filter .45s ease;
	transition-delay: var(--taban-fan-delay, 0ms);
}

/* Themes style bare `button` elements, so every state is neutralised here. */
.taban-fan-card,
.taban-fan-card:hover,
.taban-fan-card:focus,
.taban-fan-card:focus-visible,
.taban-fan-card:active {
	border: 0 !important;
	background: none !important;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	text-decoration: none !important;
	outline: none;
}

/* Collapsed stack before the reveal animation runs. */
.taban-fan-stage:not(.is-revealed) .taban-fan-card {
	opacity: 0;
	transform: translate3d(0, 26px, 0) rotate(0deg) scale(.86);
}

.taban-fan-card-inner {
	display: block;
	position: relative;
	width: 100%;
	border: 1px solid rgba(0, 0, 0, .06);
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 18px 36px -12px rgba(0, 0, 0, .22);
	overflow: hidden;
	transition: box-shadow .45s ease;
}

.taban-fan-media {
	display: block;
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

/* Themes commonly force `height: auto` on images, which breaks the crop. */
.taban-fan-image,
.taban-fan-placeholder {
	display: block;
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover !important;
	object-position: center center;
	transition: transform 1s cubic-bezier(.25, .46, .45, .94);
}

.taban-fan-placeholder {
	background:
		radial-gradient(circle at 30% 28%, rgba(189, 137, 47, .38), transparent 55%),
		linear-gradient(145deg, var(--taban-navy), var(--taban-ink));
}

.taban-fan-veil {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, .68) 0%, rgba(0, 0, 0, .22) 42%, transparent 78%);
	opacity: 0;
	transition: opacity .35s ease;
	pointer-events: none;
}

.taban-fan-caption {
	display: block;
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 0 12px 11px;
	direction: rtl;
	text-align: right;
	opacity: 0;
	transform: translateY(9px);
	transition: opacity .35s ease, transform .35s cubic-bezier(.22, 1, .36, 1);
	pointer-events: none;
}

.taban-fan-chip {
	display: inline-block;
	margin-bottom: 5px;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .34);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	color: rgba(255, 255, 255, .85);
	font-size: 9px;
	font-weight: 600;
	letter-spacing: .04em;
}

.taban-fan-name {
	display: block;
	margin: 0;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.5;
}

/* ── Hover ── */
@media (hover: hover) {
	.taban-fan-card:hover,
	.taban-fan-card:focus-visible {
		--taban-fan-hover-y: -16px;
		--taban-fan-hover-s: 1.07;
		z-index: 40;
		outline: none;
		transition-delay: 0ms;
	}

	.taban-fan-card:hover .taban-fan-card-inner,
	.taban-fan-card:focus-visible .taban-fan-card-inner {
		box-shadow: 0 30px 56px -14px rgba(0, 0, 0, .34);
	}

	.taban-fan-card:focus-visible .taban-fan-card-inner {
		outline: 2px solid var(--taban-gold);
		outline-offset: 3px;
	}

	.taban-fan-card:hover .taban-fan-image,
	.taban-fan-card:focus-visible .taban-fan-image {
		transform: scale(1.07);
	}

	.taban-fan-card:hover .taban-fan-veil,
	.taban-fan-card:focus-visible .taban-fan-veil,
	.taban-fan-card:hover .taban-fan-caption,
	.taban-fan-card:focus-visible .taban-fan-caption {
		opacity: 1;
	}

	.taban-fan-card:hover .taban-fan-caption,
	.taban-fan-card:focus-visible .taban-fan-caption {
		transform: translateY(0);
	}

	/* Dim the siblings so the hovered card reads as the focus. */
	.taban-fan-stage.is-hovering .taban-fan-card:not(:hover) {
		opacity: .62;
		filter: saturate(.75);
	}
}

/* Touch devices cannot hover, so the caption stays visible. */
@media (hover: none) {
	.taban-fan-veil,
	.taban-fan-caption {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Compact deck (narrow containers) ── */
/* A nine-card arc collapses into unreadable slivers on a phone, so the fan
   becomes a swipeable deck: one card in front, the neighbours peeking out. */
.taban-fan.is-compact .taban-fan-stage {
	touch-action: pan-y;
	overflow: hidden;
}

.taban-fan.is-compact .taban-fan-veil,
.taban-fan.is-compact .taban-fan-caption {
	opacity: 1;
	transform: translateY(0);
}

.taban-fan.is-compact .taban-fan-chip {
	font-size: 11px;
	padding: 4px 11px;
}

.taban-fan.is-compact .taban-fan-name {
	font-size: 16px;
}

.taban-fan.is-compact .taban-fan-caption {
	padding: 0 16px 16px;
}

.taban-fan-dots {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
}

.taban-fan.is-compact .taban-fan-dots {
	display: flex;
}

.taban-fan .taban-fan-dot {
	width: 7px;
	height: 7px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(16, 46, 74, .22);
	box-shadow: none;
	cursor: pointer;
	transition: width .35s cubic-bezier(.16, 1, .3, 1), background .3s ease;
}

.taban-fan .taban-fan-dot.is-active {
	width: 22px;
	border-radius: 999px;
	background: var(--taban-gold);
}

/* ── Modal ── */
.taban-fan-modal[hidden] {
	display: none;
}

.taban-fan-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(12px, 3vw, 40px);
	direction: rtl;
	font-family: "VazirMatn", Sans-serif;
}

.taban-fan-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .88);
	backdrop-filter: blur(14px) saturate(120%);
	-webkit-backdrop-filter: blur(14px) saturate(120%);
	opacity: 0;
	transition: opacity .38s ease;
}

.taban-fan-modal.is-open .taban-fan-modal-backdrop {
	opacity: 1;
}

.taban-fan-modal-dialog {
	position: relative;
	width: auto;
	max-width: min(1200px, 100%);
	max-height: calc(100vh - 2 * clamp(12px, 3vw, 40px));
	display: flex;
	flex-direction: column;
	border: 1px solid rgba(255, 255, 255, .16);
	border-radius: 20px;
	background: rgba(255, 255, 255, .07);
	backdrop-filter: blur(26px) saturate(160%);
	-webkit-backdrop-filter: blur(26px) saturate(160%);
	box-shadow:
		0 50px 110px -28px rgba(0, 0, 0, .85),
		inset 0 1px 0 rgba(255, 255, 255, .16);
	overflow: hidden;
	opacity: 0;
	transform: translateY(28px) scale(.96);
	transition:
		opacity .42s ease,
		transform .52s cubic-bezier(.16, 1, .3, 1);
}

.taban-fan-modal.is-open .taban-fan-modal-dialog {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.taban-fan-modal .taban-fan-modal-close {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 4;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .2);
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
	transition: background .25s ease, color .25s ease, transform .25s ease;
}

.taban-fan-modal .taban-fan-modal-close:hover {
	background: #fff;
	color: #000418;
	transform: rotate(90deg);
}

.taban-fan-modal-close svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

.taban-fan-modal *[hidden] {
	display: none !important;
}

.taban-fan-modal-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	flex: 1 1 auto;
	padding: 10px;
	transition: opacity .3s ease;
}

/* Swapping between items fades the image instead of snapping. */
.taban-fan-modal-stage.is-swapping {
	opacity: .25;
}

.taban-fan-modal .taban-fan-modal-frame {
	display: block;
	max-width: 100%;
	min-height: 0;
	border-radius: 12px;
	background: rgba(0, 0, 0, .3);
	overflow: hidden;
	line-height: 0;
	text-decoration: none;
}

.taban-fan-modal .taban-fan-modal-frame[href] {
	cursor: zoom-in;
}

.taban-fan-modal-image {
	display: block;
	width: auto !important;
	height: auto !important;
	max-width: 100% !important;
	max-height: calc(100vh - 220px) !important;
	margin: 0;
	border-radius: 12px;
	object-fit: contain !important;
	opacity: 0;
	transform: scale(1.02);
	transition: opacity .5s ease, transform .8s cubic-bezier(.16, 1, .3, 1);
}

.taban-fan-modal.is-loaded .taban-fan-modal-image {
	opacity: 1;
	transform: scale(1);
}

.taban-fan-modal-nav {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 12px;
	border-top: 1px solid rgba(255, 255, 255, .12);
	background: rgba(255, 255, 255, .05);
}

.taban-fan-modal .taban-fan-modal-arrow {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .2);
	border-radius: 50%;
	background: rgba(255, 255, 255, .08);
	color: #fff;
	cursor: pointer;
	transition: background .25s ease, color .25s ease, border-color .25s ease, opacity .25s ease;
}

.taban-fan-modal .taban-fan-modal-arrow:hover:not(:disabled) {
	background: #fff;
	border-color: #fff;
	color: #000418;
}

.taban-fan-modal .taban-fan-modal-arrow:disabled {
	opacity: .3;
	cursor: default;
}

.taban-fan-modal-arrow svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.taban-fan-modal-counter {
	min-width: 62px;
	color: rgba(255, 255, 255, .6);
	font-size: 13px;
	font-weight: 700;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

body.taban-fan-modal-open {
	overflow: hidden;
}

@media (max-width: 600px) {
	.taban-fan-inner {
		padding: 0 14px;
	}

	.taban-fan-card-inner {
		border-radius: 16px;
	}

	.taban-fan-modal {
		padding: 10px;
	}

	.taban-fan-modal-dialog {
		border-radius: 16px;
	}

	.taban-fan-modal-image {
		max-height: calc(100vh - 170px) !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.taban-fan-card,
	.taban-fan-image,
	.taban-fan-veil,
	.taban-fan-caption,
	.taban-fan-modal-dialog,
	.taban-fan-modal-backdrop,
	.taban-fan-modal-image {
		transition-duration: .01ms !important;
	}
}
