/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Fixed nav bar offset for all main sections */
.about-section,
.projects-section,
.skills-section,
.cv-section,
.achievements-section,
.contact-section {
  scroll-margin-top: 100px;
}

/* Additional top spacing for About section to ensure content visibility */
#about.about-section {
  scroll-margin-top: 120px;
  padding-top: 120px;
}

/* Smooth scrolling handled by ScrollManager */

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f9f9f9;
  color: #222;
  line-height: 1.6;
}

/* Header Navigation */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  z-index: 1001;
  height: auto;
  min-height: 56px;
}

.navbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.7rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: relative;
  height: auto;
  min-height: 40px;
}

/* Header Navigation - Centered primary links with Contact Me on right */
.nav-links {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  flex: 1;
  gap: clamp(0.5rem, 2vw, 2rem);
  margin: 0;
  padding: 0;
  position: relative;
}

/* Separate Contact Me link positioning */
.nav-links li:last-child {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Primary navigation links (excluding Contact Me) */
.nav-links li:not(:last-child) {
  display: flex;
  justify-content: center;
}
.nav-links li {
  display: flex;
  justify-content: center;
}
.nav-link {
  text-decoration: none;
  color: #222;
  font-weight: 500;
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  background: transparent;
  text-align: center;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  background: #6366f1;
  color: #fff;
}
.nav-link.cta {
  background: #6366f1;
  color: #fff;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.5rem 2rem;
  box-shadow: 0 2px 8px rgba(99,102,241,0.10);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.nav-link.cta:hover, .nav-link.cta:focus {
  background: #4338ca;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.18);
}

/* Timeline Section */
.timeline-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 4rem 1rem 2rem 1rem;
}

.timeline-section h2 {
  text-align: center;
  margin-bottom: 2.5rem;
  font-size: 2rem;
  font-weight: 600;
}

/* Hamburger Menu Styles */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  position: absolute;
  right: 2rem;
  top: 1.2rem;
  z-index: 1100;
}
.hamburger {
  display: block;
  width: 28px;
  height: 3px;
  background: #222;
  position: relative;
  border-radius: 2px;
}
.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 28px;
  height: 3px;
  background: #222;
  border-radius: 2px;
  transition: 0.3s;
}
.hamburger::before {
  top: -9px;
}
.hamburger::after {
  top: 9px;
}

/* Timeline Alternating Layout */
.timeline {
  position: relative;
  margin-left: 0;
  padding-left: 0;
  border-left: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.timeline-item {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin-bottom: 3rem;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}
.timeline-item.left .timeline-content {
  margin-right: auto;
  margin-left: 0;
}
.timeline-item.right .timeline-content {
  margin-left: auto;
  margin-right: 0;
}
.timeline-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 1.2rem;
  width: 20px;
  height: 20px;
  background: #222;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.15);
  z-index: 2;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: #6366f1;
  z-index: 1;
  border-radius: 2px;
}
.timeline-content {
  background: #fff;
  padding: 1.2rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  min-width: 220px;
  max-width: 320px;
  position: relative;
  z-index: 3;
  color: #1a1a1a;
}
.timeline-date {
  font-size: 1rem;
  color: #6366f1;
  font-weight: 700;
  margin-bottom: 0.3rem;
  display: block;
}

/* Remove timeline and related styles */
.timeline, .timeline-section, .timeline-item, .timeline-dot, .timeline-content, .timeline-date {
  display: none !important;
}

/* Section base styles */
.projects-section,
.skills-section,
.cv-section,
.contact-section {
  min-height: calc(100vh - 80px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 1.5rem;
}

/* Projects Section */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  justify-items: center;
  gap: 5rem;
  margin-top: 2rem;
  padding: 2rem;
}
.project-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 3rem 2.5rem 2.5rem 2.5rem;
  text-decoration: none;
  color: #1a1a1a;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
  transform-origin: center center;
  will-change: transform;
  cursor: pointer;
  outline: none;
  position: relative;
  z-index: 1;
  min-width: 320px;
  max-width: 420px;
  min-height: 320px;
  margin: 0 auto;
}

.project-card:hover,
.project-card:focus {
  transform: scale(1.03) translateY(-4px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 10;
  cursor: pointer;
}

.project-card:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 4px;
  transform: scale(1.03) translateY(-4px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 10;
}
.project-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.tag {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 1.05rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.35em 1.1em;
  margin-bottom: 0.2em;
  letter-spacing: 0.01em;
}
.project-desc {
  font-size: 1.15rem;
  color: #444;
  margin-top: 0.2rem;
}

body.dark-theme .project-desc {
  color: #d1d5db;
}

body.dark-theme .project-title {
  color: #f8fafc;
}

body.dark-theme .skill-title {
  color: #f8fafc;
}

/* Skills Section */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 3rem;
  width: 100%;
  max-width: 1200px;
  justify-items: center;
  align-items: stretch;
  margin-top: 2rem;
}

.skill-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.10);
  padding: 3rem 2.5rem 2.5rem 2.5rem;
  font-size: 1.18rem;
  margin: 0 auto;
  border-radius: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 320px;
  max-width: 420px;
  height: 280px;
  width: 100%;
}

/* Responsive design for Skills */
@media (max-width: 1100px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .skill-card {
    min-width: 280px;
    max-width: 95vw;
    min-height: 220px;
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    font-size: 1rem;
  }
}

