/* ====================================
   Modern Portfolio - Custom CSS
   Fast, Clean, Professional Design
   ==================================== */

:root {
  /* Color Palette */
  --primary-color: #0563bb;
  --primary-dark: #044a96;
  --primary-light: #1976d2;
  --secondary-color: #45505b;
  --text-primary: #272829;
  --text-secondary: #626970;
  --text-muted: #8b949e;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f8fd;
  --bg-accent: #f8f9fa;
  --border-color: #dee2e6;
  --shadow-sm: rgba(0, 0, 0, 0.05);
  --shadow-md: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.15);
  
  /* Typography */
  --font-primary: "Open Sans", sans-serif;
  --font-headings: "Raleway", sans-serif;
  --font-monospace: "Fira Code", "Courier New", monospace;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 4rem;
  
  /* Layout */
  --content-max-width: 960px;
  --content-wide-width: 1200px;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

[data-theme="dark"] {
  --primary-color: #409fff;
  --primary-dark: #1976d2;
  --primary-light: #64b5f6;
  --secondary-color: #c9d1d9;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-accent: #21262d;
  --border-color: #30363d;
  --shadow-sm: rgba(0, 0, 0, 0.3);
  --shadow-md: rgba(0, 0, 0, 0.4);
  --shadow-lg: rgba(0, 0, 0, 0.5);
}

/* ====================================
   Enhanced Timeline Component
   ==================================== */

.timeline {
  position: relative;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--spacing-lg) 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, 
    transparent 0%, 
    var(--primary-color) 10%, 
    var(--primary-color) 90%, 
    transparent 100%);
}

.timeline-item {
  position: relative;
  padding-left: 70px;
  margin-bottom: var(--spacing-xl);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.timeline-item.aos-animate {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 3px solid var(--primary-color);
  box-shadow: 0 0 0 4px var(--bg-primary),
              0 0 0 6px rgba(var(--primary-color-rgb, 5, 99, 187), 0.1);
  transition: all var(--transition-normal);
  z-index: 2;
}

.timeline-item:hover::before {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px var(--bg-primary),
              0 0 0 8px rgba(var(--primary-color-rgb, 5, 99, 187), 0.2);
}

.timeline-item.current::before {
  background: var(--primary-color);
  animation: pulse-timeline 2s infinite;
}

@keyframes pulse-timeline {
  0%, 100% {
    box-shadow: 0 0 0 4px var(--bg-primary),
                0 0 0 6px rgba(var(--primary-color-rgb, 5, 99, 187), 0.2);
  }
  50% {
    box-shadow: 0 0 0 4px var(--bg-primary),
                0 0 0 10px rgba(var(--primary-color-rgb, 5, 99, 187), 0.4);
  }
}

.timeline-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: 0 2px 8px var(--shadow-sm);
  transition: all var(--transition-normal);
}

.timeline-item:hover .timeline-content {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-md);
}

.timeline-header {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.timeline-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius);
  object-fit: contain;
  background: var(--bg-accent);
  padding: 4px;
}

.timeline-title {
  flex: 1;
}

.timeline-title h4 {
  font-family: var(--font-headings);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}

.timeline-title h4 a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.timeline-title h4 a:hover {
  color: var(--primary-color);
}

.timeline-institution {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  align-items: center;
  margin-top: var(--spacing-xs);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.timeline-date {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: var(--bg-accent);
  border-radius: 20px;
  font-weight: 500;
}

.timeline-location {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.timeline-current-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timeline-description {
  margin: var(--spacing-md) 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-highlights {
  margin-top: var(--spacing-md);
}

.timeline-highlights ul {
  margin: var(--spacing-sm) 0 0 0;
  padding-left: 1.25rem;
  list-style: none;
}

.timeline-highlights li {
  position: relative;
  padding-left: 0.5rem;
  margin-bottom: var(--spacing-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.timeline-highlights li::before {
  content: '▹';
  position: absolute;
  left: -1rem;
  color: var(--primary-color);
  font-weight: bold;
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--spacing-md);
}

.timeline-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--bg-accent);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.timeline-tag:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* ====================================
   Enhanced Project Cards (Image Left)
   ==================================== */

.projects-grid {
  max-width: var(--content-wide-width);
  margin: 0 auto;
}

.project-card {
  display: flex;
  gap: var(--spacing-lg);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  box-shadow: 0 2px 8px var(--shadow-sm);
  transition: all var(--transition-normal);
  opacity: 0;
  transform: translateY(20px);
}

.project-card.aos-animate {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--shadow-md);
  border-color: var(--primary-color);
}

.project-image {
  flex-shrink: 0;
  width: 280px;
  height: 200px;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--bg-accent);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

.project-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-header {
  margin-bottom: var(--spacing-sm);
}

.project-title {
  font-family: var(--font-headings);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.project-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.project-title a:hover {
  color: var(--primary-color);
}

.project-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--spacing-md);
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--spacing-md);
}

.tech-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--bg-accent);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-family: var(--font-monospace);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: auto;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-accent);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.project-link:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.project-link.primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.project-link.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* Featured Project Badge */
.project-card.featured {
  border: 2px solid var(--primary-color);
  background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(var(--primary-color-rgb, 5, 99, 187), 0.02) 100%);
}

.project-card.featured::before {
  content: '⭐ Featured';
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  padding: 0.25rem 0.75rem;
  background: var(--primary-color);
  color: white;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ====================================
   Responsive Design
   ==================================== */

@media (max-width: 768px) {
  :root {
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-item {
    padding-left: 50px;
  }

  .timeline-item::before {
    left: 12px;
  }

  .timeline-logo {
    width: 40px;
    height: 40px;
  }

  .timeline-title h4 {
    font-size: 1.125rem;
  }

  .project-card {
    flex-direction: column;
    padding: var(--spacing-md);
  }

  .project-image {
    width: 100%;
    height: 180px;
  }

  .project-title {
    font-size: 1.25rem;
  }
}

/* ====================================
   Section Styling
   ==================================== */

.section {
  padding: var(--spacing-xxl) 0;
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.section-title h2 {
  font-family: var(--font-headings);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  position: relative;
  display: inline-block;
}

.section-title h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

.section-title p {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 700px;
  margin: var(--spacing-md) auto 0;
}

/* ====================================
   Smooth Animations
   ==================================== */

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

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

/* Intersection Observer ready classes */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ====================================
   Performance Optimizations
   ==================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* GPU acceleration for smooth animations */
.timeline-item,
.project-card,
.timeline-content {
  will-change: transform, opacity;
}

/* Lazy load images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}
