:root {
  /* Clean Minimalist Color Palette */
  --bg-body: #ffffff;
  /* Pure white background */
  --bg-sidebar: #ffffff;
  /* Pure white sidebar */
  --bg-card: #ffffff;
  /* Pure white cards */
  --bg-subtle: #f8fafc;
  /* Slate 50 */

  --text-primary: #111111;
  /* Near Black - High contrast */
  --text-secondary: #555555;
  /* Neutral Gray - Muted text */
  --text-accent: #111827;
  /* Dark Slate - Softer than pure black */

  --accent-color: #2563eb;
  /* Vibrant Blue */
  --accent-hover: #1d4ed8;
  /* Darker Blue for hover */

  --border-color: #e5e5e5;
  /* Light Gray */

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;

  --sidebar-width: 300px;
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.profile-header {
  margin-bottom: 2rem;
  text-align: left;
}

.profile-pic {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  margin-bottom: 1.5rem;
  border: 3px solid var(--bg-body);
  box-shadow: var(--shadow-md);
}

.name {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  /* Elegant Gradient Text */
  background: linear-gradient(135deg, #111827 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.5;
}

/* Navigation */
.navbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: auto;
  /* Pushes social links to bottom if needed, or just space */
}

.nav-link {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.5rem 0;
  transition: all 0.2s ease;
  display: inline-block;
}

.nav-link:hover {
  color: var(--accent-color);
  transform: translateX(4px);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent-color);
  font-weight: 600;
  border-left: 2px solid var(--accent-color);
  padding-left: 0.5rem;
  margin-left: -0.5rem;
  /* Counteract padding to alignment */
}

/* Social Links */
.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.social-icon {
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: color 0.2s ease;
}

.social-icon:hover {
  color: var(--accent-color);
  text-decoration: none;
}

/* Main Content Styles */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 4rem 5rem;
  max-width: 1120px;
  /* Limit content width for readability */
}

.section {
  margin-bottom: 4.5rem;
  scroll-margin-top: 2rem;
}

.section:last-child {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--text-accent);
  font-weight: 700;
}

/* About Section */
.bio p {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-size: 1.05rem;
}

/* Cards & Grid */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Project Card */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-image {
  width: 100%;
  height: 160px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-body);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-title {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-accent);
  display: block;
  margin-bottom: 0.5rem;
}

.project-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.project-tech {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: auto;
}

/* Blog Styles */
.blog-post-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

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

.blog-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--bg-body);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border-color);
}

.blog-post-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.blog-post-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.blog-post-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.blog-post-title a {
  color: var(--text-primary);
}

.blog-post-title a:hover {
  color: var(--accent-color);
  text-decoration: none;
}

.blog-post-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-read-more {
  margin-top: auto;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-color);
}

.blog-post-image {
  width: 100%;
  height: 180px;
  /* Fixed height for uniformity */
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
}

.blog-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.blog-category-section {
  margin-bottom: 3rem;
}

.blog-category-section.hidden {
  display: none;
}

/* News List */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.news-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.news-item:last-child {
  border-bottom: none;
}

