/* Saudi Perfumes Phase 2.8.0 — UX hardening */
@media (max-width: 767px) {
  :root { --sp-mobile-nav-h: 72px; --sp-mobile-action-h: 76px; }

  /* Product page: one clear purchase surface on mobile. */
  body:has(.sp-premium-pdp) .sp-premium-pdp .af-pdp-purchase {
    display: none !important;
  }
  body:has(.sp-premium-pdp) .af-pdp-mobile-sticky {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    bottom: calc(var(--sp-mobile-nav-h) + env(safe-area-inset-bottom)) !important;
    min-height: var(--sp-mobile-action-h) !important;
    padding: 9px 12px !important;
    border-radius: 0 !important;
  }
  body:has(.sp-premium-pdp) .af-pdp-mobile-sticky-actions {
    grid-template-columns: 98px 74px !important;
  }
  body:has(.sp-premium-pdp) .af-pdp-mobile-sticky .af-pdp-qty,
  body:has(.sp-premium-pdp) .af-pdp-mobile-sticky .btn {
    min-height: 46px !important;
  }
  body:has(.sp-premium-pdp) {
    padding-bottom: calc(var(--sp-mobile-nav-h) + var(--sp-mobile-action-h) + 28px + env(safe-area-inset-bottom)) !important;
  }

  /* Keep product imagery premium but prevent it from swallowing small screens. */
  .sp-premium-pdp .af-pdp-main-image {
    height: clamp(300px, 78vw, 390px) !important;
    min-height: 300px !important;
  }
  .sp-premium-pdp .af-pdp-main-image img {
    padding: clamp(14px, 5vw, 24px) !important;
  }
  .sp-premium-pdp .sp-variant-options {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 8px !important;
  }
  .sp-premium-pdp .sp-variant-option {
    min-height: 58px !important;
  }

  /* Cart + Checkout: fixed CTAs sit above the app navigation and never cover fields. */
  body:has(.af-cart-page),
  body:has(.af-checkout-page) {
    padding-bottom: calc(var(--sp-mobile-nav-h) + 86px + env(safe-area-inset-bottom)) !important;
  }
  .af-cart-mobile-checkout,
  .af-checkout-mobile-submit {
    bottom: calc(var(--sp-mobile-nav-h) + env(safe-area-inset-bottom)) !important;
    min-height: 72px !important;
    padding: 10px 12px !important;
    border-top-color: #ddd5c8 !important;
    background: rgba(255,253,249,.98) !important;
    box-shadow: 0 -12px 30px rgba(34,29,20,.10) !important;
  }
  .af-cart-mobile-checkout .btn,
  .af-checkout-mobile-submit .btn {
    min-height: 48px !important;
    border-radius: 999px !important;
  }

  /* iOS: 16px prevents browser zoom when focusing checkout inputs. */
  .af-checkout-page input.form-control,
  .af-checkout-page select.form-select,
  .af-checkout-page textarea.form-control,
  .af-coupon-form input.form-control {
    font-size: 16px !important;
  }

  /* Comfortable touch targets throughout commerce. */
  .af-cart-qty-control button,
  .af-pdp-qty button,
  .sp-variant-option,
  .af-choice-card {
    touch-action: manipulation;
  }
  .af-cart-qty-control button,
  .af-pdp-qty button {
    min-width: 40px;
    min-height: 40px;
  }
}

@media (max-width: 390px) {
  .sp-premium-pdp .sp-variant-options { grid-template-columns: 1fr 1fr !important; }
  body:has(.sp-premium-pdp) .af-pdp-mobile-sticky-info span { max-width: 135px; }
}
