/* Scroll Gallery v3 — values come from the widget (CSS variables); default after the comma.
   Devices: desktop ≥1025px, tablet 768–1024px, phone ≤767px (Elementor's default breakpoints). */

.ach-sg{position:relative;background:var(--sg-bg,#fff)}
.ach-sg__sticky{position:relative;overflow:hidden;display:flex;align-items:center;justify-content:center;background:var(--sg-bg,#fff)}

/* Plays by itself: a normal section */
.ach-sg.is-view .ach-sg__sticky{height:var(--sg-h,90vh)}
/* Follows the scroll: pinned */
.ach-sg.is-scroll{height:calc(100vh - var(--sg-top,0px) + var(--sg-len,220vh))}
.ach-sg.is-scroll .ach-sg__sticky{position:sticky;top:var(--sg-top,0px);height:calc(100vh - var(--sg-top,0px))}

.ach-sg__stage{
	position:relative;
	width:min(var(--sg-maxw,1600px),calc(100% - 2 * var(--sg-pad-x,var(--sg-pad,40px))));
	height:calc(100% - 2 * var(--sg-pad,40px));
}

/* Positions: desktop values, tablet / phone fall back to the one above */
.ach-sg__item{
	--l:var(--dl,0);--t:var(--dt,0);--w:var(--dw,20);--h:var(--dh,20);--gg:var(--sg-g,8px);
	position:absolute;display:block;overflow:hidden;
	left:calc(var(--l) * 1% + var(--gg) / 2);
	top:calc(var(--t) * 1% + var(--gg) / 2);
	width:calc(var(--w) * 1% - var(--gg));
	height:calc(var(--h) * 1% - var(--gg));
	border-radius:var(--sg-radius,10px);
	transform-origin:50% 50%;will-change:transform,opacity,filter;
	background:rgba(127,127,127,.12);
}
.ach-sg__item--1{z-index:2}
@media (max-width:1024px){
	.ach-sg__item{--l:var(--tl,var(--dl,0));--t:var(--tt,var(--dt,0));--w:var(--tw,var(--dw,20));--h:var(--th,var(--dh,20))}
}
@media (max-width:767px){
	.ach-sg__item{--l:var(--ml,var(--tl,var(--dl,0)));--t:var(--mt,var(--tt,var(--dt,0)));--w:var(--mw,var(--tw,var(--dw,20)));--h:var(--mh,var(--th,var(--dh,20)))}
}

/* Photo + crop (per device) */
.ach-sg__img{position:absolute;inset:0;overflow:hidden}
.ach-sg__img img{
	--fx:var(--dfx,50%);--fy:var(--dfy,50%);--z:var(--dz,1);
	width:100%!important;height:100%!important;max-width:none!important;object-fit:cover;display:block;
	border-radius:0!important;
	object-position:var(--fx) var(--fy);transform-origin:var(--fx) var(--fy);
	transform:scale(calc(var(--z) * var(--hz,1)));
	transition:transform var(--sg-zoom-speed,.6s) ease
}
@media (max-width:1024px){.ach-sg__img img{--fx:var(--tfx,var(--dfx,50%));--fy:var(--tfy,var(--dfy,50%));--z:var(--tz,var(--dz,1))}}
@media (max-width:767px){.ach-sg__img img{--fx:var(--mfx,var(--tfx,var(--dfx,50%)));--fy:var(--mfy,var(--tfy,var(--dfy,50%)));--z:var(--mz,var(--tz,var(--dz,1)))}}
.ach-sg__item:hover .ach-sg__img img,.ach-sg__item.is-active .ach-sg__img img{--hz:var(--sg-zoom,1.05)}

/* Before the script starts: hidden (only when "start hidden" is on).
   Safety net: if the script never runs, the pictures appear anyway after 2.5s. */
.ach-sg.is-pre .ach-sg__item{opacity:0;animation:achSgSafety 0s linear 2.5s forwards}
@keyframes achSgSafety{to{opacity:1}}

/* Image name (inside, at the bottom) */
.ach-sg__cap{
	position:absolute;left:0;right:0;bottom:0;z-index:2;margin:0;
	padding:var(--sg-cap-pad,28px 14px 12px);
	color:var(--sg-cap-color,#fff);text-align:var(--sg-cap-align,left);
	font-size:15px;font-weight:600;line-height:1.25;
	background:linear-gradient(180deg,transparent,var(--sg-cap-bg,rgba(0,0,0,.55)));
	pointer-events:none;transition:opacity .35s ease,transform .35s ease;
}
.ach-sg.cap-hide .ach-sg__item:hover .ach-sg__cap,
.ach-sg.cap-hide .ach-sg__item.is-active .ach-sg__cap,
.ach-sg.cap-hide .ach-sg__item:focus-within .ach-sg__cap{opacity:0;transform:translateY(8px)}
.ach-sg.cap-stay .ach-sg__item.has-cap{--sg-lift:2.6em}

/* Buttons (position comes from the widget; default bottom left) */
.ach-sg__btns{
	position:absolute;z-index:3;display:flex;gap:var(--sg-btn-gap,8px);
	left:var(--sg-btn-edge,14px);bottom:calc(var(--sg-btn-edge,14px) + var(--sg-lift,0px));
	opacity:0;transform:translateY(8px);pointer-events:none;
	transition:opacity .3s ease,transform .3s ease;
}
.ach-sg.btn-always .ach-sg__btns,
.ach-sg__item:hover .ach-sg__btns,
.ach-sg__item.is-active .ach-sg__btns,
.ach-sg__item:focus-within .ach-sg__btns{opacity:1;transform:none;pointer-events:auto}

/* While an image is still moving: no name, no buttons */
.ach-sg.is-anim .ach-sg__item:not(.is-ready) .ach-sg__cap,
.ach-sg.is-anim .ach-sg__item:not(.is-ready) .ach-sg__btns{opacity:0!important;pointer-events:none!important}

.ach-sg__btn{
	position:relative;display:inline-flex;align-items:center;justify-content:center;gap:.45em;
	text-decoration:none!important;white-space:nowrap;cursor:pointer;
	font-size:14px;font-weight:500;line-height:1;
	border-radius:var(--sg-btn-radius,999px);
	transition:background-color .25s ease,color .25s ease,transform .25s ease;
}
.ach-sg__btn:hover{transform:translateY(-1px)}
.ach-sg__btn:focus-visible{outline:2px solid #fff;outline-offset:2px}
.ach-sg__ico{display:inline-flex;width:var(--sg-ico,16px);height:var(--sg-ico,16px)}
.ach-sg__ico svg,.ach-sg__ico i{width:100%;height:100%;font-size:var(--sg-ico,16px);line-height:1;display:block}
.ach-sg__ico svg{fill:none;stroke:currentColor}
.ach-sg__ico svg.is-fill{fill:currentColor;stroke:none}

/* Button look per device: text (pill) / icon (round) */
@media (min-width:1025px){
	.ach-sg__btn.is-text{padding:var(--sg-btn-pad,10px 16px)}
	.ach-sg__btn--1.is-text{background:var(--sg-b1t-bg,#fff);color:var(--sg-b1t-c,#1d1d1b)}
	.ach-sg__btn--2.is-text{background:var(--sg-b2t-bg,#fff);color:var(--sg-b2t-c,#1d1d1b)}
	.ach-sg__btn.is-icon{width:var(--sg-circle,44px);height:var(--sg-circle,44px);padding:0}
	.ach-sg__btn.is-icon .ach-sg__txt{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
	.ach-sg__btn--1.is-icon{background:var(--sg-b1i-bg,#fff);color:var(--sg-b1i-c,#1d1d1b)}
	.ach-sg__btn--2.is-icon{background:var(--sg-b2i-bg,#2b2b2b);color:var(--sg-b2i-c,#fff)}
}
@media (min-width:768px) and (max-width:1024px){
	.ach-sg__btn.t-text{padding:var(--sg-btn-pad,9px 14px)}
	.ach-sg__btn--1.t-text{background:var(--sg-b1t-bg,#fff);color:var(--sg-b1t-c,#1d1d1b)}
	.ach-sg__btn--2.t-text{background:var(--sg-b2t-bg,#fff);color:var(--sg-b2t-c,#1d1d1b)}
	.ach-sg__btn.t-icon{width:var(--sg-circle,44px);height:var(--sg-circle,44px);padding:0}
	.ach-sg__btn.t-icon .ach-sg__txt{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
	.ach-sg__btn--1.t-icon{background:var(--sg-b1i-bg,#fff);color:var(--sg-b1i-c,#1d1d1b)}
	.ach-sg__btn--2.t-icon{background:var(--sg-b2i-bg,#2b2b2b);color:var(--sg-b2i-c,#fff)}
}
@media (max-width:767px){
	.ach-sg__btn.m-text{padding:var(--sg-btn-pad,8px 12px);font-size:13px}
	.ach-sg__btn--1.m-text{background:var(--sg-b1t-bg,#fff);color:var(--sg-b1t-c,#1d1d1b)}
	.ach-sg__btn--2.m-text{background:var(--sg-b2t-bg,#fff);color:var(--sg-b2t-c,#1d1d1b)}
	.ach-sg__btn.m-icon{width:var(--sg-circle,40px);height:var(--sg-circle,40px);padding:0}
	.ach-sg__btn.m-icon .ach-sg__txt{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
	.ach-sg__btn--1.m-icon{background:var(--sg-b1i-bg,#fff);color:var(--sg-b1i-c,#1d1d1b)}
	.ach-sg__btn--2.m-icon{background:var(--sg-b2i-bg,#2b2b2b);color:var(--sg-b2i-c,#fff)}
}
.ach-sg__btn:hover{background:var(--sg-bh-bg,#8ac33e)!important;color:var(--sg-bh-c,#fff)!important}

/* Finished collage without animation (reduced motion, editor "final", animation off) */
.ach-sg.is-static .ach-sg__item{transform:none!important;opacity:1!important;filter:none!important}
.ach-sg.is-scroll.is-static{height:auto}
.ach-sg.is-scroll.is-static .ach-sg__sticky{position:relative;top:0;height:var(--sg-h,90vh)}

/* Tablet & phone, "Automatic" height (default): the collage height follows the
   width, spacing never below 12px, gap never below 8px, and negative margins
   given to this widget are ignored there — it can never overlap the next section. */
@media (max-width:1024px){
	.ach-sg.tm-auto:not(.t-simple):not(.m-simple){height:auto}
	.ach-sg.tm-auto .ach-sg__item{--gg:max(var(--sg-g,8px),8px)}
	.ach-sg.tm-auto.is-view .ach-sg__sticky,
	.ach-sg.tm-auto.is-scroll .ach-sg__sticky{
		position:relative;top:0;height:auto;display:block;
		padding:max(var(--sg-pad,24px),12px) max(var(--sg-pad-x,var(--sg-pad,24px)),12px);
	}
	.ach-sg.tm-auto .ach-sg__stage{
		width:auto;max-width:var(--sg-maxw,1600px);margin:0 auto;
		height:calc((100vw - 2 * max(var(--sg-pad-x,var(--sg-pad,24px)),12px)) * var(--sg-rt,.72));
	}
	.elementor-widget-ach-scroll-gallery:has(.ach-sg.tm-auto) > .elementor-widget-container{margin-top:0!important;margin-bottom:0!important}
	.ach-sg.tm-auto .ach-sg__cap{font-size:13px;padding:22px 10px 9px}
	.ach-sg.tm-auto.is-scroll{height:auto}
}
@media (max-width:767px){
	.ach-sg.tm-auto .ach-sg__stage{height:calc((100vw - 2 * max(var(--sg-pad-x,var(--sg-pad,24px)),12px)) * var(--sg-rm,1.6))}
	.ach-sg.tm-auto .ach-sg__item{--gg:max(var(--sg-g,8px),6px)}
}

/* Simple grid (per device) */
/* grid width from the screen width (container units / aspect-ratio collapse inside Elementor's flex containers) */
.ach-sg{--sg-cw:calc(100vw - 2 * var(--sg-pad-x,var(--sg-pad,40px)))}
@media (min-width:1025px){.ach-sg{--sg-cw:min(var(--sg-maxw,1600px),calc(100vw - 2 * var(--sg-pad-x,var(--sg-pad,40px))))}}
@media (min-width:1025px){
	.ach-sg.d-simple{height:auto}
	.ach-sg.d-simple .ach-sg__sticky{position:relative;top:0;height:auto;display:block;padding:var(--sg-pad,40px) var(--sg-pad-x,var(--sg-pad,40px))}
	.ach-sg.d-simple .ach-sg__stage{width:auto;max-width:var(--sg-maxw,1600px);margin:0 auto;height:auto;display:grid;grid-template-columns:repeat(var(--sg-cols,4),1fr);gap:var(--sg-gap,10px)}
	.ach-sg.d-simple .ach-sg__item{position:relative;left:auto;top:auto;width:auto;height:calc((var(--sg-cw) - (var(--sg-cols,4) - 1) * var(--sg-gap,10px)) / var(--sg-cols,4) * var(--sg-sr,100) / 100);transform:none!important;opacity:1!important;filter:none!important}
	.ach-sg.d-simple .ach-sg__item--1{grid-column:1/-1;height:calc(var(--sg-cw) * .45)}
}
@media (min-width:768px) and (max-width:1024px){
	.ach-sg.t-simple{height:auto}
	.ach-sg.t-simple .ach-sg__sticky{position:relative;top:0;height:auto;display:block;padding:var(--sg-pad,32px) var(--sg-pad-x,var(--sg-pad,32px))}
	.ach-sg.t-simple .ach-sg__stage{width:auto;height:auto;display:grid;grid-template-columns:repeat(var(--sg-cols,3),1fr);gap:var(--sg-gap,10px)}
	.ach-sg.t-simple .ach-sg__item{position:relative;left:auto;top:auto;width:auto;height:calc((var(--sg-cw) - (var(--sg-cols,3) - 1) * var(--sg-gap,10px)) / var(--sg-cols,3) * var(--sg-sr,100) / 100);transform:none!important;opacity:1!important;filter:none!important}
	.ach-sg.t-simple .ach-sg__item--1{grid-column:1/-1;height:calc(var(--sg-cw) * .56)}
}
@media (max-width:767px){
	.ach-sg.m-simple{height:auto}
	.ach-sg.m-simple .ach-sg__sticky{position:relative;top:0;height:auto;display:block;padding:var(--sg-pad,24px) var(--sg-pad-x,var(--sg-pad,24px))}
	.ach-sg.m-simple .ach-sg__stage{width:auto;height:auto;display:grid;grid-template-columns:repeat(var(--sg-cols,2),1fr);gap:var(--sg-gap,8px)}
	.ach-sg.m-simple .ach-sg__item{position:relative;left:auto;top:auto;width:auto;height:calc((var(--sg-cw) - (var(--sg-cols,2) - 1) * var(--sg-gap,8px)) / var(--sg-cols,2) * var(--sg-sr,100) / 100);transform:none!important;opacity:1!important;filter:none!important}
	.ach-sg.m-simple .ach-sg__item--1{grid-column:1/-1;height:calc(var(--sg-cw) * .625)}
}

@media (prefers-reduced-motion:reduce){
	.ach-sg__img img,.ach-sg__btns,.ach-sg__cap{transition:none}
	.ach-sg.is-pre .ach-sg__item{opacity:1}
}
