/* Omit Product Gallery - frontend styles
   Kleuren zijn bewust neutraal gehouden zodat het theme de look bepaalt;
   pas via de CSS variabelen hieronder aan of override .opg-* classes in je child theme / Bricks. */

.opg-gallery {
	--opg-btn-bg: #ffffff;
	--opg-btn-bg-hover: #111111;
	--opg-btn-color: #111111;
	--opg-btn-color-hover: #ffffff;
	--opg-dot-bg: rgba(0, 0, 0, 0.15);
	--opg-dot-bg-active: #111111;
	position: relative;
	width: 100%;
}

.opg-gallery * {
	box-sizing: border-box;
}

body.opg-lightbox-locked {
	overflow: hidden;
}

.opg-icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

/* ==========================================================================
   Desktop grid (2x2)
   ========================================================================== */

.opg-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
	gap: var(--opg-gap, 12px);
}

/* 1 afbeelding: enkel vak, geen 2x2. */
.opg-grid--1-up {
	grid-template-columns: 1fr;
	grid-template-rows: 1fr;
}

/* 2 items (uitgelicht + 1 gallery/video): 2 kolommen, 1 rij. */
.opg-grid--2-up {
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr;
}

/* 3 of 4 items: volledige 2x2 (bij 3 blijft het 4e vak leeg). */
.opg-grid--3-up,
.opg-grid--4-up {
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
}

.opg-cell {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--opg-aspect, 1);
	overflow: hidden;
	border-radius: var(--opg-radius, 0);
	padding: 0;
	margin: 0;
	border: none;
	background: var(--opg-cell-bg, #f2f2f2);
}

.opg-cell img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Weergave van de uitgelichte (eerste) afbeelding: cover of contain, instelbaar. */
.opg-cell--1 img {
	object-fit: var(--opg-first-fit, cover);
}

/* Volledige-cel klik-overlay die de lightbox opent (bij afbeeldingen / niet-autoplay video). */
.opg-cell__open {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	z-index: 2;
}

/* Video-cel: geen open-overlay, video vult de cel en is klikbaar (= pause). */
.opg-cell--video {
	cursor: pointer;
}

/* De video/iframe wordt op eigen aspect-ratio geschaald en gecentreerd; wat buiten de
   cel valt wordt door overflow:hidden op .opg-cell bijgeknipt -> echte "cover"-crop,
   geen zwarte balken (werkt ook voor YouTube, dat object-fit negeert). */
.opg-cell-video-wrap {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	min-width: 100%;
	min-height: 100%;
	aspect-ratio: 16 / 9;
	pointer-events: none;
}

.opg-cell-video,
.opg-cell-video-frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
	pointer-events: none; /* klik gaat naar .opg-cell--video (pause), niet naar de player-UI */
}

.opg-cell--empty {
	background: transparent;
	cursor: default;
	pointer-events: none;
}

.opg-open-btn {
	position: absolute;
	right: 12px;
	bottom: 12px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px 10px 14px;
	border-radius: 999px;
	background: var(--opg-btn-bg);
	color: var(--opg-btn-color);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	white-space: nowrap;
	border: none;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
	z-index: 3; /* boven de klik-overlay */
}

.opg-open-btn .opg-icon {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
}

.opg-open-btn:hover,
.opg-open-btn:focus-visible {
	background: var(--opg-btn-bg-hover);
	color: var(--opg-btn-color-hover);
}

/* ==========================================================================
   Mobiele horizontale scroller (los van het grid)
   ========================================================================== */

.opg-mobile-scroller {
	display: none;
}

.opg-mobile-track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	gap: var(--opg-mobile-gap, 16px);
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.opg-mobile-track::-webkit-scrollbar {
	display: none;
}

.opg-mobile-slide {
	position: relative;
	flex: 0 0 90%;
	width: 90%;
	min-width: 90%;
	scroll-snap-align: start;
	aspect-ratio: var(--opg-aspect, 1);
	border-radius: var(--opg-radius, 0);
	overflow: hidden;
	background: var(--opg-cell-bg, #f2f2f2);
}

.opg-mobile-image-btn,
.opg-mobile-video-preview {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
}

.opg-mobile-image-btn img,
.opg-mobile-video-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Eerste mobiele slide volgt dezelfde instelling als de uitgelichte afbeelding. */
.opg-mobile-slide:first-child .opg-mobile-image-btn img {
	object-fit: var(--opg-first-fit, cover);
}

.opg-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.9);
	border-radius: 50%;
	color: #111;
	pointer-events: none;
}

.opg-play-icon .opg-icon {
	width: 18px;
	height: 18px;
	margin-left: 2px; /* optisch centreren van driehoekje */
}