/* Responsive design for Skills */
@media (max-width: 768px) {
  .skills-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
  }
}
.skill-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.10);
  padding: 3rem 2.5rem 2.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.skill-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skill-tags .tag {
  background: #f1f5f9;
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.25em 0.9em;
  margin-bottom: 0.2em;
  letter-spacing: 0.01em;
}

/* CV/Resume Section */
.cv-embed-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  width: 100%;
}
.cv-embed {
  width: 100%;
  max-width: 700px;
  min-height: 500px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
@media (max-width: 900px) {
  .cv-embed {
    min-height: 400px;
  }
}
@media (max-width: 600px) {
  .cv-embed {
    min-height: 300px;
    max-width: 100vw;
  }
}

/* Contact Section Redesign */
.contact-section {
  min-height: calc(100vh - 80px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 1.5rem 3rem 1.5rem;
  margin-bottom: 0;
  position: relative;
}

.contact-section h2 {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 3rem;
  letter-spacing: -0.01em;
}

/* --- Contact Buttons: Even, Responsive Spacing --- */
.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 3rem;
}
.contact-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 2rem;
  background: #6366f1;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  min-width: 140px;
  justify-content: center;
}
.contact-btn:hover, .contact-btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99,102,241,0.4);
  background: #4338ca;
}
.resume-btn {
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 16px rgba(16,185,129,0.18);
}
.resume-btn:hover, .resume-btn:focus {
  background: #059669;
  color: #fff;
  box-shadow: 0 6px 24px rgba(16,185,129,0.28);
}
@media (max-width: 600px) {
  .contact-buttons {
    flex-direction: column;
    gap: 1.5rem;
  }
  .contact-btn {
    min-width: 200px;
  }
}

.linkedin-btn {
  background: #0077b5;
  box-shadow: 0 4px 16px rgba(0,119,181,0.3);
}

.linkedin-btn:hover, .linkedin-btn:focus {
  background: #005885;
  box-shadow: 0 6px 24px rgba(0,119,181,0.4);
}

.email-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 2.5rem;
  background: #f1f5f9;
  color: #374151;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 2rem;
  min-width: 160px;
  justify-content: center;
}

.email-toggle-btn:hover, .email-toggle-btn:focus {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.2);
}

/* Contact Form */
.contact-form {
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  padding: 2.5rem 2rem;
  border: 1px solid #f1f5f9;
  margin-top: 1rem;
}

