/* ============================================================
   MotorPro Gallery Carousel
   Per-instance values arrive as inline custom properties on .mpg
   (--mpg-side-d / -t / -m etc). This file maps them per breakpoint,
   so responsive settings still win over the inline values.
   ============================================================ */

.mpg{
	--mpg-side: var(--mpg-side-d, 27%);
	--mpg-mid:  var(--mpg-mid-d, 40%);
	--mpg-h:    var(--mpg-h-d, 600px);
	--mpg-gap:  var(--mpg-gap-d, 4px);
	--mpg-ease: cubic-bezier(.22,.61,.36,1);
	width: 100%;
	position: relative;
}
.mpg *,
.mpg *::before,
.mpg *::after{ box-sizing: border-box; }

/* Themes and page builders style bare <button> elements heavily. These
   resets keep the controls circular, unpadded and clickable regardless. */
.mpg .mpg__nav,
.mpg .mpg__slide,
.mpg .mpg__thumb,
.mpg-lb button{
	margin: 0 !important;
	padding: 0 !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	width: auto;
	font: inherit;
	line-height: normal !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-decoration: none !important;
	text-shadow: none !important;
	transform-origin: center;
	appearance: none;
	-webkit-appearance: none;
	pointer-events: auto !important;
}
.mpg .mpg__nav:hover,
.mpg .mpg__nav:focus,
.mpg .mpg__slide:hover,
.mpg .mpg__thumb:hover,
.mpg-lb button:hover{
	text-decoration: none !important;
	border: none;
}

/* ---------- stage ---------- */
.mpg__stage{
	position: relative;
	height: var(--mpg-h);
	overflow: hidden;
	touch-action: pan-y;
}
.mpg--drag .mpg__stage{ cursor: grab; }
.mpg--drag .mpg__stage.is-dragging{ cursor: grabbing; }

.mpg__track{
	display: flex;
	gap: var(--mpg-gap);
	height: 100%;
	will-change: transform;
	transition: transform var(--mpg-speed, .55s) var(--mpg-ease);
}
.mpg__stage.is-dragging .mpg__track{ transition: none; }

.mpg__slide{
	position: relative;
	flex: 0 0 var(--mpg-side);
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	overflow: hidden;
	background: #e9e9e9;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: flex-basis var(--mpg-speed, .55s) var(--mpg-ease);
}
.mpg__slide.is-active{ flex-basis: var(--mpg-mid); }
.mpg--lightbox .mpg__slide.is-active{ cursor: zoom-in; }
.mpg:not(.mpg--lightbox) .mpg__slide.is-active{ cursor: default; }

.mpg__slide img{
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	max-width: none;
	-webkit-user-drag: none;
	user-select: none;
}

/* the white wash over everything except the centre slide */
.mpg__slide::after{
	content: "";
	position: absolute;
	inset: 0;
	background: #fff;
	opacity: var(--mpg-fade, .72);
	transition: opacity var(--mpg-fade-speed, .6s) var(--mpg-ease);
	pointer-events: none;
}
.mpg__slide.is-active::after{ opacity: 0; }

