/* card-swatches.css — the colour dots under a product card (Theme settings > Collection > Variant
   display). snippets/card-swatches prints the row; assets/card-swatches.js marks the card for sf's
   shared card_swatches.js, which hovers and selects. Loaded only where the row can be drawn. */
.card-swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 0.3rem;
}
.card-swatch {
  flex: none;
  width: 2.2rem;
  height: 2.2rem;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0.1rem solid rgba(var(--color-foreground), 0.15);
  border-radius: 50%;
  background-color: transparent;
  background-position: center;
  background-size: cover;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.card-swatch:hover { border-color: rgba(var(--color-foreground), 0.5); }
.card-swatch:focus-visible { outline: 0.2rem solid rgb(var(--color-foreground)); outline-offset: 0.2rem; }
.card-swatch.is-selected,
.card-swatch[aria-pressed="true"] {
  border-color: rgb(var(--color-foreground));
  box-shadow: 0 0 0 0.2rem rgb(var(--color-background)), 0 0 0 0.3rem rgb(var(--color-foreground));
}
/* every variant of the colour is sold out */
.card-swatch--sold-out::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1px), rgba(var(--color-foreground), 0.7) calc(50% - 1px), rgba(var(--color-foreground), 0.7) calc(50% + 1px), transparent calc(50% + 1px));
}
.card-swatch-more {
  flex: none;
  color: rgba(var(--color-foreground), 0.7);
  font-size: 1.2rem;
  line-height: 1;
}
/* The row is inside the card, so pointing at a dot also hovers the card, which would show the
   second image over the photo the dot previews. A selected dot's photo stays as well. */
.card-wrapper:has(.card-swatches:hover) .media.media--hover-effect > img:first-child:not(:only-child),
.card-wrapper:has(.card-swatch.is-selected) .media.media--hover-effect > img:first-child:not(:only-child) {
  opacity: 1;
}
.card-wrapper:has(.card-swatches:hover) .media.media--hover-effect > img + img,
.card-wrapper:has(.card-swatch.is-selected) .media.media--hover-effect > img + img {
  opacity: 0;
}
