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

:root {
  --primary: #3b5998;
  --primary-dark: #2c4373;
  --accent: #4a90d9;
  --text: #333;
  --text-light: #666;
  --text-muted: #999;
  --bg: #fff;
  --bg-light: #f8f9fa;
  --border: #e0e0e0;
  --link: #3b5998;
  --link-hover: #1d3461;
  --nav-bg: #2c2c2c;
  --nav-text: #ddd;
  --radius: 6px;
  --max-width: 1100px;
  --sidebar-width: 260px;
  --font-main: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

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

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

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

/* ===== Top Navigation ===== */
.top-nav {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.top-nav .nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: relative;
}

.top-nav .site-title {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.75rem 0;
  text-decoration: none;
}

.top-nav .site-title:hover {
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
}

.nav-links {
  display: flex;
  list-style: none;
}

.nav-links a {
  display: block;
  color: var(--nav-text);
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  border-bottom: 3px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.6rem;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.hamburger svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* ===== Layout ===== */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 2.5rem;
  padding: 2rem 1.5rem;
  min-height: calc(100vh - 60px);
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: 62px;
  align-self: start;
}

.sidebar-inner {
  text-align: center;
  padding: 1.5rem 0;
}

.avatar-wrapper {
  width: 170px;
  height: 170px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--border);
  background: var(--bg-light);
}

.avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
}

.sidebar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.sidebar .subtitle {
  font-size: 0.84rem;
  color: var(--text-light);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.sidebar .location {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  padding: 0 0.5rem;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--text-light);
  padding: 0.3rem 0;
  transition: color 0.2s;
}

.sidebar-links a:hover {
  color: var(--link);
  text-decoration: none;
}

.sidebar-links svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: currentColor;
}

/* ===== Main Content ===== */
.main-content {
  min-width: 0;
  padding-top: 0.5rem;
}

.main-content h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.main-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}

.main-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.main-content p {
  margin-bottom: 1rem;
}

.main-content ul, .main-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.main-content li {
  margin-bottom: 0.35rem;
}

/* ===== About Page ===== */
.bio-text {
  font-size: 1.02rem;
  line-height: 1.8;
}

.interests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.interest-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.interest-item span {
  font-size: 0.9rem;
}

/* ===== Publication Cards ===== */
.pub-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--bg);
  transition: box-shadow 0.2s;
}

.pub-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.pub-card .pub-year {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.pub-card .pub-journal {
  display: inline-block;
  background: var(--bg-light);
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  margin-left: 0.3rem;
}

.pub-card h3 {
  margin-top: 0.2rem;
  margin-bottom: 0.4rem;
  font-size: 1rem;
  line-height: 1.4;
}

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

.pub-card .pub-authors strong {
  color: var(--text);
}

.pub-card .pub-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pub-card .pub-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--link);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.pub-card .pub-links a:hover {
  background: var(--link);
  color: #fff;
  border-color: var(--link);
  text-decoration: none;
}

/* ===== CV Page ===== */
.cv-section {
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cv-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  background: var(--bg-light);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.cv-section-header:hover {
  background: #eef1f5;
}

.cv-section-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
}

