/* ═══════════════════════════════════════════════════════════
   钱文杰 · 产品经理 —— 设计系统
   概念：「信号台」—— 站点呈现为一台实时检索控制台，
   背景知识图谱会随真实检索结果亮起。
   ═══════════════════════════════════════════════════════════ */

:root{
  /* 底层 */
  --bg:        #08090B;
  --bg-soft:   #0C0E12;
  --surface:   #12151A;
  --surface-2: #171B22;
  --surface-3: #1D222A;

  /* 描边 */
  --line:      rgba(255,255,255,.065);
  --line-2:    rgba(255,255,255,.12);
  --line-3:    rgba(255,255,255,.2);

  /* 文字（对比度均已实测 ≥5:1，满足 WCAG AA） */
  --text:      #E9EAEC;   /* ~15:1 */
  --text-dim:  #9AA2AE;   /* ~7.7:1 */
  --text-mute: #7F8794;   /* ~5.4:1（原 #6A727E 仅 4.1:1，不达标） */

  /* 强调：信号琥珀（检索/激活） */
  --amber:     #FFA028;
  --amber-hi:  #FFC46B;
  --amber-lo:  rgba(255,160,40,.14);
  --amber-line:rgba(255,160,40,.34);

  /* 语义 */
  --ok:        #4ADE9B;
  --warn:      #FF6B4A;

  /* 字体 */
  --f-display: "Bricolage Grotesque", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --f-body:    -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --f-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* 节奏 */
  --r-sm: 8px;  --r-md: 14px; --r-lg: 20px; --r-full: 999px;
  --gap:  clamp(16px, 2.2vw, 28px);
  --pad-x: clamp(20px, 4vw, 64px);

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(0,0,0,.5);
  --sh-2: 0 8px 30px rgba(0,0,0,.5);
  --sh-3: 0 24px 70px rgba(0,0,0,.62);
  --glow: 0 0 0 1px var(--amber-line), 0 0 34px rgba(255,160,40,.16);

  --ease: cubic-bezier(.22,.61,.36,1);
}

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

/* ⚠️ 必须显式声明：UA 样式表里 [hidden] 的 display:none 优先级极低，
   任何作者样式的 display（如 .layout{display:grid}）都会覆盖它，
   导致 hidden 的元素照常渲染。这里用 !important 兜住。 */
[hidden]{ display:none !important }

html{ -webkit-text-size-adjust:100%; scroll-behavior:smooth }

body{
  margin:0;
  min-height:100dvh;
  background:var(--bg);
  color:var(--text);
  font-family:var(--f-body);
  font-size:15px;
  line-height:1.72;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  overflow-x:hidden;
}

::selection{ background:rgba(255,160,40,.28); color:#fff }

a{ color:inherit; text-decoration:none }

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

/* ═══ 背景层 ═══ */
#bg{
  position:fixed; inset:0;
  width:100%; height:100%;
  z-index:0;
  display:block;
}
.grain{
  position:fixed; inset:0; z-index:1; pointer-events:none; opacity:.4;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  mix-blend-mode:overlay;
}
.vignette{
  position:fixed; inset:0; z-index:1; pointer-events:none;
  background:
    radial-gradient(120% 78% at 22% 8%, rgba(255,160,40,.055), transparent 58%),
    radial-gradient(100% 70% at 88% 92%, rgba(80,140,255,.05), transparent 60%),
    radial-gradient(150% 100% at 50% 50%, transparent 42%, rgba(0,0,0,.72) 100%);
}

/* ═══ 顶栏 ═══ */
.topbar{
  position:fixed; top:0; left:0; right:0; z-index:40;
  display:flex; align-items:center; justify-content:space-between;
  gap:16px;
  padding:14px var(--pad-x);
  background:linear-gradient(180deg, rgba(8,9,11,.9), rgba(8,9,11,.5) 62%, transparent);
  backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);
}
.brand{ display:flex; align-items:center; gap:10px; min-width:0 }
.brand-mark{
  width:30px; height:30px; flex:none;
  display:grid; place-items:center;
  border:1px solid var(--amber-line);
  border-radius:9px;
  color:var(--amber);
  background:var(--amber-lo);
}
.brand-mark svg{ width:17px; height:17px }
.brand-text{
  font-family:var(--f-display);
  font-weight:600; font-size:15px; letter-spacing:.01em;
  white-space:nowrap;
}
.brand-text i{ font-style:normal; color:var(--text-mute); font-family:var(--f-mono); font-size:11px; letter-spacing:.06em }

.topbar-right{ display:flex; align-items:center; gap:12px }

.status{
  display:inline-flex; align-items:center; gap:7px;
  font-family:var(--f-mono); font-size:11px; letter-spacing:.05em;
  color:var(--text-mute);
  text-transform:uppercase;
}
.dot{
  width:6px; height:6px; border-radius:50%;
  background:var(--text-mute); flex:none;
  transition:background .3s, box-shadow .3s;
}
.status.on .dot{ background:var(--ok); box-shadow:0 0 8px rgba(74,222,155,.8) }
.status.off .dot{ background:var(--warn); box-shadow:0 0 8px rgba(255,107,74,.8) }

