We present a new, fully dynamic pore-network modeling platform that is employed to conduct a systematic pore-scale study of capillary trapping under various two-phase flow conditions in a rough-walled fracture. The model rigorously solves for the fluid pressure fields, incorporates detailed descriptions of pore-scale fluid interface dynamics, and explicitly accounts for flow through wetting layers. This modeling platform further benefits from heavy parallelization and advanced domain decomposition techniques to achieve computational efficiency. We first build an equivalent pore network of a rough-walled Berea sandstone fracture using its high-resolution x-ray images. Next, to validate the dynamic model, primary drainage and imbibition simulations are conducted with fluid properties and boundary conditions matching their experimental counterparts. We show that the predicted two-phase fluid occupancy maps for both displacement processes agree well with those observed experimentally using x-ray computed tomography. Afterward, a comprehensive simulation study of flow patterns and capillary trapping during imbibition is performed under varying flow conditions, fluid properties, and initial saturations. The generated results provide significantly improved insights into the effects of wettability, gravity and viscous forces, and initial non-wetting (NW) phase saturation on the morphology and size distribution of the trapped NW phase clusters and the final residual NW phase saturation. By revealing the interplay among the capillary, buoyancy, and viscous forces, our results create a guideline on how the removal of NW phase from fractured media can be influenced by adjusting the operational settings. These findings have broad implications for predictions of capillary trapping behavior in fractured media.