-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathHighContrastToggle.css
More file actions
108 lines (93 loc) · 3.16 KB
/
Copy pathHighContrastToggle.css
File metadata and controls
108 lines (93 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
HighContrastToggle styles
─────────────────────────
All colours use semantic tokens — no component-internal hex.
The [data-contrast="high"] overrides in index.css automatically
restyle this component when high-contrast mode is active.
*/
/* ── Layout row ─────────────────────────────────────────────────────────── */
.hc-toggle-row {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1.5rem;
}
.hc-toggle-row--compact {
display: inline-flex;
gap: 0;
}
/* ── Label group ─────────────────────────────────────────────────────────── */
.hc-toggle-label-group {
display: grid;
gap: 0.25rem;
}
.hc-toggle-label {
font-size: 0.9375rem;
font-weight: 600;
color: var(--text);
}
.hc-toggle-description {
font-size: 0.85rem;
color: var(--muted);
line-height: var(--lh-small);
}
/* ── Button (role=switch) ────────────────────────────────────────────────── */
.hc-toggle-btn {
/* Reset */
appearance: none;
background: transparent;
border: none;
padding: 0;
cursor: pointer;
/* Touch target (WCAG 2.5.5) */
min-width: 44px;
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.hc-toggle-btn:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 3px;
border-radius: var(--radius-pill);
}
/* ── Track ───────────────────────────────────────────────────────────────── */
.hc-toggle-track {
position: relative;
display: block;
width: 48px;
height: 28px;
border-radius: var(--radius-pill);
background: var(--border);
transition: background-color 0.2s ease;
padding: 2px;
}
.hc-toggle-btn[data-state="on"] .hc-toggle-track {
background: var(--accent);
}
/* ── Thumb ───────────────────────────────────────────────────────────────── */
.hc-toggle-thumb {
display: block;
width: 24px;
height: 24px;
border-radius: var(--radius-pill);
background: #ffffff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
transform: translateX(0);
transition: transform 0.2s ease;
}
.hc-toggle-btn[data-state="on"] .hc-toggle-thumb {
transform: translateX(20px);
}
/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
.hc-toggle-track,
.hc-toggle-thumb {
transition: none;
}
}
/* Reduced Motion Override */
[data-motion="reduced"] .hc-toggle-track,
[data-motion="reduced"] .hc-toggle-thumb {
transition: none;
}