File size: 30,063 Bytes
f8656e1 | 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 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Crect width='32' height='32' rx='4' fill='%23051424'/%3E%3Cpath d='M16 6C13 11 11 16 11 16C11 16 13 21 16 26C19 21 21 16 21 16C21 16 19 11 16 6Z' stroke='%233b82f6' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='16' cy='16' r='2.5' fill='%233b82f6'/%3E%3C/svg%3E">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OCULUS</title>
<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=Alfa+Slab+One&family=Stardos+Stencil:wght@400;700&family=PT+Serif+Caption&family=Abril+Fatface&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
<script src="https://unpkg.com/globe.gl@2.27.3/dist/globe.gl.min.js"></script>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--void: #030712;
--deep: #060d1f;
--navy: #0a1628;
--blue-dim: #0e2044;
--accent: #3b82f6;
--accent-bright: #60a5fa;
--accent-glow: #1d4ed8;
--text-primary: #f0f6ff;
--text-secondary: #8ba3c7;
--text-muted: #3d5a80;
--green: #10b981;
--yellow: #f59e0b;
--red: #ef4444;
--glass-bg: rgba(10, 22, 40, 0.72);
--glass-border: rgba(59, 130, 246, 0.18);
--font-display: 'Stardos Stencil', monospace;
--font-body: 'PT Serif Caption', serif;
--font-mono: 'Stardos Stencil', monospace;
}
.abril-fatface-regular {
font-family: "Abril Fatface", serif;
font-weight: 400;
font-style: normal;
}
html { scroll-behavior: auto; }
body {
background: var(--void);
color: var(--text-primary);
font-family: var(--font-body);
overflow-x: hidden;
cursor: default;
}
/* βββ STARS CANVAS (background layer, always visible) βββ */
#stars-canvas {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
z-index: 0;
pointer-events: none;
}
/* βββ GLOBE WRAPPER βββ */
#globe-wrapper {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
z-index: 3;
pointer-events: none;
opacity: 0.2;
transition: opacity 0.3s ease;
}
body.globe-active #globe-wrapper {
pointer-events: auto;
}
#globe-wrapper > div,
#globe-wrapper canvas {
width: 100% !important;
height: 100% !important;
background: transparent !important;
}
/* βββ SCROLL CONTAINER βββ */
#scroll-container {
position: relative;
z-index: 10;
pointer-events: none; /* Let clicks pass through to the globe */
}
#hero, #stats-strip {
pointer-events: auto; /* Keep text and UI elements interactive */
}
/* βββ HERO βββ */
#hero {
position: relative;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
padding: 0 24px;
}
.hero-eyebrow {
font-family: var(--font-mono);
font-size: 11px;
letter-spacing: 0.35em;
text-transform: uppercase;
color: var(--accent-bright);
opacity: 0;
transform: translateY(12px);
margin-bottom: 24px;
}
.hero-title {
font-family: "Abril Fatface", serif;
font-size: clamp(72px, 12vw, 148px);
font-weight: 400;
letter-spacing: -0.03em;
line-height: 0.92;
opacity: 0;
transform: translateY(20px);
margin-bottom: 28px;
background: linear-gradient(160deg, #f0f6ff 30%, #60a5fa 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.hero-tagline {
font-family: var(--font-display);
font-size: clamp(16px, 2vw, 20px);
font-weight: 300;
color: var(--text-secondary);
letter-spacing: 0.01em;
max-width: 480px;
opacity: 0;
transform: translateY(14px);
margin-bottom: 14px;
}
.hero-desc {
font-size: 13px;
color: var(--text-muted);
max-width: 360px;
line-height: 1.7;
letter-spacing: 0.02em;
opacity: 0;
transform: translateY(10px);
}
.scroll-indicator {
position: absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
opacity: 0;
}
.scroll-indicator span {
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.25em;
color: var(--text-muted);
text-transform: uppercase;
}
.scroll-line {
width: 1px;
height: 40px;
background: linear-gradient(to bottom, var(--accent), transparent);
animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
0%, 100% { opacity: 0.3; transform: scaleY(1); }
50% { opacity: 1; transform: scaleY(1.15); }
}
/* βββ SPACER βββ */
#spacer {
height: 150vh;
pointer-events: none;
}
/* βββ GLOBE SECTION βββ */
#globe-section {
position: relative;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
/* βββ STATS STRIP βββ */
#stats-strip {
position: relative;
z-index: 20;
display: flex;
align-items: center;
justify-content: center;
gap: 48px;
padding: 18px 40px;
background: rgba(6, 13, 31, 0.6);
border-top: 1px solid var(--glass-border);
border-bottom: 1px solid var(--glass-border);
backdrop-filter: blur(12px);
opacity: 0;
transform: translateY(10px);
}
.stat-item {
display: flex;
align-items: center;
gap: 8px;
font-family: var(--font-mono);
font-size: 11px;
color: var(--text-muted);
letter-spacing: 0.1em;
}
.stat-dot {
width: 6px; height: 6px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 6px var(--green);
animation: statPulse 2s ease-in-out infinite;
}
@keyframes statPulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.stat-item span.val { color: var(--text-secondary); }
/* βββ LEGEND βββ */
#legend {
position: fixed;
bottom: 40px;
left: 40px;
z-index: 100;
display: flex;
flex-direction: column;
gap: 10px;
opacity: 0;
transition: opacity 0.4s ease;
pointer-events: none;
}
#legend.visible { opacity: 1; }
.legend-item {
display: flex;
align-items: center;
gap: 10px;
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.15em;
color: var(--text-secondary);
text-transform: uppercase;
}
.legend-dot {
width: 8px; height: 8px;
border-radius: 50%;
flex-shrink: 0;
}
.legend-dot.high { background: var(--red); box-shadow: 0 0 8px var(--red); }
.legend-dot.med { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.legend-dot.low { background: var(--green); box-shadow: 0 0 8px var(--green); }
/* βββ FILTER PILLS βββ */
#filters {
position: fixed;
top: 32px;
right: 40px;
z-index: 100;
display: flex;
gap: 8px;
opacity: 0;
transition: opacity 0.4s ease;
}
#filters.visible { opacity: 1; }
.filter-pill {
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.12em;
text-transform: uppercase;
padding: 6px 14px;
border-radius: 20px;
border: 1px solid var(--glass-border);
background: rgba(10, 22, 40, 0.6);
color: var(--text-secondary);
cursor: pointer;
backdrop-filter: blur(8px);
transition: all 0.2s ease;
}
.filter-pill:hover,
.filter-pill.active {
border-color: var(--accent);
color: var(--accent-bright);
background: rgba(59, 130, 246, 0.1);
}
/* βββ INCIDENT PANEL βββ */
#incident-panel {
position: fixed;
top: 50%;
right: -420px;
transform: translateY(-50%);
width: 380px;
max-height: 90vh;
overflow-y: auto;
z-index: 200;
background: var(--glass-bg);
border: 1px solid var(--glass-border);
border-radius: 16px;
backdrop-filter: blur(24px);
-webkit-backdrop-filter: blur(24px);
padding: 28px;
transition: right 0.45s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: 0 24px 64px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}
#incident-panel.open { right: 32px; }
.panel-close {
position: absolute;
top: 16px; right: 16px;
width: 28px; height: 28px;
border-radius: 50%;
background: rgba(255,255,255,0.06);
border: 1px solid var(--glass-border);
color: var(--text-secondary);
cursor: pointer;
display: flex; align-items: center; justify-content: center;
font-size: 14px;
transition: all 0.2s ease;
}
.panel-close:hover { background: rgba(239,68,68,0.15); color: var(--red); }
.panel-sector {
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.2em;
text-transform: uppercase;
color: var(--accent-bright);
margin-bottom: 12px;
}
.panel-title {
font-family: var(--font-display);
font-size: 18px;
font-weight: 600;
color: var(--text-primary);
line-height: 1.35;
margin-bottom: 20px;
}
.panel-meta {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 18px;
}
.meta-row {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
}
.meta-label {
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--text-muted);
}
.meta-value {
color: var(--text-secondary);
font-weight: 500;
}
.threat-badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 3px 10px;
border-radius: 20px;
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.1em;
text-transform: uppercase;
font-weight: 700;
}
.threat-badge.high { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.threat-badge.medium { background: rgba(245,158,11,0.12); color: var(--yellow); border: 1px solid rgba(245,158,11,0.3); }
.threat-badge.low { background: rgba(16,185,129,0.12); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.panel-divider {
height: 1px;
background: var(--glass-border);
margin: 18px 0;
}
.panel-summary {
font-size: 13px;
line-height: 1.7;
color: var(--text-secondary);
margin-bottom: 24px;
max-height: 200px;
overflow-y: auto;
}
.panel-actions { display: flex; gap: 10px; }
.btn-primary {
flex: 1;
padding: 11px;
background: var(--accent);
color: #fff;
border: none;
border-radius: 8px;
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.15em;
text-transform: uppercase;
cursor: pointer;
transition: all 0.2s ease;
font-weight: 700;
}
.btn-primary:hover { background: var(--accent-bright); transform: translateY(-1px); }
.btn-secondary {
padding: 11px 18px;
background: transparent;
color: var(--accent-bright);
border: 1px solid var(--glass-border);
border-radius: 8px;
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.15em;
text-transform: uppercase;
cursor: pointer;
transition: all 0.2s ease;
font-weight: 700;
}
.btn-secondary:hover { border-color: var(--accent); background: rgba(59,130,246,0.08); }
/* βββ TOOLTIP βββ */
#tooltip {
position: fixed;
z-index: 150;
pointer-events: none;
background: var(--glass-bg);
border: 1px solid var(--glass-border);
border-radius: 8px;
padding: 10px 14px;
backdrop-filter: blur(16px);
opacity: 0;
transform: translateY(4px);
transition: opacity 0.15s ease, transform 0.15s ease;
max-width: 220px;
}
#tooltip.visible { opacity: 1; transform: translateY(0); }
.tooltip-title {
font-family: var(--font-display);
font-size: 12px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 4px;
}
.tooltip-loc {
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-muted);
letter-spacing: 0.08em;
}
/* βββ NOISE OVERLAY βββ */
.noise {
position: fixed;
inset: 0;
z-index: 1;
pointer-events: none;
opacity: 0.025;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
background-size: 200px 200px;
}
/* βββ VIGNETTE βββ */
.vignette {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
background: radial-gradient(ellipse at center, transparent 40%, rgba(3,7,18,0.7) 100%);
}
/* βββ CURSOR DOT βββ */
#cursor {
position: fixed;
width: 6px; height: 6px;
border-radius: 50%;
background: var(--accent-bright);
pointer-events: none;
z-index: 9999;
transform: translate(-50%, -50%);
transition: width 0.2s, height 0.2s, opacity 0.2s;
mix-blend-mode: screen;
}
#cursor.expand { width: 32px; height: 32px; opacity: 0.4; }
</style>
</head>
<body>
<div class="noise"></div>
<div class="vignette"></div>
<div id="cursor"></div>
<!-- STARS BACKGROUND CANVAS -->
<canvas id="stars-canvas"></canvas>
<!-- GLOBE.GL WRAPPER -->
<div id="globe-wrapper"></div>
<!-- SCROLL CONTENT -->
<div id="scroll-container">
<section id="hero">
<div class="hero-eyebrow">Cyber Intelligence Platform</div>
<h1 class="hero-title">OCULUS</h1>
<p class="hero-tagline">The world, within your sight</p>
<p class="hero-desc">Monitor, analyze, and respond to global cyber incidents across critical infrastructure β before the damage spreads.</p>
<div class="scroll-indicator">
<span>Scroll to explore</span>
<div class="scroll-line"></div>
</div>
</section>
<div id="spacer"></div>
<section id="globe-section"></section>
<div id="stats-strip">
<div class="stat-item">
<div class="stat-dot"></div>
<span class="val">47</span> incidents tracked
</div>
<div class="stat-item">
<div class="stat-dot" style="background:var(--red);box-shadow:0 0 6px var(--red);animation-delay:0.3s"></div>
<span class="val">12</span> high severity
</div>
<div class="stat-item">
<div class="stat-dot" style="background:var(--accent);box-shadow:0 0 6px var(--accent);animation-delay:0.6s"></div>
Live Β· Updated recently
</div>
</div>
<div style="display:flex;justify-content:center;padding:40px 0 60px;pointer-events:auto;">
<a href="/static/updates.html" style="font-family:var(--font-mono);font-size:11px;letter-spacing:.2em;text-transform:uppercase;padding:14px 36px;border:1px solid var(--glass-border);border-radius:8px;color:var(--accent-bright);background:rgba(10,22,40,0.6);backdrop-filter:blur(12px);text-decoration:none;transition:all .2s;" onmouseover="this.style.borderColor='var(--accent)';this.style.background='rgba(59,130,246,0.1)'" onmouseout="this.style.borderColor='var(--glass-border)';this.style.background='rgba(10,22,40,0.6)'">Explore Real Time Cybersecurity Intel β</a>
</div>
</div>
<!-- LEGEND -->
<div id="legend">
<div class="legend-item"><div class="legend-dot high"></div>High Threat</div>
<div class="legend-item"><div class="legend-dot med"></div>Medium Threat</div>
<div class="legend-item"><div class="legend-dot low"></div>Low Threat</div>
</div>
<!-- FILTERS -->
<div id="filters">
<div class="filter-pill active" data-filter="all">All</div>
<div class="filter-pill" data-filter="aviation">Aviation</div>
<div class="filter-pill" data-filter="power">Power Grid</div>
<div class="filter-pill" data-filter="ot">OT / ICS</div>
<div class="filter-pill" data-filter="maritime">Maritime</div>
</div>
<!-- INCIDENT PANEL -->
<div id="incident-panel">
<button class="panel-close" id="panel-close">β</button>
<div class="panel-sector" id="p-sector">Aviation</div>
<div class="panel-title" id="p-title">Incident Title</div>
<div class="panel-meta">
<div class="meta-row">
<span class="meta-label">Location</span>
<span class="meta-value" id="p-location">β</span>
</div>
<div class="meta-row">
<span class="meta-label">Threat Level</span>
<span id="p-threat"></span>
</div>
<div class="meta-row">
<span class="meta-label">Date</span>
<span class="meta-value" id="p-date">β</span>
</div>
</div>
<div class="panel-divider"></div>
<p class="panel-summary" id="p-summary">Loading incident detailsβ¦</p>
<div class="panel-actions">
<button class="btn-primary" id="btn-analyze-further">Analyze Further</button>
<button class="btn-secondary" id="btn-ask-ai">Ask AI</button>
</div>
</div>
<!-- TOOLTIP -->
<div id="tooltip">
<div class="tooltip-title" id="tt-title"></div>
<div class="tooltip-loc" id="tt-loc"></div>
</div>
<script>
// ββ DATA βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
let INCIDENTS = [];
let ARC_CONNECTIONS = [];
async function loadIncidents() {
try {
const res = await fetch('/api/incidents');
const data = await res.json();
INCIDENTS = data.filter(inc => inc.lat && inc.lon);
// Generate arcs dynamically between high-threat incidents
const high = INCIDENTS.filter(i => i.threat === 'critical' || i.threat === 'high');
ARC_CONNECTIONS = [];
for (let i = 0; i < Math.min(high.length - 1, 8); i++) {
ARC_CONNECTIONS.push({ srcId: high[i].id, dstId: high[i+1].id });
}
if (globeInstance) {
globeInstance.pointsData(buildPoints()).arcsData(buildArcs());
}
// Update stats strip
document.querySelector('.stat-item .val').textContent = INCIDENTS.length;
const highCount = INCIDENTS.filter(i => i.threat === 'critical' || i.threat === 'high').length;
document.querySelectorAll('.stat-item .val')[1].textContent = highCount;
} catch(e) {
console.error('Failed to load incidents:', e);
}
}
const THREAT_COLORS = { critical:'#ef4444', high:'#ef4444', medium:'#f59e0b', low:'#10b981' };
// ββ STARS (Three.js on a dedicated canvas, z-index 0) βββββββββββββββββββββ
(function initStars() {
const canvas = document.getElementById('stars-canvas');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: false, alpha: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x000000, 0);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 2000);
camera.position.z = 1;
const starGeo = new THREE.BufferGeometry();
const count = 2200;
const pos = new Float32Array(count * 3);
for (let i = 0; i < count; i++) {
const theta = Math.random() * Math.PI * 2;
const phi = Math.acos(2 * Math.random() - 1);
const r = 80 + Math.random() * 40;
pos[i*3] = r * Math.sin(phi) * Math.cos(theta);
pos[i*3+1] = r * Math.cos(phi);
pos[i*3+2] = r * Math.sin(phi) * Math.sin(theta);
}
starGeo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
const starMat = new THREE.PointsMaterial({ color: 0x8ba3c7, size: 0.13, sizeAttenuation: true });
const stars = new THREE.Points(starGeo, starMat);
scene.add(stars);
(function loop() {
requestAnimationFrame(loop);
stars.rotation.y += 0.00004;
renderer.render(scene, camera);
})();
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
})();
// ββ GLOBE STATE ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
let globeInstance = null;
let activeFilter = 'all';
let isGlobeActive = false;
function filterMatch(inc, f) {
if (f === 'all') return true;
if (f === 'aviation') return inc.sector === 'Aviation';
if (f === 'power') return inc.sector === 'Power Grid';
if (f === 'ot') return inc.sector === 'OT / ICS';
if (f === 'maritime') return inc.sector === 'Maritime';
return false;
}
function buildPoints() {
return INCIDENTS
.filter(inc => filterMatch(inc, activeFilter))
.map(inc => ({
lat: inc.lat, lng: inc.lon,
size: (inc.threat === 'critical' || inc.threat === 'high') ? 0.55 : inc.threat === 'medium' ? 0.4 : 0.28,
color: THREAT_COLORS[inc.threat],
incident: inc,
}));
}
function buildArcs() {
return ARC_CONNECTIONS.map(a => {
const src = INCIDENTS.find(i => i.id === a.srcId);
const dst = INCIDENTS.find(i => i.id === a.dstId);
if (!src || !dst) return null;
const show = filterMatch(src, activeFilter) || filterMatch(dst, activeFilter);
if (!show) return null;
return {
startLat: src.lat, startLng: src.lon,
endLat: dst.lat, endLng: dst.lon,
color: [THREAT_COLORS[src.threat] + 'cc', THREAT_COLORS[dst.threat] + '22'],
};
}).filter(Boolean);
}
// ββ GLOBE INIT βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
function initGlobe() {
const wrapper = document.getElementById('globe-wrapper');
globeInstance = Globe()(wrapper)
.width(window.innerWidth)
.height(window.innerHeight)
.backgroundColor('rgba(0,0,0,0)')
.globeImageUrl('https://unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
.bumpImageUrl('https://unpkg.com/three-globe/example/img/earth-topology.png')
.atmosphereColor('#2266ff')
.atmosphereAltitude(0.15)
.pointsData(buildPoints())
.pointLat('lat')
.pointLng('lng')
.pointColor('color')
.pointAltitude(0.015)
.pointRadius('size')
.pointResolution(16)
.pointsMerge(false)
.arcsData(buildArcs())
.arcStartLat('startLat').arcStartLng('startLng')
.arcEndLat('endLat').arcEndLng('endLng')
.arcColor('color')
.arcAltitudeAutoScale(0.15)
.arcStroke(0.3)
.arcDashLength(0.4)
.arcDashGap(0.18)
.arcDashAnimateTime(3000)
.hexPolygonsData([])
.onPointClick(pt => {
console.log(pt);
if (pt?.incident) openPanel(pt.incident);
})
.onPointHover(pt => {
const tip = document.getElementById('tooltip');
const cur = document.getElementById('cursor');
if (pt?.incident) {
document.getElementById('tt-title').textContent = pt.incident.title;
document.getElementById('tt-loc').textContent = `${pt.incident.sector} Β· ${pt.incident.threat.toUpperCase()} THREAT`;
tip.classList.add('visible');
cur.classList.add('expand');
wrapper.style.cursor = 'pointer';
} else {
tip.classList.remove('visible');
cur.classList.remove('expand');
wrapper.style.cursor = 'grab';
}
});
// Camera & controls
globeInstance.pointOfView({ altitude: 2.0 });
globeInstance.pointOfView({ altitude: 1.8 });
const ctrl = globeInstance.controls();
ctrl.autoRotate = true;
ctrl.autoRotateSpeed = 0.4;
ctrl.enableDamping = true;
ctrl.dampingFactor = 0.05;
ctrl.enableZoom = false; // Disabled to prevent trapping page scroll
ctrl.minDistance = 120;
ctrl.maxDistance = 550;
// Pause auto-rotate while user drags
ctrl.addEventListener('start', () => { ctrl.autoRotate = false; });
ctrl.addEventListener('end', () => {
// resume only if panel is closed
if (!document.getElementById('incident-panel').classList.contains('open')) {
ctrl.autoRotate = true;
}
});
// Restrict OrbitControls drag to ON THE GLOBE ONLY
wrapper.addEventListener('pointerdown', (e) => {
if (!globeInstance) return;
const mouse = new THREE.Vector2();
mouse.x = (e.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(e.clientY / window.innerHeight) * 2 + 1;
const raycaster = new THREE.Raycaster();
raycaster.setFromCamera(mouse, globeInstance.camera());
// Check if raycast hits any object in the globe scene
const intersects = raycaster.intersectObjects(globeInstance.scene().children, true);
if (intersects.length === 0) {
// Clicked in empty space around the globe -> block OrbitControls
e.stopImmediatePropagation();
}
}, true); // Use capture phase to intercept before OrbitControls
// Resize handler
window.addEventListener('resize', () => {
globeInstance.width(window.innerWidth).height(window.innerHeight);
});
}
// ββ SCROLL βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
window.addEventListener('scroll', () => {
const scrollY = window.scrollY;
const windowH = window.innerHeight;
// Hero fade-out
const heroProgress = Math.min(scrollY / (windowH * 0.6), 1);
document.getElementById('hero').style.opacity = 1 - heroProgress;
// Globe fade-in
const gStart = windowH * 0.1;
const gEnd = windowH * 0.8;
const gp = Math.max(0.2, Math.min((scrollY - gStart) / (gEnd - gStart), 1));
document.getElementById('globe-wrapper').style.opacity = gp;
// Activate interactivity & UI
if (gp > 0.5 && !isGlobeActive) {
isGlobeActive = true;
document.body.classList.add('globe-active');
document.getElementById('legend').classList.add('visible');
document.getElementById('filters').classList.add('visible');
if (globeInstance) globeInstance.controls().autoRotate = true;
} else if (gp <= 0.5 && isGlobeActive) {
isGlobeActive = false;
document.body.classList.remove('globe-active');
document.getElementById('legend').classList.remove('visible');
document.getElementById('filters').classList.remove('visible');
}
});
// ββ TOOLTIP MOUSE TRACKING βββββββββββββββββββββββββββββββββββββββββββββββββ
window.addEventListener('mousemove', e => {
document.getElementById('cursor').style.left = e.clientX + 'px';
document.getElementById('cursor').style.top = e.clientY + 'px';
const tip = document.getElementById('tooltip');
if (tip.classList.contains('visible')) {
tip.style.left = (e.clientX + 18) + 'px';
tip.style.top = (e.clientY - 20) + 'px';
}
});
// ββ PANEL ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
function openPanel(inc) {
document.getElementById('p-sector').textContent = inc.sector;
document.getElementById('p-title').textContent = inc.title;
document.getElementById('p-location').textContent = `${inc.lat.toFixed(1)}Β°, ${inc.lon.toFixed(1)}Β°`;
document.getElementById('p-date').textContent = inc.date;
document.getElementById('p-summary').textContent = inc.summary;
const badge = document.getElementById('p-threat');
badge.className = 'threat-badge ' + inc.threat;
badge.innerHTML = `<span style="width:6px;height:6px;border-radius:50%;background:currentColor;display:inline-block"></span> ${inc.threat.charAt(0).toUpperCase() + inc.threat.slice(1)}`;
document.getElementById('incident-panel').classList.add('open');
if (globeInstance) globeInstance.controls().autoRotate = false;
document.getElementById('btn-analyze-further').onclick = () => {
const q = encodeURIComponent(inc.title + '. ' + inc.summary);
window.location.href = `/static/mittar.html?q=${q}`;
};
document.getElementById('btn-ask-ai').onclick = () => {
const q = encodeURIComponent(inc.title + '. ' + inc.summary);
window.location.href = `/static/chatrag.html?q=${q}`;
};
}
document.getElementById('panel-close').addEventListener('click', () => {
document.getElementById('incident-panel').classList.remove('open');
if (globeInstance) globeInstance.controls().autoRotate = true;
});
// ββ FILTERS ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
document.querySelectorAll('.filter-pill').forEach(pill => {
pill.addEventListener('click', () => {
document.querySelectorAll('.filter-pill').forEach(p => p.classList.remove('active'));
pill.classList.add('active');
activeFilter = pill.dataset.filter;
if (!globeInstance) return;
globeInstance.pointsData(buildPoints()).arcsData(buildArcs());
});
});
// ββ GSAP HERO ENTRANCE βββββββββββββββββββββββββββββββββββββββββββββββββββββ
gsap.registerPlugin(ScrollTrigger);
gsap.timeline({ delay: 0.3 })
.to('.hero-eyebrow', { opacity:1, y:0, duration:0.9, ease:'power3.out' })
.to('.hero-title', { opacity:1, y:0, duration:1.0, ease:'power3.out' }, '-=0.5')
.to('.hero-tagline', { opacity:1, y:0, duration:0.8, ease:'power3.out' }, '-=0.6')
.to('.hero-desc', { opacity:1, y:0, duration:0.7, ease:'power3.out' }, '-=0.5')
.to('.scroll-indicator', { opacity:1, duration:0.8, ease:'power2.out' }, '-=0.2');
gsap.to('#stats-strip', {
scrollTrigger: { trigger:'#stats-strip', start:'top 90%', toggleActions:'play none none reverse' },
opacity:1, y:0, duration:0.8, ease:'power3.out',
});
// ββ BOOT βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
(function waitForGlobe() {
if (typeof Globe !== 'undefined') {
initGlobe();
loadIncidents();
}
else { setTimeout(waitForGlobe, 50); }
})();
</script>
</body>
</html> |