.btn-ask{
  /* 默认（移动端）显示；桌面端隐藏 —— 桌面右栏已有常驻对话面板，无需入口按钮 */
  display:inline-flex; align-items:center; gap:7px;
  font:inherit; font-size:13px; font-weight:600;
  color:#0A0B0D; background:var(--amber);
  border:0; border-radius:var(--r-full);
  padding:8px 16px; cursor:pointer;
  transition:transform .18s var(--ease), box-shadow .18s var(--ease);
}
.btn-ask svg{ width:15px; height:15px }
.btn-ask:hover{ transform:translateY(-1px); box-shadow:0 6px 22px rgba(255,160,40,.3) }
.btn-ask:active{ transform:translateY(0) scale(.97) }

/* ═══ 布局 ═══ */
.layout{
  position:relative; z-index:2;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:0;
  padding:76px 0 0;
  max-width:1560px;
  margin:0 auto;
}

/* ═══ 简历区 ═══ */
.resume{
  min-width:0;
  padding:clamp(28px,5vw,76px) var(--pad-x) 120px;
}

.block{ margin-top:clamp(52px,7vw,104px) }

.block-title{
  display:flex; align-items:baseline; gap:14px;
  font-family:var(--f-display);
  font-size:clamp(20px,2.4vw,27px); font-weight:600;
  letter-spacing:-.01em;
  margin:0 0 34px;
  padding-bottom:16px;
  border-bottom:1px solid var(--line);
}
.block-title .idx{
  font-family:var(--f-mono); font-size:11px; font-weight:400;
  color:var(--amber); letter-spacing:.1em;
  transform:translateY(-3px);
}

/* ── 简历头部 ── */
.resume-head{ padding-top:clamp(14px,3vw,34px) }
.eyebrow{
  display:flex; align-items:center; gap:12px;
  font-family:var(--f-mono); font-size:11px; letter-spacing:.22em;
  color:var(--amber); text-transform:uppercase;
  margin:0 0 18px;
}
.eyebrow .rule{
  width:clamp(28px,7vw,72px); height:1px; flex:none;
  background:linear-gradient(90deg, transparent, var(--amber));
}
/* 姓名行：为了让卡通形象能待在姓名左边而包的一层。
   形象尺寸跟随姓名一起缩放（姓名是 clamp(46px,9vw,96px)）。 */
/* 下外边距放在这一层：flex 的 align-items:center 是按「外边距盒」居中的，
   若留在 .hero-name 上会把姓名整体顶高 10px，与形象错开。 */
