/* GAINVO Storefront v0.10.9 — Step 6: Basket & Checkout native refinement */

:root{
  --gv-sheet-radius:26px;
  --gv-touch:44px;
  --gv-sheet-max:760px;
}

/* Bottom sheets: one fixed shell, one scroll owner, stable footer. */
.cart-sheet,
.checkout-sheet{
  width:min(100%,var(--gv-sheet-max));
  max-height:min(92dvh,calc(100dvh - max(8px,var(--safe-top,0px))));
  padding:8px 0 max(10px,var(--safe-bottom,0px));
  border-radius:var(--gv-sheet-radius) var(--gv-sheet-radius) 0 0;
  overflow:hidden!important;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr) auto;
  overscroll-behavior:contain;
  touch-action:pan-y;
}
.cart-sheet>.sheet-handle,.checkout-sheet>.sheet-handle{grid-row:1;margin:2px auto 6px}
.cart-sheet>.sheet-head,.checkout-sheet>.sheet-head{
  grid-row:2;
  padding:8px 18px 12px;
  border-bottom:1px solid var(--line);
  background:#fff;
  z-index:3;
}
.cart-sheet>.sheet-head h2,.checkout-sheet>.sheet-head h2{
  margin:2px 0 0;
  font-size:clamp(1.35rem,4.8vw,1.7rem);
  line-height:1.12;
}
.cart-sheet>.sheet-head .micro,.checkout-sheet>.sheet-head .micro{font-size:.74rem;letter-spacing:.08em}
.cart-sheet>.sheet-head .close-button,.checkout-sheet>.sheet-head .close-button{
  min-width:var(--gv-touch);min-height:var(--gv-touch);width:var(--gv-touch);height:var(--gv-touch);
}

#cartItems,#checkoutBody{
  grid-row:3;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-y:contain;
  scrollbar-gutter:stable;
}
#cartItems{padding:14px 16px 6px}
#checkoutBody{padding:12px 16px 18px;scroll-padding:18px 0 110px}
.cart-footer{
  grid-row:4;
  margin:0;
  padding:12px 16px calc(8px + max(0px,var(--safe-bottom,0px)));
  border-top:1px solid var(--line);
  background:rgba(255,255,255,.97);
  box-shadow:0 -10px 28px rgba(15,49,88,.07);
  z-index:4;
}

