/* Variation swatches (see inc/variation-swatches.php) */

.berry-swatches__select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.berry-swatches__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.berry-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  background: var(--clr-surface, #fff);
  border: 2px solid var(--clr-border, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: border-color var(--transition, 0.2s), box-shadow var(--transition, 0.2s);
  color: var(--clr-text, #1a0a1e);
}

.berry-swatch--image {
  width: 56px;
  height: 56px;
  overflow: hidden;
}

.berry-swatch--image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.berry-swatch--text {
  min-height: 40px;
  padding: 6px 14px;
  font: 500 14px/1.2 var(--font-sans, system-ui, sans-serif);
}

.berry-swatch:hover {
  border-color: var(--clr-text-dim, #a08ab0);
}

.berry-swatch:focus-visible {
  outline: 2px solid var(--clr-primary, #9c50ff);
  outline-offset: 2px;
}

.berry-swatch.is-active {
  border-color: var(--clr-primary, #9c50ff);
  box-shadow: 0 0 0 1px var(--clr-primary, #9c50ff);
}

.berry-swatch.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.berry-swatches__current {
  font-weight: 400;
  color: var(--clr-text-muted, #5c4466);
}

/* WooCommerce's table layout puts the label beside the control; stack them so a
   long swatch row gets the full summary width. */
.variations_form table.variations tr:has(.berry-swatches) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.variations_form table.variations tr:has(.berry-swatches) th,
.variations_form table.variations tr:has(.berry-swatches) td {
  display: block;
  padding: 0;
  text-align: left;
}
