/* FFV6_CART_STATIC_TOP_ALIGN_V4 */

/*
  Static cart alignment fix.
  No JS. No MutationObserver. No DOM moving.
  Fixes:
  - Order Summary starting lower than Selected Items
  - Order Summary bottom getting clipped
*/

body.bw-cart-static-top-align-v4 main,
body.bw-cart-static-top-align-v4 .bw-page-shell,
body.bw-cart-static-top-align-v4 .bw-page-main,
body.bw-cart-static-top-align-v4 .bw-shell-main{
  overflow:visible !important;
}

/*
  The cart content glass band is the second major section after the hero.
  Force its two-column content to align at the top and allow vertical overflow.
*/
body.bw-cart-static-top-align-v4 main > *:nth-child(2){
  align-items:flex-start !important;
  align-content:flex-start !important;
  overflow:visible !important;
  height:auto !important;
  min-height:auto !important;
  padding-bottom:42px !important;
  box-sizing:border-box !important;
}

/* Works whether the cart band is grid or flex. */
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *{
  align-self:flex-start !important;
  vertical-align:top !important;
  margin-top:0 !important;
  transform:none !important;
  top:auto !important;
  bottom:auto !important;
  height:auto !important;
  min-height:0 !important;
  box-sizing:border-box !important;
}

/* Left Selected Items card. */
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:first-child{
  margin-top:0 !important;
  align-self:flex-start !important;
}

/* Right Order Summary card. */
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child{
  margin-top:0 !important;
  align-self:flex-start !important;
  position:relative !important;
  top:0 !important;
  transform:none !important;
  max-height:none !important;
  overflow:visible !important;
  padding-bottom:24px !important;
}

/* If the summary is wrapped one layer deeper, top-align that inner card too. */
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child > *{
  margin-top:0 !important;
  align-self:flex-start !important;
  position:relative !important;
  top:0 !important;
  transform:none !important;
  max-height:none !important;
  overflow:visible !important;
  box-sizing:border-box !important;
}

/* Prevent the right summary content from being chopped by semantic/glass overflow rules. */
body.bw-cart-static-top-align-v4 main > *:nth-child(2),
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *,
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child,
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child > *{
  overflow:visible !important;
}

/* Keep summary buttons contained. */
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child button,
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child .bw-btn,
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child a[class*="btn"],
body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *:last-child button[class*="btn"]{
  width:100% !important;
  justify-content:center !important;
}

/* Preserve mobile stack. */
@media (max-width: 980px){
  body.bw-cart-static-top-align-v4 main > *:nth-child(2){
    display:block !important;
  }

  body.bw-cart-static-top-align-v4 main > *:nth-child(2) > *{
    width:100% !important;
    max-width:100% !important;
  }
}
