mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-24 04:07:14 -05:00
2.8 KiB
2.8 KiB
Styling
Hover
- Every interactive element has hover feedback. Non-interactive elements have none.
- Hover feedback is a background change one step up the bg scale from the surface the element sits on: on
--color-bg/--color-bg-navuse--color-bg-high, on--color-bg-highuse--color-bg-higher. - Transparent elements (nav links, icon buttons, list rows, menu items, outlined and minimal buttons) get that background on hover, clipped by their own
border-radius. - Filled elements (accent, success, error buttons and badges) keep their fill and mix 15% of
--color-textinto it:color-mix(in oklch, var(--color-text-accent) 85%, var(--color-text)). This moves the same direction as the bg scale in both themes. - Muted text (
--color-text-high) lifts to--color-texton hover. Text already at--color-textdoes not change color. - Plain inline text links underline on hover; nothing else changes. Hover feedback is one or the other, never a background and an underline: the underline comes from a global
a:hoverrule, so every link class with a hover background declarestext-decoration: none. - Transition
background-color 0.15s(addcolor 0.15swhen the text lifts). Noall, no other durations. :focus-visiblegets the same background as hover plusoutline: var(--focus-ring).- The selected/current state (
aria-current="page",aria-selected) is--color-bg-higherand bold, so it stays distinct from hover. - Disabled and pending elements have no hover styles (
:hover:not(:disabled)); their cursor isnot-allowed. - No
transform,scale,opacity,filterorbox-shadowon hover.:activemay usetranslateY(1px). - Elements whose own fill is already
--color-bg-higher(chips, pills, bg-higher cards) have no next step on the scale, so they use the same 15% text mix:color-mix(in oklch, var(--color-bg-higher) 85%, var(--color-text)). - Tabs are the exception to the background step: hovering an unselected tab colours its indicator border
--color-border-highand lifts the text, the selected tab keeps the accent indicator. - Shared components (
SendouButton, menus, tabs, selects) own their hover styles in their own module; feature CSS never adds or overrides hover on them. SendouButtonderives its hover from its fill. A feature class that changes a button's fill sets--button-bginstead ofbackground, so the hover follows (--button-bg: var(--color-bg-higher)); the transparent variants (minimal,outlined) already hover to--color-bg-high(minimalcarries--s-1of horizontal padding so the background has room around the text), override with--button-hover-bgonly when the button sits on a--color-bg-highsurface. Abackgrounddeclaration in feature CSS wins over the shared hover through the cascade layers and leaves the button with no hover at all.