/*
 * Grain Out of Stock Visual
 * Targets the custom Grain single-product selectors only.
 * Stock state and variation logic remain controlled by the theme/WooCommerce.
 */

#grain-prod-img-wrap.gosv-oos-active {
    isolation: isolate;
}

/* The theme's original ribbon covers the complete image wrapper with a dark box.
   Keep the state layer, but remove the block so the product/card background remains visible. */
#grain-prod-img-wrap .grain-stock-ribbon {
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    color: transparent !important;
}

/* Dim only the actual product image. Transparent pixels stay transparent, which
   keeps the Grain card colour/pattern alive instead of creating a black rectangle. */
#grain-prod-img-wrap.gosv-oos-active > #grain-prod-img {
    filter: grayscale(.68) brightness(.44) saturate(.55) contrast(.96) !important;
    opacity: .82;
    transition: filter .24s ease, opacity .24s ease !important;
}

/* A sold-out product should not keep sparkling/animating behind the status. */
#grain-prod-img-wrap.gosv-oos-active > .prod-shine {
    opacity: .12 !important;
    animation: none !important;
}

#grain-prod-img-wrap .grain-stock-ribbon .gosv-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    max-width: calc(100% - 32px);
    padding: .68rem 1.25rem;
    border-radius: 999px;
    background: var(--red, #D94530);
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(.92rem, 2.5vw, 1.12rem);
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    box-shadow: 0 5px 16px rgba(0,0,0,.16);
    border: 1px solid rgba(255,255,255,.14);
}

@media (max-width: 599px) {
    #grain-prod-img-wrap .grain-stock-ribbon .gosv-badge {
        min-height: 42px;
        max-width: calc(100% - 24px);
        padding: .62rem 1.05rem;
        font-size: .94rem;
        box-shadow: 0 4px 13px rgba(0,0,0,.14);
    }
}

@media (prefers-reduced-motion: reduce) {
    #grain-prod-img-wrap.gosv-oos-active > #grain-prod-img {
        transition: none !important;
    }
}
