/* baolong.natcapchina.com — 仿原站 WordPress 块主题 + Elementor 视觉
 * 左列 35% 满屏 duotone 封面图（sticky），右列 65% 长内容（顶部姓名/邮箱/导航）
 */

:root {
  --primary: #163a8f;      /* 深蓝，呼应 duotone */
  --primary-soft: #eaeefb;
  --ink: #23262b;
  --muted: #6b7280;
  --line: #e6e8ec;
  --bg: #ffffff;
  --sidebar-w: 35%;
  --content-w: 65%;
  --cover: url("../img/portrait.jpg");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* 英文模式：改用 Inter 拉丁字体，排版更干净（颜色/字号覆盖见文件末尾） */
body.lang-en {
  font-family: "Inter", "Manrope", -apple-system, "Segoe UI", Arial, sans-serif;
  letter-spacing: .1px;
}

.duotone-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ===== 双列布局：左 65% 内容 + 右 35% 固定封面图 ===== */
.layout { display: flex; align-items: flex-start; min-height: 100vh; }

.content {
  flex: 0 0 65%;
  max-width: 65%;
  padding: 0 4.2rem 3rem;   /* 顶部间距放进 topbar 内部，保证吸顶零位移 */
  min-width: 0;
}

.sidebar {
  position: fixed;             /* 固定在右侧，不随页面滚动 */
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  overflow: hidden;
}
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: url(#wp-duotone-duotone-default);
}
.cover-dim {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 42, 0.55);   /* 原站 has-background-dim-60 */
  pointer-events: none;
}

/* ===== 顶部信息栏（固定，不随滚动） ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding-top: 2.6rem;          /* 原 .content 顶部间距，含在 topbar 内 → 吸顶零位移 */
  padding-bottom: 1.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.name {
  margin: 0;
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: .3px;
  color: #12162b;
  line-height: 1.15;
}
.name .en {
  font-weight: 500;
  color: var(--muted);
  font-size: 1.5rem;
  margin-left: .35rem;
}
.email {
  margin: .35rem 0 .9rem;
  color: var(--muted);
  font-size: .95rem;
}
.email .zh, .email .en { color: var(--muted); }

/* 导航（原站 my-header：简介/经历/项目/著作/其他/浏览） */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem 1.2rem;
  margin-top: .3rem;
}
.nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;   /* 防止条目内部中英文断开 */
  transition: color .15s, border-color .15s;
}
.nav a .en { font-weight: 400; color: var(--muted); font-size: .82em; margin-left: 2px; }
.nav a:hover { color: var(--primary); }
.nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== 加载提示 ===== */
.loading {
  padding: 2rem 0;
  color: var(--muted);
  font-size: .95rem;
}
.loading.hidden { display: none; }

/* ===== 各 section ===== */
/* 锚点滚动留白：动态取吸顶栏实际高度（--topbar-h 由 JS 写入），不同语言模式都贴合 */
section { scroll-margin-top: calc(var(--topbar-h, 180px) + 10px); margin-bottom: 2.2rem; }
.sec-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  margin: 2.4rem 0 .9rem;
  padding-left: .7rem;
  border-left: 4px solid var(--primary);
  line-height: 1.3;
}
.sec-title .en { font-weight: 400; color: var(--muted); font-size: .7em; margin-left: .4rem; }
.sub-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: #2b3550;
  margin: 1.4rem 0 .6rem;
}
.sub-title .en { font-weight: 400; color: var(--muted); font-size: .82em; margin-left: .35rem; }

.prose p { margin: .4rem 0 1rem; }
.prose .en, .r-card .en, .tl-body .en, .cite .en, .card .en, .post .en { color: var(--muted); }

/* 研究方向卡片网格 */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: .8rem;
}
.r-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  background: #fbfcfe;
  text-align: center;          /* 图与文字在卡内居中 */
}
/* 三张图统一尺寸：正方形框 + contain，等大居中不裁切 */
.r-card img {
  width: 70%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  margin: 0 auto .7rem;
  display: block;
}
.r-card h3 { margin: .2rem 0 .3rem; font-size: 1.02rem; }
.r-card .en { font-size: .88rem; }
.r-card p { margin: .2rem 0; font-size: .92rem; }

/* 角色 / 列表 */
.roles, .card-list { margin: .3rem 0 1rem; padding-left: 1.1rem; }
.roles li { margin: .25rem 0; }

