/* Video Gallery Pro — frontend
   Every structural rule is !important on purpose: themes style generic
   elements (button, a, img, figure) and were repainting the cards. */

.vgp-gallery {
	--vgp-cols: 3;
	--vgp-cols-tab: 2;
	--vgp-cols-mob: 1;
	--vgp-per: var(--vgp-cols);
	--vgp-gap: 28px;
	--vgp-radius: 16px;
	--vgp-accent: #2563eb;
	--vgp-card-bg: #ffffff;
	--vgp-title: #0f172a;
	--vgp-text: #4b5563;
	--vgp-muted: #6b7280;
	--vgp-ratio: 16 / 9;

	position: relative;
	margin: 0 0 1.5em;
	padding: 0;
	list-style: none;
	max-width: 100%;
}

.vgp-gallery *,
.vgp-gallery *::before,
.vgp-gallery *::after { box-sizing: border-box; }

/* ---------- layouts ---------- */
.vgp-grid {
	display: grid;
	grid-template-columns: repeat(var(--vgp-cols), minmax(0, 1fr));
	gap: var(--vgp-gap);
}

.vgp-slider .vgp-viewport {
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding: 6px 4px 14px;
	margin: -6px -4px -14px;
}

.vgp-slider .vgp-viewport::-webkit-scrollbar { display: none; }

.vgp-slider .vgp-track {
	display: flex;
	gap: var(--vgp-gap);
	align-items: stretch;
}

.vgp-slider .vgp-card {
	flex: 0 0 calc( ( 100% - ( var(--vgp-per) - 1 ) * var(--vgp-gap) ) / var(--vgp-per) );
	scroll-snap-align: start;
	min-width: 0;
}

/* ---------- card ---------- */
.vgp-gallery .vgp-card {
	background: var(--vgp-card-bg) !important;
	border: 0 !important;
	border-radius: var(--vgp-radius) !important;
	overflow: hidden !important;
	box-shadow: 0 4px 18px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
	display: flex !important;
	flex-direction: column !important;
	margin: 0 !important;
	padding: 0 !important;
	transition: transform .28s cubic-bezier(.2, .7, .3, 1), box-shadow .28s ease;
}

.vgp-gallery .vgp-card:hover,
.vgp-gallery .vgp-card:focus-within {
	transform: translateY(-4px);
	box-shadow: 0 14px 34px rgba(15, 23, 42, .14);
}

/* ---------- thumbnail (theme-proof) ---------- */
.vgp-gallery .vgp-thumb {
	position: relative !important;
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: #0b1220 !important;
	box-shadow: none !important;
	outline: none;
	aspect-ratio: var(--vgp-ratio);
	overflow: hidden !important;
	line-height: 0 !important;
	font-size: 0 !important;
	text-align: left !important;
	text-transform: none !important;
	text-decoration: none !important;
	letter-spacing: normal !important;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
}

/* aspect-ratio fallback */
@supports not (aspect-ratio: 16 / 9) {
	.vgp-gallery .vgp-thumb { padding-top: 56.25% !important; height: 0 !important; }
	.vgp-gallery .vgp-thumb .vgp-thumb-img,
	.vgp-gallery .vgp-thumb .vgp-thumb-placeholder { position: absolute !important; inset: 0 !important; }
}

.vgp-gallery .vgp-thumb:focus-visible {
	outline: 3px solid var(--vgp-accent) !important;
	outline-offset: -3px;
}

.vgp-gallery .vgp-thumb-img {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}

.vgp-gallery .vgp-card:hover .vgp-thumb-img { transform: scale(1.045); }

/* portrait / shorts thumbnails: blurred fill behind, contained image on top */
.vgp-gallery .vgp-thumb.is-portrait .vgp-thumb-img { object-fit: contain !important; }

.vgp-gallery .vgp-thumb.is-portrait .vgp-thumb-blur {
	position: absolute !important;
	inset: -8% !important;
	width: 116% !important;
	height: 116% !important;
	object-fit: cover !important;
	filter: blur(22px) saturate(1.15) brightness(.65);
	transform: none !important;
	z-index: 0;
}

.vgp-gallery .vgp-thumb.is-portrait .vgp-thumb-img { position: relative; z-index: 1; }

