/* The owner of mobile purchase geometry. Keep purchase state in Woo/QO.
 * Acceptance: 320px reflow, short viewport/keyboard, 44px primary targets,
 * one active modal, content scroll independent of its checkout action.
 */
:root {
  --sst-purchase-dock-h: 0px;
  --sst-purchase-vh: 100dvh;
  --sst-purchase-vtop: 0px;
}
.sst-purchase-review-toggle,.sst-purchase-review-footer { display:none; }
@media (max-width:1024px) {
  html { scroll-padding-bottom:calc(var(--sst-purchase-dock-h) + 16px); }
  body:not(.sst-app) .sst-footer__bottom { padding-bottom:calc(var(--sst-purchase-dock-h) + 16px); }
  body:not(.sst-app) :is(.sst-qo__btn-checkout,.sst-purchase-review-checkout,.sst-purchase-review-toggle,.sst-cart-drawer__close,.sst-qo__mobile-cart-close,.sst-cart-drawer__qty-step,.sst-cart-drawer__qty-input,.sst-cart-mobile-checkout__button,.sst-sticky-cart__btn) {
    box-sizing:border-box; min-height:44px!important; height:auto!important; min-width:44px!important; touch-action:manipulation;
  }
  body:not(.sst-app) :is(.woocommerce,.sst-qo__side,.sst-cart-drawer) :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { font-size:16px!important; }
  body:not(.sst-app) :is(.sst-purchase-review-toggle,.sst-purchase-review-checkout) { font-weight:600; font-size:14px; line-height:1.35; font-family:inherit; padding:10px 12px; border:1px solid #9e2c5f; border-radius:6px; cursor:pointer; }
  body:not(.sst-app) .sst-purchase-review-toggle { display:block; background:#fff; color:#84234e; text-align:left; }
  body:not(.sst-app) .sst-purchase-review-checkout { display:block; width:100%; background:#9e2c5f; color:#fff; min-height:48px!important; font-size:15px; }
  body:not(.sst-app) .sst-purchase-review-checkout:disabled { opacity:.5; cursor:not-allowed; }
  body:not(.sst-app) :is(.sst-purchase-review-toggle,.sst-purchase-review-checkout):focus-visible { outline:3px solid #1c5a92; outline-offset:2px; }

  /* Collapsed QO: two explicit rows; optional detail never creates columns. */
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__cart {
    display:grid!important; grid-template-columns:minmax(0,1fr) minmax(112px,1fr)!important;
    grid-template-areas:"review total" "act act" "msg msg"!important;
    gap:6px 10px!important; padding:8px 12px calc(8px + env(safe-area-inset-bottom))!important;
    min-height:0!important; max-height:40dvh!important; overflow-y:auto!important;
  }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__cart > h3 { display:none!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-purchase-review-toggle { grid-area:review; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__cart-totals { grid-area:total!important; display:block!important; cursor:default; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__total { justify-content:flex-end!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__total > span:last-child { font-size:18px!important; line-height:1.35!important; white-space:normal!important; overflow-wrap:anywhere; text-align:right; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__cart-actions { display:contents!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__btn-checkout { grid-area:act!important; min-height:44px!important; font-size:14px!important; line-height:1.3!important; letter-spacing:0!important; white-space:normal!important; padding:10px 12px!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) :is(.sst-qo__bo-banner,.sst-qo__promotion-policy-note,.sst-qo__ship-summary,.sst-qo-estimate,.sst-qo__ship-detail) { display:none!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side:not(.sst-qo__side--expanded) .sst-qo__cart-message:not([hidden]) { grid-area:msg!important; position:static!important; margin:0!important; padding:4px!important; max-width:none!important; max-height:64px; overflow:auto; font-size:12px!important; }

  /* Review panel: explicit header, one scroll region, fixed in-panel footer. */
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded {
    top:var(--sst-purchase-vtop)!important; bottom:auto!important; height:var(--sst-purchase-vh)!important;
    align-items:stretch!important; z-index:2147483001!important;
  }
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded .sst-qo__cart {
    display:grid!important; grid-template-columns:minmax(0,1fr) 44px!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
    grid-template-areas:"heading close" "content content" "footer footer"!important;
    flex-wrap:nowrap!important; width:100%!important; height:100%!important;
    max-height:100%!important; min-height:0!important; gap:0!important;
    align-items:stretch!important; align-content:stretch!important;
    padding:0!important; overflow:hidden!important; border-radius:0!important;
    box-sizing:border-box!important;
  }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-qo__cart > h3 { grid-area:heading!important; margin:0!important; padding:14px 12px!important; min-width:0!important; font-size:16px!important; white-space:normal!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded .sst-qo__cart [data-qo-mobile-cart-close] { grid-area:close!important; position:static!important; margin:0!important; align-self:start!important; width:44px!important; height:44px!important; min-width:44px!important; min-height:44px!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-purchase-review-toggle { display:none!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-purchase-review-scroll {
    grid-area:content!important; min-height:0!important; min-width:0!important; height:auto!important; align-self:stretch!important; overflow:auto!important; overscroll-behavior:contain;
    padding:8px 12px 16px; border-top:1px solid #e5e5e5;
  }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-purchase-review-scroll > * { flex:0 0 auto!important; min-width:0!important; max-width:100%!important; box-sizing:border-box!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded :is(.sst-qo__cart-list,.sst-qo__cart-totals,.sst-qo__cart-actions) { position:static!important; display:block!important; width:100%!important; max-height:none!important; overflow:visible!important; margin:0 0 12px!important; padding:0!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-qo__cart-actions > * { position:static!important; width:100%!important; max-width:100%!important; box-sizing:border-box!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-qo__cart-actions .sst-qo__btn-checkout { display:none!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-purchase-review-footer { grid-area:footer; display:block; padding:8px 12px calc(8px + env(safe-area-inset-bottom)); border-top:1px solid #ddd; background:#fff; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded :is(.sst-qo__promotion-policy-note,.sst-qo__cart-message,.sst-qo__ship-summary) { position:static!important; margin:10px 0!important; padding:8px!important; font-size:12px!important; line-height:1.45!important; box-sizing:border-box!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-qo__cart-row { flex-wrap:wrap; gap:4px 8px; }
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded .sst-qo-estimate__currency-label { display:flex!important; flex-flow:column nowrap!important; align-items:stretch!important; min-width:0!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded .sst-qo-estimate__select { flex:none!important; width:100%!important; max-width:100%!important; min-width:0!important; min-height:44px!important; box-sizing:border-box!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-qo-estimate__row { flex-wrap:wrap; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-qo-estimate__row > strong { min-width:0; white-space:normal; overflow-wrap:anywhere; flex-shrink:1; }
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded .sst-qo__cart [hidden] { display:none!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded .sst-qo__ci { width:100%!important; min-width:0!important; grid-template-columns:44px minmax(0,1fr) 44px!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side--expanded :is(.sst-qo__ci button,.sst-qo__ci input) { min-width:44px!important; min-height:44px!important; height:44px!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded .sst-qo__ci-title { display:block!important; height:auto!important; max-height:none!important; white-space:normal!important; overflow:visible!important; overflow-wrap:anywhere!important; -webkit-line-clamp:unset!important; font-size:13px!important; line-height:1.4!important; }
  html body:not(.sst-app) .sst-qo .sst-qo__side.sst-qo__side--expanded .sst-qo__cart-clear { min-height:44px!important; min-width:44px!important; }

  /* The next consent/customs step takes ownership after review closes. */
  html body:not(.sst-app) .sst-qo__preorder-modal,
  html body:not(.sst-app) .sst-qo__details-gate[data-open="1"] {
    top:var(--sst-purchase-vtop)!important; bottom:auto!important;
    height:var(--sst-purchase-vh)!important; max-height:var(--sst-purchase-vh)!important;
    padding:8px 8px calc(8px + env(safe-area-inset-bottom))!important;
    box-sizing:border-box!important; z-index:2147483001!important;
    align-items:stretch!important;
  }
  html body:not(.sst-app) :is(.sst-qo__preorder-dialog,.sst-qo__details-gate-card) {
    box-sizing:border-box!important; width:100%!important; max-width:100%!important;
    max-height:100%!important; min-height:0!important; margin:0!important;
    overflow:auto!important; overscroll-behavior:contain; padding:16px!important;
  }
  html body:not(.sst-app) .sst-qo__preorder-dialog h2 { font-size:22px!important; line-height:1.3!important; }
  html body:not(.sst-app) :is(.sst-qo__preorder-actions,.sst-qo__details-gate-actions) { flex-wrap:wrap; }
  html body:not(.sst-app) :is(.sst-qo__preorder-actions,.sst-qo__details-gate-actions) button { min-height:44px!important; white-space:normal!important; }
  html body:not(.sst-app) .sst-qo__preorder-ack { min-height:44px; }

  /* Global cart and product routes share the same usable viewport. */
  html body:not(.sst-app) .sst-cart-drawer { top:var(--sst-purchase-vtop)!important; bottom:auto!important; height:var(--sst-purchase-vh)!important; max-height:var(--sst-purchase-vh)!important; max-width:100vw!important; width:min(440px,100vw)!important; display:flex!important; flex-flow:column nowrap!important; z-index:2147483001!important; box-sizing:border-box!important; }
  html body:not(.sst-app) .sst-cart-drawer__head { flex:0 0 auto!important; }
  html body:not(.sst-app) .sst-cart-drawer__body { flex:1 1 auto!important; min-height:0!important; overflow:auto!important; overscroll-behavior:contain; }
  html body:not(.sst-app) .sst-cart-drawer__foot { flex:0 0 auto!important; padding-bottom:calc(12px + env(safe-area-inset-bottom))!important; }
  html body:not(.sst-app) .sst-cart-drawer__foot .button { min-height:44px!important; white-space:normal!important; }
  html body:not(.sst-app) .sst-cart-drawer-overlay { z-index:2147483000!important; }
  html body:not(.sst-app) .sst-sticky-cart { padding-bottom:calc(10px + env(safe-area-inset-bottom))!important; box-sizing:border-box; }
  html body:not(.sst-app) .sst-cart-drawer__qty-control { display:inline-grid; grid-template-columns:44px 48px 44px; max-width:100%; }
  html body:not(.sst-app) :is(.sst-cart-drawer__name,.sst-sticky-cart__name) { overflow-wrap:anywhere; }
  html body:not(.sst-app) .woocommerce :is(.form-row,.woocommerce-input-wrapper,.select2-container) { min-width:0; max-width:100%; }
  html body:not(.sst-app) .woocommerce :is(input,select,textarea) { box-sizing:border-box; max-width:100%; }
  html body:not(.sst-app) .woocommerce :is(button.button,a.checkout-button,#place_order) { min-height:44px; white-space:normal; line-height:1.4; }

  /* Supporting widgets live in normal page flow, never over merchandise. */
  html body:not(.sst-app) .sst-order-help-chat:not([data-open="1"]) { position:relative!important; top:auto!important; right:auto!important; bottom:auto!important; left:auto!important; margin:16px 12px calc(var(--sst-purchase-dock-h) + 16px)!important; z-index:1!important; }
  html body:not(.sst-app) .sst-order-help-chat:not([data-open="1"]) .sst-ohc-launcher { width:auto!important; max-width:100%; height:auto; min-height:44px; padding:12px 16px; gap:12px; border-radius:6px; }
  html body:not(.sst-app) .sst-order-help-chat:not([data-open="1"]) .sst-ohc-launcher__label { position:static; width:auto; height:auto; clip:auto; overflow:visible; white-space:normal; }
  html body:not(.sst-app) .sst-preorder-pop { position:relative!important; inset:auto!important; margin:12px!important; max-width:calc(100% - 24px)!important; }
  html body:not(.sst-app) .sstt-toasts { bottom:calc(var(--sst-purchase-dock-h) + 12px)!important; max-width:calc(100vw - 24px)!important; pointer-events:none; }
  html body:not(.sst-app):is(.sst-qo-panel-open,.sst-cart-open,.sst-purchase-gate-open) :is(.sst-order-help-chat,.sst-preorder-pop,#google-merchantwidget-iframe-wrapper,.sstt-toasts) { visibility:hidden!important; pointer-events:none!important; }
  html body:not(.sst-app).sst-cart-open .sst-qo__side:not(.sst-qo__side--expanded),
  html body:not(.sst-app).sst-purchase-gate-open .sst-qo__side,
  html body:not(.sst-app):is(.sst-qo-panel-open,.sst-cart-open,.sst-purchase-gate-open) :is(.sst-sticky-cart,.sst-cart-mobile-checkout,.sst-co-bar),
  html body:not(.sst-app).sst-purchase-keyboard :is(.sst-qo__side:not(.sst-qo__side--expanded),.sst-sticky-cart,.sst-cart-mobile-checkout,.sst-co-bar) { visibility:hidden!important; pointer-events:none!important; }
}
