/* Cyberpunk Animations and Effects for Matthew Kobilan's Website */

/* Glitch Effect */
.glitch-effect {
  position: relative;
  display: inline-block;
}

.glitch-effect::before,
.glitch-effect::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

.glitch-effect::before {
  left: 2px;
  text-shadow: -1px 0 #ff00ea;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim-1 5s infinite linear alternate-reverse;
}

.glitch-effect::after {
  left: -2px;
  text-shadow: 1px 0 #00dbff;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim-2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% {
    clip: rect(19px, 9999px, 52px, 0);
  }
  5% {
    clip: rect(52px, 9999px, 94px, 0);
  }
  10% {
    clip: rect(89px, 9999px, 59px, 0);
  }
  15% {
    clip: rect(91px, 9999px, 98px, 0);
  }
  20% {
    clip: rect(6px, 9999px, 46px, 0);
  }
  25% {
    clip: rect(95px, 9999px, 4px, 0);
  }
  30% {
    clip: rect(65px, 9999px, 89px, 0);
  }
  35% {
    clip: rect(84px, 9999px, 73px, 0);
  }
  40% {
    clip: rect(26px, 9999px, 23px, 0);
  }
  45% {
    clip: rect(56px, 9999px, 44px, 0);
  }
  50% {
    clip: rect(33px, 9999px, 23px, 0);
  }
  55% {
    clip: rect(89px, 9999px, 11px, 0);
  }
  60% {
    clip: rect(36px, 9999px, 13px, 0);
  }
  65% {
    clip: rect(23px, 9999px, 76px, 0);
  }
  70% {
    clip: rect(24px, 9999px, 67px, 0);
  }
  75% {
    clip: rect(95px, 9999px, 35px, 0);
  }
  80% {
    clip: rect(9px, 9999px, 10px, 0);
  }
  85% {
    clip: rect(39px, 9999px, 9px, 0);
  }
  90% {
    clip: rect(31px, 9999px, 65px, 0);
  }
  95% {
    clip: rect(89px, 9999px, 67px, 0);
  }
  100% {
    clip: rect(23px, 9999px, 91px, 0);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip: rect(87px, 9999px, 29px, 0);
  }
  5% {
    clip: rect(28px, 9999px, 16px, 0);
  }
  10% {
    clip: rect(35px, 9999px, 46px, 0);
  }
  15% {
    clip: rect(67px, 9999px, 34px, 0);
  }
  20% {
    clip: rect(89px, 9999px, 79px, 0);
  }
  25% {
    clip: rect(5px, 9999px, 80px, 0);
  }
  30% {
    clip: rect(28px, 9999px, 23px, 0);
  }
  35% {
    clip: rect(89px, 9999px, 81px, 0);
  }
  40% {
    clip: rect(4px, 9999px, 63px, 0);
  }
  45% {
    clip: rect(31px, 9999px, 12px, 0);
  }
  50% {
    clip: rect(34px, 9999px, 95px, 0);
  }
  55% {
    clip: rect(61px, 9999px, 66px, 0);
  }
  60% {
    clip: rect(23px, 9999px, 27px, 0);
  }
  65% {
    clip: rect(46px, 9999px, 65px, 0);
  }
  70% {
    clip: rect(72px, 9999px, 65px, 0);
  }
  75% {
    clip: rect(12px, 9999px, 23px, 0);
  }
  80% {
    clip: rect(20px, 9999px, 94px, 0);
  }
  85% {
    clip: rect(13px, 9999px, 55px, 0);
  }
  90% {
    clip: rect(58px, 9999px, 9px, 0);
  }
  95% {
    clip: rect(56px, 9999px, 39px, 0);
  }
  100% {
    clip: rect(18px, 9999px, 30px, 0);
  }
}

/* Neon pulse effect */
.neon-pulse {
  animation: neon-pulse 2s infinite;
}

@keyframes neon-pulse {
  0% {
    text-shadow: 0 0 5px rgba(255, 105, 180, 0.8),
                 0 0 10px rgba(255, 105, 180, 0.6),
                 0 0 15px rgba(255, 105, 180, 0.4);
  }
  50% {
    text-shadow: 0 0 10px rgba(255, 105, 180, 1),
                 0 0 20px rgba(255, 105, 180, 0.8),
                 0 0 30px rgba(255, 105, 180, 0.6);
  }
  100% {
    text-shadow: 0 0 5px rgba(255, 105, 180, 0.8),
                 0 0 10px rgba(255, 105, 180, 0.6),
                 0 0 15px rgba(255, 105, 180, 0.4);
  }
}

/* Scroll animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animation for children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.animate-in > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.animate-in > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.animate-in > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.animate-in > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.animate-in > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.animate-in > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-children.animate-in > *:nth-child(7) { transition-delay: 0.7s; }
.stagger-children.animate-in > *:nth-child(8) { transition-delay: 0.8s; }

.stagger-children.animate-in > * {
  opacity: 1;
  transform: translateY(0);
}

/* Typing animation */
.typing-animation {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid #ff69b4;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: #ff69b4 }
}

/* 3D hover effect */
.hover-3d {
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
}

.hover-3d:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Scanline effect for terminal */
.scanline {
  position: relative;
  overflow: hidden;
}

.scanline::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  background: rgba(96, 165, 250, 0.3);
  animation: scanline 6s linear infinite;
  pointer-events: none;
}

@keyframes scanline {
  0% {
    top: 0%;
  }
  100% {
    top: 100%;
  }
}

