/* Responsive product-detail and checkout modal contract. */

@media (max-width: 900px) {
  .ph-storefront-root .ph-modal-dialog:not(.ph-checkout-dialog) {
    width: min(720px, calc(100vw - 24px));
    max-width: 720px;
  }

  .ph-storefront-root .ph-modal-dialog:not(.ph-checkout-dialog) .ph-modal-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 20px !important;
  }

  .ph-storefront-root .ph-modal-media-wrap {
    aspect-ratio: 16 / 10;
    max-height: 410px;
  }

  .ph-storefront-root .ph-modal-info {
    padding: 0 0 8px;
  }
}

@media (max-width: 640px) {
  .ph-storefront-root .ph-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .ph-storefront-root .ph-modal-dialog,
  .ph-storefront-root .ph-checkout-dialog,
  .ph-storefront-root .ph-modal-dialog:not(.ph-checkout-dialog) {
    width: 100% !important;
    max-width: none !important;
    max-height: 96dvh !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    border-radius: 24px 24px 0 0 !important;
  }

  .ph-storefront-root .ph-modal-close-btn {
    top: 10px !important;
    right: 10px !important;
    width: 44px !important;
    height: 44px !important;
  }

  .ph-storefront-root .ph-modal-dialog:not(.ph-checkout-dialog) .ph-modal-grid,
  .ph-storefront-root .ph-checkout-content {
    max-height: 96dvh;
    padding: 20px 14px calc(24px + env(safe-area-inset-bottom)) !important;
    scrollbar-gutter: auto;
  }

  .ph-storefront-root .ph-modal-dialog:not(.ph-checkout-dialog) .ph-modal-grid {
    padding-top: 62px !important;
  }

  .ph-storefront-root .ph-modal-media-wrap {
    aspect-ratio: 16 / 10;
    max-height: 290px;
    border-radius: 17px !important;
  }

  .ph-storefront-root .ph-modal-title {
    padding-right: 48px;
    font-size: clamp(23px, 7.5vw, 30px) !important;
  }

  .ph-storefront-root .ph-modal-specs-table {
    grid-template-columns: minmax(0, 1fr);
  }

  .ph-storefront-root .ph-modal-checkout-buttons {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ph-storefront-root .ph-modal-checkout-buttons > * {
    grid-column: 1 !important;
  }

  .ph-storefront-root .ph-checkout-content {
    padding-top: 20px !important;
  }

  .ph-storefront-root .ph-checkout-header {
    margin-bottom: 18px;
    padding: 0 52px 18px 0;
  }

  .ph-storefront-root .ph-checkout-main-title {
    font-size: clamp(25px, 7.8vw, 31px) !important;
    line-height: 1.2 !important;
  }

  .ph-storefront-root .ph-checkout-desc {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.65;
  }

  .ph-storefront-root .ph-checkout-grid,
  .ph-storefront-root .ph-checkout-col-summary,
  .ph-storefront-root .ph-checkout-col-form {
    gap: 11px !important;
  }

  .ph-storefront-root .ph-checkout-prod-card {
    grid-template-columns: 72px minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 12px !important;
    border-radius: 17px !important;
  }

  .ph-storefront-root .ph-checkout-thumb-wrap {
    width: 72px !important;
    height: 72px !important;
    border-radius: 12px !important;
  }

  .ph-storefront-root .ph-checkout-title {
    font-size: 14px;
  }

  .ph-storefront-root .ph-checkout-options-box,
  .ph-storefront-root .ph-calc-breakdown,
  .ph-storefront-root .ph-checkout-trust-box,
  .ph-storefront-root .ph-form-section,
  .ph-storefront-root .ph-pay-method-panel {
    padding: 15px !important;
    border-radius: 17px !important;
  }

  .ph-storefront-root .ph-color-pill {
    min-height: 42px;
    padding-inline: 11px !important;
    font-size: 11px;
  }

  .ph-storefront-root .ph-calc-total-val,
  .ph-storefront-root .ph-receipt-highlight {
    font-size: 22px;
  }

  .ph-storefront-root .ph-input,
  .ph-storefront-root .ph-cash-input {
    min-height: 54px !important;
    font-size: 16px !important;
  }

  .ph-storefront-root .ph-payment-method-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .ph-storefront-root .ph-pay-tab-btn {
    min-height: 58px !important;
    padding: 10px 11px !important;
    font-size: 11px !important;
  }

  .ph-storefront-root .ph-bank-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ph-storefront-root .ph-bank-row .ph-lbl {
    grid-column: 1 / -1;
  }

  .ph-storefront-root .ph-bank-account-box,
  .ph-storefront-root .ph-success-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .ph-storefront-root .ph-success-actions > * {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .ph-storefront-root .ph-checkout-prod-card {
    grid-template-columns: 64px minmax(0, 1fr) !important;
  }

  .ph-storefront-root .ph-checkout-thumb-wrap {
    width: 64px !important;
    height: 64px !important;
  }

  .ph-storefront-root .ph-payment-method-selector {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ph-storefront-root .ph-pay-tab-btn {
    min-height: 52px !important;
  }

  .ph-storefront-root .ph-calc-row,
  .ph-storefront-root .ph-calc-total-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .ph-storefront-root .ph-calc-total-val {
    font-size: 24px;
  }
}

@media (hover: none) {
  .ph-storefront-root .ph-modal-close-btn:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ph-storefront-root .ph-modal-dialog *,
  .ph-storefront-root .ph-modal-backdrop * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