.contact-form.hidden {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form-group label {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
}

.form-group input,
.form-group textarea {
  font-size: 1rem;
  padding: 0.9rem 1.2rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  color: #374151;
  transition: border-color 0.2s, background-color 0.2s;
  resize: vertical;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #6366f1;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.form-group textarea {
  min-height: 120px;
  line-height: 1.6;
}



.contact-submit {
  background: #6366f1;
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  cursor: pointer;
  margin-top: 1rem;
  transition: background 0.2s, transform 0.2s;
}

.contact-submit:hover, .contact-submit:focus {
  background: #4338ca;
  transform: translateY(-1px);
}

/* Dark theme styles for contact */
body.dark-theme .contact-section h2 {
  color: #f3f4f6;
}

body.dark-theme .email-toggle-btn {
  background: #374151;
  color: #f3f4f6;
  border-color: #4b5563;
}

body.dark-theme .email-toggle-btn:hover,
body.dark-theme .email-toggle-btn:focus {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}

body.dark-theme .contact-form {
  background: #232336;
  border-color: #374151;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

body.dark-theme .form-group label {
  color: #f3f4f6;
}

body.dark-theme .form-group input,
body.dark-theme .form-group textarea {
  background: #374151;
  color: #f3f4f6;
  border-color: #4b5563;
}

body.dark-theme .form-group input:focus,
body.dark-theme .form-group textarea:focus {
  border-color: #6366f1;
  background: #1f2937;
}



/* Responsive design for contact */
@media (max-width: 600px) {
  .contact-buttons {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  
  .contact-btn {
    min-width: 200px;
  }
  
  .email-toggle-btn {
    min-width: 200px;
  }
  
  .contact-form {
    padding: 2rem 1.5rem;
    margin: 1rem 0.5rem 0 0.5rem;
  }
  
  .contact-section h2 {
    font-size: 2rem;
    margin-bottom: 2.5rem;
  }
}

/* Responsive Grids */
@media (max-width: 900px) {
  .projects-grid, .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-card {
    min-width: 220px;
    max-width: 95vw;
    min-height: 220px;
    padding: 2rem 1.2rem 1.2rem 1.2rem;
    font-size: 1rem;
  }
  .skill-card {
    min-width: 220px;
    max-width: 95vw;
    min-height: 220px;
    padding: 2rem 1.2rem 1.2rem 1.2rem;
    font-size: 1rem;
  }
  
  /* Responsive WIP animation for medium screens */
  .project-card[data-wip="true"].wip-active::after {
    font-size: clamp(1rem, 3vw, 1.8rem);
    padding: 0.8rem;
  }
  .projects-grid, .skills-grid {
    gap: 1.5rem;
  }
}
@media (max-width: 600px) {
  .projects-grid, .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .project-card {
    padding: 1.2rem 1rem 1rem 1rem;
  }
  .skill-card {
    padding: 1.2rem 1rem 1rem 1rem;
  }
  
  /* Responsive WIP animation for small screens */
  .project-card[data-wip="true"].wip-active::after {
    font-size: clamp(0.9rem, 4vw, 1.4rem);
    padding: 0.5rem;
    letter-spacing: 0.02em;
  }
}

/* Accessibility: High Contrast for Nav and Buttons */
.nav-link, .nav-toggle {
  color: #222;
  background: transparent;
}
.nav-link:hover, .nav-link.active {
  background: #6366f1;
  color: #fff;
}

/* Footer Styles */
.footer {
  background: #222;
  color: #fff;
  padding: 2rem 0 1rem 0;
  text-align: center;
  margin-top: 3rem;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}
.footer-social {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.5rem;
}
.footer-link {
  color: #a5b4fc;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.footer-link:hover, .footer-link:focus {
  color: #fff;
  text-decoration: underline;
}

/* Responsive Styles */
@media (max-width: 900px) {
  .navbar {
    max-width: 100%;
    padding: 1rem 1rem;
  }
  .nav-links {
    max-width: 100%;
    gap: clamp(0.3rem, 1.5vw, 1.5rem);
  }
  
  /* Adjust Contact Me positioning for medium screens */
  .nav-links li:last-child {
    right: 0;
  }
}
@media (max-width: 600px) {
  .navbar {
    padding: 1rem 0.5rem;
  }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    display: none;
    width: 100%;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1001;
    gap: 0;
  }
  .nav-links.open {
    display: flex;
  }
  
  /* Reset positioning for mobile */
  .nav-links li:last-child {
    position: static;
    transform: none;
  }
  
  .nav-links li {
    justify-content: flex-start;
  }
  .nav-link {
    padding: 1rem 2rem;
    border-radius: 0;
    border-bottom: 1px solid #eee;
  }
  .nav-link.cta {
    margin-left: 0;
    border-radius: 999px;
    margin: 1rem 2rem;
    border-bottom: none;
  }
  .nav-toggle {
    display: block;
  }
  .timeline-section {
    padding: 3rem 0.5rem 1rem 0.5rem;
  }
  .timeline {
    margin-left: 0;
    padding-left: 0;
  }
  .timeline-dot {
    width: 16px;
    height: 16px;
    left: 50%;
    top: 1.1rem;
  }
  .profile-pic {
    width: 90px;
    height: 90px;
  }
}

/* Accessibility: Focus Styles */
.nav-link:focus, .footer-link:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
} 

/* Old animation system removed - now using scroll-based animations */

/* === Dark Mode === */
body.dark-theme {
  background: #0f0f0f;
  color: #f8fafc;
}
body.dark-theme header {
  background: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  height: auto;
  min-height: 56px;
}
body.dark-theme .navbar {
  background: transparent;
}
body.dark-theme .nav-link {
  color: #f8fafc;
  background: transparent;
}
body.dark-theme .nav-link:hover, body.dark-theme .nav-link.active {
  background: #6366f1;
  color: #fff;
}
body.dark-theme .nav-link.cta {
  background: #6366f1;
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}
body.dark-theme .nav-link.cta:hover, body.dark-theme .nav-link.cta:focus {
  background: #4338ca;
}
body.dark-theme .nav-links {
  background: #232336;
}
body.dark-theme .hero {
  background: linear-gradient(135deg, #232336 0%, #18181b 100%);
}
body.dark-theme .profile-pic {
  border: 6px solid #232336;
  background: #232336;
}
body.dark-theme .tag {
  background: #312e81;
  color: #c7d2fe;
}
body.dark-theme .skill-tags .tag {
  background: #1a1a1a;
  color: #c7d2fe;
  border: 1px solid #312e81;
}
body.dark-theme .project-card, body.dark-theme .skill-card, body.dark-theme .contact-form {
  background: #1a1a1a;
  color: #f8fafc;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  border: 1px solid #2a2a2a;
}

body.dark-theme .project-card:hover,
body.dark-theme .project-card:focus {
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  border-color: #6366f1;
}

body.dark-theme .project-card:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  border-color: #6366f1;
}
/* Dark theme hover effects - inherits from main hover rule */
body.dark-theme .skill-card:hover, body.dark-theme .skill-card:focus {
  transform: scale(1.05);
  z-index: 10;
}
body.dark-theme .cv-embed {
  background: #232336;
  border-color: #312e81;
}
body.dark-theme .footer {
  background: #232336;
  color: #a5b4fc;
}
body.dark-theme .footer-link {
  color: #a5b4fc;
}
body.dark-theme .footer-link:hover, body.dark-theme .footer-link:focus {
  color: #fff;
}
body.dark-theme input, body.dark-theme textarea {
  background: #18181b;
  color: #f3f4f6;
  border-color: #312e81;
}
body.dark-theme input:focus, body.dark-theme textarea:focus {
  border-color: #6366f1;
  background: #232336;
}
body.dark-theme .contact-submit {
  background: #6366f1;
  color: #fff;
}

/* === Dark Mode Toggle === */
.dark-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: auto;
  background: #fff;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  z-index: 10000;
  user-select: none;
  touch-action: none;
}
.dark-toggle:hover {
  background: #f8fafc;
  border-color: #6366f1;
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(99,102,241,0.15);
}
.dark-toggle.dragging {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(99,102,241,0.2);
  cursor: grabbing;
}
.dark-toggle.minimized {
  width: 20px;
  opacity: 0.7;
  background: #6366f1;
  border-color: #6366f1;
}
.dark-toggle.minimized:hover {
  width: 50px;
  opacity: 1;
  background: #fff;
  border-color: #6366f1;
}
.dark-toggle-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  color: #6366f1;
  transition: color 0.2s;
}
body.dark-theme .dark-toggle {
  background: #232336;
  border-color: #4b5563;
}
body.dark-theme .dark-toggle:hover {
  background: #1f2937;
  border-color: #a5b4fc;
}
body.dark-theme .dark-toggle.minimized {
  background: #a5b4fc;
  border-color: #a5b4fc;
}
body.dark-theme .dark-toggle.minimized:hover {
  background: #232336;
  border-color: #a5b4fc;
}
body.dark-theme .dark-toggle-icon svg {
  color: #a5b4fc;
}
.dark-toggle:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* === Footer SVG Icon Styles === */
.footer-link svg {
  color: #6366f1;
  transition: color 0.2s, transform 0.2s;
}
.footer-link:hover svg, .footer-link:focus svg {
  color: #4338ca;
  transform: scale(1.13);
}
body.dark-theme .footer-link svg {
  color: #a5b4fc;
}
body.dark-theme .footer-link:hover svg, body.dark-theme .footer-link:focus svg {
  color: #fff;
} 

