/* DreamFast Gallery: image-only storefront gallery. */

.df-rmg-gallery {
	position: relative;
	/* Paint above adjacent in-flow theme content. On block themes (e.g. Twenty
	   Twenty-Five) the breadcrumb block can stretch over the floated gallery and
	   swallow clicks / zoom / swipe / thumbnail taps; raising the gallery keeps
	   it interactive, with no effect on classic themes (Astra, Blocksy, etc.). */
	z-index: 1;
	width: var(--df-rmg-width, 100%);
	max-width: var(--df-rmg-max-width, none);
	margin-inline: auto;
	animation: df-rmg-gallery-enter 0.24s ease-out both;
}

/* Block themes (e.g. Twenty Twenty-Five) render the gallery as the
   `woocommerce/product-image-gallery` block inside the product column (see
   Frontend::replace_gallery_block, which tags the gallery `df-rmg--in-block`).
   Neutralise WooCommerce's classic float / 48% width there so the gallery fills
   its column. !important beats WC's `div.product div.images` rule including its
   higher-specificity `#content` variant. Classic themes (Astra, Blocksy) never
   get this class — they keep the float-based two-column layout, unaffected. */
.df-rmg-gallery.df-rmg--in-block {
	float: none !important;
	width: 100% !important;
	max-width: var(--df-rmg-max-width, none);
	margin-inline: auto;
}

