/* ==========================================================
   Mingrui Xu — 学术主页骨架 × asurudo.top 视觉语言
   字体：Newsreader（标题）/ IBM Plex Sans（正文）/ 霞鹜文楷（中日文）
   ========================================================== */
:root{
  --accent:#39c5bb;
  --accent-dk:#2aa79e;
  --pink:#ff1688;          /* 呼吸动画 50% 处的峰值色 */
  --fg:#2f3338;
  --muted:#7a828a;
  --line:#e7e7e7;
  --ph:#f0f3f4;
  --phfg:#b6bfc2;
  --serif:"Newsreader","LXGW WenKai",Georgia,"Songti SC",serif;
  --sans:"IBM Plex Sans","LXGW WenKai",-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC",sans-serif;
}
*{box-sizing:border-box}
body{
  margin:0; color:var(--fg); background:#fff;
  font-family:var(--sans); font-size:15.5px; line-height:1.72;
  font-optical-sizing:auto;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
a{color:var(--accent-dk);text-decoration:none}
a:hover{color:var(--accent);text-decoration:underline}

/* 顶部呼吸条 —— 取自 asurudo.top */
#topbar{
  height:10px; background:var(--accent);
  animation:blink-rainbow-bg 20s linear infinite;
}
@keyframes blink-rainbow-bg{
    0%{background-color:#39c5bb}
   10%{background-color:#55d1d0}
   20%{background-color:#47c8c0}
   30%{background-color:#87e5cf}
   40%{background-color:#ff629d}
   50%{background-color:#ff1688}
   60%{background-color:#ff629d}
   70%{background-color:#87e5cf}
   80%{background-color:#47c8c0}
   90%{background-color:#55d1d0}
  100%{background-color:#39c5bb}
}
@media (prefers-reduced-motion:reduce){ #topbar{animation:none} }

.container{max-width:1040px;margin:0 auto;padding:0 22px}

/* ---------- Hero ---------- */
#hero{text-align:center;padding:52px 0 32px}
#hero h1{
  font-family:var(--serif);
  font-size:52px; font-weight:400; font-variation-settings:"opsz" 60;
  margin:0 0 20px; letter-spacing:-.015em; color:#22262b; line-height:1.15;
}
#hero .tagline{
  font-size:15px; color:var(--muted); margin:0 0 20px;
  letter-spacing:.01em;
}
#hero .rule{width:64px;height:3px;background:var(--accent);margin:0 auto;border-radius:2px}

/* ---------- 栅格 ---------- */
.row{display:flex;flex-wrap:wrap;gap:44px;padding-top:34px}
.sidebar{flex:1 1 0;min-width:0}
.maincontent{flex:1.618 1 0;min-width:0}   /* 侧栏 : 主栏 = 1 : φ */

/* ---------- 侧边栏 ---------- */
.sidebaritem{margin-bottom:28px}
.sidebaritem .sidebarheader{
  font-family:var(--serif); font-size:19px; font-weight:500;
  font-variation-settings:"opsz" 22;
  color:#22262b; margin-bottom:10px; padding-bottom:2px;
  border-bottom:2px solid var(--accent);
  line-height:1.2;
}
.sidebaritem div{font-size:14.5px;color:var(--muted)}
#headshot img{width:100%;border-radius:4px;display:block}
.photo-placeholder{
  width:100%;aspect-ratio:1/1.1;background:var(--ph);border-radius:4px;
  display:flex;align-items:center;justify-content:center;
  color:var(--phfg);font-size:13px;letter-spacing:1.5px;
}

/* ---------- 主体 ---------- */
.mainitem{margin-bottom:44px}
.mainheader{
  font-family:var(--serif); font-size:30px; font-weight:400;
  font-variation-settings:"opsz" 36;
  color:#22262b; margin-bottom:18px; padding-bottom:9px;
  border-bottom:1px solid var(--line); position:relative;
  letter-spacing:-.01em;
}
.mainheader::after{
  content:""; position:absolute; left:0; bottom:-1px;
  width:56px; height:3px; background:var(--accent);
}
.mainitem p{margin:0}

/* ---------- 论文 / 项目 ---------- */
.pub,.project{display:flex;gap:22px;margin-bottom:28px;align-items:flex-start}
.pubimagesection,.projimagesection{flex:0 0 180px}
.pubimagesection img,.projimagesection img{width:100%;border-radius:4px;display:block}
.thumb-placeholder{
  width:100%;aspect-ratio:16/10;background:var(--ph);border-radius:4px;
  display:flex;align-items:center;justify-content:center;
  color:var(--phfg);font-size:12px;
}
.pubtextsection,.projtextsection{flex:1;min-width:0}
.pubtitle,.projtitle{
  font-family:var(--serif); font-size:20px; font-weight:500;
  font-variation-settings:"opsz" 18;
  color:#22262b; margin-bottom:5px; line-height:1.35;
}
.pubauthors{font-size:14.5px;color:#4a5058}
.pubvenue{font-size:14.5px;color:var(--muted);font-style:italic}
.projintro{font-size:14.5px;color:#4a5058}
.tbd{color:#b5b5b5;font-style:italic}

/* ---------- 页脚 ---------- */
footer{
  margin-top:54px; border-top:4px solid var(--line);
  padding:28px 0 44px; text-align:center; font-size:14.5px; color:var(--muted);
}
footer .fheader{
  font-family:var(--serif); font-size:19px; font-weight:500;
  color:#22262b; margin-bottom:7px;
}
footer .copyright{margin-top:15px;font-size:13px;color:#9a9a9a}

/* ---------- 移动端 ---------- */
@media (max-width:800px){
  #hero{padding:36px 0 24px}
  #hero h1{font-size:38px;font-variation-settings:"opsz" 40}
  .mainheader{font-size:26px}
  .pubtitle,.projtitle{font-size:18px}
  /* 手机端退回普通文档流：column 方向的 flex-basis 指高度，容易算错 */
  .row{display:block;padding-top:26px}
  .sidebar,.maincontent{width:auto;flex:none}
  .sidebar{margin-bottom:30px}
  #headshot{max-width:200px;margin:0 auto 26px}
  .pub,.project{gap:14px}
  .pubimagesection,.projimagesection{flex:0 0 110px}
}


/* ---------- 语言切换：滑动呼吸胶囊 ---------- */
html[data-lang="zh"] [data-lang]:not([data-lang="zh"]),
html[data-lang="en"] [data-lang]:not([data-lang="en"]),
html[data-lang="ja"] [data-lang]:not([data-lang="ja"]){display:none !important}

body{position:relative}

#langswitch{
  position:fixed; bottom:26px; right:26px; z-index:50;
  display:flex; padding:3px;
  border:1px solid var(--line); border-radius:999px;
  background:rgba(255,255,255,.92); backdrop-filter:blur(8px);
  box-shadow:0 4px 16px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
  transition:box-shadow .25s, transform .25s;
}
#langswitch:hover{
  box-shadow:0 6px 22px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.06);
  transform:translateY(-1px);
}

/* 滑块：与顶部条共用同一套呼吸色 */
#langswitch .pill{
  position:absolute; top:0; left:0; width:0; height:0;
  border-radius:999px; background:var(--accent);
  animation:blink-rainbow-bg 20s linear infinite;
  pointer-events:none;
}
#langswitch.ready .pill{
  transition:transform .42s cubic-bezier(.34,1.5,.5,1),
             width .42s cubic-bezier(.34,1.5,.5,1);
}

#langswitch button{
  position:relative; z-index:1;
  width:36px; height:30px; padding:0; border:0; background:transparent;
  cursor:pointer; color:var(--muted);
  display:flex; align-items:center; justify-content:center;
  transition:color .28s;
}
#langswitch button .g{
  display:block; line-height:1;
  transition:transform .28s cubic-bezier(.34,1.5,.5,1);
}
/* 每种语言用自己的字形：拉丁走衬线，中日走文楷 */
#langswitch button[data-set="en"] .g{
  font-family:var(--serif); font-size:18px; font-weight:500;
  font-variation-settings:"opsz" 16;
}
#langswitch button[data-set="zh"] .g,
#langswitch button[data-set="ja"] .g{
  font-family:"LXGW WenKai",var(--sans); font-size:16px;
}
#langswitch button:hover{color:var(--fg)}
#langswitch button:hover .g{transform:translateY(-1px) scale(1.12)}
#langswitch button.on{color:#fff}
#langswitch button.on .g{transform:none}
#langswitch button:focus-visible{outline:2px solid var(--accent-dk);outline-offset:2px;border-radius:999px}

@media (prefers-reduced-motion:reduce){
  #langswitch .pill{animation:none}
  #langswitch.ready .pill{transition:none}
  #langswitch button .g{transition:none}
}

@media (max-width:800px){
  #langswitch{bottom:18px;right:18px}
  #langswitch button{width:32px;height:28px}
}

/* ---------- 姓名：中日字形与振り仮名 ---------- */
#hero h1 [data-lang="zh"],
#hero h1 [data-lang="ja"]{
  font-family:"LXGW WenKai",var(--serif);
  letter-spacing:.08em;
}
#hero h1 ruby{
  ruby-position:over;
  ruby-align:center;
}
#hero h1 rt{
  font-family:"LXGW WenKai",var(--sans);
  font-size:.24em; font-weight:400; line-height:1.4;
  letter-spacing:.14em; color:var(--muted);
  text-align:center;
}
/* ruby 的注音要占上方空间，给标题留出行高 */
html[data-lang="ja"] #hero h1{line-height:1.5;margin-top:-6px}

/* 日文姓名：姓与名之间留出间隔 */
#hero h1 ruby + ruby{margin-left:.34em}

/* ---------- 所属：三级字体分层 ----------
   身份     衬线 Newsreader   14px   粉      —— 与正文完全异质，最先被读到
   机构     无衬线 Plex 600   13.4px 深      —— 字重最重，块面最实
   部门     无衬线 Plex 400   12.2px 灰      —— 字号最小、字距略松，退为注解
   三级各差约 1px 字号 + 一档字重，靠"衬线 / 重 / 轻"三种质感区分，
   而不是只靠颜色 —— 灰度打印或色盲下层级依然成立                        */

.affil{margin-bottom:15px}
.affil:last-child{margin-bottom:0}

/* ① 身份 */
.affil .role{
  font-family:var(--serif); font-size:14px; font-weight:500; line-height:1.3;
  color:var(--pink); letter-spacing:.015em;
  margin-bottom:3px; padding-left:0; text-indent:0;
}

/* 共通：悬挂缩进 + 紧凑行距 */
.affil div:not(.role){
  font-family:var(--sans);
  line-height:1.22; margin-bottom:2px;
  padding-left:11px; text-indent:-11px;
}
.affil div:not(.role):last-child{margin-bottom:0}

/* ② 机构一级名称 */
.affil .role + div{
  font-size:13.4px; font-weight:600; color:var(--fg);
  letter-spacing:-.003em; margin-bottom:3px;
}

/* ③ 部门 / 下属单位 */
.affil .role + div ~ div{
  font-size:12.2px; font-weight:400; color:var(--muted);
  letter-spacing:.012em;
}

.affil a{font-size:inherit;font-weight:inherit}

/* ---------- 论文条目 ---------- */
.pubtitle a{color:inherit}
.pubtitle a:hover{color:var(--accent-dk);text-decoration:none}
.pubauthors .self{font-weight:600;color:var(--fg)}   /* 本人加粗，学术页惯例 */

/* ---------- 签名（头像位） ---------- */
#headshot img{
  width:100%; height:auto; display:block; border-radius:0;
  /* 原图是米色纸底(约 #f7f4e9)。brightness(1.12) 把三个通道都顶到 255 变纯白，
     墨迹(近黑)提亮后仍是近黑；再叠 multiply 兜住残余的灰白，彻底融进页面 */
  filter:brightness(1.12) contrast(1.06);
  mix-blend-mode:multiply;
}

/* 论文配图：保持 16:9，悬停微亮提示可点击 */
.pubimagesection img{height:auto;transition:filter .2s}
.pubimagesection a:hover img{filter:brightness(1.08)}

/* ---------- Links：单色图标 ---------- */
.iconlinks{display:flex;gap:16px;align-items:center;padding-top:2px}
.iconlinks a{color:#4a5058;display:inline-flex;line-height:0;transition:color .2s,transform .2s}
.iconlinks a:hover{color:#111;transform:translateY(-1px);text-decoration:none}
.iconlinks svg{width:22px;height:22px;display:block}

/* ---------- 日文论文：与英文标题对齐的字体 ----------
   标题：明朝体 Shippori Mincho，笔画对比与 Newsreader 接近
   作者：IBM Plex Sans JP，与英文作者行的 IBM Plex Sans 同一家族
   日文字形视觉上比拉丁字母大，字号略收；auto-phrase 让换行落在词组边界 */
.pubtitle:lang(ja){
  font-family:"Newsreader","Shippori Mincho",serif;
  font-size:18.5px; font-weight:500; letter-spacing:.02em; line-height:1.45;
  word-break:auto-phrase;
}
.pubauthors:lang(ja){font-family:"IBM Plex Sans","IBM Plex Sans JP",sans-serif}

/* ---------- About 结尾：座右铭（日文原文，不加标签不翻译） ---------- */
#about .motto{
  font-family:"Shippori Mincho","LXGW WenKai",serif; font-weight:500;
  font-size:15.5px; letter-spacing:.16em; color:#6b7279;
  margin-top:14px;
}
#about .motto span{color:var(--accent)}
/* 座右铭：各语言用各自合适的字体 */
#about .motto:lang(en){font-family:"Newsreader",serif;font-style:italic;font-size:16.5px;letter-spacing:.01em}
#about .motto:lang(zh){font-family:"LXGW WenKai",serif;letter-spacing:.12em}

/* ---------- 获奖 ---------- */
.awards{list-style:none;margin:0;padding:0}
.awards li{
  display:grid; grid-template-columns:64px 1fr auto; column-gap:16px;
  align-items:baseline; padding:6px 0; font-size:14.5px; line-height:1.45;
  border-bottom:1px solid #f1f1f1;
}
.awards li:last-child{border-bottom:0}
.awards .date{color:var(--muted);font-variant-numeric:tabular-nums}
.awards .contest{color:#3a3f45}
.awards .medal{font-weight:600;white-space:nowrap;font-size:13.5px}
.awards .gold{color:#b8901e}
.awards .silver{color:#8a9097}
.awards .bronze{color:#a8683a}
@media (max-width:800px){
  .awards li{grid-template-columns:58px 1fr;row-gap:2px}
  .awards .medal{grid-column:2}
}

/* ---------- 语言 ---------- */
.langitem{margin-bottom:10px}
.langitem:last-child{margin-bottom:0}
.sidebaritem .langitem .lname{font-size:13.4px;font-weight:600;color:var(--fg);line-height:1.3}
.sidebaritem .langitem .ldesc{font-size:12.2px;color:var(--muted);line-height:1.4;margin-top:1px}
.langitem .lcert{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.langitem .lcert span{
  font-size:11px; line-height:1; color:#5c636a; white-space:nowrap;
  border:1px solid #e1e4e6; border-radius:3px; padding:3px 6px; background:#fafbfb;
}

/* ---------- 整体放大 ----------
   宽屏上整页等比放大 15%，字号、间距、图片的相对比例全部保持不变。
   手机端字号本来就合适，不放大。 */
@media (min-width:900px){
  body{zoom:1.15}
}

/* ---------- 教育经历（与获奖同一套行式布局） ---------- */
.edu{list-style:none;margin:0;padding:0}
.edu li{
  display:grid; grid-template-columns:132px 1fr; column-gap:16px;
  align-items:baseline; padding:6px 0; font-size:14.5px; line-height:1.45;
  border-bottom:1px solid #f1f1f1;
}
.edu li:last-child{border-bottom:0}
.edu .date{color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.edu .what{color:#3a3f45}
.edu .sub{display:block;font-size:13px;color:var(--muted);margin-top:1px}
@media (max-width:800px){
  .edu li{grid-template-columns:1fr;row-gap:1px}
}
/* 日文等不靠空格断行的语言：以单位为整体换行，避免把「課程」拆成两行 */
.nw{white-space:nowrap}
/* 黄金比例下侧栏变宽，签名保持原来的尺寸，不随侧栏放大 */
#headshot img{max-width:250px}

/* ---------- 黄金比例下的尺寸适配（仅宽屏） ----------
   侧栏从 240px 变宽到约 390px，字号、图标、签名随之放大一档；
   主栏论文配图也相应放大。手机端保持原尺寸。 */
@media (min-width:801px){
  #headshot img{max-width:310px}

  .sidebaritem{margin-bottom:34px}
  .sidebaritem .sidebarheader{font-size:22px;font-variation-settings:"opsz" 24;margin-bottom:12px}

  .affil{margin-bottom:18px}
  .affil .role{font-size:16.5px;margin-bottom:4px}
  .affil div:not(.role){line-height:1.35;margin-bottom:3px}
  .affil .role + div{font-size:15px}
  .affil .role + div ~ div{font-size:13.8px}

  .langitem{margin-bottom:13px}
  .sidebaritem .langitem .lname{font-size:15px}
  .sidebaritem .langitem .ldesc{font-size:13.8px}
  .langitem .lcert{gap:5px;margin-top:5px}
  .langitem .lcert span{font-size:12px;padding:4px 7px}

  .iconlinks{gap:20px}
  .iconlinks svg{width:26px;height:26px}

  .pubimagesection,.projimagesection{flex:0 0 200px}
}

/* ---------- 两栏统一 ----------
   侧栏标题改用与主栏相同的样式：灰色细线 + 左端短青线（长度按字号比例 56 × 22/30 ≈ 41px）
   签名裁掉了上下留白，宽屏下铺满整栏，底部横线与栏的左右边缘对齐 */
.sidebaritem .sidebarheader{
  border-bottom:1px solid var(--line); position:relative; padding-bottom:4px;
}
.sidebaritem .sidebarheader::after{
  content:""; position:absolute; left:0; bottom:-1px;
  width:41px; height:3px; background:var(--accent);
}
#headshot img{height:auto}
@media (min-width:801px){
  #headshot img{max-width:none;width:100%}
}

/* ---------- 回收一档（宽屏） ----------
   签名不再铺满整栏，侧栏字号、图标各降一档 */
@media (min-width:801px){
  #headshot img{width:230px;max-width:100%}

  .sidebaritem{margin-bottom:30px}
  .sidebaritem .sidebarheader{font-size:20px;font-variation-settings:"opsz" 22;margin-bottom:11px}
  .sidebaritem .sidebarheader::after{width:37px}

  .affil{margin-bottom:16px}
  .affil .role{font-size:15px}
  .affil .role + div{font-size:14px}
  .affil .role + div ~ div{font-size:13px}

  .langitem{margin-bottom:11px}
  .sidebaritem .langitem .lname{font-size:14px}
  .sidebaritem .langitem .ldesc{font-size:13px}
  .langitem .lcert span{font-size:11.5px;padding:3px 7px}

  .iconlinks{gap:18px}
  .iconlinks svg{width:24px;height:24px}
}

/* 侧栏字号再加一点（宽屏） */
@media (min-width:801px){
  .sidebaritem .sidebarheader{font-size:21px}
  .sidebaritem .sidebarheader::after{width:39px}
  .affil .role{font-size:16px}
  .affil .role + div{font-size:15px}
  .affil .role + div ~ div{font-size:14px}
  .sidebaritem .langitem .lname{font-size:15px}
  .sidebaritem .langitem .ldesc{font-size:14px}
  .langitem .lcert span{font-size:12px}
}

/* 侧栏标题下的横线：只比最长一行内容（约 286px）略长，不再拉满整栏 */
@media (min-width:801px){
  .sidebaritem .sidebarheader{max-width:300px}
}

/* 栏目标题后的小字说明（如 Awards · Competitive Programming） */
.mainheader .hsub{
  font-family:var(--sans); font-size:15px; font-weight:400;
  color:var(--muted); letter-spacing:.02em; margin-left:12px;
}

/* 论文获奖标记：与 Awards 金奖同色 */
.pubaward{font-size:14px;font-weight:600;color:#b8901e;margin-top:2px;display:flex;align-items:center;gap:5px}
.pubaward::before{
  content:""; width:13px; height:13px; flex:none;
  background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0l2.35 4.76 5.25.77-3.8 3.7.9 5.23L8 11.99 3.3 14.46l.9-5.23-3.8-3.7 5.25-.77z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0l2.35 4.76 5.25.77-3.8 3.7.9 5.23L8 11.99 3.3 14.46l.9-5.23-3.8-3.7 5.25-.77z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ---------- 米色纸面 ----------
   背景从纯白换成偏暖的米白；原本按白底调的线条、占位、标签一起换成暖色调。
   签名用了 mix-blend-mode:multiply，纸底会自动融进米色背景。 */
:root{
  --bg:#f8f5ee;
  --line:#e6e0d4;
  --ph:#eee9de;
  --phfg:#b3aa9a;
}
body{background:var(--bg)}
#langswitch{background:rgba(248,245,238,.92);border-color:var(--line)}
#langswitch button + button{border-left-color:transparent}
#langswitch button:hover{background:rgba(57,197,187,.08)}
.awards li,.edu li{border-bottom-color:#ece6da}
.langitem .lcert span{background:#fbf9f4;border-color:#e2dbcd}
