/* ==========================================================
   Fengqing Maggie Zhu — site stylesheet
   Colors follow Purdue's palette (black + Boilermaker gold).
   ========================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f5f0;
  --text: #1d1d1f;
  --muted: #5d5d63;
  --line: #e4e0d6;
  --gold: #cfb991;          /* Boilermaker Gold */
  --gold-dark: #8e6f3e;     /* Aged gold, readable on white */
  --link: #7a5c2e;
  --link-hover: #000000;
  --header-bg: #000000;
  --header-text: #ffffff;
  --badge-bg: #f3ead7;
  --badge-text: #6b4f1d;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  --radius: 10px;
  --maxw: 1040px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --bg-soft: #1c1c1c;
    --text: #ececec;
    --muted: #a6a6a6;
    --line: #2e2e2e;
    --gold-dark: #cfb991;
    --link: #dcc79c;
    --link-hover: #ffffff;
    --header-bg: #000000;
    --badge-bg: #3a3122;
    --badge-text: #ecd9b0;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; transition: color .15s, border-color .15s; }
a:hover { color: var(--link-hover); border-bottom-color: var(--gold); }

h1, h2, h3 {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  line-height: 1.25;
  font-weight: 600;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: 1.55rem; margin-top: 2.2em; padding-bottom: .35em; border-bottom: 2px solid var(--gold); display: inline-block; }
h3 { font-size: 1.2rem; margin-top: 0; }

p { margin: 0 0 1em; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: 20px; }
main { padding-block: 40px 64px; }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 3px solid var(--gold);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  color: #fff;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .01em;
  border: 0;
}
.brand:hover { color: var(--gold); border: 0; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: #e6e6e6;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: .95rem;
  border: 0;
}
.nav a:hover { color: #000; background: var(--gold); }
.nav a[aria-current="page"] { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }

@media (max-width: 640px) {
  .site-header .wrap { padding-block: 8px; }
  .nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
}

/* ---------- Hero (home) ---------- */
.hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: center;
}
.hero .portrait {
  width: 220px;
  aspect-ratio: 540 / 723;   /* matches head_shot_2_web.jpg */
  background-size: cover;
  background-position: center;
  -webkit-user-select: none;
  user-select: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero .title { color: var(--muted); font-size: 1.1rem; margin-bottom: 1em; }
.hero .title strong { color: var(--text); font-weight: 600; }
.contact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  font-size: .95rem;
  margin: 0;
}
.contact dt { color: var(--muted); font-weight: 500; }
.contact dd { margin: 0; }
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 20px; }
  .hero .portrait { margin: 0 auto; width: 180px; }
  .contact { text-align: left; max-width: 360px; margin: 0 auto; }
  .quick-links { justify-content: center; }
}

