/* ==========================================================================
   Colour Picker — palette built one colour at a time, backed by a single
   comma-separated hidden input; see colour_picker_controller.js.

   The swatch pill is shared with the read-only cards that report a palette
   (.colour-swatch below), so a colour looks the same whether it is being
   chosen or being read back.
   ========================================================================== */
.colour-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  /* The form field this sits in keeps its labels on one line; the picker's own
     messages are prose and wrap. */
  white-space: normal;
}

.colour-picker__entry {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* The native colour input, unwrapped from its browser chrome so it reads as a
   swatch well sitting alongside the code box. */
.colour-picker__well {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.colour-picker__well:hover {
  border-color: var(--color-border-strong);
}

.colour-picker__well:focus-visible {
  outline: none;
  border-color: var(--color-primary-green);
  box-shadow: var(--focus-ring);
}

.colour-picker__well::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.colour-picker__well::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

.colour-picker__well::-moz-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

.colour-picker__code {
  flex: 1;
  min-width: 0;
}

.colour-picker__add {
  flex-shrink: 0;
}

.colour-picker__error {
  margin: 0;
  font-size: var(--font-size-small);
  color: var(--color-danger);
}

.colour-picker__empty {
  margin: 0;
  font-size: var(--font-size-small);
  color: var(--color-text-faint);
}

/* --- Swatch pill (shared with the read-only palette) --------------------- */
.colour-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.colour-swatch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.colour-swatch__chip {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  /* An inset border rather than an outline, so a white or very pale brand
     colour is still a visible chip. */
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.colour-swatch__code {
  font-size: var(--font-size-medium);
  font-weight: 600;
  color: var(--color-primary-dark);
}

/* Only the editable palette carries these: the read-only pill has nothing to
   take off. */
.colour-swatch__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: var(--space-1);
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  font-size: var(--font-size-medium);
  line-height: 1;
  color: var(--color-text-faint);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.colour-swatch__remove:hover {
  background: var(--tint-danger-10);
  color: var(--color-danger);
}

@media (max-width: 720px) {
  .colour-picker__entry {
    flex-wrap: wrap;
  }

  .colour-picker__code {
    flex: 1 1 140px;
  }
}