.name-row{ display:flex; align-items:center; gap:clamp(10px,2.4vw,20px); min-width:0; margin:0 0 20px }
.hero-mascot{ display:none }        /* PC 端不显示，只在窄屏出现 */
@media(max-width:1079px){
  .hero-mascot{
    display:block; flex:none;
    width:clamp(58px,12vw,104px);
    height:clamp(58px,12vw,104px);
  }
  .hero-mascot picture,
  .hero-mascot img{ display:block; width:100%; height:100%; object-fit:contain }
}
.hero-name{
  font-family:var(--f-display);
  font-size:clamp(46px,9vw,96px);
  line-height:.94; font-weight:800; letter-spacing:-.035em;
  margin:0;                    /* 间距由 .name-row 提供 */
  /* 高对比渐变：确保在深色底上始终清晰可读 */
  background:linear-gradient(170deg, #FFFFFF 0%, #F2F4F6 42%, #B9C0CA 78%, #9AA3AE 100%);
  -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent;
}
.hero-role{
  font-size:clamp(15px,1.16vw,18px); line-height:1.65;
  color:var(--text-dim);
  margin:0 0 30px;
  /* 不要用 text-wrap:balance —— 它为了让各行长度接近会**提前换行**：
     393px 下第一行只填到 78% 就断在「需求分/析」中间。
     用默认的 auto：填满一行才换，符合「到最后再转行」的预期。 */
  text-wrap:auto;
}

/* ── 桌面端：这句标语**不折行** ──
   实测这段文字占 51.1 em（单行宽 = 字号 × 51.1），hero 容器宽约 0.548 × 视口。
   反推：字号 ≤ 0.548vw ÷ 51.1 = 1.072vw 时才放得下。
   1080~1260px 区间单行需要 10.8~13.5px 字号 —— 偏小/不可读，所以从 1280px 起才强制单行。
   实测：1280px 字号 13.2px（余量 27px）、1512px 15.6px（余量 51px）、1920px 封顶 16px（余量 86px）。
   （手机单行需要约 7px 字号，绝无可能，故不在此范围。） */
@media(min-width:1280px){
  .hero-role{
    white-space:nowrap;
    font-size:min(16px,1.03vw);   /* 约 4% 余量，防止不同系统字体渲染差异导致溢出 */
    text-wrap:auto;
  }
}
/* 窄屏字号提一档（简历栏变窄，但字号不能再小） */
@media(max-width:1079px){
  /* 手机端这句 54 字标语：实测 ≤3.35vw 才能在 **360~430px**（覆盖绝大多数手机）
     排成 2 行且每行填满。再大就会变 3 行，末行还会出现「应用。」这种孤字。
     下限 12px 兼顾可读性；320px 的老机型仍是 3 行，可接受。 */
  .hero-role{ font-size:clamp(12px,3.35vw,15.5px) }
}
.hero-role em{ font-style:normal; color:var(--text); font-weight:600; border-bottom:1px solid var(--amber-line) }



/* 系统读数 */
.readout{
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
  gap:1px; margin:0 0 34px;
  background:var(--line);
  border:1px solid var(--line); border-radius:var(--r-md);
  overflow:hidden;
}
.readout > div{
  background:linear-gradient(180deg, rgba(18,21,26,.92), rgba(12,14,18,.92));
  padding:16px 18px;
}
.readout dt{
  font-family:var(--f-mono); font-size:10px; letter-spacing:.14em;
  color:var(--text-mute); text-transform:uppercase; margin-bottom:6px;
}
.readout dd{
  margin:0; font-family:var(--f-display);
  font-size:clamp(22px,3vw,30px); font-weight:600; line-height:1;
  color:var(--text); font-variant-numeric:tabular-nums;
}
.readout dd small{ font-size:.45em; color:var(--text-mute); font-weight:400; margin-left:3px; font-family:var(--f-mono) }

/* 联系方式 */
.contact{ display:flex; flex-wrap:wrap; gap:10px }
.chip{
  display:inline-flex; align-items:center; gap:8px;
  font-size:13px; color:var(--text-dim);
  background:var(--surface); border:1px solid var(--line);
  padding:8px 14px; border-radius:var(--r-full);
  transition:border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.chip svg{ width:15px; height:15px; flex:none; opacity:.75 }
a.chip:hover{ border-color:var(--amber-line); color:var(--text); transform:translateY(-1px) }
.chip.quiet{ color:var(--text-mute) }

/* ── 工作经历 ── */
.job{ margin-bottom:42px }
.job:last-child{ margin-bottom:0 }
.job-head{
  display:flex; flex-wrap:wrap; align-items:baseline;
  justify-content:space-between; gap:6px 18px;
  margin-bottom:16px;
}
.job-head h3{
  font-family:var(--f-display);
  font-size:clamp(16px,2vw,19px); font-weight:600; margin:0;
  letter-spacing:-.005em;
}
.job-meta{
  font-family:var(--f-mono); font-size:11.5px;
  color:var(--text-mute); letter-spacing:.03em; white-space:nowrap;
}
.job-list{ list-style:none; margin:0; padding:0; display:grid; gap:12px }
.job-list li{
  position:relative; padding-left:20px;
  color:var(--text-dim); font-size:14.5px;
}
.job-list li::before{
  content:""; position:absolute; left:0; top:.72em;
  width:6px; height:1px; background:var(--amber); opacity:.75;
}
.job-list b{ color:var(--text); font-weight:600; margin-right:6px }
mark{
  background:var(--amber-lo); color:var(--amber-hi);
  padding:1px 5px; border-radius:4px;
  font-weight:600; font-variant-numeric:tabular-nums;
}

/* ── 项目卡片 ── */
.card{
  background:linear-gradient(180deg, rgba(23,27,34,.72), rgba(12,14,18,.72));
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  padding:clamp(20px,3vw,30px);
  margin-bottom:18px;
  transition:border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover{
  border-color:var(--line-2);
  transform:translateY(-2px);
  box-shadow:var(--sh-2);
}
.card-top{
  display:flex; flex-wrap:wrap; align-items:center;
  justify-content:space-between; gap:10px; margin-bottom:20px;
}
.card-top h3{
  font-family:var(--f-display); font-size:clamp(16px,2vw,19px);
  font-weight:600; margin:0;
}
.card-tag{
  font-family:var(--f-mono); font-size:10.5px; letter-spacing:.09em;
  color:var(--text-mute); text-transform:uppercase;
  border:1px solid var(--line-2); border-radius:var(--r-full);
  padding:4px 11px; white-space:nowrap;
}
.card-tag.accent{
  color:var(--amber); border-color:var(--amber-line); background:var(--amber-lo);
}
.card-dl{ margin:0; display:grid; gap:14px }
.card-dl dt{
  font-family:var(--f-mono); font-size:10.5px; letter-spacing:.1em;
  color:var(--text-mute); text-transform:uppercase; margin-bottom:3px;
}
.card-dl dd{ margin:0; color:var(--text-dim); font-size:14.5px }

/* ── 技能 ── */
.skills{ display:grid; gap:20px }
.skill-row{ display:grid; gap:10px }
@media(min-width:640px){
  .skill-row{ grid-template-columns:104px minmax(0,1fr); align-items:start; gap:20px }
}
.skill-key{
  font-family:var(--f-mono); font-size:10.5px; letter-spacing:.1em;
  color:var(--text-mute); text-transform:uppercase; padding-top:7px;
}
.tags{ display:flex; flex-wrap:wrap; gap:8px }
.tags span{
  font-size:13px; color:var(--text-dim);
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-sm); padding:6px 12px;
  transition:border-color .2s var(--ease), color .2s var(--ease);
}
.tags span:hover{ border-color:var(--amber-line); color:var(--text) }

/* ── 页脚 ── */
.foot{
  margin-top:clamp(52px,7vw,96px); padding-top:26px;
  border-top:1px solid var(--line);
  font-size:13.5px; color:var(--text-dim);
}
.foot p{ margin:0 0 8px }
.foot b{ color:var(--text) }
.foot-dim{ color:var(--text-mute); font-family:var(--f-mono); font-size:11.5px }

/* 备案号（ICP + 公安）—— 法律要求必须展示，所以不加动画、不隐藏，
   也不能被 .reveal 的透明度影响可读性 */
.foot-icp{
  margin-top:16px; display:flex; flex-wrap:wrap; align-items:center; gap:8px;
  font-size:12px; line-height:1.6; color:var(--text-mute);
}
.foot-icp a{
  color:var(--text-mute); text-decoration:none;
  border-bottom:1px solid transparent;
  transition:color .18s var(--ease), border-color .18s var(--ease);
  -webkit-tap-highlight-color:transparent;
}
.foot-icp a:hover{ color:var(--text-dim); border-bottom-color:var(--line-2) }
.foot-sep{ opacity:.45 }

/* ═══ 对话面板 ═══ */
.chat{
  position:fixed; z-index:60;
  left:0; right:0; bottom:0;
  height:88dvh;
  display:flex; flex-direction:column;
  background:linear-gradient(180deg, #0F1216, #0A0C0F);
  border-top:1px solid var(--line-2);
  border-radius:var(--r-lg) var(--r-lg) 0 0;
  box-shadow:var(--sh-3);
  transform:translateY(101%);
  transition:transform .42s var(--ease);
  padding-bottom:env(safe-area-inset-bottom);
}
.chat.open{ transform:translateY(0) }
.chat.flash{ border-color:var(--amber-line); box-shadow:0 0 0 1px var(--amber-line), 0 0 40px rgba(255,160,40,.16) }

.chat-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:8px 18px;
  border-bottom:1px solid var(--line);
  flex:none;
}
/* flex-wrap 是这里的关键：问候语块「有空间就贴在头像右侧，
   空间不够就整块换到下一行」。配合下面 small 的 nowrap，
   无论哪种情况这句话都是完整一行，不会断句。 */
.chat-title{ display:flex; align-items:center; gap:12px; min-width:0 }
.chat-title strong{
  display:block; font-family:var(--f-display);
  font-size:15px; font-weight:600;
}
/* 头部问候语：说明句就在「嗨！我是杰宝。」下面，强制单行。
   flex:1 1 auto + min-width:0 让这一块能收缩、也能整体换行。 */
.chat-greet{ flex:1 1 auto; min-width:0 }
.chat-greet strong{ display:block; font-size:15px; font-weight:600; margin-bottom:3px }
.chat-greet small{
  display:block; font-size:10px; color:var(--text-mute); line-height:1.5;
  /* 不用 nowrap：宽屏放得下自然就是一行，窄屏自动折行。
     这样既满足「电脑端在问候语下面一行」，又不会因为访客系统字体更宽而溢出。 */
  text-wrap:balance;
}
/* 手机端字号放大一点，两行更易读 */
@media(max-width:1079px){
  .chat-greet small{ font-size:11.5px }
}
.pulse{
  width:9px; height:9px; border-radius:50%; flex:none;
  background:var(--amber);
  box-shadow:0 0 0 0 rgba(255,160,40,.6);
  animation:pulse 2.4s var(--ease) infinite;
}
@keyframes pulse{
  0%{ box-shadow:0 0 0 0 rgba(255,160,40,.55) }
  70%{ box-shadow:0 0 0 11px rgba(255,160,40,0) }
  100%{ box-shadow:0 0 0 0 rgba(255,160,40,0) }
}
.icon-btn{
  width:44px; height:44px; flex:none;   /* 触控目标 ≥44px */
  display:grid; place-items:center;
  background:transparent; border:1px solid var(--line);
  border-radius:9px; color:var(--text-dim); cursor:pointer;
  transition:border-color .2s, color .2s, background .2s;
}
.icon-btn:hover{ border-color:var(--line-3); color:var(--text); background:var(--surface) }
.icon-btn svg{ width:17px; height:17px }

.chat-log{
  flex:1; overflow-y:auto;
  /* 双保险：overscroll-behavior 在旧版微信 WebKit 里不生效，
     真正的锁在 app.js 的 lockScroll()（position:fixed 方案） */
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-y;
  padding:20px 18px; display:flex; flex-direction:column; gap:16px;
  scrollbar-width:thin; scrollbar-color:var(--line-2) transparent;
}
.chat-log::-webkit-scrollbar{ width:6px }
.chat-log::-webkit-scrollbar-track{ background:transparent }
.chat-log::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.12); border-radius:3px }
.chat-log::-webkit-scrollbar-thumb:hover{ background:rgba(255,255,255,.22) }

