.ths-native-swatch-field {
    position: relative;
    width: 100%;
}

/* WooCommerce's select remains available to its native variation script but is
 * visually removed. */
.ths-native-swatch-field > select,
.ths-native-swatch-field .select2-container,
.ths-native-swatch-field .select2-selection {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ths-native-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.ths-native-swatch {
    appearance: none;
    -webkit-appearance: none;
    min-width: 42px;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid rgba(0, 0, 0, .24);
    border-radius: 7px;
    background: #fff;
    color: inherit;
    font: inherit;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease, transform .15s ease;
}

.ths-native-swatch:hover:not(.is-disabled),
.ths-native-swatch:focus-visible {
    border-color: currentColor;
    box-shadow: 0 0 0 2px rgba(44, 153, 209, .22);
    outline: none;
}

.ths-native-swatch.is-selected {
    border-color: #2c99d1;
    box-shadow: 0 0 0 2px rgba(44, 153, 209, .32);
    transform: translateY(-1px);
}

.ths-native-swatch.is-disabled {
    opacity: .34;
    cursor: not-allowed;
    text-decoration: line-through;
}

.ths-native-swatches--color .ths-native-swatch {
    width: 42px;
    min-width: 42px;
    padding: 0;
}

.ths-native-swatches--image .ths-native-swatch {
    width: 54px;
    height: 54px;
    padding: 3px;
    overflow: hidden;
}

.ths-native-swatches--image .ths-native-swatch img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.ths-native-swatches--radio {
    display: grid;
    gap: 6px;
}

.ths-native-swatches--radio .ths-native-swatch {
    position: relative;
    justify-self: start;
    min-height: 34px;
    padding: 6px 10px 6px 32px;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.ths-native-swatches--radio .ths-native-swatch::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 50%;
    transform: translateY(-50%);
}

.ths-native-swatches--radio .ths-native-swatch.is-selected::after {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    transform: translateY(-50%);
}

@media (max-width: 767px) {
    .ths-native-swatch {
        min-width: 44px;
        min-height: 44px;
    }
}


/* v1.7.2: Keep sold-out variation values visible but unmistakably unavailable. */
.ths-native-swatch.is-out-of-stock,
.ths-native-swatch.is-disabled {
    opacity: .38;
    cursor: not-allowed;
    filter: grayscale(1);
    text-decoration: line-through;
}

.ths-native-swatch.is-out-of-stock:hover,
.ths-native-swatch.is-out-of-stock:focus,
.ths-native-swatch.is-disabled:hover,
.ths-native-swatch.is-disabled:focus {
    transform: none;
    box-shadow: none;
    border-color: rgba(0, 0, 0, .24);
}

/* ---- The Display Case -----------------------------------------------------
   The defaults above are built for a light page: a white button inheriting
   the page's text colour. On a dark theme that inherited colour is a pale
   grey, so the label all but disappears, and a sold spot at 38% opacity on
   grey is indistinguishable from an available one.

   These rules restate the same states on the dark palette. */
.ths-native-swatch {
    background: linear-gradient(180deg, #161d27, #11161e);
    border: 1px solid rgba(197, 214, 229, .22);
    color: #e9eef4;
    font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-weight: 700;
    letter-spacing: .01em;
    border-radius: 11px;
}

.ths-native-swatch:hover:not(.is-disabled):not(.is-out-of-stock),
.ths-native-swatch:focus-visible {
    border-color: #2C99D1;
    background: linear-gradient(180deg, #1b2532, #131a24);
    color: #ffffff;
    box-shadow: 0 0 0 2px rgba(44, 153, 209, .28);
}

/* Chosen spot: the primary fill, so there is no doubt which one is picked. */
.ths-native-swatch.is-selected {
    background: #2C99D1;
    border-color: #2C99D1;
    color: #04121c;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(44, 153, 209, .34);
}

.ths-native-swatch.is-selected:hover {
    background: #7fc7ec;
    border-color: #7fc7ec;
    color: #04121c;
}

/* Taken spots read as taken at a glance: struck through, dimmed text on a
   flat fill, no hover. Opacity alone was not enough to tell them apart. */
.ths-native-swatch.is-disabled,
.ths-native-swatch.is-out-of-stock {
    opacity: 1;
    background: rgba(197, 214, 229, .06);
    border-color: rgba(197, 214, 229, .12);
    border-style: dashed;
    color: #7c8a99;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    cursor: not-allowed;
    box-shadow: none;
}

.ths-native-swatch.is-disabled:hover,
.ths-native-swatch.is-out-of-stock:hover,
.ths-native-swatch.is-disabled:focus,
.ths-native-swatch.is-out-of-stock:focus {
    background: rgba(197, 214, 229, .06);
    border-color: rgba(197, 214, 229, .12);
    color: #7c8a99;
    box-shadow: none;
    transform: none;
}

/* Colour swatches keep their own fill; only the frame follows the palette. */
.ths-native-swatches--color .ths-native-swatch {
    background: transparent;
    border-color: rgba(197, 214, 229, .28);
}
