/* Compact, vendor-safe galleries and responsive product layout. */
body.single-product .woocommerce div.product {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}
body.single-product .woocommerce div.product > *,
body.single-product .woocommerce div.product .summary,
body.single-product .woocommerce div.product .woocommerce-tabs,
body.single-product .woocommerce div.product .ma-custom-product-gallery {
  min-width: 0 !important;
  max-width: 100% !important;
}
body.single-product .ma-custom-product-gallery {
  width: 100% !important;
  max-width: 620px !important;
  margin: 0 auto 20px !important;
  float: none !important;
  box-sizing: border-box;
}
.ma-custom-product-gallery .ma-gallery-stage {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 4;
  max-height: 500px;
  margin: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
}
.ma-custom-product-gallery .ma-gallery-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none !important;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}
.ma-custom-product-gallery .ma-gallery-slide.is-active { display: flex !important; }
.ma-custom-product-gallery .ma-gallery-slide img,
.ma-custom-product-gallery .ma-gallery-empty img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 auto !important;
}
.ma-custom-product-gallery .ma-product-gallery-controls {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0 0;
  box-sizing: border-box;
}
.ma-custom-product-gallery .ma-gallery-track {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 4px;
  scrollbar-width: thin;
}
.ma-custom-product-gallery .ma-gallery-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  padding: 4px;
  border: 2px solid #d5d1df;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}
.ma-custom-product-gallery .ma-gallery-thumb[aria-current="true"] {
  border-color: #6F6DA8;
  box-shadow: 0 0 0 2px rgba(111,109,168,.16);
}
.ma-custom-product-gallery .ma-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ma-custom-product-gallery .ma-gallery-prev,
.ma-custom-product-gallery .ma-gallery-next {
  flex: 0 0 42px;
  width: 42px;
  height: 44px;
  background: #fff;
  color: #30245e;
  border: 2px solid #d5d1df;
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.ma-custom-product-gallery button:hover,
.ma-custom-product-gallery button:focus-visible {
  border-color: #6F6DA8;
  outline-offset: 2px;
}
@media (max-width: 980px) {
  body.single-product .woocommerce div.product {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 18px !important;
  }
  body.single-product .ma-custom-product-gallery {
    max-width: min(100%, 460px) !important;
  }
  body.single-product .ma-custom-product-gallery .ma-gallery-stage {
    aspect-ratio: 1 / 1;
    max-height: min(82vw, 370px);
  }
}
/* Variant-linked color selector beneath product image thumbnails. */
body.single-product .ma-custom-product-gallery .ma-color-swatches {display:block!important;width:100%!important;margin:14px 0 5px!important;padding:12px 2px 2px!important;box-sizing:border-box!important;}
body.single-product .ma-custom-product-gallery .ma-color-heading {display:block!important;margin:0 0 11px!important;color:#29233b!important;font-size:14px!important;font-weight:600!important;}
body.single-product .ma-custom-product-gallery .ma-color-heading strong {color:#6f6da8!important;font-weight:700!important;}
body.single-product .ma-custom-product-gallery .ma-color-buttons {display:flex!important;flex-wrap:wrap!important;gap:11px!important;align-items:center!important;}
body.single-product .ma-custom-product-gallery button.ma-color-swatch {appearance:none!important;display:inline-flex!important;flex:0 0 44px!important;align-items:center!important;justify-content:center!important;box-sizing:border-box!important;min-width:44px!important;width:44px!important;max-width:44px!important;min-height:44px!important;height:44px!important;max-height:44px!important;margin:0!important;padding:4px!important;border:2px solid #c9c4d4!important;border-radius:50%!important;background:#fff!important;cursor:pointer!important;line-height:1!important;transition:border-color .14s,box-shadow .14s,transform .14s;}
body.single-product .ma-custom-product-gallery button.ma-color-swatch span.ma-color-dot {display:block!important;flex:none!important;box-sizing:border-box!important;width:32px!important;min-width:32px!important;height:32px!important;min-height:32px!important;border-radius:50%!important;background-color:var(--ma-swatch)!important;border:1px solid rgba(0,0,0,.17)!important;}
body.single-product .ma-custom-product-gallery button.ma-color-swatch.is-selected {border-color:#6f6da8!important;box-shadow:0 0 0 2px rgba(111,109,168,.22)!important;}
body.single-product .ma-custom-product-gallery button.ma-color-swatch:hover {transform:translateY(-1px);border-color:#6f6da8!important;}
body.single-product .ma-custom-product-gallery button.ma-color-swatch:focus-visible {outline:3px solid #6f6da8!important;outline-offset:3px!important;}
/* Tap-friendly shirt sizes: variation selectors stay the ordering source of truth. */
body.single-product .ma-custom-product-gallery .ma-shirt-sizes {display:block!important;width:100%!important;margin:13px 0 7px!important;padding:5px 2px 9px!important;box-sizing:border-box!important;}
body.single-product .ma-custom-product-gallery .ma-size-heading {font-size:14px!important;font-weight:600!important;color:#29233b!important;margin:0 0 10px!important;}
body.single-product .ma-custom-product-gallery .ma-size-heading strong {color:#6f6da8!important;}
body.single-product .ma-custom-product-gallery .ma-size-buttons {display:flex!important;flex-wrap:wrap!important;gap:8px!important;}
body.single-product .ma-custom-product-gallery button.ma-size-choice {appearance:none!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;flex:0 0 auto!important;box-sizing:border-box!important;min-width:49px!important;min-height:44px!important;width:auto!important;height:44px!important;padding:0 11px!important;margin:0!important;border:2px solid #cbc5d9!important;border-radius:9px!important;background:#fff!important;color:#29233b!important;font-size:14px!important;font-weight:700!important;line-height:1!important;cursor:pointer!important;}
body.single-product .ma-custom-product-gallery button.ma-size-choice.is-selected {border-color:#6f6da8!important;background:#ebe7f5!important;box-shadow:0 0 0 2px rgba(111,109,168,.16)!important;}
body.single-product .ma-custom-product-gallery button.ma-size-choice:disabled {opacity:.35!important;cursor:not-allowed!important;}
body.single-product .ma-custom-product-gallery button.ma-size-choice:focus-visible {outline:3px solid #6f6da8!important;outline-offset:3px!important;}
/* Desktop only: center the variant pickers under the gallery, leave mobile untouched. */
@media (min-width: 1025px) {
  body.single-product .ma-custom-product-gallery .ma-color-heading,
  body.single-product .ma-custom-product-gallery .ma-size-heading {
    text-align: center !important;
  }
  body.single-product .ma-custom-product-gallery .ma-color-buttons,
  body.single-product .ma-custom-product-gallery .ma-size-buttons {
    justify-content: center !important;
  }
}
@media (max-width: 620px) {
  .ma-custom-product-gallery .ma-gallery-thumb { flex-basis: 60px; width:60px; height:60px; }
  .ma-custom-product-gallery .ma-gallery-prev,
  .ma-custom-product-gallery .ma-gallery-next { flex-basis: 36px; width:36px; height:40px; font-size:26px; }
  .ma-custom-product-gallery .ma-gallery-track { gap:6px; }
  .ma-custom-product-gallery .ma-product-gallery-controls { gap:4px; }
  body.single-product .woocommerce div.product .product_title {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }
}
