/* ============================================================
   Ming-Yang Zhuang — academic homepage
   University of Illinois Urbana-Champaign
   ============================================================ */

:root {
  --bg: #faf8f5;
  --bg-alt: #f2ede6;
  --text: #201d1a;
  --text-soft: #57524c;
  --border: #e3dcd2;
  --accent: #b5511a;      /* accretion-disk amber-orange */
  --accent-2: #7a2f0a;    /* deeper ember, used in gradients */
  --accent-soft: #f1e2d4;
  --link: #8a3c12;
  --card-shadow: 0 1px 2px rgba(32, 29, 26, 0.04), 0 4px 16px rgba(32, 29, 26, 0.05);
  --card-shadow-hover: 0 6px 12px rgba(32, 29, 26, 0.06), 0 16px 40px rgba(32, 29, 26, 0.10);
  --radius: 12px;
  --max-width: 900px;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --nav-h: 68px;

  /* the hero is always a dark "night sky" band, independent of light/dark theme */
  --hero-bg: #0e0c0a;
  --hero-bg-2: #17110a;
  --hero-text: #f7f1e8;
  --hero-text-soft: #c9beae;
  --hero-border: rgba(247, 241, 232, 0.14);
  --hero-glass: rgba(247, 241, 232, 0.06);
  --hero-star: #f7f1e8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --bg-alt: #1b1815;
    --text: #ece8e2;
    --text-soft: #b3aca2;
    --border: #322c25;
    --accent: #e08a4f;
    --accent-2: #f0a468;
    --accent-soft: #2b2018;
    --link: #f0a468;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 4px 20px rgba(0, 0, 0, 0.35);
    --card-shadow-hover: 0 6px 14px rgba(0, 0, 0, 0.3), 0 20px 48px rgba(0, 0, 0, 0.42);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

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

img { max-width: 100%; }

section, header.hero {
  scroll-margin-top: var(--nav-h);
}

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

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Nav (fixed, transparent over the hero, solidifies on scroll) ---------- */

nav.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
}

nav.site-nav .wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--hero-text);
  border-bottom: none;
  white-space: nowrap;
  transition: color 0.25s ease;
}
.brand:hover { border-bottom: none; color: var(--accent); }

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: 0.9rem;
}
.nav-links a {
  position: relative;
  color: var(--hero-text-soft);
  border-bottom: none;
  padding-bottom: 3px;
  transition: color 0.25s ease;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transition: right 0.2s ease;
}
.nav-links a:hover { color: var(--hero-text); }
.nav-links a:hover::after { right: 0; }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  background: none;
  color: var(--hero-text);
  cursor: pointer;
  transition: color 0.25s ease;
}
.nav-toggle svg { display: block; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
nav.site-nav.solid .nav-toggle { color: var(--text); }

nav.site-nav.solid {
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
nav.site-nav.solid .brand { color: var(--text); }
nav.site-nav.solid .nav-links a { color: var(--text-soft); }
nav.site-nav.solid .nav-links a:hover { color: var(--accent); }

/* ---------- Hero: cosmic band ---------- */

header.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, var(--hero-bg-2), var(--hero-bg) 60%);
  color: var(--hero-text);
  overflow: hidden;
  padding-top: var(--nav-h);
}

#starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hero-glow {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}
.hero-glow.g1 {
  width: 620px;
  height: 620px;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent) 0%, transparent 70%);
  opacity: 0.55;
}
.hero-glow.g2 {
  width: 420px;
  height: 420px;
  bottom: -180px;
  right: -120px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 60%, transparent) 0%, transparent 70%);
  opacity: 0.4;
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 64px 24px 96px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
  font-weight: 600;
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}

.avatar-wrap {
  position: relative;
  width: 116px;
  height: 116px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-wrap::before {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0deg,
    var(--accent) 55deg,
    transparent 120deg,
    transparent 210deg,
    var(--accent-2) 270deg,
    transparent 340deg);
  filter: blur(3px);
  animation: spin 14s linear infinite;
}
.avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid var(--hero-border);
}
@keyframes spin { to { transform: rotate(360deg); } }

