Guilherme Favaron commited on
Commit
5fa1a81
·
1 Parent(s): a84f884

Sync: toggle de tema com sol/lua e modo automático

Browse files
Files changed (2) hide show
  1. index.html +43 -1
  2. style.css +106 -25
index.html CHANGED
@@ -13,6 +13,11 @@
13
  <header class="header">
14
  <h1 class="logo"><span class="logo-mind">MINDAPPS</span><span class="logo-ai">.AI</span></h1>
15
  <p class="tagline">Laboratório de IA Aplicada</p>
 
 
 
 
 
16
  </header>
17
 
18
  <!-- Intro Card -->
@@ -224,5 +229,42 @@
224
  </p>
225
  </footer>
226
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  </body>
228
- </html>
 
13
  <header class="header">
14
  <h1 class="logo"><span class="logo-mind">MINDAPPS</span><span class="logo-ai">.AI</span></h1>
15
  <p class="tagline">Laboratório de IA Aplicada</p>
16
+ <button id="theme-toggle" class="theme-toggle" aria-label="Alternar tema">
17
+ <span class="theme-icon">☀️</span>
18
+ <span class="theme-icon">🌙</span>
19
+ <span class="theme-toggle-knob"></span>
20
+ </button>
21
  </header>
22
 
23
  <!-- Intro Card -->
 
229
  </p>
230
  </footer>
231
  </div>
232
+ <script>
233
+ (function() {
234
+ const storageKey = 'theme-preference';
235
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
236
+ const toggleBtn = document.getElementById('theme-toggle');
237
+
238
+ function applyTheme(mode) {
239
+ if (mode === 'auto') {
240
+ document.body.setAttribute('data-theme', mediaQuery.matches ? 'dark' : 'light');
241
+ } else {
242
+ document.body.setAttribute('data-theme', mode);
243
+ }
244
+ }
245
+
246
+ function init() {
247
+ let saved = localStorage.getItem(storageKey);
248
+ const initial = saved ? saved : (mediaQuery.matches ? 'dark' : 'light');
249
+ applyTheme(initial);
250
+
251
+ mediaQuery.addEventListener('change', () => {
252
+ const savedPref = localStorage.getItem(storageKey);
253
+ if (!savedPref) {
254
+ applyTheme(mediaQuery.matches ? 'dark' : 'light');
255
+ }
256
+ });
257
+
258
+ toggleBtn.addEventListener('click', () => {
259
+ const current = document.body.getAttribute('data-theme') || (mediaQuery.matches ? 'dark' : 'light');
260
+ const next = current === 'dark' ? 'light' : 'dark';
261
+ localStorage.setItem(storageKey, next);
262
+ applyTheme(next);
263
+ });
264
+ }
265
+
266
+ init();
267
+ })();
268
+ </script>
269
  </body>
