:root {
  --bg: #04060a;
  --bg-2: #070b12;
  --panel: rgba(8, 14, 22, 0.66);
  --border: rgba(0, 240, 255, 0.16);
  --border-strong: rgba(0, 240, 255, 0.4);
  --text: #cdd9e6;
  --text-bright: #eaf2fb;
  --muted: #6b7d92;
  --cyan: #00f0ff;
  --green: #39ff88;
  --red: #ff3b4e;
  --magenta: #ff2bd6;
  --amber: #ffb547;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}
::selection { background: var(--cyan); color: var(--bg); }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #16303f; border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: #1d4356; }

/* ---------- 3D layer ---------- */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }

.label-layer { position: fixed !important; inset: 0; z-index: 1; pointer-events: none; }

.node-label {
  pointer-events: auto;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(4, 6, 10, 0.82);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 3px;
  transform: translateY(-24px);
  white-space: nowrap;
  transition: color .2s, border-color .2s, box-shadow .2s, opacity .3s;
  user-select: none;
}
.node-label::before { content: "◇ "; opacity: .5; }
.node-label:hover,
.node-label.active {
  color: var(--bg);
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 240, 255, .7);
}
body.scrolled .node-label { opacity: .3; }
body.scrolled .node-label:hover { opacity: 1; }

/* fallback kad 3D nije dostupan */
body.no3d { background: radial-gradient(ellipse at 50% 0%, #0b1826 0%, #060a11 55%, #04060a 100%); }
body.no3d #scene,
body.no3d .label-layer { display: none !important; }
body.no3d .overlay-fx { background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.6) 100%); animation: none; }

/* scanlines + vignette + flicker */
.overlay-fx {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.72) 100%);
  animation: flicker 7s infinite;
}
@keyframes flicker { 0%,96%,100%{opacity:1} 97%{opacity:.86} 98%{opacity:.97} 99%{opacity:.9} }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: grid; place-items: center;
  font-family: var(--mono); color: var(--green);
  transition: opacity .6s, visibility .6s;
}
#loader.done { opacity: 0; visibility: hidden; }
#loader .boot { font-size: 12.5px; line-height: 1.95; min-width: min(360px, 86vw); }
#loader .boot .d { color: var(--muted); }
#loader .boot .ok { color: var(--green); }
#loader .boot .w { color: var(--amber); }
#loader .bar { height: 2px; background: rgba(57,255,136,.14); margin-top: 16px; overflow: hidden; }
#loader .bar span { display:block; height:100%; width:0; background: var(--green); box-shadow: 0 0 10px var(--green); transition: width .25s; }

/* ---------- live traffic HUD ---------- */
.feed {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 40;
  width: min(340px, calc(100vw - 28px));
  background: rgba(4, 7, 12, .92);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  backdrop-filter: blur(12px);
  box-shadow: 0 0 20px rgba(0, 0, 0, .6), 0 0 1px rgba(0, 240, 255, .15);
  font-family: var(--mono);
  font-size: 10.5px;
  overflow: hidden;
  pointer-events: none;
}
.feed-head {
  padding: 5px 10px;
  color: var(--green);
  letter-spacing: .12em;
  border-bottom: 1px solid var(--border-strong);
  opacity: 1;
  text-shadow: 0 0 8px rgba(57, 255, 136, .3);
}
.feed-lines { padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 3px; min-height: 108px; }
.feed-line {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateX(-6px);
  animation: feed-in .35s ease forwards;
  transition: opacity .8s ease;
}
.feed-line.fade { opacity: .5; }
@keyframes feed-in { to { opacity: 1; transform: none; } }
.feed-line.k-pwn   { color: var(--magenta); }
.feed-line.k-bot   { color: var(--amber); }
.feed-line.k-block { color: var(--red); }
.feed-line.k-ok    { color: var(--green); }
.feed-line.k-scan  { color: var(--cyan); }

body.scrolled .feed { opacity: .7; transition: opacity .3s; }
body.scrolled .feed:hover { opacity: 1; }
body.no3d .feed { opacity: .9; }
/* na hero-u se feed box preklapao sa hint tekstom — sakrij ga dok si u hero sekciji */
body.in-hero .feed { opacity: 0; pointer-events: none; transition: opacity .4s; }
.feed { transition: opacity .4s; }

@media (max-width: 640px) {
  .feed { display: none; }
}

/* ---------- nav ---------- */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 48px);
  background: linear-gradient(to bottom, rgba(4,6,10,.92), transparent);
  backdrop-filter: blur(2px);
}
.logo { font-family: var(--mono); font-weight: 700; color: var(--cyan); text-decoration: none; letter-spacing: .05em; }
.logo span { color: var(--magenta); }
.nav-right { display: flex; align-items: center; gap: clamp(10px, 2vw, 26px); }
nav ul { display: flex; gap: clamp(10px, 2vw, 26px); list-style: none; }
nav a.link { font-family: var(--mono); font-size: 12.5px; color: var(--muted); text-decoration: none; transition: color .2s; }
nav a.link:hover, nav a.link.active { color: var(--cyan); }
nav a.link b { color: var(--magenta); font-weight: 400; }

