/* Horizontal: grid, aligned, no stagger */
.acf-named-color-radio.is-horizontal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 6px;
  align-items: start;
}

/* Vertical stays stacked */
.acf-named-color-radio.is-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  align-items: flex-start;
}

/* Ensure pills fill the grid cell nicely */
.acf-named-color-radio.is-horizontal .acf-named-color-radio__item {
  width: 100%;
  box-sizing: border-box;
}

/* Pill */
.acf-named-color-radio__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  line-height: 1;

  /* Reserve border width always (no jump) */
  border: 2px solid transparent;

  /* Reserve focus ring space always (no jump) */
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Hide native radio but keep accessible */
.acf-named-color-radio__item input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* Color dot */
.acf-named-color-radio__chip {
  width: 24px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;

  /* Reserve border width always */
  border: 2px solid transparent;
}

/* Label */
.acf-named-color-radio__label {
  white-space: nowrap;
}

/* Default (unselected) subtle borders - same widths, only color changes */
.acf-named-color-radio__item {
  border-color: rgba(220, 220, 222, 1); /* similar to #dcdcde */
}

.acf-named-color-radio__chip {
  border-color: rgba(0, 0, 0, 0.18);
}

/* Selected state (no width changes) */
.acf-named-color-radio__item
  input[type="radio"]:checked
  ~ .acf-named-color-radio__label {
  font-weight: 600;
}

/* Use border color (already 2px) instead of thicker outline/box-shadow */
.acf-named-color-radio__item:has(input[type="radio"]:checked) {
  border-color: #2271b1;
}

.acf-named-color-radio__item:has(input[type="radio"]:checked)
  .acf-named-color-radio__chip {
  border-color: #2271b1;
}

/* Focus ring (always reserved, just changes color) */
.acf-named-color-radio__item:has(input[type="radio"]:focus-visible) {
  outline-color: #2271b1;
}

/* Hover (optional, still no size change) */
.acf-named-color-radio__item:hover {
  border-color: rgba(34, 113, 177, 0.35);
}

/* None style */
.acf-named-color-radio__item.is-none .acf-named-color-radio__chip {
  background: transparent !important;
  position: relative;
  border-color: rgba(0, 0, 0, 0.18);
}

.acf-named-color-radio__item.is-none .acf-named-color-radio__chip::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px dashed rgba(0, 0, 0, 0.35);
  border-radius: 999px;
}
