/**
 * NJ — header mini-cart (hover dropdown) — isolated from theme LESS.
 * Loaded after the main theme bundle so we can win on cascade.
 *
 * 1) styles-l.css applies `.minicart-wrapper .block-minicart { right:-15px; width:390px }`
 *    (Claue _minicart @screen__m) — re-pin to the cart icon with .header-area.
 * 2) Tighten the scroll area on the items list so subtotal + actions stay in view
 *    (Claue uses a very large inner max-height).
 */

/* Desktop / tablet: align panel + sensible items scroll; no flex (avoids side-effects) */
@media (min-width: 768px) {
  .header-area:not(.minicart-slide) .minicart-wrapper .block-minicart {
    right: 0 !important;
    left: auto !important;
    width: 320px !important;
    max-width: calc(100vw - 20px) !important;
  }

  .header-area:not(.minicart-slide) .minicart-wrapper .block-minicart .block-content .minicart-items-wrapper {
    /* Original theme used ~ (100vh - 300px), which can leave no room for footer in panel */
    max-height: min(50vh, calc(100vh - 320px)) !important;
  }

  /**
   * "Column with vertical bar" (column-vertical) / left fixed menu:
   * header is 270px wide; the cart lives in that strip. A 320px panel with
   * right:0 sits ON the right edge of the strip and extends left — off-screen.
   * Match megamenu behaviour: open to the right into the main content.
   * (Theme uses body.menu-vertical-fixed .page-wrapper in compiled CSS.)
   */
  body.menu-vertical-fixed .header-area:not(.minicart-slide) .minicart-wrapper .block-minicart,
  .page-wrapper.menu-vertical-fixed .header-area:not(.minicart-slide) .minicart-wrapper .block-minicart {
    right: auto !important;
    left: 100% !important;
    margin-left: 0 !important;
    width: 320px !important;
    max-width: min(320px, calc(100vw - 290px)) !important; /* 270px bar + margin */
  }
}

/* Phone: let the open panel scroll as a whole if needed */
@media (max-width: 767px) {
  .header-area:not(.minicart-slide) .minicart-wrapper .block-minicart {
    right: 0 !important;
    max-width: calc(100vw - 20px) !important;
  }
}

/**
 * Afterpay `checkout_cart_sidebar_total_renderers.xml` injects CTA + Express Checkout
 * into `minicart -> extra_info` with NO ifconfig guard, so the admin "Enable in Mini Cart"
 * toggles don't fully remove them. Hide inside the mini-cart panel only (cart page and
 * PDP keep native behaviour).
 */
.minicart-wrapper .block-minicart #afterpay-cta-mini-cart,
.minicart-wrapper .block-minicart square-placement[id*="afterpay"],
.minicart-wrapper .block-minicart .afterpay-express-checkout-minicart-wraper,
.minicart-wrapper .block-minicart .afterpay-express-button,
#minicart-content-wrapper #afterpay-cta-mini-cart,
#minicart-content-wrapper square-placement[id*="afterpay"],
#minicart-content-wrapper .afterpay-express-checkout-minicart-wraper,
#minicart-content-wrapper .afterpay-express-button {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
