/* Goed In Beeld — Interactive Gallery
   Colors as CSS variables so the studio can re-theme without touching JS/PHP. */
.gib-thumbs,
.gib-pane,
.gib-fullscreen {
	--gib-accent: #e5007d;
}

/* ---------- Thumbnails (role: thumbs) ---------- */

.gib-thumbs {
	display: grid;
	grid-template-columns: repeat(var(--gib-columns, 3), 1fr);
	gap: var(--gib-gap, 16px);
}

.gib-thumb {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	overflow: hidden;
	border-radius: 4px;
}

.gib-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	transition: transform .3s ease;
}

.gib-thumb:hover img,
.gib-thumb:focus-visible img {
	transform: scale(1.04);
}

.gib-thumb[aria-pressed="true"] {
	box-shadow: 0 0 0 3px var(--gib-accent);
}

.gib-thumbs-empty {
	opacity: .6;
	font-style: italic;
}

/* ---------- Content column (role: pane) ---------- */
/* Fixed box size (empty, placeholder or filled) so the column next to the
   thumbnails never reflows the page layout. */

/* Fixed height (not max-height) — the box never changes size between
   placeholder/preview states, which is what actually prevents the page
   layout from reflowing. Divi's own Sizing → Width/Height/Min Height/Max
   Height fields (Advanced tab) apply to the module's outer wrapper, a
   level up from this box, so they don't affect it — use the module's own
   "Maximale hoogte content-kolom" field instead.

   Never scrolls (overflow:hidden, on purpose) and never pages into another
   thumbnail's content — prev/next stays within the current item's own
   images. Image and text always show together, top-aligned: the image
   flexes/shrinks first so the text (which never scrolls or gets cut off)
   always has room underneath it. */
.gib-pane {
	position: relative;
	height: var(--gib-pane-max-height, 600px);
	overflow: hidden;
	border-radius: 4px;
}

.gib-pane-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 20px;
	text-align: center;
	font-style: italic;
	opacity: .55;
}

.gib-pane-content {
	display: flex;
	flex-direction: column;
	height: 100%;
	width: 100%;
	cursor: zoom-in;
}

/* flex: 0 1 auto — takes its own natural size (scaled to the column width),
   never stretched to fill leftover space. That's what actually pins it to
   the top with the text flush underneath: growing it (flex-grow: 1) is what
   previously left it vertically centered with a gap above the text, since
   object-fit centers within whatever box it's given. object-position: top
   only matters for the rare case where it still has to shrink to make room
   for the text — then it crops from the bottom instead of both edges. */
.gib-pane-content > img {
	flex: 0 1 auto;
	min-height: 0;
	max-width: 100%;
	max-height: 100%;
	display: block;
	object-fit: contain;
	object-position: top center;
}

.gib-pane-video {
	flex: 0 1 auto;
	min-height: 0;
	max-height: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
}

.gib-pane-video video,
.gib-pane-video iframe {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.gib-pane-text {
	flex: 0 0 auto;
	padding: 8px 12px;
}

.gib-pane-no-image {
	padding: 20px;
	text-align: center;
	font-style: italic;
	opacity: .55;
}

/* Prev/next cycle through the current item's own images only (not the next
   Galerij-item) — positioned over the pane itself, not just the image. */
.gib-pane > .gib-pane-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .5);
	color: #fff;
	cursor: pointer;
	z-index: 2;
}

.gib-pane > .gib-pane-nav.prev {
	left: 10px;
}

.gib-pane > .gib-pane-nav.next {
	right: 10px;
}

/* ---------- Mobile: pane unused, thumbnails go straight to fullscreen ---------- */

@media (max-width: 767px) {
	.gib-pane {
		display: none;
	}

	.gib-thumbs {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ---------- Fullscreen overlay (shared, appended to <body> by JS) ---------- */

.gib-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(10, 10, 10, .96);
}

.gib-fullscreen[hidden] {
	display: none;
}

/* The inner wrapper is the single scroll container for the whole modal
   (image/video + counter + text together) if content is ever taller than
   the viewport — the text box itself never gets its own nested scrollbar. */
.gib-fullscreen-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	max-width: 100%;
	max-height: 100%;
	width: 100%;
	overflow-y: auto;
}

.gib-fullscreen-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	max-width: 100%;
}

.gib-fullscreen-body img,
.gib-fullscreen-body video,
.gib-fullscreen-body iframe {
	max-width: 100%;
	max-height: 70vh;
	object-fit: contain;
	flex-shrink: 0;
}

.gib-fullscreen-text {
	max-width: 700px;
	padding: 12px;
	background: #fff;
	color: #111;
	border-radius: 4px;
}

@media (max-width: 767px) {
	.gib-fullscreen-text {
		/* Halved again per feedback — the white card was still eating too
		   much space around the caption on small screens. */
		padding: 6px 8px;
	}
}

.gib-fullscreen-close {
	position: absolute;
	top: 16px;
	right: 20px;
	border: 0;
	background: none;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
}

.gib-fullscreen-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .15);
	color: #fff;
	font-size: 22px;
	cursor: pointer;
}

.gib-fullscreen-nav.prev {
	left: 20px;
}

.gib-fullscreen-nav.next {
	right: 20px;
}

.gib-fullscreen-counter {
	color: #fff;
	opacity: .7;
	font-size: 14px;
}
