/* =================================================================
   SSP Video Showcase — Frontend
   ================================================================= */

:root {
	--ssp-vs-bg:           #061638;
	--ssp-vs-bg-2:         #0a1f4a;
	--ssp-vs-tab-bg:       #1a3a8a;
	--ssp-vs-tab-active:   #2563eb;
	--ssp-vs-accent:       #00d4ff;
	--ssp-vs-text:         #ffffff;
	--ssp-vs-text-muted:   #c9d2e1;
	--ssp-vs-check-bg:     #00d4ff;
	--ssp-vs-card-bg:      #3b6df0;
	--ssp-vs-radius:       16px;
	--ssp-vs-radius-sm:    10px;
	--ssp-vs-shadow:       0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ===== Showcase ===== */

.ssp-video-showcase {
	background: var(--ssp-vs-bg);
	color: var(--ssp-vs-text);
	padding: clamp(24px, 5vw, 64px) clamp(16px, 4vw, 40px);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ssp-vs-inner {
	max-width: 1200px;
	margin: 0 auto;
}

/* ----- Header / tabs ----- */

.ssp-vs-header {
	margin-bottom: clamp(24px, 4vw, 48px);
}

.ssp-vs-eyebrow {
	color: var(--ssp-vs-accent);
	font-size: clamp(18px, 1.6vw, 22px);
	font-weight: 500;
	margin: 0 0 16px;
}

/* =================================================================
   Tabs layout
   - Desktop: viewport with overflow:hidden + sliding track (transform)
     The track has ALL tabs; click "Show More" slides the track left by 1 tab.
   - Mobile/tablet: native overflow-x scrolling (touch-swipe)
   ================================================================= */

.ssp-vs-tabs {
	display: flex;
	align-items: stretch;
	gap: 12px;
}

.ssp-vs-tabs-viewport {
	/* JS sets the width to a precise pixel value = N tabs + (N-1) gaps.
	   This guarantees the right edge clips exactly between tab N and tab N+1. */
	flex: 0 0 auto;
	overflow: hidden;
	width: var(--ssp-vs-viewport-width, 100%);
}

.ssp-vs-tabs-track {
	display: flex;
	gap: 12px;
	transition: transform 350ms cubic-bezier(0.22, 0.61, 0.36, 1);
	will-change: transform;
	box-sizing: border-box;
}

/* No-transition class — applied temporarily for the instant DOM rotation. */
.ssp-vs-tabs-track.no-anim {
	transition: none;
}

.ssp-vs-tabs-track .ssp-vs-tab {
	flex: 0 0 auto;
	box-sizing: border-box;
	/* JS overrides this with a precise pixel value. */
	width: var(--ssp-vs-tab-width, 140px);
}

/* Tablet + mobile: revert to native scroll. The viewport stops being a clip, the track scrolls. */
@media (max-width: 1023px) {
	.ssp-vs-tabs {
		display: block;
	}
	.ssp-vs-tabs-viewport {
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding-bottom: 4px;
	}
	.ssp-vs-tabs-viewport::-webkit-scrollbar { display: none; }
	.ssp-vs-tabs-track {
		transform: none !important; /* disable JS slide on mobile */
		transition: none;
		scroll-snap-type: x mandatory;
	}
	.ssp-vs-tabs-track .ssp-vs-tab {
		width: calc((100% - 36px) / 3.3); /* 3.3 visible on tablet */
		scroll-snap-align: start;
	}
}

@media (max-width: 639px) {
	.ssp-vs-tabs-track .ssp-vs-tab {
		width: calc((100% - 24px) / 2.3); /* 2.3 visible on mobile */
	}
}

.ssp-vs-tab {
	background: var(--ssp-vs-tab-bg);
	color: var(--ssp-vs-text);
	border: 0;
	border-radius: var(--ssp-vs-radius);
	padding: 18px 12px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 110px;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
	font: inherit;
}

.ssp-vs-tab:hover {
	background: var(--ssp-vs-tab-active);
	transform: translateY(-2px);
}

.ssp-vs-tab:focus-visible {
	outline: 2px solid var(--ssp-vs-accent);
	outline-offset: 2px;
}

.ssp-vs-tab.is-active {
	background: var(--ssp-vs-tab-active);
	box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

/* "Show More" sits OUTSIDE the sliding track on desktop so it stays put. */
.ssp-vs-tab-more {
	flex: 0 0 auto;
	width: var(--ssp-vs-tab-width, calc((100% - 72px) / 7));
}

/* On tablet/mobile, the Show More button is hidden — native swipe handles overflow. */
@media (max-width: 1023px) {
	.ssp-vs-tab-more {
		display: none !important;
	}
}

.ssp-vs-tab-icon {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ssp-vs-text);
}

.ssp-vs-tab-icon svg {
	width: 100%;
	height: 100%;
}

/* The "Show More Categories" arrow is wider than other tab icons (1.3:1 vs 1:1),
   so constrain it to width-only and let height auto-scale to avoid squishing. */
.ssp-vs-tab-more .ssp-vs-tab-icon svg {
	width: 100%;
	height: auto;
	max-height: 100%;
}

.ssp-vs-tab-icon img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.ssp-vs-tab-label {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
}

/* ----- Hero (phone + copy) ----- */

.ssp-vs-hero {
	display: grid;
	grid-template-columns: 1fr 1.4fr;
	gap: clamp(24px, 4vw, 56px);
	margin-bottom: clamp(32px, 5vw, 64px);
	align-items: center;
}

@media (max-width: 768px) {
	.ssp-vs-hero {
		grid-template-columns: 1fr;
	}
}

/* Landscape video: stack the hero vertically and use the landscape iPhone bezel.
   Detailed screen positioning is handled by theme-level overrides. */
.ssp-vs-hero.is-landscape {
	grid-template-columns: 1fr;
	gap: clamp(20px, 3vw, 36px);
	align-items: start;
	text-align: left;
}

.ssp-vs-hero.is-landscape .ssp-vs-phone {
	justify-content: center;
}

.ssp-vs-hero.is-landscape .ssp-vs-phone-frame {
	max-width: 760px;
	aspect-ratio: 971.09 / 465; /* matches landscape SVG viewBox */
}

.ssp-vs-phone {
	display: flex;
	justify-content: center;
}

.ssp-vs-phone-frame {
	position: relative;
	width: 100%;
	max-width: 320px;
	aspect-ratio: 465 / 971.09; /* Matches iPhone SVG viewBox (portrait) */
	filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
	transition: max-width 0.25s ease;
}

.ssp-vs-phone-screen {
	position: absolute;
	top: 1.54%;
	left: 3.87%;
	width: 92.26%;
	height: 96.90%;
	border-radius: 14.5% / 6.9%; /* matches SVG inner screen rx=67.5 */
	overflow: hidden;
	background: #000;
	z-index: 1;
}

.ssp-vs-phone-bezel {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2;
	user-select: none;
	-webkit-user-drag: none;
}

.ssp-vs-phone-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ssp-vs-phone-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: var(--ssp-vs-text-muted);
	font-size: 14px;
	padding: 24px;
	text-align: center;
}

/* ----- Hero copy ----- */

.ssp-vs-copy-inner {
	max-width: 640px;
}

.ssp-vs-category-tag {
	color: var(--ssp-vs-accent);
	font-size: clamp(14px, 1.4vw, 18px);
	font-weight: 600;
	letter-spacing: 0.05em;
	margin: 0 0 12px;
}

.ssp-vs-heading {
	color: var(--ssp-vs-text);
	font-size: clamp(28px, 4vw, 48px);
	font-weight: 700;
	line-height: 1.1;
	margin: 0 0 24px;
}

.ssp-vs-body {
	color: var(--ssp-vs-text-muted);
	font-size: clamp(14px, 1.2vw, 16px);
	line-height: 1.6;
	margin-bottom: 28px;
}

.ssp-vs-body p {
	margin: 0 0 12px;
}

.ssp-vs-body p:last-child {
	margin-bottom: 0;
}

/* Rich-text styling for content from the WP editor */
.ssp-vs-body a {
	color: var(--ssp-vs-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: opacity 0.2s ease;
}
.ssp-vs-body a:hover {
	opacity: 0.8;
}
.ssp-vs-body strong,
.ssp-vs-body b {
	color: var(--ssp-vs-text);
	font-weight: 700;
}
.ssp-vs-body em,
.ssp-vs-body i {
	font-style: italic;
}
.ssp-vs-body ul,
.ssp-vs-body ol {
	margin: 0 0 12px;
	padding-left: 20px;
}
.ssp-vs-body li {
	margin-bottom: 4px;
}
.ssp-vs-body u {
	text-decoration: underline;
}
.ssp-vs-body s,
.ssp-vs-body del {
	text-decoration: line-through;
	opacity: 0.7;
}

.ssp-vs-includes-label {
	color: var(--ssp-vs-accent);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.05em;
	margin: 0 0 16px;
}

.ssp-vs-includes {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px 24px;
}

@media (max-width: 480px) {
	.ssp-vs-includes {
		grid-template-columns: 1fr;
	}
}

.ssp-vs-includes li {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--ssp-vs-text);
	font-size: 15px;
}

.ssp-vs-check {
	flex: 0 0 24px;
	width: 24px;
	height: 24px;
	background: var(--ssp-vs-check-bg);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ssp-vs-bg);
}

