.sgmc-line[hidden] { display: none; }

/* Flatsome handles the backdrop, dismissal, and focus trap. Only its mobile cart changes layout. */
.mfp-wrap:has(#cart-popup.sgmc-ready) {
  --sgmc-wine: #8a3033;
  --sgmc-ink: #322522;
  --sgmc-muted: #67554f;
  --sgmc-line: #eddeda;
  --sgmc-soft: #fbf4f1;
  z-index: 100005;
}

body:has(#cart-popup.sgmc-ready) .mfp-bg { z-index: 100004; }
body:has(#cart-popup.sgmc-ready) .mobile-footer-bar,
body:has(#cart-popup.sgmc-ready) #sangom-ssa { visibility: hidden; }

.mfp-wrap:has(#cart-popup.sgmc-ready) .mfp-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.mfp-wrap:has(#cart-popup.sgmc-ready) .mfp-container::before { display: none; }

.mfp-content.off-canvas-cart:has(#cart-popup.sgmc-ready) {
  position: relative;
  inset: auto;
  width: min(100vw, 520px);
  max-width: 100%;
  height: auto;
  max-height: 92vh;
  max-height: 92dvh;
  margin: 0;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: #fff;
  box-shadow: 0 -10px 40px #21171225;
  transform: translateY(100%);
}

.mfp-ready .mfp-content.off-canvas-cart:has(#cart-popup.sgmc-ready) { transform: translateY(0); }
.mfp-removing .mfp-content.off-canvas-cart:has(#cart-popup.sgmc-ready) { transform: translateY(100%); }

.mfp-wrap:has(#cart-popup.sgmc-ready) .mfp-close { display: none; }

#cart-popup.sgmc-ready .sgmc-close {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 3;
  top: 9px;
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--sgmc-line);
  border-radius: 10px;
  background: #fff;
  color: var(--sgmc-wine);
  font-size: 26px;
  line-height: 1;
  opacity: 1;
  mix-blend-mode: normal;
}

#cart-popup.sgmc-ready {
  width: 100%;
  height: auto;
  max-height: inherit;
  color: var(--sgmc-ink);
  background: #fff;
}

#cart-popup.sgmc-ready .cart-popup-inner {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  min-height: 0;
  height: auto;
  padding: 0;
  background: #fff;
}

#cart-popup.sgmc-ready .cart-popup-title {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 9px;
  min-height: 63px;
  margin: 0;
  padding: 17px 62px 12px 16px;
  border-bottom: 1px solid var(--sgmc-line);
  color: var(--sgmc-ink);
  text-align: left;
}

#cart-popup.sgmc-ready .cart-popup-title .heading-font {
  font-size: 23px;
  letter-spacing: -.015em;
  text-transform: none;
  line-height: 1.2;
}

#cart-popup.sgmc-ready .is-divider { display: none; }
#cart-popup.sgmc-ready .sgmc-count { color: var(--sgmc-muted); font-size: 12px; line-height: 1.2; }

#cart-popup.sgmc-ready .sgmc-status {
  width: 100%;
  color: var(--sgmc-wine);
  font-size: 12px;
  line-height: 1.25;
}

#cart-popup.sgmc-ready .sgmc-status:empty { display: none; }

#cart-popup.sgmc-ready .sgmc-status:not(.sgmc-status-visible) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#cart-popup.sgmc-ready .widget_shopping_cart,
#cart-popup.sgmc-ready .widget_shopping_cart_content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

#cart-popup.sgmc-ready ul.woocommerce-mini-cart {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 11px 12px 4px;
  overflow: auto;
  overscroll-behavior: contain;
}

#cart-popup.sgmc-ready .sgmc-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 44px;
  align-items: start;
  column-gap: 9px;
  margin: 0 0 8px;
  padding: 9px;
  border: 1px solid var(--sgmc-line);
  border-radius: 12px;
  background: #fff;
}

#cart-popup.sgmc-ready .sgmc-thumb { grid-area: 1 / 1 / 2 / 2; }
#cart-popup.sgmc-ready li.sgmc-item .sgmc-thumb img {
  display: block;
  position: static;
  float: none;
  width: 60px;
  height: 60px;
  margin: 0;
  border-radius: 7px;
  background: var(--sgmc-soft);
  object-fit: contain;
}

#cart-popup.sgmc-ready .sgmc-item-name {
  grid-area: 1 / 2 / 2 / 3;
  margin: 0;
  padding-top: 2px;
  color: var(--sgmc-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.33;
  overflow-wrap: anywhere;
  text-align: left;
}

