/* ===================================================
   CSS Custom Properties
   =================================================== */
:root {
  --color-bg: #ffffff;
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-accent: #1d4ed8;
  --color-accent-hover: #1e40af;
  --color-accent-light: #eff6ff;
  --color-border: #e5e7eb;
  --color-nav-bg: rgba(255, 255, 255, 0.95);
  --color-tag-bg: #f3f4f6;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, monospace;

  --nav-height: 52px;
  --max-width: 740px;
  --section-gap: 4rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

@media (max-width: 480px) {
  html { scroll-padding-top: 6rem; }
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  word-break: break-word;
}

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

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

/* ===================================================
   Navigation
   =================================================== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--color-nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.site-nav .container {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0.25rem;
}

.nav-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
}
.nav-name:hover { text-decoration: none; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.1rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}
.nav-links::-webkit-scrollbar { display: none; } /* Chrome/Safari */

@media (max-width: 480px) {
  .site-nav { height: auto; padding: 0.35rem 0; }
  .site-nav .container { flex-wrap: nowrap; align-items: center; padding-top: 0.2rem; padding-bottom: 0.2rem; }
  .nav-links { flex-wrap: wrap; overflow-x: visible; justify-content: flex-end; }
}

.nav-name-break { display: none; }
@media (max-width: 480px) {
  .nav-name-break { display: inline; }
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--color-muted);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
  background: var(--color-accent-light);
  text-decoration: none;
}

/* ===================================================
   Header / Hero
   =================================================== */
.site-header {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--color-border);
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.site-header .subtitle {
  font-size: 1rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  text-decoration: none;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.social-link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  text-decoration: none;
}
.social-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: currentColor;
}

/* ===================================================
   Main Content
   =================================================== */
main {
  padding-bottom: 4rem;
}

/* ===================================================
   Sections
   =================================================== */
.section {
  padding: var(--section-gap) 0 0;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
}

/* ===================================================
   Header photo layout
   =================================================== */
.header-content {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}

.profile-photo-wrap {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid var(--color-border);
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 50%;
  transform: scale(1.8);
  transform-origin: center 25%;
}

.header-text { flex: 1; min-width: 0; }


/* ===================================================
   About
   =================================================== */
.about-text p {
  margin-bottom: 1rem;
}
.about-text p:last-child { margin-bottom: 0; }

/* Contact email note */
.contact-email {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}

.contact-email-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: currentColor;
}

.contact-email-note {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* Research interest tags */
.research-interests {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  margin-bottom: 1rem;
}

.research-tag {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-light);
}

.about-personal {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 0;
}

/* ===================================================
   Publications
   =================================================== */
.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.pub-title {
  font-weight: 600;
  font-size: 0.975rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
  color: var(--color-text);
}

.pub-authors {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.25rem;
}
.pub-authors strong { color: var(--color-text); }

.pub-venue {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}
.pub-venue em { font-style: italic; }

.pub-note {
  display: inline-block;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  align-items: center;
}

.pub-link {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.pub-link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  text-decoration: none;
}

.abstract-btn {
  font-family: inherit;
  line-height: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.abstract-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}
.abstract-btn[aria-expanded="true"] {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.pub-abstract {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-tag-bg);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.6;
}
.pub-abstract.open { display: block; }

/* Hidden pubs (non-highlighted) */
.pub-item.extra { display: none; }
.pub-item.extra.visible { display: block; }

/* Category headers in "all" view */
.pub-category-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}
.pub-category-header:first-child { margin-top: 0; }

.show-all-btn {
  display: block;
  margin: 1.5rem auto 0;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.show-all-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

/* ===================================================
   Experience
   =================================================== */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.exp-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 1rem;
  align-items: start;
}

.exp-role {
  font-weight: 600;
  font-size: 0.975rem;
}

.exp-org {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.exp-period {
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
  text-align: right;
}

.exp-location {
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: right;
}

/* ===================================================
   Education
   =================================================== */
.edu-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.edu-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 1rem;
  align-items: start;
}

.edu-degree {
  font-weight: 600;
  font-size: 0.975rem;
}

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

.edu-thesis {
  font-size: 0.875rem;
  color: var(--color-muted);
  font-style: italic;
  margin-top: 0.1rem;
}

.edu-period {
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
  text-align: right;
}

/* ===================================================
   Teaching
   =================================================== */
.teaching-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.teaching-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 1rem;
  align-items: start;
}

.teaching-role {
  font-weight: 600;
  font-size: 0.975rem;
}

.teaching-org {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.teaching-detail {
  font-size: 0.875rem;
  color: var(--color-muted);
  font-style: italic;
  margin-top: 0.1rem;
}

.teaching-period {
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
  text-align: right;
}

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

.news-item {
  display: grid;
  grid-template-columns: 6.5rem auto 1fr;
  gap: 0 0.75rem;
  align-items: baseline;
}

.news-date {
  font-size: 0.8rem;
  color: var(--color-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.news-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
  align-self: center;
}
.news-badge--talk         { background: #dbeafe; color: #1d4ed8; }
.news-badge--award        { background: #fef3c7; color: #b45309; }
.news-badge--paper        { background: #dcfce7; color: #166534; }
.news-badge--announcement { background: #f3e8ff; color: #6b21a8; }
.news-badge--blog         { background: var(--color-tag-bg); color: var(--color-muted); }

.news-content {
  font-size: 0.9rem;
  line-height: 1.55;
}


/* ===================================================
   Community
   =================================================== */
.community-category {
  margin-bottom: 1.75rem;
}
.community-category:last-child { margin-bottom: 0; }

.community-category-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.community-entries {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.community-entry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1rem;
  align-items: baseline;
  font-size: 0.9rem;
}

.community-year {
  font-size: 0.825rem;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.community-content { line-height: 1.5; }


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

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  margin-bottom: 0.6rem;
}

.footer-links a,
.footer-email {
  color: var(--color-muted);
  text-decoration: none;
}

.footer-email {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

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

.footer-copy {
  color: var(--color-muted);
}

/* ===================================================
   Responsive — medium (481–680px: large phones, small tablets)
   =================================================== */
@media (max-width: 680px) {
  .nav-name { display: none; }
  .nav-links a { padding: 0.25rem 0.45rem; font-size: 0.8rem; }
}

/* ===================================================
   Responsive — small (≤480px: phones)
   =================================================== */
@media (max-width: 480px) {
  :root { --section-gap: 2.5rem; }

  .site-header { padding: 2rem 0 1.75rem; }
  .site-header h1 { font-size: 1.6rem; }

  .nav-name { display: block; font-size: 1.05rem; white-space: normal; flex-shrink: 0; line-height: 1.25; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 0.2rem 0.3rem; font-size: 0.75rem; }

  .profile-photo-wrap { width: 120px; height: 120px; }

  .exp-item,
  .edu-item,
  .teaching-item {
    grid-template-columns: 1fr;
  }
  .exp-period,
  .exp-location,
  .edu-period,
  .teaching-period {
    text-align: left;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .news-date { order: 2; }
  .news-badge { order: 1; display: inline-block; margin-bottom: 0.1rem; }
  .news-content { order: 3; }

  .community-entry { gap: 0 0.6rem; }

  .header-content { flex-direction: column; gap: 1.1rem; align-items: center; text-align: center; }
  .social-links { justify-content: center; }
  .contact-email { justify-content: center; }
}
