/* =========================================================================
   Huili Huang — academic site
   Academic light theme: white background, classic navy accent, slate ink text.
   ========================================================================= */

:root {
  /* Academic light theme: white background, classic navy accent, slate ink text */
  --bg: #ffffff;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.20);
  --text: #1a2233;
  --muted: #55607a;
  --faint: #8a93a8;

  /* Accent ramp (names kept so existing var() references update automatically) */
  --cyan: #1d4ed8;   /* primary navy-blue accent (links, kickers) */
  --indigo: #2563eb; /* mid blue */
  --violet: #1e3a8a; /* deep navy */
  --grad: #1d4ed8;   /* solid accent fill (buttons, bars, dots) */
  --grad-soft: rgba(29, 78, 216, 0.08);

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1080px;
  --shadow: 0 18px 50px -24px rgba(15, 23, 42, 0.30);
  --shadow-glow: 0 0 0 1px rgba(29, 78, 216, 0.16), 0 24px 60px -28px rgba(29, 78, 216, 0.25);

  --font-head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

/* ---------- Animated background layer ---------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg-2);
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
}
#particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.3;
  pointer-events: none;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}
.section { padding: 72px 0; }
.section-tight { padding: 44px 0; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(29, 78, 216, 0.55);
}
.brand .grad-text { color: var(--cyan); }

.nav-links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-block;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active {
  color: var(--text);
  background: var(--grad-soft);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.nav-toggle {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 42px; height: 38px;
  border-radius: 10px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { padding: 84px 0 56px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 22px;
}
.eyebrow .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(2.6rem, 6vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  font-weight: 700;
}
.hero h1 .cn { font-size: 0.5em; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.hero .tagline {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--cyan);
}
.hero .lead { color: var(--muted); font-size: 1.08rem; max-width: 36em; margin: 0 0 26px; }

.hero-photo-wrap { position: relative; justify-self: center; }
.hero-photo {
  width: 280px; height: 280px;
  object-fit: cover;
  border-radius: 28px;
  border: 1px solid var(--border-strong);
  position: relative;
  z-index: 1;
}
.hero-photo-wrap::before {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 36px;
  background: var(--grad);
  filter: blur(38px);
  opacity: 0.16;
  z-index: 0;
}

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--border-strong); background: var(--surface-2); }
.btn-primary {
  background: var(--grad);
  border: none;
  color: #ffffff;
  font-weight: 700;
}
.btn-primary:hover { box-shadow: 0 14px 34px -12px rgba(29, 78, 216, 0.55); }
.btn svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------- Section headings ---------- */
.section-head { margin-bottom: 34px; }
.section-head .kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 8px;
}
.section-head h2 {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 700;
  display: inline-block;
}
.section-head h2::after {
  content: "";
  display: block;
  width: 64px; height: 4px;
  border-radius: 4px;
  margin-top: 12px;
  background: var(--grad);
}
.section-head p { color: var(--muted); margin: 14px 0 0; max-width: 52em; }

/* ---------- Cards & glass ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px -20px rgba(15, 23, 42, 0.22);
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-glow); }

.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- Chips / tags ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

/* ---------- Postdoc banner ---------- */
.banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 26px;
  border-radius: var(--radius);
  background: var(--grad-soft);
  border: 1px solid var(--border-strong);
}
.banner .icon {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--grad);
  color: #ffffff;
}
.banner .icon svg { width: 24px; height: 24px; fill: currentColor; }
.banner strong { font-family: var(--font-head); }
.banner p { margin: 2px 0 0; color: var(--muted); font-size: 0.96rem; }

