/* Min An — academic homepage
   Palette: scholarly indigo on paper. Display: Lora/Georgia. Body: system sans. */

:root {
  --indigo: #3f51b5;
  --indigo-deep: #2c3a8c;
  --indigo-soft: #eef0fa;
  --accent: #b8860b;

  --bg: #ffffff;
  --bg-alt: #f7f8fc;
  --surface: #ffffff;
  --text: #23262b;
  --muted: #626a76;
  --faint: #8b93a1;
  --rule: #e3e6ee;
  --shadow: 0 1px 2px rgba(24, 30, 54, .05), 0 10px 30px -12px rgba(24, 30, 54, .18);

  --display: "Lora", "Source Serif 4", Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1120px;
  --navh: 58px;
}

html[data-theme="dark"] {
  --indigo: #8f9bea;
  --indigo-deep: #b3bcf5;
  --indigo-soft: #1c2136;
  --accent: #d9a441;

  --bg: #14161d;
  --bg-alt: #191c26;
  --surface: #1e222e;
  --text: #e6e8ee;
  --muted: #a3abb9;
  --faint: #79808e;
  --rule: #2c3140;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px -14px rgba(0, 0, 0, .6);
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--navh) + 14px); }

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

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

a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }

.ic { width: 1em; height: 1em; fill: currentColor; flex: none; vertical-align: -.15em; }
.ic.ext { width: .78em; height: .78em; opacity: .55; margin-left: .18em; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--indigo); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 3px; }

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--indigo);
  border-bottom: 1px solid rgba(0, 0, 0, .12);
}
html[data-theme="dark"] .nav { background: #1a1e2c; border-bottom-color: var(--rule); }

.nav-in {
  height: var(--navh);
  display: flex; align-items: center; gap: 10px;
}
.brand {
  font-family: var(--display);
  font-size: 1.22rem; font-weight: 600; letter-spacing: .01em;
  color: #fff; margin-right: auto; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
html[data-theme="dark"] .brand { color: var(--indigo-deep); }

.links { display: flex; gap: 2px; flex-wrap: wrap; }
.links a {
  color: rgba(255, 255, 255, .84);
  font-size: .9rem; font-weight: 500;
  padding: 7px 11px; border-radius: 7px;
  transition: background .16s, color .16s;
}
.links a:hover { background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; }
.links a[aria-current="true"] { background: rgba(255, 255, 255, .2); color: #fff; }
html[data-theme="dark"] .links a { color: var(--muted); }
html[data-theme="dark"] .links a:hover { background: #262b3d; color: #fff; }
html[data-theme="dark"] .links a[aria-current="true"] { background: #2f3650; color: #fff; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: transparent; border: 0; border-radius: 9px;
  color: #fff; font-size: 1.15rem; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .16); }
html[data-theme="dark"] .icon-btn { color: var(--muted); }
html[data-theme="dark"] .icon-btn:hover { background: #262b3d; color: #fff; }
.menu-btn { display: none; }

.theme-btn .moon { display: none; }
html[data-theme="dark"] .theme-btn .sun { display: none; }
html[data-theme="dark"] .theme-btn .moon { display: block; }

/* ---------- hero ---------- */

.hero { padding: 46px 0 8px; background: var(--bg); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 44px;
  align-items: start;
}
.hero-shots { grid-column: 1 / -1; }

.portrait {
  width: 190px; aspect-ratio: 1; margin-bottom: 20px;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid var(--surface);
  box-shadow: 0 0 0 2px var(--indigo), var(--shadow);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }

.hero-id h1 {
  font-family: var(--display);
  font-size: clamp(1.75rem, 3.4vw, 2.35rem);
  font-weight: 600; line-height: 1.15; margin: 0 0 6px;
  letter-spacing: -.015em;
  white-space: nowrap;
}
.role { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; color: var(--indigo); }
.affil { margin: 0 0 16px; font-size: .95rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.affil a { font-weight: 500; }
.loc { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-size: .88rem; }

.social { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 20px; padding: 0; }
.social a {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--indigo-soft); color: var(--indigo);
  font-size: 1.05rem;
  transition: transform .16s, background .16s, color .16s;
}
.social a:hover { background: var(--indigo); color: #fff; text-decoration: none; transform: translateY(-2px); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 9px;
  background: var(--indigo); color: #fff;
  font-size: .92rem; font-weight: 600;
  box-shadow: var(--shadow);
}
.btn:hover { background: var(--indigo-deep); color: #fff; text-decoration: none; }
html[data-theme="dark"] .btn { color: #14161d; }

/* carousel */

.carousel {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 20px auto 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 5;
}
.stage { position: absolute; inset: 0; }
.stage img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 24%;
  opacity: 0; transition: opacity .8s ease;
}
.stage img.on { opacity: 1; }

@media (min-width: 1080px) {
  .hero-grid { grid-template-columns: 300px minmax(0, 1fr) 240px; gap: 34px; }
  .hero-id h1 { font-size: 2.3rem; }
  .hero-shots { grid-column: auto; position: sticky; top: calc(var(--navh) + 18px); }
  .carousel { max-width: none; margin: 0; }
}

.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 46px; border: 0; cursor: pointer;
  background: rgba(20, 22, 29, .38); color: #fff;
  font-size: 1.7rem; line-height: 1;
  display: grid; place-items: center;
  opacity: 0; transition: opacity .2s, background .2s;
}
.carousel:hover .nav-arrow, .nav-arrow:focus-visible { opacity: 1; }
.nav-arrow:hover { background: rgba(20, 22, 29, .68); }
.nav-arrow.prev { left: 0; border-radius: 0 10px 10px 0; }
.nav-arrow.next { right: 0; border-radius: 10px 0 0 10px; }

.dots {
  position: absolute; left: 0; right: 0; bottom: 12px;
  display: flex; justify-content: center; gap: 7px;
}
.dots button {
  width: 22px; height: 4px; padding: 0; border: 0; border-radius: 3px;
  background: rgba(255, 255, 255, .45); cursor: pointer;
  transition: background .2s, width .2s;
}
.dots button:hover { background: rgba(255, 255, 255, .8); }
.dots button[aria-selected="true"] { background: #fff; width: 30px; }

.bio p { margin: 0 0 14px; }
.bio strong { color: var(--text); font-weight: 600; }
.refs { font-size: .95rem; color: var(--muted); }

/* ---------- interests / education strip ---------- */

.strip {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 40px;
  margin: 40px auto 0; padding: 28px 30px;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 14px;
}
.strip h3 {
  font-family: var(--display);
  font-size: 1.06rem; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--faint);
  margin: 0 0 14px;
}

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.tags li {
  font-size: .84rem; font-weight: 500;
  padding: 5px 12px; border-radius: 999px;
  background: var(--surface); color: var(--indigo);
  border: 1px solid var(--rule);
}

.edu { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.edu li { display: flex; gap: 13px; align-items: center; }
.edu img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #fff; padding: 3px; border: 1px solid var(--rule); flex: none; }
.deg { margin: 0; font-weight: 600; font-size: .96rem; line-height: 1.4; }
.school { margin: 1px 0 0; font-size: .89rem; color: var(--muted); }
.years { margin: 1px 0 0; font-size: .83rem; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- sections ---------- */

section { padding: 52px 0; }
.hero { padding-bottom: 0; }

.band { background: var(--bg-alt); }

.sec-title {
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.8vw, 1.95rem);
  font-weight: 600; letter-spacing: -.005em;
  margin: 0 0 26px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--indigo);
  display: flow-root;
}
.sec-title::after { content: none; }

/* publications */

.pubs { list-style: none; counter-reset: n; margin: 0; padding: 0; display: grid; gap: 26px; }
.pubs > li {
  position: relative;
  counter-increment: n;
  padding: 20px 22px 20px 56px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.pubs > li::before {
  content: counter(n, decimal-leading-zero);
  position: absolute; left: 19px; top: 21px;
  font-family: var(--display);
  font-size: .95rem; font-weight: 600;
  color: var(--indigo); opacity: .55;
}
.pubs.zh > li::before { font-size: .9rem; }

.ptitle { margin: 0 0 5px; font-size: 1.06rem; font-weight: 600; line-height: 1.45; }
.ptitle a { color: var(--text); }
.ptitle a:hover { color: var(--indigo); text-decoration: none; }
.ptitle-en { margin: 0 0 5px; font-size: .93rem; font-style: italic; font-weight: 500; line-height: 1.45; color: var(--muted); }

.venue { margin: 0 0 6px; font-size: .92rem; color: var(--indigo); font-weight: 500; }
.venue cite { font-style: normal; }

.auth { margin: 0; font-size: .885rem; color: var(--muted); line-height: 1.6; }
.auth b { color: var(--text); font-weight: 700; }

.status {
  display: inline-block; vertical-align: 1px;
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px;
  background: #fff4e0; color: #96610a;
  border: 1px solid #f0d9ac;
  white-space: nowrap;
}
.status.ok { background: #e7f6ec; color: #1c6b38; border-color: #bfe3ca; }
html[data-theme="dark"] .status { background: #3a2c12; color: #e0aa55; border-color: #5b4520; }
html[data-theme="dark"] .status.ok { background: #143223; color: #6fd39a; border-color: #235236; }

.actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 0; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 600;
  padding: 4px 10px; border-radius: 7px;
  color: var(--indigo); background: var(--indigo-soft);
  border: 1px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.pill:hover { color: #fff; background: var(--indigo); border-color: var(--indigo); text-decoration: none; }
.pill .ic { font-size: .95em; }

.cite {
  margin: 12px 0 0; padding: 13px 15px;
  font-family: var(--mono); font-size: .76rem; line-height: 1.6;
  background: var(--indigo-soft); border-radius: 9px;
  color: var(--muted); overflow-x: auto; white-space: pre;
}
.cite.shown { display: block; }
.cite[hidden] { display: none; }

.more { margin: 26px 0 0; font-size: .9rem; color: var(--muted); }

/* experience */

.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.jobs > li {
  display: grid; grid-template-columns: 170px 1fr; gap: 24px;
  padding: 22px 0; border-top: 1px solid var(--rule);
}
.jobs > li:first-child { border-top: 0; padding-top: 4px; }
.job-when { font-size: .86rem; color: var(--faint); font-variant-numeric: tabular-nums; padding-top: 3px; }
.job-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.logo {
  flex: none; width: 138px; height: 46px;
  display: grid; place-items: center; padding: 7px 10px;
  background: #fff; border: 1px solid var(--rule); border-radius: 9px;
}
.logo img { width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.role2 { margin: 0 0 3px; font-size: 1.02rem; font-weight: 600; }
.org { margin: 0 0 9px; font-size: .93rem; color: var(--muted); }
.job-head .role2 { margin-bottom: 2px; }
.job-head .org { margin-bottom: 0; }
.duties { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--muted); }
.duties li { margin-bottom: 3px; }
.duties li::marker { color: var(--indigo); }

/* footer */

.foot { border-top: 1px solid var(--rule); background: var(--bg-alt); padding: 26px 0; }
.foot-in { display: flex; flex-wrap: wrap; gap: 6px 26px; justify-content: space-between; font-size: .85rem; color: var(--faint); }
.foot p { margin: 0; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--indigo); }
.hits {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--faint); font-variant-numeric: tabular-nums;
}
.hits .ic { font-size: 1.05em; opacity: .75; }
.hits b { color: var(--indigo); font-weight: 700; }
.hits-dot { opacity: .5; }
.to-top {
  position: fixed; right: 22px; bottom: 24px; z-index: 40;
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--indigo-soft); color: var(--indigo);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  font-size: 1.2rem;
  transition: opacity .2s, transform .2s, visibility .2s, background .16s, color .16s;
}
.to-top:hover { background: var(--indigo); color: #fff; text-decoration: none; transform: translateY(-2px); }
.to-top.up { opacity: 0; visibility: hidden; transform: translateY(10px); pointer-events: none; }
html[data-theme="dark"] .to-top:hover,
html[data-theme="dark"] .pill:hover,
html[data-theme="dark"] .social a:hover { color: #14161d; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .portrait { width: 156px; }
  .strip { grid-template-columns: 1fr; gap: 28px; }
  .menu-btn { display: grid; order: -1; }
  .links {
    position: absolute; top: var(--navh); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 14px 14px;
    background: var(--indigo);
    border-bottom: 1px solid rgba(0, 0, 0, .2);
    box-shadow: var(--shadow);
    display: none;
  }
  html[data-theme="dark"] .links { background: #1a1e2c; border-bottom-color: var(--rule); }
  .links.open { display: flex; }
  .links a { padding: 11px 12px; border-radius: 8px; font-size: .96rem; }
  .brand { font-size: 1.1rem; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  section { padding: 40px 0; }
  .wrap { padding-inline: 18px; }
  .strip { padding-inline: 18px; }
  .pubs > li { padding: 18px 18px 18px 50px; }
  .pubs > li::before { left: 15px; }
  .jobs > li { grid-template-columns: 1fr; gap: 6px; }
  .job-when { padding-top: 0; }
  .job-head { flex-wrap: wrap; gap: 10px; }
  .nav-arrow { opacity: 1; }
  .to-top { right: 14px; bottom: 16px; width: 38px; height: 38px; font-size: 1.1rem; }
}

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

@media print {
  .nav, .carousel, .social, .btn, .links, .more, .to-top { display: none !important; }
  body { font-size: 11pt; }
  .pubs > li { break-inside: avoid; box-shadow: none; }
}