.ssp-vs-check svg {
	width: 13px;
	height: auto;
}

/* ----- Grid header ----- */

.ssp-vs-grid-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	gap: 16px;
	flex-wrap: wrap;
}

.ssp-vs-grid-title {
	color: var(--ssp-vs-text);
	font-size: clamp(20px, 2.4vw, 28px);
	font-weight: 600;
	margin: 0;
}

.ssp-vs-view-all {
	color: var(--ssp-vs-text);
	text-decoration: none;
	font-size: 16px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: color 0.2s ease;
}

.ssp-vs-view-all:hover {
	color: var(--ssp-vs-accent);
}

.ssp-vs-view-all svg {
	width: 26px;
	height: auto;
	color: var(--ssp-vs-accent);
}

/* ----- Cards ----- */

.ssp-vs-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 16px;
}

@media (max-width: 1023px) {
	.ssp-vs-grid {
		display: flex;
		grid-template-columns: none;
		gap: 16px;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding-bottom: 8px;
	}
	.ssp-vs-grid::-webkit-scrollbar { display: none; }

	.ssp-vs-grid .ssp-vs-card {
		flex: 0 0 auto;
		/* 3.3 visible on tablet — 3 full cards + a partial fourth peeking */
		width: calc((100% - 48px) / 3.3);
		scroll-snap-align: start;
	}
}

