/* Enhanced Animations and Interactions */

/* ===== Loading Animation ===== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loader-text {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-primary);
  letter-spacing: 4px;
}

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

/* ===== Scroll Reveal Animations ===== */
/* Only apply reveal animations after page load to prevent flash */
.reveal {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal:not(.active) {
  opacity: 0;
  transform: translateY(30px);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-left:not(.active) {
  opacity: 0;
  transform: translateX(-30px);
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-right:not(.active) {
  opacity: 0;
  transform: translateX(30px);
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-scale:not(.active) {
  opacity: 0;
  transform: scale(0.9);
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* Stagger animation delays */
.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; }

/* ===== Typing Animation Enhancement ===== */
.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background-color: currentColor;
  margin-left: 5px;
  animation: blink 0.7s infinite;
}

/* ===== Hover Glow Effect ===== */
.glow-on-hover {
  position: relative;
  transition: all 0.3s ease;
}

.glow-on-hover::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #2563eb, #06b6d4, #2563eb);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  filter: blur(10px);
}

.glow-on-hover:hover::before {
  opacity: 0.7;
}

/* ===== Floating Animation ===== */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* ===== Pulse Animation ===== */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

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

/* ===== Shimmer Effect ===== */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ===== Slide In Animations ===== */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===== Bounce Animation ===== */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

.bounce-animation {
  animation: bounce 2s infinite;
}

/* ===== Rotate Animation ===== */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotate-animation {
  animation: rotate 20s linear infinite;
}

/* ===== Gradient Animation ===== */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-animation {
  background-size: 200% 200%;
  animation: gradientShift 5s ease infinite;
}

/* ===== Skill Bar Animation ===== */
@keyframes fillBar {
  from {
    width: 0;
  }
}

.skills__bar.animate::after {
  animation: fillBar 1.5s ease-out forwards;
}

/* ===== Card Entrance Animation ===== */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-entrance {
  animation: cardEntrance 0.6s ease-out forwards;
}

/* ===== Ripple Effect ===== */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 300px;
  height: 300px;
}

/* ===== Text Gradient Animation ===== */
.text-gradient {
  background: linear-gradient(90deg, #2563eb, #06b6d4, #2563eb);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s linear infinite;
}

/* ===== Progress Ring Animation ===== */
@keyframes progressRing {
  from {
    stroke-dashoffset: 283;
  }
}

.progress-ring__circle {
  transition: stroke-dashoffset 1s ease-out;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* ===== Underline Animation ===== */
.underline-animation {
  position: relative;
  display: inline-block;
}

.underline-animation::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  transition: width 0.3s ease;
}

.underline-animation:hover::after {
  width: 100%;
}

/* ===== Smooth Scroll Behavior ===== */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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

