/*------------------------------------------------------------------
[ AB Videos — видео карти: grid / слайдър + lightbox ]

Променливите (--ab-vd-*) идват inline от шорткода. Структурата е тук,
project-specific override-и отиват в css/ab_custom.css.
JS сменя .ab-vd--grid / .ab-vd--slider според броя карти и ширината.

Дискът в основата на картата е плътен кръг в цвета на фона — вижда се
само дъгата на бордъра отгоре, защото фонът, дискът и градиентът в
основата на картата са в един и същи цвят.
------------------------------------------------------------------*/

.ab-vd {
	position: relative;
	width: 100%;
	color: var(--ab-vd-text-color, #fff);
	--ab-vd-pv: var(--ab-vd-pv-d, 4);
}

.ab-vd .ab-vd__viewport {
	width: 100%;
	max-width: var(--ab-vd-container, 1400px);
	margin: 0 auto;
	padding-left: 15px;
	padding-right: 15px;
}

/* ── Grid режим: фиксирана ширина, центрирано ──────────────────── */

.ab-vd--grid .ab-vd__swiper {
	overflow: visible;
}
.ab-vd--grid .ab-vd__wrapper {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--ab-vd-gap, 28px);
	transform: none !important;
}
.ab-vd--grid .ab-vd__slide {
	width: min(
		var(--ab-vd-card-w, 340px),
		calc((100% - (var(--ab-vd-pv) - 1) * var(--ab-vd-gap, 28px)) / var(--ab-vd-pv))
	);
	max-width: 100%;
	flex: 0 0 auto;
}
.ab-vd--grid .ab-vd__arrow,
.ab-vd--grid .ab-vd__dots {
	display: none;
}

/* ── Слайдър режим ─────────────────────────────────────────────── */

.ab-vd--slider .ab-vd__swiper {
	overflow: hidden;
	padding: 8px 0;
	--swiper-wrapper-transition-timing-function: cubic-bezier(0.45, 0, 0.2, 1);
}
.ab-vd--slider .ab-vd__slide {
	width: calc((100% - (var(--ab-vd-pv) - 1) * var(--ab-vd-gap, 28px)) / var(--ab-vd-pv));
	max-width: var(--ab-vd-card-w, 340px);
	height: auto;
}

/* ── Карта ─────────────────────────────────────────────────────── */

.ab-vd__card {
	display: block;
	position: relative;
	text-decoration: none;
	color: inherit;
	-webkit-tap-highlight-color: transparent;
}
.ab-vd__card:hover,
.ab-vd__card:focus {
	text-decoration: none;
	color: inherit;
}
/* .ab-vd__card:focus-visible {
	outline: 2px solid var(--ab-vd-accent, #C39B63);
	outline-offset: 8px;
	border-radius: var(--ab-vd-radius, 20px);
} */

