Are you applying a custom class per specific collection component? It would help to see the settings in your Glide dashboard where the class is assigned, and please also share a screenshot of your custom CSS.
Avoid using broad selectors like .collection-item > div or .collection-item-dark > div unless you are certain of the exact target element, as this can unintentionally affect multiple nested elements.
If your intention is to have one collection use the default style and another use a custom style, then proper scoping is required. For example:
.custom-class [data-testid="cc-card"] { ... }
should work as long as .custom-class is correctly assigned in the Glide component options tab.
If you are trying to achieve dynamic or conditional styling behavior per collection instance, you may also find this approach relevant:
If you want to avoid layout shift (e.g. border affecting image size), you can use
outlineinstead ofborder, since outline does not affect element dimensions.