/* LK24H_STORE_PUBLIC_DETAIL_MODAL_APP_VIEWPORT_R8_FIXED_R1
 * Product detail modal completion for Android app/WebView and mobile web.
 * Uses the visualViewport variables maintained by Store popup R4.
 */

:root {
  --lk-store-detail-gutter-r8: clamp(8px, 2.4vw, 16px);
}

/* Follow the actual visible viewport, not the larger layout viewport. */
.store-product-detail-modal-r7:not([hidden]) {
  position: fixed !important;
  inset: auto !important;
  top: var(--lk-store-overlay-top, 0px) !important;
  left: var(--lk-store-overlay-left, 0px) !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--lk-store-overlay-width, 100vw) !important;
  height: var(--lk-store-overlay-height, 100dvh) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  isolation: isolate;
  padding-top: max(var(--lk-store-detail-gutter-r8), env(safe-area-inset-top, 0px)) !important;
  padding-right: max(var(--lk-store-detail-gutter-r8), env(safe-area-inset-right, 0px)) !important;
  padding-bottom: max(var(--lk-store-detail-gutter-r8), env(safe-area-inset-bottom, 0px)) !important;
  padding-left: max(var(--lk-store-detail-gutter-r8), env(safe-area-inset-left, 0px)) !important;
}

.store-product-detail-modal-r7:not([hidden]) .store-product-detail-backdrop-r7 {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.store-product-detail-modal-r7:not([hidden]) .store-product-detail-panel-r7 {
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  width: min(560px, 100%) !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: min(760px, 100%) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  margin: 0 !important;
  border-radius: 20px !important;
  transform: none !important;
}

/* Header and price remain reachable while only the description scrolls. */
.store-product-detail-modal-r7 .store-product-detail-header-r7,
.store-product-detail-modal-r7 .store-product-detail-summary-r7 {
  flex: 0 0 auto !important;
  min-width: 0 !important;
}

.store-product-detail-modal-r7 .store-product-detail-header-r7 > div {
  min-width: 0 !important;
}

.store-product-detail-modal-r7 .store-product-detail-header-r7 h3 {
  overflow-wrap: anywhere !important;
}

.store-product-detail-modal-r7 .store-product-detail-description-r7 {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
  scrollbar-gutter: stable !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.store-product-detail-modal-r7 .store-product-detail-description-r7::-webkit-scrollbar {
  width: 7px;
}

.store-product-detail-modal-r7 .store-product-detail-description-r7::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(100, 116, 139, .55);
  background-clip: padding-box;
}

/* WebView/mobile: centered, nearly full visible height; no 72dvh bottom-sheet cap. */
@media (max-width: 640px) {
  .store-product-detail-modal-r7:not([hidden]) {
    align-items: center !important;
    padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
    padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
  }

  .store-product-detail-modal-r7:not([hidden]) .store-product-detail-panel-r7 {
    width: 100% !important;
    max-height: 100% !important;
    border-radius: 18px !important;
  }
}

/* Very short landscape/keyboard viewport: compact chrome, preserve close and scrolling. */
@media (max-height: 480px) {
  .store-product-detail-modal-r7 .store-product-detail-header-r7 {
    padding: 9px 11px 7px !important;
    gap: 8px !important;
  }

  .store-product-detail-modal-r7 .store-product-detail-kicker-r7 {
    display: none !important;
  }

  .store-product-detail-modal-r7 .store-product-detail-header-r7 h3 {
    font-size: 15px !important;
    line-height: 1.25 !important;
  }

  .store-product-detail-modal-r7 .store-product-detail-close-r7 {
    flex-basis: 30px !important;
    width: 30px !important;
    height: 30px !important;
  }

  .store-product-detail-modal-r7 .store-product-detail-summary-r7 {
    padding: 7px 11px !important;
  }

  .store-product-detail-modal-r7 .store-product-detail-description-r7 {
    padding: 10px 11px max(12px, env(safe-area-inset-bottom, 0px)) !important;
    line-height: 1.5 !important;
  }
}