/* 时间线（经历 / 项目） */
.timeline { margin: .3rem 0 1rem; }
.tl-item {
  display: flex;
  gap: 1.1rem;
  padding: .5rem 0;
  border-bottom: 1px dashed var(--line);
}
.tl-time {
  flex: 0 0 150px;
  color: var(--primary);
  font-weight: 600;
  font-size: .92rem;
  padding-top: .1rem;
}
.tl-time .en { color: var(--muted); font-weight: 400; }
.tl-body { flex: 1; min-width: 0; }
.tl-org { font-weight: 700; }
.tl-title { color: #333; margin-top: .15rem; }
.tl-body a { color: var(--primary); font-size: .88rem; margin-left: .3rem; }

/* 著作引用 */
.cite {
  padding: .5rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: .95rem;
}
.cite .year { color: var(--primary); font-weight: 700; margin-right: .5rem; }
.cite a { color: var(--primary); margin-left: .3rem; font-size: .88rem; }

/* 其他 / 卡片 */
.card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: .9rem 1.1rem;
  margin: .6rem 0;
  background: #fbfcfe;
}
.card h3 { margin: .1rem 0 .3rem; }
.card p { margin: .15rem 0; font-size: .92rem; }
.card a { color: var(--primary); font-size: .88rem; }

/* 浏览 / 动态 */
.post {
  padding: .7rem 0;
  border-bottom: 1px dashed var(--line);
}
.post .date { color: var(--muted); font-size: .85rem; }
.post h3 { margin: .2rem 0 .3rem; font-size: 1.05rem; }
.post .body { font-size: .95rem; }
.post a { color: var(--primary); font-size: .88rem; }

/* 页脚 */
.site-footer {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
}

/* ===== 语言切换（右上角浮动） ===== */
.lang-switch {
  position: absolute;            /* 锚定在吸顶栏内（顶栏 sticky，滚动时仍可见） */
  top: 14px;
  right: 16px;
  z-index: 30;
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.lang-switch button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .82rem;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}
.lang-switch button.active { background: var(--primary); color: #fff; }

/* ===== 双语显隐 ===== */
.lang-zh .en { display: none; }
.lang-en .zh { display: none; }
/* 双语模式：正文英文（en-sub）另起一行；标题类 .en 保持同行 */
.lang-both .en-sub { display: block; margin-top: 2px; }

/* ===== 响应式：窄屏改为上下布局（封面图回到顶部） ===== */
/* ===== 中等屏幕适配：收窄边距、缩小导航，避免导航折行 ===== */
@media (min-width: 861px) and (max-width: 1450px) {
  .content { padding: 0 2.6rem 3rem; }
  .name { font-size: 2rem; }
  .nav { gap: .7rem 1rem; }
  .nav a { font-size: .95rem; }
}
@media (min-width: 861px) and (max-width: 1150px) {
  .content { padding: 0 1.6rem 3rem; }
  .name { font-size: 1.8rem; }
  .nav { gap: .6rem .85rem; }
  .nav a { font-size: .9rem; }
}

@media (max-width: 860px) {
  .layout { flex-direction: column-reverse; }
  .sidebar {
    position: relative;
    width: 100%;
    height: 46vh;
  }
  .content { max-width: 100%; flex-basis: auto; padding: 0 1.3rem 2.5rem; }
  .topbar { padding-top: 1.2rem; }
  .name { font-size: 1.9rem; }
  /* 手机端语言切换并入顶栏排版：导航下方居中，不再悬浮在屏幕边缘 */
  .lang-switch {
    position: static;
    width: max-content;
    margin: .7rem 0 0;
  }
}

/* ===== 英文模式覆盖（置于文件末尾，确保优先生效） ===== */
/* 文字整体加深 */
body.lang-en .en,
body.lang-en .email { color: #343b47; }
body.lang-en .name .en { color: #1f2530; }

/* 导航英文：加大、加深 */
body.lang-en .nav a .en {
  font-size: 1em;          /* 原 .82em */
  font-weight: 500;
  color: #23262b;
}
/* 栏目标题英文：加大、加深 */
body.lang-en .sec-title .en {
  font-size: .88em;        /* 原 .7em */
  color: #2b3550;
}
/* 子标题英文：加大、加深 */
body.lang-en .sub-title .en {
  font-size: 1em;          /* 原 .82em */
  color: #2b3550;
}

/* 加载提示中英间距 */
.loading .en { margin-left: .35rem; }

/* 英文模式：中文隐藏后，双语用的 margin 间距必须清零，否则首字母被顶出、与下行不对齐 */
body.lang-en .name .en,
body.lang-en .loading .en,
body.lang-en .nav a .en { margin-left: 0; }

/* 手机端返回顶部按钮（默认隐藏，仅在窄屏显示，且下滑后才出现） */
#toTop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  display: none;                 /* 桌面端不显示 */
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .28);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
}
#toTop.show { opacity: 1; transform: translateY(0); }
@media (max-width: 860px) {
  #toTop { display: flex; }       /* 手机端才显示 */
}