.news-date {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.news-content {
  color: var(--text-primary);
  font-size: 1rem;
}

/* Buttons & Links */
.view-all-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.view-all-link:hover {
  color: var(--accent-color);
  text-decoration: none;
}

.btn-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-link:hover {
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .layout-wrapper {
    flex-direction: column;
  }

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

  .main-content {
    margin-left: 0;
    padding: 3rem 1.5rem;
  }

  .navbar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1.5rem 0;
  }

  .nav-link:hover {
    transform: none;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Dark Mode Support (Neutral) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-body: #0a0a0a;
    /* Near Black */
    --bg-sidebar: #111111;
    /* Dark Gray */
    --bg-card: #111111;
    /* Dark Gray */
    --bg-subtle: #1a1a1a;

    --text-primary: #ededed;
    /* Off-white */
    --text-secondary: #a1a1a1;
    /* Light Gray */
    --text-accent: #ffffff;

    --accent-color: #ffffff;
    /* White accent for dark mode */
    --accent-hover: #d4d4d4;

    --border-color: #262626;
    /* Dark Border */

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  }

  .profile-pic {
    border-color: var(--bg-sidebar);
  }

  .project-image {
    opacity: 0.9;
  }

  .name {
    background: linear-gradient(135deg, #ffffff 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

/* Research Section Styles (New List Layout) */
.research-list {
  margin-top: 1rem;
}

.publication-list {
  list-style-type: decimal;
  padding-left: 1.5rem;
  /* Space for numbers */
}

.publication-item {
  margin-bottom: 2rem;
  padding-left: 0.5rem;
  display: flex;
  gap: 1.5rem;
}

.pub-image-container {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  background-color: var(--bg-body);
}

.pub-image {
  width: 100%;
  height: 100%;
  max-width: 120px;
  max-height: 120px;
  min-width: 60px;
  min-height: 60px;
  object-fit: contain;
  display: block;
  background: #f8fafc;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.pub-content {
  flex: 1;
}

.publication-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.publication-authors {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.publication-authors .me {
  text-decoration: underline;
  text-decoration-color: var(--text-primary);
}

.publication-venue {
  font-size: 1rem;
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.publication-links {
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.pub-link {
  color: var(--accent-color);
  margin-right: 0.5rem;
  font-family: monospace;
  /* Optional: gives it a code-like feel */
  font-size: 0.9rem;
}

.pub-link:hover {
  text-decoration: none;
  background-color: var(--accent-color);
  color: var(--bg-body);
}

/* Hidden Content (Abstract & BibTeX) */
.publication-abstract,
.publication-bibtex {
  margin-top: 0.75rem;
  padding: 1rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.publication-bibtex pre {
  white-space: pre-wrap;
  font-family: monospace;
  margin: 0;
  color: var(--text-primary);
}

.hidden {
  display: none;
}

/* More Publications Link */
.more-publications {
  margin-top: 1rem;
  padding-left: 2rem;
  /* Align with list content */
}

/* All Publications Page */
.year-header {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text-accent);
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.year-header:first-of-type {
  margin-top: 0;
}

/* Responsive adjustments for images */
@media (max-width: 600px) {
  .publication-item {
    flex-direction: column;
    gap: 1rem;
  }

  .pub-image-container {
    width: 100%;
    max-width: 200px;
  }
}

/* Experience Section Styles */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.experience-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  align-items: flex-start;
}

.experience-item:last-child {
  border-bottom: none;
}

.exp-logo-container {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  /* border: 1px solid var(--border-color); */
  /* Optional: Remove border for cleaner look */
  border-radius: 0;
  /* Square logos like LinkedIn usually, or slight radius */
}

.exp-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.exp-details {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.role-title {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.company-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.4;
}

.exp-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .experience-item {
    gap: 0.75rem;
  }

  .exp-logo-container {
    width: 40px;
    height: 40px;
  }
}

/* Custom Blog Page Styles */

/* Blog Intro Section */
.blog-intro-header {
  text-align: center;
  margin-bottom: 3rem;
}

.blog-intro-header h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.blog-bio-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent-color);
}

.blog-bio-text p {
  margin-bottom: 1rem;
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.7;
}

.blog-bio-text p:last-child {
  margin-bottom: 0;
}

.why-write-section {
  padding: 1.5rem;
  background-color: transparent;
  border-left: 2px solid var(--border-color);
  margin-bottom: 2rem;
}

.why-write-section h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--text-accent);
}

.why-write-section p {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
}

.blog-separator {
  height: 1px;
  background-color: var(--border-color);
  margin: 4rem 0;
  width: 100%;
}

/* Category Headers */
.category-header {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-header h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.8rem;
}

.category-icon {
  font-size: 1.4rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Subcategories */
.subcategory-block {
  margin-bottom: 3rem;
}

.subcategory-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.5rem;
  display: inline-block;
}

.empty-category-text {
  color: var(--text-secondary);
  font-style: italic;
  padding-left: 1rem;
}

/* Book Titles */
.book-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .blog-intro-header h2 {
    font-size: 1.8rem;
  }

  .blog-bio-container {
    padding: 1.5rem;
  }
}

/* --- COLORFUL ADDITIONS --- */

/* Social Icons - Brand Colors */
.social-icon {
  transition: transform 0.2s ease, color 0.2s ease;
}

/* Email */
a[href^="mailto:"] .social-icon {
  color: #EA4335;
}

/* LinkedIn */
a[href*="linkedin.com"] .social-icon {
  color: #0A66C2;
}

/* GitHub */
a[href*="github.com"] .social-icon {
  color: var(--text-accent);
}

/* Medium */
a[href*="medium.com"] .social-icon {
  color: #00AB6C;
}

/* YouTube */
a[href*="youtube.com"] .social-icon {
  color: #FF0000;
}

/* Google Scholar */
a[href*="scholar.google.com"] .social-icon {
  color: #4285F4;
}

.social-icon:hover {
  transform: translateY(-3px);
  filter: brightness(1.2);
}

/* Blog Categories - Specific Colors */
.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-body);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  /* Subtle shadow container */
  margin-right: 0.5rem;
}