/* sound toggle */
.sound-btn {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  color: var(--muted); background: rgba(8,14,22,.6);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 11px; cursor: pointer; transition: all .2s;
}
.sound-btn:hover { color: var(--cyan); border-color: var(--border-strong); }
.sound-btn.on { color: var(--green); border-color: rgba(57,255,136,.4); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 2px; height: 3px; background: currentColor; border-radius: 1px; transition: height .15s; }
.sound-btn.on .eq i { animation: eq .9s infinite ease-in-out; }
.sound-btn.on .eq i:nth-child(2){ animation-delay:.2s } .sound-btn.on .eq i:nth-child(3){ animation-delay:.4s } .sound-btn.on .eq i:nth-child(4){ animation-delay:.1s }
@keyframes eq { 0%,100%{height:3px} 50%{height:12px} }

/* ---------- content ---------- */
main { position: relative; z-index: 3; pointer-events: none; }
main a, main button, .card, .terminal, .chip, .contact-item { pointer-events: auto; }

section {
  min-height: 100vh;
  padding: 120px clamp(16px, 6vw, 96px) 80px;
  display: flex; flex-direction: column; justify-content: center;
}
.content { max-width: 640px; }

.sec-tag { font-family: var(--mono); font-size: 12.5px; color: var(--magenta); margin-bottom: 10px; letter-spacing: .12em; }
h2 { font-size: clamp(30px, 5vw, 52px); line-height: 1.08; margin-bottom: 26px; font-weight: 700; color: var(--text-bright); }
h2 .accent { color: var(--cyan); }

/* hero */
#hero .content { max-width: 740px; }
.hero-tag { font-family: var(--mono); font-size: 12.5px; color: var(--green); letter-spacing: .18em; margin-bottom: 18px; }
.hero-tag::before { content: "● "; }
h1 { font-size: clamp(44px, 8.5vw, 104px); line-height: .98; font-weight: 700; margin-bottom: 18px; color: var(--text-bright); text-shadow: 0 0 44px rgba(0, 240, 255, .28); }
h1 .glitch { position: relative; display: inline-block; color: #fff; }
h1 .glitch::before, h1 .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; opacity: .75;
}
h1 .glitch::before { color: var(--cyan); animation: glitch 3.2s infinite steps(1); }
h1 .glitch::after  { color: var(--magenta); animation: glitch 2.7s infinite steps(1) reverse; }
@keyframes glitch {
  0%,88%,100% { transform: none; clip-path: inset(0 0 100% 0); }
  90% { transform: translate(-3px, 1px); clip-path: inset(20% 0 55% 0); }
  93% { transform: translate(3px, -1px); clip-path: inset(60% 0 10% 0); }
  96% { transform: translate(-2px, 0); clip-path: inset(40% 0 35% 0); }
}
.hero-sub { font-size: clamp(16px, 2vw, 20px); color: var(--muted); max-width: 580px; margin-bottom: 26px; }
.hero-sub strong { color: var(--text-bright); font-weight: 500; }

.terminal {
  background: rgba(4, 7, 13, .86);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono); font-size: 13px;
  max-width: 580px; margin-bottom: 30px;
  backdrop-filter: blur(6px);
  box-shadow: 0 24px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(0,240,255,.04) inset;
}
.terminal-bar { display:flex; align-items:center; gap:6px; padding:9px 12px; border-bottom:1px solid var(--border); color: var(--muted); font-size: 11px; }
.terminal-bar i { width:10px; height:10px; border-radius:50%; display:inline-block; }
.terminal-bar i:nth-child(1){ background:#ff5f57 } .terminal-bar i:nth-child(2){ background:#febc2e } .terminal-bar i:nth-child(3){ background:#28c840; margin-right:8px }
.terminal-body { padding:14px 16px; min-height:190px; white-space:pre-wrap; }
.terminal-body .p{ color:var(--green) } .terminal-body .c{ color:var(--cyan) } .terminal-body .m{ color:var(--magenta) } .terminal-body .r{ color:var(--red) } .terminal-body .d{ color:var(--muted) }
.cursor-blink { display:inline-block; width:8px; height:15px; background:var(--green); vertical-align:-2px; animation:blink 1s infinite steps(1); }
@keyframes blink { 50%{opacity:0} }

.btns { display:flex; gap:14px; flex-wrap:wrap; }
.btn {
  font-family: var(--mono); font-size: 14px; text-decoration: none;
  padding: 12px 22px; border-radius: 6px;
  border: 1px solid var(--cyan); color: var(--bg); background: var(--cyan);
  cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 26px rgba(0,240,255,.5); }
.btn.ghost { background: transparent; color: var(--cyan); }
.btn.ghost:hover { background: rgba(0,240,255,.08); }

.hint { margin-top: 40px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.hint b { color: var(--cyan); font-weight: 400; }

/* cards */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: border-color .25s, transform .25s, box-shadow .25s;
  overflow: hidden;
}
.card::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(0,240,255,.06), transparent);
  transition: left .6s; pointer-events: none;
}
.card:hover::after { left: 130%; }
.card:hover { border-color: var(--border-strong); transform: translateY(-3px); box-shadow: 0 14px 44px rgba(0, 240, 255, .09); }
.card p { color: var(--muted); }
.card p + p { margin-top: 12px; }

