fix(theme): render btn-shadow via box-shadow so light fills aren't tinted

This commit is contained in:
Ilia Mashkov
2026-07-14 18:02:10 +03:00
parent f1d488ae4f
commit d479f3aabf
+10 -24
View File
@@ -255,37 +255,23 @@
transition: transform 130ms var(--ease-micro);
}
/* Offset "shadow" as a pseudo-block, not box-shadow: box-shadow repaints on
* the main thread while the button's translate runs on the compositor, so the
* two desync per frame. Animating both as transforms keeps them frame-synced. */
/* Hard offset block via box-shadow, so it sits outside the border box and never
* tints a light fill. Shadow rides the element's own transform, so it can't
* desync from the button's translate the way a separate pseudo-element could.
* Offsets are net of the translate: shadow lands at translate + shadow-offset. */
.btn-shadow {
position: relative;
z-index: 0;
transition: transform 130ms var(--ease-micro);
}
.btn-shadow::before {
content: "";
position: absolute;
/* ponytail: inset:0 tracks the padding box, ~1.5px shy of the border box;
* imperceptible on a hard offset block. Widen with negative inset if it shows. */
inset: 0;
z-index: -1;
border-radius: inherit;
background: var(--shadow-color);
transform: translate(3px, 3px);
transition: transform 130ms var(--ease-micro);
box-shadow: 3px 3px 0 var(--shadow-color);
transition:
transform 130ms var(--ease-micro),
box-shadow 130ms var(--ease-micro);
}
.btn-shadow:hover {
transform: translate(-2px, -2px);
}
.btn-shadow:hover::before {
transform: translate(5px, 5px);
box-shadow: 7px 7px 0 var(--shadow-color);
}
.btn-shadow:active {
transform: translate(2px, 2px);
}
.btn-shadow:active::before {
transform: translate(1px, 1px);
box-shadow: -1px -1px 0 var(--shadow-color);
}
/* Brutalist utility classes */