/**
 * Premium grid layouts for Video Grid Pro (modern engine only).
 * Applied via a layout class on the .rvg-modern-grid container:
 *   .rvg-layout-masonry, .rvg-layout-justified, .rvg-layout-metro
 * The default "standard" layout uses the inline CSS grid (no class needed).
 * Per-grid inline CSS still sets the tile frame/caption; these files only
 * change how tiles are arranged.
 */

/* ============================================================
 * MASONRY - Pinterest-style. Height variation comes from the title/meta
 * BELOW each thumbnail (video titles vary in length), so uniform 16:9
 * thumbnails still stagger into a real masonry layout. CSS columns.
 * ============================================================ */
.rvg-modern-grid.rvg-layout-masonry {
	display: block !important;
	position: relative;
	grid-template-columns: none !important;
	height: auto !important;
	min-height: 0 !important;
	opacity: 0;
	transition: opacity .2s ease;
	animation: rvgMasonrySafety 0s linear 2s forwards;
}
.rvg-modern-grid.rvg-layout-masonry.rvg-masonry-ready {
	opacity: 1;
}
@keyframes rvgMasonrySafety { to { opacity: 1; } }
/* Clear the column flow so the container height matches content (fixes trailing
 * page whitespace some browsers add after multi-column layouts). */
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ {
	display: block !important;
	height: auto !important;
	padding: 0 !important;
	background: #111111;
	border-radius: 6px;
	overflow: hidden !important;
	box-shadow: 0 4px 14px rgba(0,0,0,0.25);
	text-decoration: none !important;
	transition: transform .25s ease, box-shadow .25s ease;
}
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_:hover {
	transform: translateY(-4px);
	box-shadow: 0 10px 24px rgba(0,0,0,0.30);
}
/* Play button centered over the thumbnail image (not the title below). */
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ > .thum_div_ {
	width: 100% !important;
	height: auto !important;
	margin: 0 !important;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	position: relative !important;
	overflow: hidden !important;
	background: transparent !important;
	display: block !important;
	font-size: 0 !important;
}
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ .playbtnCss_video__,
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ .playbtnCss_zoom__,
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ .playbtnCss_link__ {
	position: absolute !important;
	top: 50% !important;
	left: 50% !important;
	right: auto !important;
	bottom: auto !important;
	width: 40px !important;
	height: 40px !important;
	transform: translate(-50%, -50%) !important;
	margin: 0 !important;
	background: transparent url("../images/video.png") no-repeat center center !important;
	background-size: 32px 32px !important;
	pointer-events: none;
	z-index: 3;
}
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ > .thum_div_ > img {
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 16 / 9;
	object-fit: cover !important;
	display: block !important;
	margin: 0 !important;
	border-radius: 6px 6px 0 0 !important;
	transition: transform .35s ease;
}
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_:hover > .thum_div_ > img {
	transform: scale(1.04);
}
/* Caption/title BELOW the image (this is what varies the card height). */
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ .img_caption_,
.rvg-modern-grid.rvg-layout-masonry > a.thumbnail_ .rvg-mason-caption {
	position: static !important;
	left: auto !important;
	right: auto !important;
	bottom: auto !important;
	background: transparent !important;
	color: #ffffff !important;
	padding: 12px 14px 16px !important;
	font-size: 14px !important;
	line-height: 1.35 !important;
	text-align: left !important;
	max-height: none !important;
	display: block !important;
	width: 100% !important;
	box-sizing: border-box !important;
}
/* Play button stays centered on the thumbnail only. */
/* Responsive columns (from the sample). */

/* ============================================================
 * JUSTIFIED - flex rows, tiles grow to fill each row edge-to-edge
 * at a fixed row height (based on the reference layout).
 * ============================================================ */
.rvg-modern-grid.rvg-layout-justified {
	display: flex !important;
	flex-wrap: wrap !important;
	gap: 16px !important;
	grid-template-columns: none !important;
}
/* Tile widths/heights are set by rvg-justified.js (real aspect-ratio packing).
 * Do NOT set flex-grow or width here - it would override the JS. */
