@layer components {
  .swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .swatches__option {
    display: inline-block;
    cursor: pointer;
    line-height: 0;
  }

  /* Hide the actual radio; the colored cell is the click target. */
  .swatches__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .swatches__option .cell {
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid transparent;
    transition: border-color 0.1s ease, transform 0.1s ease;
  }

  .swatches__option:has(input:checked) .cell {
    border-color: var(--text);
    transform: scale(1.05);
  }

  .swatches__option:hover .cell {
    transform: scale(1.05);
  }
}
