/* =========================================================
   v813 — gallery radius + mobile performance
   ========================================================= */

/* ---------- mosaic size + rounded images (mobile) ---------- */
@media (max-width:991px){
  html body.nxd-page .nxd-wrap .nxd-gallery.nx790-m{padding-inline:0!important;}
  html body.nxd-page .nxd-wrap .nxd-gallery.nx790-m .nxd-g-top{width:100%!important;}
  html body.nxd-page .nxd-wrap .nxd-gallery.nx790-m .nxd-stage.nx790-on{
    width:100%!important;
    max-width:none!important;
    background:transparent!important;
    border:0!important;
    height:min(82vw,48vh)!important;
    min-height:280px!important;
    box-shadow:none!important;
  }
  html body.nxd-page .nxd-wrap .nxd-gallery.nx790-m .nx790-rail{
    width:100%!important;
    box-sizing:border-box!important;
    padding-inline:8px!important;
    gap:8px!important;
    scroll-behavior:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }
  html body.nxd-page .nxd-wrap .nxd-gallery.nx790-m .nx790-tile{
    width:100%!important;
    height:100%!important;
    overflow:hidden!important;
    border-radius:14px!important;
    -webkit-border-radius:14px!important;
    background:transparent!important;
    border:0!important;
    box-shadow:none!important;
    padding:0!important;
    transform:translateZ(0);
  }
  html body.nxd-page .nxd-wrap .nxd-gallery.nx790-m .nx790-tile img{
    width:100%!important;
    height:100%!important;
    object-fit:cover!important;
    object-position:center!important;
    border-radius:14px!important;
    -webkit-border-radius:14px!important;
    padding:0!important;
    margin:0!important;
    display:block!important;
  }
}

/* ---------- force rounded photos (desktop + mobile) ---------- */
html body.nxd-page .nx-dk-main-tile,
html body.nxd-page .nx-dk-side-tile,
html body.nxd-page .nx790-tile,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-main-tile,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-side-tile{
  background:transparent!important;
  border:0!important;
  border-radius:14px!important;
  -webkit-border-radius:14px!important;
  box-shadow:none!important;
  padding:0!important;
  overflow:hidden!important;
}
html body.nxd-page .nx-dk-main-tile::after,
html body.nxd-page .nx-dk-side-tile::after,
html body.nxd-page .nx790-tile::after,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-main-tile::after,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-side-tile::after{
  display:none!important;
  content:none!important;
  box-shadow:none!important;
}

html body.nxd-page .nx-dk-main-tile>#mainImg,
html body.nxd-page .nx-dk-main-tile>.nx-gallery-main-img,
html body.nxd-page .nx-dk-main-tile img,
html body.nxd-page .nx-dk-side-tile img,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-main-tile>#mainImg,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-main-tile>.nx-gallery-main-img,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-main-tile img,
html body.nxd-page .nxd-stage.nx-dk-gallery .nx-dk-side-tile img{
  border-radius:14px!important;
  -webkit-border-radius:14px!important;
  padding:0!important;
  margin:0!important;
  box-sizing:border-box!important;
  width:100%!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:contain!important;
  object-position:center!important;
  display:block!important;
  background:transparent!important;
}

html body.nxd-page .nx790-tile,
html body.nxd-page .nxd-gallery.nx790-m .nx790-tile{
  border-radius:14px!important;
  -webkit-border-radius:14px!important;
  overflow:hidden!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  padding:0!important;
}
html body.nxd-page .nx790-tile img,
html body.nxd-page .nxd-gallery.nx790-m .nx790-tile img{
  border-radius:14px!important;
  -webkit-border-radius:14px!important;
  padding:0!important;
  margin:0!important;
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
  object-position:center!important;
  display:block!important;
  background:transparent!important;
}

@media (max-width:900px){
  html body.nxd-page .nx-dk-main-tile,
  html body.nxd-page .nx-dk-side-tile,
  html body.nxd-page .nx790-tile,
  html body.nxd-page .nxd-gallery.nx790-m .nx790-tile{
    border-radius:12px!important;
    -webkit-border-radius:12px!important;
  }
  html body.nxd-page .nx-dk-main-tile>#mainImg,
  html body.nxd-page .nx-dk-main-tile>.nx-gallery-main-img,
  html body.nxd-page .nx-dk-main-tile img,
  html body.nxd-page .nx-dk-side-tile img,
  html body.nxd-page .nx790-tile img,
  html body.nxd-page .nxd-gallery.nx790-m .nx790-tile img{
    border-radius:12px!important;
    -webkit-border-radius:12px!important;
  }
}

