/* ==========================================================================
   Yifang Zhang — academic homepage
   Plain, dependency-free CSS. Layout: fixed sidebar + scrolling content.
   ========================================================================== */

:root {
  --ink:            #1a1a1a;
  --ink-soft:       #3d3d3d;
  --muted:          #6b6b6b;
  --faint:          #8c8c8c;
  --rule:           #e4e4e4;
  --rule-strong:    #cfcfcf;
  --bg:             #ffffff;
  --bg-soft:        #f7f7f5;
  --bg-tint:        #f2f5f8;
  --accent:         #1a4d7a;
  --accent-light:   #2f6da3;
  --accent-wash:    #eef3f8;
  --serif:          "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans:           -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:           ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w:      280px;
  --content-max:    820px;
}

/* --- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
  border-radius: 2px;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* --- page shell ----------------------------------------------------------- */
.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 2rem;
  gap: 4rem;
}

/* --- sidebar -------------------------------------------------------------- */
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 3.25rem 0 2.5rem;
}

.profile { text-align: left; margin-bottom: 2rem; }

.profile__photo {
  width: 152px;
  height: 152px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid var(--rule-strong);
  background: var(--bg-soft);
  margin-bottom: 1.15rem;
}

.profile__name {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

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

.profile__role {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 0.15rem;
}

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

.profile__affil em { font-style: normal; color: var(--ink-soft); }

/* --- nav ------------------------------------------------------------------ */
.nav { margin: 0 0 1.75rem; }

.nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.nav__item { border-bottom: 1px solid var(--rule); }

.nav__link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.6rem 0.25rem 0.6rem 0;
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--ink-soft);
  transition: color 0.12s ease, padding-left 0.12s ease;
}

.nav__link:hover {
  color: var(--accent);
  text-decoration: none;
  padding-left: 0.35rem;
}

.nav__link[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.nav__hint {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.02em;
}

/* --- sidebar link groups -------------------------------------------------- */
.sidebar__section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 0.6rem;
}

.linklist {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  font-size: 0.88rem;
}

.linklist li { margin-bottom: 0.4rem; }

.linklist a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-soft);
}

.linklist a:hover { color: var(--accent); }

.linklist svg { flex: 0 0 auto; opacity: 0.75; }

/* --- content -------------------------------------------------------------- */
.content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--content-max);
  padding: 3.25rem 0 5rem;
}

.page-header { margin-bottom: 2.25rem; }

.page-header h1 {
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

h2 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 3rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

h2:first-of-type { margin-top: 0; }

h3 {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  margin: 2rem 0 0.6rem;
}

p { margin: 0 0 1.05rem; }

.lead { font-size: 1.06rem; }

ul.plain { margin: 0 0 1.05rem; padding-left: 1.15rem; }
ul.plain li { margin-bottom: 0.4rem; }

/* --- research interests --------------------------------------------------- */
.taglist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.tag {
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-wash);
  border: 1px solid #dbe5ee;
  border-radius: 3px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

/* --- metrics -------------------------------------------------------------- */
.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.metric {
  flex: 1 1 120px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  background: var(--bg-soft);
}

.metric__value {
  display: block;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--accent);
}

.metric__label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

.metric__note {
  font-size: 0.78rem;
  color: var(--faint);
  margin: 0 0 1.5rem;
}

