/* El carrusel mantiene el desplazamiento horizontal, pero no bloquea gestos
   verticales de Chrome/Android ni Safari/iOS al iniciar sobre miniaturas. */
@media (max-width:640px){
 body.single-product .c47-pdp__media .c47-phone-gallery__thumbs,
 body.single-product .c47-pdp__media .c47-phone-gallery__thumb{
  touch-action:auto!important;
 }
}

/* CERO47 — First paint stability for every single product.
   The server renders the real product image + rail before any gallery JS. */
body.single-product .c47-pdp__media.c47-ssr-gallery>.woocommerce-product-gallery{display:none!important}
body.single-product .c47-pdp__media.c47-ssr-gallery>.c47-firstpaint-gallery{
 display:grid!important;grid-template-columns:76px minmax(0,1fr)!important;gap:18px!important;
 align-items:start!important;width:100%!important;max-width:100%!important;
 background:#fff!important;position:relative!important;overflow:hidden!important;
}
body.single-product .c47-firstpaint-gallery__main{
 grid-column:2;grid-row:1;display:flex;align-items:center;justify-content:center;
 width:100%;aspect-ratio:1/1;background:#fff;overflow:hidden;
}
body.single-product .c47-firstpaint-gallery__main img{
 display:block!important;width:100%!important;height:100%!important;
 aspect-ratio:1/1!important;object-fit:contain!important;
 opacity:1!important;filter:none!important;transition:none!important;
}
body.single-product .c47-firstpaint-gallery__rail{
 grid-column:1;grid-row:1;display:flex;flex-direction:column;gap:10px;
 width:76px;max-height:min(640px,80vh);overflow:hidden;
}
body.single-product .c47-firstpaint-gallery__thumb{
 flex:0 0 76px;display:block;width:76px;height:76px;
 background:#fff;border:1px solid #d9d9d5;box-sizing:border-box;
 overflow:hidden;
}
body.single-product .c47-firstpaint-gallery__thumb:first-child{border:2px solid #000}
body.single-product .c47-firstpaint-gallery__thumb img{
 display:block!important;width:100%!important;height:100%!important;object-fit:cover!important;opacity:1!important;
}
/* Keep the identical first image visible until JS main photo has decoded/loaded. */
body.single-product .c47-pdp__media.c47-gallery-firstpaint-done>.c47-firstpaint-gallery{display:none!important}
body.single-product .c47-pdp__media.c47-phone-gallery-active:not(.c47-gallery-firstpaint-done)>.c47-firstpaint-gallery,
body.single-product .c47-pdp__media.c47-desktop-gallery-active:not(.c47-gallery-firstpaint-done)>.c47-firstpaint-gallery{
 position:absolute!important;top:0!important;left:0!important;right:0!important;
 z-index:8!important;max-width:100%!important;
}

/* No native selects blink just before CERO47 swatches are attached.
   Fail-open: the early bootstrap releases this guard if enhancements fail. */
html.c47-enhancing body.single-product .c47-pdp__buy form.variations_form:not(.c47-enhanced){
 position:relative!important;min-height:270px!important;
}
html.c47-enhancing body.single-product .c47-pdp__buy form.variations_form:not(.c47-enhanced):before{
 content:"";display:block;height:204px;width:100%;background:#fff;
}
html.c47-enhancing body.single-product .c47-pdp__buy form.variations_form:not(.c47-enhanced) .c47-unified-guide{
 visibility:hidden!important;
}
html.c47-enhancing body.single-product .c47-pdp__buy form.variations_form:not(.c47-enhanced) table.variations{
 position:absolute!important;visibility:hidden!important;pointer-events:none!important;
}
html.c47-enhancing body.single-product .c47-pdp__buy form.variations_form:not(.c47-enhanced) .single_variation_wrap{
 visibility:hidden!important;pointer-events:none!important;
}
@media(max-width:640px){
 body.single-product .c47-pdp__media.c47-ssr-gallery>.c47-firstpaint-gallery{
  display:flex!important;flex-direction:column!important;gap:0!important;
  width:100%!important;max-width:100%!important;
 }
 body.single-product .c47-firstpaint-gallery__main{
  order:0!important;flex:0 0 auto;width:100%!important;
  aspect-ratio:1/1!important;border:1px solid #dededa!important;
  margin:0 0 12px!important;box-sizing:border-box!important;
 }
 body.single-product .c47-firstpaint-gallery__rail{
  order:1!important;display:flex!important;flex-direction:row!important;
  gap:10px!important;width:100%!important;max-width:100%!important;
  max-height:100px!important;height:100px!important;overflow:hidden!important;
 }
 body.single-product .c47-firstpaint-gallery__thumb{
  flex:0 0 92px!important;width:92px!important;height:92px!important;
 }
 html.c47-enhancing body.single-product .c47-pdp__buy form.variations_form:not(.c47-enhanced){
  min-height:250px!important;
 }
}
