/* ---------- design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --fg: #111111;
  --fg-muted: #5f5f5f;
  --border: #e2e2e2;
  --accent: #1f8a4c;
  --accent-fg: #ffffff;
  --accent-soft: rgba(31, 138, 76, 0.1);
  --radius: 10px;
  --sidebar-width: 280px;
  --content-max: 720px;
  --topbar-height: 64px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #111111;
    --fg: #f2f2f2;
    --fg-muted: #9a9a9a;
    --border: #2a2a2a;
    --accent: #4fd886;
    --accent-fg: #06180e;
    --accent-soft: rgba(79, 216, 134, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #111111;
  --fg: #f2f2f2;
  --fg-muted: #9a9a9a;
  --border: #2a2a2a;
  --accent: #4fd886;
  --accent-fg: #06180e;
  --accent-soft: rgba(79, 216, 134, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { line-height: 1.25; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 901px) {
  .topbar {
    position: fixed;
    left: 0;
    right: 0;
  }
}

/* ---------- page shell ---------- */
.page {
  min-height: calc(100vh - var(--topbar-height));
}

@media (min-width: 901px) {
  .page {
    padding-top: var(--topbar-height);
  }
}

.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  height: calc(100vh - var(--topbar-height));
  overflow-y: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
}

.sidebar__inner {
  padding: 2.75rem 1.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.sidebar__avatar {
  width: 152px;
  height: 152px;
  align-self: center;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.sidebar__name {
  font-size: 1.05rem;
  margin: 0;
  white-space: nowrap;
}

.sidebar__title {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.sidebar__location {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg-muted);
  font-size: 0.85rem;
}
.sidebar__location .icon { width: 14px; height: 14px; flex-shrink: 0; }

/* ---------- nav ---------- */
.nav {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  gap: 0.5rem;
  margin: 0;
  padding: 0 2rem;
}

.nav__links {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-evenly;
  flex: 1;
  gap: 0.5rem;
}

.nav__toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
}
.nav__toggle:hover { background: var(--accent-soft); }
.nav__toggle-icon { display: flex; }
.nav__toggle-icon--close { display: none; }
.nav__toggle.is-open .nav__toggle-icon--menu { display: none; }
.nav__toggle.is-open .nav__toggle-icon--close { display: flex; }
.nav__toggle .icon { width: 20px; height: 20px; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--fg);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon { width: 17px; height: 17px; }
.theme-toggle-icon--moon { display: none; }
.theme-toggle.is-dark .theme-toggle-icon--sun { display: none; }
.theme-toggle.is-dark .theme-toggle-icon--moon { display: flex; }

.nav__link {
  color: var(--fg);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 7px;
  border-bottom: 2px solid transparent;
}
.nav__link:hover { background: var(--accent-soft); text-decoration: none; }
.nav__link.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- social list ---------- */
.sidebar__social {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.sidebar__social a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg-muted);
  font-size: 0.88rem;
  padding: 0.3rem 0.6rem;
  border-radius: 7px;
}
.sidebar__social a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.sidebar__social .icon { width: 16px; height: 16px; flex-shrink: 0; }

.icon { width: 18px; height: 18px; }

/* ---------- main content ---------- */
.content {
  margin-left: var(--sidebar-width);
  min-width: 0;
  padding: 3.5rem 2rem 7rem;
}

section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding-top: 1rem;
  scroll-margin-top: 1.5rem;
}
section + section { margin-top: 4rem; }

.section__title {
  font-size: 1.5rem;
  margin: 0 0 1.25rem;
}

.bio { color: var(--fg); }
.bio p { margin: 0 0 1rem; }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  margin: 1.75rem 0;
}
.meta-grid h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin: 0 0 0.6rem;
}
.meta-grid .plain-list li {
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0;
  border-bottom: none;
}
.meta-grid .degree { font-weight: 600; display: block; }
.meta-grid .institution { color: var(--fg-muted); font-size: 0.85rem; }

/* ---------- news timeline ---------- */
.news {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
.news h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin: 0 0 1rem;
}
.news__list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.5rem;
}
.news__item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.9rem;
  font-size: 0.9rem;
}
.news__date {
  color: var(--fg-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  padding-top: 0.1rem;
}

/* ---------- publications ---------- */
.pub-group + .pub-group { margin-top: 2.25rem; }
.pub-group__title {
  font-size: 0.95rem;
  color: var(--fg-muted);
  margin: 0 0 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

.pub-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
}

.pub-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.pub-card__badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.pub-card__keywords {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.pub-card__keyword {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pub-card__title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
}

.pub-card__authors {
  font-size: 0.88rem;
  color: var(--fg-muted);
  margin: 0 0 0.25rem;
}
.pub-card__authors strong { color: var(--fg); }

.pub-card__venue {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--fg-muted);
  margin: 0 0 0.3rem;
}

.pub-card__note {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin: 0 0 0.3rem;
}
.pub-card__highlight {
  color: #c43d3d;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .pub-card__highlight { color: #e36b6b; }
}

.pub-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.pub-card__links a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
}
.pub-card__links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.pub-card__abstract-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  cursor: pointer;
}
.pub-card__abstract-toggle:hover { border-color: var(--accent); }
.pub-card__abstract-toggle-icon { display: inline-flex; width: 11px; height: 11px; }
.pub-card__abstract-toggle-icon .icon { width: 11px; height: 11px; transition: transform 0.15s ease; }
.pub-card__abstract-toggle.is-open .pub-card__abstract-toggle-icon .icon { transform: rotate(90deg); }

.pub-card__abstract {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}
.pub-card__abstract p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--fg-muted);
}

/* ---------- projects ---------- */
.project-group + .project-group { margin-top: 1.9rem; }
.project-group__title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 0.7rem;
}
.project-group__items {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.project-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
}
.project-item p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--fg);
}
.project-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- awards / service ---------- */
.plain-list { display: flex; flex-direction: column; gap: 0.6rem; }
.plain-list li {
  font-size: 0.92rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.plain-list li:last-child { border-bottom: none; }
.plain-list .award-org,
.plain-list .award-date { color: var(--fg-muted); }

.service-group + .service-group { margin-top: 1.75rem; }
.service-group__title { font-size: 1rem; margin: 0 0 0.6rem; }

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

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .page { flex-direction: column; }
  .topbar { height: var(--topbar-height); padding: 0 1.25rem; }
  .nav { justify-content: flex-start; padding: 0; }
  .nav__toggle { display: flex; }
  .nav__links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 0.4rem 1.25rem 0.8rem;
    gap: 0;
  }
  .nav__links.is-open { display: flex; }
  .nav__link {
    padding: 0.8rem 0.4rem;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav__link:last-child { border-bottom: none; }
  .sidebar {
    position: relative;
    top: 0;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar__inner { padding: 2rem 1.5rem; align-items: center; text-align: center; }
  .sidebar__location { justify-content: center; }
  .sidebar__social { flex-direction: row; flex-wrap: wrap; justify-content: center; border-top: 1px solid var(--border); margin-top: 0.8rem; padding-top: 0.8rem; }
  .content { margin-left: 0; padding: 2.5rem 1.25rem 4rem; }
  .meta-grid { grid-template-columns: 1fr; gap: 1rem; }
  .news__item { grid-template-columns: 1fr; gap: 0.15rem; }
}
