/* Terminal Effects & Cyber Aesthetic */

:root {
  --neon-green: #00ff41;
  --neon-red: #ff3131;
  --bg-color: #000000;
  --terminal-glow: 0 0 10px rgba(0, 255, 65, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--neon-green);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
  background: #00ff41;
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: #00cc33;
}

/* Selection */
::selection {
  background: #00ff41;
  color: #000;
}

/* Scanlines Effect */
.scan-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0),
    rgba(255,255,255,0) 50%,
    rgba(0,0,0,0.1) 50%,
    rgba(0,0,0,0.1)
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 50;
  opacity: 0.3;
}

/* CRT Flicker Effect */
@keyframes flicker {
  0% { opacity: 0.97; }
  5% { opacity: 0.95; }
  10% { opacity: 0.9; }
  15% { opacity: 0.95; }
  20% { opacity: 0.99; }
  50% { opacity: 0.95; }
  80% { opacity: 0.9; }
  100% { opacity: 0.97; }
}

.crt-flicker {
  animation: flicker 0.15s infinite;
  position: relative;
}

/* Glitch Text Effect */
.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%;
  background: var(--bg-color);
}

.glitch-text::before {
  left: 2px;
  text-shadow: -2px 0 #ff00c1;
  clip: rect(24px, 550px, 90px, 0);
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch-text::after {
  left: -2px;
  text-shadow: -2px 0 #00fff9;
  clip: rect(85px, 550px, 140px, 0);
  animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% { clip: rect(10px, 9999px, 85px, 0); }
  20% { clip: rect(60px, 9999px, 70px, 0); }
  40% { clip: rect(30px, 9999px, 95px, 0); }
  60% { clip: rect(80px, 9999px, 5px, 0); }
  80% { clip: rect(20px, 9999px, 60px, 0); }
  100% { clip: rect(90px, 9999px, 30px, 0); }
}

@keyframes glitch-anim-2 {
  0% { clip: rect(65px, 9999px, 99px, 0); }
  20% { clip: rect(10px, 9999px, 85px, 0); }
  40% { clip: rect(40px, 9999px, 15px, 0); }
  60% { clip: rect(20px, 9999px, 65px, 0); }
  80% { clip: rect(90px, 9999px, 10px, 0); }
  100% { clip: rect(30px, 9999px, 50px, 0); }
}

/* Typing Cursor */
.terminal-cursor::after {
  content: '_';
  animation: blink 1s step-end infinite;
  color: var(--neon-green);
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Matrix Canvas Behind Everything */
#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
}

/* Glow Effects */
.glow-text {
  text-shadow: 0 0 10px currentColor;
}

.glow-box {
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
  transition: box-shadow 0.3s ease;
}

.glow-box:hover {
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

/* Button Hover Effects */
.cyber-button {
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.cyber-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 65, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.cyber-button:hover::before {
  left: 100%;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .glitch-text::before,
  .glitch-text::after {
    display: none; /* Disable glitch on mobile for performance */
  }
  
  body {
    font-size: 14px;
  }
}

/* Loading Animation */
@keyframes loading-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Smooth Scroll Padding for Fixed Header */
html {
  scroll-padding-top: 80px;
}

/* Section Transitions */
section {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Terminal Window Style */
.terminal-window {
  border: 1px solid rgba(0, 255, 65, 0.3);
  background: rgba(0, 0, 0, 0.8);
  position: relative;
}

.terminal-window::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ff41, transparent);
  opacity: 0.5;
}

/* Responsive Typography */
@media (max-width: 640px) {
  h1 {
    font-size: 1.5rem !important;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.25rem !important;
  }
}