/* Tech - Blue */
.category-header:has(.fa-laptop-code) .category-icon {
  color: #2563eb;
  background-color: #eff6ff;
}

/* Startups - Green */
.category-header:has(.fa-chart-line) .category-icon {
  color: #059669;
  background-color: #f0fdf4;
}

/* University - Purple */
.category-header:has(.fa-university) .category-icon {
  color: #7c3aed;
  background-color: #f5f3ff;
}

/* Books - Amber */
.category-header:has(.fa-book) .category-icon {
  color: #d97706;
  background-color: #fffbeb;
}

/* Misc - Teal */
.category-header:has(.fa-coffee) .category-icon {
  color: #0d9488;
  background-color: #f0fdfa;
}

/* Bio Section Update */
.blog-bio-container {
  background-color: var(--bg-subtle);
  /* Slate 50 - subtle contrast */
  border-left-width: 4px;
}

/* --- ELEGANT COLOR UTILITIES --- */

/* Tech Tags (Pastel Pills) */
.tech-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  margin: 0.1rem;
  border-radius: 99px;
  /* Pill shape */
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--bg-subtle);
  /* Default gray */
  color: var(--text-secondary);
  border: 1px solid transparent;
}

/* Specific Tag Colors (can be applied via n-th child or specific classes if we want more control, 
   but for now let's make them cycling or just nice defaults) */
