/*
Theme Name: Neljemark
Description: This is a custom child theme for Salient
Theme URI:   https://themeforest.net/item/salient-responsive-multipurpose-theme/4363266
Author: ThemeNectar
Author URI:  https://themeforest.net/user/themenectar
Template: salient
Text Domain: salient-child
Version: 1.0
*/

/* Active state: modal covers viewport, centered */
#md-size-chart-modal[style*="display: block"] {
  position: fixed !important;
  inset: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px;
  /* slightly above the cart background */
  z-index: 100003 !important;
}

/* Modal content box */
#md-size-chart-modal[style*="display: block"] .md-size-chart-modal-body {
  position: relative !important;
  box-sizing: border-box !important;
  width: clamp(560px, 70vw, 880px) !important;
  max-height: min(88vh, 1000px) !important;
  margin: 0 !important;
  background: #fff;
  overflow: auto;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}

/* Reset plugin offsets that break centering */
#md-size-chart-modal[style*="display: block"] .md-size-chart-modal-content,
#md-size-chart-modal[style*="display: block"] .md-size-chart-modal-body {
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
}

/* Background overlay under the modal box */
#md-size-chart-modal[style*="display: block"] .md-size-chart-overlay {
  position: fixed !important;
  inset: 0;
  background: rgba(0,0,0,.65) !important;
  z-index: -1 !important;
}

/* Remove unwanted animations/transitions only when open */
#md-size-chart-modal[style*="display: block"],
#md-size-chart-modal[style*="display: block"] * {
  animation: none !important;
  transition: none !important;
}

/* Disable clicks on background elements and prevent scroll */
.sizechart-open { overflow: hidden; }
.sizechart-open .nectar-slide-in-cart,
.sizechart-open .nectar-slide-in-cart-bg,
.sizechart-open #header-outer,
.sizechart-open #ajax-content-wrap,
.sizechart-open #footer-outer {
  pointer-events: none !important;
}

/* Responsive adjustments for small screens */
@media (max-width: 640px) {
  #md-size-chart-modal[style*="display: block"] { padding: 12px; }
  #md-size-chart-modal[style*="display: block"] .md-size-chart-modal-body {
    width: 96vw !important;
    max-height: 88vh !important;
    border-radius: 6px;
  }
}

/* Lock background when open */
.sizechart-open body {
  overflow: hidden !important;
}

/* Modal container should not scroll, only the inner box scrolls */
#md-size-chart-modal[style*="display: block"] {
  overflow: hidden !important;
}

/* Scroll inside the modal box */
#md-size-chart-modal[style*="display: block"] .md-size-chart-modal-body {
  overflow: auto !important;
  max-height: calc(100vh - 48px) !important; /* tilaa reunoille */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Kill hover zoom and flyout completely */
.woocommerce-product-gallery .easyzoom,
.woocommerce-product-gallery__image.easyzoom {
  pointer-events: auto;
}

.woocommerce-product-gallery .easyzoom img,
.woocommerce-product-gallery__image.easyzoom img {
  transform: none !important;
}

.easyzoom-flyout,
.easyzoom.is-ready .easyzoom-flyout {
  display: none !important;
  visibility: hidden !important;
}

.single-product .woocommerce-product-gallery .woocommerce-product-gallery__image a img {
  transform: none !important;
}
