/* ECW – Product Gallery widget.
 *
 * Loaded only on pages that use this widget. Shared rules (.ecw-sr,
 * .ecw-placeholder) are printed inline by the plugin as "ecw-common".
 *
 * Design values are CSS variables. Elementor style controls set the variables
 * on .ecw-gallery (per device), so they always win without specificity fights.
 * The "Thumbnails position" control switches the layout variables below.
 * Swiping uses CSS scroll-snap, so it works before (and without) the JS.
 */

.ecw-gallery [hidden]{display:none!important}

.ecw-gallery{
	--ecw-gal-ratio:var(--ecw-gal-ratio-auto,1 / 1);
	--ecw-gal-fit:contain;
	--ecw-gal-bg:#fff;
	--ecw-gal-radius:12px;
	--ecw-gal-gap:16px;
	/* Layout: thumbnails on the left (desktop default). */
	--ecw-gal-dir:row-reverse;
	--ecw-gal-strip:column;
	--ecw-gal-strip-w:var(--ecw-gal-thumb-size);
	--ecw-gal-strip-pos:absolute;
	--ecw-gal-thumbs:block;
	--ecw-gal-thumbs-align:0px;
	/* Thumbnails */
	--ecw-gal-thumb-size:88px;
	--ecw-gal-thumbs-gap:10px;
	--ecw-gal-thumb-ratio:var(--ecw-gal-ratio);
	--ecw-gal-thumb-radius:8px;
	--ecw-gal-thumb-border:2px;
	--ecw-gal-thumb-border-color:transparent;
	--ecw-gal-thumb-active:var(--e-global-color-accent,#222);
	--ecw-gal-thumb-opacity:1;
	--ecw-gal-thumb-bg:#fff;
	--ecw-gal-strip-bg:#f1f1f1;
	--ecw-gal-strip-fg:#4a4a4a;
	/* Sale badge */
	--ecw-gal-badge-bg:var(--e-global-color-accent,#222);
	--ecw-gal-badge-fg:#fff;
	--ecw-gal-badge-size:13px;
	--ecw-gal-badge-radius:20px;
	/* Arrows, dots, chips */
	--ecw-gal-arrows:flex;
	--ecw-gal-arrow-size:42px;
	--ecw-gal-arrow-offset:12px;
	--ecw-gal-arrow-radius:50%;
	--ecw-gal-arrow-bg:rgba(255,255,255,.92);
	--ecw-gal-arrow-fg:var(--e-global-color-text,#333);
	--ecw-gal-arrow-bg-hover:#fff;
	--ecw-gal-arrow-fg-hover:var(--e-global-color-accent,#222);
	--ecw-gal-dots:none;
	--ecw-gal-dot:8px;
	--ecw-gal-dot-color:rgba(0,0,0,.2);
	--ecw-gal-dot-active:var(--e-global-color-accent,#222);
	--ecw-gal-chip-bg:rgba(255,255,255,.92);
	--ecw-gal-chip-fg:var(--e-global-color-text,#333);
	/* Zoom and full-screen view */
	--ecw-gal-zoom:2;
	--ecw-gal-lb-bg:#fff;
	--ecw-gal-lb-fg:var(--e-global-color-text,#333);
	position:relative;
	display:flex;
	flex-direction:var(--ecw-gal-dir);
	gap:var(--ecw-gal-gap);
	width:100%;
	min-width:0;
	box-sizing:border-box
}

/* Fallback when Elementor's per-device CSS is missing: thumbnails below on phones. */
@media (max-width:767px){
	.ecw-gallery{--ecw-gal-dir:column;--ecw-gal-strip:row;--ecw-gal-strip-w:auto;--ecw-gal-strip-pos:static;--ecw-gal-thumb-size:64px}
}

.ecw-gallery *,.ecw-gallery *::before,.ecw-gallery *::after{box-sizing:border-box}

/* Main image */
.ecw-gallery .ecw-gallery__main{position:relative;flex:1 1 0%;min-width:0;border-radius:var(--ecw-gal-radius);overflow:hidden;background:var(--ecw-gal-bg);isolation:isolate}
.ecw-gallery .ecw-gallery__track{position:relative;display:flex;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch;outline:0}
.ecw-gallery .ecw-gallery__track::-webkit-scrollbar{display:none}
/* Snapping pauses while the script animates to a slide. */
.ecw-gallery .ecw-gallery__track.is-animating,.ecw-gallery .ecw-lightbox__track.is-animating{scroll-snap-type:none}
.ecw-gallery .ecw-gallery__track:focus-visible{outline:2px solid var(--ecw-gal-thumb-active);outline-offset:-2px}
.ecw-gallery .ecw-gallery__slide{position:relative;flex:0 0 100%;width:100%;aspect-ratio:var(--ecw-gal-ratio);margin:0;overflow:hidden;scroll-snap-align:start;scroll-snap-stop:always}
.ecw-gallery--lightbox .ecw-gallery__slide{cursor:zoom-in}
.ecw-gallery.ecw-gallery .ecw-gallery__slide img{display:block;width:100%;height:100%;max-width:none;margin:0;padding:0;border:0;border-radius:0;box-shadow:none;object-fit:var(--ecw-gal-fit);transition:opacity .2s}

/* Hover zoom: the image on screen is scaled at once (GPU transform set by the
 * script); the full-size copy fades in over it as soon as it has loaded. */
.ecw-gallery.ecw-gallery .ecw-gallery__slide img.ecw-gallery__zoom{position:absolute;inset:0;opacity:0;pointer-events:none;transition:opacity .15s}
.ecw-gallery.ecw-gallery .ecw-gallery__slide.is-zooming img{transform-origin:0 0;will-change:transform}
.ecw-gallery.ecw-gallery .ecw-gallery__slide.is-zoom-ready img.ecw-gallery__zoom{opacity:1}

/* Buttons over the image (strong selectors: themes style every <button>). */
.ecw-gallery.ecw-gallery .ecw-gallery__arrow,
.ecw-gallery.ecw-gallery .ecw-gallery__expand{position:absolute;z-index:2;display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;margin:0;padding:0;border:0;line-height:1;text-transform:none;box-shadow:0 1px 4px rgba(0,0,0,.12);cursor:pointer;transition:opacity .2s,background-color .2s,color .2s}
.ecw-gallery.ecw-gallery .ecw-gallery__arrow{display:var(--ecw-gal-arrows);top:50%;width:var(--ecw-gal-arrow-size);height:var(--ecw-gal-arrow-size);margin-top:calc(var(--ecw-gal-arrow-size) / -2);border-radius:var(--ecw-gal-arrow-radius);background:var(--ecw-gal-arrow-bg);color:var(--ecw-gal-arrow-fg)}
.ecw-gallery.ecw-gallery .ecw-gallery__arrow--prev{inset-inline-start:var(--ecw-gal-arrow-offset)}
.ecw-gallery.ecw-gallery .ecw-gallery__arrow--next{inset-inline-end:var(--ecw-gal-arrow-offset)}
.ecw-gallery.ecw-gallery .ecw-gallery__arrow:hover,
.ecw-gallery.ecw-gallery .ecw-gallery__arrow:focus-visible{background:var(--ecw-gal-arrow-bg-hover);color:var(--ecw-gal-arrow-fg-hover)}
.ecw-gallery .ecw-gallery__arrow:disabled{opacity:.35;cursor:default}
.ecw-gallery .ecw-gallery__arrow svg{display:block;width:45%;height:45%}
[dir="rtl"] .ecw-gallery .ecw-gallery__arrow svg,[dir="rtl"] .ecw-lightbox .ecw-lightbox__arrow svg{transform:scaleX(-1)}

.ecw-gallery.ecw-gallery .ecw-gallery__expand{top:12px;inset-inline-end:12px;width:36px;height:36px;border-radius:50%;background:var(--ecw-gal-chip-bg);color:var(--ecw-gal-chip-fg)}
.ecw-gallery.ecw-gallery .ecw-gallery__expand:hover,
.ecw-gallery.ecw-gallery .ecw-gallery__expand:focus-visible{background:var(--ecw-gal-chip-bg);color:var(--ecw-gal-arrow-fg-hover)}
.ecw-gallery .ecw-gallery__expand svg{display:block;width:18px;height:18px}
.ecw-gallery .ecw-gallery__arrow:focus-visible,.ecw-gallery .ecw-gallery__expand:focus-visible{outline:2px solid var(--ecw-gal-thumb-active);outline-offset:2px}

/* Sale badge (over the image; clicks pass through to zoom / full screen). */
.ecw-gallery .ecw-gallery__badge{position:absolute;z-index:3;top:12px;inset-inline-start:12px;max-width:calc(100% - 24px);padding:5px 11px;border-radius:var(--ecw-gal-badge-radius);background:var(--ecw-gal-badge-bg);color:var(--ecw-gal-badge-fg);font-size:var(--ecw-gal-badge-size);font-weight:700;line-height:1.25;letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
.ecw-gallery.ecw-gallery--badge-right .ecw-gallery__badge{inset-inline-start:auto;inset-inline-end:12px}
/* Badge on the right: the full-screen button moves to the bottom corner. */
.ecw-gallery.ecw-gallery.ecw-gallery--badge-right .ecw-gallery__expand{top:auto;bottom:12px}

/* One image (e.g. a variation with a single photo): no navigation. */
.ecw-gallery.is-single .ecw-gallery__arrow,.ecw-gallery.is-single .ecw-gallery__dots,.ecw-gallery.is-single .ecw-gallery__counter,.ecw-gallery.is-single:not(.ecw-gallery--single-thumb) .ecw-gallery__thumbs{display:none!important}

/* Arrows only on hover (computers). Keyboard focus shows them too. */
@media (hover:hover) and (pointer:fine){
	.ecw-gallery--hover-nav .ecw-gallery__main:not(:hover):not(:focus-within) .ecw-gallery__arrow,
	.ecw-gallery--hover-nav .ecw-gallery__main:not(:hover):not(:focus-within) .ecw-gallery__expand{opacity:0}
}

.ecw-gallery .ecw-gallery__counter{position:absolute;z-index:2;bottom:12px;inset-inline-start:12px;padding:4px 10px;border-radius:20px;background:var(--ecw-gal-chip-bg);color:var(--ecw-gal-chip-fg);font-size:12px;font-weight:600;line-height:1.4;pointer-events:none}

.ecw-gallery .ecw-gallery__dots{position:absolute;z-index:2;left:0;right:0;bottom:14px;display:var(--ecw-gal-dots);justify-content:center;flex-wrap:wrap;gap:8px;padding:0 60px;pointer-events:none}
.ecw-gallery.ecw-gallery .ecw-gallery__dot{position:relative;display:block;flex:0 0 auto;width:var(--ecw-gal-dot);height:var(--ecw-gal-dot);min-width:0;min-height:0;margin:0;padding:0;border:0;border-radius:50%;background:var(--ecw-gal-dot-color);box-shadow:none;cursor:pointer;pointer-events:auto;transition:background-color .2s,transform .2s}
.ecw-gallery.ecw-gallery .ecw-gallery__dot::after{content:"";position:absolute;inset:-8px}
.ecw-gallery.ecw-gallery .ecw-gallery__dot.is-active{background:var(--ecw-gal-dot-active);transform:scale(1.25)}
.ecw-gallery.ecw-gallery .ecw-gallery__dot:focus-visible{outline:2px solid var(--ecw-gal-dot-active);outline-offset:3px}

/* Thumbnails. Side layouts: the strip is as tall as the main image and
 * scrolls; top/bottom layouts: one row that scrolls sideways. */
.ecw-gallery .ecw-gallery__thumbs{display:var(--ecw-gal-thumbs);position:relative;flex:0 0 auto;width:var(--ecw-gal-strip-w);min-width:0}
.ecw-gallery .ecw-gallery__thumbs-list{position:var(--ecw-gal-strip-pos);inset:0;display:flex;flex-direction:var(--ecw-gal-strip);gap:var(--ecw-gal-thumbs-gap);margin:0;padding:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.ecw-gallery .ecw-gallery__thumbs-list::-webkit-scrollbar{display:none}
/* More thumbnails than fit: the edge fades and a small arrow appears (set by the script). */
.ecw-gallery .ecw-gallery__thumbs{--ecw-fade-a:0px;--ecw-fade-b:0px}
.ecw-gallery .ecw-gallery__thumbs.can-prev{--ecw-fade-a:36px}
.ecw-gallery .ecw-gallery__thumbs.can-next{--ecw-fade-b:36px}
.ecw-gallery .ecw-gallery__thumbs.can-prev .ecw-gallery__thumbs-list,.ecw-gallery .ecw-gallery__thumbs.can-next .ecw-gallery__thumbs-list{-webkit-mask-image:linear-gradient(to right,transparent 0,#000 var(--ecw-fade-a),#000 calc(100% - var(--ecw-fade-b)),transparent 100%);mask-image:linear-gradient(to right,transparent 0,#000 var(--ecw-fade-a),#000 calc(100% - var(--ecw-fade-b)),transparent 100%)}
.ecw-gallery .ecw-gallery__thumbs.is-vertical.can-prev .ecw-gallery__thumbs-list,.ecw-gallery .ecw-gallery__thumbs.is-vertical.can-next .ecw-gallery__thumbs-list{-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--ecw-fade-a),#000 calc(100% - var(--ecw-fade-b)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--ecw-fade-a),#000 calc(100% - var(--ecw-fade-b)),transparent 100%)}
[dir="rtl"] .ecw-gallery .ecw-gallery__thumbs:not(.is-vertical) .ecw-gallery__thumbs-list{-webkit-mask-image:linear-gradient(to left,transparent 0,#000 var(--ecw-fade-a),#000 calc(100% - var(--ecw-fade-b)),transparent 100%);mask-image:linear-gradient(to left,transparent 0,#000 var(--ecw-fade-a),#000 calc(100% - var(--ecw-fade-b)),transparent 100%)}
/* Scroll buttons: a bar across the strip (top/bottom when the thumbnails are
 * beside the image, left/right when they are below or above it). */
.ecw-gallery.ecw-gallery .ecw-gallery__strip{position:absolute;z-index:2;top:0;bottom:0;display:flex;align-items:center;justify-content:center;width:26px;height:auto;min-width:0;min-height:0;margin:0;padding:0;border:1px solid rgba(0,0,0,.08);border-radius:var(--ecw-gal-thumb-radius);background:var(--ecw-gal-strip-bg);color:var(--ecw-gal-strip-fg);box-shadow:none;line-height:1;cursor:pointer;transition:background-color .2s,color .2s}
.ecw-gallery.ecw-gallery .ecw-gallery__strip:hover,.ecw-gallery.ecw-gallery .ecw-gallery__strip:focus{background:var(--ecw-gal-strip-bg);background:color-mix(in srgb,var(--ecw-gal-strip-bg) 90%,#000);color:var(--ecw-gal-strip-fg)}
.ecw-gallery.ecw-gallery .ecw-gallery__strip[hidden]{display:none}
.ecw-gallery .ecw-gallery__strip svg{display:block;width:16px;height:16px}
.ecw-gallery.ecw-gallery .ecw-gallery__strip--prev{inset-inline-start:0}
.ecw-gallery.ecw-gallery .ecw-gallery__strip--next{inset-inline-end:0}
.ecw-gallery.ecw-gallery .is-vertical .ecw-gallery__strip{top:auto;bottom:auto;left:0;right:0;width:auto;height:26px}
.ecw-gallery.ecw-gallery .is-vertical .ecw-gallery__strip--prev{top:0}
.ecw-gallery.ecw-gallery .is-vertical .ecw-gallery__strip--next{bottom:0}
.ecw-gallery .is-vertical .ecw-gallery__strip svg{transform:rotate(90deg)}
[dir="rtl"] .ecw-gallery .ecw-gallery__thumbs:not(.is-vertical) .ecw-gallery__strip svg{transform:scaleX(-1)}
/* min(): thumbnails shrink to fit a narrow strip instead of overflowing. */
.ecw-gallery.ecw-gallery .ecw-gallery__thumb{position:relative;display:block;flex:0 0 auto;width:min(var(--ecw-gal-thumb-size),100%);height:auto;min-width:0;min-height:0;aspect-ratio:var(--ecw-gal-thumb-ratio);margin:0;padding:0;border:var(--ecw-gal-thumb-border) solid var(--ecw-gal-thumb-border-color);border-radius:var(--ecw-gal-thumb-radius);background:var(--ecw-gal-thumb-bg);opacity:var(--ecw-gal-thumb-opacity);overflow:hidden;line-height:0;box-shadow:none;cursor:pointer;transition:opacity .2s,border-color .2s}
/* "Center" alignment: auto margins centre the strip, and fall back to 0 when it overflows. */
.ecw-gallery.ecw-gallery .ecw-gallery__thumb:first-child{margin-inline-start:var(--ecw-gal-thumbs-align);margin-block-start:var(--ecw-gal-thumbs-align)}
.ecw-gallery.ecw-gallery .ecw-gallery__thumb:last-child{margin-inline-end:var(--ecw-gal-thumbs-align);margin-block-end:var(--ecw-gal-thumbs-align)}
.ecw-gallery.ecw-gallery .ecw-gallery__thumb:hover,
.ecw-gallery.ecw-gallery .ecw-gallery__thumb:focus{background:var(--ecw-gal-thumb-bg);opacity:1}
.ecw-gallery.ecw-gallery .ecw-gallery__thumb:hover:not(.is-active){border-color:rgba(43,37,34,.18);border-color:color-mix(in srgb,var(--ecw-gal-thumb-active) 35%,transparent)}
.ecw-gallery.ecw-gallery .ecw-gallery__thumb.is-active{opacity:1;border-color:var(--ecw-gal-thumb-active)}
.ecw-gallery.ecw-gallery .ecw-gallery__thumb:focus-visible{outline:2px solid var(--ecw-gal-thumb-active);outline-offset:-4px}
.ecw-gallery.ecw-gallery .ecw-gallery__thumb img{display:block;width:100%;height:100%;max-width:none;margin:0;padding:0;border:0;border-radius:0;box-shadow:none;object-fit:var(--ecw-gal-fit)}

/* Full-screen view (native <dialog>: focus stays inside, Esc closes). */
html.ecw-lightbox-open{overflow:hidden}
.ecw-gallery .ecw-lightbox{position:fixed;inset:0;width:100%;height:100%;max-width:100%;max-height:100%;margin:0;padding:0;border:0;background:var(--ecw-gal-lb-bg);color:var(--ecw-gal-lb-fg);overflow:hidden}
.ecw-gallery .ecw-lightbox[open]{display:flex;flex-direction:column}
.ecw-gallery .ecw-lightbox::backdrop{background:rgba(0,0,0,.6)}
.ecw-gallery .ecw-lightbox__bar{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px 10px 20px}
.ecw-gallery .ecw-lightbox__counter{font-size:14px;font-weight:600;line-height:1.4}
.ecw-gallery .ecw-lightbox__track{position:relative;display:flex;flex:1 1 auto;min-height:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior:contain;scrollbar-width:none}
.ecw-gallery .ecw-lightbox__track::-webkit-scrollbar{display:none}
.ecw-gallery .ecw-lightbox__slide{position:relative;display:flex;flex:0 0 100%;width:100%;height:100%;align-items:center;justify-content:center;padding:0 16px 16px;overflow:hidden;scroll-snap-align:start;scroll-snap-stop:always}
.ecw-gallery.ecw-gallery .ecw-lightbox__slide img{display:block;width:auto;height:auto;max-width:100%;max-height:100%;margin:0;border:0;border-radius:0;box-shadow:none;object-fit:contain;cursor:zoom-in;transform-origin:var(--ecw-gal-zx,50%) var(--ecw-gal-zy,50%);transition:transform .25s}
.ecw-gallery.ecw-gallery .ecw-lightbox__slide.is-zoomed img{transform:scale(var(--ecw-gal-zoom));cursor:zoom-out}
.ecw-gallery.ecw-gallery .ecw-lightbox button{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;margin:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--ecw-gal-lb-fg);box-shadow:none;line-height:1;cursor:pointer;transition:opacity .2s}
.ecw-gallery.ecw-gallery .ecw-lightbox button:hover,
.ecw-gallery.ecw-gallery .ecw-lightbox button:focus{background:transparent;color:var(--ecw-gal-lb-fg);opacity:.65}
.ecw-gallery.ecw-gallery .ecw-lightbox button:focus-visible{outline:2px solid currentColor;outline-offset:2px}
.ecw-gallery.ecw-gallery .ecw-lightbox button:disabled{opacity:.25;cursor:default}
.ecw-gallery.ecw-gallery .ecw-lightbox__close{width:44px;height:44px}
.ecw-gallery.ecw-gallery .ecw-lightbox__arrow{position:absolute;z-index:2;top:50%;width:52px;height:52px;margin-top:-26px}
.ecw-gallery.ecw-gallery .ecw-lightbox__arrow--prev{inset-inline-start:8px}
.ecw-gallery.ecw-gallery .ecw-lightbox__arrow--next{inset-inline-end:8px}
.ecw-gallery .ecw-lightbox svg{display:block;width:26px;height:26px}

/* Touch screens: swipe instead of arrows; pinch to zoom. */
@media (hover:none){
	.ecw-gallery.ecw-gallery .ecw-lightbox__arrow{display:none}
	.ecw-gallery.ecw-gallery .ecw-lightbox__slide img{cursor:default}
	.ecw-gallery .ecw-lightbox__slide{padding:0 0 16px}
}

@media (prefers-reduced-motion:reduce){
	.ecw-gallery *,.ecw-gallery *::before,.ecw-gallery *::after{transition:none!important}
}
