/* Case Video — front end. Variables: --cvd-accent, --cvd-radius (settings, Pro); themes may override. */
.cvd {
	--cvd-accent: #e62117;
	--cvd-radius: 16px;
	--cvd-text: #1c2833;
	--cvd-muted: #5d6b78;
	--cvd-border: #e4e9ee;
	--cvd-bg: #ffffff;
	color: var(--cvd-text);
	font-family: inherit;
	line-height: 1.5;
}

.cvd *,
.cvd *::before,
.cvd *::after {
	box-sizing: border-box;
}

.cvd [hidden],
.cvd[hidden] {
	display: none !important;
}

.cvd:not(.cvd-lightbox) + .cvd:not(.cvd-lightbox) {
	margin-top: 48px;
}

/* ---------- Cover (lightweight player) ---------- */
.cvd-cover {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	margin: 0;
	padding: 0;
	overflow: hidden;
	background: #0f0f0f;
	border: 0;
	border-radius: var(--cvd-radius);
	cursor: pointer;
}

.cvd-cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s cubic-bezier(.2, .7, .2, 1), opacity .3s;
}

.cvd-cover::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .35));
	pointer-events: none;
}

.cvd-play {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 1;
	width: 64px;
	height: 45px;
	transform: translate(-50%, -50%);
	transition: transform .2s;
}

.cvd-play svg {
	display: block;
	width: 100%;
	height: 100%;
}

.cvd-play__bg {
	fill: #212121;
	fill-opacity: .8;
	transition: fill .2s, fill-opacity .2s;
}

.cvd-cover:hover img {
	transform: scale(1.04);
}

.cvd-cover:hover .cvd-play__bg,
.cvd-cover:focus-visible .cvd-play__bg {
	fill: var(--cvd-accent);
	fill-opacity: 1;
}

.cvd-cover:hover .cvd-play {
	transform: translate(-50%, -50%) scale(1.08);
}

.cvd-cover:focus-visible {
	outline: 3px solid var(--cvd-accent);
	outline-offset: 3px;
}

.cvd-dur {
	position: absolute;
	right: 8px;
	bottom: 8px;
	z-index: 1;
	padding: 2px 6px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	color: #ffffff;
	background: rgba(0, 0, 0, .78);
	border-radius: 4px;
}

/* Inline player */
.cvd-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #000;
	border-radius: var(--cvd-radius);
}

.cvd-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ---------- Card ---------- */
.cvd-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
}

.cvd .cvd-card__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cvd .cvd-card__title a {
	color: inherit;
	text-decoration: none;
}

.cvd .cvd-card__title a:hover {
	color: var(--cvd-accent);
}

.cvd-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0 8px;
	margin: 4px 0 0;
	font-size: 13px;
	color: var(--cvd-muted);
}

.cvd-meta i {
	font-style: normal;
}

/* Shorts: vertical cards */
.cvd-card--short .cvd-cover,
.cvd-single--short .cvd-cover,
.cvd-single--short .cvd-frame {
	aspect-ratio: 9 / 16;
}

/* ---------- Layouts ---------- */
.cvd-list--grid {
	display: grid;
	grid-template-columns: repeat(var(--cvd-cols, 3), minmax(0, 1fr));
	gap: 28px 22px;
}

.cvd-list--grid .cvd-card--short .cvd-cover {
	aspect-ratio: 16 / 9;
}

.cvd-list--slider,
.cvd-list--shorts {
	display: grid;
	grid-auto-flow: column;
	gap: 20px;
	overflow-x: auto;
	padding: 4px 2px 10px;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
}

.cvd-list--slider {
	grid-auto-columns: calc((100% - (var(--cvd-cols, 3) - 1) * 20px) / var(--cvd-cols, 3));
}

.cvd-list--shorts {
	grid-auto-columns: 220px;
}

.cvd-list--slider::-webkit-scrollbar,
.cvd-list--shorts::-webkit-scrollbar {
	display: none;
}