@media (max-width: 639px) {
	.ssp-vs-grid .ssp-vs-card {
		/* 2.3 visible on mobile — 2 full cards + a partial third peeking at the right */
		width: calc((100% - 32px) / 2.3);
	}
}

.ssp-vs-card {
	position: relative;
	background: var(--ssp-vs-card-bg);
	border-radius: var(--ssp-vs-radius-sm);
	overflow: hidden;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	display: flex;
	flex-direction: column;
}

.ssp-vs-card:hover,
.ssp-vs-card:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
	outline: none;
}

.ssp-vs-card.is-active {
	box-shadow: 0 0 0 3px var(--ssp-vs-accent), 0 12px 28px rgba(0, 212, 255, 0.3);
}

.ssp-vs-card-thumb {
	position: relative;
	aspect-ratio: 9 / 16;
	background: #000;
	overflow: hidden;
}

.ssp-vs-card-thumb img,
.ssp-vs-card-preview {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity 0.3s ease;
}

.ssp-vs-card-preview {
	opacity: 0;
	pointer-events: none;
}

.ssp-vs-card.is-previewing .ssp-vs-card-preview {
	opacity: 1;
}

.ssp-vs-card.is-previewing .ssp-vs-card-thumb img {
	opacity: 0;
}

.ssp-vs-card.is-previewing .ssp-vs-card-play {
	opacity: 0;
}

.ssp-vs-card-play {
	position: absolute;
	bottom: 12px;
	left: 12px;
	width: 36px;
	height: 36px;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	transition: opacity 0.2s ease;
}

.ssp-vs-card-play svg {
	width: 14px;
	height: auto;
	margin-left: 2px;
}

.ssp-vs-card-title {
	padding: 12px 14px;
	color: var(--ssp-vs-text);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	min-height: 60px;
}

.ssp-vs-empty,
.ssp-vs-empty-msg {
	color: var(--ssp-vs-text-muted);
	text-align: center;
	padding: 32px;
}

/* ----- Loading spinners ----- */

@keyframes ssp-vs-shimmer {
	0%   { background-position: -200% 0; }
	100% { background-position: 200% 0; }
}

