.df-gallery {
	display: grid;
	grid-template-columns: minmax(87px, 87px) 1fr;
	gap: 12px;
	align-items: stretch;
	position: relative;
}

.df-gallery.df-gallery--thumb-right {
	grid-template-columns: 1fr minmax(84px, 110px);
}

.df-gallery.df-gallery--thumb-right .df-gallery__thumb-rail-wrap {
	order: 2;
}

.df-gallery.df-gallery--thumb-right .df-gallery__main {
	order: 1;
}

.df-gallery__thumb-rail-wrap {
	display: grid;
	grid-template-rows: 28px auto 28px;
	gap: 16px;
	align-self: center;
}

.df-gallery__thumb-nav {
	font-size: 16px;
	cursor: pointer;
	line-height: 1;
	margin: 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 0;
	background: var(--df-gallery-arrow-bg, #E7F2FE);
	color: var(--df-gallery-arrow-color, #0D80F2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color .15s ease, color .15s ease;
}

.df-gallery__thumb-nav:hover,
.df-gallery__thumb-nav:focus-visible {
	background: var(--df-gallery-arrow-bg-hover, #D2E7FC);
}

/* SVG inherits its colour from the button via fill="currentColor". */
.df-gallery__thumb-nav svg { fill: currentColor; display: block; }

.df-gallery__thumb-nav span {
	display: inline-flex;
}

.df-gallery__thumb-rail {
	display: grid;
	grid-auto-rows: 87px;
	gap: 16px;
	max-height: calc((var(--df-gallery-thumb-size, 96px) * 4) + 20px);
	overflow: hidden;
/* 	scrollbar-width: thin; */
/* 	padding-right: 3px; */
}

.df-gallery__thumb {
	border: 1px solid var(--df-gallery-thumb-border, #EFEFEF);
	background: #fff;
	border-radius: 12px;
	padding: 0;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	padding: 4px;
}

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

.df-gallery__thumb.is-active {
	border-color: var(--df-gallery-thumb-border-active, #B4D8FB);
/* 	box-shadow: 0 0 0 2px rgba(17, 102, 255, 0.12); */
}

.df-gallery__thumb-play {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 22px;
	height: 22px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(17, 102, 255, 0.9);
	color: #fff;
	font-size: 11px;
}

.df-gallery__main {
	border: 1px solid #ebeff8;
	border-radius: 24px;
	background: #fff;
	min-height: 420px;
	max-height: var(--df-gallery-max-height, 760px);
	position: relative;
	padding: 10px;
}

.df-gallery__panel {
	display: none;
	height: 100%;
}

.df-gallery__panel.is-active {
	display: flex;
	align-items: center;
	justify-content: center;
}

.df-gallery__main-image,
.df-gallery__main-video,
.df-gallery__main-iframe {
	width: 100%;
	height: 100%;
	min-height: 380px;
	max-height: calc(var(--df-gallery-max-height, 760px) - 20px);
	border: 0;
	object-fit: contain;
	background: #fff;
	border-radius: 16px;
}

.df-gallery__fallback {
	margin: 0;
}

.df-gallery-modal[hidden] {
	display: none !important;
}

.df-gallery-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
}

.df-gallery-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(3, 15, 42, 0.84);
}

.df-gallery-modal__dialog {
	position: relative;
	width: min(94vw, 1200px);
	height: min(88vh, 800px);
	margin: 6vh auto;
	border-radius: 18px;
	overflow: hidden;
	background: #fff;
	z-index: 1;
}

.df-gallery-modal__close {
	position: absolute;
	right: 14px;
	top: 10px;
	z-index: 3;
	border: none;
	background: transparent;
	font-size: 34px;
	line-height: 1;
	cursor: pointer;
	color: #1b2338;
}

.df-gallery-modal__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--df-gallery-lightbox-arrow-bg, rgba(17, 102, 255, 0.92));
	color: var(--df-gallery-lightbox-arrow-color, #fff);
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
}

.df-gallery-modal__nav--prev {
	left: 14px;
}

.df-gallery-modal__nav--next {
	right: 14px;
}

.df-gallery-modal__content {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.df-gallery-modal__content img,
.df-gallery-modal__content iframe,
.df-gallery-modal__content video {
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: contain;
	background: #fff;
}

body.df-gallery-modal-open {
	overflow: hidden;
}

@media (max-width: 767px) {
	.df-gallery,
	.df-gallery.df-gallery--thumb-right {
		grid-template-columns: 1fr;
	}

	.df-gallery__main {
		order: 1;
	}

	.df-gallery__thumb-rail-wrap {
		order: 2;
	}

	.df-gallery__thumb-rail-wrap {
		grid-template-rows: auto;
		grid-template-columns: 28px 1fr 28px;
		align-items: center;
		gap: 0;
	}

	/* Scoped to non-bottom layouts only — bottom layout rotates the SVG
	   itself, so applying this rotation to the span as well would double
	   up to -180° and flip the arrows the wrong way on mobile. */
	.df-gallery:not(.df-gallery--thumb-bottom) .df-gallery__thumb-nav--up span,
	.df-gallery:not(.df-gallery--thumb-bottom) .df-gallery__thumb-nav--down span {
		display: inline-block;
		transform: rotate(-90deg);
	}

	/* The mobile layout caps each arrow's grid column at 28px but the base
	   rule leaves the button at 38×38, so the button overflows its cell
	   and the overflowing edge ends up hidden behind the rail's scroll
	   container — taps on the visible chevron register as taps on the
	   rail instead. Shrink the button to fit, and lift its stacking order
	   so the rail can't paint over it. */
	.df-gallery:not(.df-gallery--thumb-bottom) .df-gallery__thumb-nav {
		width: 28px;
		height: 28px;
		position: relative;
		z-index: 2;
	}
	.df-gallery:not(.df-gallery--thumb-bottom) .df-gallery__thumb-rail {
		position: relative;
		z-index: 1;
	}

	.df-gallery__thumb-rail {
		grid-auto-flow: column;
		grid-auto-columns: minmax(74px, var(--df-gallery-thumb-size, 96px));
		grid-auto-rows: auto;
		overflow-x: auto;
		overflow-y: hidden;
		max-height: none;
		max-width: calc((var(--df-gallery-thumb-size, 96px) * 3) + 20px);
		padding-bottom: 2px;
	}

	.df-gallery__main {
		min-height: 300px;
	}

	.df-gallery__main-image,
	.df-gallery__main-video,
	.df-gallery__main-iframe {
		min-height: 280px;
	}
}


@media screen and (max-width: 991px) {
	.df-gallery { grid-template-columns: minmax(56px, 56px) 1fr; }
	.df-gallery .df-gallery__thumb-rail { grid-auto-rows: 56px; gap: 12px; max-height: calc((var(--df-gallery-thumb-size, 56px) * 2) + 0px); overflow: hidden; }
	.df-gallery .df-gallery__main { min-height: 268px; max-height: 268px; border-radius: 16px; overflow: hidden; }
}

@media screen and (max-width: 767px) {
	.df-gallery {
        padding: 0rem;
		grid-template-columns: initial;
    }
	.df-gallery .df-gallery__main { 
		min-height: 398px;
        max-height: 398px;
		border-radius: 16px;
	}
	.df-gallery .df-gallery__thumb-rail { 
	 	grid-auto-columns: 56px;
		max-width: 100%;
		justify-content: center;
	}
}

/* ---------------------------------------------------------------
   Bottom-position layout (.df-gallery--thumb-bottom)
   Main image on top, thumbnail rail beneath. The same up/down nav
   buttons act as prev/next; the SVG arrows are rotated so they
   point left/right to match the horizontal rail.
--------------------------------------------------------------- */
.df-gallery.df-gallery--thumb-bottom {
	grid-template-columns: 1fr;
	grid-template-rows: 1fr auto;
}

.df-gallery.df-gallery--thumb-bottom .df-gallery__main {
	order: 1;
}

.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-rail-wrap {
	order: 2;
	display: grid;
	grid-template-columns: 38px 1fr 38px;
	grid-template-rows: auto;
	gap: 12px;
	align-items: center;
	align-self: stretch;
	width: 100%;
}

.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-rail {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: var(--df-gallery-thumb-size, 96px);
	grid-auto-rows: var(--df-gallery-thumb-size, 96px);
	gap: 12px;
	max-height: none;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	/* Centre the row when the thumbs don't fill the full rail width. */
	justify-content: center;
}

/* The up/down arrow icons stay in the markup; rotate both -90° so the
   "up" chevron now points LEFT (prev, sits on the left side) and the
   "down" chevron now points RIGHT (next, sits on the right side). */
.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-nav--up svg,
.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-nav--down svg {
	transform: rotate(-90deg);
}

/* ---------------------------------------------------------------
   Bottom-layout responsive tweaks. Scale thumbs and arrow buttons
   down on tablet and phone so a 3-image rail still fits comfortably
   without immediate horizontal scrolling.
--------------------------------------------------------------- */
@media (max-width: 991px) {
	.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-rail-wrap {
		grid-template-columns: 32px 1fr 32px;
		gap: 10px;
	}
	.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-nav {
		width: 32px;
		height: 32px;
	}
	.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-rail {
		grid-auto-columns: 72px;
		grid-auto-rows: 72px;
		gap: 10px;
	}
}

@media (max-width: 767px) {
	.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-rail-wrap {
		grid-template-columns: 28px 1fr 28px;
		gap: 8px;
	}
	.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-nav {
		width: 28px;
		height: 28px;
	}
	.df-gallery.df-gallery--thumb-bottom .df-gallery__thumb-rail {
		grid-auto-columns: 56px;
		grid-auto-rows: 56px;
		gap: 8px;
	}
}
