/* ====== Theme variables ====== */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --text: #1d2127;
  --text-muted: #5b6470;
  --accent: #C5050C;
  --accent-soft: rgba(197, 5, 12, 0.08);
  --accent-border: rgba(197, 5, 12, 0.35);
  --border: #e6e8eb;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --nav-bg: rgba(255,255,255,0.92);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #14161a;
  --bg-alt: #1b1e23;
  --text: #e7e9ec;
  --text-muted: #9aa2ad;
  --accent: #E84040;
  --accent-soft: rgba(232, 64, 64, 0.12);
  --accent-border: rgba(232, 64, 64, 0.4);
  --border: #2a2e35;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.4);
  --nav-bg: rgba(20,22,26,0.95);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding-top: 52px;
  transition: background 0.2s, color 0.2s;
}

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

/* ====== Top nav ====== */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 0;
}

.topnav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-right: auto;
  white-space: nowrap;
}
.topnav-brand:hover { text-decoration: none; color: var(--accent); }

.topnav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topnav-links a {
  font-size: 0.87rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.topnav-links a:hover,
.topnav-links a.active { color: var(--accent); text-decoration: none; }

.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  margin-left: 20px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.theme-btn:hover { color: var(--accent); }
.theme-btn svg { display: block; }

/* ====== Layout ====== */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  max-width: 1120px;
  margin: 0 auto;
  gap: 56px;
  padding: 48px 32px 96px;
}

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

.sidebar .avatar {
  width: 215px;
  height: 275px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center top;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
}

.sidebar h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 16px 0 10px;
  color: var(--text);
}

.sidebar-meta {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 18px;
}

/* ====== Social icons ====== */
.social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  display: inline-flex;
}

.social-list a {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.84rem;
  color: var(--text-muted);
  padding: 4px 0;
  transition: color 0.15s;
}
.social-list a:hover { color: var(--accent); text-decoration: none; }
.social-list svg { flex-shrink: 0; }

.social-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.84rem;
  color: var(--text-muted);
  padding: 4px 0;
  cursor: default;
}

/* ====== Main content ====== */
main { min-width: 0; }

section { margin-bottom: 56px; scroll-margin-top: 68px; }

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 6px;
  display: inline-block;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
}

/* ====== Research interest tiles ====== */
.ri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.ri-card {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-border);
  border-radius: 10px;
  padding: 22px;
}

.ri-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 5px;
  color: var(--accent);
}

.ri-card .tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 14px;
  line-height: 1.5;
}

.ri-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ====== Publications ====== */
.pub-list { display: flex; flex-direction: column; gap: 0; }

.pub-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.pub-row:first-child { border-top: 1px solid var(--border); }

.pub-badge-col {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}

.pub-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  padding: 4px 8px;
  text-align: center;
  line-height: 1.3;
}

.pub-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 5px;
  color: var(--text);
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }

.pub-authors {
  font-size: 0.87rem;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.pub-authors strong { color: var(--text); font-weight: 600; }

.pub-tldr {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0 0 10px;
  border-left: 2px solid var(--border);
  padding-left: 10px;
}

.pub-links { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn svg { flex-shrink: 0; }

/* ====== Before PhD bullets ====== */
.phd-list {
  padding-left: 20px;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.phd-list li { font-size: 0.97rem; }

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

/* ====== Blog page ====== */
.blog-hero {
  max-width: 720px;
  margin: 80px auto 0;
  padding: 0 32px 96px;
}
.blog-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.blog-hero .coming-soon {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 24px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
}

/* ====== Responsive ====== */
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 28px 20px 64px;
    gap: 32px;
  }
  .sidebar { position: static; text-align: center; }
  .social-list { display: inline-flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 12px 20px; }

  .topnav { padding: 0 16px; }
  .topnav-links { gap: 14px; overflow-x: auto; }
  .topnav-links a { font-size: 0.8rem; }

  .pub-row { grid-template-columns: 64px 1fr; gap: 14px; }
}

@media (max-width: 540px) {
  .topnav-links { display: none; }
  .ri-grid { grid-template-columns: 1fr; }
}
