/* -----------------------------
   WORK EXPERIENCE SECTION - WITH PROPER ANIMATIONS
   ----------------------------- */
.work{
  position:relative;
  isolation:isolate;
  display:flex;
  flex-direction:column;
  justify-content:center;
  background-color: var(--section-bg, #120431);
  margin-top:-0px;
  overflow:hidden;
  min-height:100vh;
  width:100%;
  max-width:100vw;
  box-sizing:border-box;
}

/* Work Stats Summary */
.work-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-4xl);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: var(--card-radius);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--skills-primary), var(--card-bd-hover), var(--skills-secondary));
  border-radius: var(--card-radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover {
  transform: translateY(-3px);
  background: var(--card-bg);
  border-color: transparent;
}

.stat-card:hover .stat-number {
  background: black;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card:hover .stat-label {
  color: black;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--card-bd-hover);
  margin-bottom: var(--space-xs);
  background: linear-gradient(135deg, var(--card-bd-hover), var(--skills-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Timeline Container */
.timeline-container {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-2xl) 0;
}

/* Timeline Central Line */
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom,
      var(--card-bd-hover),
      var(--skills-primary),
      var(--skills-secondary));
  transform: translateX(-50%);
  opacity: 0.3;
}

/* Timeline Entries */
.timeline-entry {
  position: relative;
  margin-bottom: var(--space-3xl);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: var(--space-2xl);
}

/* Timeline Marker */
.timeline-marker {
  position: relative;
  width: 60px;
  height: 60px;
  background: var(--bg-dark);
  border: 3px solid var(--card-bd-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 0 20px rgba(255, 194, 14, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-entry:hover .timeline-marker {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(255, 194, 14, 0.5);
}

.timeline-icon {
  font-size: 24px;
}

/* Timeline Content Cards - ANIMATION PATTERN (Same as About section) */
.timeline-content {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: var(--card-radius);
  padding: var(--space-xl);
  position: relative;
  transition: all 0.3s ease;
}

/* Position cards based on side */
.timeline-entry[data-side="left"] .timeline-content {
  grid-column: 1;
  text-align: left;
}

.timeline-entry[data-side="right"] .timeline-content {
  grid-column: 3;
  text-align: left;
}

.timeline-entry[data-side="left"] .timeline-marker {
  grid-column: 2;
}

.timeline-entry[data-side="right"] .timeline-marker {
  grid-column: 2;
}

/* Arrow pointing to timeline */
.timeline-entry[data-side="left"] .timeline-content::after,
.timeline-entry[data-side="right"] .timeline-content::before {
  content: '';
  position: absolute;
  top: 30px;
  width: 0;
  height: 0;
  border-style: solid;
}

.timeline-entry[data-side="left"] .timeline-content::after {
  right: -10px;
  border-width: 10px 0 10px 10px;
  border-color: transparent transparent transparent var(--card-bg);
}

.timeline-entry[data-side="right"] .timeline-content::before {
  left: -10px;
  border-width: 10px 10px 10px 0;
  border-color: transparent var(--card-bg) transparent transparent;
}

/* Timeline Content Header */
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.timeline-duration {
  font-size: var(--text-sm);
  color: var(--card-bd-hover);
  font-weight: 600;
}

.timeline-badge {
  background: linear-gradient(135deg, var(--card-bd-hover), var(--skills-primary));
  color: var(--bg-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.timeline-years {
  background: rgba(255, 194, 14, 0.1);
  color: var(--card-bd-hover);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Timeline Title & Organization */
.timeline-title {
  font-size: var(--text-xl);
  color: var(--text);
  margin-bottom: var(--space-sm);
  font-weight: 700;
}

.timeline-org {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-dim);
  font-size: var(--text-base);
  margin-bottom: var(--space-lg);
}

.org-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  opacity: 0.9;
}

/* Accomplishments */
.timeline-accomplishments h4 {
  color: var(--skills-primary);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.timeline-accomplishments ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
}

.timeline-accomplishments li {
  position: relative;
  padding-left: var(--space-xl);
  margin-bottom: var(--space-sm);
  color: var(--text-dim);
  line-height: 1.6;
  font-size: var(--text-sm);
}

.timeline-accomplishments li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--card-bd-hover);
  font-weight: bold;
}

/* Skills Tags */
.timeline-skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.skill-tag {
  background: rgba(0, 174, 239, 0.1);
  color: var(--skills-primary);
  padding: 4px 10px;
  border-radius: 15px;
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid rgba(0, 174, 239, 0.3);
  transition: all 0.3s ease;
}

.skill-tag:hover {
  background: rgba(0, 174, 239, 0.2);
  transform: translateY(-2px);
}

/* Timeline End Marker */
.timeline-end {
  position: relative;
  text-align: center;
  padding-top: var(--space-2xl);
}

.timeline-end-text {
  background: var(--bg-gradient);
  color: var(--text-dim);
  padding: var(--space-sm) var(--space-xl);
  border: 1px solid var(--card-bd);
  border-radius: 25px;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 2px;
  display: inline-block;
}

/* Hover Effects */
.timeline-entry:hover .timeline-content {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(255, 194, 14, 0.1);
  border-color: var(--card-bd-hover);
}

/* ========================================
   STAGGER ANIMATION - EXACT MATCH TO ABOUT SECTION
   ======================================== */

/* When .in-view is added, set initial state and trigger animation */
.work .stagger-animation.in-view .timeline-content {
  opacity: 0;
  transform: translateY(20px);
  animation: timelineFloatIn 0.6s ease forwards;
}

/* Staggered delays for each timeline entry */
.work .timeline-container .stagger-animation:nth-child(2) .timeline-content {
  animation-delay: 0.1s;
}

.work .timeline-container .stagger-animation:nth-child(3) .timeline-content {
  animation-delay: 0.2s;
}

.work .timeline-container .stagger-animation:nth-child(4) .timeline-content {
  animation-delay: 0.3s;
}

.work .timeline-container .stagger-animation:nth-child(5) .timeline-content {
  animation-delay: 0.4s;
}

.work .timeline-container .stagger-animation:nth-child(6) .timeline-content {
  animation-delay: 0.5s;
}

.work .timeline-container .stagger-animation:nth-child(7) .timeline-content {
  animation-delay: 0.6s;
}

.work .timeline-container .stagger-animation:nth-child(8) .timeline-content {
  animation-delay: 0.7s;
}

.work .timeline-container .stagger-animation:nth-child(9) .timeline-content {
  animation-delay: 0.8s;
}

/* Animation keyframes - same as About section */
@keyframes timelineFloatIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .work-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .stat-number {
    font-size: 2rem;
  }

  /* Stack timeline vertically on mobile */
  .timeline-line {
    left: 30px;
  }

  .timeline-entry {
    grid-template-columns: auto 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
  }

  .timeline-marker {
    width: 50px;
    height: 50px;
    grid-column: 1 !important;
  }

  .timeline-content {
    grid-column: 2 !important;
  }

  /* Remove arrows on mobile */
  .timeline-entry[data-side="left"] .timeline-content::after,
  .timeline-entry[data-side="right"] .timeline-content::before {
    display: none;
  }

  /* Add left border indicator */
  .timeline-content::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 25px;
    width: 15px;
    height: 2px;
    background: var(--card-bd);
  }

  .timeline-accomplishments li {
    font-size: var(--text-xs);
    padding-left: var(--space-lg);
  }
  
  /* Disable hover effects on mobile */
  .timeline-entry:hover .timeline-content {
    transform: none;
    box-shadow: none;
  }
  
  .timeline-entry:hover .timeline-marker {
    transform: none;
  }
  
  .stat-card:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  .work-stats {
    grid-template-columns: 1fr;
  }

  .timeline-marker {
    width: 40px;
    height: 40px;
  }

  .timeline-icon {
    font-size: 18px;
  }

  .timeline-title {
    font-size: var(--text-base);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .timeline-entry:hover .timeline-content {
    transform: none;
  }

  .work .stagger-animation .timeline-content {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  
  * {
    animation: none !important;
    transition: none !important;
  }
}