.cvd-list--slider .cvd-card,
.cvd-list--shorts .cvd-card {
	scroll-snap-align: start;
}

.cvd-list--shorts .cvd-cover {
	aspect-ratio: 9 / 16;
}

.cvd .cvd-list--shorts .cvd-card__title {
	font-size: 14px;
}

.cvd-nav {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 12px;
}

.cvd-nav__btn {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	padding: 0;
	color: var(--cvd-text);
	background: var(--cvd-bg);
	border: 1px solid var(--cvd-border);
	border-radius: 50%;
	cursor: pointer;
	transition: background-color .2s, color .2s, border-color .2s;
}

.cvd-nav__btn svg,
.cvd-lightbox__nav svg,
.cvd-lightbox__close svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cvd-nav__btn:hover:not(:disabled) {
	color: #ffffff;
	background: var(--cvd-text);
	border-color: var(--cvd-text);
}

.cvd-nav__btn:disabled {
	opacity: .35;
	cursor: default;
}

/* Featured: main video + list */
.cvd-featured {
	display: grid;
	grid-template-columns: minmax(0, 1.75fr) minmax(260px, 1fr);
	gap: 24px;
	align-items: start;
}

.cvd-featured__info {
	padding-top: 14px;
}

.cvd .cvd-featured__title {
	margin: 0;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.25;
}

.cvd-featured__text {
	margin: 10px 0 0;
	color: var(--cvd-muted);
}

.cvd-featured__list {
	display: grid;
	gap: 4px;
	max-height: 520px;
	margin: 0;
	padding: 6px;
	overflow-y: auto;
	list-style: none;
	background: #f6f7f9;
	border-radius: var(--cvd-radius);
}

.cvd-featured__list li {
	margin: 0;
}

.cvd-item {
	display: grid;
	grid-template-columns: 132px minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	width: 100%;
	padding: 6px;
	font: inherit;
	color: var(--cvd-text);
	text-align: left;
	background: none;
	border: 0;
	border-radius: 12px;
	cursor: pointer;
	transition: background-color .2s;
}

.cvd-item:hover {
	background: #ffffff;
}

.cvd-item.is-active {
	background: #ffffff;
	box-shadow: inset 3px 0 0 var(--cvd-accent);
}

.cvd-item__thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 8px;
}

.cvd-item__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cvd-item__thumb .cvd-dur {
	right: 4px;
	bottom: 4px;
	font-size: 11px;
}

.cvd-item__title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Filter, more, empty */
.cvd-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 22px;
}

.cvd-filter button {
	padding: 8px 16px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--cvd-text);
	background: #f1f3f5;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color .2s, color .2s;
}

.cvd-filter button:hover {
	background: #e4e7eb;
}

.cvd-filter button.is-active {
	color: #ffffff;
	background: var(--cvd-text);
}

.cvd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 11px 24px;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
	text-decoration: none;
	background: var(--cvd-text);
	border: 2px solid var(--cvd-text);
	border-radius: 999px;
	cursor: pointer;
	transition: filter .2s, background-color .2s, color .2s;
}

.cvd-btn:hover {
	color: #ffffff;
	filter: brightness(1.15);
}

.cvd-btn--ghost {
	color: var(--cvd-text);
	background: transparent;
}

.cvd-btn--ghost:hover {
	color: #ffffff;
	background: var(--cvd-text);
}

.cvd-btn--yt {
	background: #ff0000;
	border-color: #ff0000;
}

.cvd-btn--yt svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.cvd-more {
	margin-top: 28px;
	text-align: center;
}

.cvd-empty {
	padding: 28px;
	text-align: center;
	color: var(--cvd-muted);
	background: #f6f7f9;
	border-radius: var(--cvd-radius);
}

.cvd-list.is-loading,
.cvd-featured.is-loading {
	opacity: .5;
	pointer-events: none;
	transition: opacity .2s;
}

/* Single [case_video] */
.cvd-single {
	margin: 0 0 1.5em;
}

