/* ========== BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #050505;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  overflow-x: hidden;
  cursor: none;
}

::selection {
  background: #ff0040;
  color: #fff;
}

h1, h2, h3, h4, h5, h6, .font-syncopate {
  font-family: 'Syncopate', sans-serif;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #050505; }
::-webkit-scrollbar-thumb { background: #00ff41; border-radius: 2px; }

/* ========== CUSTOM CURSOR ========== */
#custom-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  background-color: #ff0040;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;
  transition: width 0.2s, height 0.2s, background-color 0.2s;
  mix-blend-mode: difference;
}

#cursor-trail {
  position: fixed;
  top: 0; left: 0;
  width: 40px; height: 40px;
  border: 1px solid rgba(255, 0, 64, 0.4);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9998;
  transition: top 0.15s ease-out, left 0.15s ease-out, width 0.2s, height 0.2s, border-color 0.2s;
}

/* ========== MATRIX RAIN ========== */
#matrix-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  filter: blur(1px);
  opacity: 0.12;
  pointer-events: none;
}

/* ========== CRT OVERLAY ========== */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9990;
  background:
    linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.15) 50%),
    linear-gradient(90deg, rgba(255,0,0,0.03), rgba(0,255,0,0.01), rgba(0,0,255,0.03));
  background-size: 100% 3px, 6px 100%;
  opacity: 0.5;
}

/* ========== SCAN LINE ========== */
.scan-line {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 10vh;
  background: linear-gradient(to bottom, transparent, rgba(0,255,65,0.04), transparent);
  opacity: 0.5;
  pointer-events: none;
  z-index: 9991;
  animation: scan 8s linear infinite;
}

@keyframes scan {
  0% { transform: translateY(-100vh); }
  100% { transform: translateY(100vh); }
}

/* ========== GLITCH TEXT ========== */
.glitch-text {
  position: relative;
  display: inline-block;
}
.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0.8;
  pointer-events: none;
}
.glitch-text::before {
  left: 4px;
  text-shadow: -3px 0 #ff0040;
  clip: rect(24px, 1500px, 90px, 0);
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}
.glitch-text::after {
  left: -4px;
  text-shadow: -3px 0 #00d4ff;
  clip: rect(85px, 1500px, 140px, 0);
  animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% { clip: rect(26px, 9999px, 83px, 0); }
  20% { clip: rect(74px, 9999px, 12px, 0); }
  40% { clip: rect(4px, 9999px, 48px, 0); }
  60% { clip: rect(93px, 9999px, 20px, 0); }
  80% { clip: rect(15px, 9999px, 64px, 0); }
  100% { clip: rect(38px, 9999px, 91px, 0); }
}

@keyframes glitch-anim-2 {
  0% { clip: rect(65px, 9999px, 100px, 0); }
  20% { clip: rect(10px, 9999px, 50px, 0); }
  40% { clip: rect(48px, 9999px, 80px, 0); }
  60% { clip: rect(80px, 9999px, 15px, 0); }
  80% { clip: rect(23px, 9999px, 68px, 0); }
  100% { clip: rect(95px, 9999px, 34px, 0); }
}

/* ========== GLASS PANEL ========== */
.panel {
  position: relative;
  background: rgba(5,5,5,0.6);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent, transparent);
  opacity: 0;
  transition: opacity 0.7s;
  pointer-events: none;
  border-radius: inherit;
}
.panel:hover::before { opacity: 1; }
.panel:hover {
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-4px);
}

.panel-green:hover {
  border-color: rgba(0,255,65,0.3);
  box-shadow: 0 20px 40px -20px rgba(0,255,65,0.15);
}

.panel-cyan:hover {
  border-color: rgba(0,212,255,0.3);
  box-shadow: 0 20px 40px -20px rgba(0,212,255,0.15);
}

.panel-red:hover {
  border-color: rgba(255,0,64,0.3);
  box-shadow: 0 20px 40px -20px rgba(255,0,64,0.15);
}

/* ========== REVEAL ANIMATIONS ========== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* ========== BEAR PAW ANIMATION ========== */
.bear-paw {
  display: inline-block;
  animation: paw-float 3s ease-in-out infinite;
}

@keyframes paw-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-6px) rotate(-3deg); }
  75% { transform: translateY(3px) rotate(3deg); }
}

/* ========== GLOW TEXT ========== */
.glow-green {
  text-shadow: 0 0 10px rgba(0,255,65,0.5), 0 0 20px rgba(0,255,65,0.2);
}

.glow-cyan {
  text-shadow: 0 0 10px rgba(0,212,255,0.5), 0 0 20px rgba(0,212,255,0.2);
}

.glow-red {
  text-shadow: 0 0 10px rgba(255,0,64,0.5), 0 0 20px rgba(255,0,64,0.2);
}

/* ========== CODE BLOCK ========== */
.code-block {
  background: rgba(5,5,5,0.8);
  border: 1px solid rgba(0,255,65,0.15);
  border-radius: 8px;
  overflow: hidden;
}

.code-header {
  background: rgba(0,255,65,0.05);
  border-bottom: 1px solid rgba(0,255,65,0.1);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.code-content {
  padding: 24px;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
}

.code-content::-webkit-scrollbar { height: 3px; }
.code-content::-webkit-scrollbar-thumb { background: #00ff41; border-radius: 2px; }

/* Syntax colors */
.syn-keyword { color: #00ff41; }
.syn-type { color: #ff0040; }
.syn-string { color: #00d4ff; }
.syn-comment { color: #555; font-style: italic; }
.syn-func { color: #ffb800; }
.syn-number { color: #bf00ff; }
.syn-op { color: #888; }

/* ========== COUNTER ANIMATION ========== */
.counter-value {
  font-variant-numeric: tabular-nums;
}

/* ========== GRID BG ========== */
.grid-bg {
  background-image:
    linear-gradient(rgba(0,255,65,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,65,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ========== NAV ========== */
.nav-blur {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(5,5,5,0.7);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* ========== PULSE RING ========== */
.pulse-ring {
  position: relative;
}
.pulse-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(0,255,65,0.3);
  border-radius: inherit;
  animation: pulse-ring-anim 2s ease-out infinite;
}
@keyframes pulse-ring-anim {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* ========== ARCHITECTURE ASCII ========== */
.ascii-art {
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.5px;
  white-space: pre;
  overflow-x: auto;
}

@media (max-width: 768px) {
  .ascii-art {
    font-size: 8px;
    letter-spacing: 0;
  }
}

/* ========== SECTION DIVIDER ========== */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,255,65,0.2), transparent);
}

/* ========== LINK HOVER ========== */
.link-hover {
  position: relative;
}
.link-hover::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: #00ff41;
  transition: width 0.3s;
}
.link-hover:hover::after {
  width: 100%;
}

/* ========== MOBILE CURSOR FIX ========== */
@media (pointer: coarse) {
  body { cursor: auto; }
  #custom-cursor, #cursor-trail { display: none; }
}