.msg{ display:flex; flex-direction:column; gap:9px; animation:rise .4s var(--ease) both }
@keyframes rise{ from{ opacity:0; transform:translateY(9px) } to{ opacity:1; transform:none } }
.msg.user{ align-items:flex-end }

.bubble{
  font-size:14.5px; line-height:1.75;
  padding:12px 15px; border-radius:var(--r-md);
  max-width:min(100%,62ch);
  word-break:break-word;
}
.msg.user .bubble{
  background:var(--amber); color:#0A0B0D; font-weight:500;
  border-bottom-right-radius:5px;
}
.msg.ai .bubble{
  background:var(--surface-2); border:1px solid var(--line);
  border-bottom-left-radius:5px;
  color:var(--text);
}
/* ═══ 访客侧降级公告 ═══ */
.chat-notice{
  flex:none; display:flex; align-items:flex-start; gap:9px;
  margin:0; padding:9px 18px;
  font-size:12.5px; line-height:1.55; color:var(--amber-hi);
  background:var(--amber-lo); border-bottom:1px solid var(--amber-line);
}
.chat-notice svg{ width:15px; height:15px; flex:none; margin-top:2px }

.bubble p{ margin:0 0 .7em }
.bubble p:last-child{ margin-bottom:0 }
.bubble strong{ color:#fff; font-weight:600 }
.bubble ul,.bubble ol{ margin:.4em 0 .7em; padding-left:1.25em }
.bubble li{ margin:.22em 0 }
.bubble code{
  font-family:var(--f-mono); font-size:.88em;
  background:rgba(255,255,255,.07); padding:1px 5px; border-radius:4px;
}
.bubble pre{
  background:#0A0C0F; border:1px solid var(--line);
  border-radius:10px; padding:12px; overflow-x:auto; margin:.5em 0;
}
.bubble pre code{ background:none; padding:0 }

/* 打字指示 */
.typing{ display:inline-flex; gap:4px; align-items:center; height:1.2em }
.typing i{
  width:5px; height:5px; border-radius:50%; background:var(--amber); opacity:.4;
  animation:blink 1.3s var(--ease) infinite;
}
.typing i:nth-child(2){ animation-delay:.18s }
.typing i:nth-child(3){ animation-delay:.36s }
@keyframes blink{ 0%,60%,100%{ opacity:.28; transform:translateY(0) } 30%{ opacity:1; transform:translateY(-3px) } }

/* 溯源 */
.sources{
  display:flex; flex-wrap:wrap; gap:6px; align-items:center;
  font-size:11.5px; color:var(--text-mute);
}
.sources .lab{
  font-family:var(--f-mono); font-size:10px; letter-spacing:.1em;
  text-transform:uppercase;
}
.src{
  display:inline-flex; align-items:center; gap:5px;
  background:rgba(255,160,40,.08); border:1px solid var(--amber-line);
  color:var(--amber-hi); border-radius:var(--r-full);
  padding:3px 10px; font-size:11.5px;
  white-space:nowrap; max-width:100%;
  overflow:hidden; text-overflow:ellipsis;
}
.src .dom{
  font-family:var(--f-mono); font-size:9.5px; letter-spacing:.06em;
  text-transform:uppercase; opacity:.72;
}
.meta-line{
  font-family:var(--f-mono); font-size:10.5px; color:var(--text-mute);
  letter-spacing:.03em;
}

/* 快捷问题 */
/* ═══════════ 对话面板：入口问题（输入框上方，紧凑）═══════════ */
.chat-foot{
  flex:none;
  padding:11px 18px 10px;
  border-top:1px solid var(--line);
  background:linear-gradient(0deg, rgba(255,160,40,.024), transparent 70%);
}
.chat-foot .foot-cap{
  display:flex; align-items:center; gap:8px;
  margin:0 0 8px;
  font-family:var(--f-mono); font-size:9.5px; letter-spacing:.12em;
  color:var(--text-mute); text-transform:uppercase;
}
.chat-foot .foot-cap::after{
  content:''; flex:1; height:1px;
  background:linear-gradient(90deg, var(--line), transparent);
}

.chat-sugg{
  display:flex; flex-wrap:wrap; align-items:flex-start;
  gap:5px;
}
.sugg{
  display:inline-flex; align-items:center;
  width:auto; max-width:100%;
  min-height:27px;
  padding:0 10px;
  font-family:inherit; font-size:11.5px; line-height:1.25;
  color:var(--text-dim); text-align:left;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:8px;
  cursor:pointer;
  transition:border-color .18s var(--ease), color .18s var(--ease),
             background .18s var(--ease);
}
.sugg:hover{
  border-color:var(--amber-line); color:var(--text);
  background:rgba(255,160,40,.07);
}

.chat-input{
  flex:none; display:flex; gap:10px; align-items:flex-end;
  padding:14px 18px 18px; border-top:1px solid var(--line);
}
.chat-input textarea{
  flex:1; min-width:0;
  font:inherit; font-size:15px; line-height:1.6;
  color:var(--text); background:var(--surface);
  border:1px solid var(--line-2); border-radius:var(--r-md);
  padding:11px 14px; resize:none; max-height:132px;
  overflow-y:auto;
  transition:border-color .2s var(--ease);
  /* 滚动条细、半透明、贴合暗色主题（系统默认滚动条在深色输入框里非常突兀） */
  scrollbar-width:thin;
  scrollbar-color:rgba(255,255,255,.14) transparent;
}
.chat-input textarea::-webkit-scrollbar{ width:6px; height:6px }
.chat-input textarea::-webkit-scrollbar-track{ background:transparent }
.chat-input textarea::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.14); border-radius:3px;
}
.chat-input textarea::-webkit-scrollbar-thumb:hover{ background:rgba(255,255,255,.26) }
.chat-input textarea::-webkit-scrollbar-corner{ background:transparent }
.chat-input textarea::placeholder{ color:var(--text-mute) }
.chat-input textarea:focus{ outline:none; border-color:var(--amber-line) }
.chat-input button{
  width:44px; height:44px; flex:none;
  display:grid; place-items:center;
  background:var(--amber); color:#0A0B0D;
  border:0; border-radius:var(--r-md); cursor:pointer;
  transition:transform .18s var(--ease), opacity .2s;
}
.chat-input button svg{ width:19px; height:19px }
.chat-input button:hover:not(:disabled){ transform:translateY(-1px) }
.chat-input button:disabled{ opacity:.4; cursor:not-allowed }

