/* Createam Video Grid – defaults match the current projects page (4 / 4 / 2 columns, 20px gap, 9:16, 12px corners). */

.ctvg {
	width: 100%;
}

.ctvg-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
}

@media (max-width: 767px) {
	.ctvg-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.ctvg-item {
	position: relative;
	overflow: hidden;
	aspect-ratio: 9 / 16;
	border-radius: 12px;
	background-color: rgba(255, 255, 255, 0.06);
	isolation: isolate;
	transform: translateZ(0); /* keeps rounded corners clipping the video in Safari */
}

/* Older Safari without aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
	.ctvg-item::after {
		content: "";
		display: block;
		padding-top: 177.78%;
	}
}

/* Soft shimmer until the first frame is ready */
.ctvg-item::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 0;
	pointer-events: none;
	background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
	background-size: 250% 100%;
	animation: ctvg-shimmer 1.6s linear infinite;
}

.ctvg-item.is-ready::before {
	display: none;
}

@keyframes ctvg-shimmer {
	from { background-position: 150% 0; }
	to { background-position: -50% 0; }
}

.ctvg-video {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
	outline-offset: -3px;
}

.ctvg-link {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	display: block;
}

.ctvg-link:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

.ctvg-image {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	border: 0;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.ctvg-link:hover .ctvg-image,
.ctvg-link:focus-visible .ctvg-image {
	transform: scale(1.03);
}

.ctvg--no-controls .ctvg-video {
	cursor: pointer;
}

.ctvg-title {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 2;
	padding: 14px 16px 36px;
	color: #fff;
	font-size: 15px;
	line-height: 1.3;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
	pointer-events: none;
}

/* Editor-only placeholder for rows with no video yet */
.ctvg-item--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px dashed rgba(255, 255, 255, 0.25);
	color: rgba(255, 255, 255, 0.6);
	font-size: 13px;
}

.ctvg-item--empty::before {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.ctvg-item::before {
		animation: none;
	}

	.ctvg-image {
		transition: none;
	}

	.ctvg-link:hover .ctvg-image,
	.ctvg-link:focus-visible .ctvg-image {
		transform: none;
	}
}
