/* =========================================================
   RYHA 3.1.54 – native product gallery
   Be FlexSlider / PhotoSwipe / Astra gallery DOM.
   ========================================================= */
body.single-product .ryha-product-top-grid > .ryha-product-gallery{
  grid-column:1!important;
  grid-row:1!important;
  float:none!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0!important;
  box-sizing:border-box!important;
  align-self:start!important;
}

.ryha-product-gallery{
  position:relative;
  min-width:0;
  contain:layout style;
}

.ryha-product-gallery__stage{
  position:relative;
  display:grid;
  place-items:center;
  width:100%;
  aspect-ratio:1 / 1;
  min-height:320px;
  overflow:hidden;
  border:1px solid #edf1ed;
  border-radius:22px;
  background:linear-gradient(180deg,#fff 0%,#fcfdfc 100%);
  box-shadow:0 12px 34px rgba(15,23,42,.055);
  isolation:isolate;
}

.ryha-product-gallery__stage:focus-visible{
  outline:2px solid rgba(60,176,67,.55);
  outline-offset:3px;
}

.ryha-product-gallery__main-button{
  appearance:none!important;
  -webkit-appearance:none!important;
  position:absolute!important;
  inset:0!important;
  z-index:1!important;
  display:grid!important;
  place-items:center!important;
  width:100%!important;
  height:100%!important;
  margin:0!important;
  padding:clamp(18px,3vw,36px)!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  cursor:zoom-in!important;
}

.ryha-product-gallery__main-button:hover,
.ryha-product-gallery__main-button:focus,
.ryha-product-gallery__main-button:focus-visible{
  background:transparent!important;
  box-shadow:none!important;
  transform:none!important;
  outline:0!important;
}

.ryha-product-gallery__main-image{
  display:block!important;
  width:auto!important;
  height:auto!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:contain!important;
  object-position:center!important;
  margin:auto!important;
  user-select:none;
  -webkit-user-drag:none;
  transition:opacity .14s ease,transform .22s ease;
}
.ryha-product-gallery.is-switching .ryha-product-gallery__main-image{opacity:.72;transform:scale(.992)}

.ryha-product-gallery__nav{
  appearance:none!important;
  position:absolute!important;
  top:50%!important;
  z-index:5!important;
  width:44px!important;
  height:44px!important;
  min-width:44px!important;
  min-height:44px!important;
  padding:0!important;
  border:1px solid rgba(25,78,37,.12)!important;
  border-radius:999px!important;
  display:grid!important;
  place-items:center!important;
  background:rgba(255,255,255,.94)!important;
  color:#245f31!important;
  box-shadow:0 8px 22px rgba(15,23,42,.11)!important;
  transform:translateY(-50%)!important;
  opacity:.9;
  cursor:pointer!important;
  transition:opacity .16s ease,background .16s ease,box-shadow .16s ease!important;
}
.ryha-product-gallery__nav--prev{left:14px!important}
.ryha-product-gallery__nav--next{right:14px!important}
.ryha-product-gallery__nav:hover,.ryha-product-gallery__nav:focus-visible{opacity:1;background:#f3fbf4!important;box-shadow:0 10px 26px rgba(15,23,42,.15)!important}
.ryha-product-gallery__nav svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

.ryha-product-gallery__counter{
  position:absolute;
  left:14px;
  bottom:14px;
  z-index:5;
  display:inline-flex;
  align-items:center;
  gap:4px;
  min-height:28px;
  padding:0 10px;
  border:1px solid rgba(25,78,37,.10);
  border-radius:999px;
  background:rgba(255,255,255,.92);
  color:#496052;
  font-size:11px;
  font-weight:700;
  box-shadow:0 5px 14px rgba(15,23,42,.07);
  backdrop-filter:blur(8px);
}
.ryha-product-gallery__counter b{color:#208235;font-weight:850}

.ryha-product-gallery__zoom-hint{
  position:absolute;
  right:14px;
  bottom:14px;
  z-index:5;
  width:38px;
  height:38px;
  border:1px solid rgba(25,78,37,.10);
  border-radius:12px;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.92);
  color:#26923a;
  box-shadow:0 6px 16px rgba(15,23,42,.08);
  pointer-events:none;
  backdrop-filter:blur(8px);
}
.ryha-product-gallery__zoom-hint svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

.ryha-product-gallery__thumbs-wrap{position:relative;margin-top:14px;min-width:0}
.ryha-product-gallery__thumbs{
  display:grid;
  grid-auto-flow:column;
  grid-auto-columns:88px;
  gap:10px;
  width:100%;
  min-width:0;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
  scroll-snap-type:x proximity;
  scrollbar-width:thin;
  scrollbar-color:#c9decd transparent;
  padding:2px 2px 7px;
}
.ryha-product-gallery__thumbs::-webkit-scrollbar{height:5px}
.ryha-product-gallery__thumbs::-webkit-scrollbar-thumb{background:#c9decd;border-radius:99px}

.ryha-product-gallery__thumb{
  appearance:none!important;
  position:relative!important;
  scroll-snap-align:start;
  display:grid!important;
  place-items:center!important;
  width:88px!important;
  height:78px!important;
  min-width:88px!important;
  min-height:78px!important;
  margin:0!important;
  padding:5px!important;
  overflow:hidden!important;
  border:1px solid #e3eae4!important;
  border-radius:14px!important;
  background:#fff!important;
  box-shadow:none!important;
  cursor:pointer!important;
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease!important;
}
.ryha-product-gallery__thumb:hover{border-color:#bcdcc1!important;transform:translateY(-1px)!important}
.ryha-product-gallery__thumb.is-active{border:2px solid #3cb043!important;box-shadow:0 7px 17px rgba(60,176,67,.12)!important}
.ryha-product-gallery__thumb:focus-visible{outline:2px solid rgba(60,176,67,.45)!important;outline-offset:2px!important}
.ryha-product-gallery__thumb img{display:block!important;width:100%!important;height:100%!important;object-fit:contain!important;margin:0!important;border:0!important}

/* Favorite heart lieka mūsų custom galerijos viršuje. */
body.single-product .ryha-product-gallery > .ryha-fav-btn{top:14px!important;right:14px!important;z-index:8!important}

/* Lightbox – mūsų, be PhotoSwipe. */
.ryha-gallery-lightbox[hidden]{display:none!important}
.ryha-gallery-lightbox{
  position:fixed;
  inset:0;
  z-index:100500;
  display:grid;
  place-items:center;
}
.ryha-gallery-lightbox__backdrop{position:absolute;inset:0;background:rgba(5,14,8,.92);backdrop-filter:blur(6px)}
.ryha-gallery-lightbox__panel{position:relative;z-index:1;width:100%;height:100%;display:grid;place-items:center;padding:clamp(18px,3vw,42px);box-sizing:border-box}
.ryha-gallery-lightbox__image-wrap{width:100%;height:100%;display:grid;place-items:center;overflow:hidden}
.ryha-gallery-lightbox__image-wrap img{display:block;max-width:min(94vw,1500px);max-height:88vh;width:auto;height:auto;object-fit:contain;user-select:none;-webkit-user-drag:none;filter:drop-shadow(0 20px 48px rgba(0,0,0,.24))}
.ryha-gallery-lightbox__close,.ryha-gallery-lightbox__nav{
  appearance:none!important;
  position:absolute!important;
  z-index:4!important;
  display:grid!important;
  place-items:center!important;
  padding:0!important;
  border:1px solid rgba(255,255,255,.18)!important;
  background:rgba(255,255,255,.10)!important;
  color:#fff!important;
  box-shadow:none!important;
  backdrop-filter:blur(8px);
  cursor:pointer!important;
}
.ryha-gallery-lightbox__close{top:max(18px,env(safe-area-inset-top));right:max(18px,env(safe-area-inset-right));width:48px!important;height:48px!important;border-radius:15px!important}
.ryha-gallery-lightbox__nav{top:50%!important;width:52px!important;height:52px!important;border-radius:999px!important;transform:translateY(-50%)!important}
.ryha-gallery-lightbox__nav--prev{left:max(18px,env(safe-area-inset-left))!important}
.ryha-gallery-lightbox__nav--next{right:max(18px,env(safe-area-inset-right))!important}
.ryha-gallery-lightbox__close:hover,.ryha-gallery-lightbox__nav:hover{background:rgba(255,255,255,.18)!important}
.ryha-gallery-lightbox__close svg,.ryha-gallery-lightbox__nav svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ryha-gallery-lightbox__count{position:absolute;left:50%;bottom:max(18px,env(safe-area-inset-bottom));transform:translateX(-50%);z-index:4;min-height:30px;padding:0 12px;border:1px solid rgba(255,255,255,.15);border-radius:999px;display:flex;align-items:center;background:rgba(255,255,255,.10);color:#fff;font-size:12px;font-weight:750;backdrop-filter:blur(8px)}
body.ryha-gallery-open{overflow:hidden!important}

@media (max-width:921px){
  body.single-product .ryha-product-top-grid > .ryha-product-gallery{width:100%!important;max-width:100%!important;margin:0!important}
  .ryha-product-gallery__stage{min-height:0;aspect-ratio:1 / 1;border-radius:18px}
  .ryha-product-gallery__main-button{padding:18px!important}
  .ryha-product-gallery__nav{width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important}
  .ryha-product-gallery__nav--prev{left:9px!important}.ryha-product-gallery__nav--next{right:9px!important}
  .ryha-product-gallery__counter{left:10px;bottom:10px}
  .ryha-product-gallery__zoom-hint{right:10px;bottom:10px;width:36px;height:36px}
  .ryha-product-gallery__thumbs{grid-auto-columns:76px;gap:8px}
  .ryha-product-gallery__thumb{width:76px!important;height:68px!important;min-width:76px!important;min-height:68px!important;border-radius:12px!important}
  .ryha-gallery-lightbox__nav{width:44px!important;height:44px!important}
  .ryha-gallery-lightbox__nav--prev{left:8px!important}.ryha-gallery-lightbox__nav--next{right:8px!important}
  .ryha-gallery-lightbox__close{top:max(10px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right));width:44px!important;height:44px!important}
  .ryha-gallery-lightbox__panel{padding:54px 10px 52px}
  .ryha-gallery-lightbox__image-wrap img{max-width:96vw;max-height:82dvh}
}

@media (prefers-reduced-motion:reduce){
  .ryha-product-gallery__main-image,.ryha-product-gallery__nav,.ryha-product-gallery__thumb{transition:none!important}
}


/* =========================================================
   RYHA 3.1.55 – lightbox UX
   - paspaudimas už nuotraukos ribų uždaro galeriją;
   - X nuleidžiamas žemiau WordPress admin juostos.
   ========================================================= */
body.admin-bar .ryha-gallery-lightbox__close{
  top:calc(32px + max(18px,env(safe-area-inset-top)))!important;
}
@media (max-width:782px){
  body.admin-bar .ryha-gallery-lightbox__close{
    top:calc(46px + max(10px,env(safe-area-inset-top)))!important;
  }
}

/* Aiškesnis paspaudžiamas fonas, bet pati nuotrauka lieka neutrali. */
.ryha-gallery-lightbox__panel,
.ryha-gallery-lightbox__image-wrap{
  cursor:zoom-out;
}
.ryha-gallery-lightbox__image-wrap img,
.ryha-gallery-lightbox__close,
.ryha-gallery-lightbox__nav,
.ryha-gallery-lightbox__count{
  cursor:default;
}
.ryha-gallery-lightbox__close,
.ryha-gallery-lightbox__nav{
  cursor:pointer!important;
}