/* 遮罩 */
.scrim{
  position:fixed; inset:0; z-index:50;   /* 低于 .chat(60)，抽屉不会被自己压暗 */
  background:rgba(0,0,0,.66);
  backdrop-filter:blur(2px);
  animation:fade .3s var(--ease);
}
@keyframes fade{ from{opacity:0} to{opacity:1} }


/* ═══ 滚动揭示 ═══
   注意：默认必须可见。只有在 JS 确认可用（html.js）之后才隐藏，
   否则一旦 JS 加载失败或 IntersectionObserver 未触发，内容会永久不可见。 */
.reveal{ /* 默认：可见 */ }
.js .reveal{ opacity:0; transform:translateY(20px) }
.js .reveal.in{
  opacity:1; transform:none;
  transition:opacity .45s var(--ease), transform .45s var(--ease);
}

/* ═══ 桌面布局 ═══ */
@media(min-width:1080px){
  .layout{
    grid-template-columns:minmax(0,1fr) clamp(380px,32vw,470px);
    align-items:start;
    padding-right:var(--pad-x);
  }
  .resume{ padding-right:clamp(28px,4vw,58px) }

  .chat{
    position:sticky; top:76px;
    left:auto; right:auto; bottom:auto;
    height:calc(100dvh - 100px);
    transform:none;
    border:1px solid var(--line-2);
    border-radius:var(--r-lg);
    box-shadow:var(--sh-2);
    margin-right:0;
  }
  .chat-head .icon-btn{ display:none }
  .scrim{ display:none }
  .btn-ask{ display:none }
  .readout{ grid-template-columns:repeat(4,minmax(0,1fr)) }
}