#cart-popup.sgmc-ready .sgmc-item dl.variation {
  grid-column: 2 / -1;
  margin: 3px 0 0;
  color: var(--sgmc-muted);
  font-size: 12px;
}

#cart-popup.sgmc-ready li.sgmc-item .sgmc-remove {
  display: inline-flex;
  grid-area: 1 / 3 / 2 / 4;
  position: static;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sgmc-wine);
  font-size: 12px;
  font-weight: 650;
  opacity: 1;
}

#cart-popup.sgmc-ready .woocommerce-mini-cart-item:has(.sgmc-line:not([hidden])) .ux-mini-cart-qty { display: none; }
#cart-popup.sgmc-ready .sgmc-item .ux-mini-cart-qty { grid-column: 2 / -1; }

#cart-popup.sgmc-ready .sgmc-line:not([hidden]) {
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin-top: 4px;
}

#cart-popup.sgmc-ready .sgmc-stepper {
  display: inline-grid;
  grid-template-columns: 44px minmax(24px, auto) 44px;
  align-items: center;
  border: 1px solid var(--sgmc-line);
  border-radius: 8px;
  background: var(--sgmc-soft);
  color: var(--sgmc-ink);
  text-align: center;
}

#cart-popup.sgmc-ready .sgmc-stepper button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sgmc-wine);
  font-size: 20px;
  line-height: 1;
}

#cart-popup.sgmc-ready .sgmc-stepper button:disabled { opacity: .38; }
#cart-popup.sgmc-ready[aria-busy=true] .sgmc-stepper { opacity: .55; }
#cart-popup.sgmc-ready .sgmc-stepper output,
#cart-popup.sgmc-ready .sgmc-readonly { padding: 0 3px; font-size: 13px; font-weight: 650; }
#cart-popup.sgmc-ready .sgmc-line-price .amount { color: var(--sgmc-wine); font-size: 14px; font-weight: 800; }

#cart-popup.sgmc-ready .ux-mini-cart-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--sgmc-line);
  background: #fff;
}

#cart-popup.sgmc-ready .woocommerce-mini-cart__total {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 1;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 1px 0 3px;
  border: 0;
  color: var(--sgmc-ink);
  font-size: 14px;
}

#cart-popup.sgmc-ready .woocommerce-mini-cart__total .amount { color: var(--sgmc-wine); font-size: 19px; }
#cart-popup.sgmc-ready .woocommerce-mini-cart__buttons { display: contents; }

#cart-popup.sgmc-ready .woocommerce-mini-cart__buttons a,
#cart-popup.sgmc-ready .sgmp-cart-continue,
#cart-popup.sgmc-ready .return-to-shop a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--sgmc-line);
  border-radius: 8px;
  background: #fff;
  color: var(--sgmc-wine);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
}

#cart-popup.sgmc-ready .woocommerce-mini-cart__buttons a.checkout,
#cart-popup.sgmc-ready .return-to-shop a {
  min-height: 46px;
  border-color: var(--sgmc-wine);
  background: var(--sgmc-wine);
  color: #fff;
  font-size: 15px;
}

#cart-popup.sgmc-ready .woocommerce-mini-cart__buttons a.checkout { grid-area: 2 / 1 / 3 / -1; }
#cart-popup.sgmc-ready .woocommerce-mini-cart__buttons a:not(.checkout) { grid-area: 3 / 2 / 4 / 3; }
#cart-popup.sgmc-ready .sgmp-cart-continue { grid-area: 3 / 1 / 4 / 2; }
#cart-popup.sgmc-ready .ux-mini-cart-empty { padding: 20px 16px max(20px, env(safe-area-inset-bottom)); }
#cart-popup.sgmc-ready .ux-mini-cart-empty-icon svg { height: 44px !important; color: var(--sgmc-wine); opacity: .40 !important; }
#cart-popup.sgmc-ready .woocommerce-mini-cart__empty-message { margin: 6px 0 14px; color: var(--sgmc-ink); }
#cart-popup.sgmc-ready .return-to-shop { width: 100%; max-width: 240px; margin: 0 auto; }
#cart-popup.sgmc-ready :is(a, button):focus-visible { outline: 2px solid var(--sgmc-wine); outline-offset: 1px; }

#cart-popup:not(.sgmc-ready) :is(.sgmc-close, .sgmc-count, .sgmc-status) { display: none; }

@media (prefers-reduced-motion: reduce) {
  .mfp-content.off-canvas-cart:has(#cart-popup.sgmc-ready) { transition: none; }
}
