/* Modern Reset and Variables */
:root {
  /* Premium Color Palette for Robotics/AI PhD */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Primary Accent: Scientific Blue */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;

  /* Secondary Accent: Teal/Cyan for "Future/Tech" vibe */
  --secondary: #0891b2;

  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --radius-md: 0.5rem;
  --radius-lg: 1rem;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
  line-height: 1.2;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

p {
  margin-bottom: 1.5rem;
}

/* Layout Architecture */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Modern Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 2.5rem 2rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  margin-bottom: 3rem;
}

.sidebar-header h2 {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
  transform: translateX(4px);
}

.nav-link i {
  margin-right: 0.75rem;
  width: 1.25rem;
  text-align: center;
}

/* Main Content Area */
main,
.main-content {
  margin-left: 280px;
  padding: 5rem 4rem;
  width: calc(100% - 280px);
  max-width: 1600px;
  /* Wider content for better gallery view */
}

/* Sections */
section {
  margin-bottom: 8rem;
  scroll-margin-top: 2rem;
}

.section-header {
  margin-bottom: 3rem;
  position: relative;
  display: inline-block;
}

.section-title {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.section-header::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.5rem;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

/* Profile / Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 5rem;
  align-items: center;
  min-height: 80vh;
  /* Make hero take up most of initial view */
}

.hero-text h1 {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-main) 0%, #4b5563 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-bio {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  line-height: 1.8;
}

.contact-bar {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: white;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-size: 1.25rem;
  transition: var(--transition);
}

.social-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  /* Increased spacing */
  align-items: center;
  flex-wrap: wrap;
}

.contact-links a {
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.contact-links a:hover {
  color: var(--primary);
  transform: translateY(-2px);
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.profile-image-container {
  position: relative;
}

.profile-image {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  transition: var(--transition);
  border: 6px solid #fff;
  z-index: 2;
  position: relative;
}

.profile-image:hover {
  transform: scale(1.02) rotate(1deg);
}

/* Decorative background for image */
.profile-image-container::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100%;
  height: 100%;
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  z-index: 1;
}

/* Education Cards */
.education-list {
  display: grid;
  gap: 1.5rem;
}

.edu-item {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.edu-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.edu-main h4 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.edu-inst {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
}

.edu-year {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.375rem 1rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Research & Projects - Unified Premium Design */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 2.5rem;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(37, 99, 235, 0.1);
}

.card-media-wrapper {
  height: 250px;
  overflow: hidden;
  position: relative;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* For contain fit images like diagrams */
.card-img.contain {
  object-fit: contain;
  padding: 1rem;
  background: white;
}

.card:hover .card-img {
  transform: scale(1.08);
}

.card-icon-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem;
  border-radius: 50%;
  transition: var(--transition);
  color: var(--primary);
}

.card-media-wrapper:hover .card-icon-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.card-type {
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.card-venue {
  color: var(--text-muted);
  font-style: italic;
}

.card-title {
  font-size: 1.35rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  font-weight: 700;
}

.card-title a {
  color: var(--text-main);
  background-image: linear-gradient(var(--primary), var(--primary));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.3s, color 0.3s;
}

.card:hover .card-title a {
  color: var(--primary);
  background-size: 100% 2px;
}

.card-desc {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tech-tag {
  background: var(--bg-body);
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.card-links {
  display: flex;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.card-link {
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Lightbox */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

#caption {
  text-align: center;
  color: #fff;
  padding: 1.5rem;
  font-weight: 500;
  font-size: 1.1rem;
}

.close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 3rem;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  transition: var(--transition);
}

.close:hover {
  color: white;
  transform: rotate(90deg);
}

/* Footer */
.footer {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-light);
}

.footer-map {
  opacity: 0.6;
  transition: var(--transition);
  max-width: 200px;
  margin: 2rem auto 0;
  filter: saturate(0);
}

.footer-map:hover {
  opacity: 1;
  filter: saturate(1);
}

/* Responsive Handling */
@media (max-width: 1200px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
  }

  .main-content {
    margin-left: 240px;
    padding: 3rem 2rem;
    width: calc(100% - 240px);
  }

  .hero-text h1 {
    font-size: 3rem;
  }
}

@media (max-width: 768px) {
  .page-wrapper {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
  }

  .sidebar-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .sidebar-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    white-space: nowrap;
    background: #f1f5f9;
    margin-bottom: 0;
  }

  main,
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 2rem 1.5rem;
  }

  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 3rem;
    min-height: auto;
    margin-top: 2rem;
  }

  .hero-text h1 {
    font-size: 2.5rem;
  }

  .contact-bar {
    justify-content: center;
  }

  .edu-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    text-align: center;
  }

  .section-header::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .section-header {
    display: block;
    text-align: center;
  }
}

/* Experience Section - Timeline */
.timeline {
  position: relative;
  max-width: 100%;
  padding-left: 2rem;
  border-left: 2px solid var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.timeline-dot {
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 1rem;
  height: 1rem;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--primary-light);
  transform: translateX(-50%);
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.timeline-content:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateX(5px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.role-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

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

.logo-img {
  height: 60px;
  width: auto;
  object-fit: contain;
  margin-left: auto;
  /* push to right */
  /* mix-blend-mode: multiply; Not verifying backgrounds, removed to be safe */
}

/* Ensure logo in education is handled */
.edu-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem;
}

/* Fix for card images scaling */
.card-media-wrapper {
  background: #ffffff;
  /* White bg for transparent logos/graphs */
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img {
  height: 100%;
  width: 100%;
  object-fit: contain !important;
  /* Force contain for scientific figures */
  padding: 0.5rem;
  /* reduced padding */
}

/* Explicitly for photos that should cover */
.card-img.cover {
  object-fit: cover !important;
  padding: 0;
}

/* Research & Project specific styles */
.research-image,
.project-image,
.animated-gif {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
}

.research-image:hover,
.project-image:hover,
.animated-gif:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.dual-media-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.media-item {
  width: 100%;
}

.papertitle {
  font-weight: 700;
  color: var(--text-main);
}

/* Adjustments for Bootstrap Grid in our layout */
.content-container {
  margin-bottom: 4rem;
}