/* Basket typography and item cards. */
.cart-items{gap:10px;margin:0}
.cart-line{
  grid-template-columns:68px minmax(0,1fr) auto;
  gap:12px;
  padding:12px;
  border-radius:18px;
  background:#fff;
  box-shadow:0 4px 16px rgba(15,49,88,.035);
}
.cart-line-visual{width:68px;height:68px;border-radius:15px}
.cart-line h3{font-size:clamp(.95rem,3.8vw,1.03rem);line-height:1.28;margin:0 0 4px;font-weight:850}
.cart-line p,.cart-line-shop{font-size:.82rem!important;line-height:1.35;color:var(--muted)}
.cart-line-meta{display:flex;flex-wrap:wrap;gap:5px;color:#50677b;font-size:.82rem;font-weight:700;margin-top:5px}
.cart-line-side{min-width:118px;gap:8px}
.cart-line-total{font-size:.98rem;line-height:1.2}
.cart-line-remove{
  border:0;background:transparent;color:#8a5b5b;padding:4px 0;min-height:30px;
  font:inherit;font-size:.78rem;font-weight:800;text-decoration:underline;text-underline-offset:2px;
}
.qty-control.cart-qty{gap:7px}
.qty-control.cart-qty button{
  width:var(--gv-touch);height:var(--gv-touch);min-width:var(--gv-touch);min-height:var(--gv-touch);
  border-radius:13px;font-size:1.2rem;font-weight:800;
}
.qty-control.cart-qty strong{min-width:28px;text-align:center;font-size:.95rem}
.cart-total{align-items:flex-end;margin:0 0 10px;gap:14px}
.cart-total span{font-size:.9rem;line-height:1.25}
.cart-total span small{display:block;font-size:.72rem;color:var(--muted);font-weight:750;margin-bottom:2px}
.cart-total>strong{font-size:clamp(1.3rem,5vw,1.6rem)}
.cart-security-note{margin:8px 0 12px;padding:11px;border-radius:14px}
.cart-security-note p{font-size:.78rem!important;line-height:1.45!important;color:#60786f}
.cart-security-note p strong{color:#31594f}
.cart-closed-note{font-size:.8rem!important;line-height:1.4;margin:8px 0 0}
.checkout-button{
  min-height:50px;
  padding:13px 16px;
  border-radius:15px;
  font-size:.95rem;
  line-height:1.2;
}
.checkout-button:disabled{opacity:.55}
.cart-empty-state{padding:32px 14px}
.cart-empty-state h2{font-size:1.25rem}.cart-empty-state p{font-size:.9rem;line-height:1.5}

/* Checkout shell and progress. */
.checkout-sheet{grid-template-rows:auto auto minmax(0,1fr)}
.checkout-progress{gap:6px;margin:1px 0 12px;font-size:.76rem;line-height:1.15}
.checkout-progress span{min-height:42px;padding:7px 5px;border-radius:12px}
.checkout-live-summary{gap:12px;padding:15px;border-radius:18px;margin-bottom:12px}
.checkout-live-summary .micro{font-size:.72rem}
.checkout-live-summary h3{font-size:1.12rem;line-height:1.2}
.checkout-live-summary p{font-size:.82rem!important;line-height:1.35}
.checkout-total-lockup span{font-size:.72rem}
.checkout-total-lockup strong{font-size:clamp(1.45rem,5vw,1.75rem)}
.checkout-total-lockup small{font-size:.73rem!important;line-height:1.25;margin-top:4px}

.checkout-preview-card{padding:14px;border-radius:18px;margin:10px 0}
.checkout-preview-card>.micro,.checkout-payment-card .micro{font-size:.72rem;letter-spacing:.07em}
.checkout-preview-card h3{font-size:1.03rem;line-height:1.28;margin:4px 0 9px}
.checkout-preview-card p,.checkout-section-help{font-size:.84rem!important;line-height:1.5!important}
.fulfilment-select{gap:9px}
.checkout-sheet .fulfilment-option{
  min-height:64px;
  padding:10px 11px;
  border-radius:15px;
  grid-template-columns:38px 1fr;
  gap:9px;
}
.checkout-sheet .fulfilment-option>span{width:38px;height:38px;border-radius:11px}
.checkout-sheet .fulfilment-option strong{font-size:.9rem!important;line-height:1.2}
.checkout-sheet .fulfilment-option small{font-size:.77rem!important;line-height:1.35}
.pickup-directions-link{min-height:58px;padding:10px 11px}
.pickup-directions-link strong{font-size:.88rem!important}.pickup-directions-link small{font-size:.76rem!important;line-height:1.35}

/* Contact fields: keep iOS from zooming and keep text comfortably readable. */
.checkout-fields{gap:12px}
.checkout-fields label,.checkout-location-input{font-size:.88rem!important;line-height:1.3}
.checkout-fields input,.checkout-fields textarea,.checkout-location-input input{
  min-height:48px;
  font-size:16px!important;
  line-height:1.3;
  border-radius:13px;
  padding:12px 13px;
}
.checkout-fields textarea{min-height:86px;resize:vertical}
.checkout-fields .required-copy{font-size:.75rem!important}
.field-help,.field-error{font-size:.76rem!important;line-height:1.4!important}
.checkout-note>small{font-size:.76rem!important}

/* Delivery selector and saved addresses. */
.checkout-location-title{align-items:center}
.checkout-location-current{
  min-height:var(--gv-touch);padding:9px 12px;border-radius:13px;font-size:.84rem!important
}
.checkout-saved-addresses{gap:9px;margin:11px 0}
.checkout-saved-address{min-height:84px;padding:11px;border-radius:14px;gap:3px}
.checkout-saved-address strong{font-size:.88rem!important}
.checkout-saved-address span{font-size:.78rem!important;line-height:1.35}
.checkout-saved-address small{font-size:.73rem!important}
.checkout-location-search-row{grid-template-columns:minmax(0,1fr) auto;gap:8px}
.checkout-location-search-row button{
  min-width:76px;min-height:48px;padding:0 14px;border-radius:12px;font-size:.84rem!important
}
.checkout-location-results{border-radius:12px;padding:4px}
.checkout-location-results button{min-height:46px;padding:10px 11px;font-size:.84rem!important;line-height:1.35}
.checkout-location-results p{font-size:.78rem!important;line-height:1.4}
.checkout-map-help{font-size:.75rem!important;line-height:1.4}
.checkout-location-status{padding:11px;border-radius:14px;grid-template-columns:34px 1fr;gap:9px}
.checkout-location-status>span{width:34px;height:34px}
.checkout-location-status strong{font-size:.86rem!important;line-height:1.3}
.checkout-location-status small{font-size:.76rem!important;line-height:1.4}
.checkout-delivery-map{height:clamp(190px,30dvh,250px);border-radius:14px}

/* Payment and totals. */
.checkout-breakdown{display:grid;gap:7px;margin:10px 0 2px;padding:12px 13px;border:1px solid var(--line);border-radius:15px;background:#f8fafc}
.checkout-breakdown-row{display:flex;justify-content:space-between;gap:16px;font-size:.84rem;color:#60758a}
.checkout-breakdown-row strong{color:var(--ink);font-size:.88rem}
.checkout-breakdown-row.total{padding-top:8px;border-top:1px solid var(--line);font-weight:850;color:var(--ink)}
.checkout-breakdown-row.total strong{font-size:1rem}
.checkout-payment-card{grid-template-columns:44px minmax(0,1fr);gap:11px;padding:14px;border-radius:18px}
.checkout-payment-icon{width:44px;height:44px;border-radius:13px}
.checkout-payment-card h3{font-size:1rem!important;line-height:1.25}
.checkout-payment-card p{font-size:.83rem!important;line-height:1.5}
.checkout-payment-methods{gap:7px}
.checkout-payment-methods span{min-height:34px;padding:6px 10px;font-size:.76rem!important}
.checkout-reservation-note{padding:11px;border-radius:14px}
.checkout-reservation-note p{font-size:.82rem!important;line-height:1.45}
.checkout-final-note{font-size:.76rem!important;line-height:1.45;margin:8px 8px 2px}
.checkout-attention{padding:12px 13px}
.checkout-attention strong{font-size:.9rem!important}.checkout-attention p{font-size:.8rem!important;line-height:1.45}
.checkout-loading{padding:34px 10px}.checkout-loading h3{font-size:1.08rem}.checkout-loading p{font-size:.86rem;line-height:1.45}

/* Native press feedback without excessive motion. */
.cart-line-remove,.qty-control.cart-qty button,.checkout-button,.checkout-sheet .fulfilment-option,.checkout-location-current,.checkout-location-search-row button,.checkout-saved-address{
  -webkit-tap-highlight-color:transparent;
  transition:transform .14s ease,background-color .14s ease,border-color .14s ease,opacity .14s ease;
}
@media (hover:none){
  .cart-line-remove:active,.qty-control.cart-qty button:active,.checkout-button:active,.checkout-sheet .fulfilment-option:active,.checkout-location-current:active,.checkout-location-search-row button:active,.checkout-saved-address:active{transform:scale(.98)}
}

/* Short phones: maximise usable visual viewport without hiding actions. */
@media (max-width:620px){
  .cart-sheet,.checkout-sheet{width:100%;max-height:calc(var(--checkout-vv-height,100dvh) - max(4px,var(--checkout-vv-top,0px)));border-radius:24px 24px 0 0}
  .cart-line{grid-template-columns:60px minmax(0,1fr);align-items:start}
  .cart-line-visual{width:60px;height:60px}
  .cart-line-side{grid-column:2;min-width:0;width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:8px;margin-top:5px}
  .cart-line-total{justify-self:start}
  .cart-line-remove{justify-self:end}
  .checkout-live-summary{grid-template-columns:minmax(0,1fr) auto}
  .checkout-total-lockup{padding-left:10px}
  .checkout-saved-addresses{grid-template-columns:1fr}
  .checkout-saved-address span{white-space:normal}
}
@media (max-width:390px){
  #cartItems,#checkoutBody{padding-left:12px;padding-right:12px}
  .cart-footer{padding-left:12px;padding-right:12px}
  .fulfilment-select{grid-template-columns:1fr}
  .checkout-location-title{display:block}
  .checkout-location-current{width:100%;margin-top:8px}
  .checkout-live-summary{grid-template-columns:1fr}
  .checkout-total-lockup{text-align:left;padding:10px 0 0;border-left:0;border-top:1px solid rgba(255,255,255,.2)}
}

/* Desktop/tablet: modal-like sheet with comfortable density. */
@media (min-width:760px){
  .cart-sheet,.checkout-sheet{bottom:24px;border-radius:26px;max-height:min(88dvh,820px);width:min(720px,calc(100% - 48px));padding-bottom:0}
  .cart-footer{padding-bottom:14px}
  #cartItems,#checkoutBody{padding-left:20px;padding-right:20px}
  .cart-sheet>.sheet-head,.checkout-sheet>.sheet-head{padding-left:20px;padding-right:20px}
}

/* Dark theme parity. */
html[data-theme="dark"] .cart-sheet,
html[data-theme="dark"] .checkout-sheet,
html[data-theme="dark"] .cart-sheet>.sheet-head,
html[data-theme="dark"] .checkout-sheet>.sheet-head,
html[data-theme="dark"] .cart-footer{background:#0f1b24!important;border-color:#2a3b47!important;color:#edf5f8}
html[data-theme="dark"] .cart-line,
html[data-theme="dark"] .checkout-breakdown{background:#13212b!important;border-color:#2a3b47!important}
html[data-theme="dark"] .cart-line-meta,
html[data-theme="dark"] .cart-line p{color:#9fb0bd!important}
html[data-theme="dark"] .cart-security-note{background:#112720!important;border-color:#244a3f!important}
html[data-theme="dark"] .cart-security-note p{color:#9ec7bb!important}
html[data-theme="dark"] .cart-security-note p strong{color:#d5eee7!important}
html[data-theme="dark"] .checkout-breakdown-row{color:#9fb1bf}.checkout-breakdown-row strong{color:inherit}
html[data-theme="dark"] .checkout-breakdown-row strong,html[data-theme="dark"] .checkout-breakdown-row.total{color:#eef5f8}
html[data-theme="dark"] .checkout-location-search-row button{background:#16232c!important;border-color:#30414d!important;color:#e7f0f3!important}

@media (prefers-reduced-motion:reduce){
  .cart-line-remove,.qty-control.cart-qty button,.checkout-button,.checkout-sheet .fulfilment-option,.checkout-location-current,.checkout-location-search-row button,.checkout-saved-address{transition:none!important}
}
