-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
753 lines (700 loc) · 39.4 KB
/
index.html
File metadata and controls
753 lines (700 loc) · 39.4 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
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
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-E63K0PGSS0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-E63K0PGSS0');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content=" Zain Ul Abidin - Junior Data Analyst Portfolio. Specializing in data analytics, visualization, and business intelligence.">
<meta name="keywords" content="Data Analyst, Portfolio, Business Intelligence, Power BI, Tableau, SQL, Python">
<meta name="author" content="Zain Ul Abidin">
<title>Zain Ul Abidin | Data Analyst Portfolio</title>
<!-- Open Graph / Social Media Preview -->
<meta property="og:type" content="website">
<meta property="og:title" content="Zain Ul Abidin | Data Analyst Portfolio">
<meta property="og:description" content="Junior Data Analyst & Business Intelligence Professional. Specializing in SQL, Python, Power BI, Tableau, and cloud analytics.">
<meta property="og:url" content="https://xainy75.github.io">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Zain Ul Abidin | Data Analyst Portfolio">
<meta name="twitter:description" content="Junior Data Analyst & Business Intelligence Professional. Specializing in SQL, Python, Power BI, Tableau, and cloud analytics.">
<meta name="theme-color" content="#000000">
<!-- Resource hints for performance -->
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
<link rel="dns-prefetch" href="https://cdnjs.cloudflare.com">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body>
<!-- Navigation -->
<nav>
<div class="container nav-flex">
<div class="logo">
<i class="fas fa-chart-line"></i>
<span>Zain Ul Abidin</span>
</div>
<button class="mobile-menu-toggle" aria-label="Toggle menu">
<i class="fas fa-bars"></i>
</button>
<ul class="nav-menu">
<li><a href="#home" class="nav-link">Home</a></li>
<li><a href="#about" class="nav-link">About</a></li>
<li><a href="#skills" class="nav-link">Skills</a></li>
<li><a href="#certifications" class="nav-link">Certifications</a></li>
<li><a href="#projects" class="nav-link">Projects</a></li>
<li><a href="#experience" class="nav-link">Experience</a></li>
<li><a href="#contact" class="nav-link">Contact</a></li>
</ul>
</div>
</nav>
<!-- Hero Section -->
<header id="home" class="hero">
<div class="container hero-content">
<div class="hero-text">
<p class="greeting">Hello, I'm</p>
<h1 class="hero-title"><span class="name-prefix">Mr.</span> <span class="name-text">Zain Ul Abidin</span></h1>
<p class="tagline">Junior Data Analyst & Business Intelligence Professional</p>
<div class="badges">
<span class="badge"><i class="fas fa-certificate"></i> Google Certified</span>
<span class="badge"><i class="fab fa-aws"></i> AWS Data Analytics</span>
</div>
<div class="hero-buttons">
<a href="#contact" class="btn btn-primary">Get In Touch</a>
<a href="#projects" class="btn btn-secondary">View My Work</a>
</div>
</div>
<div class="hero-image">
<div class="profile-card-visual" aria-label="Profile highlights">
<div class="profile-status">
<span class="status-dot" aria-hidden="true"></span>
Available for opportunities
</div>
<div class="profile-circle" aria-hidden="true">
<span class="profile-initials">ZA</span>
</div>
<div class="profile-meta">
<h3>Zain Ul Abidin</h3>
<p>Data Analyst • Business Intelligence</p>
</div>
<div class="profile-tags">
<span>SQL & Python</span>
<span>Power BI</span>
<span>AWS Analytics</span>
</div>
</div>
</div>
</div>
<div class="scroll-indicator">
<a href="#about"><i class="fas fa-chevron-down"></i></a>
</div>
</header>
<main>
<!-- About Section -->
<section id="about" class="section about-section">
<div class="container">
<h2 class="section-title"><i class="fas fa-user"></i> About Me</h2>
<div class="about-content">
<div class="about-text card">
<h3>Professional Summary</h3>
<p>Data-driven analytics professional with hands-on experience in ETL processes, data visualization, and business intelligence. Proficient in SQL, Python, R, Power BI, Tableau, and Excel with proven ability to transform raw data into actionable insights.</p>
<p>Experienced in e-commerce analytics, digital marketing performance tracking, and data-driven decision making. Strong foundation in statistical analysis and cloud technologies (AWS).</p>
<div class="about-stats">
<div class="stat">
<i class="fas fa-project-diagram"></i>
<h4>10+</h4>
<p>Projects Completed</p>
</div>
<div class="stat">
<i class="fas fa-certificate"></i>
<h4>10+</h4>
<p>Certifications</p>
</div>
<div class="stat">
<i class="fas fa-code"></i>
<h4>8+</h4>
<p>Technologies</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Skills Section -->
<section id="skills" class="section skills-section">
<div class="container">
<h2 class="section-title"><i class="fas fa-cogs"></i> Technical Skills</h2>
<div class="skills-grid">
<div class="skill-category card">
<i class="fas fa-database"></i>
<h3>Data Analysis</h3>
<ul class="skill-list">
<li>SQL</li>
<li>Python</li>
<li>R Programming</li>
<li>Excel (Advanced)</li>
</ul>
</div>
<div class="skill-category card">
<i class="fas fa-chart-bar"></i>
<h3>Visualization</h3>
<ul class="skill-list">
<li>Microsoft Power BI</li>
<li>Tableau</li>
<li>Minitab</li>
<li>Data Storytelling</li>
</ul>
</div>
<div class="skill-category card">
<i class="fas fa-cloud"></i>
<h3>Cloud & Tools</h3>
<ul class="skill-list">
<li>AWS Technical Essentials</li>
<li>ETL (Extract, Transform, Load)</li>
<li>Data Pipelines</li>
<li>Git & Version Control</li>
</ul>
</div>
<div class="skill-category card">
<i class="fas fa-brain"></i>
<h3>Analytics</h3>
<ul class="skill-list">
<li>Data Cleaning</li>
<li>Data Modeling</li>
<li>Statistical Analysis</li>
<li>Business Intelligence</li>
</ul>
</div>
</div>
</div>
</section>
<!-- Certifications Section -->
<section id="certifications" class="section certifications-section">
<div class="container">
<h2 class="section-title"><i class="fas fa-award"></i> Licenses & Certifications</h2>
<div class="certifications-grid">
<article class="certification-card card">
<h3><i class="fas fa-graduation-cap"></i> Education</h3>
<ul class="certification-list">
<li>Bachelor of Science • Data Analytics</li>
</ul>
</article>
<article class="certification-card card">
<h3><i class="fab fa-google"></i> Google Data Analytics Professional Certificate</h3>
<ul class="certification-list">
<li>Ask Questions to Make Data-Driven Decisions</li>
<li>Foundations: Data, Data, Everywhere</li>
<li>Process Data from Dirty to Clean</li>
<li>Prepare Data for Exploration</li>
</ul>
</article>
<article class="certification-card card">
<h3><i class="fab fa-aws"></i> Cloud & Technical Certificates</h3>
<ul class="certification-list">
<li>AWS Technical Essentials Certification</li>
<li>Minitab Statistical Software Certification</li>
<li>Python (Basics) — HackerRank</li>
<li>Generative AI — Google</li>
</ul>
</article>
<article class="certification-card card">
<h3><i class="fas fa-globe-asia"></i> Global Learning Programs</h3>
<ul class="certification-list">
<li>SBCC E-Modules Course: Social and Behavior Change Communication — UNFPA</li>
<li>Climate Champion e-course — UN CC:Learn</li>
</ul>
</article>
</div>
</div>
</section>
<!-- Projects Section -->
<section id="projects" class="section projects-section">
<div class="container">
<h2 class="section-title"><i class="fas fa-project-diagram"></i> Featured Projects</h2>
<div class="project-grid">
<div class="project-card card">
<div class="project-icon">
<i class="fas fa-car"></i>
</div>
<h3>Uber Analytics Dashboard</h3>
<p>Developed a comprehensive Power BI dashboard to visualize key performance indicators including ride volume, revenue trends, driver performance, and customer satisfaction metrics.</p>
<div class="project-tech">
<span class="tech-tag">Power BI</span>
<span class="tech-tag">DAX</span>
<span class="tech-tag">SQL</span>
</div>
<div class="project-links">
<a href="#" class="project-link"><i class="fas fa-external-link-alt"></i> View Project</a>
</div>
</div>
<div class="project-card card">
<div class="project-icon">
<i class="fas fa-shopping-cart"></i>
</div>
<h3>Sales Analysis Dashboard</h3>
<p>Created a dynamic Tableau dashboard tracking market trends, regional performance, and sales forecasts. Implemented data blending from multiple sources for comprehensive insights.</p>
<div class="project-tech">
<span class="tech-tag">Tableau</span>
<span class="tech-tag">Data Blending</span>
<span class="tech-tag">Python</span>
</div>
<div class="project-links">
<a href="#" class="project-link"><i class="fas fa-external-link-alt"></i> View Project</a>
</div>
</div>
<div class="project-card card">
<div class="project-icon">
<i class="fas fa-chart-line"></i>
</div>
<h3>Customer Segmentation Analysis</h3>
<p>Performed RFM analysis and clustering to identify customer segments. Built predictive models to forecast customer lifetime value and churn probability.</p>
<div class="project-tech">
<span class="tech-tag">Python</span>
<span class="tech-tag">Machine Learning</span>
<span class="tech-tag">Pandas</span>
</div>
<div class="project-links">
<a href="#" class="project-link"><i class="fas fa-external-link-alt"></i> View Project</a>
</div>
</div>
<div class="project-card card">
<div class="project-icon">
<i class="fas fa-ad"></i>
</div>
<h3>Marketing Campaign ROI Tracker</h3>
<p>Automated ETL pipeline for marketing data analysis. Created interactive reports showing campaign performance, cost per acquisition, and conversion metrics.</p>
<div class="project-tech">
<span class="tech-tag">Excel</span>
<span class="tech-tag">Power Query</span>
<span class="tech-tag">VBA</span>
</div>
<div class="project-links">
<a href="#" class="project-link"><i class="fas fa-external-link-alt"></i> View Project</a>
</div>
</div>
</div>
</div>
</section>
<!-- Experience Section -->
<section id="experience" class="section experience-section">
<div class="container">
<h2 class="section-title"><i class="fas fa-briefcase"></i> Work Experience</h2>
<div class="timeline">
<div class="timeline-item card">
<div class="timeline-date">Oct 2025 - Present</div>
<div class="timeline-content">
<h3>E-commerce Data Analyst (Intern)</h3>
<h4><i class="fas fa-building"></i> Daraz E-commerce</h4>
<ul class="experience-list">
<li><i class="fas fa-check-circle"></i> Manage product data pipelines for 500+ SKUs using Excel automation and Python scripts</li>
<li><i class="fas fa-check-circle"></i> Optimize ROI for Google and Facebook Ads through data-driven recommendations, improving campaign performance by 25%</li>
<li><i class="fas fa-check-circle"></i> Build interactive Power BI dashboards tracking conversion rates, customer acquisition, and sales trends</li>
<li><i class="fas fa-check-circle"></i> Conduct A/B testing analysis to improve website conversion rates and user engagement</li>
</ul>
</div>
</div>
<div class="timeline-item card">
<div class="timeline-date">Duration: TBD</div>
<div class="timeline-content">
<h3>Social Media Marketing Intern</h3>
<h4><i class="fas fa-building"></i> International MUN</h4>
<ul class="experience-list">
<li><i class="fas fa-check-circle"></i> Managed and optimized brand presence across Instagram, TikTok, and LinkedIn with a strong focus on community engagement and data-driven content creation</li>
<li><i class="fas fa-check-circle"></i> Developed and scheduled weekly content calendars using Canva and Adobe Express, expanding monthly audience reach</li>
<li><i class="fas fa-check-circle"></i> Monitored social channels and engaged with followers in real time to maintain brand voice and strengthen loyalty</li>
<li><i class="fas fa-check-circle"></i> Tracked engagement rate, click-through rate, and follower growth through Meta Business Suite and Google Analytics to guide campaign improvements</li>
<li><i class="fas fa-check-circle"></i> Applied trend forecasting and moment marketing tactics to improve TikTok/Reels view performance</li>
<li><i class="fas fa-check-circle"></i> Collaborated with design and copywriting teams to align creative assets with campaign goals and brand guidelines</li>
</ul>
</div>
</div>
<div class="timeline-item card">
<div class="timeline-date">Duration: TBD</div>
<div class="timeline-content">
<h3>Data Analyst</h3>
<h4><i class="fas fa-building"></i> CodeAlpha</h4>
<ul class="experience-list">
<li><i class="fas fa-check-circle"></i> Engaged in a structured data analytics program focused on data-driven business intelligence and applied Python-based tools to solve real analytical problems</li>
<li><i class="fas fa-check-circle"></i> Engineered web scraping pipelines with BeautifulSoup and Python to collect and structure analysis-ready custom datasets from public sources</li>
<li><i class="fas fa-check-circle"></i> Performed end-to-end exploratory data analysis, including data cleaning, hypothesis testing, and anomaly detection for actionable insights</li>
<li><i class="fas fa-check-circle"></i> Built visual narratives with Matplotlib and Seaborn to convert complex findings into decision-ready dashboards</li>
<li><i class="fas fa-check-circle"></i> Conducted sentiment analysis using NLP and lexicon-based techniques on customer and social media text to identify sentiment patterns</li>
<li><i class="fas fa-check-circle"></i> Published all projects on GitHub with LinkedIn video walkthroughs documenting each delivery</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="section contact-section">
<div class="container">
<h2 class="section-title"><i class="fas fa-envelope"></i> Get In Touch</h2>
<div class="contact-content">
<div class="contact-info">
<h3>Let's Connect</h3>
<p>I'm always open to discussing new opportunities, collaborations, or just having a chat about data analytics!</p>
<div class="contact-details">
<div class="contact-item">
<i class="fas fa-map-marker-alt"></i>
<span>Multan, Pakistan</span>
</div>
<div class="contact-item">
<i class="fas fa-envelope"></i>
<span>xainyblblack@gmail.com</span>
</div>
<div class="contact-item">
<i class="fas fa-phone"></i>
<span>Available on request</span>
</div>
</div>
<div class="social-links-contact">
<a href="https://github.com/xainy75" class="social-link" aria-label="GitHub" target="_blank" rel="noopener noreferrer">
<i class="fab fa-github"></i>
</a>
<a href="https://www.linkedin.com/in/zain-ul-abidin-b387a1381/" class="social-link" aria-label="LinkedIn" target="_blank" rel="noopener noreferrer">
<i class="fab fa-linkedin"></i>
</a>
<a href="https://www.kaggle.com/xainyblblack" class="social-link" aria-label="Kaggle" target="_blank" rel="noopener noreferrer">
<i class="fab fa-kaggle"></i>
</a>
<a href="https://twitter.com/Xainyblblack" class="social-link" aria-label="Twitter" target="_blank" rel="noopener noreferrer">
<i class="fab fa-twitter"></i>
</a>
</div>
</div>
<div class="contact-form-container card">
<form class="contact-form" id="contactForm" action="https://formsubmit.co/xainyblblack@gmail.com" method="POST">
<!-- FormSubmit Configuration -->
<input type="hidden" name="_subject" value="New contact form submission from portfolio!">
<input type="hidden" name="_captcha" value="false">
<input type="hidden" name="_template" value="table">
<div class="form-group">
<label for="name">Your Name</label>
<input type="text" id="name" name="name" placeholder="John Doe" required>
</div>
<div class="form-group">
<label for="email">Your Email</label>
<input type="email" id="email" name="_replyto" placeholder="john@example.com" required>
</div>
<div class="form-group">
<label for="subject">Subject</label>
<input type="text" id="subject" name="subject" placeholder="Project Inquiry" required>
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea id="message" name="message" rows="5" placeholder="Your message here..." required></textarea>
</div>
<p id="formStatus" class="form-status" aria-live="polite"></p>
<button type="submit" class="btn btn-primary btn-submit">
<i class="fas fa-paper-plane"></i> Send Message
</button>
</form>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer>
<div class="container">
<div class="footer-content">
<p>© 2026 Zain Ul Abidin. All rights reserved.</p>
<p class="footer-tagline">Turning Data into Insights | Multan, Pakistan</p>
</div>
</div>
</footer>
<script>
// Performance utilities - Throttle function to limit event frequency
function throttle(func, limit) {
let inThrottle;
return function(...args) {
if (!inThrottle) {
func.apply(this, args);
inThrottle = true;
setTimeout(() => inThrottle = false, limit);
}
};
}
// Cache DOM queries
const menuToggle = document.querySelector('.mobile-menu-toggle');
const navMenu = document.querySelector('.nav-menu');
const hero = document.querySelector('.hero');
const sections = document.querySelectorAll('section');
const navLinks = document.querySelectorAll('.nav-link');
// Smooth scrolling with event delegation for better performance
document.addEventListener('click', (e) => {
const anchor = e.target.closest('a[href^="#"]');
if (anchor) {
e.preventDefault();
const target = document.querySelector(anchor.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
}
});
// Mobile menu toggle
if (menuToggle) {
menuToggle.addEventListener('click', () => {
navMenu.classList.toggle('active');
const icon = menuToggle.querySelector('i');
icon.classList.toggle('fa-bars');
icon.classList.toggle('fa-times');
});
// Close mobile menu when clicking on a link - event delegation
navMenu.addEventListener('click', (e) => {
if (e.target.classList.contains('nav-link') && navMenu.classList.contains('active')) {
navMenu.classList.remove('active');
const icon = menuToggle.querySelector('i');
icon.classList.add('fa-bars');
icon.classList.remove('fa-times');
}
});
}
// Form submission handler
const contactForm = document.getElementById('contactForm');
if (contactForm) {
contactForm.addEventListener('submit', async function(e) {
e.preventDefault();
const button = contactForm.querySelector('.btn-submit');
const formStatus = document.getElementById('formStatus');
const defaultButtonText = '<i class="fas fa-paper-plane"></i> Send Message';
button.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Sending...';
button.disabled = true;
formStatus.textContent = '';
formStatus.className = 'form-status';
try {
const response = await fetch(contactForm.action, {
method: 'POST',
body: new FormData(contactForm),
headers: {
'Accept': 'application/json'
}
});
if (!response.ok) {
throw new Error('Unable to send message');
}
formStatus.textContent = 'Thanks! Your message has been sent successfully.';
formStatus.classList.add('success');
contactForm.reset();
} catch (error) {
formStatus.textContent = 'Message could not be sent. Please try again or use the email listed in the contact section.';
formStatus.classList.add('error');
} finally {
button.innerHTML = defaultButtonText;
button.disabled = false;
}
});
}
// Optimized scroll handler with throttling (300ms)
const handleScroll = throttle(() => {
// Add active state to navigation based on scroll position
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
if (window.pageYOffset >= sectionTop - 200) {
current = section.getAttribute('id');
}
});
navLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === '#' + current) {
link.classList.add('active');
}
});
// Parallax effect for hero background (only when hero is visible)
if (hero && window.pageYOffset < window.innerHeight) {
requestAnimationFrame(() => {
hero.style.backgroundPositionY = window.pageYOffset * 0.5 + 'px';
});
}
}, 300);
// Add passive event listener for better scroll performance
window.addEventListener('scroll', handleScroll, { passive: true });
// Optimized scroll-triggered animations using Intersection Observer
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
// Single consolidated observer for all animated elements
const animationObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
const delay = parseInt(entry.target.dataset.delay || '0');
setTimeout(() => {
entry.target.style.opacity = '1';
entry.target.style.transform = entry.target.dataset.finalTransform || 'translateY(0)';
}, delay);
// Unobserve after animation to prevent re-triggering
animationObserver.unobserve(entry.target);
}
});
}, observerOptions);
// Separate observer for stats with counter animation
const statsObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
const statValue = entry.target.querySelector('h4');
if (statValue && !entry.target.dataset.counted) {
entry.target.dataset.counted = 'true';
const text = statValue.textContent;
const target = parseInt(text.replace(/\D/g, ''));
if (!isNaN(target) && target > 0) {
let current = 0;
const increment = target / 30; // Reduced iterations for performance
const duration = 1000; // 1 second total
const stepTime = duration / 30;
const updateCounter = () => {
current += increment;
if (current >= target) {
statValue.textContent = target + '+';
} else {
statValue.textContent = Math.floor(current) + '+';
requestAnimationFrame(() => setTimeout(updateCounter, stepTime));
}
};
updateCounter();
}
}
statsObserver.unobserve(entry.target);
}
});
}, observerOptions);
const sectionObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add('section-3d-visible');
sectionObserver.unobserve(entry.target);
}
});
}, observerOptions);
// Observe all cards and skill categories
document.addEventListener('DOMContentLoaded', () => {
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const INTERACTION_THROTTLE_MS = 50;
sections.forEach((section) => {
if (prefersReducedMotion) {
section.classList.add('section-3d-visible');
return;
}
section.classList.add('section-3d-enter');
sectionObserver.observe(section);
});
const animatedElements = document.querySelectorAll('.card, .skill-category, .project-card, .profile-card-visual');
// Add staggered delays to elements
animatedElements.forEach((el, index) => {
if (prefersReducedMotion) {
el.style.opacity = '1';
el.style.transform = 'none';
el.style.transition = 'none';
return;
}
el.style.opacity = '0';
el.style.transform = 'translateY(30px) rotateX(10deg) scale(0.98)';
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
el.dataset.finalTransform = 'translateY(0) rotateX(0deg) scale(1)';
el.dataset.delay = (index % 4) * 100; // Stagger within groups of 4
animationObserver.observe(el);
});
// Observe stats separately with counter animation
const stats = document.querySelectorAll('.stat');
stats.forEach((stat) => {
if (prefersReducedMotion) {
stat.style.opacity = '1';
stat.style.transform = 'none';
stat.style.transition = 'none';
return;
}
stat.style.opacity = '0';
stat.style.transform = 'translateY(30px)';
stat.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
stat.dataset.finalTransform = 'translateY(0)';
statsObserver.observe(stat);
});
// Optimized typing effect using requestAnimationFrame
const heroTitle = document.querySelector('.hero-title');
const nameTextEl = heroTitle ? heroTitle.querySelector('.name-text') : null;
const typeTarget = nameTextEl || heroTitle;
if (typeTarget && !prefersReducedMotion) {
const text = typeTarget.textContent;
typeTarget.textContent = '';
if (heroTitle) heroTitle.style.opacity = '1';
let i = 0;
let lastTime = 0;
const typingSpeed = 100; // milliseconds per character
const typeWriter = (currentTime) => {
if (lastTime === 0) lastTime = currentTime;
if (currentTime - lastTime >= typingSpeed) {
if (i < text.length) {
typeTarget.textContent += text.charAt(i);
i++;
lastTime = currentTime;
} else {
return; // Stop when done
}
}
if (i < text.length) {
requestAnimationFrame(typeWriter);
}
};
setTimeout(() => requestAnimationFrame(typeWriter), 500);
} else if (heroTitle) {
heroTitle.style.opacity = '1';
}
// Optimized magnetic effect for buttons with throttling
if (!prefersReducedMotion && window.matchMedia('(hover: hover)').matches) {
document.querySelectorAll('.btn').forEach(button => {
const handleMouseMove = throttle((e) => {
requestAnimationFrame(() => {
const rect = button.getBoundingClientRect();
const x = e.clientX - rect.left - rect.width / 2;
const y = e.clientY - rect.top - rect.height / 2;
button.style.transform = `translate(${x * 0.1}px, ${y * 0.1}px)`;
});
}, INTERACTION_THROTTLE_MS);
button.addEventListener('mousemove', handleMouseMove, { passive: true });
button.addEventListener('mouseleave', () => {
requestAnimationFrame(() => {
button.style.transform = 'translate(0, 0)';
});
});
});
}
const profileCard = document.querySelector('.profile-card-visual');
if (profileCard && !prefersReducedMotion && window.matchMedia('(hover: hover)').matches) {
// These fallback values intentionally mirror CSS :root defaults:
// --profile-tilt-perspective and --profile-tilt-sensitivity.
const defaultProfileTiltPerspective = '1000px';
const defaultProfileTiltSensitivity = 25;
const profileTiltLift = -6; // Lift amount in pixels
const rootStyles = getComputedStyle(document.documentElement);
const tiltPerspective = rootStyles.getPropertyValue('--profile-tilt-perspective').trim() || defaultProfileTiltPerspective;
const tiltSensitivity = parseFloat(rootStyles.getPropertyValue('--profile-tilt-sensitivity')) || defaultProfileTiltSensitivity;
const handleProfileMove = throttle((e) => {
requestAnimationFrame(() => {
const rect = profileCard.getBoundingClientRect();
const centerX = rect.left + rect.width / 2;
const centerY = rect.top + rect.height / 2;
const rotateY = (e.clientX - centerX) / tiltSensitivity;
const rotateX = (centerY - e.clientY) / tiltSensitivity;
profileCard.style.transform = `perspective(${tiltPerspective}) rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateY(${profileTiltLift}px)`;
});
}, INTERACTION_THROTTLE_MS);
profileCard.addEventListener('mousemove', handleProfileMove, { passive: true });
profileCard.addEventListener('mouseleave', () => {
requestAnimationFrame(() => {
profileCard.style.transform = `perspective(${tiltPerspective}) rotateX(0deg) rotateY(0deg) translateY(0)`;
});
});
}
});
</script>
</body>
</html>