/* ==========================================================================
   Single product gallery — FIXED main frame size (desktop + mobile)
   Scoped to body.single-product only.
   Note: If a source file has large empty margins baked into the image, re-crop
   and re-upload with tighter product boundaries; CSS cannot remove that padding.
   ========================================================================== */

body.single-product {
  --ax-gallery-frame-size: 560px;
}

/* ==========================================================================
   Desktop only — fixed 560×560 gallery stage
   ========================================================================== */
@media (min-width: 769px) {
  body.single-product .woocommerce div.product div.images,
  body.single-product .woocommerce-page div.product div.images {
    width: var(--ax-gallery-frame-size) !important;
    max-width: var(--ax-gallery-frame-size) !important;
    min-width: var(--ax-gallery-frame-size) !important;
    flex: 0 0 var(--ax-gallery-frame-size) !important;
  }

  body.single-product .ax-product-gallery,
  body.single-product .ax-product-gallery.images {
    display: block;
    width: var(--ax-gallery-frame-size) !important;
    max-width: var(--ax-gallery-frame-size) !important;
    min-width: var(--ax-gallery-frame-size) !important;
    margin-left: 0;
    margin-right: 0;
    position: relative !important;
    top: -40px !important;
    box-sizing: border-box;
  }

  body.single-product .ax-product-gallery__main {
    position: relative;
    display: block;
    width: var(--ax-gallery-frame-size) !important;
    max-width: var(--ax-gallery-frame-size) !important;
    min-width: var(--ax-gallery-frame-size) !important;
    height: var(--ax-gallery-frame-size) !important;
    min-height: var(--ax-gallery-frame-size) !important;
    max-height: var(--ax-gallery-frame-size) !important;
    box-sizing: border-box;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: #ffffff;
    overflow: visible;
    flex: none;
  }

  body.single-product .ax-product-gallery,
  body.single-product .ax-product-gallery.images,
  body.single-product .woocommerce div.product div.images,
  body.single-product .woocommerce-page div.product div.images {
    overflow: visible;
  }

  body.single-product .ax-product-gallery__main #ax-main-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: block;
    width: 92% !important;
    height: 92% !important;
    max-width: 92% !important;
    max-height: 92% !important;
    margin: 0;
    object-fit: contain !important;
    object-position: center center !important;
    z-index: 1;
    cursor: zoom-in;
  }
}

/* Shared frame chrome (desktop + mobile) */
body.single-product .ax-product-gallery__main {
  position: relative;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #ffffff;
  overflow: visible;
}

@media (max-width: 768px) {
  body.single-product .ax-product-gallery__main {
    overflow: hidden;
  }
}

/* Navigation arrows — overlap frame edges (desktop); inside on mobile */
body.single-product .ax-product-gallery__main .ax-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  color: #111;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 15;
  margin: 0;
  padding: 0;
}

@media (min-width: 769px) {
  body.single-product .ax-product-gallery__main .ax-prev {
    left: -22px;
  }

  body.single-product .ax-product-gallery__main .ax-next {
    right: -22px;
  }
}

body.single-product .ax-product-gallery__main .ax-nav:hover {
  border-color: #f6623c;
}

/* Discount / status badges — top-right of frame */
body.single-product .ax-product-gallery__main .single-product-badges {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  pointer-events: none;
}

/* Horizontal thumbnails strip */
.ax-product-gallery__thumbs {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin: 16px 0 0 0;
  padding: 0;
}

.ax-product-gallery__thumbs .ax-thumb {
  display: block;
  width: 100%;
  padding: 6px;
  border-radius: 8px;
  outline: 2px solid rgba(0,0,0,0.06); /* default subtle frame */
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: outline-color .2s ease, box-shadow .2s ease;
}

.ax-product-gallery__thumbs .ax-thumb:hover {
  outline-color: rgba(0,0,0,0.12);
}

.ax-product-gallery__thumbs .ax-thumb.is-active {
  outline-color: #f6623c; /* match product hover red */
  box-shadow: 0 0 0 6px rgba(220,38,38,0.12);
}

body.single-product .ax-product-gallery__thumbs .ax-thumb-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72px;
  object-fit: contain;
  object-position: center center;
  border-radius: 6px;
}

@media (max-width: 768px) {
  .ax-product-gallery__thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
} 

/* Extra description spacing */
.ax-extra-description {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.6;
}

/* Lightbox overlay */
.ax-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2147483646;
}
.ax-lightbox.active { display: flex; }

.ax-lightbox__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
}

.ax-lightbox__stage {
  display: block;
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
  margin-right: auto;
}

