/* WooCommerce bridge for Joomla PG gallery (Swiper thumbs + PhotoSwipe + Drift) */

.single-product div.product.ava-pg-product {
  display: grid !important;
  grid-template-columns: minmax(300px, 590px) minmax(280px, 1fr);
  column-gap: 32px;
  row-gap: 16px;
  align-items: start;
}

.single-product .pg-product-gallery.ava-pg-wrap,
.single-product .summary {
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
  max-width: none !important;
}

.single-product .woocommerce-product-gallery {
  display: none !important;
}

.single-product .pg {
  --accent: #f68e13;
  /* Keep px token (Joomla): % here breaks .pg-thumbs { height: var(--main) }. */
  --main: 480px;
  max-width: 100%;
}

/* True 1:1 main viewport; defeat Astra img { max-width:100%; height:auto } stretch. */
.single-product .ava-pg-wrap > .ava-product-notice {
  margin: 14px 0 0;
}

.single-product .pg-main {
  aspect-ratio: 1 / 1 !important;
  width: min(var(--main), 100%);
  height: auto !important;
  max-width: 100%;
  box-sizing: border-box;
}

.single-product .pg-main .swiper-wrapper,
.single-product .pg-main .swiper-slide {
  height: 100% !important;
}

.single-product .pg-main img,
.single-product .pg-thumbs img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Keep nav chevrons proportional (Swiper defaults svg { width:100% }). */
.single-product .pg-main .swiper-button-prev svg,
.single-product .pg-main .swiper-button-next svg,
.single-product .pg-main .swiper-navigation-icon {
  width: auto !important;
  height: 12px !important;
  max-width: none !important;
  max-height: 12px !important;
  object-fit: contain !important;
}

.single-product .summary.zoom-host {
  position: relative;
  min-width: 0;
  --ava-pg-zoom: 480px;
}

@media (min-width: 992px) {
  /*
   * Drift injects .drift-zoom-pane { width/height:100% } (fills tall .summary).
   * Force square pane matching main image; JS sets --ava-pg-zoom from .pg-main width.
   */
  .single-product .summary.zoom-host .drift-zoom-pane {
    position: absolute !important;
    top: 0;
    left: 0;
    width: var(--ava-pg-zoom, 480px) !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 1 / 1 !important;
    z-index: 20;
    border: 1px solid #e9e9e9;
    background: #fff;
    box-sizing: border-box;
    overflow: hidden;
  }

  .single-product .summary.zoom-host .drift-zoom-pane:not(.drift-open) {
    display: none !important;
  }

  /*
   * Astra `img { max-width:100% }` beats Drift's injected max-width:none (same cascade
   * quirks) and squishes zoom width while inline height stays → vertical stretch.
   */
  .single-product .summary.zoom-host .drift-zoom-pane img {
    max-width: none !important;
    max-height: none !important;
  }
}

@media (max-width: 991px) {
  .single-product div.product.ava-pg-product {
    grid-template-columns: 1fr !important;
  }

  .single-product .summary.zoom-host .drift-zoom-pane,
  .single-product .drift-zoom-pane {
    display: none !important;
  }

  /*
   * Mobile order (как Joomla + JS placeMobileBlocks):
   * H1 → CTA → gallery → summary (meta/short/swatches) → notice → tabs
   */
  .single-product div.product.ava-pg-product {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }
  .single-product .product_title,
  .single-product div.product > h1.product_title {
    order: 1;
    margin: 0 0 4px;
    font-size: 1.25rem;
    line-height: 1.35;
  }
  .single-product div.product > .ava-product-cta-wrap {
    order: 2;
    margin: 0;
  }
  .single-product .pg-product-gallery.ava-pg-wrap {
    order: 3;
  }
  .single-product .summary {
    order: 4;
  }
  .single-product div.product > .ava-product-notice {
    order: 5;
  }
  .single-product .woocommerce-tabs {
    order: 6;
  }
  .single-product .related.products {
    order: 7;
  }
}

@media (max-width: 767px) {
  /* Full-bleed photo; thumbs as horizontal strip under main (pg-gallery.css) */
  .single-product .pg-product-gallery.ava-pg-wrap {
    margin: 0 -4px;
  }
  .single-product .pg-main {
    box-shadow: none;
    width: 100%;
  }
}

.single-product .woocommerce-tabs,
.single-product .related.products {
  grid-column: 1 / -1;
  width: 100%;
}
/* PhotoSwipe 5 uses SVG icons; WooCommerce's legacy sprite must not show. */
.pswp.pswp--open .pswp__button,
.pswp.pswp--open .pswp__button:hover,
.pswp.pswp--open .pswp__button:focus,
.pswp.pswp--open .pswp__button:active {
  background-image: none !important;
  background-color: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.pswp.pswp--open .pswp__button::before,
.pswp.pswp--open .pswp__button::after { content: none !important; }
.pswp.pswp--open .pswp__button .pswp__icn { background: none !important; }