/* incoming slide fades and settles in */
.mpg__slide.is-active img{ animation: mpgFadeIn var(--mpg-fade-speed, .6s) var(--mpg-ease) both; }
@keyframes mpgFadeIn{
	from{ opacity: 0; transform: scale(1.045); }
	to  { opacity: 1; transform: scale(1); }
}
.mpg__slide:focus-visible{ outline: 3px solid var(--mpg-accent, #e01b1b); outline-offset: -3px; }

/* zoom badge */
.mpg__zoom{
	position: absolute;
	right: 14px;
	bottom: 14px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(0,0,0,.5);
	display: none;
	place-items: center;
	pointer-events: none;
	opacity: 0;
	transition: opacity .25s ease;
}
.mpg--lightbox .mpg__slide.is-active .mpg__zoom{ display: grid; }
.mpg__slide.is-active:hover .mpg__zoom{ opacity: 1; }
.mpg__zoom svg{ fill: #fff; }

/* video badge */
.mpg__play{
	position: absolute;
	inset: 0;
	margin: auto;
	width: clamp(48px, 7vw, 74px);
	height: clamp(48px, 7vw, 74px);
	border-radius: 50%;
	background: rgba(0,0,0,.55);
	display: none;
	place-items: center;
	pointer-events: none;
}
.mpg__slide--video.is-active .mpg__play{ display: grid; }
.mpg__play svg{ margin-left: 5px; fill: #fff; }

/* ---------- arrows ---------- */
.mpg__nav{
	display: grid;
	place-items: center;
	border: 0;
	padding: 0;
	margin: 0;
	background: #c51d29;
	color: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0,0,0,.18);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: opacity .2s ease, filter .2s ease;
}
.mpg__nav:hover{ filter: brightness(1.06); }
.mpg__nav:focus-visible{ outline: 2px solid var(--mpg-accent, #e01b1b); outline-offset: 3px; }
.mpg__nav[disabled]{ opacity: .3; cursor: default; }
.mpg__nav svg{ fill: currentColor; pointer-events: none; }

.mpg .mpg__nav--prev, .mpg .mpg__nav--next {
	position: absolute;
	top: 50%;
	z-index: 20;
	width: clamp(34px, 4vw, 48px);
	height: clamp(34px, 4vw, 48px);
	transform: translateY(-50%);
	background: #c51d29;
	color: #fff;
	border-radius: 50% !important;
	box-shadow: 0 2px 10px rgba(0,0,0,.18) !important;
	border: 0px;
}
.mpg__nav--prev{ left: clamp(8px, 1.4vw, 18px); }
.mpg__nav--next{ right: clamp(8px, 1.4vw, 18px); }

/* ---------- thumbnails ---------- */
.mpg__thumbrow{
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	margin-top: 14px;
}

/* Centred thumbnail panel. "safe center" keeps the first thumbnails
   reachable when the strip is wider than the panel. */
.mpg--thumbs-center .mpg__thumbs{
	justify-content: center;
	justify-content: safe center;
}
.mpg__nav--thumb{
	flex: 0 0 auto;
	width: 30px !important;
	height: 30px;
	box-shadow: 0 1px 6px rgba(0,0,0,.16);
}
.mpg__nav--thumb svg{ width: 8px; height: 13px; }

.mpg__thumbs{
	display: flex;
	gap: var(--mpg-thumb-gap, 10px);
	flex: 1 1 auto;
	min-width: 0;
	padding: 4px 0;
	overflow-x: auto;
	scrollbar-width: none;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
}
.mpg__thumbs::-webkit-scrollbar{ display: none; }

.mpg .mpg__thumb{
	position: relative;
	flex: 0 0 var(--mpg-thumb-w, 70px);
	height: var(--mpg-thumb-h, 62px);
	padding: 0;
	margin: 0;
	border: 2px solid transparent;
	border-radius: 0;
	background: none;
	cursor: pointer;
	overflow: hidden;
	appearance: none;
	-webkit-appearance: none;
}
.mpg__thumb img{
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	max-width: none;
	transition: opacity .25s ease;
}
.mpg__thumb:hover img{ opacity: .8; }
.mpg__thumb.is-active{ border-color: var(--mpg-accent, #e01b1b); }
.mpg__thumb.is-active img{ outline: 2px solid #fff; outline-offset: -2px; opacity: 1; }
.mpg__thumb:focus-visible{ outline: 2px solid var(--mpg-accent, #e01b1b); outline-offset: 2px; }
.mpg__thumb--video::after{
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 9px 0 9px 15px;
	border-color: transparent transparent transparent #fff;
	filter: drop-shadow(0 0 3px rgba(0,0,0,.6));
}

/* ---------- lightbox (built by JS, appended to <body>) ---------- */
.mpg-lb{
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	grid-template-rows: auto 1fr auto;
	background: var(--mpg-lb-bg, #0c0c0c);
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s cubic-bezier(.22,.61,.36,1), visibility .3s;
}
.mpg-lb.is-open{ opacity: 1; visibility: visible; }
.mpg-lb *,
.mpg-lb *::before,
.mpg-lb *::after{ box-sizing: border-box; }

.mpg-lb__bar{
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	color: #fff;
}
.mpg-lb__count{ font-size: 14px; letter-spacing: .04em; opacity: .85; }
.mpg-lb__close{
	width: 42px !important;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: rgba(255,255,255,.12);
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background .2s ease;
}
.mpg-lb__close:hover{ background: rgba(255,255,255,.25); }
.mpg-lb__close:focus-visible{ outline: 2px solid #fff; outline-offset: 3px; }
.mpg-lb__close svg{ fill: currentColor; }

.mpg-lb__stage{
	position: relative;
	margin: 0;
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 0 clamp(8px, 6vw, 90px);
	touch-action: pan-y;
}
.mpg-lb__media{
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
	-webkit-user-drag: none;
	user-select: none;
	animation: mpgLbIn .35s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes mpgLbIn{
	from{ opacity: 0; transform: scale(.97); }
	to  { opacity: 1; transform: scale(1); }
}

.mpg-lb__nav{
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: clamp(38px, 4.2vw, 52px);
	height: clamp(38px, 4.2vw, 52px);
	z-index: 20;
	border: 0;
	border-radius: 50%;
	background: rgba(255,255,255,.14);
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background .2s ease, opacity .2s ease;
}
.mpg-lb__nav{ background: rgba(255,255,255,.14) !important; color: #fff !important; border-radius: 50% !important; }
.mpg-lb__nav:hover{ background: rgba(255,255,255,.28) !important; }
.mpg-lb__nav:focus-visible{ outline: 2px solid #fff; outline-offset: 3px; }
.mpg-lb__nav[disabled]{ opacity: .25; cursor: default; }
.mpg-lb__nav svg{ fill: currentColor; pointer-events: none; }
.mpg-lb__prev{ left: clamp(6px, 2vw, 26px); }
.mpg-lb__next{ right: clamp(6px, 2vw, 26px); }

.mpg-lb__caption{
	color: #e8e8e8;
	font-size: 13px;
	text-align: center;
	padding: 10px 16px 0;
	min-height: 20px;
}
.mpg-lb__thumbs{
	display: flex;
	gap: 8px;
	justify-content: center;
	justify-content: safe center;
	padding: 10px 16px 18px;
	overflow-x: auto;
	scrollbar-width: none;
	scroll-behavior: smooth;
}
.mpg-lb__thumbs::-webkit-scrollbar{ display: none; }
.mpg-lb__thumb{
	flex: 0 0 62px;
	height: 48px;
	padding: 0;
	border: 2px solid transparent;
	background: none;
	cursor: pointer;
	overflow: hidden;
	opacity: .55;
	transition: opacity .2s ease;
}
.mpg-lb__thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; }
.mpg-lb__thumb.is-active{ border-color: var(--mpg-lb-accent, #e01b1b); opacity: 1; }

.mpg-lb__thumb:focus-visible{ outline: 2px solid #fff; outline-offset: 2px; }

body.mpg-lb-open{ overflow: hidden; }
.mpg-lb__stage .mpg-lb__nav {
	display: none;
}
/* ---------- breakpoints ---------- */
@media (max-width: 1024px){
	.mpg{
		--mpg-side: var(--mpg-side-t, 28%);
		--mpg-mid:  var(--mpg-mid-t, 58%);
		--mpg-h:    var(--mpg-h-t, 420px);
	}
}
@media (max-width: 768px){
	.mpg{
		--mpg-side: var(--mpg-side-m, 16%);
		--mpg-mid:  var(--mpg-mid-m, 80%);
		--mpg-h:    var(--mpg-h-m, 290px);
		--mpg-gap:  var(--mpg-gap-m, 3px);
	}
	.mpg__nav--thumb{ display: none; }   /* the strip swipes on touch */
	.mpg-lb__bar{ padding: 10px 12px; }
	.mpg-lb__thumbs{ padding: 8px 12px 14px; }
	.mpg-lb__thumb{ flex: 0 0 52px; height: 40px; }
	.mpg-lb__caption{ font-size: 12px; }
}
@media (max-width: 768px) and (orientation: landscape){
	.mpg-lb__thumbs{ display: none; }
}
@media (hover: none){
	.mpg--lightbox .mpg__slide.is-active .mpg__zoom{ opacity: 1; }
}

@media (prefers-reduced-motion: reduce){
	.mpg__track,
	.mpg__slide,
	.mpg__slide::after,
	.mpg__nav,
	.mpg-lb{ transition: none; }
	.mpg__slide.is-active img,
	.mpg-lb__media{ animation: none; }
	.mpg__thumbs,
	.mpg-lb__thumbs{ scroll-behavior: auto; }
}
