/* CSS Variables */
:root {
  --terminal-green: #00ff00;
  --terminal-bg: #000000;
  --terminal-text: #cccccc;
  --terminal-dim: #003300;
}

/* Font Loading Optimization */
@font-face {
  font-family: 'IBM Plex Mono';
  font-display: swap;
}

/* CRT Scanline Effect */
.scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  animation: scanline-move 8s linear infinite;
  opacity: 0.1;
}

@keyframes scanline-move {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(4px);
  }
}

/* Terminal Glow Effect */
.terminal-glow {
  color: var(--terminal-green);
  text-shadow:
    0 0 5px var(--terminal-green),
    0 0 10px var(--terminal-green),
    0 0 15px var(--terminal-green),
    0 0 20px var(--terminal-green);
  animation: flicker 8s infinite;
}

@keyframes flicker {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.95;
  }
  75% {
    opacity: 0.98;
  }
}

/* Terminal Border Effect */
.terminal-border {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(0, 255, 0, 0.3);
  box-shadow:
    0 0 10px rgba(0, 255, 0, 0.1),
    inset 0 0 10px rgba(0, 255, 0, 0.05);
  transition: all 0.3s ease;
}

.terminal-border:hover {
  border-color: rgba(0, 255, 0, 0.5);
  box-shadow:
    0 0 20px rgba(0, 255, 0, 0.2),
    inset 0 0 15px rgba(0, 255, 0, 0.1);
  transform: translateY(-5px);
}

/* Project Card 3D Hover Effect */
.project-card {
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.project-card:hover {
  transform: translateY(-10px) rotateX(2deg);
}

/* Member Card Effect */
.member-card {
  transition: all 0.5s ease;
}

.member-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 255, 0, 0.6);
}

/* GitHub Icon Hover Effect */
a[title="View on GitHub"] svg {
  transition: all 0.3s ease;
}

a[title="View on GitHub"]:hover svg {
  transform: rotate(360deg) scale(1.2);
  filter: drop-shadow(0 0 8px var(--terminal-green));
}

/* Waveform Monitor Styling */
.waveform-monitor {
  background: #000000;
  border: 1px solid rgba(0, 255, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.waveform-monitor::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 255, 0, 0.05) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.waveform-monitor svg {
  display: block;
}

.waveform-monitor path {
  fill: none;
  stroke: var(--terminal-green);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* PCB Circuit Board Styling */
.pcb-circuit {
  background-color: #000000;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 9px,
      rgba(0, 255, 0, 0.03) 9px,
      rgba(0, 255, 0, 0.03) 10px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 9px,
      rgba(0, 255, 0, 0.03) 9px,
      rgba(0, 255, 0, 0.03) 10px
    );
  border: 1px solid rgba(0, 255, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.pcb-circuit::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 255, 0, 0.08) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.pcb-circuit svg {
  display: block;
}

.pcb-circuit .trace {
  fill: none;
  stroke: var(--terminal-green);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pcb-circuit .trace-inactive {
  stroke: var(--terminal-dim);
  stroke-width: 1;
  opacity: 0.3;
}

.pcb-circuit .component-node {
  fill: var(--terminal-green);
  filter: drop-shadow(0 0 3px var(--terminal-green));
}

/* Status Badge */
.status-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.625rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(0, 255, 0, 0.5);
  background: rgba(0, 255, 0, 0.1);
  color: var(--terminal-green);
  white-space: nowrap;
  letter-spacing: 0.05em;
}

/* Tech Tag */
.tech-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.625rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(0, 255, 0, 0.3);
  background: rgba(0, 255, 0, 0.05);
  color: var(--terminal-text);
  transition: all 0.2s ease;
}

.tech-tag:hover {
  background: rgba(0, 255, 0, 0.15);
  border-color: rgba(0, 255, 0, 0.5);
  color: var(--terminal-green);
}

/* Glitch Effect */
.glitch {
  animation: glitch-animation 0.3s ease;
}

@keyframes glitch-animation {
  0%, 100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
}

/* Enhanced Glitch for Title */
.glitch-title {
  position: relative;
  animation: title-glitch 5s infinite;
}

@keyframes title-glitch {
  0%, 90%, 100% {
    transform: translate(0);
    text-shadow:
      0 0 5px var(--terminal-green),
      0 0 10px var(--terminal-green),
      0 0 15px var(--terminal-green),
      0 0 20px var(--terminal-green);
  }
  91% {
    transform: translate(-3px, 2px);
    text-shadow:
      2px 0 var(--terminal-green),
      -2px 0 #ff00ff,
      0 0 20px var(--terminal-green);
  }
  92% {
    transform: translate(2px, -2px);
    text-shadow:
      -2px 0 var(--terminal-green),
      2px 0 #00ffff,
      0 0 20px var(--terminal-green);
  }
  93% {
    transform: translate(0);
    text-shadow:
      0 0 5px var(--terminal-green),
      0 0 10px var(--terminal-green),
      0 0 15px var(--terminal-green),
      0 0 20px var(--terminal-green);
  }
}

/* Fade In Animation */
.fade-in-element {
  opacity: 0;
  animation: fade-in 1s ease forwards;
}

.fade-in-element:nth-child(2) {
  animation-delay: 0.3s;
}

.fade-in-element:nth-child(3) {
  animation-delay: 0.6s;
}

.fade-in-element:nth-child(4) {
  animation-delay: 0.9s;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Packet Glitch Display */
.packet-glitch {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--terminal-green);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  transition: opacity 0.2s ease;
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scanline-overlay {
    animation: none;
    opacity: 0.05;
  }

  .terminal-glow {
    animation: none;
  }
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .terminal-glow {
    text-shadow:
      0 0 3px var(--terminal-green),
      0 0 6px var(--terminal-green),
      0 0 9px var(--terminal-green);
  }

  .waveform-monitor path,
  .pcb-circuit .trace {
    stroke-width: 1.5;
  }
}

/* Coming Soon Display */
.coming-soon-display {
  background: #000000;
  border: 1px solid rgba(0, 255, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.coming-soon-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 255, 0, 0.1) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.coming-soon-display span {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    text-shadow:
      0 0 10px var(--terminal-green),
      0 0 20px var(--terminal-green),
      0 0 30px var(--terminal-green);
  }
  50% {
    opacity: 0.7;
    text-shadow:
      0 0 5px var(--terminal-green),
      0 0 10px var(--terminal-green),
      0 0 15px var(--terminal-green);
  }
}

/* Capability Item Animation */
.capability-item {
  opacity: 0;
  animation: slide-in-left 0.6s ease forwards;
}

.capability-item:nth-child(1) { animation-delay: 0.1s; }
.capability-item:nth-child(2) { animation-delay: 0.2s; }
.capability-item:nth-child(3) { animation-delay: 0.3s; }
.capability-item:nth-child(4) { animation-delay: 0.4s; }
.capability-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Performance Optimizations */
.waveform-monitor,
.pcb-circuit,
.terminal-border {
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