.avatar {
  position: relative;
  z-index: 1;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fdf6ee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  object-fit: cover;
}

.hero-text h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--hero-text);
}

.hero-text .title {
  color: var(--hero-text-soft);
  font-size: 1.05rem;
  margin: 0 0 2px;
}

.hero-text .affil {
  color: var(--hero-text-soft);
  font-size: 1.02rem;
  margin: 0;
}

.hero-tagline {
  margin-top: 26px;
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--hero-text-soft);
  max-width: 66ch;
  text-wrap: pretty;
}

.hero-links {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* pills inside the dark hero get a translucent "glass" treatment */
.hero-links .pill {
  background: var(--hero-glass);
  border-color: var(--hero-border);
  color: var(--hero-text);
  backdrop-filter: blur(6px);
}
.hero-links .pill:hover {
  border-color: var(--accent);
  color: var(--hero-text);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 2;
  color: var(--hero-text-soft);
  opacity: 0.75;
  animation: bob 2.4s ease-in-out infinite;
}
.scroll-cue svg { display: block; }
@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(7px); }
}

/* ---------- Sections ---------- */

section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

section h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

section > .wrap > p.section-intro {
  color: var(--text-soft);
  margin-top: -8px;
  margin-bottom: 24px;
  max-width: 62ch;
}

/* scroll-reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Research topic cards ---------- */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.topic-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.topic-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.topic-num {
  position: absolute;
  top: -6px;
  right: 8px;
  font-family: var(--serif);
  font-size: 3.2rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.1;
  line-height: 1;
  pointer-events: none;
}
.topic-card h3 {
  position: relative;
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}
.topic-card p {
  position: relative;
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-soft);
}

/* ---------- Publications ---------- */

.pub-list {
  display: flex;
  flex-direction: column;
}

.pub-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding: 16px 12px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.pub-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.pub-item:hover {
  border-left-color: var(--accent);
  background: var(--bg-alt);
}

.pub-year {
  font-family: var(--serif);
  color: var(--text-soft);
  font-size: 0.95rem;
  padding-top: 2px;
}

.pub-title {
  font-weight: 600;
  margin: 0 0 4px;
}

.pub-authors {
  color: var(--text-soft);
  font-size: 0.92rem;
  margin: 0 0 5px;
}
.pub-authors .me { color: var(--text); font-weight: 600; }

.pub-venue {
  font-size: 0.9rem;
  color: var(--text-soft);
  font-style: italic;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.venue-badge {
  font-style: normal;
  border-bottom: none;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 2px 7px;
}

.pub-links a {
  font-size: 0.86rem;
  margin-right: 12px;
}

.pub-more {
  margin-top: 22px;
  font-size: 0.94rem;
}

/* ---------- Research highlights ---------- */

.pub-subhead {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  font-weight: 600;
  margin: 34px 0 16px;
}

.hl-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hl-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px 20px;
  box-shadow: var(--card-shadow);
  scroll-margin-top: calc(var(--nav-h) + 12px);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.hl-card:hover { box-shadow: var(--card-shadow-hover); }
.hl-card:target { border-color: var(--accent); }

.hl-meta {
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 6px;
}

.hl-title {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 6px;
}

.hl-figs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0 14px;
}
.hl-figs figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hl-figs figure > a {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;            /* paper figures have white backgrounds */
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  height: 300px;
  overflow: hidden;
}
.hl-figs figure > a:hover { border-color: var(--accent); }
.hl-figs img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.hl-figs figcaption {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-soft);
}

.hl-summary {
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 0 10px;
}

@media (max-width: 640px) {
  .hl-card { padding: 18px 16px 16px; }
  .hl-figs { grid-template-columns: 1fr; }
  .hl-figs figure > a { height: auto; max-height: 420px; }
}

/* ---------- CV timeline ---------- */

.cv-block {
  margin-bottom: 28px;
}
.cv-block h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: 0 0 16px;
  font-weight: 600;
}

