/* =============================
   Base Styles
============================= */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f6f9;
  color: #333;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

a {
  color: #58a6ff;
  text-decoration: none;
}
a:hover {
  text-decoration: none;
}

/* =============================
   Buttons
============================= */
.resume-btn {
  display: inline-block;
  margin-top: 15px;
  padding: 10px 20px;
  background: #58a6ff;
  color: #fff;
  font-weight: bold;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.3s;
}
.resume-btn:hover { background: #007acc; }

.download-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: #fff;
}
.download-btn:hover::after {
  content: "Resume";
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8em;
  white-space: nowrap;
  z-index: 10;
}

.dark-mode-toggle {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: #fff;
}

/* =============================
   Navbar
============================= */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0d1117;
  padding: 10px 20px;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
}
.navbar.navbar-hidden {
  transform: translateY(-100%);
}
.navbar .logo {
  font-size: 1.3em;
  font-weight: bold;
  color: #fff;
}
.nav-links {
  display: flex;
  list-style: none;
}
.nav-links li { margin-left: 20px; }
.nav-links a {
  color: #fff;
  font-weight: 500;
}
.nav-links a:hover { color: #58a6ff; }
.menu-toggle {
  display: none;
  font-size: 1.5em;
  cursor: pointer;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  opacity: 1;
  visibility: visible;
}
.menu-toggle.menu-toggle-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.navbar .right-buttons {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto;
}

/* =============================
   Header
============================= */
header {
  background: linear-gradient(135deg, #0d1117, #1f2937);
  color: #fff;
  padding: 60px 20px;
  text-align: center;
}
header h1 { margin-bottom: 10px; }
header a { color: #58a6ff; }
header .links a {
  margin: 0 5px;
  font-size: 0.95em;
}

/* =============================
   Sections
============================= */
section {
  max-width: 900px;
  margin: 20px auto;
  padding: 25px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  transition: background 0.3s, color 0.3s;
}
h2 {
  color: #0d1117;
  border-bottom: 2px solid #58a6ff;
  padding-bottom: 8px;
}

/* =============================
   Projects
============================= */
.project {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  transition: transform 0.2s ease, background 0.3s, color 0.3s;
}
.project:hover {
  transform: translateY(-4px);
  border-color: #58a6ff;
}
.project h3 a { color: #007acc; }
.project h3 a:hover { text-decoration: underline; }

/* =============================
   Timeline
============================= */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 40px auto;
}
.timeline::after {
  content: '';
  position: absolute;
  width: 4px;
  background-color: #58a6ff;
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -2px;
  /* start collapsed and grow when timeline gets .line-animate */
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 0.8s cubic-bezier(.2,.9,.2,1);
}
.timeline-item {
  padding: 20px 40px;
  position: relative;
  width: 50%;
  box-sizing: border-box;
}
.timeline-item.left { left: 0; }
.timeline-item.right { left: 50%; }
.timeline-item .content {
  background: #fafafa;
  padding: 25px;
  border-radius: 10px;
  border: 1px solid #ddd;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.timeline-item .content:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: #58a6ff;
  box-shadow: 0 8px 20px rgba(88, 166, 255, 0.15);
}
.timeline-item::before {
  content: '';
  position: absolute;
  top: 20px;
  width: 20px;
  height: 20px;
  background-color: #58a6ff;
  border: 3px solid #fff;
  border-radius: 50%;
  z-index: 1;
}
.timeline-item.left::before { right: -14px; }
.timeline-item.right::before { left: -14px; }

/* ===== Timeline entrance animations ===== */
/* hidden initial state */
.timeline-item {
  opacity: 0;
}

/* make the timeline circles pop in */
.timeline-item::before {
  transform: scale(0);
  transition: transform 0.5s cubic-bezier(.34,1.56,.64,1), background-color 0.3s;
  box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.7);
}

/* Keyframes for sliding in from left/right with enhanced effects */
@keyframes slideInLeft {
  from { 
    opacity: 0; 
    transform: translateX(-50px) translateY(20px) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translateX(0) translateY(0) scale(1); 
  }
}
@keyframes slideInRight {
  from { 
    opacity: 0; 
    transform: translateX(50px) translateY(20px) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translateX(0) translateY(0) scale(1); 
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(88, 166, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(88, 166, 255, 0);
  }
}

/* apply animations when observer toggles .show */
.timeline-item.show.left .content {
  animation: slideInLeft 0.7s cubic-bezier(.34,1.56,.64,1) both;
}
.timeline-item.show.right .content {
  animation: slideInRight 0.7s cubic-bezier(.34,1.56,.64,1) both;
}
.timeline-item.show {
  opacity: 1;
}
.timeline-item.show::before {
  transform: scale(1);
  animation: pulse 1s ease-out;
}

/* Enhanced stagger effect using nth-child for smoother entrance */
.timeline-item.show:nth-child(1) .content { 
  animation-delay: 0.1s;
  animation-duration: 0.7s;
}
.timeline-item.show:nth-child(2) .content { 
  animation-delay: 0.2s;
  animation-duration: 0.75s;
}
.timeline-item.show:nth-child(3) .content { 
  animation-delay: 0.3s;
  animation-duration: 0.7s;
}
.timeline-item.show:nth-child(4) .content { 
  animation-delay: 0.4s;
  animation-duration: 0.75s;
}
.timeline-item.show:nth-child(5) .content { 
  animation-delay: 0.5s;
  animation-duration: 0.7s;
}

.timeline-item.show:nth-child(1)::before { 
  animation-delay: 0.1s;
}
.timeline-item.show:nth-child(2)::before { 
  animation-delay: 0.2s;
}
.timeline-item.show:nth-child(3)::before { 
  animation-delay: 0.3s;
}
.timeline-item.show:nth-child(4)::before { 
  animation-delay: 0.4s;
}
.timeline-item.show:nth-child(5)::before { 
  animation-delay: 0.5s;
}

/* animate the central line when timeline receives .line-animate */
.timeline.line-animate::after {
  transform: scaleY(1);
}

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .timeline::after,
  .timeline-item .content,
  .timeline-item::before {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
/* =============================
   Experience-specific styles
============================= */
.experience-header {
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e7eb;
}

.job-title {
  font-size: 1.3em;
  font-weight: 700;
  color: #0d1117;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.company {
  display: inline-block;
  font-size: 1.1em;
  font-weight: 600;
  color: #58a6ff;
  margin-right: 12px;
}

.date-range {
  display: inline-block;
  font-size: 0.95em;
  color: #6b7280;
  font-weight: 500;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 12px;
}

.experience-description {
  margin: 15px 0;
  line-height: 1.7;
  color: #4b5563;
}

.tech {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85em;
  color: #007acc;
  font-weight: 600;
  padding: 6px 12px;
  background: #eff6ff;
  border-radius: 6px;
}

/* Dark mode adjustments for experience */
body.dark-mode .job-title {
  color: #e6e6e6;
}

body.dark-mode .company {
  color: #58a6ff;
}

body.dark-mode .date-range {
  color: #d1d5db;
  background: #374151;
}

body.dark-mode .experience-description {
  color: #d1d5db;
}

body.dark-mode .experience-header {
  border-bottom-color: #4b5563;
}

body.dark-mode .tech {
  color: #93c5fd;
  background: #1e3a5f;
}

/* =============================
   Footer
============================= */
footer {
  text-align: center;
  padding: 20px;
  background: #0d1117;
  color: #aaa;
  font-size: 0.9em;
  transition: background 0.3s, color 0.3s;
}

/* =============================
   Dark Mode
============================= */
body.dark-mode { background: #0d1117; color: #e6e6e6; }
body.dark-mode section { background: #1f2937; color: #e6e6e6; }
body.dark-mode h2 { color: #58a6ff; }
body.dark-mode .project { background: #2d3748; border-color: #444; }
body.dark-mode footer { background: #1f2937; color: #bbb; }
body.dark-mode .timeline::after { background-color: #58a6ff; }
body.dark-mode .timeline-item .content {
  background: #1f2937;
  border: 1px solid #444;
  color: #e6e6e6;
}
body.dark-mode .timeline-item::before {
  background-color: #58a6ff;
  border: 3px solid #1f2937;
}

/* =============================
   Responsive
============================= */
html { scroll-padding-top: 70px; }

@media (max-width: 768px) {
  nav {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #fff; /* Ensure visibility */
}

  /* Navbar */
  .navbar {
    padding: 10px 15px;
    position: relative;
  }
  .navbar .logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
  }
  .menu-toggle { display: inline-block; margin-left: 12px; }
  .navbar .right-buttons {
    position: absolute;
    top: 12px;
    right: 50px;
    display: flex;
    gap: 12px;
  }

  /* Nav links dropdown */
  .nav-links {
    position: absolute;
    top: 55px;
    left: 0;
    width: 100%;
    flex-direction: column;
    background: #0d1117;
    display: none;
    padding: 10px 0;
    text-align: center;
  }
  .nav-links.active { display: flex; }
  .nav-links li { margin: 12px 0; }

  /* Sections */
  section { margin: 15px 10px; padding: 15px; }
  h2 { font-size: 1.3em; }

  /* Timeline single-column */
  .timeline::after { left: 15px; }
  .timeline-item {
    width: 100%;
    left: 0 !important;
    padding: 15px 20px;
    margin-left: 30px;
  }
  .timeline-item::before {
    left: -28px;
    right: auto;
  }
  .timeline-item.right::before {
    left: -28px;
}
/* Make hover-info visible when active on mobile */
.timeline-item .hover-info {
  display: none;
  margin-top: 10px;
  font-size: 0.9em;
  color: #2563eb;
  font-weight: bold;
}

/* On hover for desktop */
.timeline-item:hover .hover-info {
  display: block;
}

/* Active class for mobile tap */
.timeline-item.active .hover-info {
  display: block;
}
  .timeline-item:focus,
  .timeline-item:hover {
    background-color: #f0f0f0;
  }

  /* Mobile: force single-column entrance animation (slide from left) */
  .timeline-item {
    opacity: 0;
  }
  .timeline-item.show { opacity: 1; }
  .timeline-item.show .content {
    animation: slideInLeft 0.6s cubic-bezier(.2,.9,.2,1) both;
  }
  .timeline.line-animate::after {
    transform: scaleY(1);
  }
}

@media (max-width: 480px) {
  header { padding: 40px 15px; }
  header h1 { font-size: 1.4em; }
  header p { font-size: 0.9em; }
  .resume-btn { padding: 8px 15px; font-size: 0.9em; }
}

#scrollTopBtn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99;
  width: 50px;              /* Equal width */
  height: 50px;             /* Equal height */
  font-size: 20px;
  border: none;
  outline: none;
  background-color: #58a6ff;
  color: white;
  cursor: pointer;
  border-radius: 50%;       /* Perfect circle */
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  transition: opacity 0.3s, transform 0.3s;
}

#scrollTopBtn:hover {
  background-color: #2575fc;
  transform: scale(1.1);
}