/* 1. Remove empty rulesets */
/* (No empty rulesets remain) */

/* 2. Main container - use document/window as the scroll container */
main {
  scroll-padding-top: 30px;
  overflow: visible;
  height: auto;
  width: 100%;
}

/* 3. Full-screen sections - let JavaScript handle scrolling */
.hero,
.projects-section,
.skills-section,
.cv-section,
.achievements-section,
.contact-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.5rem 2.5rem 1.5rem;
  margin: 0;
}

/* 4. Hero Section Vertical Card Layout */
.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: 2rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.13);
  padding: 3.5rem 4rem;
  max-width: 600px;
  width: 100%;
  gap: 2.2rem;
}
.profile-pic {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 6px solid #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  background: #fff;
  margin-bottom: 1.5rem;
}
.hero-content h1 {
  font-size: 2.7rem;
  font-weight: 800;
  margin-bottom: 1.2rem;
  text-align: center;
}
.tagline {
  font-size: 1.25rem;
  color: #555;
  margin-top: 0.5rem;
  text-align: center;
  max-width: 500px;
}
@media (max-width: 900px) {
  .hero-content {
    padding: 2rem 1.2rem;
    max-width: 95vw;
    gap: 1.5rem;
  }
  .profile-pic {
    width: 120px;
    height: 120px;
  }
  .hero-content h1 {
    font-size: 2rem;
  }
}
body.dark-theme .hero-content {
  background: #232336;
  box-shadow: 0 8px 40px rgba(99,102,241,0.13);
}
body.dark-theme .profile-pic {
  border: 6px solid #232336;
  background: #232336;
}

/* 5. Section Titles */
.hero h1,
.projects-section h2,
.skills-section h2,
.cv-section h2,
.achievements-section h2,
.contact-section h2 {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 2.5rem;
  letter-spacing: -0.01em;
}

/* Dark mode section headings */
body.dark-theme .hero h1,
body.dark-theme .projects-section h2,
body.dark-theme .skills-section h2,
body.dark-theme .cv-section h2,
body.dark-theme .achievements-section h2,
body.dark-theme .contact-section h2 {
  color: #f8fafc;
}

/* 6. Projects and Skills Grid */
.projects-grid,
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
  width: 100%;
  max-width: 1200px;
  justify-items: center;
}
.skill-card {
  min-width: 320px;
  max-width: 420px;
  min-height: 320px;
  padding: 3rem 2.5rem 2.5rem 2.5rem;
  font-size: 1.18rem;
  margin: 0 auto;
  box-shadow: 0 6px 32px rgba(0,0,0,0.10);
  border-radius: 1.5rem;
}
.project-title {
  font-size: 2rem;
  margin-bottom: 1.2rem;
}
.skill-title {
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  text-align: center;
}
/* Skills section specific styling for better readability */
.skills-section .skill-title {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 1.2rem;
}
.project-desc {
  font-size: 1.15rem;
}
.tag {
  font-size: 1.05rem;
  padding: 0.35em 1.1em;
}
@media (max-width: 1100px) {
  .projects-grid,
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}
@media (max-width: 700px) {
  .projects-grid,
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .project-card {
    min-width: 220px;
    max-width: 95vw;
    min-height: 220px;
    padding: 2rem 1.2rem 1.2rem 1.2rem;
    font-size: 1rem;
  }
  .skill-card {
    min-width: 220px;
    max-width: 95vw;
    min-height: 220px;
    padding: 2rem 1.2rem 1.2rem 1.2rem;
    font-size: 1rem;
  }
  
  /* Additional responsive WIP animation for this breakpoint */
  .project-card[data-wip="true"].wip-active::after {
    font-size: clamp(0.9rem, 4vw, 1.4rem);
    padding: 0.5rem;
  }
}

/* 7. CV/Resume Section PDF */
.cv-embed-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
.cv-embed {
  width: 95vw;
  max-width: 1100px;
  min-height: 70vh;
  height: 80vh;
  border: 1.5px solid #e5e7eb;
  border-radius: 1.2rem;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
}
@media (max-width: 900px) {
  .cv-embed {
    min-height: 50vh;
    height: 60vh;
    max-width: 98vw;
  }
}
@media (max-width: 600px) {
  .cv-embed {
    min-height: 40vh;
    height: 50vh;
    max-width: 100vw;
  }
}

