/* ================= General Layout ================= */
main {
  margin-top: 80px; /* space after navbar */
}

/* ================= Experience Section ================= */
.experience-section {
  padding: 60px 0;
  background: linear-gradient(135deg, var(--neutral-50) 0%, var(--neutral-100) 100%);
}

.timeline {
  position: relative;
  max-width: 1000px; /* Increased max-width for wider cards */
  margin: 30px auto 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
}

.timeline-item {
  position: relative;
  margin-bottom: 30px;
  display: flex;
  width: 100%;
}

.timeline-item:nth-child(odd) {
  justify-content: flex-start;
}

.timeline-item:nth-child(even) {
  justify-content: flex-end;
}

.timeline-marker {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  box-shadow: var(--shadow-md);
  z-index: 2;
  flex-shrink: 0;
}

.timeline-content {
  width: calc(50% - 20px); /* Reduced margin for wider cards */
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid var(--neutral-200);
}

.timeline-item:nth-child(odd) .timeline-content {
  margin-right: 20px; /* Reduced margin */
}

.timeline-item:nth-child(even) .timeline-content {
  margin-left: 20px; /* Reduced margin */
}

.timeline-content:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.job-header h3 {
  color: var(--primary);
  font-size: 1.3rem;
  margin: 0;
  flex: 1;
  min-width: 180px;
}

.company {
  font-weight: 600;
  color: var(--neutral-600);
  font-size: 1rem;
}

.job-period {
  background: var(--neutral-100);
  color: var(--neutral-600);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
}

.job-details h4 {
  color: var(--primary);
  margin: 16px 0 8px;
  font-size: 1rem;
}

.job-details ul {
  padding-left: 18px;
  margin-bottom: 16px;
}

.job-details li {
  margin-bottom: 6px;
  line-height: 1.6;
  color: var(--neutral-600);
}

.more-responsibilities {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease-out;
}

.more-responsibilities.expanded {
  max-height: 800px;
}

.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
  font-size: 0.9rem;
}

.expand-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.expand-btn i {
  transition: transform 0.3s ease;
}

.expand-btn.expanded i {
  transform: rotate(180deg);
}

/* ================= Education Section (Dark) ================= */
.education-section {
  padding: 60px 0;
  background: linear-gradient(135deg, rgba(3, 14, 51, 0.95), rgba(3, 14, 51, 0.98));
  color: white;
}

.education-section .section-title {
  color: white;
}

.education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.education-card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.education-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.12);
}

.education-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: white;
  color: var(--primary);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.education-card h3 {
  color: white;
  margin-bottom: 6px;
  font-size: 1.2rem;
}

.degree {
  font-weight: 600;
  color: #e6e6e6;
  margin-bottom: 4px;
}

.period {
  color: #bbb;
  font-size: 0.85rem;
}

/* ================= Testimonials Section (Light) ================= */
.testimonials-section {
  padding: 60px 0;
  background: linear-gradient(135deg, var(--neutral-0) 0%, var(--neutral-50) 100%);
}

.testimonials-section .section-title {
  color: var(--primary);
}

.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.testimonial-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
}

.testimonial-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  z-index: 10;
}

/* Image testimonials - standard height with zoomed out view */
.testimonial-card:not(.video-testimonial) .testimonial-media {
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.4s ease;
}

.testimonial-card:not(.video-testimonial):hover .testimonial-media {
  height: 300px; /* Expand on hover */
  transform: scale(1.02);
}

/* Image testimonials - show full screenshot on hover */
.testimonial-card:not(.video-testimonial) .testimonial-screenshot img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Show full screenshot without cropping */
  background: #f8fafc;
  transition: all 0.4s ease;
}

.testimonial-card:not(.video-testimonial):hover .testimonial-screenshot img {
  object-fit: contain; /* Maintain full screenshot view */
  transform: scale(1); /* Remove scale to show full image */
}

/* Video testimonials - compact initial state */
.testimonial-card.video-testimonial .testimonial-media {
  height: 200px; /* Same as images initially */
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.4s ease;
  position: relative;
}

/* Video testimonials - expanded on hover */
.testimonial-card.video-testimonial:hover .testimonial-media {
  height: 400px; /* Much taller on hover */
  transform: scale(1.02);
}

.testimonial-video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Fill container initially */
  display: block;
  transition: all 0.4s ease;
}

.testimonial-card.video-testimonial:hover .testimonial-video {
  object-fit: contain; /* Show full video without cropping on hover */
  background: #000; /* Black background for videos */
}

.video-control {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: var(--transition);
  z-index: 3;
}

.video-control:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.testimonial-body {
  padding: 16px;
  text-align: center;
  margin-top: auto;
  transition: all 0.3s ease;
}

