/* =========================================================================
   WP Vertical Stories – front-end
   The row blends into any theme; the fullscreen viewer is the signature moment.
   ========================================================================= */

.wpvs-container,
.wpvs-container * { box-sizing: border-box; }

.wpvs-container {
	--wps-radius: 14px;
	--wps-ring: linear-gradient(45deg, #f9ce34 0%, #ee2a7b 45%, #6228d7 100%);
	margin: 0 0 1em;
}

/* ---- Row ---------------------------------------------------------------- */
.wpvs-row {
	display: flex;
	gap: var(--wps-gap, 14px);
	overflow-x: auto;
	overflow-y: hidden;
	padding: 4px 2px 10px;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.wpvs-row::-webkit-scrollbar { display: none; }

/* Desktop drag-to-scroll (mouse): grab affordance + snap off while dragging */
.wpvs-row.wpvs-draggable { cursor: grab; }
.wpvs-row.wpvs-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	scroll-behavior: auto;
	user-select: none;
	-webkit-user-select: none;
}
.wpvs-row.wpvs-dragging * { cursor: grabbing !important; }

.wpvs-item {
	flex: 0 0 auto;
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: transform 0.18s ease;
}
.wpvs-item:hover { transform: translateY(-2px); }
.wpvs-item:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 4px;
	border-radius: 6px;
}

.wpvs-thumb {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #e9ecef;
	display: block;
}
.wpvs-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.wpvs-thumb-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	background: #000;
	pointer-events: none;
}
/* Small play badge shown on auto-generated video previews (no cover set). */
.wpvs-thumb-play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32%;
	max-width: 34px;
	aspect-ratio: 1 / 1;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.42);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}
.wpvs-thumb-play::before {
	content: "";
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 0 6px 10px;
	border-color: transparent transparent transparent #fff;
	margin-left: 2px;
}
.wpvs-thumb-fallback {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #cfd4dc, #eef0f3);
}
.wpvs-thumb-fallback::before {
	content: "";
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 11px 0 11px 18px;
	border-color: transparent transparent transparent #fff;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
	margin-left: 4px;
}

/* Shapes */
.wpvs-shape-circle .wpvs-thumb { aspect-ratio: 1 / 1; border-radius: 50%; }
.wpvs-shape-square .wpvs-thumb { aspect-ratio: 1 / 1; border-radius: var(--wps-radius); }
.wpvs-shape-rounded .wpvs-thumb { aspect-ratio: 9 / 16; border-radius: var(--wps-radius); }

/* Gradient ring */
.wpvs-has-ring .wpvs-thumb {
	padding: 3px;
	background: var(--wps-ring);
}
.wpvs-has-ring .wpvs-thumb img,
.wpvs-has-ring .wpvs-thumb-video,
.wpvs-has-ring .wpvs-thumb-fallback {
	border: 2px solid #fff;
	border-radius: inherit;
}
.wpvs-has-ring.wpvs-shape-circle .wpvs-thumb img,
.wpvs-has-ring.wpvs-shape-circle .wpvs-thumb-video { border-radius: 50%; }

/* Label */
.wpvs-label {
	max-width: 100%;
	font-size: 12px;
	line-height: 1.3;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	opacity: 0.88;
}
.wpvs-no-titles .wpvs-label { display: none; }

/* ---- Body lock while viewer open --------------------------------------- */
body.wpvs-lock { overflow: hidden; }

/* ---- Fullscreen viewer -------------------------------------------------- */
.wpvs-viewer {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(10, 10, 12, 0.94);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.22s ease;
}
.wpvs-viewer.is-open { display: flex; opacity: 1; }

.wpvs-stage {
	position: relative;
	width: 100vw;
	height: 100vh;
	height: 100svh;
	max-height: 100svh;
	background: #000;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: none;
	animation: wpvs-pop 0.24s ease;
}
@keyframes wpvs-pop {
	from { transform: scale(0.96); opacity: 0.4; }
	to   { transform: scale(1); opacity: 1; }
}
@media (min-width: 600px) {
	.wpvs-stage {
		width: min(430px, calc(92svh * 9 / 16));
		height: min(92svh, 880px);
		border-radius: 18px;
		box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
	}
}

.wpvs-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
	display: block;
}

/* Top gradient scrim for legibility */
.wpvs-stage::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 120px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
	pointer-events: none;
	z-index: 2;
}

/* Progress bars */
.wpvs-progress {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	gap: 4px;
	padding: 10px 10px 0;
	z-index: 5;
}
.wpvs-progress span {
	flex: 1 1 0;
	height: 3px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.32);
	overflow: hidden;
}
.wpvs-progress span i {
	display: block;
	height: 100%;
	width: 0;
	background: #fff;
	border-radius: 3px;
}
.wpvs-progress span.is-done i { width: 100%; }

/* Header */
.wpvs-head {
	position: absolute;
	top: 18px;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 10px;
	z-index: 6;
	color: #fff;
}
.wpvs-title {
	flex: 1;
	min-width: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.wpvs-btn {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.3);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}
.wpvs-btn:hover { background: rgba(0, 0, 0, 0.5); }
.wpvs-btn svg { width: 20px; height: 20px; display: block; }

/* Nav arrows (desktop) */
.wpvs-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	cursor: pointer;
	z-index: 6;
	transition: background 0.15s ease;
}
.wpvs-nav:hover { background: rgba(255, 255, 255, 0.28); }
.wpvs-nav svg { width: 22px; height: 22px; }
.wpvs-prev { left: 10px; }
.wpvs-next { right: 10px; }
@media (max-width: 599px) { .wpvs-nav { display: none; } }

/* CTA button */
.wpvs-cta {
	position: absolute;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	z-index: 6;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: 80%;
	padding: 11px 22px;
	border-radius: 999px;
	background: #fff;
	color: #111;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease;
}
.wpvs-cta:hover { transform: translateX(-50%) translateY(-2px); color: #111; }
.wpvs-cta::after {
	content: "";
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 5px 0 5px 7px;
	border-color: transparent transparent transparent currentColor;
}

/* Loading spinner */
.wpvs-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	z-index: 4;
	animation: wpvs-spin 0.8s linear infinite;
}
@keyframes wpvs-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.wpvs-viewer,
	.wpvs-stage,
	.wpvs-item,
	.wpvs-cta,
	.wpvs-btn,
	.wpvs-nav { transition: none; animation: none; }
}