.cv-timeline {
  position: relative;
  margin-left: 6px;
  padding-left: 22px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cv-entry {
  position: relative;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  font-size: 0.95rem;
}
.cv-entry::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.cv-entry .when {
  color: var(--text-soft);
  font-size: 0.88rem;
  padding-top: 1px;
}
.cv-entry .what strong { font-weight: 600; }
.cv-entry .what span.where { color: var(--text-soft); }

/* ---------- News ---------- */

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.news-list li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  font-size: 0.95rem;
}
.news-date {
  color: var(--text-soft);
  font-size: 0.86rem;
  padding-top: 1px;
  white-space: nowrap;
}

/* ---------- Projects ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.project-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}
.project-card h3 {
  margin: 6px 0 6px;
  font-size: 1rem;
}
.project-card p {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--text-soft);
}
.project-card a { font-size: 0.86rem; }

/* ---------- Contact / Footer ---------- */

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
}

footer {
  padding: 32px 0 60px;
  color: var(--text-soft);
  font-size: 0.85rem;
}
footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.to-top {
  color: var(--text-soft);
  font-size: 0.85rem;
  border-bottom: none;
}
.to-top:hover { color: var(--accent); border-bottom: none; }

/* ---------- Back-to-top floating button ---------- */

#back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#back-to-top:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 560px) {
  .hero-row { flex-direction: column; align-items: flex-start; }
  .cv-entry, .news-list li { grid-template-columns: 1fr; gap: 2px; }
  .cv-entry::before { left: -22px; }
  .pub-item { grid-template-columns: 1fr; }
  .pub-year { padding-top: 0; }
}

/* ---------- Nav collapses into a dropdown menu on narrow screens ---------- */
@media (max-width: 700px) {
  .nav-toggle { display: inline-flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 49;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease;
  }
  .nav-links.open {
    max-height: 320px;
    opacity: 1;
  }
  nav.site-nav .nav-links a {
    color: var(--text-soft);
    padding: 13px 24px;
    border-bottom: 1px solid var(--border);
  }
  nav.site-nav .nav-links a:last-child { border-bottom: none; }
  nav.site-nav .nav-links a:hover { color: var(--accent); }
  .nav-links a::after { display: none; }
}

/* mentee papers under Mentoring entries */
.mentee-pubs { margin-top: 6px; font-size: 0.92em; color: var(--text-soft); }
.mentee-pubs a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
.mentee-pubs a:hover { color: var(--accent); text-decoration-color: currentColor; }


/* ===== Compact layout (2026-10) ===== */

/* publications: links on the same line as the venue */
.pub-item > div:last-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 14px;
}
.pub-item .pub-title, .pub-item .pub-authors { flex: 0 0 100%; }
.pub-item .pub-venue { margin: 0; }
.pub-item .pub-links { margin: 0; }
.pub-item .pub-links a { margin-right: 10px; }

/* collapsed first-author list */
.pub-item.is-collapsed { display: none; }
.pub-toggle {
  margin: 14px 0 0 12px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.pub-toggle:hover { border-color: var(--accent); }

/* highlight cards: smaller figures, clamped summary */
.hl-figs figure > a { height: 210px; }
.hl-figs { margin: 14px 0 12px; }
.hl-summary.is-clamped:not(.is-open) {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hl-more {
  font: inherit;
  font-size: 0.86rem;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  margin: 0 14px 10px 0;
  cursor: pointer;
}
.hl-more:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .hl-figs figure > a { height: auto; max-height: 260px; }
}

/* latest-news strip under the hero */
.latest { padding: 28px 0 4px; }
.latest[hidden] { display: none; }
.latest h2 {
  font-family: var(--font-body, inherit);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 12px;
}
.latest .news-list { gap: 8px; }
.latest .news-list li { font-size: 0.93rem; }

.cn-name { white-space: nowrap; font-weight: inherit; }

.hero-text { flex: 1 1 0; min-width: 0; }
@media (max-width: 560px) { .hero-text { flex-basis: 100%; } .hero-text h1 { font-size: 2rem; } }

#publications .section-intro { max-width: none; text-wrap: wrap; }
