/* ==================================================
   3D + HACKER UI — radar, terminal, hex numbers
   3D tilt cards, depth shadows, animated overlays
   ================================================== */

/* ---------- 3D scene perspective ---------- */
body { perspective: 1500px; }
.studio-main { transform-style: preserve-3d; }

/* ---------- 3D tilt cards on hover ---------- */
.skill-card, .project-card, .pub-card, .timeline-card, .edu-card, .stat-card, .lang-card, .info-item {
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.25,1,.5,1), background .3s, border-color .3s, box-shadow .5s !important;
  will-change: transform;
}
.skill-card:hover, .project-card:hover, .pub-card:hover, .edu-card:hover, .lang-card:hover {
  transform: translateY(-6px) rotateX(2deg) rotateY(-2deg) !important;
  box-shadow: 0 30px 60px rgba(0,0,0,.4), 0 0 0 1px var(--line-2) !important;
}
[data-theme="light"] .skill-card:hover, [data-theme="light"] .project-card:hover {
  box-shadow: 0 30px 60px rgba(20,25,30,.15), 0 0 0 1px var(--line-2) !important;
}

/* Profile photo 3D depth */
.profile-card {
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.25,1,.5,1);
}
.profile-frame {
  transform: translateZ(20px);
  transition: transform .8s cubic-bezier(.25,1,.5,1);
}
.profile-card:hover .profile-frame {
  transform: translateZ(40px);
}

/* Hero title — deep shadow */
.hero-title {
  text-shadow: 0 8px 40px rgba(0,0,0,.4);
}
[data-theme="light"] .hero-title { text-shadow: 0 8px 40px rgba(20,25,30,.15); }

/* ---------- HACKER WIDGETS ---------- */

/* Floating RADAR (bottom right) */
.hack-radar {
  position: fixed;
  bottom: 8rem; right: 1.2rem;
  width: 140px; height: 140px;
  z-index: 40;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.hack-radar svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  filter: drop-shadow(0 0 8px rgba(200,205,211,.3));
}
.hack-radar .radar-bg-circle { fill: rgba(14,16,20,.6); stroke: var(--line-2); stroke-width: 1; }
.hack-radar .radar-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.hack-radar .radar-cross { stroke: var(--line); stroke-width: .5; }
.hack-radar .radar-sweep {
  fill: url(#sweepGrad);
  transform-origin: 70px 70px;
  animation: radarSweep 3s linear infinite;
}
@keyframes radarSweep { to { transform: rotate(360deg); } }
.hack-radar .radar-blip {
  fill: var(--ink);
  opacity: 0;
  animation: blipPulse 3s ease-in-out infinite;
}
.hack-radar .radar-blip.b1 { animation-delay: .8s; }
.hack-radar .radar-blip.b2 { animation-delay: 1.6s; }
.hack-radar .radar-blip.b3 { animation-delay: 2.4s; }
@keyframes blipPulse {
  0%,100% { opacity: 0; r: 2; }
  20%     { opacity: 1; r: 5; }
  60%     { opacity: 0; r: 2; }
}
.hack-radar .radar-label {
  position: absolute; bottom: -18px; left: 0; right: 0; text-align: center;
  font-size: .55rem; letter-spacing: .25em; text-transform: uppercase; color: var(--ink-faint);
}
@media (max-width: 1024px) { .hack-radar { display: none; } }

/* Floating HEX number stream (left edge) */
.hex-stream {
  position: fixed;
  left: 1rem; top: 50%; transform: translateY(-50%);
  z-index: 30;
  display: grid; gap: .25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .58rem;
  color: var(--ink-faint);
  pointer-events: none;
  max-height: 60vh; overflow: hidden;
  mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent);
}
.hex-stream div { white-space: nowrap; opacity: .8; transition: opacity .4s; }
.hex-stream div.bright { color: var(--ink); opacity: 1; }
@media (max-width: 1024px) { .hex-stream { display: none; } }

