/* 
 * Sprout Advocates - Enhanced Approach Section Styles
 * Implements interactive background changes, animations, and case studies
 */

/* Approach Section Base Styles */
.case-timeline {
  position: relative;
  overflow: hidden;
  padding: var(--spacing-xl) 0;
  transition: background-color 0.8s ease;
}

/* Background color transitions for different steps */
.case-timeline.step-1-active {
  background-color: rgba(26, 77, 128, 0.05); /* Light blue */
}

.case-timeline.step-2-active {
  background-color: rgba(30, 102, 66, 0.05); /* Light green */
}

.case-timeline.step-3-active {
  background-color: rgba(26, 77, 128, 0.1); /* Medium blue */
}

.case-timeline.step-4-active {
  background-color: rgba(30, 102, 66, 0.1); /* Medium green */
}

.case-timeline.step-5-active {
  background-color: rgba(26, 77, 128, 0.15); /* Darker blue */
}

/* Timeline container with enhanced styling */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-xl) 0;
}

.timeline:before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: linear-gradient(to bottom, 
    var(--primary-blue),
    var(--primary-green),
    var(--primary-blue),
    var(--primary-green),
    var(--primary-blue)
  );
  transform: translateX(-50%);
  z-index: 1;
}

/* Timeline items with enhanced interactions */
.timeline-item {
  position: relative;
  margin-bottom: var(--spacing-xl);
  width: 50%;
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.timeline-item:nth-child(even) {
  margin-left: 50%;
  transform: translateX(50px);
}

.timeline-item:nth-child(even).visible {
  transform: translateX(0);
}

/* Active state for timeline items */
.timeline-item.active .timeline-icon {
  transform: scale(1.2);
  background-color: var(--primary-green);
  box-shadow: 0 0 15px rgba(30, 102, 66, 0.5);
}

.timeline-item.active .timeline-content {
  transform: translateY(-5px);
  box-shadow: var(--box-shadow-hover);
  border-color: var(--primary-green);
}

/* Timeline icons with enhanced animations */
.timeline-icon {
  position: absolute;
  top: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-white);
  font-size: 1.2rem;
  z-index: 2;
  transition: transform 0.5s ease, background-color 0.5s ease, box-shadow 0.5s ease;
  border: 2px solid transparent;
}

.timeline-item:hover .timeline-icon {
  transform: scale(1.1);
}

.timeline-item:nth-child(odd) .timeline-icon {
  right: -25px;
}

.timeline-item:nth-child(even) .timeline-icon {
  left: -25px;
}

/* Timeline content with enhanced animations */
.timeline-content {
  padding: var(--spacing-lg);
  background-color: var(--primary-white);
  border-radius: var(--border-radius-md);
  box-shadow: var(--box-shadow);
  position: relative;
  transition: transform 0.5s ease, box-shadow 0.5s ease, border-color 0.5s ease;
  border: 1px solid var(--medium-gray);
}

.timeline-item:hover .timeline-content {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.timeline-item:nth-child(odd) .timeline-content {
  margin-right: var(--spacing-xl);
}

.timeline-item:nth-child(even) .timeline-content {
  margin-left: var(--spacing-xl);
}

.timeline-content:before {
  content: '';
  position: absolute;
  top: 15px;
  width: 20px;
  height: 20px;
  background-color: var(--primary-white);
  transform: rotate(45deg);
  transition: background-color 0.5s ease;
  border: 1px solid var(--medium-gray);
}

.timeline-item:hover .timeline-content:before {
  background-color: var(--light-green);
}

.timeline-item:nth-child(odd) .timeline-content:before {
  right: -10px;
  border-top: none;
  border-left: none;
}

.timeline-item:nth-child(even) .timeline-content:before {
  left: -10px;
  border-bottom: none;
  border-right: none;
}

/* Timeline content animations */
.timeline-item h3 {
  position: relative;
  margin-bottom: var(--spacing-sm);
  transition: transform 0.5s ease;
}

.timeline-item.active h3 {
  transform: translateY(-3px);
}

.timeline-item h3:after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-green);
  transition: width 0.5s ease;
}

.timeline-item.active h3:after {
  width: 50px;
}

.timeline-item p {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.timeline-item.active p {
  opacity: 1;
  transform: translateY(0);
}

/* Case Study Examples */
.case-study {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-sm);
  border-top: 1px dashed var(--light-gray);
  font-size: 0.9rem;
  display: none;
}

.timeline-item.active .case-study {
  display: block;
  animation: fadeIn 0.5s ease forwards;
}

.case-study-title {
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 5px;
}

.case-study-description {
  color: var(--dark-gray);
  font-style: italic;
}

/* Client Testimonial */
.approach-testimonial {
  font-size: 0.85rem;
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  background-color: rgba(30, 102, 66, 0.05);
  border-radius: var(--border-radius-sm);
  border-left: 3px solid var(--primary-green);
  display: none;
}

.timeline-item.active .approach-testimonial {
  display: block;
  animation: fadeIn 0.5s ease forwards 0.3s;
}

.approach-testimonial-text {
  font-style: italic;
  color: var(--dark-gray);
  margin-bottom: 5px;
}

.approach-testimonial-author {
  font-weight: 600;
  color: var(--primary-green);
  text-align: right;
}

/* Background patterns for each step */
.pattern-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
  z-index: 0;
}

