/* ================================================================
   NEKOJIMA THEME RC12.33
   Safe WooCommerce single-product gallery refinements.
   This layer deliberately does NOT resize FlexSlider's wrapper/viewport
   with forced heights and does not require DOM mutation JavaScript.
================================================================ */

/* The gallery section is the positioning context for the sale badge. */
body.single-product .neko-single-product__gallery {
    position: relative !important;
    min-width: 0 !important;
}

body.single-product .neko-single-product__gallery .woocommerce-product-gallery {
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

/* Undo the unsafe RC12.32 forced heights if an old stylesheet is cached. */
body.single-product .neko-single-product__gallery .woocommerce-product-gallery .flex-viewport,
body.single-product .neko-single-product__gallery .woocommerce-product-gallery__wrapper,
body.single-product .neko-single-product__gallery .woocommerce-product-gallery__image,
body.single-product .neko-single-product__gallery .woocommerce-product-gallery__image > a {
    height: auto !important;
    min-height: 0 !important;
}

/* Each product slide creates its own square stage. FlexSlider is left free
   to calculate its wrapper dimensions normally. */
body.single-product .neko-single-product__gallery .woocommerce-product-gallery__image {
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    border-radius: 26px !important;
    background: #fff !important;
}

body.single-product .neko-single-product__gallery .woocommerce-product-gallery__image > a {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    border-radius: inherit !important;
}

body.single-product .neko-single-product__gallery .woocommerce-product-gallery__image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    object-position: center center !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: inherit !important;
    background: transparent !important;
}

/* Keep the native WooCommerce zoom/lightbox trigger directly on the main
   photograph. We preserve its native click handler and icon markup. */
body.single-product .neko-single-product__gallery .woocommerce-product-gallery__trigger {
    position: absolute !important;
    z-index: 60 !important;
    top: 18px !important;
    right: 18px !important;
    bottom: auto !important;
    left: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(79, 67, 73, .14) !important;
    border-radius: 999px !important;
    color: var(--color-text, #4f4349) !important;
    background: rgba(255, 255, 255, .94) !important;
    box-shadow: 0 7px 22px rgba(55, 44, 50, .14) !important;
    text-decoration: none !important;
    line-height: 1 !important;
    overflow: hidden !important;
    opacity: 1 !important;
}

body.single-product .neko-single-product__gallery .woocommerce-product-gallery__trigger:hover,
body.single-product .neko-single-product__gallery .woocommerce-product-gallery__trigger:focus-visible {
    background: #fff !important;
    transform: translateY(-1px) !important;
}

/* The sale flash is already emitted immediately before the WooCommerce
   gallery inside .neko-single-product__gallery. Position it over the photo
   directly, without moving it in JavaScript. */
body.single-product .neko-single-product__gallery > .onsale {
    position: absolute !important;
    z-index: 61 !important;
    top: 18px !important;
    left: 18px !important;
    right: auto !important;
    bottom: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 10px 15px !important;
    border: 0 !important;
    border-radius: 999px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    box-shadow: 0 7px 22px rgba(55, 44, 50, .14) !important;
    pointer-events: none !important;
}

/* Preserve the RC12.30 thumbnail carousel below the square stage. */
body.single-product .neko-single-product__gallery .neko-thumb-carousel {
    position: relative !important;
    z-index: 2 !important;
}

@media (max-width: 767px) {
    body.single-product .neko-single-product__gallery .woocommerce-product-gallery__image,
    body.single-product .neko-single-product__gallery .woocommerce-product-gallery__image > a {
        border-radius: 20px !important;
    }

    body.single-product .neko-single-product__gallery .woocommerce-product-gallery__trigger {
        top: 12px !important;
        right: 12px !important;
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
    }

    body.single-product .neko-single-product__gallery > .onsale {
        top: 12px !important;
        left: 12px !important;
        padding: 9px 13px !important;
        font-size: .9rem !important;
    }
}
