File size: 5,588 Bytes
e927672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* ═══════════════════════════════════════════════════════════════════════════

   ThemeToggle.css β€” QUANTUM MORPHIC v5.0

   PASTE THIS β†’ src/components/ThemeToggle.css



   β€’ Track morphs shape + color on toggle

   β€’ Thumb does a liquid squish spring jump

   β€’ Glow aura pulses on toggle

   β€’ Cursor scan line fires (via JS)

   β€’ Full dark/light cursor color propagation via CSS vars

═══════════════════════════════════════════════════════════════════════════ */

.theme-toggle {
  background: none;
  border: none;
  cursor: none;
  padding: 0;
  flex-shrink: 0;
  position: relative;
}

/* ── Aura ring that pulses on toggle ── */
.theme-toggle::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 40px;
  background: var(--grad-aurora);
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}
.theme-toggle:hover::before {
  opacity: 0.18;
}
.theme-toggle.just-toggled::before {
  animation: toggleAuraPulse 0.65s cubic-bezier(0.19,1,0.22,1) forwards;
}
@keyframes toggleAuraPulse {
  0%   { opacity: 0;    transform: scale(0.8); }
  30%  { opacity: 0.45; transform: scale(1.2); }
  100% { opacity: 0;    transform: scale(1.5); }
}

/* ── Track ── */
.toggle-track {
  position: relative;
  width: 64px;
  height: 32px;
  background: var(--toggle-bg, rgba(124,58,237,0.14));
  border: 1.5px solid var(--toggle-border, rgba(124,58,237,0.4));
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  overflow: hidden;
  cursor: none;
  transition:
    background      0.55s cubic-bezier(0.4,0,0.2,1),
    border-color    0.55s cubic-bezier(0.4,0,0.2,1),
    box-shadow      0.55s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 14px rgba(124,58,237,0.22);
}

/* Track inner shimmer */
.toggle-track::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.18) 50%,
    transparent 100%
  );
  transition: left 0.5s ease;
  pointer-events: none;
  border-radius: inherit;
}
.theme-toggle:hover .toggle-track::after { left: 100%; }

/* Light mode track */
[data-theme='light'] .toggle-track {
  background: var(--toggle-bg, rgba(253,230,138,0.2));
  border-color: var(--toggle-border, rgba(217,119,6,0.5));
  box-shadow: 0 0 14px rgba(217,119,6,0.22);
}

/* ── Icons ── */
.toggle-icon {
  font-size: 14px;
  line-height: 1;
  z-index: 1;
  position: relative;
  transition:
    opacity   0.35s ease,
    transform 0.35s cubic-bezier(0.34,1.56,0.64,1),
    filter    0.35s ease;
}

/* Dark mode: moon active, sun dim */
.toggle-icon.moon { opacity: 1; filter: drop-shadow(0 0 5px rgba(0,255,238,0.8)); }
.toggle-icon.sun  { opacity: 0.32; transform: scale(0.75) rotate(-30deg); filter: none; }

/* Light mode: sun active, moon dim */
[data-theme='light'] .toggle-icon.moon {
  opacity: 0.32;
  transform: scale(0.75) rotate(30deg);
  filter: none;
}
[data-theme='light'] .toggle-icon.sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  filter: drop-shadow(0 0 6px rgba(217,119,6,0.9));
}

/* ── Thumb β€” the liquid slider ── */
.toggle-thumb {
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;

  /* Dark: cyan→purple gradient */
  background: linear-gradient(135deg, #7c3aed, #00ffee);
  box-shadow:
    0 0 14px rgba(0,255,238,0.75),
    0 0 28px rgba(124,58,237,0.35),
    0 2px 6px rgba(0,0,0,0.4);

  transition:
    left         0.45s cubic-bezier(0.34,1.56,0.64,1),
    background   0.55s cubic-bezier(0.4,0,0.2,1),
    box-shadow   0.55s cubic-bezier(0.4,0,0.2,1),
    border-radius 0.3s ease;

  will-change: left, background;
}

/* Thumb squish on mid-animation */
.toggle-thumb.squish {
  animation: thumbSquish 0.45s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes thumbSquish {
  0%   { border-radius: 50%; transform: translateY(-50%) scaleX(1); }
  30%  { border-radius: 40% 60% 60% 40%; transform: translateY(-50%) scaleX(1.35); }
  60%  { border-radius: 60% 40% 40% 60%; transform: translateY(-50%) scaleX(0.8); }
  100% { border-radius: 50%; transform: translateY(-50%) scaleX(1); }
}

/* Light mode thumb: gold→amber */
.toggle-thumb.light {
  left: calc(100% - 28px);
  background: linear-gradient(135deg, #d97706, #fbbf24);
  box-shadow:
    0 0 14px rgba(251,191,36,0.9),
    0 0 28px rgba(217,119,6,0.5),
    0 2px 6px rgba(0,0,0,0.2);
}

/* Thumb inner sparkle */
.toggle-thumb::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  filter: blur(2px);
  transition: background 0.55s ease;
}
.toggle-thumb.light::before {
  background: rgba(255,255,255,0.7);
}

/* ── State label (screen-reader) ── */
.toggle-label-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}