.rvg-modern-grid.rvg-layout-justified > a.thumbnail_ {
	flex: 0 0 auto;
	position: relative !important;
	overflow: hidden !important;
	border-radius: 10px;
}
.rvg-modern-grid.rvg-layout-justified > a.thumbnail_ > .thum_div_ {
	width: 100% !important;
	height: 100% !important;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	margin: 0 !important;
}
.rvg-modern-grid.rvg-layout-justified > a.thumbnail_ > .thum_div_ > img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
}

/* Mobile: stack full width (JS also handles this). */
@media (max-width: 500px) {
	.rvg-modern-grid.rvg-layout-justified > a.thumbnail_ {
		width: 100% !important;
	}
}

/* ============================================================
 * METRO - one large hero tile + smaller tiles (magazine style).
 * CSS grid with the first tile spanning 2x2.
 * ============================================================ */
.rvg-modern-grid.rvg-layout-metro {
	display: grid !important;
	grid-template-columns: repeat(4, 1fr) !important;
	grid-auto-rows: 1fr !important;
	gap: 14px !important;
}
.rvg-modern-grid.rvg-layout-metro > a.thumbnail_ {
	width: 100% !important;
	height: 100% !important;
	min-height: 160px;
}
.rvg-modern-grid.rvg-layout-metro > a.thumbnail_:first-child {
	grid-column: span 2;
	grid-row: span 2;
}
/* Give every 6th tile emphasis too, for rhythm on long grids. */
.rvg-modern-grid.rvg-layout-metro > a.thumbnail_:nth-child(6n+1):not(:first-child) {
	grid-column: span 2;
	grid-row: span 2;
}
.rvg-modern-grid.rvg-layout-metro > a.thumbnail_ > .thum_div_,
.rvg-modern-grid.rvg-layout-metro > a.thumbnail_ > .thum_div_ > img {
	height: 100% !important;
	object-fit: cover !important;
}
@media (max-width: 700px) {
	.rvg-modern-grid.rvg-layout-metro { grid-template-columns: repeat(2, 1fr) !important; }
	.rvg-modern-grid.rvg-layout-metro > a.thumbnail_:first-child,
	.rvg-modern-grid.rvg-layout-metro > a.thumbnail_:nth-child(6n+1) { grid-column: span 2; grid-row: span 1; }
}

/* ============================================================
 * STANDARD layout on mobile - use a 16:9 tile so full-width tiles
 * aren't awkwardly short/cropped, and images stay sharp.
 * ============================================================ */
@media (max-width: 560px) {
	.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) {
		grid-template-columns: 1fr !important;
	}
	.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) > a.thumbnail_ {
		height: auto !important;
	}
	.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) > a.thumbnail_ > .thum_div_ {
		height: auto !important;
		aspect-ratio: 16 / 9;
	}
	.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) > a.thumbnail_ > .thum_div_ > img {
		height: 100% !important;
		aspect-ratio: 16 / 9;
		object-fit: cover !important;
	}
}

/* ============================================================================
 * MODERN ENGINE - core layout rules (moved from per-grid inline CSS).
 * Per-grid values come in as CSS variables on the container:
 *   --rvg-col-w   : min column width for the standard grid (e.g. 200px)
 *   --rvg-thumb-h : fixed thumbnail height for the standard layout (e.g. 150px)
 * Class-based, so no per-instance inline CSS or !important is needed.
 * ============================================================================ */

/* ---- STANDARD (default modern grid) ---- */
.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--rvg-col-w, 200px), 1fr));
	gap: 16px;
	width: 100%;
	margin: 0 auto 18px;
	padding: 0;
	box-sizing: border-box;
}
/* Left / right / center alignment: shrink the grid to its content and position
 * it. auto-fit collapses empty columns so tiles group together. */
