/* Prodealer Vehicle Gallery 1.0.3
 *
 * Same layout as the vehicle page gallery it replaces:
 * - Desktop (992px+): one large 4:3 photo on the left two-thirds, the next
 *   three photos stacked on the right third, 8px gaps, 8px padding.
 * - Tablet and phone: the large photo full width, three photos in a row
 *   below it.
 * Brand fonts and colours for the photo count badge come from each site's
 * own stylesheet (.pd-photo-count), so this file is the same for every brand.
 */

.pdvg {
	position: relative;
}

.pdvg a {
	display: block;
	text-decoration: none;
	cursor: zoom-in;
}

/* ".pdvg .pdvg-img" (two classes) so it beats WooCommerce's
   ".woocommerce img { height: auto }", which otherwise stops the photos
   filling their boxes and the thumbnails showing only the top of each
   photo. Fixed in 1.0.3. */
.pdvg .pdvg-img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	background: #f4f6f9;
}

.pdvg-main {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #f4f6f9;
}

.pdvg-thumbs {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 7px;
	padding: 9px;
	background: #fff;
}

/* Thumbnails are cropped wider than the photo, so the crop is taken from
   lower down (75%, not the middle). Vehicle photos usually have the car in
   the lower half and sky above it, so this keeps the whole car, wheels
   included, and drops sky instead of tyres. 1.0.3 */
.pdvg .pdvg-thumb .pdvg-img {
	object-position: center 75%;
}

.pdvg-thumb {
	height: 76px;
	overflow: hidden;
	border-radius: 7px;
}

.pdvg-thumb:hover,
.pdvg-thumb:focus-visible {
	outline: 2px solid #1a1a1a;
	outline-offset: -2px;
}

/* Photo count badge */
.pdvg .pdvg-count {
	position: absolute;
	top: 20px;
	right: 20px;
	left: auto;
	z-index: 6;
	display: inline-flex;
	align-items: center;
	margin: 0;
	padding: 7px 14px 7px 32px;
	border: 0;
	border-radius: 999px;
	background-color: rgba(26, 26, 26, .82);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'%3E%3C/path%3E%3Ccircle cx='12' cy='13' r='4'%3E%3C/circle%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: 12px center;
	background-size: 15px;
	box-shadow: none;
	color: #fff;
	font-size: 12px;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .2s;
}

.pdvg .pdvg-count:hover,
.pdvg .pdvg-count:focus-visible {
	background-color: rgba(26, 26, 26, .95);
}

/* Desktop: large photo left, three photos stacked right */
@media (min-width: 992px) {

	.pdvg {
		display: grid;
		grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
		gap: 8px;
		padding: 8px;
	}

	.pdvg-main {
		grid-column: 1;
		border-radius: 8px;
	}

	/* The right-hand column is exactly as tall as the large photo. */
	.pdvg-thumbs {
		position: absolute;
		top: 8px;
		right: 8px;
		bottom: 8px;
		width: calc((100% - 24px) / 3);
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: repeat(var(--pdvg-rows, 3), minmax(0, 1fr));
		gap: 8px;
		padding: 0;
		background: none;
	}

	.pdvg-thumb {
		height: auto;
		min-height: 0;
		border-radius: 8px;
	}

	/* Badge sits 12px in from the thumbnail column. */
	.pdvg .pdvg-count {
		right: calc((100% - 24px) / 3 + 28px);
	}

	/* Only one photo: it fills the card. */
	.pdvg--single {
		grid-template-columns: minmax(0, 1fr);
	}

	.pdvg--single .pdvg-main {
		aspect-ratio: auto;
		max-height: 560px;
	}

	.pdvg.pdvg--single .pdvg-img {
		max-height: 560px;
		object-fit: contain;
	}

	/* !important and the extra classes beat the theme's badge position rule */
	.pdvg.pdvg--single .pdvg-count.pd-photo-count {
		right: 20px !important;
	}
}

/* No photos */
.pdvg--empty img {
	display: block;
	width: 100%;
	height: auto;
}

/* Full-screen viewer: photo counter in the same style as the badge */
.pswp .pswp__counter {
	font-size: 14px;
	opacity: .9;
}
