/* ================================================
   Modern Personal Academic Website
   Yutian Chen  ·  2024
   ================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- Variables ---- */
:root {
  --sidebar-width: 256px;

  /* Sidebar */
  --sidebar-bg: #3a3a3a;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-text-active: #ffffff;

  /* Content */
  --body-bg: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Accent */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --accent-text: #1e40af;

  /* Borders & shadows */
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);

  /* Geometry */
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.18s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--body-bg);
}

/* ================================================
   SIDEBAR
   ================================================ */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 2rem 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

/* ---- Navigation ---- */
.nav-menu {
  list-style: none;
  padding: 0.75rem 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  color: var(--sidebar-text-hover);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}

.nav-link.active {
  color: #fff;
  background: rgba(37,99,235,0.18);
  border-left-color: #3b82f6;
}

/* ---- Sidebar footer ---- */
.sidebar-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.last-update {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.75;
}

/* ================================================
   MOBILE HEADER
   ================================================ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 58px;
  background: var(--sidebar-bg);
  z-index: 190;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mobile-name { color: #fff; font-weight: 700; font-size: 1rem; }

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all var(--transition);
}

.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 195;
}

.sidebar-overlay.active { display: block; }

/* ================================================
   MAIN CONTENT
   ================================================ */
#content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 3rem 3.5rem 4rem;
  max-width: calc(var(--sidebar-width) + 880px);
}

section { margin-bottom: 3rem; }

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

/* ---- Section titles ---- */
.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--border);
}

/* ---- Paragraphs ---- */
p { color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.8; }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: 0.55rem; color: var(--text-secondary); line-height: 1.8; }

/* ================================================
   HERO  (index.html)
   ================================================ */
.hero {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
  padding: 2.5rem 0 3rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 3rem;
}

.profile-photo {
  width: 170px;
  height: 210px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.hero-text { padding-top: 0.25rem; }

.hero-name {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

.chinese {
  font-family: STKaiti, "华文楷体", KaiTi, "楷体", serif;
  word-break: keep-all;
  font-size: 0.8em;
  font-weight: 400;
  color: var(--text-secondary);
}

.hero-role {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.hero-role strong { color: var(--text-primary); font-weight: 600; }

.email-icon {
  height: 34px;
  vertical-align: middle;
  margin-top: 0.25rem;
}

/* ================================================
   RESEARCH PAGE
   ================================================ */
.research-intro { margin-bottom: 2.5rem; }

.research-intro ul {
  margin: 0.5rem 0 1rem 0;
  list-style: disc;
}

/* ---- Project cards ---- */
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.project-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.project-card-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.project-card-title a::after {
  content: ' ↗';
  font-size: 0.8em;
  opacity: 0.5;
}

.project-card-title a:hover {
  text-decoration: underline;
}

.project-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.project-media {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.project-media img,
.project-media video {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}


/* YouTube iframes — wrapper carries the aspect ratio, iframe fills it absolutely.
   Critically: no overflow:hidden, which caused Error 153 by zeroing the height. */
.yt-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.yt-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

.project-body { flex: 1; }

.project-body p {
  font-size: 0.93rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.highlight-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-text);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  margin: 0.15rem 0;
}

/* ================================================
   PUBLICATIONS PAGE
   ================================================ */
.pub-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--border);
}

.pub-header h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; }

.pub-header-links { font-size: 0.82rem; color: var(--text-muted); }
.pub-header-links a { color: var(--accent); }

.pub-group { margin-bottom: 2.5rem; }

.pub-group-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.pub-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-style: italic;
}

.pub-list { list-style: none; padding: 0; }

.pub-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }

.pub-title {
  font-size: 0.93rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.pub-authors {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.pub-venue {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

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

.pub-link {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  text-decoration: none;
  transition: all var(--transition);
}

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

/* ================================================
   AWARDS PAGE
   ================================================ */
.awards-list { list-style: none; padding: 0; }

.award-card {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  padding: 1.25rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.award-card:hover { box-shadow: var(--shadow-md); }

.award-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
  line-height: 1;
}

.award-body { flex: 1; }

.award-name {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.award-detail {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 920px) {
  #content { padding: 2.5rem 2rem 3rem; }

  .project-layout { flex-direction: column; }
  .project-media { flex: none; width: 100%; }
  .project-media .media-grid { max-width: 480px; }
}

@media (max-width: 720px) {
  .mobile-header { display: flex; }

  #sidebar { transform: translateX(-100%); box-shadow: none; }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.25); }

  #content {
    margin-left: 0;
    padding: 1.5rem 1.2rem 3rem;
    padding-top: calc(58px + 1.5rem);
    max-width: 100%;
  }

  .hero { flex-direction: column; align-items: center; text-align: center; gap: 1.5rem; }
  .hero-name { font-size: 1.9rem; }
  .profile-photo { width: 140px; height: 175px; }

  .project-media .media-grid { grid-template-columns: 1fr; }
}
.5rem; }
  .hero-name { font-size: 1.9rem; }
  .profile-photo { width: 140px; height: 175px; }

  .project-media .media-grid { grid-template-columns: 1fr; }
}
