-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathresearch.html
More file actions
657 lines (579 loc) · 23.2 KB
/
Copy pathresearch.html
File metadata and controls
657 lines (579 loc) · 23.2 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
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Research | Berkeley RDI</title>
<!-- Tailwind + site styles for the new header/hero/footer -->
<link href="/assets/css/tailwind.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com/">
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin="">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/assets/css/style.css">
<style>
/* === Your original custom CSS (kept) === */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-blue: #003262;
--berkeley-gold: #FDB515;
--light-blue: #3B7EA1;
--dark-gray: #2A2A2A;
--light-gray: #F5F5F5;
--white: #FFFFFF;
--gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--gradient-2: linear-gradient(135deg, #3B7EA1 0%, #003262 100%);
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: var(--dark-gray);
background: var(--white);
}
.logo {
font-size: 1.5rem;
font-weight: bold;
color: var(--primary-blue);
}
.nav-links {
display: flex;
gap: 2rem;
list-style: none;
}
.nav-links a {
text-decoration: none;
color: var(--dark-gray);
transition: color 0.3s;
font-weight: 500;
}
.nav-links a:hover {
color: var(--berkeley-gold);
}
/* Hero Section (legacy styles retained; replaced by Tailwind hero) */
.hero {
background: var(--gradient-2);
color: var(--white);
padding: 5rem 2rem;
text-align: center;
}
.hero h1 {
font-size: 3rem;
margin-bottom: 1rem;
animation: fadeInUp 0.8s ease;
}
.hero p {
font-size: 1.3rem;
max-width: 800px;
margin: 0 auto;
opacity: 0.95;
animation: fadeInUp 0.8s ease 0.2s backwards;
}
/* Main Content */
.container {
max-width: 1400px;
margin: 0 auto;
padding: 2rem;
}
/* Research Thrusts Grid */
.research-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
gap: 2rem;
margin: 4rem 0;
}
.research-card {
background: var(--white);
border-radius: 12px;
padding: 2rem;
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
transition: transform 0.3s, box-shadow 0.3s;
border-top: 4px solid var(--berkeley-gold);
}
.research-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.research-card h3 {
color: var(--primary-blue);
margin-bottom: 1rem;
font-size: 1.4rem;
}
.research-card p {
color: #666;
margin-bottom: 1rem;
}
.sub-areas {
list-style: none;
margin-top: 1rem;
}
.sub-areas li {
padding: 0.5rem 0;
border-left: 3px solid var(--light-blue);
padding-left: 1rem;
margin-bottom: 0.5rem;
transition: all 0.3s;
}
.sub-areas li:hover {
border-left-color: var(--berkeley-gold);
background: var(--light-gray);
}
/* Featured Section */
.featured-section {
background: var(--light-gray);
padding: 4rem 0;
margin: 4rem 0;
}
.featured-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-top: 2rem;
}
.featured-item {
background: var(--white);
padding: 1.5rem;
border-radius: 8px;
border-left: 4px solid var(--light-blue);
}
.featured-item h4 {
color: var(--primary-blue);
margin-bottom: 0.5rem;
}
.tag {
display: inline-block;
background: var(--berkeley-gold);
color: var(--white);
padding: 0.2rem 0.6rem;
border-radius: 20px;
font-size: 0.85rem;
margin-right: 0.5rem;
margin-bottom: 0.5rem;
}
/* Cross-cutting Initiatives */
.initiatives {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin: 3rem 0;
}
.initiative-card {
text-align: center;
padding: 2rem;
background: var(--white);
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.initiative-icon {
width: 60px;
height: 60px;
margin: 0 auto 1rem;
background: var(--gradient-1);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: var(--white);
font-size: 1.5rem;
}
/* CTA Section */
.cta-section {
background: var(--gradient-2);
color: var(--white);
padding: 4rem 2rem;
text-align: center;
margin-top: 4rem;
border-radius: 12px;
}
.cta-section h2 {
font-size: 2.5rem;
margin-bottom: 1rem;
}
.cta-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
margin-top: 2rem;
}
.cta-item {
padding: 1.5rem;
background: rgba(255,255,255,0.1);
border-radius: 8px;
backdrop-filter: blur(10px);
}
.btn {
display: inline-block;
padding: 0.8rem 2rem;
background: var(--berkeley-gold);
color: var(--white);
text-decoration: none;
border-radius: 25px;
transition: all 0.3s;
margin-top: 1rem;
font-weight: 600;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(253, 181, 21, 0.4);
}
/* Section Headers */
.section-header {
text-align: center;
margin: 4rem 0 2rem;
}
.section-header h2 {
font-size: 2.5rem;
color: var(--primary-blue);
margin-bottom: 1rem;
}
.section-header p {
color: #666;
font-size: 1.1rem;
max-width: 700px;
margin: 0 auto;
}
/* Animations */
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
.fade-in {
animation: fadeInUp 0.8s ease;
}
/* Mobile Responsive */
@media (max-width: 768px) {
.nav-links { flex-direction: column; gap: 1rem; }
.hero h1 { font-size: 2rem; }
.hero p { font-size: 1rem; }
.research-grid { grid-template-columns: 1fr; }
.section-header h2 { font-size: 1.8rem; }
}
/* Accordion for sub-areas */
.accordion { margin-top: 1rem; }
.accordion-header {
background: var(--light-gray);
padding: 0.8rem;
cursor: pointer;
border-radius: 4px;
margin-bottom: 0.5rem;
transition: background 0.3s;
display: flex;
justify-content: space-between;
align-items: center;
}
.accordion-header:hover { background: #e0e0e0; }
.accordion-content {
display: none;
padding: 1rem;
background: #fafafa;
border-radius: 4px;
margin-bottom: 1rem;
}
.accordion-content.active { display: block; }
.arrow { transition: transform 0.3s; }
.arrow.active { transform: rotate(180deg); }
/* === Pagination (add) === */
.pagination{display:flex;gap:.5rem;justify-content:center;margin:2rem 0;flex-wrap:wrap}
.pagination button{padding:.5rem .75rem;border:1px solid #e5e7eb;border-radius:6px;background:#fff;cursor:pointer}
.pagination button.active{background:var(--primary-blue);color:#fff;border-color:var(--primary-blue)}
.pagination button[disabled]{opacity:.5;cursor:not-allowed}
</style>
</head>
<body class="text-gray-800">
<!-- ====== NEW TAILWIND HEADER ====== -->
<header class="sticky top-0 bg-white shadow z-50">
<div class="max-w-7xl mx-auto flex justify-between items-center px-6 py-4">
<div id="logo-container" class="py-2">
<a href="/" aria-label="Berkeley Center for RDI Logo">
<img src="/assets/images/rdi_logo_horizontal_720.png" alt="Berkeley RDI Logo" class="h-16 w-auto max-w-full">
</a>
</div>
<button id="menu-toggle" class="sm:hidden text-gray-600 focus:outline-none" aria-label="Toggle menu">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 6h16M4 12h16M4 18h16"/>
</svg>
</button>
<nav id="nav-links" class="hidden sm:flex space-x-6 text-sm font-medium">
<a href="/" class="hover:text-blue-600">Home</a>
<a href="/research" class="hover:text-blue-900">Research</a>
<a href="/education" class="hover:text-blue-900">Education</a>
<a href="/events" class="hover:text-blue-900">Events</a>
<a href="/blog" class="hover:text-blue-900">Blog</a>
<a href="/people" class="hover:text-blue-900">About</a>
</nav>
</div>
<div id="mobile-menu" class="sm:hidden hidden px-6 pb-4 space-y-2 text-sm font-medium">
<a href="/" class="block py-1">Home</a>
<a href="/research" class="block py-1">Research</a>
<a href="/education" class="block py-1">Education</a>
<a href="/events" class="block py-1">Events</a>
<a href="/blog" class="block py-1">Blog</a>
<a href="/people" class="block py-1">About</a>
<a href="/contact" class="block py-1">Contact</a>
</div>
</header>
<!-- ====== NEW TAILWIND HERO ====== -->
<section style="background-image: url('/assets/images/homepage-background.png')" class="bg-cover bg-center py-40 text-center px-4">
<h1 class="text-5xl font-bold text-white mb-4">Research @Berkeley RDI</h1>
<p class="max-w-2xl mx-auto text-lg text-white mb-6">
Advancing the Frontier of Agentic AI and Decentralized Intelligence
</p>
<a href="/publications"
class="inline-block bg-yellow-400 text-blue-900 px-8 py-3 font-bold rounded border-2 border-yellow-400 hover:bg-yellow-500 transition">
View All Research Publications
</a>
</section>
<!-- ====== YOUR ORIGINAL MAIN CONTENT (UPDATED) ====== -->
<div class="container">
<!-- Core Research Thrusts -->
<div class="section-header">
<h2>Core Research Thrusts</h2>
<p>Pioneering the next generation of AI and Agentic AI</p>
</div>
<div class="research-grid" id="research-grid">
<!-- 1. Agentic AI Foundation -->
<div class="research-card">
<h3>Agentic AI Foundation</h3>
<ul class="sub-areas">
<li>Reasoning and Planning</li>
<li>Reinforcement Learning</li>
<li>Lifelong Learning and Self-Improvement</li>
</ul>
</div>
<!-- 2. AI Safety and Security -->
<div class="research-card">
<h3>AI Safety and Security</h3>
<ul class="sub-areas">
<li>Robustness and Adversarial Resilience</li>
<li>Oversight, Alignment, and Control</li>
<li>Interpretability and Monitoring</li>
<li>Privacy</li>
</ul>
</div>
<!-- 3. Agentic AI Applications -->
<div class="research-card">
<h3>Agentic AI Applications</h3>
<ul class="sub-areas">
<li>Web Agents</li>
<li>Coding Agents</li>
<li>Deep Research Agents</li>
<li>Multi-Agent Systems</li>
</ul>
</div>
<!-- 4. AI for Cybersecurity -->
<div class="research-card">
<h3>AI for Cybersecurity</h3>
<ul class="sub-areas">
<li>AI Cybersecurity Capability Evaluation</li>
<li>Threat Detection and Intrusion Prevention</li>
<li>Automated Vulnerability Discovery</li>
<li>Cyber Deception and Active Defense</li>
</ul>
</div>
<!-- 5. AI for Program Synthesis and Secure Code -->
<div class="research-card">
<h3>AI for Program Synthesis and Secure Code</h3>
<ul class="sub-areas">
<li>Program Synthesis and Automated Code Generation</li>
<li>Secure Code Generation and Verification</li>
<li>AI-Driven Formal Methods (static analysis, correctness proofs)</li>
</ul>
</div>
<!-- 6. Decentralization Technology -->
<div class="research-card">
<h3>Decentralization Technology</h3>
<ul class="sub-areas">
<li>Zero-Knowledge Proofs</li>
<li>DeFi</li>
<li>Applied Cryptography</li>
<li>Metaverse and Synthetic Worlds</li>
<li>Privacy</li>
</ul>
</div>
</div>
<div id="pagination" class="pagination"></div>
</div>
<!-- test -->
<!-- Join Our Community -->
<section id="community" class="bg-blue-900 py-16 px-6 text-center">
<h2 class="text-3xl text-white font-bold mb-4 text-white">Join Our Community</h2>
<p class="max-w-3xl mx-auto mb-6 text-white">We invite researchers, students, industry practitioners, innovators and entrepreneurs to collaborate with us in shaping the future of responsible AI and decentralized intelligence.</p>
<div class="mt-8 gap-4 flex flex-col sm:flex-row justify-center items-center">
<a href="https://berkeleyrdi.substack.com/" class="bg-yellow-400 text-blue-900 px-8 py-3 font-bold rounded border-2 border-yellow-400 hover:bg-yellow-500">Subscribe to Newsletter</a>
<a href="https://twitter.com/BerkeleyRDI" class="bg-yellow-400 text-blue-900 px-8 py-3 font-bold rounded border-2 border-yellow-400 hover:bg-yellow-500">Follow RDI on X/Twitter</a>
<a href="https://discord.gg/NWVpQ9rBvd" class="bg-yellow-400 text-blue-900 px-8 py-3 font-bold rounded border-2 border-yellow-400 hover:bg-yellow-500">Join Agentic AI Discord</a>
</div>
</section>
<!-- Footer -->
<footer class="bg-gray-900 text-gray-300 text-sm py-10 px-6">
<div class="max-w-7xl mx-auto grid md:grid-cols-4 gap-6">
<div>
<h4 class="text-white font-semibold mb-2">Berkeley RDI</h4>
<p>Advancing the science, technology, and education of decentralization and AI to empower a responsible digital economy.</p>
<div class="flex space-x-3 mt-4 text-xl">
<!-- Twitter -->
<a href="https://twitter.com/BerkeleyRDI" class="hover:text-white transition text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" fill="currentColor" class="bi bi-twitter-x" viewBox="0 0 16 16">
<path d="M12.6.75h2.454l-5.36 6.142L16 15.25h-4.937l-3.867-5.07-4.425 5.07H.316l5.733-6.57L0 .75h5.063l3.495 4.633L12.601.75Zm-.86 13.028h1.36L4.323 2.145H2.865z"/>
</svg>
</a>
<!-- Youtube -->
<a href="https://www.youtube.com/@BerkeleyRDI" class="hover:text-white transition text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" fill="currentColor" class="bi bi-youtube" viewBox="0 0 16 16">
<path d="M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 0 1 1.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.01 2.01 0 0 1-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.01 2.01 0 0 1-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31 31 0 0 1 0 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.01 2.01 0 0 1 1.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A100 100 0 0 1 7.858 2zM6.4 5.209v4.818l4.157-2.408z"/>
</svg>
</a>
<!-- Discord -->
<a href="https://discord.gg/NWVpQ9rBvd" class="hover:text-white transition text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" fill="currentColor" class="bi bi-discord" viewBox="0 0 16 16">
<path d="M13.545 2.907a13.2 13.2 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.2 12.2 0 0 0-3.658 0 8 8 0 0 0-.412-.833.05.05 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.04.04 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032q.003.022.021.037a13.3 13.3 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019q.463-.63.818-1.329a.05.05 0 0 0-.01-.059l-.018-.011a9 9 0 0 1-1.248-.595.05.05 0 0 1-.02-.066l.015-.019q.127-.095.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.05.05 0 0 1 .053.007q.121.1.248.195a.05.05 0 0 1-.004.085 8 8 0 0 1-1.249.594.05.05 0 0 0-.03.03.05.05 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.2 13.2 0 0 0 4.001-2.02.05.05 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.03.03 0 0 0-.02-.019m-8.198 7.307c-.789 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612m5.316 0c-.788 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612"/>
</svg>
</a>
<!-- Mail -->
<a href="mailto:rdi@berkeley.edu" class="hover:text-white transition text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" fill="currentColor" class="bi bi-envelope-fill" viewBox="0 0 16 16">
<path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414zM0 4.697v7.104l5.803-3.558zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586zm3.436-.586L16 11.801V4.697z"/>
</svg>
</a>
</div>
</div>
<div>
<h4 class="text-white font-semibold mb-2 text-yellow-400">Explore</h4>
<ul class="space-y-1">
<li><a href="/research" class="hover:underline">Research</a></li>
<li><a href="/education" class="hover:underline">Education</a></li>
<li><a href="/events" class="hover:underline">Events</a></li>
<li><a href="/blog" class="hover:underline">Blog</a></li>
<li><a href="/people" class="hover:underline">About Us</a></li>
</ul>
</div>
<!-- <div>
<h4 class="text-white font-semibold mb-2 text-yellow-400">Resources</h4>
<ul class="space-y-1">
<li><a href="/publications" class="hover:underline">Publications</a></li>
<li><a href="/moocs" class="hover:underline">MOOCs</a></li>
<li><a href="/videos" class="hover:underline">Lecture Videos</a></li>
<li><a href="https://discord.gg/NWVpQ9rBvd" class="hover:underline">Join Discord</a></li>
</ul>
</div>
<div>
<h4 class="text-white font-semibold mb-2 text-yellow-400">Contact</h4>
<ul class="space-y-1">
<li><a href="/contact" class="hover:underline">Get in Touch</a></li>
<li><a href="/media" class="hover:underline">Media Inquiries</a></li>
<li><a href="/partnerships" class="hover:underline">Partnerships</a></li>
<li><a href="/careers" class="hover:underline">Careers</a></li>
</ul>
</div> -->
</div>
<div class="text-center text-xs mt-8 text-gray-500">
Copyright © {{ "now" | date: "%Y" }} UC Regents; all rights reserved
</div>
</footer>
<!-- ====== Scripts (kept + mobile menu) ====== -->
<!-- 4) Add this JS (either in your existing <script> before </script>, or as a new <script> after it) -->
<!-- Replace your first pagination script block with this one -->
<script>
(function () {
const grid = document.getElementById('research-grid');
const pagEl = document.getElementById('pagination');
if (!grid || !pagEl) return;
const perPage = 30;
const allItems = Array.from(grid.querySelectorAll('.research-card'));
let page = 1;
function visibleItems() {
// Treat elements hidden by filters (e.g., .hidden or display:none) as invisible
return allItems.filter(el =>
!el.classList.contains('hidden') &&
getComputedStyle(el).display !== 'none' &&
el.offsetParent !== null
);
}
function render() {
const vis = visibleItems();
const totalPages = Math.ceil(vis.length / perPage);
// If 30 or fewer visible, show all and hide pagination
if (vis.length <= perPage) {
allItems.forEach(el => (el.style.display = ''));
pagEl.innerHTML = '';
pagEl.style.display = 'none';
page = 1;
return;
}
// Otherwise, paginate visible set
pagEl.style.display = '';
const maxPage = Math.max(1, totalPages);
page = Math.min(Math.max(1, page), maxPage);
// Hide all, then show the current slice of visible ones
allItems.forEach(el => (el.style.display = 'none'));
const start = (page - 1) * perPage;
const end = start + perPage;
vis.slice(start, end).forEach(el => (el.style.display = ''));
// Build controls
pagEl.innerHTML = '';
const mkBtn = (label, disabled, goto, active = false) => {
const b = document.createElement('button');
b.textContent = label;
if (disabled) b.disabled = true;
if (active) b.classList.add('active');
if (!disabled && !active) b.addEventListener('click', () => { page = goto; render(); });
return b;
};
pagEl.appendChild(mkBtn('Prev', page === 1, page - 1));
for (let p = 1; p <= totalPages; p++) pagEl.appendChild(mkBtn(String(p), false, p, p === page));
pagEl.appendChild(mkBtn('Next', page === totalPages, page + 1));
}
// Re-render when filters change: observe class/style changes or child list mutations
const mo = new MutationObserver(render);
mo.observe(grid, { attributes: true, attributeFilter: ['class', 'style'], subtree: true, childList: true });
// Optional: re-render on a custom event if your filters dispatch it
window.addEventListener('filters:changed', render);
render();
})();
</script>
<script>
// Accordion functionality
function toggleAccordion(header) {
const content = header.nextElementSibling;
const arrow = header.querySelector('.arrow');
content.classList.toggle('active');
arrow.classList.toggle('active');
}
// Smooth scroll for in-page anchors
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
const target = document.querySelector(this.getAttribute('href'));
if (target) {
e.preventDefault();
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Fade-in on scroll
const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -50px 0px' };
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) entry.target.classList.add('fade-in');
});
}, observerOptions);
document.querySelectorAll('.research-card, .featured-item, .initiative-card').forEach(el => {
observer.observe(el);
});
// Mobile menu toggle
const toggleBtn = document.getElementById('menu-toggle');
const mobileMenu = document.getElementById('mobile-menu');
if (toggleBtn) {
toggleBtn.addEventListener('click', () => {
mobileMenu.classList.toggle('hidden');
});
}
</script>
</body>
</html>