/**
 * [swatch_selector] on product listing cards: the Color line, the Stocked in / Made to
 * Order groups, the +N tile, and the Made to Order ? with its tooltip.
 *
 * The ? and tooltip match the product page's swatch selector block, whose stylesheet
 * does not load on listings.
 *
 * @package EchelonCore
 */

.swatch-selector .swatch-group-headings[hidden] {
    display: none;
}

/* Color: White */
.swatch-selector__color {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    margin: 0 0 12px;
}

.swatch-selector__color-name {
    font-weight: 400;
}

/*
 * The theme shows the active swatch's name under the row and pads the row for it.
 * The Color line names it here, so the label is kept for screen readers only.
 */
.swatch-selector .swatches {
    padding-bottom: 0;
}

.swatch-selector .swatch .swatch__label,
.swatch-selector .swatch.is-active .swatch__label {
    position: absolute;
    top: auto;
    left: auto;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

/* Stocked in 90210 / Made to Order ? */
.swatch-selector .swatch-region-group + .swatch-region-group {
    margin-top: 16px;
}

.swatch-selector .swatch-region-group-title {
    margin: 0 0 8px;
}

/* "Not stocked in {zip}" has no swatches of its own. */
.swatch-selector .swatch-region-group--not-stocked .swatch-region-group-title {
    margin-bottom: 0;
}

/* The +N tile sits in the row at swatch size. */
.swatch-selector .swatch-more,
.swatch-selector .swatch-more:hover,
.swatch-selector .swatch-more:focus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    margin: 0;
    padding: 0 6px;
    border: 1px solid var(--global-palette10, var(--global-palette4));
    background: var(--global-palette9);
    color: var(--global-palette3);
    text-decoration: none;
}

/* Made to Order ? and its tooltip. */
.swatch-selector .made-to-order-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    vertical-align: middle;
}

/* The theme styles every button as a large filled button, so each property is reset. */
.swatch-selector .made-to-order-info__trigger,
.swatch-selector .made-to-order-info__trigger:hover,
.swatch-selector .made-to-order-info__trigger:focus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    min-width: 0;
    height: 16px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--global-palette3);
    box-shadow: none;
    color: var(--global-palette9);
    font-family: var(--global-body-font-family);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
    cursor: help;
}

.swatch-selector .made-to-order-info__trigger:focus-visible {
    outline: 2px solid var(--global-palette3);
    outline-offset: 2px;
}

.swatch-selector .made-to-order-info__tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 10;
    width: max-content;
    max-width: 260px;
    padding: 8px 12px;
    background: var(--global-palette3);
    color: var(--global-palette9);
    font-family: var(--global-body-font-family);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.4;
    text-align: left;
    text-transform: none;
    transform: translateX(-50%);
    visibility: hidden;
    opacity: 0;
}

.swatch-selector .made-to-order-info__tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    border: 6px solid transparent;
    border-top-color: var(--global-palette3);
    transform: translateX(-50%);
}

.swatch-selector .made-to-order-info:hover .made-to-order-info__tooltip,
.swatch-selector .made-to-order-info:focus-within .made-to-order-info__tooltip {
    visibility: visible;
    opacity: 1;
}

.swatch-selector .made-to-order-info.is-dismissed .made-to-order-info__tooltip {
    visibility: hidden;
    opacity: 0;
}