/* 8. Achievements/Extra Curricular Section */
.achievements-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 1.5rem;
}
.achievements-section h2 {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 2.5rem;
  letter-spacing: -0.01em;
}
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  width: 100%;
  max-width: 1200px;
  justify-items: center;
  align-items: stretch;
}
.achievement-card {
  width: 100%;
  max-width: 420px;
  min-height: 280px;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
  font-size: clamp(1rem, 2.5vw, 1.18rem);
  margin: 0 auto;
  box-shadow: 0 6px 32px rgba(0,0,0,0.10);
  border-radius: clamp(1rem, 3vw, 1.5rem);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  box-sizing: border-box;
}
.achievement-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: clamp(0.8rem, 2vw, 1.2rem);
  line-height: 1.2;
}
@media (max-width: 1100px) {
  .achievement-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(1.2rem, 3vw, 2rem);
  }
}

@media (max-width: 768px) {
  .achievement-grid {
    grid-template-columns: 1fr;
    gap: clamp(1rem, 2.5vw, 1.5rem);
    max-width: 95vw;
  }
  
  .achievement-card {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    padding: clamp(1.5rem, 4vw, 2rem) clamp(1rem, 3vw, 1.5rem);
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  }
  
  .achievement-title {
    font-size: clamp(1.5rem, 4vw, 1.8rem);
    margin-bottom: clamp(0.8rem, 2vw, 1rem);
  }
}
body.dark-theme .achievement-card {
  background: #232336;
  color: #f3f4f6;
  box-shadow: 0 6px 32px rgba(99,102,241,0.13);
}

/* Extra small mobile optimization */
@media (max-width: 480px) {
  .achievement-grid {
    gap: 1rem;
    padding: 0 0.5rem;
  }
  
  .achievement-card {
    padding: 1.2rem 1rem;
    font-size: 0.95rem;
    border-radius: 0.8rem;
  }
  
  .achievement-title {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
  }
  
  .achievement-card ul {
    margin: 0;
    padding-left: 1.2rem;
  }
  
  .achievement-card li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
  }
}

/* General achievement card list styling */
.achievement-card ul {
  margin: 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.achievement-card li {
  margin-bottom: 0.6rem;
  line-height: 1.5;
  color: inherit;
}

/* 9. Remove overflow: hidden or other properties that break scroll snap (none present) */ 

/* Section vertical spacing for clarity */
.hero,
.projects-section,
.skills-section,
.cv-section,
.achievements-section,
.contact-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.5rem 2.5rem 1.5rem;
  margin: 0;
}

/* Remove margin-bottom from last section to avoid extra space at end */
.contact-section {
  margin-bottom: 0;
} 

/* Section vertical spacing and visual distinction */
.hero,
.projects-section,
.skills-section,
.cv-section,
.achievements-section,
.contact-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 1.5rem 3rem 1.5rem;
  margin: 0;
  position: relative;
}

/* Remove margin-bottom from last section to avoid extra space at end */
.contact-section {
  margin-bottom: 0;
}

/* Subtle section divider (faint line at bottom of each section except last) */
.hero:not(.contact-section)::after,
.projects-section:not(.contact-section)::after,
.skills-section:not(.contact-section)::after,
.cv-section:not(.contact-section)::after,
.achievements-section:not(.contact-section)::after {
  content: '';
  display: block;
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e5e7eb 60%, transparent);
  opacity: 0.7;
  pointer-events: none;
}
body.dark-theme .hero:not(.contact-section)::after,
body.dark-theme .projects-section:not(.contact-section)::after,
body.dark-theme .skills-section:not(.contact-section)::after,
body.dark-theme .cv-section:not(.contact-section)::after,
body.dark-theme .achievements-section:not(.contact-section)::after {
  background: linear-gradient(90deg, transparent, #312e81 60%, transparent);
}

/* Optional: alternate subtle background for every other section for page feel */
.projects-section,
.cv-section {
  background: #f7f8fa;
}
body.dark-theme .projects-section,
body.dark-theme .cv-section {
  background: #232336;
} 

/* About Me section redesign */
.about-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem 1.5rem 3rem 1.5rem;
  margin: 0;
  position: relative;
  text-align: center;
}

.about-heading {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 2.5rem;
  color: #222;
  letter-spacing: -0.02em;
}


.about-bio {
  font-size: 1.25rem;
  line-height: 1.7;
  color: #555;
  max-width: 700px;
  margin-bottom: 3rem;
  text-align: center;
}

.timeline-container {
  width: 100%;
  max-width: 1000px;
  margin-top: 2rem;
}

.timeline-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 3rem;
  color: #222;
  text-align: center;
}

.timeline-horizontal {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 3rem 1rem;
  gap: 1.5rem;
}

.timeline-line {
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  height: 2px;
  background: #e5e7eb;
  transform: translateY(-50%);
  z-index: 1;
}

.timeline-milestone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 280px;
  max-width: 320px;
  z-index: 2;
}

/* Milestone cards above the line */
.milestone-above .milestone-content {
  transform: translateY(-50px);
}

