The code below does a good job of plotting $B / (A \cup C)$ provided $A \cap C = \emptyset$ but fails when $A$ and $C$ overlap.
How can I fix the lower panel so that only the part of $B$ that is outside $A$ and $C$ gets filled? If needed, it can be different from the solution for the top row, but one solution for both situations would be ideal.
I had recently asked a similar question where an answer showed how to make the top panel without filling in circles A and C in white, and am hoping it is possible to do the same for this new scenario.
\documentclass[tikz,border=1mm]{standalone}
\usetikzlibrary{math}
\begin{document}
\newcommand{\drawrow}[5]
{
\tikzmath{\xo=#1; \y=#2; \r=#3; \d=#4; \n=#5;};
\foreach \x in {1,...,\n}{
\draw ({\xo + (\x - 1) * \d}, \y) circle (\r) {};
}
}
\begin{tikzpicture}
\tikzmath{\r = 1; \d = 1.2; \x = -\d; \y=0;}
\def\A{({\x},\y) circle(\r)};
\def\B{({\x+\d},{\y}) circle(\r)};
\def\C{({\x+2\d},{\y}) circle(\r)};
\begin{scope}
\clip \B;
\fill[lightgray, even odd rule] \B \A \C;
\end{scope}
\drawrow{\x}{\y}{\r}{\d}{3}
\node at ({\x}, \y) {A};
\node at ({\x+\d}, \y) {B};
\node at ({\x+2\d}, \y) {C};
\tikzmath{\r = 1; \d = 0.8; \x = -\d; \y=-2.5;} %%%% <---- NOTE CHANGE IN \d
\def\A{({\x},\y) circle(\r)};
\def\B{({\x+\d},{\y}) circle(\r)};
\def\C{({\x+2\d},{\y}) circle(\r)};
\begin{scope}
\clip \B;
\fill[lightgray, even odd rule] \B \A \C;
\end{scope}
\drawrow{\x}{\y}{\r}{\d}{3}
\node at ({\x}, \y) {A};
\node at ({\x+\d}, \y) {B};
\node at ({\x+2\d}, \y) {C};
\end{tikzpicture}
\end{document}


