File size: 28,786 Bytes
3e6f27b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript Effects Showcase</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        /* Custom CSS for effects that need more control */
        .parallax {
            background-attachment: fixed;
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
        }
        
        .card-3d {
            transition: transform 0.5s ease;
        }
        
        .card-3d:hover {
            transform: perspective(1000px) rotateY(10deg) rotateX(5deg) scale(1.05);
        }
        
        .gradient-text {
            background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            animation: gradient 8s ease infinite;
            background-size: 400% 400%;
        }
        
        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        
        .typewriter {
            overflow: hidden;
            border-right: 3px solid #3b82f6;
            white-space: nowrap;
            letter-spacing: 2px;
        }
        
        .particles {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }
        
        .ripple {
            position: relative;
            overflow: hidden;
        }
        
        .ripple-effect {
            position: absolute;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.4);
            transform: scale(0);
            animation: ripple 0.6s linear;
            pointer-events: none;
        }
        
        @keyframes ripple {
            to {
                transform: scale(4);
                opacity: 0;
            }
        }
    </style>
</head>
<body class="bg-gray-900 text-gray-100 font-sans">
    <!-- Particles Background -->
    <div id="particles-js" class="particles"></div>
    
    <!-- Navigation -->
    <nav class="fixed w-full z-50 bg-gray-900/80 backdrop-blur-md shadow-lg">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex items-center justify-between h-16">
                <div class="flex items-center">
                    <div class="flex-shrink-0">
                        <span class="text-2xl font-bold gradient-text">JS Effects</span>
                    </div>
                </div>
                <div class="hidden md:block">
                    <div class="ml-10 flex items-baseline space-x-4">
                        <a href="#parallax" class="ripple px-3 py-2 rounded-md text-sm font-medium hover:bg-gray-700 transition">Parallax</a>
                        <a href="#typing" class="ripple px-3 py-2 rounded-md text-sm font-medium hover:bg-gray-700 transition">Typing</a>
                        <a href="#cards" class="ripple px-3 py-2 rounded-md text-sm font-medium hover:bg-gray-700 transition">3D Cards</a>
                        <a href="#accordion" class="ripple px-3 py-2 rounded-md text-sm font-medium hover:bg-gray-700 transition">Accordion</a>
                        <a href="#counters" class="ripple px-3 py-2 rounded-md text-sm font-medium hover:bg-gray-700 transition">Counters</a>
                    </div>
                </div>
                <div class="-mr-2 flex md:hidden">
                    <button id="mobile-menu-button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none">
                        <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
                        </svg>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- Mobile menu -->
        <div id="mobile-menu" class="hidden md:hidden bg-gray-800">
            <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
                <a href="#parallax" class="block px-3 py-2 rounded-md text-base font-medium hover:bg-gray-700">Parallax</a>
                <a href="#typing" class="block px-3 py-2 rounded-md text-base font-medium hover:bg-gray-700">Typing</a>
                <a href="#cards" class="block px-3 py-2 rounded-md text-base font-medium hover:bg-gray-700">3D Cards</a>
                <a href="#accordion" class="block px-3 py-2 rounded-md text-base font-medium hover:bg-gray-700">Accordion</a>
                <a href="#counters" class="block px-3 py-2 rounded-md text-base font-medium hover:bg-gray-700">Counters</a>
            </div>
        </div>
    </nav>
    
    <!-- Hero Section -->
    <header class="relative pt-32 pb-20 px-4 sm:px-6 lg:px-8 flex flex-col items-center justify-center min-h-screen">
        <h1 class="text-5xl md:text-7xl font-extrabold mb-6 text-center gradient-text">
            JavaScript Effects Showcase
        </h1>
        <p id="typewriter" class="typewriter text-xl md:text-2xl text-gray-300 mb-10 max-w-3xl text-center"></p>
        <div class="flex flex-wrap justify-center gap-4">
            <a href="#cards" class="ripple px-8 py-3 bg-indigo-600 hover:bg-indigo-700 rounded-full font-semibold transition transform hover:scale-105 shadow-lg">
                Explore Effects
            </a>
            <a href="#counters" class="ripple px-8 py-3 bg-gray-700 hover:bg-gray-600 rounded-full font-semibold transition transform hover:scale-105 shadow-lg">
                View Counters
            </a>
        </div>
        <div class="absolute bottom-10 animate-bounce">
            <i class="fas fa-chevron-down text-3xl text-gray-400"></i>
        </div>
    </header>
    
    <!-- Parallax Section -->
    <section id="parallax" class="parallax min-h-[60vh] flex items-center justify-center relative" style="background-image: url('https://images.unsplash.com/photo-1639762681057-408e52192e55?q=80&w=2232&auto=format&fit=crop');">
        <div class="absolute inset-0 bg-black/50"></div>
        <div class="relative z-10 text-center px-4">
            <h2 class="text-4xl md:text-5xl font-bold mb-6">Parallax Scrolling Effect</h2>
            <p class="text-xl max-w-3xl mx-auto">This background image stays fixed while scrolling, creating a depth illusion.</p>
        </div>
    </section>
    
    <!-- 3D Cards Section -->
    <section id="cards" class="py-20 px-4 sm:px-6 lg:px-8 bg-gray-800">
        <div class="max-w-7xl mx-auto">
            <h2 class="text-3xl md:text-4xl font-bold mb-12 text-center">3D Card Effects</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
                <!-- Card 1 -->
                <div class="card-3d bg-gray-700 rounded-xl overflow-hidden shadow-2xl">
                    <div class="h-48 bg-gradient-to-r from-purple-500 to-pink-500 flex items-center justify-center">
                        <i class="fas fa-magic text-6xl text-white"></i>
                    </div>
                    <div class="p-6">
                        <h3 class="text-2xl font-bold mb-3">Hover Effect</h3>
                        <p class="text-gray-300 mb-4">This card tilts in 3D space when hovered, creating an interactive experience.</p>
                        <button class="ripple px-4 py-2 bg-indigo-600 hover:bg-indigo-700 rounded-md font-medium transition">
                            Try Hovering
                        </button>
                    </div>
                </div>
                
                <!-- Card 2 -->
                <div class="card-3d bg-gray-700 rounded-xl overflow-hidden shadow-2xl">
                    <div class="h-48 bg-gradient-to-r from-blue-500 to-teal-400 flex items-center justify-center">
                        <i class="fas fa-spinner text-6xl text-white animate-spin"></i>
                    </div>
                    <div class="p-6">
                        <h3 class="text-2xl font-bold mb-3">Loading Animation</h3>
                        <p class="text-gray-300 mb-4">This card features a spinning icon that rotates continuously.</p>
                        <button id="spin-btn" class="ripple px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-md font-medium transition">
                            Toggle Spin
                        </button>
                    </div>
                </div>
                
                <!-- Card 3 -->
                <div class="card-3d bg-gray-700 rounded-xl overflow-hidden shadow-2xl">
                    <div class="h-48 bg-gradient-to-r from-green-500 to-emerald-400 flex items-center justify-center">
                        <i class="fas fa-expand text-6xl text-white"></i>
                    </div>
                    <div class="p-6">
                        <h3 class="text-2xl font-bold mb-3">Expand Effect</h3>
                        <p class="text-gray-300 mb-4">Click the button to see this card expand to full width.</p>
                        <button id="expand-btn" class="ripple px-4 py-2 bg-green-600 hover:bg-green-700 rounded-md font-medium transition">
                            Expand Card
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </section>
    
    <!-- Typing Effect Section -->
    <section id="typing" class="py-20 px-4 sm:px-6 lg:px-8 bg-gray-900">
        <div class="max-w-4xl mx-auto text-center">
            <h2 class="text-3xl md:text-4xl font-bold mb-6">Typing Effect</h2>
            <div class="bg-gray-800 rounded-xl p-8 shadow-xl">
                <div id="typing-demo" class="typewriter text-xl md:text-2xl h-12 mb-6 text-left"></div>
                <div class="flex justify-center gap-4">
                    <button id="start-typing" class="ripple px-6 py-2 bg-indigo-600 hover:bg-indigo-700 rounded-md font-medium transition">
                        Start Typing
                    </button>
                    <button id="reset-typing" class="ripple px-6 py-2 bg-gray-700 hover:bg-gray-600 rounded-md font-medium transition">
                        Reset
                    </button>
                </div>
            </div>
        </div>
    </section>
    
    <!-- Accordion Section -->
    <section id="accordion" class="py-20 px-4 sm:px-6 lg:px-8 bg-gray-800">
        <div class="max-w-4xl mx-auto">
            <h2 class="text-3xl md:text-4xl font-bold mb-12 text-center">Accordion Effect</h2>
            
            <div class="space-y-4">
                <!-- Accordion Item 1 -->
                <div class="accordion-item bg-gray-700 rounded-lg overflow-hidden shadow-lg">
                    <button class="accordion-btn w-full flex justify-between items-center p-6 text-left hover:bg-gray-600 transition">
                        <span class="text-xl font-semibold">What is JavaScript?</span>
                        <i class="fas fa-chevron-down transition-transform duration-300"></i>
                    </button>
                    <div class="accordion-content max-h-0 overflow-hidden transition-all duration-300">
                        <div class="p-6 pt-0 text-gray-300">
                            <p>JavaScript is a programming language that enables interactive web pages. It is a core technology of the web, alongside HTML and CSS. JavaScript allows for dynamic content updates, interactive maps, animated graphics, and much more.</p>
                        </div>
                    </div>
                </div>
                
                <!-- Accordion Item 2 -->
                <div class="accordion-item bg-gray-700 rounded-lg overflow-hidden shadow-lg">
                    <button class="accordion-btn w-full flex justify-between items-center p-6 text-left hover:bg-gray-600 transition">
                        <span class="text-xl font-semibold">What are these effects?</span>
                        <i class="fas fa-chevron-down transition-transform duration-300"></i>
                    </button>
                    <div class="accordion-content max-h-0 overflow-hidden transition-all duration-300">
                        <div class="p-6 pt-0 text-gray-300">
                            <p>These effects are created using JavaScript to enhance user experience and make websites more interactive. They include animations, transitions, and dynamic content changes that respond to user actions like hovering, clicking, or scrolling.</p>
                        </div>
                    </div>
                </div>
                
                <!-- Accordion Item 3 -->
                <div class="accordion-item bg-gray-700 rounded-lg overflow-hidden shadow-lg">
                    <button class="accordion-btn w-full flex justify-between items-center p-6 text-left hover:bg-gray-600 transition">
                        <span class="text-xl font-semibold">How can I learn more?</span>
                        <i class="fas fa-chevron-down transition-transform duration-300"></i>
                    </button>
                    <div class="accordion-content max-h-0 overflow-hidden transition-all duration-300">
                        <div class="p-6 pt-0 text-gray-300">
                            <p>There are many resources available online to learn JavaScript and web development. Some popular platforms include MDN Web Docs, freeCodeCamp, Codecademy, and Udemy. Practice by building small projects and experimenting with different effects.</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    
    <!-- Counters Section -->
    <section id="counters" class="py-20 px-4 sm:px-6 lg:px-8 bg-gray-900">
        <div class="max-w-7xl mx-auto">
            <h2 class="text-3xl md:text-4xl font-bold mb-12 text-center">Animated Counters</h2>
            
            <div class="grid grid-cols-2 md:grid-cols-4 gap-8">
                <!-- Counter 1 -->
                <div class="text-center">
                    <div class="counter text-5xl md:text-6xl font-bold text-indigo-500 mb-2" data-target="100">0</div>
                    <div class="text-xl text-gray-400">Effects</div>
                </div>
                
                <!-- Counter 2 -->
                <div class="text-center">
                    <div class="counter text-5xl md:text-6xl font-bold text-blue-500 mb-2" data-target="42">0</div>
                    <div class="text-xl text-gray-400">Lines of Code</div>
                </div>
                
                <!-- Counter 3 -->
                <div class="text-center">
                    <div class="counter text-5xl md:text-6xl font-bold text-green-500 mb-2" data-target="7">0</div>
                    <div class="text-xl text-gray-400">Sections</div>
                </div>
                
                <!-- Counter 4 -->
                <div class="text-center">
                    <div class="counter text-5xl md:text-6xl font-bold text-purple-500 mb-2" data-target="24">0</div>
                    <div class="text-xl text-gray-400">Hours Work</div>
                </div>
            </div>
        </div>
    </section>
    
    <!-- Footer -->
    <footer class="bg-gray-800 py-12 px-4 sm:px-6 lg:px-8">
        <div class="max-w-7xl mx-auto">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <span class="text-2xl font-bold gradient-text">JS Effects</span>
                    <p class="text-gray-400 mt-2">Showcasing the power of JavaScript</p>
                </div>
                <div class="flex space-x-6">
                    <a href="#" class="text-gray-400 hover:text-white transition">
                        <i class="fab fa-github text-2xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition">
                        <i class="fab fa-twitter text-2xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition">
                        <i class="fab fa-linkedin text-2xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition">
                        <i class="fab fa-codepen text-2xl"></i>
                    </a>
                </div>
            </div>
            <div class="mt-8 pt-8 border-t border-gray-700 text-center text-gray-400">
                <p>&copy; 2023 JavaScript Effects Showcase. All rights reserved.</p>
            </div>
        </div>
    </footer>
    
    <!-- Back to Top Button -->
    <button id="back-to-top" class="fixed bottom-8 right-8 bg-indigo-600 hover:bg-indigo-700 text-white p-3 rounded-full shadow-lg transition opacity-0 invisible">
        <i class="fas fa-arrow-up"></i>
    </button>
    
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/particles.min.js"></script>
    <script>
        // Mobile menu toggle
        const mobileMenuButton = document.getElementById('mobile-menu-button');
        const mobileMenu = document.getElementById('mobile-menu');
        
        mobileMenuButton.addEventListener('click', () => {
            mobileMenu.classList.toggle('hidden');
        });
        
        // Ripple effect for buttons
        document.querySelectorAll('.ripple').forEach(button => {
            button.addEventListener('click', function(e) {
                const x = e.clientX - e.target.getBoundingClientRect().left;
                const y = e.clientY - e.target.getBoundingClientRect().top;
                
                const ripple = document.createElement('span');
                ripple.classList.add('ripple-effect');
                ripple.style.left = `${x}px`;
                ripple.style.top = `${y}px`;
                
                this.appendChild(ripple);
                
                setTimeout(() => {
                    ripple.remove();
                }, 600);
            });
        });
        
        // Typewriter effect
        const typewriterText = document.getElementById('typewriter');
        const demoText = document.getElementById('typing-demo');
        const startTypingBtn = document.getElementById('start-typing');
        const resetTypingBtn = document.getElementById('reset-typing');
        
        const texts = [
            "Interactive JavaScript effects...",
            "Smooth animations...",
            "Engaging user experiences...",
            "All powered by JavaScript!"
        ];
        
        let currentTextIndex = 0;
        let charIndex = 0;
        let isDeleting = false;
        let isTypingPaused = false;
        
        function typeWriter() {
            const currentText = texts[currentTextIndex];
            
            if (isDeleting) {
                typewriterText.textContent = currentText.substring(0, charIndex - 1);
                charIndex--;
            } else {
                typewriterText.textContent = currentText.substring(0, charIndex + 1);
                charIndex++;
            }
            
            if (!isDeleting && charIndex === currentText.length) {
                isTypingPaused = true;
                setTimeout(() => {
                    isTypingPaused = false;
                    isDeleting = true;
                    setTimeout(typeWriter, 100);
                }, 2000);
                return;
            }
            
            if (isDeleting && charIndex === 0) {
                isDeleting = false;
                currentTextIndex = (currentTextIndex + 1) % texts.length;
                setTimeout(typeWriter, 500);
                return;
            }
            
            const speed = isDeleting ? 50 : 100;
            setTimeout(typeWriter, speed);
        }
        
        function demoTypeWriter(text, element, callback) {
            let i = 0;
            const speed = 50;
            
            function type() {
                if (i < text.length) {
                    element.textContent += text.charAt(i);
                    i++;
                    setTimeout(type, speed);
                } else if (callback) {
                    setTimeout(callback, 1000);
                }
            }
            
            element.textContent = '';
            type();
        }
        
        startTypingBtn.addEventListener('click', () => {
            demoTypeWriter("This is a typing effect created with JavaScript!", demoText, () => {
                demoTypeWriter(" It simulates human typing behavior.", demoText);
            });
        });
        
        resetTypingBtn.addEventListener('click', () => {
            demoText.textContent = '';
        });
        
        // Start the main typewriter effect
        setTimeout(typeWriter, 1000);
        
        // Accordion functionality
        document.querySelectorAll('.accordion-btn').forEach(button => {
            button.addEventListener('click', () => {
                const accordionContent = button.nextElementSibling;
                const icon = button.querySelector('i');
                
                if (accordionContent.style.maxHeight) {
                    accordionContent.style.maxHeight = null;
                    icon.style.transform = 'rotate(0deg)';
                } else {
                    accordionContent.style.maxHeight = accordionContent.scrollHeight + 'px';
                    icon.style.transform = 'rotate(180deg)';
                }
            });
        });
        
        // Animated counters
        function animateCounters() {
            const counters = document.querySelectorAll('.counter');
            const speed = 200;
            
            counters.forEach(counter => {
                const target = +counter.getAttribute('data-target');
                const count = +counter.innerText;
                const increment = target / speed;
                
                if (count < target) {
                    counter.innerText = Math.ceil(count + increment);
                    setTimeout(animateCounters, 1);
                } else {
                    counter.innerText = target;
                }
            });
        }
        
        // Start counters when section is in view
        const counterSection = document.getElementById('counters');
        const observer = new IntersectionObserver((entries) => {
            if (entries[0].isIntersecting) {
                animateCounters();
                observer.unobserve(counterSection);
            }
        }, { threshold: 0.5 });
        
        observer.observe(counterSection);
        
        // Card effects
        const spinBtn = document.getElementById('spin-btn');
        const spinIcon = document.querySelector('.fa-spinner');
        
        spinBtn.addEventListener('click', () => {
            spinIcon.classList.toggle('animate-spin');
        });
        
        const expandBtn = document.getElementById('expand-btn');
        const expandCard = expandBtn.closest('.card-3d');
        
        expandBtn.addEventListener('click', () => {
            expandCard.classList.toggle('md:col-span-3');
            expandCard.classList.toggle('transform');
            expandCard.classList.toggle('scale-x-105');
            
            if (expandBtn.textContent.includes('Expand')) {
                expandBtn.textContent = 'Collapse Card';
            } else {
                expandBtn.textContent = 'Expand Card';
            }
        });
        
        // Back to top button
        const backToTopButton = document.getElementById('back-to-top');
        
        window.addEventListener('scroll', () => {
            if (window.pageYOffset > 300) {
                backToTopButton.classList.remove('opacity-0', 'invisible');
                backToTopButton.classList.add('opacity-100', 'visible');
            } else {
                backToTopButton.classList.remove('opacity-100', 'visible');
                backToTopButton.classList.add('opacity-0', 'invisible');
            }
        });
        
        backToTopButton.addEventListener('click', () => {
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            });
        });
        
        // Particles.js configuration
        particlesJS('particles-js', {
            particles: {
                number: {
                    value: 80,
                    density: {
                        enable: true,
                        value_area: 800
                    }
                },
                color: {
                    value: "#3b82f6"
                },
                shape: {
                    type: "circle",
                    stroke: {
                        width: 0,
                        color: "#000000"
                    },
                    polygon: {
                        nb_sides: 5
                    }
                },
                opacity: {
                    value: 0.5,
                    random: false,
                    anim: {
                        enable: false,
                        speed: 1,
                        opacity_min: 0.1,
                        sync: false
                    }
                },
                size: {
                    value: 3,
                    random: true,
                    anim: {
                        enable: false,
                        speed: 40,
                        size_min: 0.1,
                        sync: false
                    }
                },
                line_linked: {
                    enable: true,
                    distance: 150,
                    color: "#3b82f6",
                    opacity: 0.4,
                    width: 1
                },
                move: {
                    enable: true,
                    speed: 2,
                    direction: "none",
                    random: false,
                    straight: false,
                    out_mode: "out",
                    bounce: false,
                    attract: {
                        enable: false,
                        rotateX: 600,
                        rotateY: 1200
                    }
                }
            },
            interactivity: {
                detect_on: "canvas",
                events: {
                    onhover: {
                        enable: true,
                        mode: "grab"
                    },
                    onclick: {
                        enable: true,
                        mode: "push"
                    },
                    resize: true
                },
                modes: {
                    grab: {
                        distance: 140,
                        line_linked: {
                            opacity: 1
                        }
                    },
                    bubble: {
                        distance: 400,
                        size: 40,
                        duration: 2,
                        opacity: 8,
                        speed: 3
                    },
                    repulse: {
                        distance: 200,
                        duration: 0.4
                    },
                    push: {
                        particles_nb: 4
                    },
                    remove: {
                        particles_nb: 2
                    }
                }
            },
            retina_detect: true
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=theharby/jsgallery" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>