.ab-vd__frame {
	display: block;
	position: relative;
	aspect-ratio: var(--ab-vd-ratio, 340 / 560);
	border: 1px solid var(--ab-vd-frame, rgba(195, 155, 99, 0.35));
	border-radius: var(--ab-vd-radius, 20px);
	transition: border-color 0.5s ease;
}
.ab-vd--hover .ab-vd__card:hover .ab-vd__frame {
	border-color: var(--ab-vd-arc, #C39B63);
}

/* Постерът — заоблен, изрязан */
.ab-vd__media {
	display: block;
	position: absolute;
	inset: 0;
	border-radius: calc(var(--ab-vd-radius, 20px) - 1px);
	overflow: hidden;
	background: var(--ab-vd-bg, #241D1D);
	isolation: isolate;
	-webkit-mask-image: -webkit-radial-gradient(white, black);
	transform: translateZ(0);
}
.ab-vd__img {
	display: block;
	position: absolute;
	inset: 0;
}
/* Паралакс: постерът е по-висок от рамката, за да има накъде да се движи.
   Мястото се мери от самия път (--ab-vd-par), а не с фиксиран процент —
   иначе при по-голяма сила постерът излиза от рамката и се вижда фонът. */
.ab-vd--parallax .ab-vd__img {
	inset: calc(-1 * (var(--ab-vd-par, 40px) + 2px)) 0;
	will-change: transform;
}
.ab-vd__img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transform: scale(1);
	transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ab-vd--hover .ab-vd__card:hover .ab-vd__img img {
	transform: scale(1.05);
}

/* Градиент отдолу — минава върху постера И върху рамката (inset -1px) */
.ab-vd__gradient {
	display: block;
	position: absolute;
	left: -2px;
	right: -2px;
	bottom: -2px;
	height: var(--ab-vd-grad-h, 32%);
	z-index: 2;
	pointer-events: none;
	border-radius: 0 0 var(--ab-vd-radius, 20px) var(--ab-vd-radius, 20px);
	background: linear-gradient(to top, var(--ab-vd-bg, #241D1D) 0%, rgba(0, 0, 0, 0) 100%);
}
@supports (background: color-mix(in srgb, red 50%, transparent)) {
	.ab-vd__gradient {
		background: linear-gradient(
			to top,
			var(--ab-vd-bg, #241D1D) 0%,
			color-mix(in srgb, var(--ab-vd-bg, #241D1D) 85%, transparent) 40%,
			color-mix(in srgb, var(--ab-vd-bg, #241D1D) 0%, transparent) 100%
		);
	}
}

/* ── Диск с дъга и play ────────────────────────────────────────── */

.ab-vd__disc {
	display: block;
	position: absolute;
	left: 50%;
	bottom: calc(-0.5 * var(--ab-vd-disc, 110px));
	width: var(--ab-vd-disc, 110px);
	height: var(--ab-vd-disc, 110px);
	margin-left: calc(-0.5 * var(--ab-vd-disc, 110px));
	border-radius: 50%;
	background: var(--ab-vd-disc-color, #241D1D);
	z-index: 3;
	pointer-events: none;
}

/* Бордърът е цял кръг, но се вижда само горната част —
   маската го отрязва на --ab-vd-arc-cut с мек преход */
.ab-vd__disc::before {
	content: "";
	position: absolute;
	inset: 0;
	border: var(--ab-vd-arc-w, 1px) solid var(--ab-vd-arc, #C39B63);
	border-left: none;
    border-right: none;
	border-bottom: none;
	border-radius: 50%;
	-webkit-mask-image: linear-gradient(
		to bottom,
		#000 0%,
		#000 calc(var(--ab-vd-arc-cut, 78%) - 18%),
		transparent var(--ab-vd-arc-cut, 78%)
	);
	mask-image: linear-gradient(
		to bottom,
		#000 0%,
		#000 calc(var(--ab-vd-arc-cut, 78%) - 18%),
		transparent var(--ab-vd-arc-cut, 78%)
	);
	transition: opacity 0.5s ease, filter 0.5s ease;
}
.ab-vd--hover .ab-vd__card:hover .ab-vd__disc::before {
	filter: drop-shadow(0 0 10px var(--ab-vd-arc, #C39B63));
}

.ab-vd__play {
	position: absolute;
	left: 50%;
	top: var(--ab-vd-play-top, 34%);
	width: var(--ab-vd-play, 22px);
	height: var(--ab-vd-play, 22px);
	margin-left: calc(-0.5 * var(--ab-vd-play, 22px));
	color: var(--ab-vd-arc, #C39B63);
	transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.45s ease;
}
.ab-vd__play svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}
.ab-vd--hover .ab-vd__card:hover .ab-vd__play {
	transform: scale(1.18);
	filter: drop-shadow(0 0 8px var(--ab-vd-arc, #C39B63));
}

/* ── Номер и заглавие ──────────────────────────────────────────── */

.ab-vd__meta {
	display: block;
	margin-top: calc(0.5 * var(--ab-vd-disc, 110px) + 12px);
	text-align: center;
}

.ab-vd__num {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	font-family: "Bona Nova", Georgia, serif;
	font-family: 'CyrillicOld';
	font-size: var(--ab-vd-num-size, 16px);
	line-height: 1;
	letter-spacing: 0.08em;
	color: var(--ab-vd-accent, #C39B63);
}
.ab-vd__num::before,
.ab-vd__num::after {
	content: "";
	width: var(--ab-vd-dash, 18px);
	height: 1px;
	background: currentColor;
	opacity: 0.7;
}

.ab-vd__title {
	display: block;
	margin-top: 14px;
	font-family: "Bona Nova", Georgia, serif;
	font-weight: 700;
	font-size: var(--ab-vd-title-size, 20px);
	line-height: 1.3;
	color: var(--ab-vd-text-color, #fff);
	transition: color 0.4s ease;
}
.ab-vd--hover .ab-vd__card:hover .ab-vd__title {
	color: var(--ab-vd-accent, #C39B63);
}

/* ── Стрелки / точки ───────────────────────────────────────────── */

.ab-vd__arrow {
	position: absolute;
	top: 40%;
	z-index: 5;
	width: 56px;
	height: 56px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ab-vd-accent, #C39B63);
	cursor: pointer;
	transform: translateY(-50%);
	transition: transform 0.3s ease, opacity 0.3s ease;
	-webkit-tap-highlight-color: transparent;
	appearance: none;
	-webkit-appearance: none;
}
.ab-vd__arrow svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}
.ab-vd__arrow:hover {
	transform: translateY(-50%) scale(1.08);
}
.ab-vd__arrow:focus-visible {
	outline: 2px solid var(--ab-vd-accent, #C39B63);
	outline-offset: 6px;
	border-radius: 50%;
}
.ab-vd__arrow--prev {
	left: max(8px, calc(50% - var(--ab-vd-container, 1400px) / 2 - 80px));
}
.ab-vd__arrow--next {
	right: max(8px, calc(50% - var(--ab-vd-container, 1400px) / 2 - 80px));
}
.ab-vd__arrow.is-disabled {
	opacity: 0.3;
	pointer-events: none;
}

.ab-vd__dots {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 24px;
}
.ab-vd__dot {
	width: 8px;
	height: 8px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--ab-vd-accent, #C39B63);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background 0.3s ease, transform 0.3s ease;
	appearance: none;
	-webkit-appearance: none;
}
.ab-vd__dot.is-active {
	background: var(--ab-vd-accent, #C39B63);
	transform: scale(1.3);
}

/* ── Lightbox ──────────────────────────────────────────────────── */

.ab-vd-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px 72px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.ab-vd-modal.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.35s ease, visibility 0s;
}
.ab-vd-modal[hidden] {
	display: none;
}

.ab-vd-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(12, 9, 9, 0.9);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.ab-vd-modal__box {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: min(1100px, 100%);
	transform: translateY(16px) scale(0.98);
	transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ab-vd-modal.is-open .ab-vd-modal__box {
	transform: translateY(0) scale(1);
}

.ab-vd-modal__stage {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border: 1px solid var(--ab-vd-frame, rgba(195, 155, 99, 0.35));
	border-radius: calc(var(--ab-vd-radius, 20px) * 0.6);
	background: #000;
}
.ab-vd-modal__stage iframe,
.ab-vd-modal__stage video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	background: #000;
	object-fit: contain;
}

.ab-vd-modal__title {
	margin-top: 18px;
	text-align: center;
	font-family: "Bona Nova", Georgia, serif;
	font-weight: 700;
	font-size: var(--ab-vd-title-size, 20px);
	line-height: 1.3;
	color: var(--ab-vd-text-color, #fff);
}
.ab-vd-modal__title:empty {
	display: none;
}

.ab-vd-modal__close,
.ab-vd-modal__nav {
	position: absolute;
	z-index: 2;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ab-vd-accent, #C39B63);
	cursor: pointer;
	transition: transform 0.3s ease, opacity 0.3s ease;
	appearance: none;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
}
.ab-vd-modal__close:focus-visible,
.ab-vd-modal__nav:focus-visible {
	outline: 2px solid var(--ab-vd-accent, #C39B63);
	outline-offset: 6px;
	border-radius: 50%;
}

.ab-vd-modal__close {
	top: -46px;
	right: 0;
	width: 32px;
	height: 32px;
}
.ab-vd-modal__close::before,
.ab-vd-modal__close::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 24px;
	height: 1.5px;
	margin: -0.75px 0 0 -12px;
	background: currentColor;
}
.ab-vd-modal__close::before { transform: rotate(45deg); }
.ab-vd-modal__close::after  { transform: rotate(-45deg); }
.ab-vd-modal__close:hover {
	transform: rotate(90deg);
}

.ab-vd-modal__nav {
	top: 50%;
	width: 48px;
	height: 48px;
	transform: translateY(-50%);
}
.ab-vd-modal__nav svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}
.ab-vd-modal__nav:hover {
	transform: translateY(-50%) scale(1.1);
}
.ab-vd-modal__nav--prev { left: -64px; }
.ab-vd-modal__nav--next { right: -64px; }
.ab-vd-modal--single .ab-vd-modal__nav {
	display: none;
}

body.ab-vd-locked {
	overflow: hidden;
}

/* ── Таблет / мобилно ──────────────────────────────────────────── */

@media (max-width: 1199px) {
	.ab-vd__arrow--prev { left: 4px; }
	.ab-vd__arrow--next { right: 4px; }

	.ab-vd-modal {
		padding: 32px 56px;
	}
	.ab-vd-modal__nav--prev { left: -50px; }
	.ab-vd-modal__nav--next { right: -50px; }
}

@media (max-width: 991px) {
	.ab-vd {
		--ab-vd-pv: var(--ab-vd-pv-t, 3);
	}
	.ab-vd__arrow {
		width: 44px;
		height: 44px;
	}
	.ab-vd__arrow--next{
		right: 35px;
	}
	.ab-vd__arrow--prev {
        left: 35px;
    }
}

@media (max-width: 767px) {
	.ab-vd {
		--ab-vd-pv: var(--ab-vd-pv-m, 1);
	}
	.ab-vd--slider .ab-vd__slide {
		width: min(var(--ab-vd-card-w, 340px), 84%);
	}
	.ab-vd--grid .ab-vd__slide {
		width: min(var(--ab-vd-card-w, 340px), 100%);
	}
	.ab-vd__arrow {
		width: 36px;
		height: 36px;
		top: 42%;
	}
	.ab-vd__title {
		font-size: calc(var(--ab-vd-title-size, 20px) * 0.9);
	}

	.ab-vd-modal {
		padding: 16px;
	}
	.ab-vd-modal__close {
		top: -40px;
		right: 0;
	}
	.ab-vd-modal__nav {
		top: auto;
		bottom: -58px;
		width: 38px;
		height: 38px;
		transform: none;
	}
	.ab-vd-modal__nav:hover {
		transform: scale(1.1);
	}
	.ab-vd-modal__nav--prev { left: calc(50% - 60px); }
	.ab-vd-modal__nav--next { right: calc(50% - 60px); }
	.ab-vd-modal__title {
		margin-top: 14px;
		padding: 0 40px;
	}
}

/* ── Без анимации ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.ab-vd__img img,
	.ab-vd__play,
	.ab-vd__frame,
	.ab-vd__title,
	.ab-vd__arrow,
	.ab-vd__dot,
	.ab-vd-modal,
	.ab-vd-modal__box {
		transition: none;
	}
	.ab-vd--hover .ab-vd__card:hover .ab-vd__img img,
	.ab-vd--hover .ab-vd__card:hover .ab-vd__play {
		transform: none;
	}
}
