/* Custom Effects and Animations for Hugo Blog */

/* ============================================
   Smooth Scroll Behavior
   ============================================ */
html {
  scroll-behavior: smooth;
}

/* ============================================
   Fade-in Animation for Post Entries
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-entry {
  animation: fadeInUp 0.6s ease-out;
}

/* Stagger animation for multiple entries */
.post-entry:nth-child(1) { animation-delay: 0.1s; }
.post-entry:nth-child(2) { animation-delay: 0.2s; }
.post-entry:nth-child(3) { animation-delay: 0.3s; }
.post-entry:nth-child(4) { animation-delay: 0.4s; }
.post-entry:nth-child(5) { animation-delay: 0.5s; }

/* ============================================
   Hover Effects for Links
   ============================================ */
.post-entry a,
.post-content a {
  transition: all 0.3s ease;
  position: relative;
}

.post-entry a:hover,
.post-content a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Underline animation effect */
.post-content a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

.post-content a:hover::after {
  width: 100%;
}

/* ============================================
   Code Block Enhancements
   ============================================ */
.post-content pre {
  position: relative;
  overflow-x: auto;
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-content pre:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Image Zoom Effect
   ============================================ */
.post-content img {
  transition: transform 0.3s ease;
  border-radius: 8px;
}

.post-content img:hover {
  transform: scale(1.02);
  cursor: zoom-in;
}

/* ============================================
   Typography Animations
   ============================================ */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Use this class in your templates for typewriter effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--primary);
  white-space: nowrap;
  animation: typewriter 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--primary);
  }
}

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

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

/* ============================================
   Pulse Animation
   ============================================ */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* ============================================
   Gradient Text Effect
   ============================================ */
.gradient-text {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   Card Hover Effects
   ============================================ */
.post-entry {
  transition: all 0.3s ease;
}

.post-entry:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Loading Skeleton (for async content)
   ============================================ */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--code-bg) 0%,
    var(--tertiary) 50%,
    var(--code-bg) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ============================================
   Dark Mode Transitions
   ============================================ */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   Custom Scrollbar (optional)
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--theme);
}

::-webkit-scrollbar-thumb {
  background: var(--tertiary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}

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







