.scroll-section {
  --scroll-progress: 1;
  --scroll-opacity: 1;
  --scroll-scale: 1;
  --scroll-blur: 0px;
  --scroll-shift: 0px;
  position: relative;
  min-height: auto;
  opacity: var(--scroll-opacity);
  transform: translate3d(0, var(--scroll-shift), 0) scale(var(--scroll-scale));
  filter: blur(var(--scroll-blur));
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
  will-change: transform, opacity, filter;
}

.scroll-section::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(11, 18, 32, 0.15) 0%,
    rgba(11, 18, 32, 0.03) 45%,
    rgba(11, 18, 32, 0) 100%
  );
  opacity: calc(1 - var(--scroll-progress));
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 0;
}

.scroll-section > * {
  position: relative;
  z-index: 1;
}

.scroll-section[data-scroll-active="true"] {
  filter: blur(0);
}

/* Desabilitar scroll blur na timeline para evitar conflito com interações */
.timeline-section {
  filter: blur(0) !important;
}

/* Desabilitar blur em seções com interação ou conteúdo importante */
#projects,
#tech-stack,
#recommendations {
  filter: blur(0) !important;
}

@media (max-width: 900px) {
  .scroll-section {
    min-height: auto;
    filter: blur(0) !important;
    transform: none !important;
  }

  .scroll-section::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-section {
    transition: none;
    transform: none;
    filter: none;
  }

  .scroll-section::after {
    display: none;
  }
}

/* Page Transitions */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

/* Loading States */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

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

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

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Micro-interactions */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

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

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* Button Ripple Effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

/* Card Entrance Animations */
.card-entrance {
  animation: fadeInUp 0.6s ease-out forwards;
}

.card-entrance:nth-child(1) { animation-delay: 0.1s; }
.card-entrance:nth-child(2) { animation-delay: 0.2s; }
.card-entrance:nth-child(3) { animation-delay: 0.3s; }
.card-entrance:nth-child(4) { animation-delay: 0.4s; }
.card-entrance:nth-child(5) { animation-delay: 0.5s; }
.card-entrance:nth-child(6) { animation-delay: 0.6s; }

/* Hover Lift Effect */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Glow Effect */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px var(--accent),
                0 0 10px var(--accent),
                0 0 15px var(--accent);
  }
  50% {
    box-shadow: 0 0 10px var(--accent),
                0 0 20px var(--accent),
                0 0 30px var(--accent);
  }
}

.glow-on-hover:hover {
  animation: glow 1.5s ease-in-out infinite;
}

/* Smooth Icon Transitions */
.icon-transition {
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-transition:hover {
  transform: scale(1.2) rotate(10deg);
}

/* Badge Pulse */
@keyframes badge-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.badge-pulse {
  animation: badge-pulse 2s infinite;
}

/* Typing Animation */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

.typing-effect {
  overflow: hidden;
  border-right: 2px solid var(--accent);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end),
             blink 0.75s step-end infinite;
}

/* Stagger Animation Helper */
.stagger-animation > * {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

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

/* Progress Bar Animation */
@keyframes progress-fill {
  from { width: 0; }
}

.progress-animated {
  animation: progress-fill 1.5s ease-out forwards;
}

/* Tooltip Animation */
@keyframes tooltip-appear {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tooltip {
  animation: tooltip-appear 0.3s ease-out;
}

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