/* Timeline animations and fixes */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(93, 157, 246, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(93, 157, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(93, 157, 246, 0); }
}

@keyframes timeline-fade-in {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes line-grow {
  from { height: 0; }
  to { height: 100%; }
}

/* Fixed timeline item visible state */
#timeline-section .timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
  animation: timeline-fade-in 0.8s forwards;
}

#timeline-section .timeline-container::before {
  animation: line-grow 1.5s ease-out forwards;
}

#timeline-section .timeline-item::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: var(--highlight-color);
  border-radius: 50%;
  top: 30px;
  left: -18px; /* Position exactly on the timeline */
  z-index: 3;
  box-shadow: 0 0 15px var(--highlight-bright);
  transition: all 0.3s ease;
}

#timeline-section .timeline-item:hover::before {
  animation: pulse 1.5s infinite;
  background-color: var(--highlight-bright);
}

/* Horizontal connector from dot to content */
#timeline-section .timeline-item::after {
  content: '';
  position: absolute;
  width: 2rem;
  height: 2px;
  background-color: var(--border-color);
  top: 38px;
  left: -10px; /* Connect from the dot's edge */
  z-index: 2;
}

/* Section heading for resume-like timeline */
.section-heading {
  color: var(--highlight-color);
  font-size: 1.75rem;
  margin-bottom: 2rem;
  position: relative;
  padding-bottom: 0.5rem;
  display: inline-block;
}

.section-heading:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 3px;
  background-color: var(--highlight-bright);
}

/* Timeline year marker styles - can be added for multi-year timelines */
.timeline-year-marker {
  position: relative;
  display: block;
  margin: 2rem 0 1.5rem 0;
  font-weight: 600;
  color: var(--highlight-color);
  font-size: 1.1rem;
  padding-left: 3rem;
  letter-spacing: 0.03em;
}

.timeline-year-marker:before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 2.5rem;
  height: 2px;
  background-color: var(--highlight-bright);
  transform: translateY(-50%);
}

/* First timeline item after a year marker needs less top margin */
.timeline-year-marker + .timeline-item {
  margin-top: 0;
}

/* Override any conflicting styles */
.timeline-item.visible {
  animation: none !important;
  opacity: 1;
  transform: translateY(0);
}

/* Enhance timeline content appearance */
#timeline-section .timeline-content {
  background: var(--bg-alt-color);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--highlight-color); /* Thicker accent border */
  border-radius: 4px;
  padding: 1.5rem 2rem;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
  width: 100%;
}

#timeline-section .timeline-content:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  border-left: 4px solid var(--highlight-bright);
}

/* Ensure section heading has proper styling */
#timeline-section h2.section-heading {
  border-bottom: none;
  margin-bottom: 2.5rem;
}

#timeline-section h2.section-heading:after {
  height: 4px;
  width: 100px;
  background: linear-gradient(to right, var(--highlight-color), var(--highlight-bright));
  border-radius: 2px;
}

/* Add some extra spacing between timeline items */
#timeline-section .timeline-item {
  margin-bottom: 3rem;
}

/* Education section styling to match timeline section */
#education-section .timeline-container::before {
  animation: line-grow 1.5s ease-out forwards;
}

#education-section .timeline-item::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: var(--highlight-color);
  border-radius: 50%;
  top: 30px;
  left: -18px; /* Position exactly on the timeline */
  z-index: 3;
  box-shadow: 0 0 15px var(--highlight-bright);
  transition: all 0.3s ease;
}

#education-section .timeline-item:hover::before {
  animation: pulse 1.5s infinite;
  background-color: var(--highlight-bright);
}

#education-section .timeline-item::after {
  content: '';
  position: absolute;
  width: 2rem;
  height: 2px;
  background-color: var(--border-color);
  top: 38px;
  left: -10px; /* Connect from the dot's edge */
  z-index: 2;
}

#education-section .timeline-content {
  background: var(--bg-alt-color);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--highlight-color);
  border-radius: 4px;
  padding: 1.5rem 2rem;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
  width: 100%;
}

#education-section .timeline-content:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  border-left: 4px solid var(--highlight-bright);
}

#education-section h2.section-heading {
  border-bottom: none;
  margin-bottom: 2.5rem;
}

#education-section h2.section-heading:after {
  height: 4px;
  width: 100px;
  background: linear-gradient(to right, var(--highlight-color), var(--highlight-bright));
  border-radius: 2px;
}

#education-section .timeline-item {
  margin-bottom: 3rem;
}

/* Common styling for both timeline sections */
.timeline-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 2rem 0 5rem; /* Add padding to the left for the timeline */
}

/* The vertical line */
.timeline-container::before {
  content: '';
  position: absolute;
  height: 100%;
  width: 2px; /* Thinner line for elegance */
  background: var(--border-color);
  left: 3rem; /* Position line on the left */
  z-index: 1;
}