@keyframes ssp-vs-spin {
	to { transform: rotate(360deg); }
}

/* Phone hero — spinner inside the phone screen until the poster image loads.
   Text content (heading/body/includes) is instant — only the heavy media gets a spinner. */
.ssp-vs-phone.is-loading .ssp-vs-phone-screen::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	margin: -18px 0 0 -18px;
	border: 3px solid rgba(255, 255, 255, 0.18);
	border-top-color: var(--ssp-vs-accent);
	border-radius: 50%;
	animation: ssp-vs-spin 0.8s linear infinite;
	z-index: 3;
}

/* Card thumbnail loading — small spinner over the thumb area until the image decodes. */
.ssp-vs-card.img-loading .ssp-vs-card-thumb::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	border: 2.5px solid rgba(255, 255, 255, 0.18);
	border-top-color: var(--ssp-vs-accent);
	border-radius: 50%;
	animation: ssp-vs-spin 0.8s linear infinite;
	z-index: 3;
}

.ssp-vs-card.img-loading .ssp-vs-card-thumb img {
	opacity: 0;
	transition: opacity 0.25s ease;
}
.ssp-vs-card:not(.img-loading) .ssp-vs-card-thumb img {
	opacity: 1;
	transition: opacity 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
	.ssp-vs-phone.is-loading .ssp-vs-phone-screen::after,
	.ssp-vs-card.img-loading .ssp-vs-card-thumb::after {
		animation: none;
	}
}

/* =================================================================
   Archive grid block
   ================================================================= */

.ssp-video-archive {
	background: var(--ssp-vs-bg);
	color: var(--ssp-vs-text);
	padding: clamp(24px, 5vw, 64px) clamp(16px, 4vw, 40px);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ssp-vag-inner {
	max-width: 1200px;
	margin: 0 auto;
}

.ssp-vag-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 32px;
}

.ssp-vag-filter-btn {
	background: var(--ssp-vs-tab-bg);
	color: var(--ssp-vs-text);
	border: 0;
	border-radius: 999px;
	padding: 8px 18px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.2s ease;
	font-family: inherit;
}

.ssp-vag-filter-btn:hover {
	background: var(--ssp-vs-tab-active);
}

.ssp-vag-filter-btn.is-active {
	background: var(--ssp-vs-accent);
	color: var(--ssp-vs-bg);
}

.ssp-vag-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 16px;
	margin-bottom: 40px;
}

@media (max-width: 1024px) {
	.ssp-vag-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
	.ssp-vag-grid { grid-template-columns: repeat(2, 1fr); }
}

.ssp-vag-grid .ssp-vs-card {
	/* Inherit card styles from the showcase. */
}

.ssp-vag-load-wrap,
.ssp-vs-load-wrap {
	display: flex;
	justify-content: center;
	margin-top: 16px;
}

.ssp-vag-load-more,
.ssp-vs-load-more {
	background: transparent;
	border: 0;
	color: var(--ssp-vs-text);
	font-size: 18px;
	font-weight: 500;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 12px 24px;
	cursor: pointer;
	transition: color 0.2s ease;
	font-family: inherit;
}

.ssp-vag-load-more:hover,
.ssp-vs-load-more:hover {
	color: var(--ssp-vs-accent);
}

.ssp-vag-load-more svg,
.ssp-vs-load-more svg {
	width: 24px;
	height: 24px;
	color: var(--ssp-vs-accent);
	animation: ssp-vag-bounce 1.6s infinite ease-in-out;
}

@keyframes ssp-vag-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(4px); }
}

.ssp-vag-load-more.is-loading,
.ssp-vs-load-more.is-loading {
	pointer-events: none;
	opacity: 0.6;
}

.ssp-vag-load-more.is-loading svg,
.ssp-vs-load-more.is-loading svg {
	animation: ssp-vag-spin 0.8s linear infinite;
}

@keyframes ssp-vag-spin {
	to { transform: rotate(360deg); }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.ssp-vs-tab,
	.ssp-vs-card,
	.ssp-vs-card-thumb img,
	.ssp-vs-card-preview,
	.ssp-vag-load-more,
	.ssp-vag-load-more svg,
	.ssp-vs-load-more,
	.ssp-vs-load-more svg {
		transition: none;
		animation: none;
	}
}