/* Milestone cards below the line */
.milestone-below .milestone-content {
  transform: translateY(50px);
}

.milestone-content {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 1.2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  text-align: center;
  width: 100%;
  border: 1px solid #f1f5f9;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.milestone-company {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: #222;
  line-height: 1.3;
}

.milestone-role {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #6366f1;
  line-height: 1.3;
}

.milestone-date {
  font-size: 0.7rem;
  font-weight: 500;
  color: #666;
  margin-bottom: 0.4rem;
  display: block;
}

.milestone-description {
  font-size: 0.75rem;
  color: #555;
  line-height: 1.4;
  margin: 0;
}

/* Dark theme styles for timeline */
body.dark-theme .about-heading {
  color: #f8fafc;
}

body.dark-theme .about-bio {
  color: #d1d5db;
}

body.dark-theme .timeline-title {
  color: #f8fafc;
}

body.dark-theme .timeline-line {
  background: #6366f1;
}

body.dark-theme .milestone-content {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

body.dark-theme .milestone-company {
  color: #f8fafc;
}

body.dark-theme .milestone-role {
  color: #c7d2fe;
}

body.dark-theme .milestone-date {
  color: #9ca3af;
}

body.dark-theme .milestone-description {
  color: #d1d5db;
}

/* Responsive design for timeline */
@media (max-width: 1100px) {
  .timeline-horizontal {
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    padding: 2rem 0;
  }
  
  .timeline-line {
    display: none;
  }
  
  .timeline-milestone {
    flex: none;
    width: 100%;
    max-width: 350px;
  }
  
  /* Reset positioning for mobile - all cards inline */
  .milestone-above .milestone-content,
  .milestone-below .milestone-content {
    transform: none;
  }
}

@media (max-width: 900px) {
  .timeline-title {
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
  }
  
  .milestone-content {
    padding: 1rem 0.8rem;
  }
  
  .milestone-company {
    font-size: 0.9rem;
  }
  
  .milestone-role {
    font-size: 0.8rem;
  }
}

@media (max-width: 600px) {
  .timeline-container {
    margin-top: 1.5rem;
  }
  
  .timeline-title {
    font-size: 1.6rem;
    margin-bottom: 2rem;
  }
  
  .timeline-horizontal {
    gap: 2rem;
    padding: 1.5rem 0;
  }
  
  .milestone-content {
    max-width: 280px;
    padding: 0.8rem 0.6rem;
  }
  
  .milestone-company {
    font-size: 0.85rem;
  }
  
  .milestone-role {
    font-size: 0.75rem;
  }
  
  .milestone-description {
    font-size: 0.7rem;
  }
}

/* WIP Project Card Overlay */
.project-card[data-wip="true"] {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.project-card[data-wip="true"].wip-active::after {
  content: 'WORK IN PROGRESS';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ffb347 0%, #ffcc80 100%);
  color: #7c4700;
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: wip-waterfall 0.5s cubic-bezier(.4,2,.6,1);
  letter-spacing: 0.05em;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  border-radius: inherit;
  text-align: center;
  padding: 1rem;
  box-sizing: border-box;
}

/* Ensure WIP overlay covers transformed cards properly */
.project-card[data-wip="true"]:hover.wip-active::after,
.project-card[data-wip="true"]:focus.wip-active::after {
  transform: scale(0.97) translateY(4px);
}

@keyframes wip-waterfall {
  0% { 
    transform: translateY(-100%); 
    opacity: 0.5; 
  }
  60% { 
    transform: translateY(2%); 
    opacity: 1; 
  }
  100% { 
    transform: translateY(0); 
    opacity: 1; 
  }
}

/* Large screen navigation spacing */
@media (min-width: 1200px) {
  .navbar {
    max-width: 1400px;
    padding: 1rem 3rem;
  }
  .nav-links {
    gap: clamp(1.5rem, 3vw, 3rem);
  }
}

/* Desktop scaling for About Me section */
@media (min-width: 1024px) {
  #about.hero .hero-content {
    padding: 4.5rem 5rem;
    max-width: 720px;
    gap: 2.8rem;
  }

  #about.hero .hero-content h1 {
    font-size: 3.2rem;
    margin-bottom: 1.5rem;
  }
  #about .tagline {
    font-size: 1.4rem;
    line-height: 1.6;
  }
  #about .timeline-title {
    font-size: 2.4rem;
    margin-bottom: 4rem;
  }
  #about .timeline-container {
    margin-top: 3rem;
    max-width: 1200px;
  }
  #about .timeline-horizontal {
    padding: 4rem 2rem;
    gap: 2rem;
  }
  #about .timeline-milestone {
    min-width: 320px;
    max-width: 360px;
  }
  #about .milestone-content {
    padding: 2rem 1.5rem;
    min-height: 160px;
  }
}

/* Responsive adjustments for About Me */
@media (max-width: 900px) {
  #about.hero .hero-content {
    padding: 2rem 1.2rem;
    max-width: 95vw;
    gap: 1.5rem;
  }

  #about.hero .hero-content h1 {
    font-size: 2rem;
  }
} 