html body.nxd-page .nxd-stage.nx-dk-gallery,
html body.nxd-page .nxd-stage.nx790-on{
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}

/* کارت info کمتر روی عکس‌ها */
@media (max-width:760px){
  html:root:root:root:root:root:root:root:root body.nxd-page .nxd-grid>.nxd-info{
    margin-top:-8px!important;
  }
}

/* لایت‌باکس */
html body .nx713fs-slide img,
html body .nx713fs .nx713fs-slide img{
  border-radius:12px!important;
  -webkit-border-radius:12px!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:contain!important;
}
html body .nx713fs-track{
  scroll-behavior:auto!important;
  -webkit-overflow-scrolling:touch!important;
}
html body .nx713fs-th button{
  border-radius:10px!important;
  overflow:hidden!important;
}
html body .nx713fs-th img{
  border-radius:8px!important;
}

/* =========================================================
   MOBILE PERFORMANCE (weak phones)
   ========================================================= */
@media (max-width:760px){

  /* 1) Kill expensive visual effects on product page */
  html body.nxd-page .nxd-stage,
  html body.nxd-page .nx790-tile,
  html body.nxd-page .nx-dk-main-tile,
  html body.nxd-page .nx-dk-side-tile,
  html body.nxd-page .nxd-buy,
  html body.nxd-page .nxd-tabs,
  html body.nxd-page .nx765-mobile-product,
  html body.nxd-page .nx-dk-more,
  html body.nxd-page .nx-dk-count{
    box-shadow:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
    filter:none!important;
  }

  /* 2) Cheaper sticky / fixed layers */
  html body.nxd-page .nxd-tabs,
  html body.nxd-page .nx765-mobile-product{
    background:#fff!important;
    transition:none!important;
  }
  html[data-theme="dark"] body.nxd-page .nxd-tabs,
  html[data-theme="dark"] body.nxd-page .nx765-mobile-product{
    background:#0f1b2d!important;
  }

  /* 3) Gallery scroll: auto is cheaper than smooth on weak GPUs */
  html body.nxd-page .nx790-rail,
  html body.nxd-page .nx787-rail,
  html body .nx713fs-track{
    scroll-behavior:auto!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-x:contain!important;
  }

  /* 4) Contain paint for gallery tiles */
  html body.nxd-page .nx790-tile,
  html body.nxd-page .nx-dk-main-tile,
  html body.nxd-page .nx-dk-side-tile{
    contain:layout paint style!important;
    content-visibility:auto;
  }

  /* 5) Images: avoid extra compositing cost */
  html body.nxd-page .nx790-tile img,
  html body.nxd-page .nx-dk-main-tile img,
  html body.nxd-page .nx-dk-side-tile img,
  html body.nxd-page #mainImg{
    image-rendering:auto;
    -webkit-backface-visibility:hidden;
    backface-visibility:hidden;
  }

  /* 6) Soften info card shadow (was paint-heavy) */
  html:root:root:root:root:root:root:root:root body.nxd-page .nxd-grid>.nxd-info{
    box-shadow:0 -2px 8px -4px rgba(15,23,42,.12)!important;
  }

  /* 7) Disable decorative hover/transition cost on touch */
  html body.nxd-page .nxd-cta,
  html body.nxd-page .nx754-quote,
  html body.nxd-page .nx790-tile,
  html body.nxd-page .nx-thumb{
    transition:none!important;
  }
}

/* Reduced motion users */
@media (prefers-reduced-motion:reduce){
  html body.nxd-page *{
    transition-duration:0.01ms!important;
    animation-duration:0.01ms!important;
    animation-iteration-count:1!important;
  }
  html body.nxd-page .nx790-rail,
  html body.nxd-page .nx787-rail,
  html body .nx713fs-track{
    scroll-behavior:auto!important;
  }
}

/* Very small / weak devices: even leaner */
@media (max-width:420px){
  html body.nxd-page .nxd-stage.nx790-on{
    min-height:240px!important;
    height:min(78vw,44vh)!important;
  }
  html body.nxd-page .nx790-pill,
  html body.nxd-page .nx787-prog,
  html body.nxd-page .nx787-cnt{
    box-shadow:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
}
