/* ========================================
   Design Tokens — Dark Mode (default)
   ======================================== */
:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #141b2d;
  --bg-tertiary: #1a2236;
  --accent-glow: #3b82f6;
  --accent-hover: #60a5fa;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-link: #60a5fa;
  --text-link-hover: #93bbfc;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(59, 130, 246, 0.4);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 30px rgba(59, 130, 246, 0.2);
  --icon-bg: rgba(255, 255, 255, 0.1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 900px;
}

/* ========================================
   Light Mode Tokens
   ======================================== */
[data-theme="light"] {
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f2f5;
  --accent-glow: #2563eb;
  --accent-hover: #1d4ed8;
  --text-main: #1a1a2e;
  --text-muted: #555770;
  --text-link: #2563eb;
  --text-link-hover: #1d4ed8;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(37, 99, 235, 0.3);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 24px rgba(37, 99, 235, 0.12);
  --icon-bg: rgba(0, 0, 0, 0.04);
}

/* ========================================
   Reset & Base
   ======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: 'Lato', 'Trebuchet MS', Verdana, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* ========================================
   Typography
   ======================================== */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--text-link-hover);
}

h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-glow);
  display: inline-block;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

strong {
  font-weight: 700;
}

small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ========================================
   Layout
   ======================================== */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 2rem 2rem;
}

section {
  margin-bottom: 3rem;
}

/* ========================================
   Theme Toggle
   ======================================== */
.theme-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.5rem;
  z-index: 100;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-card);
  font-size: 1.2rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent-glow);
  transform: scale(1.1);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg);
}

.theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0deg);
}

[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg);
}

[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg);
}

/* ========================================
   Hero / Profile Section
   ======================================== */
.hero {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  text-align: center;
  margin-bottom: 1rem;
}

.hero-text p {
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.hero-photo {
  flex-shrink: 0;
  width: 200px;
}

.hero-photo img {
  width: 100%;
  border-radius: 50%;
  border: 3px solid var(--border-subtle);
  transition: var(--transition-smooth);
}

.hero-photo img:hover {
  border-color: var(--accent-glow);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.25);
}

/* ========================================
   Social Links
   ======================================== */
.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.social-link:hover {
  border-color: var(--accent-glow);
  background: var(--bg-tertiary);
  color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.social-link img {
  width: 20px;
  height: 20px;
}

/* ========================================
   Info Grid (Education + Research Interests)
   ======================================== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  transition: var(--transition-smooth);
}

.info-card:hover {
  border-color: var(--border-hover);
}

.info-card h2 {
  margin-bottom: 1rem;
}

.education-list {
  list-style: none;
}

.education-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.education-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.education-list .edu-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--icon-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.education-list .edu-icon img {
  width: 20px;
  height: 20px;
}

.education-list .degree {
  font-weight: 700;
  color: var(--text-main);
}

.education-list .institution {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.research-interests {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.research-interests li {
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.research-interests li:hover {
  border-color: var(--accent-glow);
  color: var(--text-main);
}

/* ========================================
   News Section
   ======================================== */
.news-list {
  list-style: none;
}

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

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

.news-date {
  flex-shrink: 0;
  width: 70px;
  font-weight: 700;
  color: var(--accent-glow);
  font-size: 0.85rem;
}

/* ========================================
   Section Divider Styling
   ======================================== */
.section-ongoing h2 {
  border-color: #10b981;
}

.section-preprints h2 {
  border-color: #f59e0b;
}

.section-published h2 {
  border-color: var(--accent-glow);
}

.section-label {
  display: inline-block;
  font-family: 'Lato', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 4px;
  margin-left: 0.8rem;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

.section-ongoing .section-label {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.section-preprints .section-label {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.section-published .section-label {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

/* ========================================
   Portfolio Grid (Papers / Projects)
   ======================================== */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

/* Center lone odd card on its row */
.portfolio-grid > .project-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 380px;
}

.project-card {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  transition: var(--transition-smooth);
  will-change: transform, box-shadow;
  display: flex;
  flex-direction: column;
}

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

.project-card .card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: var(--bg-tertiary);
  padding: 0.5rem;
}

.project-card h3 {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.project-card h3 a {
  color: var(--text-main);
  transition: color 0.2s ease;
}

.project-card h3 a:hover {
  color: var(--accent-hover);
}

.project-card .card-authors {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.project-card .card-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  flex-grow: 1;
}

.project-card .card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: auto;
}

.card-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-link);
  transition: var(--transition-smooth);
}

.card-links a:hover {
  border-color: var(--accent-glow);
  background: rgba(59, 130, 246, 0.1);
}

.card-links img {
  width: 14px;
  height: 14px;
}

.card-links .card-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ========================================
   Author Color Coding
   ======================================== */
.author-first {
  color: #34d399;
  font-weight: 700;
}

.author-equal {
  color: #c084fc;
  font-weight: 700;
}

[data-theme="light"] .author-first {
  color: #059669;
}

[data-theme="light"] .author-equal {
  color: #7c3aed;
}

/* Legend */
.author-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.author-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.swatch-first {
  background: #34d399;
}

.swatch-equal {
  background: #c084fc;
}

[data-theme="light"] .swatch-first {
  background: #059669;
}

[data-theme="light"] .swatch-equal {
  background: #7c3aed;
}

/* ========================================
   Scroll Animation
   ======================================== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========================================
   Responsive — Tablet
   ======================================== */
@media (max-width: 768px) {
  .hero {
	flex-direction: column-reverse;
	text-align: center;
	gap: 1.5rem;
  }

  .hero-photo {
	width: 160px;
  }

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

  .info-grid {
	grid-template-columns: 1fr;
  }

  .site-wrapper {
	padding: 2rem 1.25rem;
  }

  .theme-toggle {
	top: 0.8rem;
	right: 0.8rem;
	width: 40px;
	height: 40px;
	font-size: 1.1rem;
  }

  section {
	margin-bottom: 2.5rem;
  }
}

/* ========================================
   Responsive — Mobile
   ======================================== */
@media (max-width: 480px) {
  .hero-photo {
	width: 130px;
  }

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

  h2 {
	font-size: 1.1rem;
  }

  .site-wrapper {
	padding: 1.5rem 1rem;
  }

  .portfolio-grid {
	grid-template-columns: 1fr;
  }

  .social-links {
	gap: 0.5rem;
  }

  .social-link {
	padding: 5px 10px;
	font-size: 0.8rem;
  }

  .project-card {
	padding: 1.2rem;
  }

  .info-card {
	padding: 1.2rem;
  }

  .news-list li {
	gap: 0.5rem;
  }

  .section-label {
	display: block;
	margin-left: 0;
	margin-top: 0.5rem;
	width: fit-content;
  }

  .author-legend {
	gap: 0.8rem;
	font-size: 0.75rem;
  }

  .theme-toggle {
	width: 36px;
	height: 36px;
	font-size: 1rem;
  }
}
