.core-sale-subcat-grid {
    display: grid;
    grid-template-columns: repeat(var(--core-sale-subcat-cols, 4), minmax(0, 1fr));
    gap: 20px;
    direction: rtl;
}

.core-sale-subcat-grid__item {
    display: block;
    color: inherit;
    text-decoration: none;
}

/* Square box: the icon fills its top-left 76%, the tag SVG its bottom-right 50%, so both keep their proportions at any width. */
.core-sale-subcat-grid__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.core-sale-subcat-grid__icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 76%;
    height: 76%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.core-sale-subcat-grid__tag {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 50%;
    height: 50%;
    overflow: visible;
    pointer-events: none;
}

/* Mobile-only tag; sized against the icon box, which on mobile is the whole media box. */
.core-sale-subcat-grid__sticker {
    position: absolute;
    right: -10%;
    bottom: -10%;
    display: none;
    width: 60%;
    height: 60%;
    overflow: visible;
    pointer-events: none;
}

/* Centered under the icon rather than under the whole box. */
.core-sale-subcat-grid__prices {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 76%;
    margin: 6px auto 0 0;
    line-height: 1.3;
    text-align: center;
}

.core-sale-subcat-grid__title h4{
    height: 52px;
    font-weight: bold;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 76%;
    line-height: 1.3;
    text-align: center;
    gap: 2px;
    margin: 6px auto 0px 0px;
}

.core-sale-subcat-grid__regular {
    color: #8a8f98;
    font-size: 12px;
    text-decoration: line-through;
}

.core-sale-subcat-grid__sale {
    background: none;
    color: #d32f2f;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.core-sale-subcat-grid__empty {
    padding: 16px;
    color: #666;
    text-align: center;
}

@media (max-width: 1024px) {
    .core-sale-subcat-grid {
        grid-template-columns: repeat(var(--core-sale-subcat-cols-tablet, 3), minmax(0, 1fr));
        gap: 16px;
    }
    /* .core-sale-subcat-grid__title h4{
        height: unset;
    } */
}

@media (max-width: 600px) {
    .core-sale-subcat-grid {
        grid-template-columns: repeat(var(--core-sale-subcat-cols-mobile, 2), minmax(0, 1fr));
        gap: 12px;
    }

    /* The icon is centered and the sticker sits on its corner, so the media box shrinks to the icon itself. */
    .core-sale-subcat-grid__media {
        width: 95%;
        margin: 0 auto;
    }

    .core-sale-subcat-grid__icon {
        width: 100%;
        height: 100%;
    }

    .core-sale-subcat-grid__tag {
        display: none;
    }

    .core-sale-subcat-grid__sticker {
        display: block;
    }

    /* Percentage margins follow the column width, so the gap always clears the sticker's tip. */
    .core-sale-subcat-grid__prices {
        width: 80%;
        margin: 10% auto 0;
    }
    
    .core-sale-subcat-grid__title h4{
        width: 80%;
        margin: 10% auto 0;
       /* height: 26px;*/
    }

    .core-sale-subcat-grid__regular {
        font-size: 10px;
    }

    .core-sale-subcat-grid__sale {
        font-size: 10px;
    }
}
