/* ============================================
   ENHANCED ANIMATIONS & INTERACTIVE FEATURES
   ============================================ */

/* Smooth scroll reveal with better timing */
.content-block {
  --reveal-delay: 0ms;
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.content-block.visible {
  animation: slideInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Staggered animation for child elements */
.content-block.visible .block-title {
  animation: fadeInLeft 0.6s ease-out 0.2s both;
}

.content-block.visible .block-content {
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.content-block.visible .data-table-wrapper,
.content-block.visible .rating-cards {
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced table row animations */
.data-table tbody tr {
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.content-block.visible .data-table tbody tr {
  animation: slideInRow 0.4s ease-out forwards;
}

.content-block.visible .data-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.content-block.visible .data-table tbody tr:nth-child(2) { animation-delay: 0.15s; }
.content-block.visible .data-table tbody tr:nth-child(3) { animation-delay: 0.2s; }
.content-block.visible .data-table tbody tr:nth-child(4) { animation-delay: 0.25s; }
.content-block.visible .data-table tbody tr:nth-child(5) { animation-delay: 0.3s; }
.content-block.visible .data-table tbody tr:nth-child(6) { animation-delay: 0.35s; }
.content-block.visible .data-table tbody tr:nth-child(7) { animation-delay: 0.4s; }
.content-block.visible .data-table tbody tr:nth-child(8) { animation-delay: 0.45s; }
.content-block.visible .data-table tbody tr:nth-child(9) { animation-delay: 0.5s; }
.content-block.visible .data-table tbody tr:nth-child(10) { animation-delay: 0.55s; }
.content-block.visible .data-table tbody tr:nth-child(11) { animation-delay: 0.6s; }
.content-block.visible .data-table tbody tr:nth-child(12) { animation-delay: 0.65s; }
.content-block.visible .data-table tbody tr:nth-child(13) { animation-delay: 0.7s; }

@keyframes slideInRow {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Rating cards hover effect */
.rating-card {
  position: relative;
  overflow: hidden;
}

.rating-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100, 160, 255, 0.2), transparent);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.rating-card:hover::before {
  width: 300px;
  height: 300px;
}

.rating-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(100, 160, 255, 0.4);
  box-shadow: 0 12px 30px rgba(100, 160, 255, 0.25);
}

/* Enhanced table hover effects */
.data-table tbody tr {
  position: relative;
}

.data-table tbody tr::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, #64a0ff, #64ffb4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.data-table tbody tr:hover::after {
  opacity: 1;
}

.data-table tbody tr:hover {
  background: rgba(100, 160, 255, 0.12);
  transform: translateX(4px);
}

/* Medal colors with glow effect */
.medal-gold {
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.medal-silver {
  text-shadow: 0 0 8px rgba(192, 192, 192, 0.5);
}

.medal-bronze {
  text-shadow: 0 0 8px rgba(205, 127, 50, 0.5);
}

/* Parallax effect for hero section */
.hero-section {
  position: relative;
}

.hero-title {
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% {
    text-shadow: 0 0 15px rgba(100, 150, 255, 0.5),
                 0 0 30px rgba(100, 150, 255, 0.3);
  }
  100% {
    text-shadow: 0 0 25px rgba(100, 150, 255, 0.8),
                 0 0 50px rgba(100, 150, 255, 0.5),
                 0 0 75px rgba(100, 150, 255, 0.3);
  }
}

/* Gradient text animation that transitions to emoji - applies to ALL block-icons */
.block-icon {
  display: inline-block;
  position: relative;
  background: linear-gradient(90deg, #74b3ff, #64ffb4, #b064ff, #74b3ff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 2.5s ease infinite, revealEmoji 1s ease 3.5s forwards;
  opacity: 0.9;
  transform: scale(0.9);
  filter: blur(0.5px);
}

@keyframes gradientShift {
  0%, 100% { 
    background-position: 0% 50%;
    filter: blur(0.5px);
  }
  50% { 
    background-position: 100% 50%;
    filter: blur(1px);
  }
}

@keyframes revealEmoji {
  0% {
    opacity: 0.9;
    transform: scale(0.9);
    filter: blur(0.5px);
    -webkit-text-fill-color: transparent;
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0px);
    -webkit-text-fill-color: unset;
    background: none;
    background-clip: unset;
    -webkit-background-clip: unset;
  }
}

/* Smooth number counter animation */
.highlight-cell,
.total-cell {
  transition: all 0.3s ease;
}

/* Enhanced content block borders */
.content-block {
  position: relative;
  z-index: 1;
}

.content-block::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 25px;
  padding: 1px;
  background: linear-gradient(135deg, 
    rgba(100, 160, 255, 0.5) 0%,
    rgba(100, 255, 180, 0.3) 50%,
    rgba(176, 100, 255, 0.5) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  pointer-events: none;
}

.content-block:hover::after {
  opacity: 1;
}

/* Ensure all links are clickable */
a {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.project-card a,
.content-block a {
  z-index: 20;
}

/* Scroll progress indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #64a0ff, #64ffb4, #b064ff);
  z-index: 1000;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(100, 160, 255, 0.5);
}

/* Floating animation for icons */
.block-icon {
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Enhanced project cards */
.project-card {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.project-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(100, 160, 255, 0.1),
    transparent 30%,
    transparent,
    rgba(100, 255, 180, 0.1),
    transparent 60%,
    transparent,
    rgba(176, 100, 255, 0.1),
    transparent
  );
  animation: rotate 8s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
  pointer-events: none;
}

.project-card:hover::before {
  opacity: 1;
}

.project-card > * {
  position: relative;
  z-index: 2;
}

.project-card a {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

/* Cursor trail effect (desktop only) */
@media (min-width: 1024px) {
  .cursor-trail {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(100, 160, 255, 0.6), transparent);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: screen;
    animation: fadeOut 0.5s ease-out forwards;
  }

  @keyframes fadeOut {
    to {
      opacity: 0;
      transform: scale(0);
    }
  }
}

/* Smooth transitions for all interactive elements */
a, button, .tech-item, .project-link {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced focus states */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #64a0ff;
  outline-offset: 4px;
  border-radius: 4px;
}

/* Loading shimmer effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Desktop-specific enhancements */
@media (min-width: 1024px) {
  .content-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 50px;
  }

  /* Larger blocks on desktop */
  .content-block {
    padding: 40px 45px;
  }

  /* Better spacing for tables */
  .data-table-wrapper {
    margin-top: 2rem;
  }

  /* Enhanced hover effects on desktop */
  .content-block:hover {
    transform: translateY(-10px) scale(1.01);
  }
  
  /* Better table sizing on desktop */
  .data-table {
    font-size: 1rem;
  }
  
  .data-table th,
  .data-table td {
    padding: 1rem 1.25rem;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
  .content-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 35px;
  }
}

/* Performance optimizations */
.content-block,
.data-table,
.rating-card {
  will-change: transform, opacity;
}

.content-block.visible {
  will-change: auto;
}