/* ═══ 无障碍：尊重减少动效 ═══ */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
    scroll-behavior:auto !important;
  }
  .reveal{ opacity:1 !important; transform:none !important }
  #bg{ display:none }
}

/* ═══════════ 项目卡片：图谱入口 ═══════════ */
.block-sub{
  color:var(--text-mute); font-size:13.5px;
  margin:-20px 0 26px;
}
.card-sum{
  color:var(--text-dim); font-size:14.5px; margin:0 0 18px;
}
.card-actions{ display:flex; flex-wrap:wrap; gap:10px }
.btn-graph,.btn-ask-proj{
  display:inline-flex; align-items:center; gap:8px;
  font:inherit; font-size:13px; font-weight:500;
  border-radius:var(--r-full); padding:9px 16px; cursor:pointer;
  transition:border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.btn-graph{
  background:var(--amber-lo); color:var(--amber-hi);
  border:1px solid var(--amber-line);
}
.btn-graph svg{ width:15px; height:15px }
.btn-graph:hover{ transform:translateY(-1px); background:rgba(255,160,40,.2) }
.btn-ask-proj{
  background:transparent; color:var(--text-dim);
  border:1px solid var(--line-2);
}
.btn-ask-proj:hover{ border-color:var(--line-3); color:var(--text); transform:translateY(-1px) }

/* ═══════════ 项目图谱页 ═══════════ */
.proj-page{
  /* z-index 必须低于 .layout(2)。手机端的对话抽屉在 .layout 内部，
     它的 z-index:60 只在 .layout 这个层叠上下文里有效；若图谱页也是 2
     且在 DOM 后面，抽屉就会被图谱页盖住 —— 点了「提问」什么都不出来。 */
  position:relative; z-index:1;
  /* 必须是确定高度（不是 min-height），否则 .pp-graph 的 flex:1
     拿不到确定高度，SVG 就会按内容撑开 → 整页超出视口 */
  height:100dvh;
  overflow-y:auto;                       /* 极窄屏兜底 */
  display:flex; flex-direction:column;
  padding:68px var(--pad-x) 22px;
  animation:ppIn .35s var(--ease);
}
@keyframes ppIn{ from{ opacity:0; transform:translateY(10px) } to{ opacity:1; transform:none } }
.pp-inner{
  flex:1 1 auto; min-height:0;           /* 高度由父容器剩余空间决定 */
  width:100%; max-width:1560px; margin:0 auto;
  display:flex; flex-direction:column;
}
.pp-back{
  align-self:flex-start;
  display:inline-flex; align-items:center; gap:7px;
  font:inherit; font-size:14px; color:var(--text-dim);
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-full); padding:9px 18px 9px 12px;
  cursor:pointer; margin-bottom:16px;
  transition:border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.pp-back svg{ width:18px; height:18px }
.pp-back:hover{ border-color:var(--amber-line); color:var(--text); transform:translateX(-2px) }

.pp-head{ flex:none; margin-bottom:clamp(6px,1.4vw,16px) }
.pp-tag{
  display:inline-block;
  font-family:var(--f-mono); font-size:12px; letter-spacing:.1em; text-transform:uppercase;
  color:var(--amber); background:var(--amber-lo); border:1px solid var(--amber-line);
  border-radius:var(--r-full); padding:5px 14px; margin-bottom:10px;
}
.pp-head h2{
  font-family:var(--f-display);
  font-size:clamp(24px,2.8vw,34px); font-weight:700;
  letter-spacing:-.02em; margin:0 0 8px; line-height:1.2;
}
.pp-sum{
  color:var(--text-dim); font-size:clamp(13px,1.1vw,15px);
  margin:0; max-width:96ch; line-height:1.62;
}
.pp-graph{
  flex:1 1 auto; min-height:0;           /* 拿到确定高度后，SVG 才能按高度缩放 */
  /* 用 flex + 子元素 margin:auto 居中：比 justify-content:center 好在
     内容放大溢出时，左右两端都能滚到（后者会把左半边滚不到）。 */
  display:flex;
  overflow:auto;                         /* 放大后可拖动查看 */
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.pp-graph > .starlink{ margin:auto; flex:none }
.pp-foot{
  flex:none; display:flex; align-items:center; justify-content:space-between;
  gap:14px; margin-top:10px; flex-wrap:wrap;
}
.pp-hint{
  display:flex; align-items:center; gap:9px;
  margin:0; min-width:0;
  font-size:13px; color:var(--text-mute);
}
/* 缩放控件：按钮 ≥38px 以满足触控目标 */
.pp-zoom{ display:flex; align-items:center; gap:6px; flex:none; margin-left:auto }
.pp-zoom-btn{
  width:38px; height:38px; flex:none;
  display:grid; place-items:center;
  background:var(--surface); border:1px solid var(--line);
  border-radius:10px; color:var(--text-dim);
  font:inherit; font-size:20px; line-height:1; cursor:pointer;
  transition:border-color .18s, color .18s, background .18s;
  -webkit-tap-highlight-color:transparent;
}
.pp-zoom-btn:hover{ border-color:var(--line-3); color:var(--text) }
.pp-zoom-btn:active{ background:var(--amber-lo); border-color:var(--amber-line); color:var(--amber-hi) }
.pp-zoom-val{
  width:auto; min-width:62px; padding:0 10px;
  font-size:12.5px; font-variant-numeric:tabular-nums; letter-spacing:.01em;
}
.pp-zoom-btn[disabled]{ opacity:.35; cursor:default }
.pp-zoom-btn[disabled]:active{ background:var(--surface); border-color:var(--line); color:var(--text-dim) }
.pp-dot{
  width:7px; height:7px; border-radius:50%; flex:none;
  background:var(--amber); box-shadow:0 0 10px rgba(255,160,40,.9);
  animation:corePulse 2.6s var(--ease) infinite;
}
@media(max-width:1079px){
  /* 手机端进图谱页时**不能**把整个 .layout 隐藏 —— 对话抽屉和遮罩都在里面，
     一隐藏它们就跟着 display:none，点「提问」自然没反应。只藏简历栏即可。 */
  .layout.on-project main.resume{ display:none }
}

@media(max-width:760px){
  .proj-page{ padding-left:20px; padding-right:20px }
  /* 不再用固定 min-width 撑宽：缩放由 .pp-zoom 接管，默认已放大 */
  .pp-foot{ gap:10px }
  .pp-hint{ font-size:12.5px }
}

/* 矮屏（手机横屏最典型）：标题区几乎吃掉全部垂直高度，图谱被挤到只剩几像素。
   这里做两件事：① 压缩头部把高度让给图谱 ② 给图谱一个下限并允许内层滚动。 */
@media(max-height:560px){
  .proj-page{ padding-top:56px; padding-bottom:14px }
  .pp-head{ margin-bottom:4px }
  .pp-head h2{ font-size:clamp(20px,3.2vh,26px); margin-bottom:4px }
  .pp-tag{ margin-bottom:6px; padding:4px 12px; font-size:11px }
  .pp-tabs{ margin-top:6px }
  /* 描述在矮屏先让位——它最长，且图谱才是这个页面的主体 */
  .pp-sum{ display:none }
  .pp-inner{ overflow-y:auto; -webkit-overflow-scrolling:touch }
  .pp-graph{ flex:none; min-height:300px; max-height:62dvh }
}

.starlink{
  /* 宽高都给满，配合 preserveAspectRatio="meet" 自动缩放到容器内 → 永远一屏可见 */
  width:100%; height:100%;
  display:block; margin:0; overflow:visible;
}
.starlink text{
  font-family:var(--f-body);
  fill:var(--text-dim);
  font-size:15px;
  text-anchor:middle;
  pointer-events:none;
  user-select:none;
}
.starlink .sl{ stroke:rgba(255,255,255,.10); stroke-width:1; transition:stroke .25s, stroke-width .25s }
.starlink .sl-core{ stroke:rgba(255,160,40,.28); stroke-width:1.3 }
.starlink .sl-leaf{ stroke:rgba(255,255,255,.075) }
.starlink .sl.lit{ stroke:var(--amber); stroke-width:1.8 }
.starlink .sl-leaf.lit{ stroke:rgba(255,160,40,.75) }

/* 装饰环：缓慢旋转，让画面是活的 */
.starlink .sl-ring{
  fill:none; stroke:rgba(255,255,255,.05); stroke-width:1;
  stroke-dasharray:3 9;
  transform-origin:735px 230px;
  animation:ringSpin 90s linear infinite;
}
.starlink .sl-ring2{
  stroke:rgba(255,160,40,.09);
  stroke-dasharray:2 12;
  animation:ringSpin 60s linear infinite reverse;
}
@keyframes ringSpin{ to{ transform:rotate(360deg) } }

/* 一级模块 */
.sl-mod-node{ cursor:default }
.sl-mod-node circle{
  fill:rgba(20,24,30,.94);
  stroke:rgba(255,255,255,.16);
  stroke-width:1.2;
  transition:stroke .25s, fill .25s, r .25s;
}
.sl-mod-node:hover circle{ stroke:var(--amber-line); fill:rgba(32,26,16,.94) }
.sl-mod-node .sl-mod-text{
  fill:var(--text); font-size:17px; font-weight:600;
}
.sl-mod-node .sl-mod-n{
  fill:var(--text-mute);
  font-family:var(--f-mono); font-size:12px; letter-spacing:.04em;
}

/* 叶子模块（可点提问） */
.sl-leaf-node{ cursor:pointer }
.sl-leaf-node circle:first-of-type{
  fill:#0E1116; stroke:rgba(255,255,255,.30); stroke-width:1.2;
  transition:fill .22s, stroke .22s;
}
.sl-leaf-node .halo{
  fill:rgba(255,160,40,0); transition:fill .22s;
}
.sl-leaf-node text{ font-size:15px; transition:fill .22s }
.sl-leaf-node:hover circle:first-of-type,
.sl-leaf-node.lit circle:first-of-type{ fill:var(--amber); stroke:var(--amber-hi) }
.sl-leaf-node:hover .halo,
.sl-leaf-node.lit .halo{ fill:rgba(255,160,40,.20) }
.sl-leaf-node:hover text,
.sl-leaf-node.lit text{ fill:var(--amber-hi) }

/* 中心：项目 */
.sl-core-node .core-halo{
  fill:rgba(255,160,40,.07);
  animation:corePulse 4.5s var(--ease) infinite;
}
@keyframes corePulse{ 0%,100%{ opacity:.55 } 50%{ opacity:1 } }
.sl-core-node .core{
  fill:rgba(255,160,40,.14);
  stroke:var(--amber); stroke-width:1.4;
}
.sl-core-node .core-name{
  fill:var(--amber-hi); font-family:var(--f-display);
  font-size:26px; font-weight:700;
}
.sl-core-node .core-sub{
  fill:rgba(255,180,90,.72);
  font-family:var(--f-mono); font-size:13px; letter-spacing:.05em;
}


/* 星链图：中心项目名过长时自动缩小，避免硬断行 */
.sl-core-node .core-name.sm{ font-size:19px; letter-spacing:-.01em }
/* 画布变高后，星链图在弹层里留出更合理的边距 */


/* 证书条目：奖章图标 + 文字 */
.tags span.cert{ display:inline-flex; align-items:center; gap:8px; padding-left:11px }
.tags span.cert svg{ width:16px; height:16px; flex:none; color:var(--amber) }
.tags span.cert:hover svg{ color:var(--amber-hi) }

/* ═══════════ 项目图谱页：子项目标签 ═══════════ */
.pp-tabs{
  display:flex; flex-wrap:wrap; gap:8px;
  margin:16px 0 0;
}
.pp-tab{
  font-family:inherit; font-size:13px; line-height:1;
  color:var(--text-dim);
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-full);
  padding:0 16px; min-height:36px;
  display:inline-flex; align-items:center; gap:8px;
  cursor:pointer;
  transition:border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.pp-tab:hover{ border-color:var(--amber-line); color:var(--text) }
.pp-tab[aria-selected="true"]{
  color:#0A0B0D; background:var(--amber); border-color:var(--amber);
  font-weight:600;
}
.pp-tab-n{
  font-family:var(--f-mono); font-size:11px;
  opacity:.72;
}
@media(max-width:640px){
  .pp-tabs{ gap:6px }
  .pp-tab{ font-size:12px; padding:0 12px; min-height:34px }
}

/* ── 对话面板：空状态 ──
   开场区固定在顶部，下方留白交给对话流（flex:1 吸收空间）。
   试过把开场区垂直居中，但标题栏下方会出现一块没有解释的空白，反而像渲染缺失，
   而「顶部对齐 + 下方留白」的留白会被读作「对话将出现在这里」，更自然。 */

/* ═══════════ 会话面板头部：卡通形象 ═══════════ */
/* 透明无底色：不加背景渐变、不加圆形遮罩，人物直接浮在面板上。
   去掉圆圈后人物不再被框住，同样尺寸下观感明显更大。
   只用一层极淡投影把它从深底上分离出来（不是背景，是阴影）。 */
.chat-avatar{
  flex:none;
  width:72px; height:72px;
}
.chat-avatar picture{ display:block; width:100%; height:100% }
.chat-avatar img{
  display:block;
  width:100%; height:100%;
  object-fit:contain;
  filter:drop-shadow(0 3px 10px rgba(0,0,0,.5));
}
@media(max-width:1079px){
  .chat-avatar{ width:62px; height:62px }
}