.df-rmg-main {
	position: relative;
	width: 100%;
	aspect-ratio: var(--df-rmg-aspect-ratio, 1);
	overflow: hidden;
	background: var(--df-rmg-bg, #f4f4f5);
	border-radius: var(--df-rmg-radius, 8px);
	box-shadow: var(--df-rmg-gallery-shadow, 0 8px 32px rgba(15, 23, 42, 0.08));
}

.df-rmg-main .swiper-wrapper,
.df-rmg-main .swiper-slide,
.df-rmg-slide-inner,
.df-rmg-zoom-wrap {
	width: 100%;
	height: 100%;
}

.df-rmg-slide-inner {
	position: relative;
	overflow: hidden;
	background: var(--df-rmg-bg, #f4f4f5);
}

.df-rmg-main .swiper-slide img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	object-fit: var(--df-rmg-object-fit, contain);
	object-position: center;
	user-select: none;
	-webkit-user-drag: none;
	transition: transform 0.22s ease;
}

.df-rmg-zoom-wrap {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.df-rmg-gallery:not(.df-rmg--no-zoom) .df-rmg-zoom-wrap {
	cursor: zoom-in;
}

.df-rmg-gallery:not(.df-rmg--no-zoom) .df-rmg-zoom-wrap.df-rmg-zoomed {
	cursor: zoom-out;
}

.df-rmg--ratio-auto .df-rmg-main {
	aspect-ratio: auto;
	min-height: var(--df-rmg-min-height, 280px);
	max-height: var(--df-rmg-max-height, none);
}

/* Natural height: let the image drive the height (in flow), so the gallery
   container follows the image and can never collapse to zero. */
.df-rmg--ratio-auto .df-rmg-main .swiper-wrapper,
.df-rmg--ratio-auto .df-rmg-main .swiper-slide,
.df-rmg--ratio-auto .df-rmg-slide-inner,
.df-rmg--ratio-auto .df-rmg-zoom-wrap {
	position: relative;
	inset: auto;
	height: auto;
}

.df-rmg--ratio-auto .df-rmg-main .swiper-slide img {
	position: relative;
	width: 100%;
	height: auto;
	max-height: var(--df-rmg-max-height, none);
}

.df-rmg-main .swiper-button-next,
.df-rmg-main .swiper-button-prev {
	top: 50%;
	width: 42px;
	height: 42px;
	margin-top: 0;
	transform: translateY(-50%);
	color: #1f2937;
	background: rgba(255,255,255,.94);
	border: 1px solid rgba(15,23,42,.08);
	border-radius: 50%;
	box-shadow: 0 3px 16px rgba(15,23,42,.14);
}

.df-rmg-main .swiper-button-next::after,
.df-rmg-main .swiper-button-prev::after {
	font-size: 16px;
	font-weight: 700;
}

.df-rmg--arrow-minimal .df-rmg-main .swiper-button-next,
.df-rmg--arrow-minimal .df-rmg-main .swiper-button-prev {
	color: #fff;
	background: transparent;
	border: 0;
	box-shadow: none;
	filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
}

.df-rmg--ui-dark .df-rmg-main .swiper-button-next,
.df-rmg--ui-dark .df-rmg-main .swiper-button-prev {
	color: #fff;
	background: rgba(15,23,42,.62);
	border-color: rgba(255,255,255,.16);
}

/* Shadow off also flattens the on-image controls (arrows + zoom button) so the
   gallery_shadow "None" choice removes every shadow. */
.df-rmg--shadow-none .df-rmg-main .swiper-button-next,
.df-rmg--shadow-none .df-rmg-main .swiper-button-prev,
.df-rmg--shadow-none .df-rmg-zoom-hint {
	box-shadow: none;
}

/* Focus ring: hidden on pointer interaction (no ugly box after a click), but a
   clean, on-brand ring for keyboard users — replaces the theme's heavy default
   outline. Accessible AND tidy. */
.df-rmg-main .swiper-button-next:focus,
.df-rmg-main .swiper-button-prev:focus,
.df-rmg-zoom-hint:focus {
	outline: none;
}
.df-rmg-main .swiper-button-next:focus-visible,
.df-rmg-main .swiper-button-prev:focus-visible,
.df-rmg-zoom-hint:focus-visible {
	outline: 2px solid var(--df-rmg-accent, #1f2937);
	outline-offset: 2px;
}

.df-rmg-main .swiper-pagination {
	bottom: 14px;
}

.df-rmg-main .swiper-pagination-bullet {
	width: var(--df-rmg-bullet-size, 8px);
	height: var(--df-rmg-bullet-size, 8px);
	margin: 0 4px;
	opacity: 1;
	transition: width .2s ease, transform .2s ease, background .2s ease;
}

.df-rmg--pag-floating .df-rmg-main .swiper-pagination {
	left: 50%;
	width: auto;
	padding: 1px 12px 3px 12px;
	transform: translateX(-50%);
	background: rgba(15,23,42,.45);
	border-radius: 999px;
	backdrop-filter: blur(8px);
}

.df-rmg--pag-floating .swiper-pagination-bullet {
	background: rgba(255,255,255,.55);
}

.df-rmg--pag-floating .swiper-pagination-bullet-active {
	background: #fff;
	box-shadow: 0 0 0 2px var(--df-rmg-accent, #1f2937);
}

.df-rmg--pag-classic .swiper-pagination-bullet {
	background: rgba(255,255,255,.92);
	border: 2px solid rgba(15,23,42,.22);
}

.df-rmg--pag-classic .swiper-pagination-bullet-active {
	background: var(--df-rmg-accent, #1f2937);
	border-color: var(--df-rmg-accent, #1f2937);
	transform: scale(1.2);
}

.df-rmg--pag-line .df-rmg-main .swiper-pagination {
	display: flex;
	gap: 6px;
	left: 50%;
	width: auto;
	transform: translateX(-50%);
}

.df-rmg--pag-line .swiper-pagination-bullet {
	width: 20px;
	height: 3px;
	margin: 0;
	background: rgba(15,23,42,.25);
	border-radius: 999px;
}

.df-rmg--pag-line .swiper-pagination-bullet-active {
	width: 32px;
	background: var(--df-rmg-accent, #1f2937);
}

.df-rmg-thumbs {
	margin-top: 6px;
	padding: 8px 2px;
	overflow: hidden;
}

.df-rmg-thumbs .swiper-wrapper {
	gap: var(--df-rmg-thumb-gap, 10px);
}

.df-rmg-thumbs .swiper-slide {
	position: relative;
	width: var(--df-rmg-thumb-size, 72px);
	height: var(--df-rmg-thumb-size, 72px);
	overflow: hidden;
	cursor: pointer;
	opacity: .62;
	background: var(--df-rmg-bg, #f4f4f5);
	border: 2px solid transparent;
	border-radius: calc(var(--df-rmg-radius, 8px) * .75);
	transition: opacity .2s ease, border-color .2s ease, transform .2s ease;
}

.df-rmg-thumbs .swiper-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.df-rmg-thumbs .swiper-slide-thumb-active {
	opacity: 1;
	border-color: var(--df-rmg-accent, #1f2937);
}

.df-rmg--thumb-lift .df-rmg-thumbs .swiper-slide-thumb-active {
	transform: translateY(-3px);
	box-shadow: 0 7px 18px rgba(15,23,42,.16);
}

.df-rmg-zoom-hint {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 5;
	display: grid;
	width: 36px;
	height: 36px;
	padding: 0;
	place-items: center;
	color: #fff;
	cursor: pointer;
	background: rgba(15,23,42,.68);
	border: 0;
	border-radius: 9px;
}

.df-rmg--zoom-light .df-rmg-zoom-hint {
	color: #1f2937;
	background: rgba(255,255,255,.94);
}

.df-rmg--no-thumbs .df-rmg-thumbs {
	display: none;
}

@media (max-width: 768px) {
	.df-rmg-gallery.df-rmg--mobile-hide-arrows .swiper-button-next,
	.df-rmg-gallery.df-rmg--mobile-hide-arrows .swiper-button-prev {
		display: none;
	}

	/* Optional mobile min/max height for "Fit image height" mode. Falls back to
	   the desktop var when no mobile value is set (blank = inherit desktop). */
	.df-rmg--ratio-auto .df-rmg-main {
		min-height: var(--df-rmg-min-height-mobile, var(--df-rmg-min-height, 280px));
		max-height: var(--df-rmg-max-height-mobile, var(--df-rmg-max-height, none));
	}
	.df-rmg--ratio-auto .df-rmg-main .swiper-slide img {
		max-height: var(--df-rmg-max-height-mobile, var(--df-rmg-max-height, none));
	}
}

@media (prefers-reduced-motion: reduce) {
	.df-rmg-gallery,
	.df-rmg-main .swiper-slide img,
	.df-rmg-thumbs .swiper-slide {
		animation: none;
		transition: none;
	}
}

@keyframes df-rmg-gallery-enter {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}