.opg-mobile-dots {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 4px;
}

.opg-mobile-dots li {
	flex: 1 1 0;
	margin: 0;
}

.opg-mobile-dots button {
	width: 100%;
	height: 4px;
	border: none;
	border-radius: 4px;
	background: var(--opg-dot-bg);
	padding: 0;
	font-size: 0;
	cursor: pointer;
	transition: background 0.2s ease;
}

.opg-mobile-dots li.is-active button {
	background: var(--opg-dot-bg-active);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.opg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	background: var(--opg-overlay, #ffffff);
}

.opg-lightbox.is-open {
	display: block;
}

.opg-lightbox__inner {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
}

.opg-lightbox__close {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 50;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	color: #111;
}

.opg-lightbox__close .opg-icon {
	width: 20px;
	height: 20px;
}

/* Verticale thumbnail-kolom (desktop) */
.opg-lightbox__thumbs {
	position: relative;
	flex: 0 0 140px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 24px 0;
	overflow: hidden;
}

.opg-lightbox__thumbs-track {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 12px;
	overflow-y: auto;
	scroll-behavior: smooth;
	scrollbar-width: none;
	flex: 1 1 auto;
	max-height: 100%;
}

.opg-lightbox__thumbs-track::-webkit-scrollbar {
	display: none;
}

.opg-lightbox__thumb {
	position: relative;
	width: 96px;
	aspect-ratio: var(--opg-aspect, 1);
	border: 2px solid transparent;
	border-radius: calc(var(--opg-radius, 0) * 0.6);
	overflow: hidden;
	padding: 0;
	cursor: pointer;
	background: var(--opg-cell-bg, #f2f2f2);
	flex: 0 0 auto;
}

.opg-lightbox__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.opg-lightbox__thumb.is-active {
	border-color: #111;
}

.opg-thumb-play-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.25);
}

.opg-thumb-play-icon .opg-icon {
	width: 18px;
	height: 18px;
	color: #fff;
}

/* Hoofdafbeelding / stage */
.opg-lightbox__stage {
	position: relative;
	z-index: 1;
	isolation: isolate;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.opg-lightbox__slide {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease;
	padding: 40px;
	pointer-events: none;
}

.opg-lightbox__slide.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.opg-lightbox__image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	cursor: zoom-in;
	transition: transform 0.25s ease;
	touch-action: pan-y;
}

.opg-lightbox__image.is-zoomed {
	cursor: zoom-out;
	transform: scale(2);
	max-width: none;
	max-height: none;
}

.opg-video-wrap {
	position: absolute;
	inset: 0;
	cursor: pointer;
}

.opg-lightbox__video,
.opg-video-wrap .opg-youtube-poster,
.opg-video-wrap iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: contain;
}

.opg-play-icon--stage {
	width: 64px;
	height: 64px;
}

.opg-play-icon--stage .opg-icon {
	width: 24px;
	height: 24px;
}

.opg-video-wrap.is-playing .opg-play-icon {
	display: none;
}

.opg-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 15;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.15);
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.opg-lightbox__nav--prev {
	left: 24px;
}

.opg-lightbox__nav--prev .opg-icon {
	transform: rotate(180deg);
}

.opg-lightbox__nav--next {
	right: 24px;
}

.opg-lightbox__nav .opg-icon {
	width: 16px;
	height: 16px;
}

/* Dots (voornamelijk mobiele lightbox) */
.opg-lightbox__dots {
	position: absolute;
	left: 50%;
	bottom: 20px;
	transform: translateX(-50%);
	display: none;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 6px;
	z-index: 15;
}

.opg-lightbox__dots li {
	margin: 0;
}

.opg-lightbox__dots button {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	border: none;
	background: var(--opg-dot-bg);
	padding: 0;
	font-size: 0;
	cursor: pointer;
}

.opg-lightbox__dots li.is-active button {
	background: var(--opg-dot-bg-active);
}

/* ==========================================================================
   Responsive: hieronder wordt de default 767px-breakpoint gebruikt.
   OPG_Render::inline_breakpoint_css() genereert hierboven eenzelfde blok
   met de instelbare breakpoint-waarde uit de instellingenpagina, dat blok wint.
   ========================================================================== */

@media only screen and (max-width: 767px) {
	.opg-grid {
		display: none;
	}

	.opg-mobile-scroller {
		display: block;
	}

	.opg-lightbox__thumbs {
		display: none;
	}

	.opg-lightbox__nav {
		display: none;
	}

	.opg-lightbox__dots {
		display: flex;
	}

	.opg-lightbox__slide {
		padding: 16px;
	}
}