/* Cyberpunk button effect */
.cyber-button {
  position: relative;
  background: transparent;
  border: 2px solid #ff69b4;
  color: white;
  padding: 10px 20px;
  font-family: 'Roboto Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.cyber-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 105, 180, 0.4), transparent);
  transition: all 0.3s ease;
}

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

.cyber-button:hover {
  box-shadow: 0 0 10px #ff69b4, 0 0 20px #ff69b4;
  background: rgba(255, 105, 180, 0.1);
}

/* Terminal styling */
.terminal-container {
  font-family: 'Roboto Mono', monospace;
  background-color: #0f1419;
  border: 1px solid #ff69b4;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
  overflow: hidden;
  transition: all 0.3s ease;
}

.terminal-container:hover {
  box-shadow: 0 0 15px rgba(255, 105, 180, 0.8);
}

.terminal-header {
  background-color: #1a1d21;
  padding: 5px 10px;
  display: flex;
  align-items: center;
}

.terminal-output {
  padding: 10px;
  height: 200px;
  overflow-y: auto;
  color: #48bb78;
}

.terminal-input-container {
  display: flex;
  padding: 5px 10px;
  background-color: #1a1d21;
}

.terminal-prompt {
  color: #ff69b4;
  margin-right: 5px;
}

.terminal-input {
  background: transparent;
  border: none;
  color: white;
  flex-grow: 1;
  font-family: 'Roboto Mono', monospace;
  outline: none;
}

/* Matrix rain effect container */
.matrix-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

/* Holographic card effect */
.holographic-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background-color: rgba(15, 23, 42, 0.8);
}

.holographic-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 0%,
    rgba(255, 105, 180, 0.1) 30%,
    rgba(96, 165, 250, 0.1) 40%,
    rgba(167, 139, 250, 0.1) 50%,
    rgba(96, 165, 250, 0.1) 60%,
    rgba(255, 105, 180, 0.1) 70%,
    transparent 100%
  );
  transform: rotate(45deg);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.holographic-card:hover::before {
  opacity: 1;
  animation: holographic-shift 2s linear infinite;
}

@keyframes holographic-shift {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

/* Data corruption effect */
.data-corruption {
  position: relative;
  display: inline-block;
}

.data-corruption::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: inherit;
  transform: translateX(0);
  opacity: 0;
}

.data-corruption:hover::after {
  animation: data-corrupt 0.5s steps(2) infinite;
}

@keyframes data-corrupt {
  0% {
    clip-path: inset(50% 0 30% 0);
    transform: translateX(-2px);
    opacity: 0.7;
  }
  20% {
    clip-path: inset(20% 0 60% 0);
    transform: translateX(2px);
    opacity: 0.7;
  }
  40% {
    clip-path: inset(80% 0 5% 0);
    transform: translateX(-2px);
    opacity: 0.7;
  }
  60% {
    clip-path: inset(10% 0 85% 0);
    transform: translateX(2px);
    opacity: 0.7;
  }
  80% {
    clip-path: inset(40% 0 43% 0);
    transform: translateX(-2px);
    opacity: 0.7;
  }
  100% {
    clip-path: inset(5% 0 70% 0);
    transform: translateX(2px);
    opacity: 0.7;
  }
}

/* Darknet Binary Overlay */
.darknet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
}

.darknet-binary {
  position: absolute;
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  color: rgba(255, 0, 0, 0.7);
  white-space: nowrap;
  animation: binary-fall 5s linear infinite;
}

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

/* Neonstorm Rain Effect for 1s and 0s */
.neonstorm-rain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  background: transparent;
}

.neonstorm-rain-bit {
  position: absolute;
  top: -10%;
  width: 20px;
  height: 20px;
  color: #ff00ea; /* Brighter neon pink */
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  text-align: center;
  text-shadow: 0 0 5px #ff00ea, 0 0 10px #ff00ea, 0 0 20px #ff00ea, 0 0 40px #ff00ea, 0 0 80px #ff00ea; /* neon-glow-intense */
  animation: neonstorm-fall 2s linear infinite, neon-pulse 1s infinite;
  will-change: transform;
}

@keyframes neonstorm-fall {
  0% { transform: translateY(-10%); opacity: 1; }
  100% { transform: translateY(110vh); opacity: 0.5; }
}

/* Decrypt Overlay */
.decrypt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10;
  pointer-events: none;
}

.decrypt-message {
  font-family: 'Roboto Mono', monospace;
  font-size: 24px;
  color: var(--neon-pink);
  border: 2px solid var(--neon-pink);
  padding: 20px;
  text-align: center;
  max-width: 600px;
  box-shadow: 0 0 10px var(--neon-pink);
}

/* Matrix Rain Overlay */
.matrix-rain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.matrix-rain-stream {
  position: absolute;
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  color: #48bb78;
  white-space: nowrap;
  animation: matrix-fall 4s linear infinite;
  will-change: transform;
}

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

/* Pulsing Static Overlay */
.synthwave-static-overlay.pulsing {
  animation: pulse-static 2s ease-in-out infinite;
}

@keyframes pulse-static {
  0% { opacity: 0.1; }
  50% { opacity: 0.3; }
  100% { opacity: 0.1; }
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.countdown-message {
  font-family: 'Roboto Mono', monospace;
  font-size: 48px;
  color: var(--neon-pink);
  border: 4px solid var(--neon-blue);
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  box-shadow: 0 0 15px var(--neon-pink), 0 0 30px var(--neon-blue);
  text-align: center;
}