/* Product Color Links — standalone feature.
   Every selector is scoped under .product-color-links. This file is deliberately
   separate from the theme's product stylesheet: the variant colour swatch rules
   there belong to a different feature and are left untouched. */

.product-color-links {
  margin-top: 1rem;
}

/* Under Add to Cart, the purchase column's flex gap already spaces it. */
.form--product .product-color-links {
  margin-top: 0;
}

/* Each metafield renders its own independent section. */
.product-color-links .product-color-links__group + .product-color-links__group {
  margin-top: 1rem;
}

.product-color-links .product-color-links__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

/* Flex + gap only, so the row mirrors naturally in RTL and LTR. */
.product-color-links .product-color-links__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-color-links .product-color-links__item {
  display: flex;
}

/* 24px wide (WCAG 2.2 AA target size) by 44px tall around a 22px dot, so the
   swatches sit close together while the 8px list gap keeps targets apart. */
.product-color-links .product-color-links__link,
.product-color-links .product-color-links__static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 44px;
  border-radius: 8px;
  line-height: 1;
  color: inherit;
  text-decoration: none;
}

.product-color-links .product-color-links__link {
  cursor: pointer;
}

.product-color-links .product-color-links__link:hover .product-color-links__dot {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(0, 0, 0, 0.25);
}

.product-color-links .product-color-links__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* The colour only ever reaches CSS through this custom property, and only
   after the template has proved it is a HEX literal. */
.product-color-links .product-color-links__dot {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--product-color-link, transparent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* Shown instead of a dot when the colour value is not a usable HEX. */
.product-color-links .product-color-links__label {
  display: block;
  padding: 0 0.5rem;
  font-size: 0.875rem;
  text-decoration: underline;
}

.product-color-links .product-color-links__static .product-color-links__label {
  text-decoration: none;
}

/* Accessible name for a dot-only target. */
.product-color-links .product-color-links__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
