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
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
<!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>News Intel β€” CyberShield</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&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>

<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;
  --text-primary: #f0f6ff;
  --text-secondary: #8ba3c7;
  --text-muted: #3d5a80;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --red-bright: #f87171;
  --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;
}

body {
  background: var(--void);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow: hidden; /* Prevent page vertical scroll */
  cursor: default;
}

#bg-canvas {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
}

.noise {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.028;
  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");
}
.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(3,7,18,0.75) 100%);
}

#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: 28px; height: 28px; opacity: 0.35; }

nav {
  position: relative; z-index: 500; height: 65px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px; background: rgba(3,7,18,0.85);
  border-bottom: 1px solid var(--glass-border); backdrop-filter: blur(16px);
}

@keyframes navPulse { 0%,100%{opacity:1;} 50%{opacity:0.3;} }
.nav-links {
  display: flex; align-items: center; gap: 32px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-muted);
}
.nav-links a { color: inherit; text-decoration: none; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-bright); }

#ticker-bar {
  position: relative; z-index: 20; overflow: hidden;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(6,13,31,0.9); backdrop-filter: blur(16px);
  height: 44px; display: flex; align-items: center;
}
.ticker-label {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--red-bright);
  padding: 0 20px 0 32px; border-right: 1px solid var(--glass-border);
  height: 100%; display: flex; align-items: center; gap: 8px;
  background: rgba(239,68,68,0.1); white-space: nowrap; font-weight: 700;
}
.ticker-label-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--red-bright);
  box-shadow: 0 0 6px var(--red-bright); animation: navPulse 1.5s infinite;
}
.ticker-track-wrap { flex: 1; overflow: hidden; }
.ticker-track {
  display: flex; align-items: center; white-space: nowrap; animation: tickerScroll 55s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes tickerScroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.ticker-item {
  display: inline-flex; align-items: center; gap: 10px; padding: 0 36px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  letter-spacing: 0.08em; border-right: 1px solid rgba(59,130,246,0.08); cursor: default;
}
.ticker-threat {
  font-size: 9px; letter-spacing: 0.15em; font-weight: 700; padding: 2px 7px; border-radius: 3px; text-transform: uppercase;
}
.ticker-threat.high   { color: var(--red);    background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.25); }
.ticker-threat.medium { color: var(--yellow); background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.25); }
.threat-pip.low    { color: var(--green);  background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.25); }

#page { position: relative; z-index: 10; display: flex; flex-direction: column; height: calc(100vh - 65px - 44px); }

#filter-bar {
  display: flex; align-items: center; gap: 16px; padding: 24px 80px;
  border-bottom: 1px solid rgba(59,130,246,0.08); overflow-x: auto; flex-shrink: 0;
}
.filter-label {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--text-muted); margin-right: 16px;
}
.filter-btn {
  background: rgba(10,22,40,0.5); border: 1px solid var(--glass-border);
  color: var(--text-muted); padding: 8px 20px; border-radius: 20px;
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; cursor: pointer; transition: all 0.3s ease;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent-bright); }
.filter-btn.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff; box-shadow: 0 0 16px rgba(59,130,246,0.3);
}

#horizontal-track {
  flex: 1; display: flex; gap: 40px; padding: 40px 80px;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity;
  scroll-padding: 0 80px; align-items: center;
  /* Custom scrollbar */
  scrollbar-width: thin; scrollbar-color: var(--accent) rgba(0,0,0,0.2);
}
#horizontal-track::-webkit-scrollbar { height: 8px; }
#horizontal-track::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
#horizontal-track::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

.intel-card {
  flex: 0 0 480px; height: 100%; max-height: 550px; min-height: 400px;
  scroll-snap-align: start; padding: 48px;
  background: rgba(6,13,31,0.6); backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border); border-radius: 12px;
  display: flex; flex-direction: column; cursor: pointer;
  transition: transform 0.3s, background 0.3s, border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden; /* Required to contain the laser lines */
}
.intel-card:hover {
  background: rgba(8, 16, 32, 0.9); 
  border-color: rgba(59,130,246,0.4); 
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* 1. Left Border Tracing Line (Goes UP) */
.intel-card::before {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 2px; height: 0%;
  background: var(--accent-bright);
  box-shadow: 0 0 12px var(--accent-bright);
  transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.25s; /* Delay on un-hover */
  z-index: 2;
}

/* 2. Top Border Tracing Line (Goes RIGHT) */
.intel-card::after {
  content: ''; position: absolute; top: 0; left: 0;
  width: 0%; height: 2px;
  background: var(--accent-bright);
  box-shadow: 0 0 12px var(--accent-bright);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0s; /* No delay on un-hover */
  z-index: 2;
}

/* Sequential L-Shape drawing on hover */
.intel-card:hover::before { 
  height: 100%;
  transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0s; /* Starts immediately */
}
.intel-card:hover::after { 
  width: 100%;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.25s; /* Starts exactly when left line finishes */
}

/* Ensure text remains above the lines */
.intel-card > * { 
  position: relative; z-index: 1; 
}

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.card-sector { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); }
.threat-pip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; font-weight: 700; padding: 4px 10px; border-radius: 4px; }
.threat-pip.high { color: var(--red); background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); }
.threat-pip.medium { color: var(--yellow); background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); }
.threat-pip.low { color: var(--green); background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); }
.threat-pip.advisory { color: var(--accent-bright); background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); }