/* --- CV Section: Improve dark mode readability --- */
body.dark-theme .cv-section {
  background: #181a23 !important;
  color: #f3f4f6 !important;
}
body.dark-theme .cv-section h2 {
  color: #f3f4f6 !important;
}
body.dark-theme .cv-section, 
body.dark-theme .cv-embed-wrapper, 
body.dark-theme .cv-embed {
  background: #181a23 !important;
  color: #f3f4f6 !important;
}
@media (max-width: 700px) {
  body.dark-theme .cv-section, 
  body.dark-theme .cv-embed-wrapper, 
  body.dark-theme .cv-embed {
    background: #181a23 !important;
    color: #f3f4f6 !important;
  }
}

/* --- Nav Bar: Improve active tab highlight for both themes --- */
.nav-link.active {
  background: #6366f1;
  color: #fff;
  box-shadow: 0 2px 12px rgba(99,102,241,0.18);
  position: relative;
  z-index: 2;
}
body.dark-theme .nav-link.active {
  background: #a5b4fc;
  color: #181a23;
  box-shadow: 0 2px 12px rgba(165,180,252,0.18);
}

/* Add a visible underline or border for extra clarity */
.nav-link.active::after {
  content: '';
  display: block;
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 6px;
  height: 3px;
  border-radius: 2px;
  background: #4338ca;
  opacity: 0.85;
}
body.dark-theme .nav-link.active::after {
  background: #6366f1;
  opacity: 0.95;
}

/* Ensure nav-link is position:relative for ::after */
.nav-link {
  position: relative;
  z-index: 1;
} 

main {
  overflow: visible;
  height: auto;
  width: 100%;
}
/* Desktop and large screens: standard behavior */
main > section,
.about-section,
.projects-section,
.skills-section,
.achievements-section,
.contact-section {
  /* Remove scroll-snap-align: start; - let JavaScript handle it */
  /* Remove scroll-snap-stop: always; - let JavaScript handle it */
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  position: relative;
  width: 100%;
  overflow-y: visible;
  background-clip: padding-box;
}

/* Mobile: Allow scrolling within sections, prevent section-to-section navigation */
@media (max-width: 768px) {
  body {
    position: relative;
    width: 100%;
    height: auto;
    overflow-y: auto;
  }
  
  main {
    scroll-snap-type: none;
    overflow: visible;
    height: auto;
    position: relative;
  }
  
  main > section,
  .about-section,
  .projects-section,
  .skills-section,
  .achievements-section,
  .contact-section {
    scroll-snap-align: start;
    scroll-snap-stop: always;
    min-height: 100vh;
    height: 100vh;
    padding-top: 80px; /* Space for fixed nav */
    padding-bottom: 0;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    margin: 0;
    overflow: hidden;
    border-bottom: none;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  /* About section: extra top spacing */
  .about-section {
    padding-top: 96px;
  }
}

/* Very small screens: additional adjustments */
@media (max-width: 480px) {
  main > section,
  .about-section,
  .projects-section,
  .skills-section,
  .achievements-section,
  .contact-section {
    padding-top: 90px;
    padding-bottom: 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .about-section {
    padding-top: 110px;
  }
}

/* Prevent any section bleed-through */
.about-section,
.projects-section,
.skills-section,
.achievements-section,
.contact-section {
  margin: 0;
  border-bottom: none;
}

/* Desktop: remove borders */
@media (min-width: 769px) {
  .about-section,
  .projects-section,
  .skills-section,
  .achievements-section,
  .contact-section {
    border-bottom: none;
  }
}

/* Ensure smooth scrolling on all devices */
html {
  scroll-behavior: smooth;
}

/* === Momentum Scrolling === */
main {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* === Unified Page Scrolling & Snap (Overrides) === */
:root { --header-height: 80px; }
html, body { height: 100%; }
/* Apply scroll snap to the root scroller for broad browser compatibility */
html { scroll-snap-type: y mandatory; scroll-padding-top: var(--header-height); }
body {
  overflow-y: auto !important;
  scroll-snap-type: y mandatory;
  scroll-padding-top: var(--header-height);
}

/* Only one scrollbar: window. No inner scroll on main */
main {
  overflow: visible !important;
  height: auto !important;
  min-height: 100%;
}

/* Each section is a full page and snaps cleanly */
main > section,
.about-section,
.projects-section,
.skills-section,
.achievements-section,
.contact-section {
  min-height: 100vh !important;
  height: auto !important;
  scroll-snap-align: start !important;
  scroll-snap-stop: always !important;
  margin: 0 !important;
  overflow: visible !important;
}

/* Account for fixed header when jumping via anchors */
.about-section,
.projects-section,
.skills-section,
.achievements-section,
.contact-section {
  scroll-margin-top: var(--header-height);
}

/* Mobile keeps the same behavior */
@media (max-width: 768px) {
  body { overflow-y: auto !important; }
}

/* --- Defined boundaries and transition-only gutters --- */
/* Disable any always-on section dividers */
.projects-section::before,
.projects-section::after,
.skills-section::before,
.skills-section::after,
.cv-section::before,
.cv-section::after,
.achievements-section::before,
.achievements-section::after,
.about-section::before,
.about-section::after,
.contact-section::before,
.contact-section::after {
  content: none !important;
}

/* Variables for gutter sizing */
:root {
  /* Larger, responsive transition-only gutters */
  --section-gutter-thickness: clamp(40px, 8svh, 120px);
  --section-gutter-inset: 8%;
  /* Layered divider tokens */
  --section-divider-width: clamp(1px, 0.25vw, 2px);
  --section-divider-gap: clamp(2px, 0.5vw, 6px);
  --section-divider-strong: rgba(148, 163, 184, 0.92); /* slate-300-ish */
  --section-divider-glow: rgba(99, 102, 241, 0.22);   /* indigo glow */
  --section-gutter-fade: rgba(249, 249, 249, 0.96);
}

body.dark-theme {
  --section-divider-strong: rgba(165, 180, 252, 0.9); /* indigo-200-ish */
  --section-divider-glow: rgba(99, 102, 241, 0.28);
  --section-gutter-fade: rgba(24, 26, 35, 0.88);
}

/* Transition-only gutters and layered borders: bottom (leaving) */
body.is-scrolling .about-section::before,
body.is-scrolling .projects-section::before,
body.is-scrolling .skills-section::before,
body.is-scrolling .cv-section::before,
body.is-scrolling .achievements-section::before,
body.is-scrolling .contact-section::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--section-gutter-thickness);
  pointer-events: none;
  z-index: 3;
  background-repeat: no-repeat, no-repeat, no-repeat;
  /* Layer order: glow (thicker) + two crisp lines separated by a gap, over a fade gutter */
  background-image:
    /* soft outer glow */
    linear-gradient(90deg, transparent, var(--section-divider-glow) 50%, transparent),
    /* lower crisp line at seam */
    linear-gradient(90deg, transparent, var(--section-divider-strong) 50%, transparent),
    /* fade gutter */
    linear-gradient(to top, var(--section-gutter-fade) 0%, rgba(0,0,0,0) 80%);
  background-size:
    calc(100% - (2 * var(--section-gutter-inset))) calc(2 * var(--section-divider-width)),
    calc(100% - (2 * var(--section-gutter-inset))) var(--section-divider-width),
    100% 100%;
  background-position:
    center calc(100% - var(--section-divider-width)),
    center calc(100% - var(--section-divider-gap) - (2 * var(--section-divider-width))),
    left bottom;
}

/* Transition-only gutters and layered borders: top (entering) */
body.is-scrolling .about-section::after,
body.is-scrolling .projects-section::after,
body.is-scrolling .skills-section::after,
body.is-scrolling .cv-section::after,
body.is-scrolling .achievements-section::after,
body.is-scrolling .contact-section::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--section-gutter-thickness);
  pointer-events: none;
  z-index: 3;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-image:
    /* soft outer glow */
    linear-gradient(90deg, transparent, var(--section-divider-glow) 50%, transparent),
    /* upper crisp line at seam */
    linear-gradient(90deg, transparent, var(--section-divider-strong) 50%, transparent),
    /* fade gutter (top) */
    linear-gradient(to bottom, var(--section-gutter-fade) 0%, rgba(0,0,0,0) 80%);
  background-size:
    calc(100% - (2 * var(--section-gutter-inset))) calc(2 * var(--section-divider-width)),
    calc(100% - (2 * var(--section-gutter-inset))) var(--section-divider-width),
    100% 100%;
  background-position:
    center var(--section-divider-width),
    center calc(var(--section-divider-gap) + (2 * var(--section-divider-width))),
    left top;
}