.vgp-gallery .vgp-thumb-placeholder {
	position: absolute !important;
	inset: 0 !important;
	display: block !important;
	background:
		radial-gradient(120% 90% at 20% 10%, #1e293b 0%, #0b1220 60%),
		linear-gradient(135deg, rgba(37, 99, 235, .35), transparent 60%);
}

/* play button
 *
 * Centred with negative margins rather than transform: translate(-50%, -50%).
 * A single theme rule such as `a:hover svg { transform: translateY(-2px) }`
 * replaces the whole transform and throws the icon out of the middle, which
 * looks like the icon jumping on hover. The zoom uses the standalone `scale`
 * property so it can never clobber positioning.
 */
.vgp-gallery .vgp-play {
	position: absolute !important;
	top: 50% !important;
	left: 50% !important;
	z-index: 2;
	width: 66px !important;
	height: 66px !important;
	margin: -33px 0 0 -33px !important;
	transform: none !important;
	translate: none !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, .95) !important;
	color: var(--vgp-accent) !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 0 0 0 3px !important;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
	transition: scale .25s cubic-bezier(.2, .7, .3, 1), background .25s ease, box-shadow .25s ease;
}

.vgp-gallery .vgp-card:hover .vgp-play,
.vgp-gallery .vgp-thumb:focus-visible .vgp-play {
	scale: 1.1;
	background: #fff !important;
	box-shadow: 0 10px 26px rgba(0, 0, 0, .34);
}

/* Pin the icon through every state, whatever the theme declares. */
.vgp-gallery .vgp-play,
.vgp-gallery .vgp-play:hover,
.vgp-gallery .vgp-play:focus,
.vgp-gallery .vgp-play:focus-visible,
.vgp-gallery .vgp-play:active,
.vgp-gallery .vgp-card:hover .vgp-play,
.vgp-gallery .vgp-thumb:hover .vgp-play {
	top: 50% !important;
	left: 50% !important;
	right: auto !important;
	bottom: auto !important;
	margin: -33px 0 0 -33px !important;
	transform: none !important;
	translate: none !important;
}

/* The inner glyph is a common target for theme icon animations too. */
.vgp-gallery .vgp-play svg,
.vgp-gallery .vgp-play:hover svg,
.vgp-gallery .vgp-card:hover .vgp-play svg {
	transform: none !important;
	translate: none !important;
	margin: 0 !important;
	position: static !important;
}

.vgp-gallery .vgp-play svg { display: block !important; width: 26px !important; height: 26px !important; }

/* duration */
.vgp-gallery .vgp-duration {
	position: absolute !important;
	right: 10px !important;
	bottom: 10px !important;
	z-index: 2;
	background: rgba(0, 0, 0, .82) !important;
	color: #fff !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	padding: 5px 8px !important;
	border-radius: 5px !important;
	font-variant-numeric: tabular-nums;
}

/* ---------- body ---------- */
.vgp-gallery .vgp-body {
	padding: 20px 22px 22px !important;
	display: flex !important;
	flex-direction: column;
	gap: 10px;
	flex: 1 1 auto;
	background: transparent !important;
}

.vgp-gallery .vgp-title {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 19px;
	line-height: 1.35;
	font-weight: 700;
	color: var(--vgp-title);
	overflow-wrap: break-word;
	text-transform: none !important;
}

.vgp-gallery .vgp-desc {
	margin: 0 !important;
	font-size: 15px;
	line-height: 1.55;
	color: var(--vgp-text);
}

.vgp-gallery .vgp-meta {
	margin-top: auto;
	padding-top: 8px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	font-size: 14.5px;
	color: var(--vgp-muted);
}

.vgp-gallery .vgp-sub {
	display: inline-flex !important;
	align-items: center;
	gap: 7px;
	color: var(--vgp-muted) !important;
	text-decoration: none !important;
	background: none !important;
	padding: 0 !important;
	border: 0 !important;
	transition: color .2s ease;
}

.vgp-gallery a.vgp-sub:hover,
.vgp-gallery a.vgp-sub:focus { color: var(--vgp-accent) !important; }

.vgp-gallery .vgp-sub-icon { flex: 0 0 auto; }

/* ---------- inline play ---------- */
.vgp-gallery .vgp-thumb.is-playing .vgp-play,
.vgp-gallery .vgp-thumb.is-playing .vgp-duration,
.vgp-gallery .vgp-thumb.is-playing .vgp-thumb-img,
.vgp-gallery .vgp-thumb.is-playing .vgp-thumb-blur { display: none !important; }

.vgp-gallery .vgp-inline-frame {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	border: 0 !important;
	background: #000 !important;
	z-index: 3;
}

