-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathui.html
More file actions
850 lines (788 loc) · 50.9 KB
/
Copy pathui.html
File metadata and controls
850 lines (788 loc) · 50.9 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
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
<html lang="en" class="antialiased"><head><meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QuakeVector — Seismic Detection Engine</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/iconify-icon@1.0.7/dist/iconify-icon.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"
}
}
</script>
<style>
*{box-sizing:border-box}
body { font-family: 'Space Grotesk', sans-serif; background: #030305; color: #fff; margin: 0; overflow-x:hidden; }
.glass {
background: rgba(8,8,14,0.85);
backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,0.05);
}
.glass-bright {
background: rgba(8,8,14,0.9);
backdrop-filter: blur(16px);
border: 1px solid rgba(34,211,238,0.1);
}
.glass-alert {
background: rgba(25,5,8,0.9);
backdrop-filter: blur(12px);
border: 1px solid rgba(239,68,68,0.2);
}
.inner-card {
background: rgba(255,255,255,0.025);
border: 1px solid rgba(255,255,255,0.03);
}
.metric { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.glitch-target { will-change: transform, text-shadow; backface-visibility: hidden; }
.glitch-active { animation: glitch-anim 0.25s cubic-bezier(0.25,0.46,0.45,0.94) both; }
@keyframes glitch-anim {
0% { transform: translate(0); text-shadow: none; }
20% { transform: translate(-2px,1px) skewX(-2deg); text-shadow: 2px 0 rgba(34,211,238,0.4), -2px 0 rgba(255,0,170,0.4); }
40% { transform: translate(2px,-1px) skewX(2deg); text-shadow: -2px 0 rgba(34,211,238,0.4), 2px 0 rgba(255,0,170,0.4); }
60% { transform: translate(-1px,2px); }
100% { transform: translate(0); text-shadow: none; }
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes scan { 0% { top: -2px; } 100% { top: 100%; } }
@keyframes border-pulse {
0%,100% { border-color: rgba(34,211,238,0.05); }
50% { border-color: rgba(34,211,238,0.15); }
}
@keyframes alert-pulse {
0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
50% { box-shadow: 0 0 40px 5px rgba(239,68,68,0.15); }
}
.scan-line { position: absolute; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(34,211,238,0.1), transparent); animation: scan 5s linear infinite; pointer-events: none; }
.border-pulse { animation: border-pulse 3s ease infinite; }
.alert-active { animation: alert-pulse 2s ease infinite; }
canvas.wf { image-rendering: pixelated; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(34,211,238,0.12); border-radius: 2px; }
.alert-card { transition: all 0.2s ease; }
.alert-card:hover { transform: translateX(3px); }
html { scroll-behavior: smooth; }
.nav-tab.active { background: rgba(34,211,238,0.1); color: #22d3ee; border-color: rgba(34,211,238,0.15); }
.nav-tab:not(.active) { background: transparent; color: #737373; border-color: transparent; }
.nav-tab:not(.active):hover { color: #22d3ee; }
</style></head>
<body>
<!-- Loader -->
<div id="loader" class="fixed inset-0 z-50 flex items-center justify-center bg-[#030305] transition-opacity duration-1000">
<div class="flex flex-col items-center gap-6">
<div class="relative w-16 h-16">
<svg viewBox="0 0 100 100" class="w-full h-full animate-spin" style="animation-duration:3s">
<circle cx="50" cy="50" r="40" fill="none" stroke="rgba(34,211,238,0.08)" stroke-width="1.5"/>
<circle cx="50" cy="50" r="40" fill="none" stroke="#22d3ee" stroke-width="1.5" stroke-dasharray="50 200" stroke-linecap="round"/>
</svg>
<svg class="absolute inset-3 w-10 h-10" viewBox="0 0 100 50">
<path d="M5 25 L20 25 L25 8 L30 42 L35 15 L40 35 L45 25 L55 25 L60 5 L65 45 L70 18 L75 32 L80 25 L95 25" fill="none" stroke="#22d3ee" stroke-width="2" stroke-linecap="round" opacity="0.7">
<animate attributeName="stroke-dashoffset" from="200" to="0" dur="1s" fill="freeze"/>
<animate attributeName="stroke-dasharray" from="0 200" to="200 0" dur="1s" fill="freeze"/>
</path>
</svg>
</div>
<div class="h-px w-32 bg-neutral-800 overflow-hidden relative">
<div class="absolute inset-0 bg-gradient-to-r from-transparent via-cyan-400 to-transparent w-full -translate-x-full animate-[shimmer_1s_infinite]"></div>
</div>
<div class="text-center">
<p class="text-[10px] uppercase tracking-[0.3em] text-cyan-400/50 mb-1">QuakeVector</p>
<p class="text-[10px] uppercase tracking-[0.15em] text-neutral-700">Initializing Seismic Core</p>
</div>
</div>
</div>
<!-- ====== SCROLLABLE PAGE LAYOUT ====== -->
<div id="app" class="opacity-0">
<!-- === SECTION 1: TOP NAV === -->
<header class="sticky top-0 z-40 glass border-t-0 border-l-0 border-r-0 px-6 py-3 flex justify-between items-center">
<div class="flex items-center gap-3 group cursor-pointer">
<div class="relative w-9 h-9 rounded-lg border border-cyan-500/20 flex items-center justify-center bg-cyan-500/5 group-hover:border-cyan-400/40 transition-all duration-500">
<svg class="w-5 h-5 text-cyan-400" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<path d="M2 12h3l3-9 4 18 4-12 3 6h3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<div>
<span class="text-sm font-semibold tracking-tight text-white glitch-target block leading-none">QUAKEVECTOR</span>
<span class="text-[8px] uppercase tracking-[0.15em] text-neutral-600">Seismic Detection v0.1.0</span>
</div>
</div>
<nav id="main-nav" class="hidden lg:flex items-center gap-1 glass rounded-full px-1.5 py-1 border-0 bg-white/[0.02]">
<button data-target="sec-dashboard" class="nav-tab active px-4 py-1.5 rounded-full text-[10px] uppercase tracking-widest bg-cyan-500/10 text-cyan-400 border border-cyan-500/15 transition-all duration-300">Dashboard</button>
<button data-target="sec-network" class="nav-tab px-4 py-1.5 rounded-full text-[10px] uppercase tracking-widest text-neutral-500 hover:text-cyan-400 transition-all duration-300 border border-transparent">Network</button>
<button data-target="sec-embeddings" class="nav-tab px-4 py-1.5 rounded-full text-[10px] uppercase tracking-widest text-neutral-500 hover:text-cyan-400 transition-all duration-300 border border-transparent">Embeddings</button>
<button data-target="sec-hnsw" class="nav-tab px-4 py-1.5 rounded-full text-[10px] uppercase tracking-widest text-neutral-500 hover:text-cyan-400 transition-all duration-300 border border-transparent">HNSW Graph</button>
</nav>
<div class="flex items-center gap-3">
<div class="hidden md:flex items-center gap-2 px-3 py-1.5 bg-white/[0.02] rounded-lg border border-white/[0.03]">
<div id="sys-dot" class="w-2 h-2 rounded-full bg-cyan-500 shadow-[0_0_8px_rgba(6,182,212,0.5)]"></div>
<span id="sys-status" class="text-[10px] uppercase tracking-[0.1em] text-cyan-400 font-medium glitch-target">Operational</span>
</div>
<div class="flex items-center gap-1.5 px-3 py-1.5 bg-white/[0.02] rounded-lg border border-white/[0.03]">
<div class="w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.5)]"></div>
<span class="text-[9px] uppercase tracking-wider text-green-400 metric">LIVE</span>
</div>
</div>
</header>
<!-- === SECTION 2: STATUS STRIP === -->
<section id="sec-dashboard" class="px-6 py-5 scroll-mt-16">
<div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4">
<div class="glass rounded-xl p-4 border-pulse">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1.5">Uptime</span>
<span id="val-uptime" class="text-lg font-bold metric text-white">04:32:17</span>
</div>
<div class="glass rounded-xl p-4">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1.5">Station</span>
<span class="text-lg font-bold metric text-white">STA-042</span>
</div>
<div class="glass rounded-xl p-4">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1.5">Boot</span>
<span id="val-boot" class="text-lg font-bold metric text-cyan-400">WARM</span>
<span class="text-[9px] text-neutral-600 metric ml-1">247ms</span>
</div>
<div class="glass rounded-xl p-4">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1.5">Degradation</span>
<span id="val-degrad" class="text-lg font-bold metric text-green-400">NORMAL</span>
</div>
<div class="glass rounded-xl p-4">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1.5">HNSW Nodes</span>
<span id="val-nodes" class="text-lg font-bold metric text-white">12,847</span>
</div>
<div class="glass rounded-xl p-4">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1.5">Sensors</span>
<span class="text-lg font-bold metric text-white">3</span>
<span class="text-[9px] text-green-400/60 ml-1">active</span>
</div>
</div>
</section>
<!-- === SECTION 3: WAVEFORM === -->
<section class="px-6 pb-5">
<div class="glass rounded-2xl overflow-hidden border-pulse">
<div class="px-5 py-3 flex items-center justify-between border-b border-white/[0.04]">
<div class="flex items-center gap-3">
<svg class="w-4 h-4 text-cyan-400" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M2 12h3l3-9 4 18 4-12 3 6h3" stroke-linecap="round" stroke-linejoin="round"/></svg>
<span class="text-xs font-medium text-neutral-200">Live Seismic Waveform</span>
<span class="text-[9px] metric text-neutral-600 ml-2">SEN-001 | CH-0 | 1kHz</span>
</div>
<div class="flex items-center gap-5">
<div class="flex items-center gap-1.5"><span class="w-4 h-[2px] rounded-full bg-cyan-400"></span><span class="text-[9px] text-neutral-500">P-wave</span></div>
<div class="flex items-center gap-1.5"><span class="w-4 h-[2px] rounded-full" style="background:#ff00aa"></span><span class="text-[9px] text-neutral-500">S-wave</span></div>
<div class="flex items-center gap-1.5"><span class="w-4 h-[2px] rounded-full bg-amber-400"></span><span class="text-[9px] text-neutral-500">Surface</span></div>
</div>
</div>
<div class="relative h-44 lg:h-56 bg-[#050508]">
<canvas id="waveform-1" class="wf w-full h-full"></canvas>
<div class="scan-line" style="animation-duration:7s;opacity:0.35"></div>
<div class="absolute right-3 top-[10%] text-[8px] metric text-red-500/25">CRITICAL 0.9</div>
<div class="absolute right-3 top-[26%] text-[8px] metric text-orange-500/20">HIGH 0.7</div>
<div class="absolute right-3 top-[44%] text-[8px] metric text-amber-500/15">MEDIUM 0.5</div>
<div class="absolute right-3 top-[62%] text-[8px] metric text-green-500/10">LOW 0.3</div>
<div class="absolute left-3 bottom-2 text-[8px] metric text-neutral-700" id="wf-timestamp"></div>
</div>
</div>
</section>
<!-- === SECTION 4: 3D GLOBE — THE HERO === -->
<section class="relative" style="height:70vh; min-height:500px;">
<!-- 3D Canvas fills this section -->
<canvas id="webgl-canvas" class="absolute inset-0 w-full h-full outline-none z-0"></canvas>
<!-- Scanline overlay -->
<div class="absolute inset-0 z-[1] pointer-events-none opacity-20"><div class="scan-line"></div></div>
<!-- Floating metric pills over the 3D -->
<div class="absolute top-6 left-1/2 -translate-x-1/2 z-10 flex items-center gap-2 pointer-events-none">
<div class="glass rounded-full px-4 py-2 flex items-center gap-2">
<div id="hero-dot" class="w-2 h-2 rounded-full bg-cyan-500 shadow-[0_0_8px_rgba(6,182,212,0.5)]"></div>
<span id="hero-status" class="text-[10px] uppercase tracking-[0.15em] text-cyan-400 metric glitch-target">System Operational</span>
</div>
</div>
<!-- Bottom floating cards -->
<div class="absolute bottom-8 left-1/2 -translate-x-1/2 z-10 flex gap-4 pointer-events-none">
<div class="glass rounded-xl px-6 py-4 text-center min-w-[120px]">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1">Magnitude</span>
<span id="val-mag" class="text-2xl font-bold metric text-white block leading-none">2.1</span>
<span class="text-[8px] text-neutral-700 metric">Richter Est.</span>
</div>
<div class="glass rounded-xl px-6 py-4 text-center min-w-[120px]">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1">Probability</span>
<span id="val-prob-hero" class="text-2xl font-bold metric text-green-400 block leading-none">0.16</span>
<span id="val-prob-label" class="text-[8px] text-neutral-700 metric">LOW</span>
</div>
<div class="glass rounded-xl px-6 py-4 text-center min-w-[120px]">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1">Time to Peak</span>
<span id="val-ttp" class="text-2xl font-bold metric text-amber-400 block leading-none">11.2s</span>
<span class="text-[8px] text-neutral-700 metric">Estimated</span>
</div>
<div class="glass rounded-xl px-6 py-4 text-center min-w-[120px]">
<span class="text-[8px] uppercase tracking-widest text-neutral-600 block mb-1">Inference</span>
<span id="val-latency" class="text-2xl font-bold metric text-cyan-400 block leading-none">142us</span>
<span class="text-[8px] text-neutral-700 metric">Model v1</span>
</div>
</div>
</section>
<!-- === SECTION 5: GAUGE + PROBABILITY + WAVEFORM 2 === -->
<section id="sec-embeddings" class="px-6 py-5 scroll-mt-16">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-5">
<!-- Probability Gauge -->
<div id="threat-panel" class="glass-bright rounded-2xl p-6 border-pulse">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<iconify-icon icon="solar:shield-warning-linear" width="16" class="text-neutral-500"></iconify-icon>
<span class="text-[10px] uppercase tracking-widest text-neutral-500">Event Probability</span>
</div>
<span id="threat-badge" class="text-[9px] uppercase tracking-wider px-2.5 py-0.5 rounded-full bg-green-500/10 text-green-400 border border-green-500/15 metric">LOW</span>
</div>
<div class="flex justify-center my-4">
<div class="relative w-40 h-40">
<svg viewBox="0 0 120 120" class="w-full h-full -rotate-90">
<circle cx="60" cy="60" r="48" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="6"/>
<circle id="gauge-ring" cx="60" cy="60" r="48" fill="none" stroke="#22c55e" stroke-width="6" stroke-dasharray="301" stroke-dashoffset="253" stroke-linecap="round" class="transition-all duration-500"/>
</svg>
<div class="absolute inset-0 flex flex-col items-center justify-center">
<span id="gauge-val" class="text-3xl font-bold metric" style="color:#22c55e">0.16</span>
<span class="text-[8px] uppercase tracking-widest text-neutral-600 mt-1">PROBABILITY</span>
</div>
</div>
</div>
<div class="grid grid-cols-2 gap-3 mt-4">
<div class="inner-card rounded-lg p-3 text-center">
<span class="text-[8px] text-neutral-600 block mb-0.5">Confidence</span>
<span id="val-conf" class="text-base font-semibold metric text-white">87%</span>
</div>
<div class="inner-card rounded-lg p-3 text-center">
<span class="text-[8px] text-neutral-600 block mb-0.5">Wave Evidence</span>
<span id="val-waves" class="text-base font-semibold metric text-neutral-400">3 IDs</span>
</div>
</div>
</div>
<!-- Probability Timeline -->
<div class="glass rounded-2xl overflow-hidden">
<div class="px-5 py-3 border-b border-white/[0.04] flex items-center justify-between">
<div class="flex items-center gap-2">
<iconify-icon icon="solar:graph-new-linear" width="14" class="text-cyan-400/60"></iconify-icon>
<span class="text-xs font-medium text-neutral-200">Probability Timeline</span>
</div>
<span id="pred-count" class="text-[9px] metric text-neutral-600">48 predictions</span>
</div>
<div class="relative h-52 bg-[#050508]">
<canvas id="prob-chart" class="w-full h-full"></canvas>
<div class="absolute left-0 right-0 pointer-events-none" style="top:10%"><div class="border-t border-dashed border-red-500/10"></div></div>
<div class="absolute left-0 right-0 pointer-events-none" style="top:30%"><div class="border-t border-dashed border-orange-500/8"></div></div>
<div class="absolute left-0 right-0 pointer-events-none" style="top:50%"><div class="border-t border-dashed border-amber-500/6"></div></div>
<div class="absolute left-0 right-0 pointer-events-none" style="top:70%"><div class="border-t border-dashed border-green-500/5"></div></div>
</div>
</div>
<!-- Waveform 2 -->
<div class="glass rounded-2xl overflow-hidden">
<div class="px-5 py-3 border-b border-white/[0.04] flex items-center justify-between">
<div class="flex items-center gap-2">
<span class="text-xs text-neutral-300">SEN-002 | CH-1</span>
</div>
<span class="text-[9px] metric text-neutral-600">256-DIM EMBEDDING</span>
</div>
<div class="relative h-52 bg-[#050508]">
<canvas id="waveform-2" class="wf w-full h-full"></canvas>
</div>
</div>
</div>
</section>
<!-- === SECTION 6: RESOURCES + SENSORS + PEERS === -->
<section id="sec-hnsw" class="px-6 pb-5 scroll-mt-16">
<div class="grid grid-cols-1 md:grid-cols-3 gap-5">
<!-- Resources -->
<div class="glass rounded-2xl p-5">
<div class="flex items-center gap-2 mb-5">
<iconify-icon icon="solar:cpu-bolt-linear" width="16" class="text-neutral-500"></iconify-icon>
<span class="text-[10px] uppercase tracking-widest text-neutral-500">System Resources</span>
</div>
<div class="space-y-5">
<div>
<div class="flex justify-between items-baseline mb-2">
<span class="text-xs text-neutral-400">RAM Utilization</span>
<span id="val-ram" class="text-sm metric text-cyan-400 font-semibold">42%</span>
</div>
<div class="h-2 rounded-full bg-white/[0.03] overflow-hidden">
<div id="bar-ram" class="h-full rounded-full bg-gradient-to-r from-cyan-500 to-cyan-400 shadow-[0_0_8px_rgba(34,211,238,0.3)] transition-all duration-700" style="width:42%"></div>
</div>
</div>
<div>
<div class="flex justify-between items-baseline mb-2">
<span class="text-xs text-neutral-400">HNSW Graph Fill</span>
<span id="bar-nodes-pct" class="text-sm metric text-purple-400 font-semibold">64%</span>
</div>
<div class="h-2 rounded-full bg-white/[0.03] overflow-hidden">
<div id="bar-nodes" class="h-full rounded-full bg-gradient-to-r from-purple-500/80 to-pink-500/60 shadow-[0_0_6px_rgba(168,85,247,0.2)] transition-all duration-700" style="width:64%"></div>
</div>
</div>
<div>
<div class="flex justify-between items-baseline mb-2">
<span class="text-xs text-neutral-400">Inference Load</span>
<span id="val-inf-load" class="text-sm metric text-amber-400 font-semibold">31%</span>
</div>
<div class="h-2 rounded-full bg-white/[0.03] overflow-hidden">
<div id="bar-inf" class="h-full rounded-full bg-gradient-to-r from-amber-500/80 to-orange-500/60 shadow-[0_0_6px_rgba(245,158,11,0.2)] transition-all duration-700" style="width:31%"></div>
</div>
</div>
</div>
</div>
<!-- Sensors -->
<div class="glass rounded-2xl p-5">
<div class="flex items-center justify-between mb-5">
<div class="flex items-center gap-2">
<iconify-icon icon="solar:radar-2-linear" width="16" class="text-neutral-500"></iconify-icon>
<span class="text-[10px] uppercase tracking-widest text-neutral-500">Sensors</span>
</div>
<span class="text-[9px] metric text-green-400/60">3/3 ONLINE</span>
</div>
<div class="space-y-3">
<div class="inner-card rounded-xl px-4 py-3 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-2 h-2 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.5)]"></div>
<div>
<span class="text-xs metric text-neutral-200 block">SEN-001</span>
<span class="text-[8px] text-neutral-600 metric">1kHz | CH-0</span>
</div>
</div>
<span class="text-[9px] text-green-400 font-medium px-2 py-0.5 rounded-full bg-green-500/10 border border-green-500/15">ACTIVE</span>
</div>
<div class="inner-card rounded-xl px-4 py-3 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-2 h-2 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.5)]"></div>
<div>
<span class="text-xs metric text-neutral-200 block">SEN-002</span>
<span class="text-[8px] text-neutral-600 metric">1kHz | CH-1</span>
</div>
</div>
<span class="text-[9px] text-green-400 font-medium px-2 py-0.5 rounded-full bg-green-500/10 border border-green-500/15">ACTIVE</span>
</div>
<div class="inner-card rounded-xl px-4 py-3 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-2 h-2 rounded-full bg-amber-500 shadow-[0_0_6px_rgba(245,158,11,0.5)]"></div>
<div>
<span class="text-xs metric text-neutral-200 block">SEN-003</span>
<span class="text-[8px] text-neutral-600 metric">1kHz | CH-2</span>
</div>
</div>
<span class="text-[9px] text-amber-400 font-medium px-2 py-0.5 rounded-full bg-amber-500/10 border border-amber-500/15">DEGRADED</span>
</div>
</div>
</div>
<!-- Mesh Network -->
<div class="glass rounded-2xl p-5">
<div class="flex items-center justify-between mb-5">
<div class="flex items-center gap-2">
<iconify-icon icon="solar:global-linear" width="16" class="text-neutral-500"></iconify-icon>
<span class="text-[10px] uppercase tracking-widest text-neutral-500">Mesh Network</span>
</div>
<span class="text-[9px] metric text-cyan-400/50">2 PEERS</span>
</div>
<div class="space-y-3">
<div class="inner-card rounded-xl px-4 py-3 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-2 h-2 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.4)]"></div>
<div>
<span class="text-xs metric text-neutral-200 block">STA-043</span>
<span class="text-[8px] text-neutral-600 metric">Last seen 2s ago</span>
</div>
</div>
<span class="text-[9px] text-green-400 font-medium">HEALTHY</span>
</div>
<div class="inner-card rounded-xl px-4 py-3 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-2 h-2 rounded-full bg-amber-500 shadow-[0_0_6px_rgba(245,158,11,0.4)]"></div>
<div>
<span class="text-xs metric text-neutral-200 block">STA-044</span>
<span class="text-[8px] text-neutral-600 metric">Last seen 47s ago</span>
</div>
</div>
<span class="text-[9px] text-amber-400 font-medium">STALE</span>
</div>
</div>
<div class="mt-4 pt-3 border-t border-white/[0.04] flex items-center justify-between">
<span class="text-[9px] text-neutral-600">Consensus</span>
<span class="text-[9px] metric text-neutral-500">min 1 confirm / 10s window</span>
</div>
</div>
</div>
</section>
<!-- === SECTION 7: ALERTS + THRESHOLDS === -->
<section id="sec-network" class="px-6 pb-5 scroll-mt-16">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-5">
<!-- Alert Feed (takes 2 columns) -->
<div class="lg:col-span-2 glass rounded-2xl overflow-hidden">
<div class="px-5 py-3 border-b border-white/[0.04] flex items-center justify-between">
<div class="flex items-center gap-2">
<iconify-icon icon="solar:danger-triangle-linear" width="16" class="text-red-400/60"></iconify-icon>
<span class="text-xs font-medium text-neutral-200">Alert Feed</span>
</div>
<span id="alert-total" class="text-[9px] metric text-red-400/40">7 alerts</span>
</div>
<div id="alert-feed" class="p-3 space-y-2 max-h-[400px] overflow-y-auto">
</div>
</div>
<!-- Thresholds -->
<div class="glass rounded-2xl p-5">
<div class="flex items-center gap-2 mb-5">
<iconify-icon icon="solar:tuning-2-linear" width="16" class="text-neutral-500"></iconify-icon>
<span class="text-[10px] uppercase tracking-widest text-neutral-500">Alert Thresholds</span>
</div>
<div class="space-y-4">
<div class="flex items-center gap-3">
<div class="w-1.5 h-8 rounded-full bg-gradient-to-b from-green-500/70 to-green-500/20"></div>
<div class="flex-1">
<span class="text-xs text-green-400 font-medium block">Low</span>
<span class="text-[9px] text-neutral-600">Local emit only</span>
</div>
<span class="text-sm metric text-green-400/60">P ≥ 0.30</span>
</div>
<div class="flex items-center gap-3">
<div class="w-1.5 h-8 rounded-full bg-gradient-to-b from-amber-500/70 to-amber-500/20"></div>
<div class="flex-1">
<span class="text-xs text-amber-400 font-medium block">Medium</span>
<span class="text-[9px] text-neutral-600">Local emit only</span>
</div>
<span class="text-sm metric text-amber-400/60">P ≥ 0.50</span>
</div>
<div class="flex items-center gap-3">
<div class="w-1.5 h-8 rounded-full bg-gradient-to-b from-orange-500/70 to-orange-500/20"></div>
<div class="flex-1">
<span class="text-xs text-orange-400 font-medium block">High</span>
<span class="text-[9px] text-neutral-600">Deferred for consensus</span>
</div>
<span class="text-sm metric text-orange-400/60">P ≥ 0.70</span>
</div>
<div class="flex items-center gap-3">
<div class="w-1.5 h-8 rounded-full bg-gradient-to-b from-red-500/70 to-red-500/20"></div>
<div class="flex-1">
<span class="text-xs text-red-400 font-medium block">Critical</span>
<span class="text-[9px] text-neutral-600">Deferred for consensus</span>
</div>
<span class="text-sm metric text-red-400/60">P ≥ 0.90</span>
</div>
</div>
<div class="mt-5 pt-3 border-t border-white/[0.04]">
<span class="text-[9px] text-neutral-600 block mb-1">Cooldown: 30s same-or-higher level</span>
<span class="text-[9px] text-neutral-600">Override: new mag ≥ prev + 0.5</span>
</div>
</div>
</div>
</section>
<!-- === FOOTER === -->
<footer class="px-6 py-4 border-t border-white/[0.03] flex items-center justify-between">
<div class="flex items-center gap-3">
<span class="text-[9px] metric text-neutral-700">LAT 34.0522 LON -118.2437</span>
<span class="text-[9px] text-neutral-800">|</span>
<span id="footer-clock" class="text-[9px] metric text-neutral-700"></span>
</div>
<div class="flex items-center gap-4">
<span class="text-[9px] metric text-neutral-700">RUST 1.75+ | HNSW M=16 ef=64 | 256-DIM</span>
<span class="text-[9px] text-neutral-800">|</span>
<span class="text-[9px] metric text-cyan-500/25">QUAKEVECTOR v0.1.0</span>
</div>
</footer>
</div>
<!-- ====== THREE.JS (renders into the globe section canvas) ====== -->
<script type="module">
import * as THREE from 'three';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
const C = { bg: 0x030305, pri: 0x22d3ee, sec: 0xff00aa };
const canvas = document.querySelector('#webgl-canvas');
const section = canvas.parentElement;
const scene = new THREE.Scene();
scene.background = new THREE.Color(C.bg);
scene.fog = new THREE.FogExp2(C.bg, 0.018);
const camera = new THREE.PerspectiveCamera(70, section.clientWidth/section.clientHeight, 0.1, 100);
camera.position.z = 7;
const renderer = new THREE.WebGLRenderer({ canvas, antialias: false, powerPreference: "high-performance" });
renderer.setSize(section.clientWidth, section.clientHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.3;
const G = new THREE.Group();
scene.add(G);
const coreGeo = new THREE.IcosahedronGeometry(2.2, 14);
const coreMat = new THREE.MeshPhysicalMaterial({ color:0x000000, metalness:0.95, roughness:0.03, clearcoat:1, clearcoatRoughness:0.03, emissive:C.pri, emissiveIntensity:0.05 });
const core = new THREE.Mesh(coreGeo, coreMat);
G.add(core);
const w1 = new THREE.Mesh(new THREE.IcosahedronGeometry(2.5,2), new THREE.MeshBasicMaterial({ color:C.pri, wireframe:true, transparent:true, opacity:0.1, side:THREE.DoubleSide }));
G.add(w1);
const w2 = new THREE.Mesh(new THREE.IcosahedronGeometry(3.0,1), new THREE.MeshBasicMaterial({ color:C.sec, wireframe:true, transparent:true, opacity:0.04, side:THREE.DoubleSide }));
G.add(w2);
const w3 = new THREE.Mesh(new THREE.IcosahedronGeometry(3.8,1), new THREE.MeshBasicMaterial({ color:0x4488ff, wireframe:true, transparent:true, opacity:0.025, side:THREE.DoubleSide }));
G.add(w3);
const pGeo = new THREE.BufferGeometry();
const pN = 500;
const pP = new Float32Array(pN*3);
for(let i=0;i<pN*3;i++) pP[i]=(Math.random()-0.5)*18;
pGeo.setAttribute('position', new THREE.BufferAttribute(pP,3));
const particles = new THREE.Points(pGeo, new THREE.PointsMaterial({ size:0.02, color:C.pri, transparent:true, opacity:0.5, blending:THREE.AdditiveBlending }));
scene.add(particles);
const eN = 7000, eGeo = new THREE.BufferGeometry();
const eI = new Float32Array(eN*3), eT = new Float32Array(eN*3), eCur = new Float32Array(eN*3);
for(let i=0;i<eN;i++){
const phi=Math.acos(-1+(2*i)/eN), theta=Math.sqrt(eN*Math.PI)*phi, r=2.2;
const x=r*Math.cos(theta)*Math.sin(phi), y=r*Math.sin(theta)*Math.sin(phi), z=r*Math.cos(phi);
eI[i*3]=x; eI[i*3+1]=y; eI[i*3+2]=z; eCur[i*3]=x; eCur[i*3+1]=y; eCur[i*3+2]=z;
const d=new THREE.Vector3(x,y,z).normalize(), dist=2.2+Math.random()*8;
eT[i*3]=d.x*dist; eT[i*3+1]=d.y*dist; eT[i*3+2]=d.z*dist;
}
eGeo.setAttribute('position', new THREE.BufferAttribute(eCur,3));
const eMat = new THREE.PointsMaterial({ size:0.03, color:C.pri, transparent:true, opacity:0, blending:THREE.AdditiveBlending, depthWrite:false });
const eSys = new THREE.Points(eGeo, eMat); eSys.visible=false; G.add(eSys);
scene.add(new THREE.AmbientLight(0xffffff, 0.06));
const l1 = new THREE.PointLight(C.pri, 600); l1.position.set(5,3,5); scene.add(l1);
const l2 = new THREE.PointLight(C.sec, 600); l2.position.set(-5,-3,3); scene.add(l2);
const l3 = new THREE.PointLight(0x4488ff, 300); l3.position.set(0,5,-4); scene.add(l3);
const composer = new EffectComposer(renderer);
composer.addPass(new RenderPass(scene, camera));
const bloom = new UnrealBloomPass(new THREE.Vector2(section.clientWidth,section.clientHeight),1.5,0.4,0.85);
bloom.strength=1.3; bloom.radius=0.7; bloom.threshold=0.08;
composer.addPass(bloom);
let mX=0, mY=0, busy=false;
const anim={p:0};
window.triggerSeismicExplosion = ()=>{
if(busy)return; busy=true;
gsap.to(bloom,{strength:2.8,duration:0.3,yoyo:true,repeat:1});
gsap.to([coreMat,w1.material],{opacity:0,duration:0.12,onComplete:()=>{core.visible=false;w1.visible=false;w2.visible=false;w3.visible=false;}});
eSys.visible=true; gsap.to(eMat,{opacity:1,duration:0.08});
gsap.to(anim,{p:1,duration:1,ease:"power4.out",
onUpdate:()=>{const pos=eGeo.attributes.position.array;for(let i=0;i<eN;i++){const ix=i*3;pos[ix]=eI[ix]+(eT[ix]-eI[ix])*anim.p;pos[ix+1]=eI[ix+1]+(eT[ix+1]-eI[ix+1])*anim.p;pos[ix+2]=eI[ix+2]+(eT[ix+2]-eI[ix+2])*anim.p;if(anim.p>0.01){const a=anim.p*0.7,x=pos[ix],z=pos[ix+2];pos[ix]=x*Math.cos(a)-z*Math.sin(a);pos[ix+2]=x*Math.sin(a)+z*Math.cos(a);}}eGeo.attributes.position.needsUpdate=true;},
onComplete:()=>{gsap.to(anim,{p:0,duration:1.5,delay:0.2,ease:"elastic.out(1,0.5)",
onUpdate:()=>{const pos=eGeo.attributes.position.array;for(let i=0;i<eN;i++){const ix=i*3;pos[ix]=eI[ix]+(eT[ix]-eI[ix])*anim.p;pos[ix+1]=eI[ix+1]+(eT[ix+1]-eI[ix+1])*anim.p;pos[ix+2]=eI[ix+2]+(eT[ix+2]-eI[ix+2])*anim.p;}eGeo.attributes.position.needsUpdate=true;},
onComplete:()=>{core.visible=true;w1.visible=true;w2.visible=true;w3.visible=true;gsap.to(eMat,{opacity:0,duration:0.3});gsap.to([coreMat,w1.material],{opacity:1,duration:0.4});w1.material.opacity=0.1;w2.material.opacity=0.04;w3.material.opacity=0.025;eSys.visible=false;busy=false;}
});}
});
};
window.setCoreGlow=(v)=>{gsap.to(coreMat,{emissiveIntensity:v,duration:0.4});};
window.setCoreColor=(hex)=>{coreMat.emissive.setHex(hex);};
document.addEventListener('mousemove',e=>{mX=e.clientX-innerWidth/2;mY=e.clientY-innerHeight/2;});
const clk=new THREE.Clock();
function loop(){
const t=clk.getElapsedTime();
G.rotation.y+=0.0012; G.rotation.x+=0.0006;
G.rotation.y+=0.025*(mX*0.0008-G.rotation.y);
G.rotation.x+=0.025*(mY*0.0008-G.rotation.x);
if(!busy){const s=1+Math.sin(t*1.8)*0.018;w1.scale.set(s,s,s);w2.rotation.y=t*0.25;w2.rotation.x=t*0.12;w3.rotation.y=-t*0.15;w3.rotation.z=t*0.08;}
l1.position.x=Math.sin(t*0.45)*6;l1.position.y=Math.cos(t*0.35)*5;
l2.position.x=Math.cos(t*0.25)*7;l2.position.z=Math.sin(t*0.35)*6;
l3.position.x=Math.sin(t*0.15)*4;l3.position.z=Math.cos(t*0.25)*5;
particles.rotation.y=t*0.025;particles.rotation.x=-mY*0.0001;
composer.render();requestAnimationFrame(loop);
}
function onResize(){
const w=section.clientWidth, h=section.clientHeight;
camera.aspect=w/h; camera.updateProjectionMatrix();
renderer.setSize(w,h); composer.setSize(w,h);
}
addEventListener('resize', onResize);
onload=()=>{
onResize();
loop();
const tl=gsap.timeline();
tl.to("#loader",{opacity:0,duration:0.5,onComplete:()=>document.getElementById("loader").style.display="none"})
.to("#app",{opacity:1,duration:0.6},"-=0.2")
.from(core.scale,{x:0,y:0,z:0,duration:1.5,ease:"elastic.out(1,0.7)"},"-=0.3")
.from(w1.scale,{x:0,y:0,z:0,duration:1.5,ease:"elastic.out(1,0.7)"},"<")
.from(w2.scale,{x:0,y:0,z:0,duration:1.8,ease:"elastic.out(1,0.6)"},"<0.1")
.from(w3.scale,{x:0,y:0,z:0,duration:2,ease:"elastic.out(1,0.5)"},"<0.15");
};
</script>
<!-- ====== DASHBOARD ENGINE ====== -->
<script>
(function(){
let simTime=0,eventPhase=0,eventIntensity=0,eventTimer=0,nextEvent=70;
let wf1=new Array(400).fill(0),wf2=new Array(400).fill(0);
let probH=[];
let alerts=[];
for(let i=0;i<48;i++){const p=0.04+Math.random()*0.1+(i>36?Math.sin((i-36)*0.5)*0.15:0);probH.push(Math.max(0.01,Math.min(1,p)));}
const now=Date.now();
[{l:'low',p:0.35},{l:'medium',p:0.57},{l:'low',p:0.33},{l:'high',p:0.74},{l:'medium',p:0.55},{l:'critical',p:0.93},{l:'low',p:0.38}].forEach((a,i)=>{
alerts.push({level:a.l,probability:a.p,magnitude:1.5+Math.random()*5,ttp:2+Math.random()*10,consensus:a.l==='critical'?2:a.l==='high'?1:0,time:now-(7-i)*180000});
});
function tick(){
simTime++; nextEvent--;
if(eventPhase===0&&nextEvent<=0){eventPhase=1;eventTimer=0;}
if(eventPhase===1){eventIntensity=Math.min(1,eventIntensity+0.012+Math.random()*0.018);eventTimer++;if(eventTimer>45+Math.random()*25){eventPhase=2;eventTimer=0;}}
if(eventPhase===2){eventTimer++;eventIntensity=0.85+Math.sin(eventTimer*0.3)*0.15;if(eventTimer>18){eventPhase=3;eventTimer=0;}}
if(eventPhase===3){eventIntensity*=0.96;if(eventIntensity<0.015){eventIntensity=0;eventPhase=0;nextEvent=50+Math.floor(Math.random()*120);}}
if(eventPhase===2&&eventTimer===1&&window.triggerSeismicExplosion)window.triggerSeismicExplosion();
if(window.setCoreGlow)window.setCoreGlow(0.05+eventIntensity*0.5);
if(window.setCoreColor){if(eventIntensity>0.8)window.setCoreColor(0xff4444);else if(eventIntensity>0.5)window.setCoreColor(0xffaa00);else window.setCoreColor(0x22d3ee);}
const n=()=>(Math.random()-0.5)*0.05;
for(let i=0;i<4;i++){
const t=Date.now()/1000;
wf1.shift();wf1.push(n()+Math.sin(t*18+i)*0.25*eventIntensity+Math.sin(t*10+i*1.3)*0.45*eventIntensity*Math.max(0,eventIntensity-0.25)+Math.sin(t*4+i*2)*0.6*Math.max(0,eventIntensity-0.55));
wf2.shift();wf2.push(n()*0.7+Math.sin(t*14+i*0.9)*0.2*eventIntensity+Math.sin(t*8+i*1.1)*0.3*eventIntensity*Math.max(0,eventIntensity-0.3));
}
const prob=Math.max(0.01,Math.min(0.99,0.04+eventIntensity*0.88+(Math.random()-0.5)*0.04));
probH.push(prob);if(probH.length>80)probH.shift();
if(eventIntensity>0.3&&Math.random()<0.05){
let lvl='low';if(prob>=0.9)lvl='critical';else if(prob>=0.7)lvl='high';else if(prob>=0.5)lvl='medium';
alerts.push({level:lvl,probability:prob,magnitude:1.5+eventIntensity*5.5+(Math.random()-0.5)*0.4,ttp:Math.max(0.1,(1-eventIntensity)*12+Math.random()*2),consensus:prob>=0.7?Math.floor(Math.random()*3):0,time:Date.now()});
if(alerts.length>30)alerts.shift();
}
drawWF('waveform-1',wf1,'#22d3ee',eventIntensity);
drawWF('waveform-2',wf2,'#a855f7',eventIntensity*0.6);
drawProb();
updateGauge(prob);
updateStatus();
updateAlerts();
updateFooter();
}
function drawWF(id,data,color,intensity){
const c=document.getElementById(id);if(!c)return;
const ctx=c.getContext('2d');const r=c.parentElement.getBoundingClientRect();
c.width=r.width*2;c.height=r.height*2;ctx.scale(2,2);
const w=r.width,h=r.height,mid=h/2,amp=h*0.42;
ctx.clearRect(0,0,w,h);
ctx.strokeStyle='rgba(34,211,238,0.025)';ctx.lineWidth=0.5;
for(let y=0;y<h;y+=14){ctx.beginPath();ctx.moveTo(0,y);ctx.lineTo(w,y);ctx.stroke();}
for(let x=0;x<w;x+=40){ctx.beginPath();ctx.moveTo(x,0);ctx.lineTo(x,h);ctx.stroke();}
ctx.strokeStyle='rgba(255,255,255,0.03)';ctx.lineWidth=0.5;
ctx.beginPath();ctx.moveTo(0,mid);ctx.lineTo(w,mid);ctx.stroke();
const step=w/(data.length-1);
ctx.shadowColor=color;ctx.shadowBlur=10+intensity*25;
ctx.strokeStyle=color+'88';ctx.lineWidth=1.5;ctx.beginPath();
for(let i=0;i<data.length;i++){const x=i*step,y=mid-data[i]*amp;i===0?ctx.moveTo(x,y):ctx.lineTo(x,y);}ctx.stroke();
ctx.shadowBlur=0;ctx.strokeStyle=color;ctx.lineWidth=0.8;ctx.beginPath();
for(let i=0;i<data.length;i++){const x=i*step,y=mid-data[i]*amp;i===0?ctx.moveTo(x,y):ctx.lineTo(x,y);}ctx.stroke();
ctx.beginPath();ctx.moveTo(0,mid);
for(let i=0;i<data.length;i++)ctx.lineTo(i*step,mid-data[i]*amp);
ctx.lineTo(w,mid);ctx.closePath();ctx.fillStyle=color+'0a';ctx.fill();
}
function drawProb(){
const c=document.getElementById('prob-chart');if(!c)return;
const ctx=c.getContext('2d');const r=c.parentElement.getBoundingClientRect();
c.width=r.width*2;c.height=r.height*2;ctx.scale(2,2);
const w=r.width,h=r.height;ctx.clearRect(0,0,w,h);
if(probH.length<2)return;const step=w/(probH.length-1);
ctx.fillStyle='rgba(239,68,68,0.03)';ctx.fillRect(0,0,w,h*0.1);
ctx.fillStyle='rgba(249,115,22,0.02)';ctx.fillRect(0,h*0.1,w,h*0.2);
ctx.beginPath();ctx.moveTo(0,h);
for(let i=0;i<probH.length;i++)ctx.lineTo(i*step,h-probH[i]*h);
ctx.lineTo(w,h);ctx.closePath();
const g=ctx.createLinearGradient(0,0,0,h);g.addColorStop(0,'rgba(34,211,238,0.15)');g.addColorStop(1,'rgba(34,211,238,0)');
ctx.fillStyle=g;ctx.fill();
ctx.shadowColor='#22d3ee';ctx.shadowBlur=6;ctx.strokeStyle='rgba(34,211,238,0.85)';ctx.lineWidth=1.2;ctx.beginPath();
for(let i=0;i<probH.length;i++){const x=i*step,y=h-probH[i]*h;i===0?ctx.moveTo(x,y):ctx.lineTo(x,y);}ctx.stroke();ctx.shadowBlur=0;
const lx=(probH.length-1)*step,ly=h-probH[probH.length-1]*h;
ctx.beginPath();ctx.arc(lx,ly,2.5,0,Math.PI*2);ctx.fillStyle='#22d3ee';ctx.fill();
ctx.beginPath();ctx.arc(lx,ly,6,0,Math.PI*2);ctx.fillStyle='rgba(34,211,238,0.1)';ctx.fill();
}
function updateGauge(prob){
const p=Math.max(0,Math.min(1,prob));
document.getElementById('gauge-ring').style.strokeDashoffset=301-(301*p);
document.getElementById('gauge-val').textContent=p.toFixed(2);
let color,label;
if(p>=0.9){color='#ef4444';label='CRITICAL';}else if(p>=0.7){color='#f97316';label='HIGH';}else if(p>=0.5){color='#f59e0b';label='MEDIUM';}else if(p>=0.3){color='#22c55e';label='LOW';}else{color='#22c55e';label='NONE';}
document.getElementById('gauge-ring').style.stroke=color;
document.getElementById('gauge-val').style.color=color;
const b=document.getElementById('threat-badge');b.textContent=label;b.style.color=color;b.style.borderColor=color+'25';b.style.backgroundColor=color+'12';
document.getElementById('threat-panel').className=p>=0.9?'glass-alert rounded-2xl p-6 alert-active':'glass-bright rounded-2xl p-6 border-pulse';
const mag=1.5+eventIntensity*5.5;const magEl=document.getElementById('val-mag');
magEl.textContent=mag.toFixed(1);magEl.style.color=mag>=6?'#ef4444':mag>=4?'#f59e0b':'#ffffff';
document.getElementById('val-ttp').textContent=Math.max(0.1,(1-eventIntensity)*12).toFixed(1)+'s';
document.getElementById('val-latency').textContent=(120+Math.floor(Math.random()*80))+'us';
document.getElementById('pred-count').textContent=probH.length+' predictions';
document.getElementById('val-conf').textContent=Math.round((0.6+eventIntensity*0.35)*100)+'%';
document.getElementById('val-waves').textContent=Math.max(1,Math.floor(eventIntensity*8))+' IDs';
// Hero overlay
const heroProb=document.getElementById('val-prob-hero');heroProb.textContent=p.toFixed(2);heroProb.style.color=color;
document.getElementById('val-prob-label').textContent=label;
}
function updateStatus(){
const d=document.getElementById('sys-dot'),s=document.getElementById('sys-status');
const hd=document.getElementById('hero-dot'),hs=document.getElementById('hero-status');
if(eventIntensity>0.8){
d.className='w-2 h-2 rounded-full bg-red-500 shadow-[0_0_10px_rgba(239,68,68,0.6)]';s.textContent='EVENT DETECTED';s.className='text-[10px] uppercase tracking-[0.1em] text-red-400 font-medium glitch-target';
hd.className='w-2 h-2 rounded-full bg-red-500 shadow-[0_0_10px_rgba(239,68,68,0.6)]';hs.textContent='SEISMIC EVENT DETECTED';hs.className='text-[10px] uppercase tracking-[0.15em] text-red-400 metric glitch-target';
}else if(eventIntensity>0.4){
d.className='w-2 h-2 rounded-full bg-amber-500 shadow-[0_0_10px_rgba(245,158,11,0.6)]';s.textContent='Elevated';s.className='text-[10px] uppercase tracking-[0.1em] text-amber-400 font-medium glitch-target';
hd.className='w-2 h-2 rounded-full bg-amber-500 shadow-[0_0_10px_rgba(245,158,11,0.6)]';hs.textContent='Elevated Seismic Activity';hs.className='text-[10px] uppercase tracking-[0.15em] text-amber-400 metric glitch-target';
}else{
d.className='w-2 h-2 rounded-full bg-cyan-500 shadow-[0_0_8px_rgba(6,182,212,0.5)]';s.textContent='Operational';s.className='text-[10px] uppercase tracking-[0.1em] text-cyan-400 font-medium glitch-target';
hd.className='w-2 h-2 rounded-full bg-cyan-500 shadow-[0_0_8px_rgba(6,182,212,0.5)]';hs.textContent='System Operational';hs.className='text-[10px] uppercase tracking-[0.15em] text-cyan-400 metric glitch-target';
}
const sec=16337+Math.floor(simTime/10);
document.getElementById('val-uptime').textContent=[Math.floor(sec/3600),Math.floor((sec%3600)/60),sec%60].map(v=>String(v).padStart(2,'0')).join(':');
const ram=0.42+eventIntensity*0.2+Math.sin(simTime*0.005)*0.03;const rp=Math.round(ram*100);
document.getElementById('val-ram').textContent=rp+'%';document.getElementById('bar-ram').style.width=rp+'%';
document.getElementById('bar-ram').className='h-full rounded-full transition-all duration-700 shadow-[0_0_8px_'+(rp>85?'rgba(239,68,68,0.3)] bg-gradient-to-r from-red-500 to-red-400':'rgba(34,211,238,0.3)] bg-gradient-to-r from-cyan-500 to-cyan-400');
const nodes=12847+Math.floor(simTime/2);document.getElementById('val-nodes').textContent=nodes.toLocaleString();
const np=Math.min(95,64+simTime*0.01);document.getElementById('bar-nodes').style.width=np+'%';document.getElementById('bar-nodes-pct').textContent=Math.round(np)+'%';
const inf=31+eventIntensity*45;document.getElementById('val-inf-load').textContent=Math.round(inf)+'%';document.getElementById('bar-inf').style.width=Math.round(inf)+'%';
const dEl=document.getElementById('val-degrad');
if(ram>0.9){dEl.textContent='CRITICAL';dEl.className='text-lg font-bold metric text-red-400';}
else if(ram>0.8){dEl.textContent='WARNING';dEl.className='text-lg font-bold metric text-amber-400';}
else{dEl.textContent='NORMAL';dEl.className='text-lg font-bold metric text-green-400';}
}
const aC={low:{bg:'rgba(34,197,94,0.04)',border:'rgba(34,197,94,0.1)',text:'#4ade80',dot:'#22c55e'},medium:{bg:'rgba(245,158,11,0.04)',border:'rgba(245,158,11,0.1)',text:'#fbbf24',dot:'#f59e0b'},high:{bg:'rgba(249,115,22,0.04)',border:'rgba(249,115,22,0.12)',text:'#fb923c',dot:'#f97316'},critical:{bg:'rgba(239,68,68,0.06)',border:'rgba(239,68,68,0.15)',text:'#f87171',dot:'#ef4444'}};
function updateAlerts(){
const el=document.getElementById('alert-feed');
el.innerHTML=alerts.slice().reverse().slice(0,15).map(a=>{
const c=aC[a.level]||aC.low;
const ts=new Date(a.time).toLocaleTimeString('en-US',{hour12:false,hour:'2-digit',minute:'2-digit',second:'2-digit'});
return `<div style="background:${c.bg};border:1px solid ${c.border}" class="alert-card rounded-lg px-4 py-3">
<div class="flex items-center justify-between mb-1.5">
<div class="flex items-center gap-2">
<div style="background:${c.dot};box-shadow:0 0 6px ${c.dot}50" class="w-2 h-2 rounded-full"></div>
<span style="color:${c.text}" class="text-[10px] font-semibold uppercase tracking-wider">${a.level}</span>
</div>
<span class="text-[9px] metric text-neutral-600">${ts}</span>
</div>
<div class="flex items-center gap-3 text-[9px] metric">
<span class="text-neutral-500">P: <span class="text-neutral-300">${a.probability.toFixed(3)}</span></span>
<span class="text-neutral-500">M: <span class="text-neutral-300">${a.magnitude.toFixed(1)}</span></span>
<span class="text-neutral-500">TTP: <span class="text-neutral-300">${a.ttp.toFixed(1)}s</span></span>
${a.consensus>0?`<span style="color:${c.text}" class="opacity-50">${a.consensus} sta confirmed</span>`:''}
</div>
</div>`;
}).join('');
document.getElementById('alert-total').textContent=alerts.length+' alerts';
}
function updateFooter(){
document.getElementById('footer-clock').textContent=new Date().toISOString().replace('T',' ').slice(0,19)+' UTC';
document.getElementById('wf-timestamp').textContent=new Date().toISOString().slice(11,23);
}
updateAlerts();
setInterval(tick,100);
const gt=document.querySelectorAll('.glitch-target');let lX=0,lY=0,lT=0;
document.addEventListener('mousemove',e=>{const now=Date.now(),dt=now-lT;if(dt>30){const dx=e.clientX-lX,dy=e.clientY-lY,s=Math.sqrt(dx*dx+dy*dy)/dt;if(s>2.5)gt.forEach(el=>{if(!el.classList.contains('glitch-active')){el.classList.add('glitch-active');setTimeout(()=>el.classList.remove('glitch-active'),250);}});lX=e.clientX;lY=e.clientY;lT=now;}});
// === NAV TAB CLICK + SCROLL HIGHLIGHT ===
const navTabs = document.querySelectorAll('.nav-tab');
const sections = ['sec-dashboard','sec-embeddings','sec-hnsw','sec-network'].map(id => document.getElementById(id)).filter(Boolean);
navTabs.forEach(tab => {
tab.addEventListener('click', () => {
const target = document.getElementById(tab.dataset.target);
if (target) {
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
setActiveTab(tab);
}
});
});
function setActiveTab(activeTab) {
navTabs.forEach(t => t.classList.remove('active'));
activeTab.classList.add('active');
}
// Highlight active tab on scroll
let scrollTimer;
window.addEventListener('scroll', () => {
clearTimeout(scrollTimer);
scrollTimer = setTimeout(() => {
const scrollY = window.scrollY + 100;
let current = null;
sections.forEach(sec => {
if (sec.offsetTop <= scrollY) current = sec;
});
if (current) {
navTabs.forEach(t => {
if (t.dataset.target === current.id) setActiveTab(t);
});
}
}, 50);
});
})();
</script>
</body></html>