270
+ </html>
style.css CHANGED
@@ -1,4 +1,20 @@
1
  /* Reset and Base Styles */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  * {
3
  margin: 0;
4
  padding: 0;
@@ -8,8 +24,8 @@
8
  body {
9
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Arial", sans-serif;
10
  line-height: 1.6;
11
- color: #1f2937;
12
- background: #f9fafb;
13
  padding: 0;
14
  }
15
 
@@ -26,6 +42,7 @@ body {
26
  padding: 2rem 0;
27
  background: #000;
28
  margin: -2rem -1rem 2rem -1rem;
 
29
  }
30
 
31
  .logo {
@@ -40,11 +57,11 @@ body {
40
  }
41
 
42
  .logo-ai {
43
- color: #ffbe00;
44
  }
45
 
46
  .tagline {
47
- color: #9ca3af;
48
  font-size: 0.875rem;
49
  text-transform: uppercase;
50
  letter-spacing: 0.15em;
@@ -53,8 +70,8 @@ body {
53
 
54
  /* Cards */
55
  .card {
56
- background: white;
57
- border: 1px solid #e5e7eb;
58
  border-radius: 12px;
59
  padding: 1.5rem;
60
  margin-bottom: 2rem;
@@ -68,11 +85,11 @@ body {
68
  .intro-card h2 {
69
  font-size: 1.5rem;
70
  margin-bottom: 1rem;
71
- color: #111827;
72
  }
73
 
74
  .intro-card p {
75
- color: #4b5563;
76
  font-size: 1rem;
77
  margin-bottom: 0.75rem;
78
  }
@@ -99,7 +116,7 @@ body {
99
  }
100
 
101
  .btn-primary {
102
- background: #ffbe00;
103
  color: #000;
104
  }
105
 
@@ -128,8 +145,8 @@ body {
128
  }
129
 
130
  .stat-item {
131
- background: white;
132
- border: 1px solid #e5e7eb;
133
  border-radius: 8px;
134
  padding: 1.5rem;
135
  text-align: center;
@@ -145,7 +162,7 @@ body {
145
  .stat-label {
146
  display: block;
147
  font-size: 0.875rem;
148
- color: #6b7280;
149
  text-transform: uppercase;
150
  letter-spacing: 0.05em;
151
  margin-top: 0.25rem;
@@ -160,9 +177,9 @@ body {
160
  font-size: 1.25rem;
161
  font-weight: 700;
162
  margin-bottom: 1rem;
163
- color: #111827;
164
  padding-bottom: 0.5rem;
165
- border-bottom: 2px solid #ffbe00;
166
  }
167
 
168
  .apps-grid {
@@ -173,8 +190,8 @@ body {
173
  }
174
 
175
  .app-card {
176
- background: white;
177
- border: 1px solid #e5e7eb;
178
  border-radius: 8px;
179
  padding: 1.25rem;
180
  transition: all 0.3s;
@@ -189,18 +206,18 @@ body {
189
  .app-card h3 {
190
  font-size: 1rem;
191
  margin-bottom: 0.5rem;
192
- color: #111827;
193
  }
194
 
195
  .app-card p {
196
- color: #6b7280;
197
  font-size: 0.875rem;
198
  margin-bottom: 1rem;
199
  }
200
 
201
  .app-link {
202
  display: inline-block;
203
- color: #ffbe00;
204
  text-decoration: none;
205
  font-weight: 600;
206
  font-size: 0.875rem;
@@ -224,7 +241,7 @@ body {
224
 
225
  .newsletter-list li {
226
  padding: 0.5rem 0;
227
- color: #4b5563;
228
  font-size: 0.9375rem;
229
  }
230
 
@@ -245,7 +262,7 @@ body {
245
 
246
  .achievements-list li {
247
  padding: 0.375rem 0;
248
- color: #4b5563;
249
  font-size: 0.9375rem;
250
  }
251
 
@@ -254,11 +271,11 @@ body {
254
  text-align: center;
255
  padding: 2rem 0 1rem 0;
256
  margin-top: 3rem;
257
- border-top: 1px solid #e5e7eb;
258
  }
259
 
260
  .footer p {
261
- color: #6b7280;
262
  font-size: 0.875rem;
263
  margin-bottom: 0.5rem;
264
  }
@@ -268,7 +285,7 @@ body {
268
  }
269
 
270
  .footer-links a {
271
- color: #4b5563;
272
  text-decoration: none;
273
  font-weight: 500;
274
  transition: color 0.2s;
@@ -278,6 +295,70 @@ body {
278
  color: #ffbe00;
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  /* Responsive */
282
  @media (max-width: 768px) {
283
  .container {
@@ -326,4 +407,4 @@ body {
326
  .stat-number {
327
  font-size: 1.5rem;
328
  }
329
- }
 
1
  /* Reset and Base Styles */
2
+ :root {
3
+ --bg: #f9fafb;
4
+ --text: #1f2937;
5
+ --card-bg: #ffffff;
6
+ --card-border: #e5e7eb;
7
+ --muted: #6b7280;
8
+ --accent: #ffbe00;
9
+ }
10
+
11
+ [data-theme="dark"] {
12
+ --bg: #0b0b0b;
13
+ --text: #e5e7eb;
14
+ --card-bg: #111827;
15
+ --card-border: #1f2937;
16
+ --muted: #9ca3af;
17
+ }
18
  * {
19
  margin: 0;
20
  padding: 0;
 
24
  body {
25
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Arial", sans-serif;
26
  line-height: 1.6;
27
+ color: var(--text);
28
+ background: var(--bg);
29
  padding: 0;
30
  }
31
 
 
42
  padding: 2rem 0;
43
  background: #000;
44
  margin: -2rem -1rem 2rem -1rem;
45
+ position: relative;
46
  }
47
 
48
  .logo {
 
57
  }
58
 
59
  .logo-ai {
60
+ color: var(--accent);
61
  }
62
 
63
  .tagline {
64
+ color: var(--muted);
65
  font-size: 0.875rem;
66
  text-transform: uppercase;
67
  letter-spacing: 0.15em;
 
70
 
71
  /* Cards */
72
  .card {
73
+ background: var(--card-bg);
74
+ border: 1px solid var(--card-border);
75
  border-radius: 12px;
76
  padding: 1.5rem;
77
  margin-bottom: 2rem;
 
85
  .intro-card h2 {
86
  font-size: 1.5rem;
87
  margin-bottom: 1rem;
88
+ color: var(--text);
89
  }
90
 
91
  .intro-card p {
92
+ color: var(--muted);
93
  font-size: 1rem;
94
  margin-bottom: 0.75rem;
95
  }
 
116
  }
117
 
118
  .btn-primary {
119
+ background: var(--accent);
120
  color: #000;
121
  }
122
 
 
145
  }
146
 
147
  .stat-item {
148
+ background: var(--card-bg);
149
+ border: 1px solid var(--card-border);
150
  border-radius: 8px;
151
  padding: 1.5rem;
152
  text-align: center;
 
162
  .stat-label {
163
  display: block;
164
  font-size: 0.875rem;
165
+ color: var(--muted);
166
  text-transform: uppercase;
167
  letter-spacing: 0.05em;
168
  margin-top: 0.25rem;
 
177
  font-size: 1.25rem;
178
  font-weight: 700;
179
  margin-bottom: 1rem;
180
+ color: var(--text);
181
  padding-bottom: 0.5rem;
182
+ border-bottom: 2px solid var(--accent);
183
  }
184
 
185
  .apps-grid {
 
190
  }
191
 
192
  .app-card {
193
+ background: var(--card-bg);
194
+ border: 1px solid var(--card-border);
195
  border-radius: 8px;
196
  padding: 1.25rem;
197
  transition: all 0.3s;
 
206
  .app-card h3 {
207
  font-size: 1rem;
208
  margin-bottom: 0.5rem;
209
+ color: var(--text);
210
  }
211
 
212
  .app-card p {
213
+ color: var(--muted);
214
  font-size: 0.875rem;
215
  margin-bottom: 1rem;
216
  }
217
 
218
  .app-link {
219
  display: inline-block;
220
+ color: var(--accent);
221
  text-decoration: none;
222
  font-weight: 600;
223
  font-size: 0.875rem;
 
241
 
242
  .newsletter-list li {
243
  padding: 0.5rem 0;
244
+ color: var(--muted);
245
  font-size: 0.9375rem;
246
  }
247
 
 
262
 
263
  .achievements-list li {
264
  padding: 0.375rem 0;
265
+ color: var(--muted);
266
  font-size: 0.9375rem;
267
  }
268
 
 
271
  text-align: center;
272
  padding: 2rem 0 1rem 0;
273
  margin-top: 3rem;
274
+ border-top: 1px solid var(--card-border);
275
  }
276
 
277
  .footer p {
278
+ color: var(--muted);
279
  font-size: 0.875rem;
280
  margin-bottom: 0.5rem;
281
  }
 
285
  }
286
 
287
  .footer-links a {
288
+ color: var(--text);
289
  text-decoration: none;
290
  font-weight: 500;
291
  transition: color 0.2s;
 
295
  color: #ffbe00;
296
  }
297
 
298
+ .theme-toggle-btn {
299
+ position: absolute;
300
+ top: 12px;
301
+ right: 12px;
302
+ width: 32px;
303
+ height: 32px;
304
+ display: inline-flex;
305
+ align-items: center;
306
+ justify-content: center;
307
+ border-radius: 9999px;
308
+ background: #111;
309
+ border: 1px solid #333;
310
+ color: #fff;
311
+ font-size: 16px;
312
+ cursor: pointer;
313
+ opacity: 0.85;
314
+ transition: opacity 0.2s, transform 0.2s;
315
+ }
316
+
317
+ .theme-toggle-btn:hover {
318
+ opacity: 1;
319
+ transform: translateY(-1px);
320
+ }
321
+
322
+ .theme-toggle {
323
+ position: absolute;
324
+ top: 12px;
325
+ right: 12px;
326
+ width: 56px;
327
+ height: 28px;
328
+ display: inline-flex;
329
+ align-items: center;
330
+ justify-content: space-between;
331
+ padding: 0 6px;
332
+ border-radius: 9999px;
333
+ background: #111;
334
+ border: 1px solid #333;
335
+ color: #fff;
336
+ cursor: pointer;
337
+ opacity: 0.9;
338
+ }
339
+
340
+ .theme-icon {
341
+ font-size: 14px;
342
+ line-height: 1;
343
+ user-select: none;
344
+ }
345
+
346
+ .theme-toggle-knob {
347
+ position: absolute;
348
+ top: 2px;
349
+ left: 2px;
350
+ width: 24px;
351
+ height: 24px;
352
+ border-radius: 9999px;
353
+ background: var(--accent);
354
+ box-shadow: 0 1px 3px rgba(0,0,0,0.5);
355
+ transition: left 0.2s ease;
356
+ }
357
+
358
+ body[data-theme="dark"] .theme-toggle-knob {
359
+ left: 30px;
360
+ }
361
+
362
  /* Responsive */
363
  @media (max-width: 768px) {
364
  .container {
 
407
  .stat-number {
408
  font-size: 1.5rem;
409
  }
410
+ }