/* ---------- Publications ---------- */
.pub-year {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 38px 0 16px;
  display: flex; align-items: center; gap: 14px;
}
.pub-year::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pub {
  display: flex;
  gap: 18px;
  padding: 20px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 14px;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.pub:hover { border-color: var(--border-strong); transform: translateX(4px); background: var(--surface-2); }
.pub-body { flex: 1; min-width: 0; }
.pub-title { font-family: var(--font-head); font-weight: 600; font-size: 1.06rem; margin: 0 0 6px; }
.pub-title a { color: var(--text); text-decoration: none; }
.pub-title a:hover { color: var(--cyan); }
.pub-authors { color: var(--muted); font-size: 0.93rem; margin: 0 0 8px; }
.pub-authors .me { color: var(--text); font-weight: 700; }
.pub-venue { font-size: 0.88rem; color: var(--faint); font-style: italic; }

/* ---------- Research cards ---------- */
.research-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.research-figure {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #ffffff;
  display: grid; place-items: center;
  border-bottom: 1px solid var(--border);
}
.research-figure img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 10px; }
.research-figure .placeholder {
  text-align: center; color: var(--muted); font-size: 0.84rem; padding: 16px;
}
.research-figure .placeholder svg { width: 38px; height: 38px; fill: var(--faint); margin-bottom: 8px; }
.research-body { padding: 24px 26px; flex: 1; display: flex; flex-direction: column; }
.research-body h3 { font-family: var(--font-head); font-size: 1.22rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.research-body .venue { color: var(--cyan); font-size: 0.85rem; font-weight: 600; margin: 0 0 12px; }
.research-body p { color: var(--muted); font-size: 0.96rem; margin: 0 0 16px; flex: 1; }
.research-links { display: flex; flex-wrap: wrap; gap: 10px; }
.link-pill {
  font-size: 0.85rem; font-weight: 600; text-decoration: none;
  color: var(--text); padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  transition: border-color 0.2s, color 0.2s;
}
.link-pill:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---------- Teaching ---------- */
.teach {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); margin-bottom: 12px;
  transition: border-color 0.2s, transform 0.2s;
}
.teach { color: var(--text); text-decoration: none; }
.teach:hover { border-color: var(--border-strong); transform: translateX(4px); }
.teach > span:first-child { font-family: var(--font-head); font-weight: 600; }
.teach:hover > span:first-child { color: var(--cyan); }
.teach .role { color: var(--muted); font-size: 0.86rem; white-space: nowrap; }
.teach .role .hl { color: var(--violet); font-weight: 600; }

/* ---------- CV / timeline ---------- */
.timeline { position: relative; margin-left: 8px; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 2px; background: var(--cyan);
  opacity: 0.5;
}
.tl-item { position: relative; margin-bottom: 28px; }
.tl-item::before {
  content: ""; position: absolute; left: -30px; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 0 8px rgba(29, 78, 216, 0.5);
}
.tl-item .when { color: var(--cyan); font-size: 0.85rem; font-weight: 600; }
.tl-item h3 { font-family: var(--font-head); margin: 4px 0 2px; font-size: 1.12rem; }
.tl-item .org { color: var(--muted); font-size: 0.95rem; margin: 0 0 8px; }
.tl-item ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.tl-item ul li { margin-bottom: 4px; }

/* ---------- Skills bars ---------- */
.skill { margin-bottom: 18px; }
.skill-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 0.95rem; }
.skill-label .pct { color: var(--faint); }
.skill-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.skill-fill { height: 100%; border-radius: 999px; background: var(--grad); width: 0; transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- Awards ---------- */
.award {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); margin-bottom: 12px;
}
.award .medal {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; background: var(--grad-soft);
  border: 1px solid var(--border);
}
.award .medal svg { width: 19px; height: 19px; fill: var(--cyan); }

/* ---------- News ---------- */
.news-item { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-date { flex: none; width: 86px; color: var(--cyan); font-size: 0.84rem; font-weight: 600; font-family: var(--font-head); padding-top: 1px; }
.news-text { color: var(--muted); font-size: 0.97rem; }
.news-text a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.news-text a:hover { color: var(--cyan); }

/* ---------- Prose ---------- */
.prose p { color: var(--muted); margin: 0 0 16px; }
.prose a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid rgba(29, 78, 216, 0.35); }
.prose a:hover { border-bottom-color: var(--cyan); }
.prose strong { color: var(--text); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 36px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: center; }
.footer .social { display: flex; gap: 12px; }
.footer .social a {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.footer .social a:hover { color: var(--cyan); border-color: var(--cyan); transform: translateY(-2px); }
.footer .social svg { width: 19px; height: 19px; fill: currentColor; }
.footer .copy { color: var(--faint); font-size: 0.88rem; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-photo-wrap { order: -1; }
  .btn-row, .chips, .eyebrow { justify-content: center; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-links {
    position: absolute; top: 100%; right: 16px; left: 16px;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 10px; margin-top: 8px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .section { padding: 52px 0; }
  .hero-photo { width: 220px; height: 220px; }
  .pub { flex-direction: column; gap: 10px; }
  .teach { flex-direction: column; align-items: flex-start; gap: 6px; }
  .news-item { flex-direction: column; gap: 4px; }
  .news-date { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #particles { display: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .eyebrow .pulse { animation: none; }
  * { transition: none !important; }
}