/* --- news ----------------------------------------------------------------- */
.news {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

.news li {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.news li:last-child { border-bottom: 0; }

.news__date {
  flex: 0 0 92px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  padding-top: 0.1rem;
}

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

.pub-group__title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.25rem;
}

.pub-group__note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.pub {
  display: flex;
  gap: 1.75rem;
  padding: 1.35rem 0;
  border-top: 1px solid var(--rule);
}

.pub:last-child { border-bottom: 1px solid var(--rule); }

.pub__body { flex: 1 1 auto; min-width: 0; }

.pub__title {
  font-family: var(--serif);
  font-size: 1.09rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.35rem;
}

.pub__authors {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0 0 0.3rem;
}

.pub__authors .me { font-weight: 700; color: var(--ink); }

.pub__venue {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.pub__venue em { font-style: italic; }

.pub__abstract {
  font-size: 0.93rem;
  color: var(--ink-soft);
  margin: 0 0 0.7rem;
}

.pub__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pub__links a,
.pub__links span.badge {
  font-size: 0.79rem;
  line-height: 1;
  padding: 0.34rem 0.6rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  color: var(--ink-soft);
  background: #fff;
  white-space: nowrap;
}

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

.pub__links .badge {
  border-style: dashed;
  color: var(--muted);
  cursor: default;
}

.pub__links .badge--cites {
  border-style: solid;
  border-color: #d6e2ec;
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}

.pub__thumb {
  flex: 0 0 168px;
  width: 168px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  align-self: flex-start;
}

.pub__thumb img { width: 100%; }

.pub__thumb figcaption {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--faint);
  padding: 0.4rem 0.5rem;
  border-top: 1px solid var(--rule);
  background: var(--bg-soft);
}

/* --- project cards -------------------------------------------------------- */
.project {
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  background: #fff;
}

.project--wash { background: var(--bg-tint); border-color: #dde6ee; }

.project__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.project__name {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
}

.project__when {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.project__tagline {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 1rem;
}

.project__body { font-size: 0.95rem; }

.project__body p:last-child { margin-bottom: 0; }

.project__figure {
  margin: 0 0 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  padding: 0.75rem;
  overflow: hidden;
}

.project__figure svg { display: block; width: 100%; height: auto; }

.project__figure figcaption {
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--rule);
}

/* highlight / result strip */
.results {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.results li {
  border-left: 3px solid var(--accent-light);
  background: var(--bg-soft);
  padding: 0.6rem 0.8rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.results strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--accent);
  line-height: 1.2;
}

/* --- tables --------------------------------------------------------------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

table.data th {
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule-strong);
  font-weight: 700;
}

table.data tr:last-child td { border-bottom: 0; }

table.data td:first-child { white-space: nowrap; color: var(--muted); }

/* --- callout -------------------------------------------------------------- */
.callout {
  border-left: 3px solid var(--accent-light);
  background: var(--accent-wash);
  padding: 0.9rem 1.1rem;
  font-size: 0.93rem;
  margin: 0 0 1.25rem;
  border-radius: 0 4px 4px 0;
}

.callout p:last-child { margin-bottom: 0; }

/* --- footer --------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding: 1.5rem 0 0;
  font-size: 0.82rem;
  color: var(--faint);
}

.footer p { margin: 0 0 0.35rem; }

/* --- responsive ----------------------------------------------------------- */
@media (max-width: 940px) {
  .layout {
    flex-direction: column;
    gap: 0;
    padding: 0 1.5rem;
  }

  .sidebar {
    position: static;
    width: 100%;
    flex: 1 1 auto;
    max-height: none;
    overflow: visible;
    padding: 2.5rem 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 2rem;
    border-bottom: 1px solid var(--rule);
  }

  .profile { flex: 1 1 220px; }

  .sidebar__nav-wrap { flex: 1 1 260px; margin-bottom: 1.25rem; }

  .linklist { margin-bottom: 1.25rem; }

  .content { padding: 2rem 0 4rem; max-width: none; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }

  .layout { padding: 0 1.15rem; }

  .profile { display: flex; align-items: center; gap: 1rem; }

  .profile__photo { width: 96px; height: 96px; margin-bottom: 0; }

  .pub { flex-direction: column; gap: 1rem; }

  .pub__thumb {
    order: -1;
    width: 100%;
    flex: 1 1 auto;
    max-width: 320px;
  }

  .page-header h1 { font-size: 1.7rem; }

  h2 { font-size: 1.25rem; }

  .news li { flex-direction: column; gap: 0.1rem; }

  .news__date { flex: none; }
}

/* --- print ---------------------------------------------------------------- */
@media print {
  .sidebar { position: static; max-height: none; overflow: visible; }
  .layout { display: block; padding: 0; max-width: none; }
  .content { max-width: none; padding: 0; }
  .nav, .sidebar__section-title, .footer { display: none; }
  a { color: var(--ink); }
  .project, .pub { break-inside: avoid; }
}
