/* =========================================================
   个人主页 · 主题样式（Win11 / Fluent 扁平风）
   设计原则：
     · 扁平 —— 白底 + 1px 极淡描边，几乎不用投影，不用渐变按钮
     · 圆角保留但收小 —— 卡片 10px / 控件 6px / 头像 12px
     · 层级靠"描边 + 淡填充"表达，不靠阴影和位移
     · 主色蓝 + 白；软件板块蓝青、硬件板块琥珀橙，滚动切换时整体过渡
   ========================================================= */

:root {
  /* 主色：蓝 */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  /* 辅色 */
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;
  --amber-100: #fef3c7;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;

  /* 中性色 */
  --ink:       #0f172a;
  --ink-soft:  #334155;
  --muted:     #64748b;
  --line:      #e5eaf1;          /* 描边：比之前的更淡 */
  --line-soft: rgba(15, 23, 42, .08);
  --white:     #ffffff;

  /* 当前板块强调色（JS 切换 html[data-accent]） */
  --accent:      var(--blue-600);
  --accent-2:    var(--cyan-500);
  --accent-soft: var(--blue-100);
  --accent-tint: var(--blue-50);

  /* 圆角：整体收小 */
  --radius:    10px;   /* 卡片 */
  --radius-sm: 6px;    /* 标签 / 按钮 / 图标块 */
  --radius-lg: 12px;   /* 头像 / 悬浮导航 */

  /* 投影：扁平化，只留极淡的一层 */
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-2: 0 4px 16px -8px rgba(15, 23, 42, .20);

  --ease: cubic-bezier(.65, .05, .36, 1);

  --side-w: 318px;

  /* 项目页左侧导航宽度（收起后只剩图标） */
  --pnav-w: 208px;
  --pnav-w-min: 54px;

  /* 顶部导航栏高度：翻页舞台要扣掉它，否则会被压在下面 */
  --topbar-h: 56px;
  /* 一屏可用的高度（舞台高度）：先给 100vh 兜底，支持 dvh 的浏览器下面再覆盖 */
  --stage-h: calc(100vh - var(--topbar-h));
}

/* 手机地址栏会伸缩，dvh 才是真正的可视高度 */
@supports (height: 100dvh) {
  :root { --stage-h: calc(100dvh - var(--topbar-h)); }
}