.testimonial-card:hover .testimonial-body {
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(5px);
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.verify-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

/* ================= Section Titles ================= */
.section-title {
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: var(--primary);
  margin-bottom: 10px;
  position: relative;
  display: inline-block;
  width: 100%;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
}

.section-title-light {
  color: white;
}

.section-title-light::after {
  background: linear-gradient(90deg, white, rgba(255, 255, 255, 0.7));
}

/* ================= Mobile-Specific Styles ================= */
@media (max-width: 768px) {
  main {
    margin-top: 80px; /* Increased from 60px to create more space */
  }
  
  .experience-section {
    padding: 50px 0 40px; /* Increased top padding for better spacing */
  }
  
  .experience-section .section-title {
    margin-bottom: 25px; /* Added more space below the title */
    padding-top: 10px; /* Extra padding at the top */
  }
  
  .timeline {
    margin: 20px auto 0; /* Adjusted margin */
  }
  
  .timeline::before {
    left: 20px;
  }
  
  .timeline-marker {
    width: 36px;
    height: 36px;
    left: 20px;
    font-size: 0.9rem;
  }
  
  .timeline-content {
    width: calc(100% - 56px);
    margin-left: 56px !important;
    padding: 20px; /* Slightly increased padding for better readability */
  }
  
  .education-section,
  .testimonials-section {
    padding: 40px 0;
  }
  
  .education-grid,
  .testimonial-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  /* Mobile: Images show full screenshot by default */
  .testimonial-card:not(.video-testimonial) .testimonial-media {
    height: 250px; /* Taller for mobile to show more content */
  }
  
  .testimonial-card:not(.video-testimonial) .testimonial-screenshot img {
    object-fit: contain; /* Show full screenshot on mobile */
    background: #f8fafc;
  }
  
  /* Mobile: Videos get more height */
  .testimonial-card.video-testimonial .testimonial-media {
    height: 300px; /* Taller for videos on mobile */
  }
  
  .testimonial-card.video-testimonial .testimonial-video {
    object-fit: contain; /* Show full video on mobile */
    background: #000;
  }
  
  /* Disable hover effects on touch devices */
  @media (hover: none) {
    .testimonial-card:hover {
      transform: none;
      box-shadow: var(--shadow-sm);
    }
    
    .testimonial-card:not(.video-testimonial):hover .testimonial-media,
    .testimonial-card.video-testimonial:hover .testimonial-media {
      height: initial;
      transform: none;
    }
    
    .testimonial-card:hover .testimonial-body {
      background: transparent;
      backdrop-filter: none;
    }
  }
}

@media (max-width: 992px) {
  .timeline::before {
    left: 30px;
  }
  
  .timeline-item {
    justify-content: flex-start !important;
  }
  
  .timeline-marker {
    left: 30px;
    transform: translateX(-50%);
  }
  
  .timeline-content {
    width: calc(100% - 70px);
    margin-left: 70px !important;
    margin-right: 0 !important;
  }
  
  .job-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .job-period {
    align-self: flex-start;
  }
}

@media (max-width: 640px) {
  /* Enhanced mobile spacing */
  main {
    margin-top: 80px; /* Consistent spacing */
  }
  
  .experience-section {
    padding: 40px 0 30px; /* Balanced padding */
  }
  
  .experience-section .section-title {
    margin-bottom: 20px;
    padding-top: 5px;
    font-size: clamp(1.6rem, 5vw, 2.2rem); /* Better mobile font sizing */
  }
  
  .timeline-item {
    flex-direction: column;
    margin-bottom: 25px; /* Increased spacing between items */
  }
  
  .timeline::before {
    display: none;
  }
  
  .timeline-marker {
    position: relative;
    left: auto;
    transform: none;
    margin-right: 0;
    margin-bottom: 15px; /* More space below marker */
    align-self: flex-start;
  }
  
  .timeline-content {
    width: 100%;
    margin-left: 0 !important;
    padding: 18px;
  }
  
  .job-header h3 {
    font-size: 1.2rem;
    min-width: 100%;
    margin-bottom: 5px;
  }
  
  /* Mobile small screens */
  .testimonial-card:not(.video-testimonial) .testimonial-media {
    height: 220px;
  }
  
  .testimonial-card.video-testimonial .testimonial-media {
    height: 250px;
  }
}

@media (max-width: 480px) {
  /* Extra small mobile optimization */
  .experience-section,
  .education-section,
  .testimonials-section {
    padding: 30px 0;
  }
  
  .experience-section .section-title {
    margin-bottom: 15px;
    font-size: clamp(1.5rem, 6vw, 2rem);
  }
  
  .timeline-content {
    padding: 16px;
    margin-bottom: 5px;
  }
  
  .job-header {
    margin-bottom: 12px;
  }
  
  .education-grid,
  .testimonial-grid {
    gap: 12px;
    margin-top: 20px;
  }
  
  .education-card,
  .testimonial-card {
    border-radius: var(--radius);
  }
  
  /* Extra small mobile testimonial heights */
  .testimonial-card:not(.video-testimonial) .testimonial-media {
    height: 200px;
  }
  
  .testimonial-card.video-testimonial .testimonial-media {
    height: 220px;
  }
}

/* Professional spacing for the first section on mobile */
@media (max-width: 768px) {
  .experience-section:first-child {
    padding-top: 60px; /* Extra top padding for the first section */
  }
}

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

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .timeline-content, .education-card, .testimonial-card,
  .expand-btn, .verify-badge, .video-control,
  .timeline-item, .education-card {
    transition: none !important;
    animation: none !important;
  }
  
  .timeline-item, .education-card {
    opacity: 1 !important;
    transform: none !important;
  }
  
  .testimonial-card:not(.video-testimonial):hover .testimonial-media,
  .testimonial-card.video-testimonial:hover .testimonial-media {
    height: initial !important;
    transform: none !important;
  }
}