Repository navigation
Expand file tree
/
Copy pathStyle.css
More file actions
95 lines (84 loc) · 2.16 KB
/
Copy pathStyle.css
File metadata and controls
95 lines (84 loc) · 2.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
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #0d0d0d;
}
/* ── hidden checkbox ── */
.toggle-input {
display: none;
}
/* ── track ── */
.toggle-label {
display: inline-block;
width: 90px;
height: 50px;
border-radius: 999px;
background: #2a2a3a;
border: 2.5px solid #3a3a55;
position: relative;
cursor: pointer;
transition:
background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
box-shadow 0.4s ease;
}
/* ── thumb ── */
.toggle-label::after {
content: '';
position: absolute;
top: 50%;
left: 6px;
transform: translateY(-50%);
width: 36px;
height: 36px;
border-radius: 50%;
background: #fff;
box-shadow:
0 2px 6px rgba(0,0,0,0.4),
0 1px 2px rgba(0,0,0,0.3);
transition:
left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
width 0.15s ease,
box-shadow 0.4s ease;
}
/* ── checked state ── */
.toggle-input:checked + .toggle-label {
background: #4f6ef7;
border-color: #3a58d8;
box-shadow:
0 0 0 4px rgba(79, 110, 247, 0.15),
0 4px 20px rgba(79, 110, 247, 0.35);
}
.toggle-input:checked + .toggle-label::after {
left: calc(100% - 42px);
box-shadow:
0 2px 8px rgba(0,0,0,0.4),
0 0 0 2px rgba(255,255,255,0.1);
}
/* ── squish on press ── */
.toggle-label:active::after {
width: 42px;
}
.toggle-input:checked + .toggle-label:active::after {
left: calc(100% - 48px);
width: 42px;
}
/* ── ripple on click ── */
.toggle-label .ripple {
position: absolute;
inset: -10px;
border-radius: 999px;
border: 2px solid rgba(79, 110, 247, 0);
pointer-events: none;
animation: none;
}
.toggle-input:checked + .toggle-label .ripple {
animation: rippleOut 0.5s ease-out forwards;
}
@keyframes rippleOut {
0% { inset: -4px; border-color: rgba(79,110,247,0.5); }
100% { inset: -14px; border-color: rgba(79,110,247,0); }
}