.stats { display:grid; grid-template-columns: repeat(3, 1fr); gap:14px; margin-top:18px; }
.stat { text-align:center; padding:18px 10px; }
.stat .num { font-family: var(--mono); font-size: 30px; color: var(--cyan); font-weight: 700; display: block; }
.stat .lbl { font-size: 12px; color: var(--muted); }

/* timeline */
.timeline { display:flex; flex-direction:column; gap:16px; position:relative; }
.timeline .card { position:relative; padding-left:28px; }
.timeline .card::before {
  content:""; position:absolute; left:0; top:18px; bottom:18px; width:3px; border-radius:3px;
  background: var(--c, var(--cyan)); box-shadow: 0 0 12px var(--c, var(--cyan));
}
.exp-head { display:flex; justify-content:space-between; align-items:baseline; gap:10px; flex-wrap:wrap; margin-bottom:6px; }
.exp-head h3 { font-size:19px; color: var(--text-bright); }
.exp-head .role { font-family: var(--mono); font-size:12px; color: var(--c, var(--cyan)); }
.tags { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.tag { font-family: var(--mono); font-size:11px; color: var(--text); border:1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03); padding:2px 8px; border-radius:4px; }

/* certs */
.certs { display:grid; gap:16px; }
.cert { display:flex; gap:18px; align-items:flex-start; }
.cert-badge {
  flex:0 0 56px; height:56px; border-radius:10px; display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(255,43,43,.25), rgba(255,181,71,.15));
  border:1px solid rgba(255,90,60,.5); font-family: var(--mono); font-weight:700; font-size:13px; color:#ff7a59;
}
.cert h3 { font-size:18px; margin-bottom:2px; color: var(--text-bright); }
.cert .issuer { font-family: var(--mono); font-size:12px; color: var(--amber); margin-bottom:8px; display:block; }
.verified { font-family: var(--mono); font-size:11px; color: var(--green); margin-left:6px; }

/* skills */
.skill-groups { display:grid; grid-template-columns: repeat(2, 1fr); gap:16px; }
.skill-groups h3 { font-family: var(--mono); font-size:13px; color: var(--cyan); font-weight:400; margin-bottom:12px; letter-spacing:.05em; }
.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip {
  font-family: var(--mono); font-size:12px; padding:5px 11px; border-radius:5px;
  border:1px solid var(--border); background: rgba(0,240,255,.04); cursor:default; transition: all .2s;
}
.chip[data-node] { cursor:pointer; }
.chip:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 12px rgba(0,240,255,.25); }

/* threat feed — stats bar */
.threat-stats {
  display: flex; gap: 2px; padding: 0; overflow: hidden; margin-bottom: 14px;
}
.tstat {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 14px 8px; border-right: 1px solid var(--border);
  transition: background .3s;
}
.tstat:last-child { border-right: none; }
.tstat:hover { background: rgba(0,240,255,.04); }
.tstat-n {
  font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text-bright);
  line-height: 1;
}
.tstat-l {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  color: var(--muted); margin-top: 6px;
}
#ts-critical .tstat-n { color: var(--red); }
#ts-high .tstat-n { color: var(--magenta); }
#ts-medium .tstat-n { color: var(--cyan); }
#ts-low .tstat-n { color: var(--muted); }
#ts-total .tstat-n { color: var(--green); }

/* threat feed panel */
.threat-panel { padding: 0; overflow: hidden; }

/* tabs */
.threat-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em;
}
.ttab {
  flex: 1; padding: 13px 12px; text-align: center;
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s, background .2s;
}
.ttab:hover { color: var(--text-bright); background: rgba(0,240,255,.03); }
.ttab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.ttab-body { display: none; }
.ttab-body.active { display: block; }