.tech-tag.blue {
  background-color: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.tech-tag.green {
  background-color: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.tech-tag.purple {
  background-color: #faf5ff;
  color: #7e22ce;
  border-color: #e9d5ff;
}

.tech-tag.amber {
  background-color: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.tech-tag.rose {
  background-color: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

/* Styles for Project Cards to pop */
.project-card {
  border-top: 4px solid transparent;
  /* Prepare for color */
}

/* Nth-child trick for varied project card colors without manual classes */
.project-card:nth-child(3n+1) {
  border-top-color: #3b82f6;
}

/* Blue */
.project-card:nth-child(3n+2) {
  border-top-color: #8b5cf6;
}

/* Purple */
.project-card:nth-child(3n+3) {
  border-top-color: #10b981;
}

/* Green */

/* Venue Highlight */
.venue-pill {
  display: inline-block;
  font-weight: 600;
  color: #c2410c;
  /* Deep Orange/Rust */
  position: relative;
  z-index: 1;
}

.venue-pill::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -2px;
  right: -2px;
  height: 6px;
  background-color: #ffedd5;
  /* Light Orange highlighter */
  z-index: -1;
  opacity: 0.7;
}

/* Research Paper Styling */
.research-paper {
  font-family: 'Times New Roman', Times, serif;
  line-height: 1.8;
  color: var(--text-primary);
  text-align: justify;
  max-width: 850px;
  margin: 0 auto;
  counter-reset: section;
}

/* Figures must never exceed the 850px text column. Without this the page
   scrolls horizontally on any screen narrower than the raw image, which the
   router-scheduler post (1190px plots) hit immediately. Wide tables and code
   get their own scroll container for the same reason: the page body should
   never be the thing that scrolls sideways. */
.research-paper img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
}

.research-paper .paper-table,
.research-paper table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.research-paper pre {
  max-width: 100%;
  overflow-x: auto;
}

.research-paper h3 {
  counter-reset: subsection;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  font-family: 'Times New Roman', Times, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  text-transform: uppercase;
}

.research-paper h3::before {
  counter-increment: section;
  content: counter(section) ". ";
}

.research-paper h4 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-family: 'Times New Roman', Times, serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.research-paper h4::before {
  counter-increment: subsection;
  content: counter(section) "." counter(subsection) " ";
}

.research-paper p {
  margin-bottom: 1.5rem;
  font-size: 1.15rem;
}

.research-paper ul,
.research-paper ol {
  margin-bottom: 1.5rem;
  padding-left: 2.5rem;
  font-size: 1.15rem;
}

.research-paper li {
  margin-bottom: 0.75rem;
}

.research-paper .algorithm-block {
  font-family: 'Courier New', Courier, monospace;
  background: #f8f9fa;
  border: 1px solid #000;
  box-shadow: none;
  margin: 2rem 0;
}

.research-paper .algorithm-block strong {
  font-family: 'Times New Roman', Times, serif;
  font-size: 1.1rem;
}

.research-paper .references p {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  text-align: left;
  line-height: 1.5;
}
/* Paper tables (used in research write-ups: BOFlow, etc.) */
.research-paper .paper-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  text-align: right;
}

.research-paper .paper-table caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.research-paper .paper-table th,
.research-paper .paper-table td {
  padding: 0.5rem 0.7rem;
  border: none;
  white-space: nowrap;
}

.research-paper .paper-table thead th {
  border-top: 2px solid var(--text-primary);
  border-bottom: 1px solid var(--text-primary);
  font-weight: 600;
  color: var(--text-primary);
}

.research-paper .paper-table tbody tr:last-child td {
  border-bottom: 2px solid var(--text-primary);
}

.research-paper .paper-table th:first-child,
.research-paper .paper-table td:first-child {
  text-align: left;
}

.research-paper .paper-table tbody tr:hover {
  background-color: var(--bg-subtle);
}

.research-paper .paper-table tr.row-ours {
  background-color: #fff7ed;
}

.research-paper .paper-table tr.row-ours:hover {
  background-color: #ffedd5;
}

.research-paper code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.92em;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

/* News / Talks list */
.news-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.news-list li {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  line-height: 1.6;
}

.news-list li:last-child {
  border-bottom: none;
}

.news-date {
  flex: 0 0 6.5rem;
  font-weight: 600;
  color: #c2410c;
  font-size: 0.85rem;
  padding-top: 0.15rem;
}

@media (max-width: 640px) {
  .news-list li {
    flex-direction: column;
    gap: 0.15rem;
  }

  .news-date {
    flex: none;
  }
}

/* Experience / education extras */
.exp-logo-container .exp-icon {
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.exp-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 0.4rem;
}

.exp-details {
  min-width: 0;
}

/* Publication links that are not yet live (paper/code not public) */
.pub-link-pending {
  color: var(--text-secondary);
  cursor: default;
}

.pub-link-pending:hover {
  background-color: transparent;
  color: var(--text-secondary);
}

/* ---------- Projects grid: two tiles per row ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.projects-grid .project-card {
  height: 100%;
}

.projects-grid .project-info {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.projects-grid .project-description {
  flex: 1 1 auto;
}

@media (max-width: 1100px) {
  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Project links / tech tags sit at the bottom of each tile */
.project-links {
  margin-top: 0.75rem;
}

.project-tech {
  margin-top: 0.75rem;
}

/* ---------- Sidebar nav: keep 9 items readable ---------- */
.navbar {
  gap: 0.35rem;
}

.nav-link {
  padding: 0.35rem 0;
}

/* ---------- Dark-mode fixes for the newer components ---------- */
@media (prefers-color-scheme: dark) {
  .research-paper .paper-table tr.row-ours {
    background-color: #1f1a12;
  }

  .research-paper .paper-table tr.row-ours:hover {
    background-color: #2a2216;
  }

  .news-date {
    color: #fb923c;
  }

  .venue-pill {
    color: #fdba74;
  }

  .venue-pill::before {
    background-color: #3a2a17;
    opacity: 0.55;
  }

  .research-paper .algorithm-block {
    background: var(--bg-subtle);
    border-color: var(--border-color);
  }

  .exp-logo-container {
    background: transparent;
  }

  .exp-logo {
    filter: brightness(0) invert(1);
    opacity: 0.85;
/* ============================================================
   Quant Systems page (quant-systems.html)
   Uses the existing .research-paper typography; adds only a lede,
   a metric row and a repo-link line. All colours come from the
   theme variables so light and dark both work.
   ============================================================ */

.research-paper .qs-lede {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
  border-left: 3px solid var(--accent-color);
  padding-left: 1.1rem;
  margin-bottom: 1.6rem;
}

.research-paper .qs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin: 1.8rem 0 2.2rem;
}

.research-paper .qs-metric {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.1rem 1rem;
  text-align: center;
}

.research-paper .qs-metric-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent-color);
  margin-bottom: 0.45rem;
}

.research-paper .qs-metric-label {
  display: block;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.research-paper .qs-links {
  margin: -0.4rem 0 1.2rem;
  font-size: 0.9rem;
}

.research-paper .qs-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent-color);
  text-decoration: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.32rem 0.7rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.research-paper .qs-links a:hover {
  color: var(--accent-hover);
  border-color: var(--accent-color);
}

/* The tables on this page carry more columns than the research
   write-ups, so allow them to scroll rather than overflow. */
.research-paper .paper-table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .research-paper .paper-table {
    display: table;
    white-space: normal;
  }
}

/* Captions must wrap even while the table itself scrolls (see the
   .paper-table block above that switches to display:block under 900px). */
.research-paper .paper-table caption {
  white-space: normal;
}