.card-headline {
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  letter-spacing: 0; color: var(--text-primary); margin-bottom: 16px; line-height: 1.25;
}
.card-summary {
  font-size: 15px; line-height: 1.6; color: var(--text-secondary);
  font-weight: 300; margin-bottom: 32px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden;}

.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 24px; border-top: 1px solid rgba(59,130,246,0.08); }
.card-time { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text-muted); }
.card-actions { display: flex; gap: 8px; }

.btn-sm-primary {
  padding: 9px 18px; background: var(--accent); color: #fff; border: none;
  border-radius: 6px; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.15em; text-transform: uppercase; cursor: pointer; font-weight: 700; transition: all 0.2s;
}
.btn-sm-primary:hover { background: var(--accent-bright); }

@media (max-width: 768px) {
  nav { padding: 0 24px; }
  .nav-links { display: none; }
  #filter-bar { padding: 16px 24px; }
  #horizontal-track { padding: 24px; scroll-padding: 0 24px; gap: 24px; }
  .intel-card { flex: 0 0 85vw; padding: 32px; min-height: 450px; }
  .card-headline { font-size: 20px; }
}
</style>
</head>
<body>

<div class="noise"></div>
<div class="vignette"></div>
<div id="cursor"></div>
<canvas id="bg-canvas"></canvas>

<nav>
<div class="nav-brand">
    <img src="/static/oculus-logo.svg" alt="OCULUS" style="height:44px;width:auto;">
  </div>
<div class="nav-links">
    <a href="/static/globe.html">Threat Map</a>
    <a href="/static/updates.html" class="active">News Intel</a>
    <a href="/static/mittar.html">Analyzer</a>
    <a href="/static/chatrag.html">Assistant</a>
  </div>
</nav>

<div id="ticker-bar">
  <div class="ticker-label">
    <div class="ticker-label-dot"></div>
    INTEL FEED
  </div>
  <div class="ticker-track-wrap">
    <div class="ticker-track" id="ticker-track"></div>
  </div>
</div>

<div id="page">

  <div id="horizontal-track">

  </div>
</div>

<script>
// ── CURSOR ──────────────────────────────────────────────────────────────
const cursor = document.getElementById('cursor');
window.addEventListener('mousemove', e => {
  cursor.style.left = e.clientX + 'px';
  cursor.style.top  = e.clientY + 'px';
});
document.querySelectorAll('button, a, .intel-card').forEach(el => {
  el.addEventListener('mouseenter', () => cursor.classList.add('expand'));
  el.addEventListener('mouseleave', () => cursor.classList.remove('expand'));
});

