/* WAO Standard Product v1.2.0: imagen principal únicamente en móvil.
 * Se aplica a fichas de producto de todos los subsitios: .wao-mobile-single-image.
 * No cambia el HTML ni la galería de escritorio. No recorta las imágenes.
 */
@media screen and (max-width: 767px) {
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper,
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery .flex-viewport > .woocommerce-product-gallery__wrapper {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin: 0 !important;
    overflow: hidden !important;
    transform: none !important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:not(:first-child) {
    display: none !important;
    visibility: hidden !important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    float: none !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    margin: 0 !important;
    opacity: 1 !important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img.wp-post-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain !important;
  }

  /* Eliminar la navegación y los espacios de miniaturas. */
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery .flex-control-thumbs,
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery .woocommerce-product-gallery__trigger {
    display: none !important;
  }
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery::after {
    content: none !important;
    display: none !important;
  }
  /* Defensa si algún script crea el viewport antes de la desactivación. */
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery > .flex-viewport {
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    aspect-ratio: 1 / 1;
  }
}

/* WAO_STABLE_MOBILE_PRICE_V1
 * Precio anterior y actual en dos filas desde el primer renderizado.
 * Evita depender del ajuste de líneas y del margen de INS del tema padre.
 */
@media screen and (max-width: 767px) {
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .content-single-wrapper > .summary > .wao-price-rating-card .wao-pr-price p.price {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .content-single-wrapper > .summary > .wao-price-rating-card .wao-pr-price p.price > del,
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .content-single-wrapper > .summary > .wao-price-rating-card .wao-pr-price p.price > ins {
    margin: 0 !important;
    flex: 0 0 auto;
  }
}

/* WAO_MOBILE_GAP_FIX_V1
 * Elimina el espacio residual bajo la imagen principal en móvil,
 * colapsando completamente miniaturas/navegación ocultas.
 */
@media screen and (max-width: 767px) {
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery,
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery > .flex-viewport,
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper,
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery .flex-viewport > .woocommerce-product-gallery__wrapper {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery .flex-control-nav,
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery .flex-control-thumbs,
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery .flex-control-thumbs li,
  body.wao-native-product-layout.wao-mobile-single-image.single-product .woocommerce-product-gallery .woocommerce-product-gallery__trigger {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }
}

/* WAO_STABLE_MOBILE_GALLERY_V2
 * Imagen cuadrada estable desde el primer renderizado.
 * No cambia el diseño desktop.
 */
@media screen and (max-width:767px) {
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper,
  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery .flex-viewport > .woocommerce-product-gallery__wrapper {
    position:relative!important;
    display:block!important;
    width:100%!important;
    aspect-ratio:1/1!important;
    height:auto!important;
    margin:0!important;
    padding:0!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    margin:0!important;
    padding:0!important;
    float:none!important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child > a {
    display:block!important;
    width:100%!important;
    height:100%!important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img.wp-post-image {
    display:block!important;
    width:100%!important;
    height:100%!important;
    object-fit:contain!important;
  }

  body.wao-native-product-layout.wao-mobile-single-image.single-product
    .woocommerce-product-gallery > .flex-viewport {
    width:100%!important;
    height:auto!important;
    aspect-ratio:1/1!important;
    margin:0!important;
    padding:0!important;
    box-sizing:border-box!important;
  }
}
