The physics
Cut the gap into columns, from plate to plate. Each column is a small capacitor. The columns sit side by side, so their capacitances add.
side by side: C = C₁ + C₂ + …
Inside one column, the layers sit in a line. The same charge sits on each layer. So they add as 1/C.
in a line: 1/C = 1/C₁ + 1/C₂ + … one layer: C = Kε0A/t
A slab across part of the area adds side by side. A slab across part of the gap adds in a line. A rising liquid fills part of the area. So its wet and dry parts add.
When K changes smoothly across the gap, add 1/C over many thin layers.
K from K₁ to K₂, evenly: C = C0 (K₂ − K₁) / ln(K₂/K₁)