Defining joint distribution of two uniform variables where one is bounded by the other

We can break the joint distribution into a product of marginal and conditional distributions: $$f_{X, Y}(x, y) = f_{X}(x) f_{Y \mid X}(y \mid x).$$

We have the marginal distribution for $X$: $$f_X(x) = \begin{cases} 1 & \text{if } 0 < x < 1,\\ 0 & \text{otherwise.} \end{cases}$$ and, letting $c = 1 - k$, the conditional distribution of $Y$ given $X$ is a uniform on the interval with lower bound $$\max(0, x - c),$$ and upper bound $$\min(1, x + c).$$ Therefore, $$f_{Y \mid X}(y \mid x) = \begin{cases} \left(\min(1, x + c) - \max(0, x - c)\right)^{-1} & \text{if } \max(0, x - c) < y < \min(1, x + c),\\ 0 & \text{otherwise.} \end{cases}$$

Multiplying these together we have $$f_{X, Y}(x, y) = \begin{cases} \left(\min(1, x + c) - \max(0, x - c)\right)^{-1} & \text{if } 0 < x < 1 \text{ and } \max(0, x - c) < y < \min(1, x + c),\\ 0 & \text{otherwise.} \end{cases}$$