.rvg-modern-grid.rvg-align-left:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro),
.rvg-modern-grid.rvg-align-right:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro),
.rvg-modern-grid.rvg-align-center:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) {
	grid-template-columns: repeat(auto-fit, var(--rvg-col-w, 200px));
	width: fit-content;
	max-width: 100%;
}
.rvg-modern-grid.rvg-align-left:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) {
	margin-left: 0;
	margin-right: auto;
}
.rvg-modern-grid.rvg-align-right:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) {
	margin-left: auto;
	margin-right: 0;
}
.rvg-modern-grid.rvg-align-center:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) {
	margin-left: auto;
	margin-right: auto;
}
.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) > a.thumbnail_ {
	position: relative;
	width: 100%;
	height: auto;
	margin: 0;
	padding: 0;
	display: block;
	opacity: 1;
	text-decoration: none;
}

/* ---- Shared tile frame (standard + metro + justified use the framed look) ---- */
.rvg-modern-grid:not(.rvg-layout-masonry) > a.thumbnail_ > .thum_div_ {
	width: 100%;
	margin: 0;
	border: 5px solid #fff;
	outline: 1px solid #eee;
	box-shadow: 0 1px 4px rgba(0,0,0,.18);
	border-radius: 4px;
	background: #000;
	position: relative;
	overflow: hidden;
	box-sizing: border-box;
	display: block;
}
.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) > a.thumbnail_ > .thum_div_ {
	height: auto;
}
.rvg-modern-grid.rvg-layout-justified > a.thumbnail_ > .thum_div_,
.rvg-modern-grid.rvg-layout-metro > a.thumbnail_ > .thum_div_ {
	height: 100%;
}

/* ---- Shared tile image ---- */
.rvg-modern-grid:not(.rvg-layout-masonry) > a.thumbnail_ > .thum_div_ > img {
	width: 100%;
	object-fit: cover;
	max-width: none;
	max-height: none;
	display: block;
	margin: 0;
	padding: 0;
	vertical-align: top;
	transition: transform .3s ease;
}
.rvg-modern-grid:not(.rvg-layout-masonry):not(.rvg-layout-justified):not(.rvg-layout-metro) > a.thumbnail_ > .thum_div_ > img {
	height: var(--rvg-thumb-h, 150px);
}
.rvg-modern-grid.rvg-layout-justified > a.thumbnail_ > .thum_div_ > img,
.rvg-modern-grid.rvg-layout-metro > a.thumbnail_ > .thum_div_ > img {
	height: 100%;
}
.rvg-modern-grid > a.thumbnail_:hover > .thum_div_ > img {
	transform: scale(1.06);
}
.rvg-modern-grid > a.thumbnail_ > .thum_div_ > img.fit_img {
	object-fit: contain;
	background: #000;
}

/* ---- Caption (overlay for non-masonry; masonry overrides to below) ---- */
.rvg-modern-grid:not(.rvg-layout-masonry) > a.thumbnail_ .thum_div_ .img_caption_ {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	margin: 0;
}

/* ---- Play button (centered over the tile) ---- */
.rvg-modern-grid:not(.rvg-layout-masonry) > a.thumbnail_ .playbtnCss_video__,
.rvg-modern-grid:not(.rvg-layout-masonry) > a.thumbnail_ .playbtnCss_zoom__,
.rvg-modern-grid:not(.rvg-layout-masonry) > a.thumbnail_ .playbtnCss_link__ {
	display: block;
	background: transparent url("../images/video.png") no-repeat center center;
	background-size: 40px 40px;
	top: 0; left: 0; right: 0; bottom: 0;
	position: absolute;
	z-index: 3;
	pointer-events: none;
}

/* ---- JUSTIFIED: FOUC hide until JS lays out, with safety auto-reveal ---- */
.rvg-modern-grid.rvg-layout-justified {
	opacity: 0;
	transition: opacity .25s ease;
	animation: rvgJustifiedSafety 0s linear 2s forwards;
}
.rvg-modern-grid.rvg-layout-justified.rvg-justified-ready {
	opacity: 1;
}
@keyframes rvgJustifiedSafety { to { opacity: 1; } }
.rvg-modern-grid.rvg-layout-justified > a.thumbnail_ > .thum_div_ {
	background: #000;
}