/* ---------- slider controls ---------- */
.vgp-arrow {
	position: absolute !important;
	top: 50% !important;
	z-index: 5;
	/*
	 * Centred with a negative margin, NOT transform: translateY(-50%).
	 * Themes love to add `button:hover { transform: translateY(-2px) }`,
	 * which replaces the centering transform and makes the arrow jump
	 * down by half its height on hover/click.
	 */
	margin-top: -22px !important;
	transform: none !important;
	width: 44px !important;
	height: 44px !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: #fff !important;
	color: var(--vgp-title) !important;
	box-shadow: 0 6px 18px rgba(15, 23, 42, .18) !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .2s ease, color .2s ease, opacity .2s ease, box-shadow .2s ease;
	font-size: 0 !important;
	line-height: 0 !important;
	flex: 0 0 auto;
	appearance: none;
	-webkit-appearance: none;
}

.vgp-arrow:hover {
	background: var(--vgp-accent) !important;
	color: #fff !important;
	box-shadow: 0 10px 26px rgba(15, 23, 42, .28) !important;
}

/* Hold position through every interactive state, whatever the theme says. */
.vgp-arrow:hover,
.vgp-arrow:focus,
.vgp-arrow:focus-visible,
.vgp-arrow:active,
.vgp-arrow[disabled] {
	top: 50% !important;
	bottom: auto !important;
	transform: none !important;
	translate: none !important;
	scale: none !important;
}

/* Themes also like nudging buttons with position offsets on :active. */
.vgp-gallery .vgp-arrow:active {
	inset-block-start: 50% !important;
	padding: 0 !important;
	border: 0 !important;
	outline-offset: 2px;
}
.vgp-arrow svg { width: 20px; height: 20px; display: block; }
.vgp-arrow-prev { left: -18px !important; }
.vgp-arrow-next { right: -18px !important; }
.vgp-arrow[disabled] { opacity: .32; pointer-events: none; }

.vgp-dots {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 18px;
}

.vgp-dot {
	width: 9px !important;
	height: 9px !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: rgba(15, 23, 42, .22) !important;
	cursor: pointer;
	transition: all .25s ease;
	font-size: 0 !important;
	box-shadow: none !important;
}

.vgp-dot.is-active {
	background: var(--vgp-accent) !important;
	width: 26px !important;
	border-radius: 6px !important;
}

/* ---------- lightbox ---------- */
.vgp-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.vgp-lightbox[hidden] { display: none; }

.vgp-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(6, 10, 20, .88);
	backdrop-filter: blur(3px);
	animation: vgp-fade .22s ease both;
}

@keyframes vgp-fade { from { opacity: 0; } to { opacity: 1; } }

.vgp-lightbox-inner {
	position: relative;
	width: min(1100px, 100%);
	animation: vgp-zoom .26s cubic-bezier(.2, .8, .25, 1) both;
}

@keyframes vgp-zoom {
	from { opacity: 0; transform: scale(.95) translateY(10px); }
	to   { opacity: 1; transform: none; }
}

.vgp-lightbox-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

.vgp-lightbox-frame.is-portrait {
	aspect-ratio: 9 / 16;
	height: 86vh;
	width: auto;
	margin: 0 auto;
}

.vgp-lightbox-frame iframe,
.vgp-lightbox-frame video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	background: #000;
}

.vgp-lightbox-close {
	position: absolute;
	top: -46px;
	right: 0;
	width: 40px !important;
	height: 40px !important;
	min-height: 0 !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: 0 !important;
	background: rgba(255, 255, 255, .16) !important;
	color: #fff !important;
	font-size: 26px !important;
	line-height: 1;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}

.vgp-lightbox-close:hover { background: rgba(255, 255, 255, .3) !important; transform: rotate(90deg); }

body.vgp-locked { overflow: hidden; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
	.vgp-gallery { --vgp-per: var(--vgp-cols-tab); }
	.vgp-grid { grid-template-columns: repeat(var(--vgp-cols-tab), minmax(0, 1fr)); }
	.vgp-arrow-prev { left: 4px !important; }
	.vgp-arrow-next { right: 4px !important; }
}