.cv-section-header .chevron {
  width: 20px;
  height: 20px;
  fill: var(--text-muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.cv-section.open .cv-section-header .chevron {
  transform: rotate(180deg);
}

.cv-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.cv-section.open .cv-section-body {
  max-height: 5000px;
  transition: max-height 0.6s ease;
}

.cv-section-body-inner {
  padding: 1rem 1.2rem 1.2rem;
}

.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.cv-download:hover {
  background: var(--primary-dark);
  color: #fff;
  text-decoration: none;
}

.cv-download:active {
  transform: scale(0.97);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.4rem;
  padding-left: 1rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-item .date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.timeline-item h3 {
  font-size: 1rem;
  margin-top: 0;
  margin-bottom: 0.1rem;
}

.timeline-item .institution {
  font-size: 0.88rem;
  color: var(--text-light);
  font-weight: 500;
}

.timeline-item .description {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Skills & Languages */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.skill-tag {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
}

.lang-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

.lang-level {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== Research Page ===== */
.research-area {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border-left: 4px solid var(--accent);
}

.research-area h3 {
  margin-top: 0;
  color: var(--primary-dark);
}

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

.site-footer a {
  color: var(--text-muted);
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */
@media (max-width: 900px) {
  .page-wrapper {
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
  }
  .avatar-wrapper {
    width: 140px;
    height: 140px;
  }
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  /* Nav */
  .hamburger {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--nav-bg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 200;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .nav-links a {
    padding: 0.9rem 1.5rem;
    font-size: 0.95rem;
  }

  .top-nav .nav-inner {
    padding: 0 1rem;
  }

  /* Layout */
  .page-wrapper {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  /* Sidebar — horizontal card on mobile */
  .sidebar {
    position: static;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
  }

  .sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem 1rem;
    gap: 0;
  }

  .avatar-wrapper {
    width: 110px;
    height: 110px;
    margin-bottom: 0.7rem;
  }

  .sidebar h1 {
    font-size: 1.2rem;
  }

  .sidebar .subtitle {
    font-size: 0.82rem;
  }

  .sidebar .location {
    margin-bottom: 0.7rem;
  }

  .sidebar-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    padding: 0;
    gap: 0.3rem;
  }

  .sidebar-links a {
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    gap: 0.3rem;
  }

  .sidebar-links svg {
    width: 14px;
    height: 14px;
  }

  /* Main content */
  .main-content {
    padding: 1.2rem 1rem 2rem;
  }

  .main-content h1 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
  }

  .main-content h2 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
  }

  .main-content h3 {
    font-size: 1rem;
  }

  .bio-text {
    font-size: 0.95rem;
  }

  /* Interests grid — 2 columns on mobile */
  .interests-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .interest-item {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
  }

  .interest-item span {
    font-size: 0.82rem;
  }

  /* Publication cards */
  .pub-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .pub-card h3 {
    font-size: 0.95rem;
  }

  .pub-card .pub-authors {
    font-size: 0.82rem;
  }

  /* CV sections */
  .cv-section {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-bottom: 0;
    border-bottom: none;
  }

  .cv-section + .cv-section {
    border-top: 1px solid var(--border);
  }

  .cv-section:first-of-type {
    border-top: 1px solid var(--border);
  }

  .cv-section-header {
    padding: 0.85rem 1rem;
  }

  .cv-section-header h2 {
    font-size: 1.05rem;
  }

  .cv-section-body-inner {
    padding: 0.8rem 1rem 1rem;
  }

  .cv-download {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    margin: 0 1rem 1rem;
    width: calc(100% - 2rem);
  }

  /* Timeline mobile */
  .timeline {
    padding-left: 1.2rem;
  }

  .timeline-item {
    padding-left: 0.8rem;
    margin-bottom: 1.2rem;
  }

  .timeline-item::before {
    left: -1.45rem;
    width: 8px;
    height: 8px;
  }

  .timeline-item .date {
    font-size: 0.78rem;
  }

  .timeline-item h3 {
    font-size: 0.95rem;
  }

  .timeline-item .institution,
  .timeline-item .description {
    font-size: 0.84rem;
  }

  /* Skills tags smaller on mobile */
  .skill-tag {
    font-size: 0.78rem;
    padding: 0.2rem 0.55rem;
  }

  /* Research areas */
  .research-area {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  /* Footer */
  .site-footer {
    margin-top: 2rem;
    padding: 1.2rem 1rem;
  }

  /* News list more compact */
  .main-content li {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
}

/* ============================================================
   Responsive — Small phones
   ============================================================ */
@media (max-width: 400px) {
  .interests-grid {
    grid-template-columns: 1fr;
  }

  .avatar-wrapper {
    width: 90px;
    height: 90px;
  }

  .sidebar h1 {
    font-size: 1.1rem;
  }

  .lang-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
  }
}
