/* ARAx Technologies - Technology-Inspired Animations */
/* Advanced animations for modern tech website */

/* Keyframe Animations */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tech-Inspired Animations */
@keyframes glitch {
  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);
  }
}

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

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

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

/* Matrix-style digital rain effect */
@keyframes matrix {
  0% {
    transform: translateY(-100vh);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* Circuit board line animation */
@keyframes circuit {
  0% {
    stroke-dashoffset: 1000;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Hologram effect */
@keyframes hologram {
  0%, 100% {
    opacity: 0.8;
    transform: translateY(0);
  }
  25% {
    opacity: 0.9;
    transform: translateY(-2px);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
  75% {
    opacity: 0.9;
    transform: translateY(-2px);
  }
}

/* Animation Classes */
.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-fade-in-right {
  animation: fadeInRight 0.8s ease-out forwards;
}

.animate-scale-in {
  animation: scaleIn 0.6s ease-out forwards;
}

.animate-slide-down {
  animation: slideDown 0.5s ease-out forwards;
}

.animate-glitch {
  animation: glitch 0.3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-rotate {
  animation: rotate 2s linear infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-hologram {
  animation: hologram 2s ease-in-out infinite;
}

/* Staggered Animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Floating cards should be visible and animate properly */
.floating-card {
  opacity: 1;
  animation-fill-mode: forwards;
}

/* Smooth initial state for all animated elements */
[class*="animate-"],
[class*="stagger-"] {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
}

/* Only hide elements that have explicit animation classes */
.animate-fade-in-up:not(.revealed),
.animate-fade-in-left:not(.revealed),
.animate-fade-in-right:not(.revealed),
.animate-scale-in:not(.revealed),
.animate-slide-down:not(.revealed) {
  opacity: 0;
}

/* Portfolio and project sections smoothness */
.portfolio-grid .portfolio-item,
.services-grid .service-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.portfolio-grid .portfolio-item.revealed,
.services-grid .service-card.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Loading Animations */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 212, 255, 0.3);
  border-top: 3px solid var(--accent-blue);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
  margin: 0 auto;
  display: block;
}

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Page Transition Effects */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-background);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease-in-out;
}

.page-transition.active {
  opacity: 1;
  visibility: visible;
}

.page-transition-content {
  text-align: center;
  color: var(--text-white);
}

/* Tech Grid Background Animation */
.tech-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.1;
  background-image: 
    linear-gradient(rgba(0, 212, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: float 20s ease-in-out infinite;
}

/* Circuit Lines Animation */
@keyframes circuit {
  0% {
    stroke-dashoffset: 1000;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.circuit-line {
  stroke: var(--accent-blue);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: circuit 3s ease-in-out forwards;
}

.circuit-line:nth-child(2) {
  animation-delay: 0.5s;
}

/* Typewriter Effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent-blue);
  white-space: nowrap;
  animation: 
    typewriter 3s steps(40, end),
    blink 0.75s step-end infinite;
}

/* Scroll Reveal Animation */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  will-change: opacity, transform;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Hover Effects */
.hover-glow {
  transition: all var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
  transform: translateY(-2px);
}

.hover-scale {
  transition: transform var(--transition-normal);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Circuit Lines Animation */
.circuit-line {
  stroke: var(--accent-blue);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: circuit 3s ease-in-out forwards;
}

/* Matrix Background Effect */
.matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.matrix-char {
  position: absolute;
  color: var(--accent-blue);
  font-family: var(--font-code);
  font-size: 14px;
  opacity: 0.3;
  animation: matrix 10s linear infinite;
}

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

@media (max-width: 768px) {
  .animate-fade-in-up,
  .animate-fade-in-left,
  .animate-fade-in-right {
    animation-duration: 0.6s;
  }
  
  .tech-grid {
    background-size: 30px 30px;
  }
}