.pattern-overlay-1 {
  background: radial-gradient(circle at 20% 30%, rgba(26, 77, 128, 0.05) 0%, transparent 70%);
}

.pattern-overlay-2 {
  background: radial-gradient(circle at 80% 40%, rgba(30, 102, 66, 0.05) 0%, transparent 70%);
}

.pattern-overlay-3 {
  background: linear-gradient(135deg, rgba(26, 77, 128, 0.05) 0%, transparent 70%);
}

.pattern-overlay-4 {
  background: linear-gradient(45deg, rgba(30, 102, 66, 0.05) 0%, transparent 70%);
}

.pattern-overlay-5 {
  background: radial-gradient(circle at 50% 50%, rgba(26, 77, 128, 0.08) 0%, transparent 70%);
}

.case-timeline.step-1-active .pattern-overlay-1,
.case-timeline.step-2-active .pattern-overlay-2,
.case-timeline.step-3-active .pattern-overlay-3,
.case-timeline.step-4-active .pattern-overlay-4,
.case-timeline.step-5-active .pattern-overlay-5 {
  opacity: 1;
}

/* Floating elements for visual interest */
.floating-element {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.8s ease, transform 3s ease;
  pointer-events: none;
}

.floating-element-1 {
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(26, 77, 128, 0.1) 0%, transparent 70%);
  top: 20%;
  left: 10%;
}

.floating-element-2 {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(30, 102, 66, 0.1) 0%, transparent 70%);
  top: 40%;
  right: 10%;
}

.floating-element-3 {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(26, 77, 128, 0.1) 0%, transparent 70%);
  bottom: 30%;
  left: 15%;
}

.floating-element-4 {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(30, 102, 66, 0.1) 0%, transparent 70%);
  bottom: 20%;
  right: 15%;
}

.case-timeline.step-1-active .floating-element-1,
.case-timeline.step-2-active .floating-element-2,
.case-timeline.step-3-active .floating-element-3,
.case-timeline.step-4-active .floating-element-4,
.case-timeline.step-5-active .floating-element-1 {
  opacity: 1;
  animation: float 8s infinite ease-in-out;
}

@keyframes float {
  0% {
    transform: translateY(0) translateX(0);
  }
  25% {
    transform: translateY(-10px) translateX(5px);
  }
  50% {
    transform: translateY(0) translateX(10px);
  }
  75% {
    transform: translateY(10px) translateX(5px);
  }
  100% {
    transform: translateY(0) translateX(0);
  }
}

/* Progress indicator */
.approach-progress {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.approach-progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--medium-gray);
  transition: background-color 0.5s ease, transform 0.5s ease;
  cursor: pointer;
  border: 1px solid var(--dark-gray);
}

.approach-progress-dot:hover {
  transform: scale(1.2);
}

.approach-progress-dot.active {
  background-color: var(--primary-green);
  transform: scale(1.2);
  box-shadow: 0 0 5px rgba(30, 102, 66, 0.5);
}

/* Horizontal timeline for mobile */
.timeline-horizontal {
  display: none;
  overflow-x: auto;
  white-space: nowrap;
  padding: var(--spacing-md) 0;
  margin-bottom: var(--spacing-md);
}

.timeline-horizontal-item {
  display: inline-block;
  width: 250px;
  margin-right: var(--spacing-md);
  vertical-align: top;
}

.timeline-horizontal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-white);
  margin: 0 auto var(--spacing-sm);
}

.timeline-horizontal-content {
  padding: var(--spacing-md);
  background-color: var(--primary-white);
  border-radius: var(--border-radius-md);
  box-shadow: var(--box-shadow);
  border: 1px solid var(--light-gray);
}

.timeline-horizontal-content h3 {
  font-size: 1rem;
  margin-bottom: var(--spacing-sm);
}

.timeline-horizontal-content p {
  font-size: 0.9rem;
  white-space: normal;
}

/* Responsive styles */
@media (max-width: 992px) {
  .approach-progress {
    display: none;
  }
}

@media (max-width: 768px) {
  .timeline {
    display: none;
  }
  
  .timeline-horizontal {
    display: block;
  }
  
  .timeline:before {
    left: 30px;
  }
  
  .timeline-item {
    width: 100%;
    margin-left: 0;
    padding-left: 60px;
  }
  
  .timeline-item:nth-child(even) {
    margin-left: 0;
  }
  
  .timeline-icon {
    left: 5px !important;
    right: auto !important;
  }
  
  .timeline-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  .timeline-item:nth-child(odd) .timeline-content:before,
  .timeline-item:nth-child(even) .timeline-content:before {
    display: none;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .timeline-item,
  .timeline-item:nth-child(even),
  .timeline-icon,
  .timeline-content,
  .floating-element,
  .pattern-overlay {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  
  .timeline-item.visible,
  .timeline-item:nth-child(even).visible {
    transform: none !important;
  }
  
  .timeline-item:hover .timeline-content,
  .timeline-item.active .timeline-content {
    transform: none !important;
  }
  
  .timeline-item.active h3 {
    transform: none !important;
  }
}

@media (forced-colors: active) {
  .timeline:before {
    background: currentColor;
  }
  
  .timeline-icon {
    border: 2px solid currentColor;
  }
  
  .timeline-content {
    border: 2px solid currentColor;
  }
}