/* 硬件板块：强调色整体转橙 */
html[data-accent="amber"] {
  --accent:      var(--amber-500);
  --accent-2:    var(--amber-400);
  --accent-soft: var(--amber-100);
  --accent-tint: #fffbeb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  /* Win11 优先用 Segoe UI Variable，找不到再退回系统字体 */
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, "PingFang SC",
               "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #ffffff 0%, transparent 60%),
    linear-gradient(180deg, #f9fbff 0%, #eef4ff 45%, #f8fbff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景装饰 ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg__blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .4; }
.bg__blob--blue  { width: 520px; height: 520px; top: -160px; left: -120px; background: #bfdbfe; }
.bg__blob--cyan  { width: 420px; height: 420px; top: 34%; right: -140px;  background: #cffafe; }
.bg__blob--amber { width: 360px; height: 360px; bottom: -140px; left: 26%; background: #fde68a; opacity: .26; }
.bg__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 55% 25%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 55% 25%, #000 0%, transparent 72%);
}

/* ---------- 顶部导航栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  display: flex; align-items: center;
  background: rgba(255, 255, 255, .74);
  border-bottom: 1px solid rgba(15, 23, 42, .07);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}
.topbar__inner {
  width: 100%; max-width: 1560px; margin: 0 auto;
  padding: 0 clamp(12px, 2vw, 34px) 0 clamp(10px, 1.2vw, 22px);
  display: flex; align-items: center; gap: 10px;
}
.topbar__brand {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink);
  font-size: 14.5px; font-weight: 700; letter-spacing: -.2px;
  white-space: nowrap;
}
.topbar__logo {
  width: 27px; height: 27px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
}
.topbar__brand small {
  font-size: 11.5px; font-weight: 600; color: #94a3b8;
  letter-spacing: .2px;
}
.topbar__nav { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.topbar__link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  text-decoration: none; white-space: nowrap;
  transition: background .18s, color .18s;
}
.topbar__link:hover { background: rgba(15, 23, 42, .05); color: var(--ink); }
.topbar__link.is-active { background: var(--blue-50); color: var(--blue-700); }
.topbar__link:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; }

/* ---------- 普通内容页（比如 test.html，不走滚动翻页） ---------- */
.page-main {
  position: relative; z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding:
    calc(var(--topbar-h) + clamp(26px, 6vh, 62px))
    clamp(16px, 3vw, 32px)
    clamp(40px, 8vh, 80px);
  display: grid;
  gap: clamp(14px, 2.2vh, 22px);
}
.page-main__head { display: grid; gap: 5px; }
.page-main__title { margin: 0; font-size: clamp(24px, 3.6vh, 36px); letter-spacing: -.8px; line-height: 1.25; }
.page-main__desc { margin: 0; color: var(--muted); max-width: 62ch; }
.page-main__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 一格两列/三列的小网格（测试页演示用） */
.demo-grid { display: grid; gap: clamp(10px, 1.4vw, 14px); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.swatch { display: flex; align-items: center; gap: 10px; }
.swatch__dot { width: 26px; height: 26px; border-radius: 8px; flex: 0 0 26px; border: 1px solid rgba(15, 23, 42, .06); }

.debug-note {
  margin: 0; padding: 10px 13px;
  border-radius: var(--radius);
  font-size: 12.5px; line-height: 1.6;
  color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
}
.debug-note code {
  font-size: .94em; padding: 1px 4px; border-radius: 3px;
  background: rgba(146, 64, 14, .08);
}

/* 开关（实验室里的调试按钮） */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch__track {
  position: relative; flex: 0 0 40px; width: 40px; height: 22px;
  border-radius: 999px; background: #e2e8f0; border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}
.switch__dot {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
  transition: transform .2s var(--ease);
}
.switch input:checked + .switch__track { background: var(--blue-600); border-color: var(--blue-600); }
.switch input:checked + .switch__track .switch__dot { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--blue-300); outline-offset: 2px; }
.switch__label { font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.switch__label code { font-size: .92em; padding: 1px 4px; border-radius: 3px; background: var(--blue-50); color: var(--blue-700); }

/* ---------- 项目 / 产品页（projects.html） ---------- */
.pbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  display: inline-flex; align-items: center;
  padding: 5px 11px; border-radius: var(--radius-sm);
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--muted); background: var(--white);
  border: 1px solid var(--line); cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.filter:hover { color: var(--ink); border-color: var(--blue-200); }
.filter.is-active { color: var(--blue-700); background: var(--blue-50); border-color: var(--blue-100); }
.filter__n { margin-left: 6px; font-size: 11px; font-weight: 700; opacity: .6; }
.pbar__count { margin-left: auto; font-size: 12.5px; font-weight: 600; color: #94a3b8; }

.pgrid {
  display: grid; gap: clamp(12px, 1.6vw, 16px);
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  align-items: start;
}
.pcard {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--blue-100); }
.pcard[data-featured="1"] { grid-column: span 2; }
.pcard.is-off { display: none; }

.pcard__cover {
  position: relative; aspect-ratio: 16 / 9;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #eef4ff 0%, #e6f7fb 100%);
}
.pcard[data-featured="1"] .pcard__cover { aspect-ratio: 21 / 9; }
.pcard__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard__ph { font-size: 38px; line-height: 1; }
.pcard__phimg { max-width: 46%; max-height: 62%; object-fit: contain; border-radius: 7px; }
.pcard__status {
  position: absolute; top: 9px; left: 9px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .2px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(15, 23, 42, .06);
}
.pcard__status--wip      { color: var(--blue-700); }
.pcard__status--done     { color: #0f766e; }
.pcard__status--archived { color: var(--muted); }
.pcard__status--idea     { color: #b45309; }

.pcard__body { display: grid; gap: 6px; padding: 13px 14px 0; }
.pcard__title { margin: 0; font-size: 15.5px; letter-spacing: -.2px; line-height: 1.3; }
.pcard__sum  { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.pcard__desc { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.pcard__foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto; padding: 12px 14px 13px;
}
.pcard__year { font-size: 11.5px; font-weight: 600; color: #94a3b8; }
.pcard__links { margin-left: auto; display: flex; gap: 6px; }
.pcard__link {
  padding: 4px 9px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; text-decoration: none;
  color: var(--muted); background: var(--white); border: 1px solid var(--line);
  transition: background .16s, color .16s, border-color .16s;
}
.pcard__link:hover { color: var(--blue-700); background: var(--blue-50); border-color: var(--blue-100); }
.pcard__link--primary { color: #fff; background: var(--blue-600); border-color: transparent; }
.pcard__link--primary:hover { color: #fff; background: var(--blue-700); }

/* 双类名压过后面的 .chips / .chip */
.chips.chips--sm { gap: 4px; }
.chip.chip--sm { padding: 2px 7px; font-size: 11px; }

.pgrid__empty {
  margin: 0; padding: 28px 16px; text-align: center;
  color: #94a3b8; font-size: 13px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}

@media (max-width: 720px) {
  .pcard[data-featured="1"] { grid-column: auto; }
  .pcard[data-featured="1"] .pcard__cover { aspect-ratio: 16 / 9; }
  .pbar__count { margin-left: 0; }
}

/* 整张卡片可点：标题里的链接用 ::after 撑满，卡片内的按钮再抬到上面 */
.pcard { position: relative; }
.pcard__go { color: inherit; text-decoration: none; }
.pcard__go::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.pcard:hover .pcard__go { color: var(--blue-700); }
.pcard__links { position: relative; z-index: 2; }
.pcard__status { z-index: 2; }

/* ---------- 项目页外壳：左侧导航 + 右侧内容 ---------- */
.page-shell {
  position: relative; z-index: 1;
  max-width: 1280px; margin: 0 auto;
  padding:
    calc(var(--topbar-h) + clamp(22px, 5vh, 46px))
    clamp(16px, 3vw, 32px)
    clamp(40px, 8vh, 80px);
  display: grid;
  grid-template-columns: var(--pnav-w) minmax(0, 1fr);
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
  transition: grid-template-columns .22s var(--ease);
}
html.pnav-collapsed .page-shell { grid-template-columns: var(--pnav-w-min) minmax(0, 1fr); }
/* 放进外壳里的 .page-main 不再自己留边距 */
.page-shell > .page-main { padding: 0; margin: 0; max-width: none; }

/* ---------- 项目侧边栏 ---------- */
/* 左侧项目导航：给一层很淡的底，收起时缩成窄条 */
.pnav {
  position: sticky; top: calc(var(--topbar-h) + 20px);
  min-width: 0;
  padding: 10px 8px;
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(15, 23, 42, .05);
  border-radius: var(--radius);
}
.pnav__toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin-bottom: 8px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
  transition: border-color .16s, color .16s, background .16s;
}
.pnav__toggle:hover { border-color: var(--blue-200); color: var(--blue-700); background: var(--blue-50); }
.pnav__bars { display: block; width: 13px; height: 1.5px; background: currentColor;
  box-shadow: 0 -4px 0 currentColor, 0 4px 0 currentColor; }

.pnav__items { display: grid; gap: 2px; }
.pnav__group { display: grid; gap: 1px; }
.pnav__item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-decoration: none;
  transition: background .16s, color .16s;
}
.pnav__item:hover { background: rgba(15, 23, 42, .045); color: var(--ink); }
.pnav__item.is-active { background: var(--blue-50); color: var(--blue-700); }
.pnav__ico { flex: 0 0 auto; width: 20px; text-align: center; font-size: 14px; }
/* 图标也可以是一张图片（card.icon 写成 assets/xxx.png） */
.pnav__img {
  display: block; width: 17px; height: 17px; margin: 0 auto;
  object-fit: contain; border-radius: 4px;
}
.pnav__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pnav__toc {
  display: grid; gap: 1px;
  margin: 3px 0 7px 10px; padding-left: 9px;
  border-left: 1px solid var(--line);
}
.pnav__toc-item {
  padding: 4px 7px; border-radius: 5px;
  font-size: 12px; color: #94a3b8; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .16s, color .16s;
}
.pnav__toc-item:hover { background: var(--blue-50); color: var(--blue-700); }
.pnav__toc-item.is-active { background: var(--blue-50); color: var(--blue-700); font-weight: 600; }

/* 收起：只剩图标 */
html.pnav-collapsed .pnav__label,
html.pnav-collapsed .pnav__toc { display: none; }
html.pnav-collapsed .pnav__item { justify-content: center; padding: 8px 0; }

/* ---------- 详情页（project.html）---------- */
/* 详情正文：跟着列宽一起长（左栏收起后不会只往左平移、右边空一大块） */
.pd-main { display: grid; gap: clamp(16px, 3vh, 28px); min-width: 0; max-width: 1120px; }

.blk { display: grid; gap: 10px; min-width: 0; }
.blk__title { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.blk__warn {
  margin: 0; padding: 10px 13px; border-radius: var(--radius);
  font-size: 12.5px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
}
.lderr {
  margin: 0; padding: 14px 16px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.65; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca;
}
.pd-load { margin: 0; padding: 28px 0; font-size: 13px; color: #94a3b8; }

/* hero */
.phero {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 20px;
  align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.phero__title { margin: 4px 0 0; font-size: clamp(25px, 4vh, 36px); letter-spacing: -.9px; line-height: 1.2; }
.phero__sub { margin: 6px 0 0; font-size: 13.5px; line-height: 1.65; color: var(--muted); max-width: 56ch; }
.phero__meta { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 0; padding: 0; list-style: none; }
.phero__meta li { display: grid; gap: 1px; }
.phero__meta span { font-size: 10.5px; font-weight: 600; letter-spacing: .3px; color: #94a3b8; }
.phero__meta b { font-size: 13.5px; }
.phero__side {
  display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(135deg, #eef4ff, #e6f7fb);
}
.phero__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.phero__ph { font-size: 46px; }
.phero__phimg { max-width: 58%; max-height: 64%; object-fit: contain; border-radius: 9px; }
@media (max-width: 720px) {
  .phero { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .phero__side { order: -1; aspect-ratio: 16 / 9; }
}

/* 富文本 */
.prose { font-size: 14px; line-height: 1.78; color: var(--ink-soft); }
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--blue-700); }
.prose strong { color: var(--ink); }
.prose code {
  padding: 1px 5px; border-radius: 4px; font-size: .92em;
  color: var(--blue-700); background: var(--blue-50);
}

/* 列表 */
.plist { margin: 0; display: grid; gap: 5px; font-size: 13.5px; line-height: 1.65; color: var(--ink-soft); padding-left: 1.2em; }
.plist--bullet { list-style: disc; }
.plist--number { list-style: decimal; }
.plist--check { list-style: none; padding-left: 0; }
.plist--check li { position: relative; padding-left: 1.6em; }
.plist--check li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--blue-600); font-weight: 800;
}

/* 小卡片网格 */
.bcards { display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.bcard {
  padding: 12px 13px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.bcard__ico { font-size: 19px; line-height: 1; }
.bcard__title { margin: 5px 0 0; font-size: 13.5px; letter-spacing: -.1px; }
.bcard__desc { margin: 3px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
@media (max-width: 720px) { .bcards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }

/* 数字 */
.bstats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.bstat {
  padding: 12px 14px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.bstat b { display: block; font-size: 22px; letter-spacing: -.6px; line-height: 1.15; }
.bstat span { font-size: 11.5px; font-weight: 600; color: #94a3b8; }

/* 参数表 */
.specs {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.specs th, .specs td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--line); }
.specs tr:last-child th, .specs tr:last-child td { border-bottom: 0; }
.specs th { width: 32%; font-weight: 600; color: var(--muted); background: #fbfdff; }
.specs td { color: var(--ink-soft); }

/* 代码块 */
.codeblk { position: relative; border-radius: var(--radius); background: #0f172a; overflow: hidden; }
/* 顶部横条：文件名在左，语言标签在右（两个都可选） */
.codeblk__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  background: rgba(148, 163, 184, .07);
  border-bottom: 1px solid rgba(148, 163, 184, .16);
  font-size: 11px; font-weight: 700;
}
.codeblk__file {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .2px; color: #cbd5e1;
}
.codeblk__lang {
  flex: 0 0 auto;
  font-size: 10px; letter-spacing: .6px; text-transform: uppercase;
  color: #64748b;
}
.codeblk pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.codeblk code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px; line-height: 1.72; color: #e2e8f0; white-space: pre;
}

/* 图片 / 图集 */
.fig { margin: 0; display: grid; gap: 6px; }
.fig__img {
  width: 100%; display: block; border-radius: var(--radius);
  border: 1px solid var(--line); background: #f8fafc;
}
.fig__cap { font-size: 12px; color: #94a3b8; text-align: center; }
.gal { display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
@media (max-width: 620px) { .gal { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } }

/* 时间线 */
.ptl { margin: 0; padding: 0; list-style: none; display: grid; gap: 15px; }
.ptl__item {
  position: relative; padding-left: 16px;
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px;
}
.ptl__item::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-50);
}
.ptl__item::after {
  content: ""; position: absolute; left: 3px; top: 19px; bottom: -15px;
  width: 1px; background: var(--line);
}
.ptl__item:last-child::after { display: none; }
.ptl__time { padding-top: 2px; font-size: 12px; font-weight: 700; color: var(--blue-700); }
.ptl__title { margin: 0; font-size: 13.5px; }
.ptl__desc { margin: 3px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
@media (max-width: 620px) {
  .ptl__item { grid-template-columns: minmax(0, 1fr); gap: 1px; }
}

/* 引用 */
.bquote {
  margin: 0; padding: 12px 16px;
  border-left: 3px solid var(--blue-300); border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--blue-50);
}
.bquote p { margin: 0; font-size: 14px; line-height: 1.75; color: var(--ink-soft); }
.bquote cite { display: block; margin-top: 6px; font-size: 12px; font-style: normal; color: var(--muted); }

/* 视频 */
.bvideo {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: #0f172a;
}
.bvideo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bvideo--empty {
  display: grid; place-items: center;
  background: #f1f5f9; color: #94a3b8; font-size: 13px;
}

/* 分隔线 */
.bdiv { margin: 4px 0; border: 0; border-top: 1px solid var(--line); }

/* 窄屏：侧边栏变成顶部一条横向滚动条 */
@media (max-width: 900px) {
  .page-shell,
  html.pnav-collapsed .page-shell { grid-template-columns: minmax(0, 1fr); }
  .pnav {
    position: static; display: flex; align-items: center; gap: 8px;
    margin: 0 calc(-1 * clamp(16px, 3vw, 32px));
    padding: 0 clamp(16px, 3vw, 32px) 6px;
    background: transparent; border: 0; border-radius: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .pnav__toggle { display: none; }
  .pnav__items { display: flex; gap: 4px; }
  .pnav__group { display: flex; gap: 4px; }
  .pnav__item { white-space: nowrap; border: 1px solid var(--line); background: var(--white); }
  .pnav__item.is-active { border-color: var(--blue-100); }
  .pnav__toc { display: none !important; }
  html.pnav-collapsed .pnav__label { display: inline; }
  html.pnav-collapsed .pnav__item { padding: 7px 9px; }
}

/* ---------- 博客（blog.html / blog-post.html） ---------- */
.blog-shell {
  position: relative; z-index: 1;
  max-width: 1440px; margin: 0 auto;
  padding:
    calc(var(--topbar-h) + clamp(18px, 4.5vh, 38px))
    clamp(12px, 1.6vw, 26px)
    clamp(40px, 8vh, 80px);
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: clamp(13px, 1.6vw, 22px);
  align-items: start;
}

/* 左边：个人介绍（不占满高度，下面留白给以后的东西） */
/* 侧栏 = 一个卡片容器，里面装 blocks（profile / text / links / posts…） */
.bside {
  position: sticky; top: calc(var(--topbar-h) + 18px);
  display: grid; gap: 14px; min-width: 0;
  padding: 15px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.bside__card { display: grid; gap: 12px; padding: 15px 14px; }
.bside__head { display: flex; align-items: center; gap: 11px; }
.bside__id { min-width: 0; }
.bside__name { margin: 0; font-size: 16px; letter-spacing: -.3px; line-height: 1.25; }
.bside__title {
  margin: 2px 0 0; font-size: 11.5px; font-weight: 600; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bside__bio { margin: 0; font-size: 12.5px; line-height: 1.68; color: var(--muted); }
.bside__meta {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 5px; font-size: 12.5px; color: var(--muted);
}
.bside__meta .ico { margin-right: 6px; }
.bside__links { display: grid; gap: 3px; }

/* 头像的纯 CSS 版本（没有图片时显示字母） */
/* 双类名是有意的：修饰符要压过后面定义的基础类（.avatar 在 700 行附近），
   否则 width 来自这里、height 来自基础类，头像会变成竖长方形 */
.avatar.avatar--flat {
  width: 52px; height: 52px; flex: 0 0 52px;
  display: grid; place-items: center;
  border-radius: 6px;                       /* 方形一点 */
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
  color: #fff; font-size: 19px; font-weight: 800; letter-spacing: -.4px;
}
.avatar--flat .avatar__letter { line-height: 1; }

/* 右边：内容 */
.bmain { display: grid; gap: clamp(14px, 2.6vh, 24px); min-width: 0; max-width: 1000px; }
/* 文章页和列表页同一套宽度规则：不居中固定宽（那样左右都会留一大块空白） */
.bmain--post { max-width: 1000px; }
.ppost { display: grid; gap: clamp(14px, 2.6vh, 24px); min-width: 0; }

/* 介绍卡下面的附加块（由 _home.json 的 sidebar 生成），窄栏里压缩一下 */
.bside__extra { display: grid; gap: 10px; }
.bside__extra:empty { display: none; }
.bside__extra .blk { gap: 6px; }
.bside__extra .blk__title { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.bside__extra .posts { gap: 6px; }
.bside__extra .post { padding: 9px 10px; gap: 0; }
.bside__extra .post__thumb { display: none; }
.bside__extra .post__title { font-size: 12.5px; line-height: 1.45; }
.bside__extra .post__sum { display: none; }
.bside__extra .posts__count { display: none; }

/* 文章列表（posts 组件） */
.posts { display: grid; gap: 8px; }
.post {
  display: flex; gap: 13px; padding: 12px 13px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  text-decoration: none; color: inherit;
  transition: border-color .16s, background .16s, transform .16s, box-shadow .16s;
}
.post:hover {
  border-color: var(--blue-100); background: #fbfdff;
  transform: translateY(-1px); box-shadow: var(--shadow-2);
}
.post__thumb {
  width: 92px; height: 68px; flex: 0 0 92px;
  object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.post__body { display: grid; gap: 3px; min-width: 0; }
.post__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post__date { font-size: 11.5px; font-weight: 600; color: #94a3b8; font-variant-numeric: tabular-nums; }
.post__min { font-size: 11.5px; font-weight: 600; color: #b6c2d1; }
.post__label {
  padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--blue-700); background: var(--blue-50); border: 1px solid var(--blue-100);
}
.post__tags { display: flex; gap: 4px; }
.post__arrow { margin-left: auto; align-self: center; font-size: 13px; color: #cbd5e1; }
.post--ref { border-left: 3px solid var(--blue-300); padding-left: 13px; }
.post--ref:hover .post__arrow { color: var(--blue-600); }
.post__title { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; line-height: 1.4; }
.post:hover .post__title { color: var(--blue-700); }
.post__sum { font-size: 12.5px; line-height: 1.62; color: var(--muted); }
.posts__count { margin: 4px 0 0; font-size: 11.5px; color: #94a3b8; }
.posts__empty {
  margin: 0; padding: 24px 16px; text-align: center;
  font-size: 13px; color: #94a3b8;
  border: 1px dashed var(--line); border-radius: var(--radius);
}

/* 文章页头部 */
.postback {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.postback:hover { color: var(--blue-700); }
.posthead { display: grid; gap: 6px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.posthead__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.posthead__date { font-size: 11.5px; font-weight: 600; color: #94a3b8; font-variant-numeric: tabular-nums; }
.posthead__min { font-size: 11.5px; font-weight: 600; color: #b6c2d1; }
.posthead__dot { font-size: 11px; color: #cbd5e1; }
.posthead__tags { display: flex; gap: 4px; }
.posthead__title { margin: 0; font-size: clamp(21px, 3.4vh, 29px); letter-spacing: -.7px; line-height: 1.3; }
.posthead__sum { margin: 0; font-size: 13.5px; line-height: 1.68; color: var(--muted); }

/* 窄屏：单列，介绍卡在最上面（不吸顶） */
@media (max-width: 900px) {
  .blog-shell { grid-template-columns: minmax(0, 1fr); }
  .bside { position: static; }
  .bside__card { display: grid; grid-template-columns: 1fr; }
  .bmain, .bmain--post { max-width: none; }
}

/* 快捷键（Ctrl+Alt）临时冒出来的实验室入口 */
.labkey {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  right: 14px;
  z-index: 120;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  font-size: 12.5px; font-weight: 700; color: #fff;
  text-decoration: none; white-space: nowrap;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
  border-radius: 999px;
  box-shadow: 0 6px 18px -6px rgba(37, 99, 235, .55);
  opacity: 0; transform: translateY(-8px) scale(.96);
  pointer-events: none;
  transition: opacity .18s, transform .18s var(--ease);
}
.labkey.is-on { opacity: 1; transform: none; pointer-events: auto; }
.labkey:hover { filter: brightness(1.06); }
.labkey:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- 写文章的小工具（studio.html） ---------- */
.studio {
  position: relative; z-index: 1;
  max-width: 1760px; margin: 0 auto;
  padding: calc(var(--topbar-h) + 14px) clamp(10px, 1.4vw, 20px) 60px;
  display: grid; gap: 12px;
}
.studio__bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.studio__id { flex: 1 1 260px; min-width: 180px; }
.studio__spacer { flex: 1 1 auto; }

.studio__grid {
  display: grid;
  /* 左栏宽度用变量控制：收起时变窄，中间的编辑器自动吃掉剩下的地方 */
  grid-template-columns: var(--studio-leftw, 300px) 6px minmax(300px, 1.4fr) 6px var(--studio-rightw, 400px);
  gap: 12px;
  align-items: start;
}
.studio__grid.is-left-closed { --studio-leftw: 48px; }

/* 拖动分隔条 */
.studio__split {
  align-self: stretch;
  min-height: 240px;
  cursor: col-resize;
  border-radius: 3px;
  background: linear-gradient(180deg, transparent, rgba(148,163,184,.18), transparent);
  transition: background .15s;
  touch-action: none;
}
.studio__split:hover, .studio__split.is-drag { background: rgba(37,99,235,.22); }

/* 容器切换的小分段按钮 */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--slate-100, #f1f5f9); border-radius: 8px; }
.seg__btn {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.seg__btn.is-on { background: #fff; color: var(--blue-700, #1d4ed8); box-shadow: 0 1px 3px rgba(15,23,42,.12); }


.studio__left { display: grid; gap: 10px; min-width: 0; }
.studio__mid { display: grid; gap: 12px; min-width: 0; }
.studio__leftHead { display: flex; align-items: center; gap: 7px; }
.studio__leftTitle { font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: var(--muted); }

.studio__collapse {
  width: 22px; height: 22px; padding: 0; line-height: 1;
  font-size: 12px; color: var(--muted); cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: color .15s, border-color .15s, background .15s;
}
.studio__collapse:hover { color: var(--blue-700); border-color: var(--blue-200); background: var(--blue-50); }
.studio__collapse.is-closed { color: var(--blue-700); border-color: var(--blue-100); background: var(--blue-50); }

.studio__leftBody { display: grid; gap: 10px; }
.studio__rail { display: none; flex-direction: column; gap: 6px; }
.studio__railBtn {
  width: 32px; height: 32px; padding: 0; line-height: 1;
  font-size: 14px; color: var(--muted); cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: color .15s, border-color .15s, background .15s;
}
.studio__railBtn:hover { color: var(--blue-700); border-color: var(--blue-200); background: var(--blue-50); }

.studio__grid.is-left-closed .studio__leftBody,
.studio__grid.is-left-closed .studio__leftTitle { display: none; }
.studio__grid.is-left-closed .studio__rail { display: flex; }

/* 分区折叠 */
.studio__sec { padding: 0; overflow: hidden; }
.studio__secHead {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
  text-align: left; background: transparent; border: 0;
}
.studio__secHead:hover { background: rgba(15, 23, 42, .03); }
.studio__secTitle { flex: 1; }
.studio__chev { font-size: 10px; color: #94a3b8; transition: transform .18s var(--ease); }
.studio__sec.is-closed .studio__chev { transform: rotate(-90deg); }
.studio__secBody { display: grid; gap: 8px; padding: 0 12px 12px; }
.studio__sec.is-closed .studio__secBody { display: none; }
.studio__secBody .fld:last-child { margin-bottom: 0; }

/* 右栏：预览 */
.studio__right { position: sticky; top: calc(var(--topbar-h) + 14px); display: grid; gap: 8px; min-width: 0; }
.studio__pvBar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.studio__pvTitle { font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: var(--muted); }
.studio__pvBtns { display: flex; gap: 3px; }
.studio__pvBtn {
  padding: 3px 8px; font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: color .15s, border-color .15s, background .15s;
}
.studio__pvBtn:hover { color: var(--ink); border-color: var(--blue-200); }
.studio__pvBtn.is-on { color: var(--blue-700); background: var(--blue-50); border-color: var(--blue-100); }
.studio__pvSize { margin-left: auto; font-size: 11px; color: #94a3b8; font-variant-numeric: tabular-nums; }

.studio__frame {
  resize: both; overflow: auto;
  width: 100%; min-width: 300px; max-width: 100%;
  height: 68vh; min-height: 300px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.studio__iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.studio__pvHint { margin: 0; font-size: 11px; line-height: 1.6; color: #b6c2d1; }

/* 表单字段 */
.fld { display: grid; gap: 4px; margin-bottom: 10px; }
.fld:last-child { margin-bottom: 0; }
.fld__cap { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.fld input, .fld textarea, .fld select, .studio__id {
  width: 100%; padding: 7px 9px;
  font: inherit; font-size: 13px; line-height: 1.5;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.fld input:focus, .fld textarea:focus, .fld select:focus, .studio__id:focus {
  outline: none; border-color: var(--blue-300); box-shadow: 0 0 0 3px var(--blue-50);
}
.fld textarea { resize: vertical; }
.fld__json { font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.62; }
.fld__json.is-bad { border-color: #fca5a5; background: #fef2f2; }
.fld__tip { margin: 0 0 8px; font-size: 11.5px; line-height: 1.6; color: #94a3b8; }

/* 块列表 */
.studio__blocks { display: grid; gap: 2px; margin-bottom: 10px; }
.brow {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  font-size: 12.5px; color: var(--ink-soft);
}
.brow:hover { background: rgba(15, 23, 42, .04); }
.brow.is-sel { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-700); font-weight: 600; }
.brow__no { flex: 0 0 18px; text-align: right; font-size: 11px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.brow__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow__ops { display: flex; gap: 1px; opacity: 0; transition: opacity .15s; }
.brow:hover .brow__ops, .brow.is-sel .brow__ops { opacity: 1; }
.brow__op {
  width: 20px; height: 20px; padding: 0; line-height: 1;
  font-size: 11px; color: var(--muted);
  background: transparent; border: 0; border-radius: 4px; cursor: pointer;
}
.brow__op:hover { background: rgba(15, 23, 42, .08); color: var(--ink); }

.studio__add { display: flex; gap: 6px; }
.studio__add select {
  flex: 1; min-width: 0; padding: 6px 8px;
  font: inherit; font-size: 12.5px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.studio__json {
  margin: 8px 0 0; max-height: 320px; overflow: auto;
  padding: 12px 14px; border-radius: var(--radius);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px; line-height: 1.62;
  color: #e2e8f0; background: #0f172a;
}

@media (max-width: 1280px) {
  .studio__grid { grid-template-columns: var(--studio-leftw, 280px) minmax(0, 1fr); }
  .studio__split { display: none; }
  .studio__right { grid-column: 1 / -1; position: static; }
}
@media (max-width: 860px) {
  .studio__grid { grid-template-columns: minmax(0, 1fr); }
  .studio__left, .studio__mid, .studio__right { grid-column: auto; }
}

/* ---------- 布局（首页：左栏 + 右侧滚动舞台） ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  /* 顶部留出导航栏的位置：这样 deck 的起点正好是舞台吸顶的位置 */
  padding: var(--topbar-h) clamp(18px, 2vw, 34px) 0 clamp(6px, .8vw, 12px);
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: clamp(16px, 1.6vw, 26px);
  align-items: start;
}

/* 扁平卡片：白底 + 极淡描边 + 一层薄投影 */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

/* =========================================================
   左侧：贴边停靠的浅蓝渐变介绍栏
   ========================================================= */
.sidebar {
  position: sticky;
  /* 同样要避开导航栏 */
  top: calc(var(--topbar-h) + 14px);
  height: calc(var(--stage-h) - 28px);
  min-width: 0;
}
.sidebar::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; z-index: 2;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--blue-600), var(--cyan-400) 55%, var(--blue-200));
}

.profile {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding: 22px 18px 16px 20px;
  /* 浅蓝渐变（保留你上一版要的效果） */
  background:
    radial-gradient(120% 55% at 0% 0%, #dbeafe 0%, rgba(219, 234, 254, 0) 60%),
    linear-gradient(168deg, #eaf3ff 0%, #fbfdff 40%, #e7f3ff 100%);
  border: 1px solid #dbeafe;
  border-left: 0;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: var(--shadow-1);
  scrollbar-width: thin;
  scrollbar-color: #c3dcf9 transparent;
}
.profile::-webkit-scrollbar { width: 6px; }
.profile::-webkit-scrollbar-thumb { background: #c3dcf9; border-radius: 99px; }
.profile::-webkit-scrollbar-track { background: transparent; }

.profile__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.avatar {
  width: 82px; height: 82px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-1);
}
.avatar svg, .avatar__img {
  width: 100%; height: 100%; display: block;
  object-fit: cover;                 /* 换成真图后居中裁成正方形 */
  object-position: 50% 35%;          /* 人像一般脸偏上；想调裁切位置改这里 */
  background: var(--white);
}

.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; color: #047857;
  background: #ecfdf5; border: 1px solid #a7f3d0;
  white-space: nowrap;
}
.status__dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; }

.profile__name { margin: 16px 0 2px; font-size: 24px; line-height: 1.25; letter-spacing: -.4px; }
.profile__title {
  margin: 0; font-size: 13.5px; font-weight: 600;
  color: var(--accent);
  transition: color .5s var(--ease);
}
.profile__title .slash { color: var(--blue-300); margin: 0 2px; }

.profile__meta {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft);
}
.profile__meta .ico { margin-right: 6px; }

.profile__bio { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.profile__bio em {
  font-style: normal; font-weight: 700; color: var(--blue-700);
  background: rgba(37, 99, 235, .10);
  border-radius: 4px; padding: 0 3px;
}

.profile__foot {
  margin: auto 0 0; padding-top: 16px;
  font-size: 11.5px; color: #8fb0d4; text-align: center; line-height: 1.6;
}

.divider { height: 1px; margin: 16px 0 12px; background: var(--line); }

.side-heading {
  margin: 0 0 8px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: #7d9ec4;
}

/* ---------- 标签 / 徽章：小圆角矩形，更 Fluent ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }

.chip {
  display: inline-block;
  padding: 3px 9px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  color: var(--blue-700); background: var(--blue-50); border: 1px solid var(--blue-100);
  white-space: nowrap;
}
.chip--blue  { color: var(--blue-700); background: var(--blue-50); border-color: var(--blue-100); }
.chip--amber { color: #b45309; background: #fffbeb; border-color: #fde68a; }

/* ---------- 侧栏链接 ---------- */
.links { display: grid; gap: 4px; }

.link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-soft);
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  transition: background .18s, border-color .18s, color .18s;
}
.link:hover { background: var(--white); border-color: var(--blue-200); color: var(--blue-700); }
.link__ico {
  width: 24px; height: 24px; flex: 0 0 24px;
  display: grid; place-items: center; border-radius: var(--radius-sm);
  font-size: 10.5px; font-weight: 800;
  color: var(--blue-700); background: var(--blue-100);
}
.link__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link__arrow { color: var(--blue-300); font-size: 12px; }

/* =========================================================
   右侧：滚动跑道 + 钉住的舞台
   ========================================================= */
.main { min-width: 0; }

.deck {
  /* 跑道 = 页数 × 舞台高度；舞台高度已经扣掉了顶部导航栏 */
  height: calc(var(--pages, 4) * var(--stage-h));
  position: relative;
}

.stage {
  position: sticky;
  /* 吸在导航栏下面，不是吸在 0，否则会被栏压住 56px */
  top: var(--topbar-h);
  height: var(--stage-h);
  overflow: hidden;
  isolation: isolate;
}

/* 背景光晕：两块叠加，按当前板块交叉淡入 */
.glow {
  position: absolute; inset: -12%;
  pointer-events: none; opacity: 0; z-index: 0;
  transition: opacity .9s var(--ease);
}
.glow--blue {
  background:
    radial-gradient(46% 40% at 80% 16%, rgba(59, 130, 246, .22), transparent 70%),
    radial-gradient(40% 34% at 10% 88%, rgba(34, 211, 238, .18), transparent 70%);
}
.glow--amber {
  background:
    radial-gradient(46% 40% at 80% 16%, rgba(245, 158, 11, .20), transparent 70%),
    radial-gradient(40% 34% at 10% 88%, rgba(251, 191, 36, .16), transparent 70%);
}
html[data-accent="blue"]  .glow--blue  { opacity: 1; }
html[data-accent="amber"] .glow--amber { opacity: 1; }

/* 顶部进度线 */
.stage__progress {
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: rgba(15, 23, 42, .05); z-index: 7;
}
.stage__progress i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  transition: background .5s var(--ease);
}

/* ---------- 页面 ---------- */
.page {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  padding:
    clamp(52px, 8vh, 84px)
    clamp(64px, 6vw, 100px)
    clamp(46px, 7vh, 76px)
    clamp(20px, 3vw, 40px);
  will-change: transform, opacity, filter;
}
/* 兜底：JS 没跑起来时只显示第一页 */
.page:not(.is-active) { opacity: 0; }

/* ---------- 每页的边框：低调地暗示"这是一页" ---------- */
.page::before {
  content: "";
  position: absolute; inset: 12px;
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 14px;
  pointer-events: none;
  z-index: 0;
  transition: border-color .5s var(--ease);
}
/* 当前页的边框跟着板块色调微调一下 */
html[data-accent="blue"]  .page.is-active::before { border-color: rgba(37, 99, 235, .11); }
html[data-accent="amber"] .page.is-active::before { border-color: rgba(245, 158, 11, .16); }

/* ---------- 背景装饰层：在内容后面，被边框裁切 ---------- */
.deco {
  position: absolute; inset: 12px;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.deco > * { position: absolute; }
.deco svg, .deco img { display: block; }
.deco pre { margin: 0; white-space: pre; }

/* 通用小词标 */
.deco__tok {
  font: 700 12px/1 Consolas, "Courier New", monospace;
  color: var(--blue-600);
  letter-spacing: .5px; opacity: .18; white-space: nowrap;
}

/* ── 第 1 页 · 概览：软件 ↔ 硬件 ── */
#page-overview .deco__bridge { right: 54px; top: 50%; transform: translateY(-50%); width: min(21%, 220px); opacity: .34; }
#page-overview .deco__tok--1 { left: 50%; top: 12%; font-size: 28px; }
#page-overview .deco__tok--2 { left: 41%; top: 22%; }
#page-overview .deco__tok--3 { left: 2%;  bottom: 8%; }
#page-overview .deco__tok--4 { right: 27%; top: 16%; }
#page-overview .deco__tok--5 { left: 26%; bottom: 6%; font-size: 26px; }

/* ── 第 2 页 · 软件开发：C / C++ / C# 堆叠 + OpenGL + Tux + 二进制 / ELF ── */
/* 三个六边形按"下面两个、上面一个"堆起来：
   下面两个等宽并排 ⇒ 中心距 = 宽度（正六边形正好边贴边）；
   上面那个宽度略大、水平居中骑在接缝上，底边落在两个下面的"肩线"上 */
.hexstack {
  position: absolute; right: 40px; top: 46%; margin-top: -103px;
  width: 192px; height: 206px;
  opacity: .55;
  transform: scale(var(--hex-scale, 1));
  transform-origin: 50% 50%;
}
.hexstack__item { position: absolute; display: block; }
.hexstack__c   { left: 0;    bottom: 0;    width: 96px; }   /* 左下 */
.hexstack__cpp { left: 96px; bottom: 0;    width: 96px; }   /* 右下，与 C 贴边 */
.hexstack__cs  { left: 40px; bottom: 78px; width: 112px; }  /* 上面那个（更大） */

#page-software .deco__gl  { right: 54px; top: 7%; width: min(15%, 152px); opacity: .5; }
#page-software .deco__tux { right: 54px; bottom: 7%; width: min(12%, 120px); opacity: .5; }
#page-software .deco__bin {
  left: 2%; bottom: 2.5%; opacity: .16;
  font: 10.5px/1.85 Consolas, "Courier New", monospace;
  color: var(--blue-700); letter-spacing: .5px;
}
#page-software .deco__elf {
  right: 26%; bottom: 2.5%; opacity: .17; text-align: right;
  font: 10.5px/1.75 Consolas, "Courier New", monospace;
  color: var(--blue-700);
}

/* ── 第 3 页 · 硬件开发：PCB 走线 + 丝印层 + 我的板子 ── */
#page-hardware .deco__pcb { left: 0; top: 0; width: 100%; height: 100%; opacity: .4; }

/* 项目实物 / 走线图 */
.deco-shot {
  -webkit-mask-image: radial-gradient(ellipse 82% 82% at 50% 50%, #000 58%, transparent 100%);
          mask-image: radial-gradient(ellipse 82% 82% at 50% 50%, #000 58%, transparent 100%);
}
/* PCB 走线图：整张放大铺在右上角，当背景纹理用（那边最空，不挡正文） */
.deco__layout {
  right: -5%; top: -7%;
  width: 84%;
  opacity: .17;
  transform: rotate(-3deg);
  /* 淡出偏向"左下"，因为左下压着正文 */
  -webkit-mask-image: radial-gradient(ellipse 74% 74% at 66% 34%, #000 42%, transparent 100%);
          mask-image: radial-gradient(ellipse 74% 74% at 66% 34%, #000 42%, transparent 100%);
}
/* 焊接实物：抠不干净背景，所以紧裁 + 半透明斜摆在右下角 */
.deco__board { right: 6px; bottom: 0; width: min(27%, 290px); transform: rotate(7deg); opacity: .42; }

/* ── 第 4 页 · 经历：一路向上的里程碑折线 ── */
#page-journey .deco__path { right: 60px; top: 50%; transform: translateY(-50%); width: min(18%, 190px); opacity: .4; }
#page-journey .deco__tok--1 { left: 3%; top: 10%; }
#page-journey .deco__tok--2 { left: 3%; top: 17%; }
#page-journey .deco__tok--3 { left: 2%; bottom: 7%; }

.page__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  /* 收窄一点，给右侧装饰留出一条"走廊" */
  max-width: 840px;
  display: grid;
  align-content: center;
  gap: clamp(8px, 1.5vh, 16px);
  font-size: clamp(13px, 1.5vh, 15px);
}

.eyebrow {
  margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 2px;
  color: var(--accent); transition: color .5s var(--ease);
}
.eyebrow--amber { color: var(--amber-500); }

.page__title {
  margin: 0; font-size: clamp(26px, 4.2vh, 44px);
  line-height: 1.22; letter-spacing: -1px;
}
.page__lead { margin: 0; max-width: 62ch; color: var(--muted); font-size: clamp(13px, 1.6vh, 15px); }

.phead { display: grid; gap: 3px; }
.phead__title { margin: 0; font-size: clamp(21px, 3.2vh, 30px); letter-spacing: -.7px; line-height: 1.3; }
.phead__desc { margin: 0; color: var(--muted); font-size: clamp(12.5px, 1.5vh, 14px); }

/* 高亮：淡色块，不用荧光笔下划线（更扁平） */
.hl { padding: 1px 7px; border-radius: var(--radius-sm); }
.hl--blue  { color: var(--blue-700); background: rgba(37, 99, 235, .10); }
.hl--amber { color: #b45309;          background: rgba(245, 158, 11, .14); }

/* ---------- 数字卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(7px, 1vw, 12px); }
.stat { padding: clamp(10px, 1.6vh, 15px) clamp(12px, 1.3vw, 16px); display: flex; flex-direction: column; gap: 1px; }
.stat b {
  font-size: clamp(17px, 2.5vh, 23px); letter-spacing: -.5px;
  color: var(--accent); transition: color .5s var(--ease);
}
.stat span { font-size: clamp(11px, 1.35vh, 12px); color: var(--muted); }

/* ---------- 快捷跳转卡 ---------- */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(7px, 1vw, 12px); }
.quick__card {
  display: flex; align-items: center; gap: 10px;
  padding: clamp(9px, 1.5vh, 14px) clamp(11px, 1.3vw, 15px);
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color .18s, background .18s;
}
.quick__card:hover { border-color: var(--accent-soft); background: var(--accent-tint); }
.quick__card:focus-visible { outline: 2px solid var(--blue-400); outline-offset: 2px; }
.quick__ico {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: grid; place-items: center; border-radius: var(--radius-sm);
  font-size: 15px; background: var(--blue-50); border: 1px solid var(--blue-100);
}
.quick__ico--amber { background: #fffbeb; border-color: #fde68a; }
.quick__text { display: grid; gap: 0; min-width: 0; }
.quick__text b { font-size: clamp(12.5px, 1.55vh, 14px); }
.quick__text i { font-style: normal; font-size: clamp(10.5px, 1.35vh, 12px); color: var(--muted); }
.quick__arrow { margin-left: auto; color: var(--accent); font-weight: 700; font-size: 13px; }

/* ---------- 区块标题 / 卡片网格 ---------- */
.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 3px 0 -2px; font-size: clamp(13.5px, 1.75vh, 15.5px); letter-spacing: -.2px;
}
.dot {
  width: 7px; height: 7px; border-radius: 2px;   /* 小方点，扁平 */
  background: var(--accent);
  transition: background .5s var(--ease);
}

.mini-title { margin: 0 0 7px; font-size: clamp(12.5px, 1.55vh, 13.5px); letter-spacing: -.1px; }

.grid { display: grid; gap: clamp(7px, 1.1vh, 12px); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(204px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }

.pad { padding: clamp(11px, 1.7vh, 16px) clamp(13px, 1.5vw, 18px); }

.mini { padding: clamp(10px, 1.5vh, 15px); display: grid; gap: 6px; align-content: start; }
.mini h4 { margin: 0; font-size: clamp(12.5px, 1.55vh, 14.5px); }
.mini--amber { background: #fffdf7; border-color: #fdf0cd; }

/* ---------- 项目卡（横向紧凑版） ---------- */
.work {
  padding: clamp(10px, 1.6vh, 16px);
  display: grid; gap: 8px; align-content: start;
  transition: border-color .18s, background .18s;
}
.work--slim { grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; align-items: center; }
.work--slim h4 { margin: 0 0 1px; font-size: clamp(12.5px, 1.6vh, 14.5px); }
.work--slim p { margin: 0; font-size: clamp(11px, 1.38vh, 12.5px); color: var(--muted); line-height: 1.55; }
.work--slim .work__link { grid-column: 2; justify-self: start; }

.work:hover { border-color: var(--accent-soft); background: var(--accent-tint); }

.work__ico {
  width: clamp(32px, 4.2vh, 40px); height: clamp(32px, 4.2vh, 40px);
  border-radius: var(--radius-sm); display: grid; place-items: center;
  font-size: clamp(15px, 2vh, 18px);
  background: var(--accent-tint); border: 1px solid var(--accent-soft);
  transition: background .5s var(--ease), border-color .5s var(--ease);
}
.work__link {
  font-size: clamp(11px, 1.35vh, 12px); font-weight: 700;
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: color .5s var(--ease), border-color .18s;
}
.work__link:hover { border-color: var(--accent); }

/* ---------- 小列表（荣誉 / 记录） ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(4px, .8vh, 7px); }
.list li {
  display: flex; gap: 9px; align-items: baseline;
  font-size: clamp(11px, 1.4vh, 12.5px); color: var(--ink-soft);
}
.list__tag {
  flex: 0 0 auto; min-width: 40px;
  font-weight: 700; font-size: clamp(10.5px, 1.28vh, 11.5px);
  color: var(--accent); transition: color .5s var(--ease);
}

/* ---------- 两栏 ---------- */
/* 用 auto-fit：config.js 里关掉左边或右边任意一块后，剩下的会自动占满整行 */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(7px, 1.1vw, 12px);
  align-items: stretch;
}
.two-col > .grid { align-content: stretch; }
.two-col .work--slim { grid-template-columns: minmax(0, 1fr); }
.two-col .work__ico { display: none; }

/* ---------- 熟练度 ---------- */
.bars { padding: clamp(11px, 1.8vh, 16px) clamp(13px, 1.4vw, 18px); display: grid; gap: clamp(8px, 1.3vh, 13px); align-content: center; }
.bar__head { display: flex; justify-content: space-between; font-size: clamp(11px, 1.4vh, 12.5px); font-weight: 600; margin-bottom: 4px; }
.bar__head span:last-child { color: var(--muted); font-weight: 500; }
.bar__track { height: 6px; border-radius: 3px; background: #eef2f7; overflow: hidden; }
.bar__fill {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: var(--amber-500);
  transition: width 1s var(--ease);
}
.bars.is-inview .bar__fill { width: var(--v); }

/* ---------- 时间线 ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(6px, 1.1vh, 10px); }
.timeline li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: start; }
.timeline__time { font-size: clamp(11px, 1.4vh, 12.5px); font-weight: 700; color: var(--blue-600); padding-top: 12px; }
.timeline__body { padding: clamp(10px, 1.5vh, 14px) 14px; border-left: 3px solid var(--accent-soft); transition: border-color .5s var(--ease); }
.timeline__body h4 { margin: 0 0 2px; font-size: clamp(12.5px, 1.6vh, 14px); }
.timeline__body p { margin: 0; font-size: clamp(11px, 1.4vh, 12.5px); color: var(--muted); }

.scroll-note {
  margin: 2px 0 0; text-align: center;
  font-size: clamp(11px, 1.4vh, 12.5px); color: #8fb0d4;
}
.scroll-note__chev { display: inline-block; animation: bob 1.8s infinite; }

/* =========================================================
   右侧章节导航：半透明胶囊 + 带圆形边框的指示点
   ========================================================= */
.rail {
  position: absolute; right: clamp(4px, .9vw, 14px); top: 50%;
  transform: translateY(-50%);
  display: grid; gap: clamp(6px, 1vh, 11px);
  padding: 9px 8px;
  border-radius: var(--radius-lg);
  /* 半透明 + 轻微毛玻璃，像 Win11 的悬浮工具条 */
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(15, 23, 42, .07);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  z-index: 8;
}
.rail__item {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  background: none; border: 0; padding: 2px; cursor: pointer; font: inherit;
}
.rail__label {
  font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
  opacity: 0; transform: translateX(5px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), color .4s;
}
.rail__item:hover .rail__label,
.rail__item.is-active .rail__label { opacity: 1; transform: none; }
.rail__item.is-active .rail__label { color: var(--accent); }
.rail__item:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; border-radius: 6px; }

/* 指示点：圆形描边 + 半透明填充 */
.rail__dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: rgba(37, 99, 235, .07);
  border: 1.5px solid rgba(37, 99, 235, .30);
  transition: background .25s, border-color .25s, box-shadow .25s;
}
.rail__item:hover .rail__dot {
  background: rgba(37, 99, 235, .18);
  border-color: rgba(37, 99, 235, .55);
}
.rail__item.is-active .rail__dot {
  background: rgba(37, 99, 235, .85);
  border-color: rgba(37, 99, 235, .95);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .16);
}
/* 硬件板块换成橙色（box-shadow 不认变量颜色，所以分开写） */
html[data-accent="amber"] .rail__dot {
  background: rgba(245, 158, 11, .07);
  border-color: rgba(245, 158, 11, .32);
}
html[data-accent="amber"] .rail__item:hover .rail__dot {
  background: rgba(245, 158, 11, .18);
  border-color: rgba(245, 158, 11, .55);
}
html[data-accent="amber"] .rail__item.is-active .rail__dot {
  background: rgba(245, 158, 11, .85);
  border-color: rgba(245, 158, 11, .95);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .18);
}

/* ---------- 滚动提示 ---------- */
.hint {
  position: absolute; left: 50%; bottom: clamp(10px, 2vh, 22px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  font-size: 12px; color: var(--muted);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
  z-index: 8;
}
.hint.is-hidden { opacity: 0; transform: translate(-50%, 10px); }
.hint__chev { font-size: 15px; line-height: 1; animation: bob 1.8s infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(-2px); opacity: .45; }
  50%      { transform: translateY(3px);  opacity: 1; }
}

/* =========================================================
   落地页：滚过最后一屏才出现
   ========================================================= */
.landing {
  margin: clamp(18px, 4vh, 40px) 0 clamp(28px, 7vh, 64px);
  padding: clamp(42px, 8vh, 84px) clamp(22px, 4vw, 56px);
  text-align: center;
  display: grid; justify-items: center; gap: 11px;
  background:
    radial-gradient(80% 60% at 50% 0%, #eaf3ff 0%, rgba(234, 243, 255, 0) 70%),
    var(--white);
}
.landing__title { margin: 0; font-size: clamp(25px, 4.4vh, 40px); letter-spacing: -1px; }
.landing__desc { margin: 0; max-width: 46ch; color: var(--muted); }
.landing__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.landing__foot { margin: 16px 0 0; font-size: 12px; color: #94a3b8; }

/* 按钮：扁平实心 / 扁平描边，小圆角 */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; text-decoration: none;
  color: var(--ink-soft); background: var(--white);
  border: 1px solid rgba(15, 23, 42, .10);
  transition: background .18s, border-color .18s, color .18s;
}
.btn:hover { background: #f1f5fd; border-color: rgba(37, 99, 235, .35); color: var(--blue-700); }
.btn--primary { background: var(--blue-600); color: #fff; border-color: transparent; }
.btn--primary:hover { background: var(--blue-700); color: #fff; }

/* =========================================================
   普通流模式：窄屏 / 内容放不下 / 用户偏好减少动效时启用
   ========================================================= */
#deck.is-flow { height: auto; }
#deck.is-flow .stage {
  position: static; height: auto; overflow: visible;
  display: flex; flex-direction: column;
}
#deck.is-flow .glow,
#deck.is-flow .stage__progress { display: none; }
/* 普通流模式下页边框和背景装饰会挤到正文，直接收起 */
#deck.is-flow .page::before,
#deck.is-flow .deco { display: none; }
#deck.is-flow .page {
  position: static;
  padding: clamp(24px, 6vw, 52px) 0;
  opacity: 1 !important; transform: none !important;
  filter: none !important; visibility: visible !important; pointer-events: auto !important;
}
#deck.is-flow .page__inner { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
#deck.is-flow .page.in-view .page__inner { opacity: 1; transform: none; }
#deck.is-flow .hint { display: none; }

/* 导航条移到顶部横向排列 */
#deck.is-flow .rail {
  position: sticky; top: calc(var(--topbar-h) + 8px); left: auto; right: auto; transform: none;
  order: -1;
  display: flex; justify-content: center; align-items: center; gap: 2px;
  width: max-content; max-width: 100%; margin: 0 auto 6px;
  padding: 5px 6px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .82);
  z-index: 30;
}
#deck.is-flow .rail__label { opacity: 1; transform: none; font-size: 12.5px; }
#deck.is-flow .rail__item { padding: 6px 10px; border-radius: var(--radius-sm); transition: background .18s; }
#deck.is-flow .rail__item.is-active { background: var(--accent-tint); }
#deck.is-flow .rail__dot { width: 10px; height: 10px; border-width: 1.5px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1240px) {
  :root { --side-w: 286px; }
  .page__inner { max-width: 100%; }
}

@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: var(--topbar-h) clamp(12px, 3vw, 22px) 0; }
  .sidebar { position: static; height: auto; }
  .profile { height: auto; overflow: visible; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
  .profile__foot { margin-top: 18px; }
  .avatar { width: 72px; height: 72px; }
  /* 博客里那个小头像有 flex-basis，别被上面的 width/height 拉成竖条 */
  .avatar.avatar--flat { width: 52px; height: 52px; flex: 0 0 52px; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .two-col .work--slim { grid-template-columns: auto minmax(0, 1fr); }
  .two-col .work__ico { display: grid; }
}

@media (max-width: 860px) {
  /* 没有 JS 时的兜底 */
  .deck { height: auto; }
  .deck .stage { position: static; height: auto; overflow: visible; }
  .deck .page { position: static; padding: 24px 0; opacity: 1; transform: none; filter: none; visibility: visible; }
  .deck .page[aria-hidden="true"] { display: block; }
  .rail {
    position: sticky; top: calc(var(--topbar-h) + 8px); right: auto; transform: none;
    display: flex; justify-content: center; align-items: center; gap: 2px;
    width: max-content; max-width: 100%; margin: 0 auto 6px; padding: 5px 6px;
    border-radius: var(--radius); background: rgba(255, 255, 255, .82); z-index: 30;
  }
  .rail__label { opacity: 1; transform: none; font-size: 12.5px; }
  .rail__item { padding: 6px 10px; }
  .rail__dot { width: 10px; height: 10px; }
  .hint { display: none; }
  .deco, .page::before { display: none; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .timeline__time { padding-top: 0; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: minmax(0, 1fr); }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .page__title { letter-spacing: -.5px; }
  .landing__actions .btn { flex: 1; justify-content: center; }
}

/* 视口很矮时进一步压缩，保证一屏放得下 */
@media (max-height: 760px) and (min-width: 861px) {
  .page { padding-top: clamp(42px, 6.5vh, 60px); padding-bottom: clamp(36px, 5.5vh, 56px); }
  .page__inner { gap: 7px; }
  .grid, .stats, .quick, .two-col { gap: 7px; }
  .mini, .work, .pad, .bars { padding: 9px 11px; }
  .list { gap: 3px; }
  .timeline { gap: 5px; }
}

/* ---------- 无障碍：尊重"减少动态效果" ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =============================================================
   顶部加载进度条（列表页 fetch json 时显示）
   ============================================================= */
.ldbar {
  position: fixed; left: 0; right: 0; top: 0; height: 2px;
  z-index: 90; pointer-events: none;
  opacity: 0; transition: opacity .18s linear;
}
.ldbar.is-on { opacity: 1; }
.ldbar__fill {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--blue-500), #22d3ee);
  transition: transform .22s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .ldbar, .ldbar__fill { transition: none; }
}

/* =============================================================
   首屏加载遮罩
   内容由 JS 渲染的页面，在 JS 就绪前先把容器藏起来、显示「正在加载…」，
   避免用户看到兜底内容 → 变成真实内容的跳变。
   ============================================================= */
/* 注意：这里不能用 transition —— 会把 .page-shell 自己的
   transition: grid-template-columns 覆盖掉，导致侧栏折叠不再有动画。
   所以用 animation 做淡入。 */
@keyframes bootfade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes bootfadeout { from { opacity: 1; } to { opacity: 0; } }

/* 阶段 1：渲染中 —— 显示遮罩。
   注意：这里刻意不去隐藏内容（不设 opacity:0）——
   内容本来就被清空成空占位了，没有什么会"闪"的；
   而依赖 opacity 的时序在慢网络/慢脚本下并不可靠。
   遮罩是纯 CSS 就能显示出来的，所以第一帧一定看得见。 */
body[data-booting] .boot-hide { /* 保留类名，便于以后想遮的时候再用 */ }

/* 阶段 2：渲染完成 —— 内容淡入，遮罩淡出（遮罩在 data-booting 移除时才真正消失） */
body.boot-done .boot-hide { opacity: 1; animation: bootfade .28s ease-out; }
body.boot-done .bootmask  { animation: bootfadeout .3s ease-out forwards; }

.bootmask { display: none; }
/* 遮罩期间，内容区自带的「正在加载」占位不用再显示（避免两处文字） */
body[data-booting] .pd-load { display: none; }

body[data-booting] .bootmask {
  display: flex;
  /* 和 body 一样的背景：遮罩要真的盖住下面的空骨架，而不是只浮一个文字 */
  background:
    radial-gradient(1200px 600px at 10% -10%, #ffffff 0%, transparent 60%),
    linear-gradient(180deg, #f9fbff 0%, #eef4ff 45%, #f8fbff 100%);
  position: fixed; left: 0; right: 0; top: var(--topbar-h); bottom: 0;
  align-items: center; justify-content: center; gap: 12px;
  z-index: 40; pointer-events: none;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.bootmask__spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--blue-500);
  animation: bootspin .7s linear infinite;
}
@keyframes bootspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  body.boot-done .boot-hide, body.boot-done .bootmask { animation: none; }
  .bootmask__spin { animation: none; }
}

/* 关掉 JS 时的提示 */
.noscript {
  position: fixed; left: 50%; top: calc(var(--topbar-h) + 18px);
  transform: translateX(-50%); z-index: 60;
  margin: 0; padding: 10px 16px; border-radius: var(--radius-sm);
  background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
  font-size: 12.5px; font-weight: 600;
}
/* =============================================================
   首页加载提示
   内容没渲染好时（html.home-booting）右侧只显示这一块，
   左侧和滚动舞台都藏着 —— main.js 初始化完后移除提示、显示内容。
   ============================================================= */
.home-load {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: calc(100vh - var(--topbar-h));
  text-align: center; color: var(--muted);
}
.home-load__spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--blue-500);
  animation: bootspin .7s linear infinite;
}
.home-load__text { margin: 0; font-size: 13px; font-weight: 600; }
.home-load__note { margin: 0; font-size: 12px; line-height: 1.8; }

/* 内容还没好：左侧栏和滚动舞台先不显示（占位保持布局） */
html.home-booting .sidebar,
html.home-booting .deck { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .home-load__spin { animation: none; }
}

/* =============================================================
   首页（关于页）：正文居中，Label 字号加大
   ============================================================= */
.bmain--home .prose { text-align: center; }
.bmain--home .blk__title { text-align: center; font-size: 1.55rem; letter-spacing: .5px; }
.bmain--home .page-main__actions { justify-content: center; }

/* 单栏页面（实验室）：不要左侧项目导航那一列 */
.page-shell--single { grid-template-columns: minmax(0, 1fr); }

/* 侧栏没内容时整列收起（文章可以配 sidebar: [] 表示不要侧栏） */
.bside:empty { display: none; }
.blog-shell:has(> .bside:empty) { grid-template-columns: minmax(0, 1fr); }
