/* Artmarket product messaging — fullscreen on phones and tablets.
   Keep this query aligned with theme/js/product-chat.js. Narrow desktop
   windows also use the accessible fullscreen layout. iPadOS desktop User
   Agent does not affect the result. This CSS is separately cache-versioned. */
@media (max-width: 1024px), (max-width: 1400px) and (any-pointer: coarse) {
  .am-product-chat {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    align-items: stretch;
  }
  .am-product-chat__launcher {
    align-self: flex-end;
    max-width: calc(100vw - 24px);
  }
  body:has(.floating-cart) .am-product-chat {
    right: 12px;
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
  body:has(.floating-cart) .am-product-chat__launcher { align-self: flex-start; }
  .am-product-chat__launcher-label--desktop { display: none; }
  .am-product-chat__launcher-label--mobile { display: inline; }

  html:has(.am-product-chat.is-open),
  body:has(.am-product-chat.is-open) {
    overflow: hidden;
    overscroll-behavior: none;
  }
  .am-product-chat.is-open {
    top: var(--am-product-chat-vv-top, 0px);
    right: 0 !important;
    bottom: auto !important;
    left: 0;
    z-index: 500;
    width: 100%;
    height: var(--am-product-chat-vv-height, 100dvh);
    align-items: stretch;
    gap: 0;
  }
  .am-product-chat.is-open .am-product-chat__panel {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .am-product-chat.is-open .am-product-chat__header {
    min-height: 68px;
    flex: 0 0 auto;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: rgba(255,255,255,.98);
  }
  .am-product-chat.is-open .am-product-chat__history {
    min-height: 0;
    flex: 1 1 auto;
  }
  .am-product-chat.is-open .am-product-chat__composer.artist-messages-composer {
    flex: 0 0 auto;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .am-product-chat.is-open .am-product-chat__composer textarea {
    font-size: 16px;
  }
  /* Keep bubbles readable on wide iPads rather than stretching across 1kpx. */
  .am-product-chat .artist-message { max-width: min(84%, 560px); }
  .am-product-chat__guest-message { max-width: min(86%, 560px); }
  .am-product-chat__guest-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .am-product-chat__guest-form textarea,
  .am-product-chat__guest-email input {
    font-size: 16px;
  }
}
