/*
 * Swatches on shop and archive cards (spec 10.1). Loads with the card script.
 */
.wcsw-card {
    position: relative;
    margin: 0.5em 0;
}

.wcsw-card .variations {
    display: block;
    margin: 0;
}

.wcsw-card-attribute {
    margin-bottom: 4px;
}

.wcsw-card .swatch-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.wcsw-card .swatch-wrapper[hidden] {
    display: none !important;
}

.wcsw-card-align-left {
    text-align: left;
}

.wcsw-card-align-center {
    text-align: center;
}

.wcsw-card-align-center .swatch-control {
    justify-content: center;
}

.wcsw-card-align-right {
    text-align: right;
}

.wcsw-card-align-right .swatch-control {
    justify-content: flex-end;
}

.wcsw-card-label {
    margin-bottom: 4px;
    font-size: 0.875em;
}

.wcsw-card .wcsw-more {
    display: inline-block;
    margin: 0 5px 5px 0;
    padding: 0 6px;
    border: 1px solid currentColor;
    background: none;
    color: inherit;
    font-size: 0.875em;
    line-height: 1.75;
    text-decoration: none;
    cursor: pointer;
}

.wcsw-card .swatch-control + .wcsw-more {
    margin-top: 0;
}

.wcsw-card-clear {
    display: inline-block;
    font-size: 0.875em;
}

.wcsw-card-stock {
    font-size: 0.875em;
}

.wcsw-card-stock p {
    margin: 0;
}

/* The card's price and stock show the variation; WooCommerce's variation block stays hidden. */
.wcsw-card .single_variation_wrap .single_variation {
    display: none !important;
}

.wcsw-card-loading .variations {
    opacity: 0.4;
    pointer-events: none;
}

.wcsw-card-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: wcsw-card-spin 0.8s linear infinite;
}

@keyframes wcsw-card-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wcsw-card-loading::after {
        animation: none;
    }
}

/* Stacked groups on a card share one left edge, names over their first swatch; the stack follows the card alignment. */
.wcsw-card .swatch-groups-vertical {
    width: fit-content;
    text-align: left;
}

.wcsw-card-align-center .swatch-groups-vertical {
    margin-inline: auto;
}

.wcsw-card-align-right .swatch-groups-vertical {
    margin-left: auto;
}