.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); margin-right: 6px; box-shadow: 0 0 8px var(--red);
  animation: live-pulse 1.4s infinite;
}
@keyframes live-pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.threat-head-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.04);
}
.threat-meta { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.threat-list { max-height: 520px; overflow-y: auto; }

.threat-item {
  display: flex; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-family: var(--mono);
  animation: tfade-in .4s ease-out;
}
@keyframes tfade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.threat-item:last-child { border-bottom: none; }
.threat-sev {
  flex: 0 0 auto; align-self: flex-start;
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  padding: 3px 7px; border-radius: 4px; white-space: nowrap;
  border: 1px solid currentColor;
}
.sev-critical { color: var(--red); text-shadow: 0 0 6px rgba(255,59,78,.4); }
.sev-high { color: var(--magenta); }
.sev-medium { color: var(--cyan); }
.sev-low, .sev-unknown { color: var(--muted); }
.threat-id { font-size: 13px; color: var(--text-bright); margin-bottom: 2px; }
.threat-id a { color: inherit; text-decoration: none; }
.threat-id a:hover { color: var(--cyan); text-decoration: underline; }
.threat-sum { font-size: 12.5px; color: var(--muted); line-height: 1.5; font-family: var(--sans); }
.threat-age { font-size: 10px; color: var(--muted); margin-top: 4px; opacity: .7; }
.threat-cvss {
  font-size: 10px; padding: 2px 6px; border-radius: 3px; margin-left: 8px;
  background: rgba(255,255,255,.06); color: var(--text-bright); font-weight: 700;
}
.threat-tag {
  display: inline-block; font-size: 9px; padding: 2px 6px; border-radius: 3px;
  background: rgba(0,240,255,.08); color: var(--cyan); margin-top: 5px;
  letter-spacing: .05em;
}
.threat-impact {
  font-size: 11px; color: var(--amber); margin-top: 4px; font-family: var(--sans);
  line-height: 1.4;
}
.threat-empty { padding: 24px 18px; color: var(--muted); font-family: var(--mono); font-size: 13px; text-align: center; }
.threat-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 18px; font-family: var(--mono); font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--border); background: rgba(255,255,255,.015);
}
.threat-foot a { color: var(--cyan); text-decoration: none; }
.threat-foot a:hover { text-decoration: underline; }
.threat-refresh {
  cursor: pointer; color: var(--cyan); transition: opacity .2s;
  user-select: none;
}
.threat-refresh:hover { opacity: .7; }

/* notable/history items — extra styling */
.threat-item.notable { border-left: 3px solid var(--red); }
.threat-item.hist { border-left: 3px solid var(--cyan); }

/* contact */
.contact-list { display:grid; gap:12px; }
.contact-item { display:flex; align-items:center; justify-content:space-between; text-decoration:none; color:var(--text); font-family:var(--mono); font-size:14px; }
.contact-item .k { color:var(--muted); font-size:12px; }
.contact-item .arrow { color:var(--cyan); transition: transform .2s; }
.contact-item:hover .arrow { transform: translateX(4px); }

footer { position:relative; z-index:3; text-align:center; padding:30px 16px 40px; font-family:var(--mono); font-size:12px; color:var(--muted); }
footer .on { color: var(--green); }

/* reveal */
.reveal { opacity:0; transform: translateY(30px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity:1; transform:none; }

/* node info panel */
#panel {
  position: fixed; z-index: 60; right: clamp(12px, 3vw, 40px); top: 50%;
  width: min(380px, calc(100vw - 24px)); transform: translate(120%, -50%);
  background: rgba(5, 9, 16, .92); border: 1px solid var(--cyan); border-radius: 10px;
  padding: 24px; backdrop-filter: blur(14px); box-shadow: 0 0 44px rgba(0,240,255,.22);
  transition: transform .5s cubic-bezier(.2,.9,.2,1); font-family: var(--sans);
}
#panel.open { transform: translate(0, -50%); }
#panel .p-id { font-family: var(--mono); font-size: 11px; color: var(--magenta); letter-spacing: .1em; }
#panel h3 { font-size: 26px; margin: 4px 0 12px; color: var(--text-bright); }
#panel p { color: var(--muted); font-size: 15px; }
#panel .close { position:absolute; top:12px; right:14px; background:none; border:none; color:var(--muted); font-size:20px; cursor:pointer; font-family:var(--mono); }
#panel .close:hover { color: var(--cyan); }

/* responsive */
@media (max-width: 900px) {
  .content { max-width: 100%; }
  nav ul { display: none; }
  .skill-groups { grid-template-columns: 1fr; }
  #panel { top:auto; bottom:12px; transform: translate(0, 130%); }
  #panel.open { transform: translate(0, 0); }
}
@media (max-width: 480px) { .stat .num { font-size:22px; } .terminal { font-size:12px; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity:1; transform:none; transition:none; }
  h1 .glitch::before, h1 .glitch::after { animation:none; display:none; }
  .overlay-fx { animation: none; }
}
