A card family tends to change one decision at a time. The gallery wants more padding, the archive needs a tighter corner, and the reading area needs stronger contrast. Put those decisions on the family wrapper as custom properties. Then use the same card rule in each place.
Try two variants on the same content
Put an element with class="card" inside a wrapper with class="card-family". For a second example, give another wrapper the same class and add data-theme="contrast". Each card will inherit its own wrapper’s values. In this example the high-contrast margins and corner do not change, so you can see exactly what the colour changes achieve.
.card-family {
--card-pad: 1rem;
--card-radius: .75rem;
--card-bg: #eef4fa;
--card-text: #41546a;
--card-edge: #416386;
}
.card-family[data-theme="contrast"] {
--card-bg: #fff;
--card-text: #101820;
--card-edge: #101820;
}
.card {
padding: var(--card-pad, 1rem);
border: 2px solid var(--card-edge, #416386);
border-radius: var(--card-radius, .75rem);
background: var(--card-bg, #eef4fa);
color: var(--card-text, #41546a);
}
.card a { color: inherit; text-decoration: underline; }
.card a:focus-visible { outline: 2px solid currentColor; }
Custom properties inherit through descendants, and var() can supply a fallback if the property is missing. The standalone card in this snippet gets the standard colours and sizing. Both versions use a visible border, and a link has an underline even before it receives focus.
Check the relationship between the colours
The standard text pair is about 7.0:1 and the high-contrast pair is about 17.9:1, calculated from the two hex colours in each theme. Both exceed WCAG’s 4.5:1 minimum for ordinary text. If you place text over a photo or add a subdued secondary colour, check that new pair independently.
For a compact gallery, adjust only --card-pad on the gallery wrapper. Try a two-line title and tab over the links at the narrowest width before choosing the smaller spacing. The wrapper gives the gallery room to make its own decision while the card keeps the same markup and keyboard behaviour.