.product-modal{
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease; /* быстрее и стабильно */
  padding: 60px 24px 60px; /* воздух вокруг модалки */
  overflow-y: auto;        /* скроллим весь оверлей, ползунок на краю окна */
}

.product-modal.is-visible{
  opacity: 1;
  pointer-events: auto;
}

.product-modal__overlay{
  position: fixed;       /* растягиваем на весь экран, не зависим от внутренних отступов */
  inset: 0;
  background: rgba(0,0,0,0.55);
}

.product-modal__dialog{
  position: relative;
  z-index: 1;
  background: var(--page-bg);
  max-width: min(1200px, 95vw);
  max-height: none;     
  overflow: visible;
  border-radius: 16px; 
  box-shadow: 0 2px 60px rgba(0,0,0,0.25);
  padding: 40px 36px 40px; /* больше отступы сверху и снизу */
  transform: translateY(10px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  margin-bottom: 0;
}

.product-modal.is-visible .product-modal__dialog{
  transform: translateY(0);
  opacity: 1;
}

.product-modal__close{
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

/* Product modal: на мобильных полноэкранно, кнопка закрытия ≥44px для тапа */
@media (max-width: 768px){
  .product-modal{ padding: 0; align-items: stretch; }
  .product-modal__dialog{
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    padding: calc(16px + env(safe-area-inset-top,0)) 16px calc(16px + env(safe-area-inset-bottom,0));
  }
  .product-modal__close{
    top: calc(12px + env(safe-area-inset-top,0));
    right: 12px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,.08);
  }
}

.no-scroll{
  overflow: hidden;
}