// ── THREE.JS BACKGROUND ─────────────────────────────────────────────────
(function initBg() {
  const canvas   = document.getElementById('bg-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 starCount = 1800;
  const starPos = new Float32Array(starCount * 3);
  for (let i = 0; i < starCount; i++) {
    const theta = Math.random() * Math.PI * 2;
    const phi   = Math.acos(2 * Math.random() - 1);
    const r     = 70 + Math.random() * 50;
    starPos[i*3]   = r * Math.sin(phi) * Math.cos(theta);
    starPos[i*3+1] = r * Math.cos(phi);
    starPos[i*3+2] = r * Math.sin(phi) * Math.sin(theta);
  }
  starGeo.setAttribute('position', new THREE.BufferAttribute(starPos, 3));
  const starMat = new THREE.PointsMaterial({ color: 0x8ba3c7, size: 0.11, sizeAttenuation: true });
  const stars   = new THREE.Points(starGeo, starMat);
  scene.add(stars);

  const nodeGeo = new THREE.BufferGeometry();
  const nodeCount = 120;
  const nodePos = new Float32Array(nodeCount * 3);
  for (let i = 0; i < nodeCount; i++) {
    nodePos[i*3]   = (Math.random() - 0.5) * 60;
    nodePos[i*3+1] = (Math.random() - 0.5) * 60;
    nodePos[i*3+2] = (Math.random() - 0.5) * 30;
  }
  nodeGeo.setAttribute('position', new THREE.BufferAttribute(nodePos, 3));
  const nodeMat = new THREE.PointsMaterial({ color: 0x3b82f6, size: 0.08, sizeAttenuation: true, transparent: true, opacity: 0.4 });
  const nodes   = new THREE.Points(nodeGeo, nodeMat);
  scene.add(nodes);

  (function loop() {
    requestAnimationFrame(loop);
    stars.rotation.y += 0.000035;
    nodes.rotation.y -= 0.000018;
    nodes.rotation.x += 0.000009;
    renderer.render(scene, camera);
  })();

  window.addEventListener('resize', () => {
    camera.aspect = window.innerWidth / window.innerHeight;
    camera.updateProjectionMatrix();
    renderer.setSize(window.innerWidth, window.innerHeight);
  });
})();

// ── TICKER ──────────────────────────────────────────────────────────────
// ── API FETCH ────────────────────────────────────────────────────────────
async function loadNews() {
  try {
    const res = await fetch('/api/news');
    const articles = await res.json();
    renderCards(articles);
    renderTicker(articles);
  } catch(e) {
    console.error('Failed to load news:', e);
  }
}

function getThreatClass(level) {
  if (!level) return 'medium';
  const l = level.toLowerCase();
  if (l === 'critical' || l === 'high') return 'high';
  if (l === 'low') return 'low';
  return 'medium';
}

function formatDate(dateStr) {
  if (!dateStr) return 'β€”';
  try {
    return new Date(dateStr).toLocaleString('en-GB', {
      day: 'numeric', month: 'short', year: 'numeric',
      hour: '2-digit', minute: '2-digit'
    }) + ' UTC';
  } catch { return dateStr; }
}

function renderCards(articles) {
  const track = document.getElementById('horizontal-track');
  track.innerHTML = '';

  articles.forEach(a => {
    const threatClass = getThreatClass(a.threat_level);
    const card = document.createElement('div');
    card.className = 'intel-card';
    card.dataset.category = (a.sector || 'General').toLowerCase().replace(/\s+/g, '-');
const q = encodeURIComponent(a.headline + '. ' + a.summary);
    card.innerHTML = `
      <div class="card-header">
        <div class="card-sector">${a.sector || 'General'} Β· ${a.source || ''}</div>
        <div class="threat-pip ${threatClass}">${threatClass.charAt(0).toUpperCase() + threatClass.slice(1)}</div>
      </div>
      <h3 class="card-headline">${a.headline}</h3>
      <p class="card-summary">${a.summary}</p>
      <div class="card-footer">
        <div class="card-time">${formatDate(a.published_at)}</div>
        <div class="card-actions">
          <button class="btn-sm-primary" onclick="window.open('${a.url}','_blank')">Expand</button>
          <button class="btn-sm-primary" style="background:transparent;border:1px solid var(--glass-border);color:var(--accent-bright);" onclick="window.location.href='/static/mittar.html?q=${q}'">Analyze</button>
          <button class="btn-sm-primary" style="background:transparent;border:1px solid var(--glass-border);color:var(--accent-bright);" onclick="window.location.href='/static/chatrag.html?q=${q}'">Ask AI</button>
        </div>
      </div>
    `;
    track.appendChild(card);
  });

  // Re-attach cursor + filter logic after dynamic render
  attachCardCursor();
}

function renderTicker(articles) {
  const track = document.getElementById('ticker-track');
  track.innerHTML = '';
  const items = [...articles, ...articles, ...articles];
  items.forEach(a => {
    const threatClass = getThreatClass(a.threat_level);
    const el = document.createElement('span');
    el.className = 'ticker-item';
    el.innerHTML = `<span class="ticker-threat ${threatClass}">${threatClass.toUpperCase()}</span>${a.headline}<span style="color:var(--text-muted);opacity:0.3;padding-left:36px;">Β·</span>`;
    track.appendChild(el);
  });
}

function attachCardCursor() {
  document.querySelectorAll('.intel-card').forEach(el => {
    el.addEventListener('mouseenter', () => cursor.classList.add('expand'));
    el.addEventListener('mouseleave', () => cursor.classList.remove('expand'));
  });
}

// ── BOOT ─────────────────────────────────────────────────────────────────
loadNews();

</script>
</body>
</html>