@media (max-width: 680px) {
	.vgp-gallery { --vgp-per: var(--vgp-cols-mob); --vgp-gap: 18px; }
	.vgp-grid { grid-template-columns: repeat(var(--vgp-cols-mob), minmax(0, 1fr)); }
	.vgp-gallery .vgp-body { padding: 16px 18px 18px !important; }
	.vgp-gallery .vgp-title { font-size: 17.5px; }
	.vgp-gallery .vgp-play,
	.vgp-gallery .vgp-card:hover .vgp-play,
	.vgp-gallery .vgp-play:hover {
		width: 56px !important;
		height: 56px !important;
		margin: -28px 0 0 -28px !important;
	}
	.vgp-arrow,
	.vgp-arrow:hover,
	.vgp-arrow:focus,
	.vgp-arrow:active {
		width: 38px !important;
		height: 38px !important;
		margin-top: -19px !important;
	}
	.vgp-lightbox { padding: 14px; }
	.vgp-lightbox-close { top: auto !important; bottom: -50px !important; right: 50% !important; transform: translateX(50%) !important; }
	.vgp-lightbox-close:hover { transform: translateX(50%) rotate(90deg) !important; }
	.vgp-lightbox-frame.is-portrait { height: auto; width: 100%; max-width: 420px; }
}

@media (prefers-reduced-motion: reduce) {
	.vgp-gallery .vgp-card,
	.vgp-gallery .vgp-thumb-img { transition: none !important; }
	.vgp-slider .vgp-viewport { scroll-behavior: auto; }
}

/* editor-only notice */
.vgp-error {
	padding: 12px 16px;
	border-left: 4px solid #dc2626;
	background: #fef2f2;
	color: #991b1b;
	font-size: 14px;
}

/* =============================================================
 * Hover autoplay preview
 * ========================================================== */

.vgp-gallery .vgp-preview {
	position: absolute !important;
	inset: 0 !important;
	/* Must beat .vgp-thumb.is-portrait .vgp-thumb-img (z-index: 1). */
	z-index: 3 !important;
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: #0b1220 !important;
	object-fit: cover;
	/* The card itself owns the click, so the player must not swallow it. */
	pointer-events: none !important;
	opacity: 0;
	/* Hides the 1px provider chrome that can peek at the frame edges. */
	transform: scale(1.012);
	transition: opacity .4s ease;
}

.vgp-gallery .vgp-thumb.is-previewing .vgp-preview {
	opacity: 1;
}

/* Cross-fade the still thumbnail out from under the video. */
.vgp-gallery .vgp-thumb .vgp-thumb-img,
.vgp-gallery .vgp-thumb .vgp-thumb-blur {
	transition: opacity .4s ease;
}

.vgp-gallery .vgp-thumb.is-previewing .vgp-thumb-img,
.vgp-gallery .vgp-thumb.is-previewing .vgp-thumb-blur {
	opacity: 0 !important;
}

/* The card hover zoom would otherwise fight the preview. */
.vgp-gallery .vgp-card:hover .vgp-thumb.is-previewing .vgp-thumb-img {
	transform: none !important;
}

/* Get the badges out of the way while the preview runs. */
.vgp-gallery .vgp-thumb.is-previewing .vgp-play,
.vgp-gallery .vgp-thumb.is-previewing .vgp-duration {
	opacity: 0 !important;
	transition: opacity .25s ease;
}

/* Real playback always outranks the preview. */
.vgp-gallery .vgp-thumb.is-playing .vgp-preview {
	display: none !important;
}

/* A muted preview deserves a hint that sound exists on click. */
.vgp-gallery .vgp-thumb.is-previewing::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 4;
	pointer-events: none;
	box-shadow: inset 0 0 0 2px var(--vgp-accent);
	opacity: .55;
}

@media (prefers-reduced-motion: reduce) {
	.vgp-gallery .vgp-preview {
		transition: none;
	}
}

/* Instagram clip being resolved over AJAX */
.vgp-gallery .vgp-thumb.is-preview-loading .vgp-play {
	animation: vgp-pulse 1s ease-in-out infinite;
	transform: none !important;
}

@keyframes vgp-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: .45; }
}

/* =============================================================
 * Theme-conflict guard
 *
 * Many themes animate every button/link/icon with transform on
 * hover. Anything the plugin positions absolutely must ignore
 * that, or it drifts out of place mid-hover.
 * ========================================================== */

.vgp-gallery .vgp-duration,
.vgp-gallery .vgp-badge,
.vgp-gallery .vgp-dot,
.vgp-gallery .vgp-dot:hover,
.vgp-gallery .vgp-dot:active,
.vgp-gallery .vgp-thumb .vgp-overlay {
	transform: none !important;
	translate: none !important;
}

.vgp-gallery .vgp-card:hover .vgp-duration,
.vgp-gallery .vgp-card:hover .vgp-badge {
	top: auto !important;
	margin: 0 !important;
}
