/* ---------- Base / tokens ---------- */
:root{
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #222;
  --muted: #666;
  --brand: #0b63f6;
  --brand-ink: #0a3fb4;
  --rule: #e9ecf2;
  --shadow: 0 8px 24px rgba(0,0,0,.06);
  --radius: 14px;

  /* CCF badges */
  --ccf-a-grad: linear-gradient(135deg, #ff8a00, #ff3d71 35%, #8a2be2 75%);
  --ccf-a-text: #fff;
  --ccf-a-ring: rgba(255, 61, 113, .55);

  --ccf-b-bg: #eaf8ff;
  --ccf-b-ink: #0b63f6;

  --ccf-c-bg: #f2f3f7;
  --ccf-c-ink: #555;
}

@media (prefers-color-scheme: dark) {
  :root{
    --bg: #0e1116;
    --panel: #141922;
    --ink: #eef0f4;
    --muted: #a9b0bb;
    --brand: #6aa8ff;
    --brand-ink: #a6c6ff;
    --rule: #1f2632;
    --shadow: 0 8px 24px rgba(0,0,0,.4);

    --ccf-a-grad: linear-gradient(135deg, #ffb35c, #ff6fa0 35%, #a77bff 75%);
    --ccf-a-ring: rgba(255, 146, 188, .55);

    --ccf-b-bg: #0b1a2a;
    --ccf-b-ink: #6aa8ff;

    --ccf-c-bg: #1b2130;
    --ccf-c-ink: #cfd6e4;
  }
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  line-height:1.65; color:var(--ink); background:var(--bg);
}

/* ---------- A11y ---------- */
.skip-link{
  position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden;
}
.skip-link:focus{position:static;width:auto;height:auto;padding:.5rem .75rem;background:#fffa;}

/* ---------- Header / Nav ---------- */
.site-header{
  position: sticky; top: 0; z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.site-header .wrap{
  max-width: 980px; margin: 0 auto;
  display:flex; align-items:center; justify-content:space-between;
  padding: .6rem 1rem;
}
.brand{color:var(--ink); text-decoration:none; font-size:1.05rem}
.site-nav a{
  color:var(--muted); text-decoration:none; margin-left:1rem; font-weight:600;
}
.site-nav a:hover{color:var(--brand)}
.site-nav a.active{ color: var(--brand); }
.icon-btn{
  background: transparent; border: 1px solid var(--rule); border-radius: 10px;
  padding: .35rem .55rem; margin-left: .75rem; cursor: pointer; color: var(--muted);
}
.icon-btn:hover{ color: var(--brand); border-color: #c8d5ff; }

/* ---------- Container ---------- */
.container{
  max-width: 980px; margin: 28px auto; padding: 0 16px;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- Sections ---------- */
.section{padding: 28px 28px 6px; border-top: 1px solid var(--rule);}
.section:first-of-type{border-top:none}
h1,h2,h3{line-height:1.25;margin:0 0 10px}
h2{font-size:1.35rem;border-bottom:2px solid var(--brand);padding-bottom:.4rem;margin-bottom:1rem}
p{margin:.5rem 0}

/* ---------- Profile ---------- */
.profile{
  display:grid;
  grid-template-columns: minmax(260px, 320px) 1fr; /* 左图列更宽，适配竖版 */
  gap: 22px;
  padding: 28px;
}

/* 头像容器（默认矩形，可被形状类覆盖） */
.profile-photo{
  margin:0; 
  align-self:start;
  width:100%;
  aspect-ratio: 4 / 3;        /* 默认横向矩形 */
  border-radius: 16px;         /* 默认圆角矩形 */
  overflow: hidden;
  border: 4px solid var(--rule);
  background:#ddd;
}

/* 头像图片：铺满容器，不变形，自动居中裁切 */
.profile-photo img{
  width:100%;
  height:100%;
  object-fit: cover;
  object-position: 50% 38%;   /* 竖版常见人脸偏上，稍微上移，按需调整为 50% 35% / 45% */
  display:block;
}

/* —— 形状类（通过切换类名改变外观） —— */
.photo--rect{        aspect-ratio: 4 / 3;  border-radius: 16px; }
.photo--tall{        aspect-ratio: 3 / 4;  border-radius: 16px; } /* ★ 竖版（证件照比例） */
.photo--circle{      aspect-ratio: 1 / 1;  border-radius: 999px; }
.photo--wide{        aspect-ratio: 16 / 9; border-radius: 14px; }

.headline{font-size:1.8rem; margin: 0 0 .2rem}
.role{color:var(--muted); margin:.2rem 0 .5rem}
.affil{opacity:.9}

/* Epigraph */
.epigraph{
  margin:.2rem 0 .9rem;
  color:#555; font-style:italic;
  border-left:3px solid var(--rule); padding-left:.75rem;
}
.q-zh{ margin-left:.35rem; color:#777; font-style:normal; }

.bio{margin-top:.2rem}
.cta-row{margin-top: 12px}
.btn{
  display:inline-flex; align-items:center; gap:.4rem;
  padding:.45rem .7rem; border-radius:10px; border:1px solid var(--rule);
  text-decoration:none; color:var(--ink); background: #f3f5fb;
  transition: all .2s ease;
  margin-right:.45rem; font-weight:600; font-size:.92rem;
}
.btn:hover{transform:translateY(-1px); border-color:#c8d5ff}
.btn.primary{background: var(--brand); color:#fff; border-color: transparent}
.btn.primary:hover{background: var(--brand-ink)}
.looking{margin-top:10px; font-weight:600}

/* ---------- Lists ---------- */
.bullets{padding-left: 1.1rem}
.bullets li{margin: .35rem 0}

/* ---------- Publications ---------- */
.note{color:#777; margin-top:-.2rem}
.pub-toolbar{
  display:flex; gap:.6rem; align-items:center; margin:.5rem 0 1rem;
  flex-wrap: wrap;
}
.pub-toolbar input, .pub-toolbar select{
  border:1px solid var(--rule); border-radius:10px; padding:.4rem .55rem; background:#f3f5fb;
}
.ccf-legend{ display:flex; align-items:center; gap:.5rem; margin:.2rem 0 1rem; }

.pub{margin: 14px 0 18px; padding-left: 12px; border-left: 3px solid var(--rule)}
.pub h3{font-size:1.05rem; margin:0 0 .25rem}
.pub .authors{color:var(--muted); margin:.1rem 0}
.pub .venue{font-weight:600; color:#444; margin:.1rem 0; display:flex; align-items:center; gap:.45rem}
.pub .links{margin-top:.3rem}
.tag{
  display:inline-block; padding:.18rem .5rem; border-radius:999px;
  background:#eef3ff; color:#2b47c6; text-decoration:none; font-size:.82rem; border:1px solid #dfe7ff;
}
.pub .mini-btn{
  border:1px solid var(--rule); background:#fff; padding:.15rem .5rem; border-radius:8px;
  font-size:.82rem; cursor:pointer; margin-left:.35rem;
}
.pub .mini-btn:hover{ background:#f6f8ff; border-color:#c8d5ff; }

/* ★ CCF badges */
.badge{
  display:inline-flex; align-items:center; gap:.35rem;
  height:1.35rem; padding:0 .55rem; border-radius:999px;
  font-size:.78rem; font-weight:800; letter-spacing:.02em;
  border: 1px solid transparent; user-select:none;
  line-height:1; position:relative;
}

/* A — gradient + glow */
.badge.ccf-a{
  color: var(--ccf-a-text);
  background: var(--ccf-a-grad);
  box-shadow: 0 0 0 0 var(--ccf-a-ring);
  background-size: 220% 220%;
  animation: ccfShimmer 5s linear infinite, ccfGlow 2.8s ease-in-out infinite;
}
.badge.ccf-a::before{
  content: "★";
  font-size:.75rem; opacity:.95; transform: translateY(-1px);
}
/* B / C — muted pills */
.badge.ccf-b{
  background: var(--ccf-b-bg); color: var(--ccf-b-ink); border-color: #cfe3ff;
  font-weight:700;
}
.badge.ccf-c{
  background: var(--ccf-c-bg); color: var(--ccf-c-ink); border-color: #d9deea;
  font-weight:700;
}

/* Animation — disabled if prefers-reduced-motion */
@keyframes ccfShimmer{
  0%{ background-position: 0% 50%; }
  100%{ background-position: 200% 50%; }
}
@keyframes ccfGlow{
  0%,100%{ box-shadow: 0 0 0 0 var(--ccf-a-ring); }
  50%{ box-shadow: 0 0 0 6px rgba(0,0,0,0), 0 0 22px 4px var(--ccf-a-ring); }
}
@media (prefers-reduced-motion: reduce){
  .badge.ccf-a{ animation: none; }
}

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

/* ---------- Timeline ---------- */
.timeline{list-style:none; padding:0; margin:0}
.timeline li{
  padding: .35rem 0; border-bottom: 1px dashed var(--rule);
}
.timeline li:last-child{border-bottom:none}
.timeline .date{
  display:inline-block; width: 6.5rem; font-weight:700; color:#445; opacity:.9;
}
.timeline .is-hidden{ display:none; }

/* ---------- Contact / Footer ---------- */
.footer{
  padding: 24px 28px 28px; text-align:center; color:var(--muted);
  border-top: 1px solid var(--rule);
}

/* ---------- Back to top ---------- */
.to-top{
  position: fixed; right: 18px; bottom: 18px; z-index: 20;
  width: 42px; height: 42px; border-radius: 12px; border:1px solid var(--rule);
  display:flex; align-items:center; justify-content:center;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
  opacity:0; pointer-events:none; transform: translateY(8px); transition: all .25s ease;
}
.to-top.show{ opacity:1; pointer-events:auto; transform:none; }
.to-top:hover{ color: var(--brand); }

/* ---------- Modal ---------- */
.modal{ position: fixed; inset:0; background: rgba(0,0,0,.4); display:none; align-items:center; justify-content:center; padding: 20px; }
.modal[aria-hidden="false"]{ display:flex; }
.modal__panel{
  width:min(860px, 92vw); max-height: 80vh; overflow:auto; background: var(--panel);
  border-radius: 14px; box-shadow: var(--shadow); border:1px solid var(--rule); position:relative;
}
.modal__close{
  position:absolute; top:8px; right:8px; background:transparent; border:none; font-size:1.2rem; color: var(--muted); cursor:pointer;
}
.modal__content{ margin: 18px; white-space: pre-wrap; }

/* ---------- Email copied feedback ---------- */
.btn.copied{ outline: 2px solid #6bd36b; }

/* ---------- Manual theme override (auto/light/dark) ---------- */
:root[data-theme="light"]{
  --bg:#f6f7fb; --panel:#fff; --ink:#222; --muted:#666; --brand:#0b63f6; --brand-ink:#0a3fb4; --rule:#e9ecf2; --shadow:0 8px 24px rgba(0,0,0,.06);
}
:root[data-theme="dark"]{
  --bg:#0e1116; --panel:#141922; --ink:#eef0f4; --muted:#a9b0bb; --brand:#6aa8ff; --brand-ink:#a6c6ff; --rule:#1f2632; --shadow:0 8px 24px rgba(0,0,0,.4);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px){
  .profile{ grid-template-columns: 1fr; }
  .profile-photo{ max-width: 360px; }
  .site-nav a{ margin-left:.7rem }
}