/* ---------- Buttons / pills ---------- */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--gold-dark);
  color: var(--text);
  font-size: .92rem;
  font-weight: 500;
}
.btn:hover { background: var(--gold); border-color: var(--gold); color: #000; }
.btn.primary { background: #000; color: #fff; border-color: #000; }
.btn.primary:hover { background: var(--gold); color: #000; border-color: var(--gold); }
@media (prefers-color-scheme: dark) {
  .btn.primary { background: var(--gold); color: #000; border-color: var(--gold); }
  .btn.primary:hover { background: #fff; border-color: #fff; }
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  margin-top: 1.2em;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.card:hover { transform: translateY(-3px); border-color: var(--gold); color: var(--text); }
.card .thumb { aspect-ratio: 16 / 10; background: var(--bg-soft); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Cards without a picture get a gold gradient band instead */
.card:not(:has(.thumb))::before {
  content: "";
  display: block;
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(circle at 80% 20%, rgba(207,185,145,.55), transparent 55%),
    linear-gradient(135deg, #000 0%, #2b2418 55%, #8e6f3e 100%);
}
.card .body { padding: 14px 16px 16px; }
.card h3 { font-size: 1.05rem; margin-bottom: .3em; }
.card p { font-size: .9rem; color: var(--muted); margin: 0; }
.card .ext::after { content: " \2197"; color: var(--gold-dark); }

.subhead {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
  margin: 1.6em 0 0;
}

/* ---------- Project sections (research pages) ---------- */
.page-intro { color: var(--muted); max-width: 70ch; }
.back { font-size: .92rem; display: inline-block; margin-bottom: 14px; }

.project {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.project:first-of-type { border-top: 0; }
.project:not(:has(figure)) { grid-template-columns: 1fr; }
.project figure { margin: 0; position: sticky; top: 84px; align-self: start; }
.project figure img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  width: 100%;
}
.project h2 { margin-top: 0; }
@media (max-width: 820px) {
  .project { grid-template-columns: 1fr; gap: 18px; }
  .project figure { max-width: 480px; position: static; }
}

/* ---------- Publication lists ---------- */
.pubs { list-style: none; padding: 0; margin: 1em 0 0; counter-reset: pub; }
.pubs li {
  position: relative;
  padding: 12px 0 12px 44px;
  border-bottom: 1px solid var(--line);
  counter-increment: pub;
  font-size: .96rem;
}
.pubs li:last-child { border-bottom: 0; }
.pubs li::before {
  content: counter(pub);
  position: absolute;
  left: 0;
  top: 13px;
  width: 30px;
  text-align: right;
  color: var(--gold-dark);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pubs .t { font-weight: 600; color: var(--text); display: block; }
.pubs a.t:hover { color: var(--link); }
.pubs .a { color: var(--text); }
.pubs .v { font-style: italic; color: var(--muted); }
.pubs .me { font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.tag {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: .75rem;
  font-weight: 600;
  padding: 1px 9px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
  letter-spacing: .02em;
}
.show-all {
  margin: 10px 0 0 36px;
  padding: 5px 14px;
  font: inherit;
  font-size: .86rem;
  font-weight: 500;
  color: var(--link);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.show-all:hover { border-color: var(--gold); color: var(--text); }
.tag.preprint { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line); }
.res { display: inline-flex; gap: 6px; margin-left: 6px; }
.res a {
  font-size: .78rem;
  font-weight: 600;
  padding: 1px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
}
.res a:hover { border-color: var(--gold); color: var(--text); }

/* Research-area links after a paper (Publications page) */
.areas { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 6px; vertical-align: 1px; }
.areas a.area {
  font-size: .74rem;
  font-weight: 600;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--gold-dark);
  border: 1px solid var(--line);
}
.areas a.area:hover { border-color: var(--gold); color: var(--text); }

/* Publications page: year jump links + year groups */
.year-nav { display: flex; flex-wrap: wrap; gap: 6px 4px; margin: 18px 0 0; font-size: .92rem; }
.year-nav a, .year-nav [data-year-nav] a {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--text);
}
.year-nav a:hover { border-color: var(--gold); background: var(--bg-soft); }
.year-nav [data-year-nav] { display: contents; }
.pubs-by-year .year { scroll-margin-top: 70px; margin-top: 10px; }
.pubs-by-year .year > summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  padding: 10px 4px 6px;
  border-bottom: 1px solid var(--line);
}
.pubs-by-year .year > summary::-webkit-details-marker { display: none; }
.pubs-by-year .year > summary::before {
  content: "\25B8";
  color: var(--gold-dark);
  font-size: .9rem;
  transition: transform .15s;
}
.pubs-by-year .year[open] > summary::before { transform: rotate(90deg); }
.pubs-by-year .year .yr {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gold-dark);
}
.pubs-by-year .year .count { font-size: .85rem; color: var(--muted); }
.pubs-by-year .year > summary:hover .yr { color: var(--text); }

/* Publications filter bar */
.pub-filters {
  margin: 22px 0 6px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  font: inherit;
  font-size: .86rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.chips button .n { color: var(--muted); font-size: .78rem; margin-left: 2px; }
.chips button:hover { border-color: var(--gold); }
.chips button[aria-pressed="true"] { background: #000; color: #fff; border-color: #000; }
.chips button[aria-pressed="true"] .n { color: var(--gold); }
.search-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.search-row input {
  flex: 1 1 260px;
  font: inherit;
  font-size: .92rem;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.search-row input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.result-count { font-size: .86rem; color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .chips button[aria-pressed="true"] { background: var(--gold); color: #000; border-color: var(--gold); }
  .chips button[aria-pressed="true"] .n { color: #000; }
}
section[id] { scroll-margin-top: 70px; }

.project .pubs li { font-size: .92rem; padding-left: 36px; }
.project .pubs li::before { width: 24px; }
.pubs-label { font-weight: 600; font-size: .9rem; margin: 1.2em 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- People ---------- */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px 20px;
  list-style: none;
  padding: 0;
  margin: 1em 0 0;
}
.people-grid li {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
/* Current members: cards with role label + research topic */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 1em 0 0;
}
.member {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.member .name { font-weight: 600; }
.member .topic { font-size: .86rem; color: var(--muted); line-height: 1.45; }
.member .role, .alumni .role {
  align-self: flex-start;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold-dark);
}
.alumni .role { display: inline-block; min-width: 92px; margin-right: 6px; }
@media (max-width: 640px) { .alumni .role { display: block; min-width: 0; } }
.placements {
  margin: 1em 0 0;
  padding: 12px 16px;
  border-left: 4px solid var(--gold);
  background: var(--bg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .98rem;
}

.alumni { list-style: none; padding: 0; margin: 1em 0 0; }
.alumni li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.alumni li:last-child { border-bottom: 0; }
.alumni .name { font-weight: 600; }
.alumni .meta { color: var(--muted); font-size: .92rem; }
.alumni .thesis { display: block; font-size: .92rem; margin-top: 2px; }

/* ---------- Research thrusts ---------- */
.thrust-num {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 4px;
}

/* Home page: three thrust tiles */
.thrust-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 1em;
}
.thrust-tile {
  display: block;
  padding: 20px 22px 18px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
a.thrust-tile:hover { transform: translateY(-3px); border-color: var(--gold); color: var(--text); }
.thrust-tile h3 { font-size: 1.15rem; margin-bottom: .6em; }
.thrust-tile ul { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: .92rem; }
.thrust-tile ul li { margin: 3px 0; }
.thrust-tile::after { content: "Learn more \2192"; display: block; margin-top: 12px; font-size: .88rem; font-weight: 500; color: var(--link); }

/* Research page: jump links */
.thrust-toc { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 8px; }
.thrust-toc a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: .92rem;
  font-weight: 500;
  background: var(--bg-soft);
}
.thrust-toc a:hover { border-color: var(--gold); }
.thrust-toc span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #000;
  color: var(--gold);
  font-size: .8rem;
  font-weight: 600;
}

/* Research page: one row per thrust, image side alternates */
.thrust {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 44px;
  padding: 48px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 70px;
}
.thrust:first-of-type { border-top: 0; }
.thrust:nth-of-type(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.thrust:nth-of-type(even) figure { order: 2; }
.thrust figure { margin: 0; position: sticky; top: 84px; align-self: start; }
.thrust figure > img,
.collage img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}
.thrust figcaption { font-size: .85rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.collage { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.collage img { aspect-ratio: 4 / 3; object-fit: cover; }
.thrust h2 { margin-top: 0; }
.objective {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.45;
  margin: .8em 0 .6em;
  padding-left: 14px;
  border-left: 3px solid var(--gold);
}
.focus { list-style: none; padding: 0; margin: 1.2em 0 0; display: grid; gap: 8px; }
.focus li {
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: .93rem;
  color: var(--muted);
}
.focus strong { display: block; color: var(--text); font-weight: 600; }
/* Focus areas at the top of a research page: clickable jump links in a row */
.focus-nav { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 8px; }
.focus-nav li { padding: 0; border: 1px solid transparent; transition: border-color .15s; }
.focus-nav li:hover { border-color: var(--gold); }
.focus-nav a { display: block; padding: 10px 14px; color: var(--muted); border: 0; }
.focus-nav a:hover { color: var(--muted); }
.project { scroll-margin-top: 70px; }
.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.related .btn { font-size: .85rem; padding: 5px 14px; }
.btn.ext::after { content: " \2197"; }

@media (max-width: 860px) {
  .thrust, .thrust:nth-of-type(even) { grid-template-columns: 1fr; gap: 20px; padding: 36px 0; }
  .thrust:nth-of-type(even) figure { order: 0; }
  .thrust figure { position: static; max-width: 560px; }
}

/* ---------- Honors & Service (dated lists) ---------- */
.cv-list { list-style: none; padding: 0; margin: .8em 0 0; }
.cv-list li {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: .95rem;
}
.cv-list li:last-child { border-bottom: 0; }
.cv-list .when { color: var(--gold-dark); font-weight: 600; font-size: .88rem; font-variant-numeric: tabular-nums; }
.cv-note { color: var(--muted); font-size: .88rem; }
.cv-sub { margin: 1.8em 0 0; font-size: 1.1rem; }
.jump { font-size: .95rem; }
@media (max-width: 640px) { .cv-list li { grid-template-columns: 1fr; } }
.bio-more { font-weight: 500; }

/* ---------- Misc ---------- */
.callout {
  background: var(--bg-soft);
  border-left: 4px solid var(--gold);
  padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.2em 0;
}
ul.checklist { padding-left: 1.2em; }
ul.checklist li { margin: 4px 0; }

.teaching { list-style: none; padding: 0; margin: 1em 0 0; }
.teaching li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.teaching li:last-child { border-bottom: 0; }
.teaching .code { font-weight: 600; color: var(--gold-dark); margin-right: 6px; }
.teaching .note { display: block; color: var(--muted); font-size: .9rem; }
/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: .88rem;
  padding-block: 24px;
}
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
