/**
 * Nova Video Grid — styles.
 *
 * Uses CSS custom properties from PHP render:
 *   --nvf-vgrid-cols, --nvf-vgrid-gap, --nvf-vgrid-ratio,
 *   --nvf-vgrid-radius, --nvf-vgrid-play-size,
 *   --nvf-vgrid-play-color, --nvf-vgrid-play-bg,
 *   --nvf-vgrid-text
 */

/* ── Grid container ───────────────────────────────────────── */

.nvf-video-grid {
	max-width: 100%;
	box-sizing: border-box;
}

.nvf-vgrid__grid {
	display: grid;
	grid-template-columns: repeat( var(--nvf-vgrid-cols, 4), 1fr );
	gap: var(--nvf-vgrid-gap, 24px);
}

/* ── Card ─────────────────────────────────────────────────── */

.nvf-vgrid__card {
	display: flex;
	flex-direction: column;
}

/* ── Thumbnail ────────────────────────────────────────────── */

.nvf-vgrid__thumb {
	position: relative;
	aspect-ratio: var(--nvf-vgrid-ratio, 16/9);
	border-radius: var(--nvf-vgrid-radius, 0);
	overflow: hidden;
	background: #1a1a1a;
	cursor: pointer;
}

.nvf-vgrid__thumb:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #0073aa);
	outline-offset: 2px;
}

/* Poster image */
.nvf-vgrid__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Empty poster placeholder */
.nvf-vgrid__poster-ph {
	width: 100%;
	height: 100%;
	background: #333;
}

/* Hover zoom */
.nvf-vgrid__thumb:hover .nvf-vgrid__poster {
	transform: scale(1.05);
}

/* ── Play button ──────────────────────────────────────────── */

.nvf-vgrid__play {
	position: absolute !important;
	top: 50% !important;
	left: 50% !important;
	transform: translate(-50%, -50%) !important;
	z-index: 2;
	width: var(--nvf-vgrid-play-size, 56px) !important;
	height: var(--nvf-vgrid-play-size, 56px) !important;
	border-radius: 50% !important;
	border: none !important;
	background: var(--nvf-vgrid-play-bg, rgba(0,0,0,0.45)) !important;
	color: var(--nvf-vgrid-play-color, #fff) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: transform 0.25s ease, opacity 0.25s ease;
	pointer-events: none; /* let .nvf-vgrid__thumb handle clicks */
}

.nvf-vgrid__thumb:hover .nvf-vgrid__play {
	transform: translate(-50%, -50%) scale(1.1) !important;
}

/* ── Meta: artist + title ─────────────────────────────────── */

.nvf-vgrid__meta {
	padding-top: 10px;
	color: var(--nvf-vgrid-text, currentColor);
}

.nvf-vgrid__artist {
	margin: 0 !important;
	font-weight: 700;
	text-transform: uppercase;
	font-size: clamp(11px, 1vw, 14px);
	letter-spacing: 0.06em;
	line-height: 1.35;
}

.nvf-vgrid__title {
	margin: 2px 0 0 !important;
	font-size: clamp(11px, 1vw, 14px);
	opacity: 0.7;
	line-height: 1.35;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1024px) {
	.nvf-vgrid__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.nvf-vgrid__grid {
		grid-template-columns: 1fr;
	}
}

/* ── Lightbox overlay ─────────────────────────────────────── */

.nvf-vgrid-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(0, 0, 0, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.nvf-vgrid-lightbox.is-open {
	opacity: 1;
	pointer-events: auto;
}

/* Iframe wrapper */
.nvf-vgrid-lightbox__wrap {
	position: relative;
	width: 88vw;
	max-width: 1100px;
	aspect-ratio: 16 / 9;
}

.nvf-vgrid-lightbox__wrap iframe {
	width: 100%;
	height: 100%;
	border: none;
	border-radius: 6px;
}

/* Close button */
.nvf-vgrid-lightbox__close {
	position: absolute;
	top: 16px;
	right: 20px;
	z-index: 10;
	width: 44px;
	height: 44px;
	border: none;
	background: none;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s;
	padding: 0;
	margin: 0;
}

.nvf-vgrid-lightbox__close:hover {
	opacity: 1;
}

/* ── Editor compat ────────────────────────────────────────── */

.block-editor-block-list__layout .nvf-video-grid .nvf-vgrid__thumb {
	cursor: default;
}

.block-editor-block-list__layout .nvf-video-grid .nvf-vgrid__play {
	pointer-events: none;
}