/* Top-right floating system terminal */
.hack-terminal {
  position: fixed;
  top: 84px; right: 1.2rem;
  z-index: 40;
  width: 280px;
  background: rgba(14,16,20,.78);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  color: var(--ink-soft);
  overflow: hidden;
  pointer-events: none;
}
[data-theme="light"] .hack-terminal {
  background: rgba(240,242,245,.78);
}
.hack-terminal .term-head {
  display: flex; align-items: center; gap: .35rem;
  padding: .45rem .7rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.hack-terminal .term-head .dots {
  display: inline-flex; gap: 4px;
}
.hack-terminal .term-head .dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-faint);
}
.hack-terminal .term-head .dots span:nth-child(1) { background: #ef4444; }
.hack-terminal .term-head .dots span:nth-child(2) { background: #f59e0b; }
.hack-terminal .term-head .dots span:nth-child(3) { background: #10b981; }
.hack-terminal .term-head .term-title {
  font-size: .56rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-soft); margin-left: auto;
}
.hack-terminal .term-body {
  padding: .6rem .8rem;
  height: 130px;
  overflow: hidden;
  position: relative;
}
.hack-terminal .term-body div {
  margin: 0; line-height: 1.5;
  color: var(--ink-soft);
}
.hack-terminal .term-body .prompt { color: var(--ink); }
.hack-terminal .term-body .ok { color: #10b981; }
.hack-terminal .term-body .warn { color: #f59e0b; }
.hack-terminal .term-body .info { color: var(--ink); }
.hack-terminal .term-body .typing::after {
  content: '_'; display: inline-block; animation: termBlink 1s steps(2) infinite;
}
@keyframes termBlink { 50% { opacity: 0; } }

@media (max-width: 1024px) { .hack-terminal { display: none; } }

/* Top-left vertical coordinate label */
.hack-coords {
  position: fixed;
  left: 1rem; top: 84px;
  z-index: 30;
  font-family: 'JetBrains Mono', monospace;
  font-size: .58rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-faint);
  pointer-events: none;
  display: grid; gap: .35rem;
}
.hack-coords .v { color: var(--ink); }
@media (max-width: 1024px) { .hack-coords { display: none; } }

/* Bottom-left scrolling code feed */
.hack-feed {
  position: fixed;
  left: 1rem; bottom: 1rem;
  z-index: 30;
  font-family: 'JetBrains Mono', monospace;
  font-size: .55rem;
  color: var(--ink-faint);
  pointer-events: none;
  display: grid; gap: 2px;
  max-width: 240px;
}
.hack-feed div span { color: var(--ink); }
.hack-feed div.warn span { color: #f59e0b; }
.hack-feed div.ok span { color: #10b981; }
@media (max-width: 1024px) { .hack-feed { display: none; } }

/* ---------- 3D Tilt for profile card on mouse move (handled in JS) ---------- */
.profile-card {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
}

/* ---------- Floating section badges with glow ---------- */
.section-tag {
  text-shadow: 0 0 16px rgba(200,205,211,.3);
}

/* ---------- Animated hero scroll cue with arrow ---------- */
.hero-scroll-cue { font-family: 'JetBrains Mono', monospace; }

/* ---------- Pulse ring around stat numbers ---------- */
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  border: 1px solid var(--line);
  opacity: .3;
  animation: pulse3d 4s ease-in-out infinite;
}
@keyframes pulse3d {
  0%,100% { transform: scale(1); opacity: .3; }
  50%     { transform: scale(1.4); opacity: .05; }
}

/* ---------- Animated noise overlay (very subtle) ---------- */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  opacity: .03;
  mix-blend-mode: overlay;
  animation: noiseShift 1s steps(4) infinite;
}
@keyframes noiseShift {
  0% { transform: translate(0,0); }
  25% { transform: translate(-2%,2%); }
  50% { transform: translate(2%,-2%); }
  75% { transform: translate(-1%,1%); }
  100% { transform: translate(0,0); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hack-radar, .hack-terminal, .hex-stream, .hack-coords, .hack-feed { display: none !important; }
  body::before { display: none; }
  .skill-card:hover, .project-card:hover, .pub-card:hover, .edu-card:hover, .lang-card:hover {
    transform: translateY(-3px) !important;
  }
}