/* Lightbox square frame — shared image fit (mobile + desktop) */
.ax-lightbox .ax-lightbox__stage.ax-product-gallery__main {
  overflow: hidden;
  box-sizing: border-box;
  margin-left: auto !important;
  margin-right: auto !important;
}

.ax-lightbox .ax-lightbox__stage.ax-product-gallery__main .ax-lightbox__img {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  display: block !important;
  margin: 0 !important;
  object-fit: contain !important;
  object-position: center center !important;
  box-shadow: none;
  width: auto;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ax-lightbox__img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}

.ax-lightbox__close,
.ax-lightbox__nav {
  position: fixed;
  border-radius: 9999px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.ax-lightbox__close {
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
}

.ax-lightbox__nav {
  top: 50%;
  margin-top: -28px;
  width: 56px;
  height: 56px;
}

.ax-lightbox__prev { left: 20px; }
.ax-lightbox__next { right: 20px; }

.ax-lightbox__close:hover,
.ax-lightbox__nav:hover { background: rgba(255,255,255,0.2); }

.ax-lightbox.no-nav .ax-lightbox__nav { display: none; }

.ax-lightbox__thumbs {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Mobile lightbox — no arrows, shared gallery thumbs below main image, swipe on stage */
@media (max-width: 889px) {
  .ax-lightbox {
    padding: 48px 0 16px;
    box-sizing: border-box;
  }

  .ax-lightbox__inner {
    justify-content: center;
    height: auto;
    max-height: 100%;
    gap: 0;
    padding: 0;
    box-sizing: border-box;
  }

  .ax-lightbox__stage {
    flex: 0 0 auto;
    width: 100%;
    touch-action: pan-y;
  }

  /* Same square white frame as pre-zoom .ax-product-gallery__main */
  .ax-lightbox .ax-lightbox__stage.ax-product-gallery__main {
    display: block;
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 1 / 1;
    margin: 0 auto !important;
    padding: 0;
  }

  .ax-lightbox .ax-lightbox__stage.ax-product-gallery__main .ax-lightbox__img {
    width: 96% !important;
    height: 96% !important;
    max-width: 96% !important;
    max-height: 96% !important;
  }

  .ax-lightbox__nav {
    display: none !important;
  }

  /* Reuses .ax-product-gallery__thumbs / .ax-thumb — same look as pre-zoom gallery */
  .ax-lightbox .ax-product-gallery__thumbs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 12px !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 12px 0 0 !important;
    margin-left: -6px !important;
    padding: 8px 16px 8px 10px !important;
    scroll-padding-left: 10px !important;
    scroll-padding-right: 16px !important;
    box-sizing: border-box;
    position: relative !important;
    z-index: 1 !important;
  }

  .ax-lightbox .ax-product-gallery__thumbs .ax-thumb {
    flex: 0 0 84px !important;
    width: 84px !important;
  }

  .ax-lightbox .ax-product-gallery__thumbs::-webkit-scrollbar {
    display: none;
  }

  .ax-lightbox .ax-product-gallery__thumbs .ax-thumb-image {
    max-height: 72px;
    object-fit: contain;
    object-position: center center;
  }
}

/* Desktop lightbox — fixed square frame, centered like product gallery */
@media (min-width: 890px) {
  .ax-lightbox__inner {
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 24px;
    box-sizing: border-box;
  }

  .ax-lightbox .ax-lightbox__stage.ax-product-gallery__main {
    width: var(--ax-gallery-frame-size) !important;
    max-width: min(var(--ax-gallery-frame-size), calc(100vw - 160px)) !important;
    min-width: 0 !important;
    height: var(--ax-gallery-frame-size) !important;
    max-height: min(var(--ax-gallery-frame-size), calc(100vh - 80px)) !important;
    min-height: 0 !important;
    aspect-ratio: auto;
    margin: 0 auto !important;
    padding: 0;
  }

  .ax-lightbox .ax-lightbox__stage.ax-product-gallery__main .ax-lightbox__img {
    width: 92% !important;
    height: 92% !important;
    max-width: 92% !important;
    max-height: 92% !important;
  }
}

/* AX: Center thumbnails under main image on all viewports */
.ax-product-gallery__thumbs {
  grid-template-columns: repeat(auto-fit, 84px) !important;
  justify-content: center !important;
  gap: 12px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

@media (min-width: 769px) {
  body.single-product .ax-product-gallery__thumbs {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, 96px) !important;
    justify-content: flex-start !important;
    gap: 16px !important;
    width: var(--ax-gallery-frame-size) !important;
    max-width: var(--ax-gallery-frame-size) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 20px !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
}

/* AX: Mobile - keep thumbnails on a single row */
@media (max-width: 768px) {
  .ax-product-gallery__thumbs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 12px !important;
    justify-content: flex-start !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
  }
  .ax-product-gallery__thumbs .ax-thumb {
    flex: 0 0 84px !important;
    width: 84px !important;
  }
  .ax-product-gallery__thumbs::-webkit-scrollbar { display: none; }
} 

/* AX: Tablet widths - ensure thumbs visible and closer to main image */
@media (min-width: 768px) and (max-width: 1060px) {
  .ax-product-gallery__thumbs {
    margin-top: 6px !important;
    position: relative !important;
    z-index: 50 !important;
  }
} 

/* AX: Prevent hover ring from being clipped on mobile */
body.single-product .ax-product-gallery.images { overflow: visible !important; }
.ax-product-gallery__thumbs { position: relative !important; z-index: 30 !important; }
.ax-product-gallery__thumbs .ax-thumb { position: relative !important; z-index: 1 !important; }
.ax-product-gallery__thumbs .ax-thumb:hover,
.ax-product-gallery__thumbs .ax-thumb.is-active { z-index: 2 !important; }
@media (max-width: 768px) {
  .ax-product-gallery__thumbs { overflow-x: auto !important; overflow-y: visible !important; padding: 8px 0 !important; }
} 

/* AX: Mobile - add side padding so first/last thumb ring isn't clipped */
@media (max-width: 768px) {
  .ax-product-gallery__thumbs {
    padding-left: 14px !important;
    padding-right: 14px !important;
    scroll-padding-left: 14px !important;
    scroll-padding-right: 14px !important;
  }
} 
/* ==========================================================================
   Mobile — full-width gallery (beats axalia 16px margins + parent padding)
   ========================================================================== */
@media (max-width: 889px) {
  /* Break out of .bricks-container padding — same width as full-bleed summary */
  html body.single-product .woocommerce div.product div.images,
  html body.single-product .woocommerce-page div.product div.images,
  html body.single-product .ax-product-gallery,
  html body.single-product .ax-product-gallery.images {
    display: block !important;
    width: calc(100% + 80px) !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    margin-left: -40px !important;
    margin-right: -40px !important;
    margin-top: -48px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    float: none !important;
  }

  /* Square main frame — width follows channel, height from aspect-ratio */
  body.single-product .ax-product-gallery__main {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 1 / 1;
    margin: 0 !important;
    padding: 0;
    touch-action: pan-y;
  }

  /* Perfect center inside frame; size independent of image file dimensions */
  body.single-product .ax-product-gallery__main #ax-main-image {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    display: block !important;
    width: 96% !important;
    height: 96% !important;
    max-width: 96% !important;
    max-height: 96% !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    z-index: 1;
    cursor: zoom-in;
  }

  /* Summary: match gallery full-bleed width; pull up toward gallery */
  html body.single-product .woocommerce div.product .summary.entry-summary {
    width: calc(100% + 80px) !important;
    max-width: none !important;
    margin-left: -40px !important;
    margin-right: -40px !important;
    margin-top: -32px !important;
    left: auto !important;
    right: auto !important;
    position: relative !important;
    top: auto !important;
    box-sizing: border-box;
  }

  html body.single-product .content-area .product {
    row-gap: 8px !important;
  }

  /* Thumbnails: horizontal scroll; side padding so first/last outline is not clipped */
  body.single-product .ax-product-gallery__thumbs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 12px !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 12px !important;
    margin-left: -6px !important;
    padding: 8px 16px 8px 10px !important;
    scroll-padding-left: 10px !important;
    scroll-padding-right: 16px !important;
    box-sizing: border-box;
  }

  body.single-product .ax-product-gallery__thumbs .ax-thumb {
    flex: 0 0 84px !important;
    width: 84px !important;
  }

  body.single-product .ax-product-gallery__thumbs::-webkit-scrollbar {
    display: none;
  }

  body.single-product .ax-product-gallery__thumbs .ax-thumb-image {
    max-height: 72px;
    object-fit: contain;
    object-position: center center;
  }

  /* Hide prev/next arrows on mobile — use thumbnails instead */
  body.single-product .ax-product-gallery__main .ax-nav {
    display: none !important;
  }

  body.single-product .ax-product-gallery__main .single-product-badges {
    top: 12px;
    right: 12px;
    z-index: 10;
  }
}

/* Stacked tablet/desktop-narrow: center fixed 560px stage (890px+ only; mobile full-bleed below 890) */
@media (min-width: 890px) and (max-width: 1199px) {
  body.single-product .woocommerce div.product div.images,
  body.single-product .woocommerce-page div.product div.images {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 100% !important;
    display: flex;
    justify-content: center;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body.single-product .ax-product-gallery,
  body.single-product .ax-product-gallery.images {
    margin-left: auto;
    margin-right: auto;
  }
}