.cvd-single--short {
	max-width: 360px;
}

.cvd-single figcaption {
	margin-top: 10px;
	font-size: 14px;
	color: var(--cvd-muted);
	text-align: center;
}

/* Channel */
.cvd-channel {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	padding: 18px 22px;
	background: var(--cvd-bg);
	border: 1px solid var(--cvd-border);
	border-radius: var(--cvd-radius);
}

.cvd-channel__avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
}

.cvd-channel__info {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 160px;
}

.cvd-channel__info strong {
	font-size: 18px;
}

.cvd-channel__info span {
	font-size: 14px;
	color: var(--cvd-muted);
}

/* ---------- Lightbox ---------- */
.cvd-lightbox-open {
	overflow: hidden;
}

.cvd-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100004;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.cvd-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(5, 8, 12, .93);
	opacity: 0;
	transition: opacity .25s;
}

.cvd-lightbox__inner {
	position: relative;
	width: min(1100px, 100%, calc((100dvh - 140px) * 16 / 9));
	opacity: 0;
	transform: scale(.97);
	transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .3, 1);
}

.cvd-lightbox.is-short .cvd-lightbox__inner {
	width: min(420px, 100%, calc((100dvh - 140px) * 9 / 16));
}

.cvd-lightbox.is-open .cvd-lightbox__backdrop,
.cvd-lightbox.is-open .cvd-lightbox__inner {
	opacity: 1;
	transform: none;
}

.cvd-lightbox__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #000;
	border-radius: 12px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.cvd-lightbox.is-short .cvd-lightbox__frame {
	aspect-ratio: 9 / 16;
}

.cvd-lightbox__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.cvd-lightbox__bar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 14px;
	color: #ffffff;
}

.cvd-lightbox__title {
	flex: 1;
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
}

.cvd-lightbox__nav,
.cvd-lightbox__close {
	display: grid;
	flex: none;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: #ffffff;
	background: rgba(255, 255, 255, .12);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color .2s;
}

.cvd-lightbox__nav:hover,
.cvd-lightbox__close:hover {
	background: rgba(255, 255, 255, .25);
}

.cvd-lightbox__nav:disabled {
	opacity: .3;
	cursor: default;
}

.cvd-lightbox__close {
	position: absolute;
	top: -54px;
	right: 0;
}

/* ---------- Single video page ---------- */
.cvd-watch {
	width: min(1100px, 100% - 32px);
	margin: 32px auto 64px;
}

.cvd-watch__player.is-short {
	max-width: 420px;
	margin: 0 auto;
}

.cvd-watch__player.is-short .cvd-cover,
.cvd-watch__player.is-short .cvd-frame {
	aspect-ratio: 9 / 16;
}

.cvd-watch__head {
	margin-top: 20px;
}

.cvd .cvd-watch__title {
	margin: 0;
	font-size: clamp(24px, 3.2vw, 34px);
	font-weight: 800;
	line-height: 1.2;
}

.cvd-watch__text {
	max-width: 820px;
	margin-top: 18px;
	color: var(--cvd-muted);
}

.cvd-watch__more {
	margin-top: 48px;
}

.cvd .cvd-watch__more h2 {
	margin: 0 0 18px;
	font-size: 22px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.cvd-list--grid,
	.cvd-list--slider {
		--cvd-cols: 2 !important;
	}

	.cvd-featured {
		grid-template-columns: 1fr;
	}

	.cvd-featured__list {
		max-height: 380px;
	}
}

@media (max-width: 640px) {
	.cvd-list--grid {
		grid-template-columns: 1fr;
	}

	.cvd-list--slider {
		grid-auto-columns: 86%;
	}

	.cvd-list--shorts {
		grid-auto-columns: 46%;
	}

	.cvd-lightbox {
		padding: 12px;
	}

	.cvd-lightbox__close {
		top: -50px;
	}

	.cvd-play {
		width: 54px;
		height: 38px;
	}
}