/* Section visual isolation: prevent color bleed across sections */
.about-section,
.projects-section,
.skills-section,
.achievements-section,
.contact-section {
  position: relative;
  isolation: isolate; /* create new stacking context */
  overflow: clip; /* clip gutters strictly inside the section */
}

/* Ensure section content is above transition gutters/dividers */
.about-section > *,
.projects-section > *,
.skills-section > *,
.achievements-section > *,
.contact-section > * {
  position: relative;
  z-index: 1;
}

/* Keep gutters/dividers below section content but above section background */
body.is-scrolling .about-section::before,
body.is-scrolling .about-section::after,
body.is-scrolling .projects-section::before,
body.is-scrolling .projects-section::after,
body.is-scrolling .skills-section::before,
body.is-scrolling .skills-section::after,
body.is-scrolling .cv-section::before,
body.is-scrolling .cv-section::after,
body.is-scrolling .achievements-section::before,
body.is-scrolling .achievements-section::after,
body.is-scrolling .contact-section::before,
body.is-scrolling .contact-section::after {
  z-index: 0;
}

/* Accessibility: honor reduced motion without breaking the snap model */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { scroll-snap-type: y mandatory; }
  :root {
    --section-gutter-thickness: clamp(24px, 4svh, 64px);
    --section-divider-gap: clamp(1px, 0.25vw, 4px);
  }
}

/* === Scroll-based Animations === */
.scroll-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-scale-in {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

.scroll-slide-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-slide-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* === Scroll Progress Indicator === */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(99, 102, 241, 0.1);
  z-index: 1002;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s ease-out;
}

.scroll-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #4338ca);
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s ease-out;
}

/* Dark theme scroll progress */
body.dark-theme .scroll-progress {
  background: rgba(99, 102, 241, 0.2);
}

body.dark-theme .scroll-progress-bar {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

/* === Scroll Direction Indicator === */
.scroll-direction-indicator {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(99, 102, 241, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
  pointer-events: none;
}

.scroll-direction-indicator.show {
  opacity: 1;
}

/* Dark theme scroll direction indicator */
body.dark-theme .scroll-direction-indicator {
  background: rgba(99, 102, 241, 0.8);
}

/* Mobile: Hide scroll direction indicator */
@media (max-width: 768px) {
  .scroll-direction-indicator {
    display: none;
  }
}