/* ==========================================================================
   YYKK ORBITAL ARCHIVE · 主站集成层（css/site.css）
   工位之外自建：六场景滚动布局 / 固定点云背景 / 64px 页头 / 搜索面板 / 留言表单
   硬约束：零圆角 · 1.5px 描边 · 禁 box-shadow / text-shadow / backdrop-filter
   移动端适配：全部收进文末 @media（主断点 760px，次级 480px），桌面端零回退
   ========================================================================== */

html { scroll-behavior:auto; }
body { background:#000; }

/* ---------- 点云固定全屏背景 ---------- */
#station-canvas {
  position:fixed; inset:0; width:100vw; height:100vh; display:block;
  background:#000; z-index:0; pointer-events:none;
}

/* ---------- 64px 固定页头（半透明 rgba 底色，不用 backdrop-filter） ---------- */
.site-head {
  position:fixed; top:0; left:0; right:0; z-index:100; height:64px;
  display:flex; align-items:center; justify-content:space-between;
  padding:0 24px 0 84px; /* 左侧为 60px 工具轨道让位 */
  border-bottom:1.5px solid var(--line-strong);
  background:rgba(10,10,10,.72);
  color:var(--fg);
}
body[data-tone="light"] .site-head { background:rgba(255,255,255,.78); }

.site-head__brand { display:flex; align-items:center; gap:14px; text-decoration:none; color:inherit; }
.site-head__brand b {
  background:var(--yellow); color:#000; padding:5px 10px 4px;
  font:700 11px/1 var(--mono); letter-spacing:.14em;
}
.site-head__brand span { color:var(--muted); font:8px/1 var(--mono); letter-spacing:.22em; }

.site-head__tools { display:flex; align-items:center; gap:18px; }
.site-head__search {
  display:flex; align-items:center; gap:10px; min-height:34px; padding:0 12px;
  border:1.5px solid var(--line-strong); background:transparent; color:var(--fg);
  cursor:pointer; font:9px/1 var(--mono); letter-spacing:.12em;
}
.site-head__search:hover { background:var(--yellow); color:#000; border-color:var(--yellow); }
.site-head__search kbd { font:7px/1 var(--mono); opacity:.6; border:1px solid currentColor; padding:2px 4px; }
/* 页头内的明暗双按钮压缩到 34px 行高（fusion.css 的 .tone-control 结构保持不动） */
.site-head .tone-control { display:flex; }
.site-head .tone-control button { min-height:34px; }

/* ---------- 滚动骨架：63px 占位 + 6 × 100vh ---------- */
.site-main { position:relative; z-index:1; }
.scroll-spacer { height:63px; }

.scene {
  position:relative; height:100vh; box-sizing:border-box;
  display:flex; align-items:center; padding:88px 56px 40px;
}
.scene--right { justify-content:flex-end; }
.scene--center { justify-content:center; }

/* ---------- 纸面内容面板：半透明底色让点云隐约可见 ---------- */
.scene__panel {
  width:min(600px, 44vw);
  max-height:calc(100vh - 160px);
  display:flex; flex-direction:column;
  border:1.5px solid var(--line-strong);
  background:rgba(12,12,12,.82);
  color:var(--fg);
  padding:32px;
}
body[data-tone="light"] .scene__panel { background:rgba(255,255,255,.88); }
.list-panel { width:min(680px, 48vw); }
.panel-scroll { flex:1 1 auto; min-height:0; overflow-y:auto; margin:0 -8px 0 0; padding-right:8px; }
.panel-scroll::-webkit-scrollbar { width:6px; }
.panel-scroll::-webkit-scrollbar-thumb { background:var(--line-strong); }
.panel-scroll::-webkit-scrollbar-track { background:transparent; }

/* ---------- 档案标签 / 黄色档案条 ---------- */
.archive-tag {
  display:inline-block; background:var(--yellow); color:#000;
  padding:3px 8px 2px; font:700 8px/1 var(--mono); letter-spacing:.18em;
}
.archive-bar {
  display:flex; justify-content:space-between; align-items:center;
  background:var(--yellow); color:#000; margin:-32px -32px 28px;
  padding:6px 12px 5px; font:700 8px/1 var(--mono); letter-spacing:.18em;
}

.panel-head { display:grid; gap:10px; margin-bottom:20px; }
.panel-head h2 {
  margin:0; font:900 clamp(30px,3.2vw,44px)/.95 var(--display);
  letter-spacing:.02em; text-transform:uppercase;
}
.panel-meta { color:var(--muted); font:8px/1 var(--mono); letter-spacing:.2em; }

/* ---------- 主页：巨型窄体标题 + 规格表 ---------- */
.mega-title {
  margin:0 0 22px; font:900 clamp(48px,7.4vw,110px)/.88 var(--display);
  letter-spacing:.01em; text-transform:uppercase;
}
.home-panel { overflow:hidden; }
.mega-title em { font-style:normal; background:var(--yellow); color:#000; padding:0 .1em; }
.home-sub { margin:0 0 26px; max-width:46ch; color:var(--muted); font:12px/1.8 var(--sans); }

.spec-grid { margin:0; display:grid; border-top:1px solid var(--line); }
.spec-grid > div {
  display:flex; justify-content:space-between; align-items:baseline;
  padding:9px 0; border-bottom:1px solid var(--line);
}
.spec-grid dt { color:var(--muted); font:8px/1 var(--mono); letter-spacing:.18em; }
.spec-grid dd { margin:0; font:700 15px/1 var(--mono); }
.spec-grid dd b { color:var(--yellow-2); font-weight:700; }
body[data-tone="light"] .spec-grid dd b { color:#8a7500; }

.scroll-hint {
  position:absolute; left:50%; bottom:26px; transform:translateX(-50%);
  display:flex; align-items:center; gap:10px;
  color:var(--muted); font:8px/1 var(--mono); letter-spacing:.26em;
}
.scroll-hint i { font-style:normal; color:var(--yellow); animation:hint-blink 1.6s steps(2,end) infinite; }
@keyframes hint-blink { 50% { opacity:0; } }

/* ---------- 笔记列表（latest） ---------- */
.note-list { flex:1 1 auto; min-height:0; overflow-y:auto; margin:0 -8px 0 0; padding:0 8px 0 0; list-style:none; counter-reset:note; border-top:1px solid var(--line); }
.note-list::-webkit-scrollbar { width:6px; }
.note-list::-webkit-scrollbar-thumb { background:var(--line-strong); }
.note-list li { counter-increment:note; }
.note-list a {
  display:grid; grid-template-columns:44px 1fr auto auto; align-items:baseline; gap:14px;
  padding:11px 8px; border-bottom:1px solid var(--line);
  color:inherit; text-decoration:none;
}
.note-list a::before {
  content:counter(note, decimal-leading-zero);
  color:var(--muted); font:9px/1 var(--mono);
}
.note-list a:hover { background:var(--yellow); color:#000; }
.note-list a:hover * { color:#000 !important; }
.note-title { font:12px/1.4 var(--sans); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.note-cat {
  border:1px solid var(--line-strong); padding:2px 6px 1px;
  font:7px/1.4 var(--mono); letter-spacing:.1em; white-space:nowrap;
}
.note-date { color:var(--muted); font:9px/1 var(--mono); white-space:nowrap; }

/* ---------- 分组文档树（tech / study / project，可折叠，V1.1） ---------- */
.group-list { display:grid; gap:2px; }
.tree-row {
  display:flex; align-items:center; gap:14px;
  min-height:52px; box-sizing:border-box;
  padding:6px 10px 6px calc(10px + var(--depth, 0) * 20px);
  border-bottom:1px solid var(--line);
  color:inherit; text-decoration:none; font:11px/1.5 var(--sans);
}
.tree-row .tree-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tree-row .note-date { margin-left:auto; flex:none; }
.tree-row:hover { background:var(--yellow); color:#000; }
.tree-row:hover .note-date, .tree-row:hover .tree-chevron { color:#000; }

/* 文件夹行（button 重置 + 恒定透明左条，展开时染黄，避免布局位移） */
button.tree-row--folder {
  width:100%; margin:0; border:0; border-bottom:1px solid var(--line);
  border-left:4px solid transparent;
  background:transparent; cursor:pointer; text-align:left;
  font:700 12px/1.4 var(--sans); letter-spacing:.03em; color:var(--fg);
}
.tree-node.is-open > .tree-row--folder { border-left-color:var(--yellow); }
.tree-row--root { font-size:13px; }
.tree-chevron {
  width:14px; height:14px; flex:none; color:var(--yellow-2);
  transition:transform 180ms cubic-bezier(.3,.7,.2,1);
}
.tree-node.is-open > .tree-row--folder .tree-chevron { transform:rotate(90deg); }
body[data-tone="light"] .tree-chevron { color:#8a7500; }
body[data-tone="light"] .tree-row:hover .tree-chevron { color:#000; }

/* 折叠动画：grid 0fr/1fr 高度过渡，190ms 脆起脆落 */
.tree-kids { display:grid; grid-template-rows:0fr; transition:grid-template-rows 190ms cubic-bezier(.3,.7,.2,1); }
.tree-node.is-open > .tree-kids { grid-template-rows:1fr; }
.tree-kids__inner { min-height:0; overflow:hidden; }

/* ---------- 留言表单 ---------- */
.form-panel { width:min(560px, 42vw); }
#guestbookForm { display:grid; gap:22px; }
.field textarea {
  width:100%; padding:12px 14px; border:0;
  border-top:1px solid var(--line-strong); border-bottom:1px solid var(--line-strong);
  background:transparent; color:var(--fg); outline:0;
  font:13px/1.7 var(--sans); resize:vertical; min-height:120px;
}
.form-note { margin:0; color:var(--muted); font:9px/1.6 var(--mono); letter-spacing:.08em; }
.form-error { margin:0; color:var(--red); font:10px/1.6 var(--mono); }
#guestbookSubmit { min-height:52px; }
/* .ui-button 默认三列（图标/文本/角标），提交按钮无图标，改两列 */
#guestbookSubmit.ui-button { grid-template-columns:1fr auto; padding:0 18px; }

/* ---------- 页脚（末场景底部） ---------- */
.site-foot {
  position:absolute; left:0; right:0; bottom:0;
  display:flex; justify-content:center; gap:32px; align-items:center;
  padding:14px 24px; border-top:1px solid var(--line);
  color:var(--muted); font:8px/1 var(--mono); letter-spacing:.16em;
}

/* ---------- 搜索面板 ---------- */
.search-overlay {
  position:fixed; inset:0; z-index:200;
  background:rgba(0,0,0,.55);
  display:flex; justify-content:center; align-items:flex-start; padding-top:14vh;
}
body[data-tone="light"] .search-overlay { background:rgba(255,255,255,.55); }
.search-panel {
  width:min(760px, 80vw);
  border:1.5px solid var(--line-strong);
  background:var(--bg); color:var(--fg);
  display:grid;
}
.search-panel__bar {
  display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:16px;
  padding:16px 20px; border-bottom:1.5px solid var(--line-strong);
}
.search-panel__bar input {
  border:0; background:transparent; color:var(--fg); outline:0;
  font:16px/1.2 var(--sans);
}
.search-panel__bar kbd { font:8px/1 var(--mono); color:var(--muted); border:1px solid var(--line-strong); padding:3px 6px; }
.search-results { margin:0; padding:0; list-style:none; max-height:52vh; overflow-y:auto; }
.search-results:empty { display:none; }
.search-results a {
  display:grid; grid-template-columns:1fr auto; gap:4px 16px;
  padding:12px 20px; border-bottom:1px solid var(--line);
  color:inherit; text-decoration:none;
}
.search-results a:hover, .search-results a.is-active { background:var(--yellow); color:#000; }
.search-results a:hover *, .search-results a.is-active * { color:#000 !important; }
.sr-title { font:700 13px/1.4 var(--sans); }
.sr-path { color:var(--muted); font:8px/1 var(--mono); letter-spacing:.12em; align-self:start; padding-top:4px; white-space:nowrap; }
.sr-snip { grid-column:1 / -1; color:var(--muted); font:10px/1.6 var(--sans); }
.sr-snip mark { background:var(--yellow); color:#000; padding:0 1px; }
.search-results a:hover .sr-snip mark, .search-results a.is-active .sr-snip mark { background:#000; color:var(--yellow); }
.search-panel__foot { padding:10px 20px; border-top:1px solid var(--line); color:var(--muted); font:8px/1 var(--mono); letter-spacing:.18em; }

/* ---------- 明暗变量下的面板微调 ---------- */
body[data-tone="light"] .site-head__search { color:var(--fg); }

/* ---------- 低视口（<760px 高）主页面板防裁切（V1.1 顺带修复） ---------- */
@media (max-height:760px) {
  .scene { padding:72px 56px 20px; }
  .scene__panel { max-height:calc(100vh - 92px); padding:24px; }
  .archive-bar { margin:-24px -24px 18px; }
  .panel-head { margin-bottom:14px; gap:8px; }
  .panel-head h2 { font-size:clamp(26px,2.8vw,36px); }
  .mega-title { font-size:clamp(40px,6vw,72px); margin-bottom:16px; }
  .home-sub { margin-bottom:18px; }
  .tree-row { min-height:44px; }
}

/* ---------- reduced motion 兜底 ---------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint i { animation:none; }
}

/* ==========================================================================
   移动端适配（工位 M）：主断点 760px
   - tool-rail 左侧竖排 → 底部横排导航条（可触 ≥40px，当前场景高亮黄）
   - 顶栏压缩：品牌不折行 / 搜索框弹性宽 / CTRL K 隐藏 / 主题切换保留
   - 场景面板全宽、字号阶梯缩放、树与列表行 ≥44px、日期不溢出
   - 横向滚动零容忍：body overflow-x 审计 + 全元素 min-width 防线
   ========================================================================== */
@media (max-width: 760px) {
  /* ---- 全局：横向溢出防线 ---- */
  html, body { overflow-x:clip; }
  .site-main, .scene, .scene__panel { max-width:100vw; }
  .scene__panel, .panel-head, .note-list a, .tree-row, #guestbookForm { min-width:0; }

  /* ---- 顶栏：56px 单行，品牌 / 搜索 / 主题切换 ---- */
  .site-head { height:56px; padding:0 10px; gap:10px; }
  .site-head__brand { flex:none; gap:0; }
  .site-head__brand b { padding:6px 8px 5px; font-size:10px; letter-spacing:.1em; white-space:nowrap; }
  .site-head__tools { flex:1 1 auto; min-width:0; gap:8px; }
  .site-head__find { flex:1 1 auto; min-width:0; }
  .site-head__find input { width:100%; min-width:0; height:40px; font-size:12px; }
  .site-head__find kbd { display:none; } /* CTRL K 提示窄屏隐藏 */
  .head-search-panel { width:calc(100vw - 20px); right:0; }
  /* 主题切换保留可用：仅图标，40px 可触 */
  .site-head .tone-control { flex:none; }
  .site-head .tone-control button {
    width:40px; min-height:40px; grid-template-columns:1fr; padding:0; place-items:center;
  }
  .site-head .tone-control button span { display:none; }
  .site-head .tone-control button i { width:8px; height:8px; }

  /* ---- 工具轨道 → 底部横排导航条 ---- */
  body[data-direction="fusion"] .tool-rail {
    inset:auto 0 0 0; width:100%; height:56px;
    flex-direction:row; align-items:stretch; padding:0;
    border-right:0; border-top:1px solid var(--rail-muted);
    transition:none;
  }
  body[data-direction="fusion"] .tool-rail[data-state="expanded"] { width:100%; }
  .tool-rail__nav {
    flex:1 1 auto; min-width:0;
    display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:0;
  }
  body[data-direction="fusion"] .tool-rail .tool-rail__item {
    width:auto; min-width:0; height:56px; min-height:56px;
    display:grid; grid-template-columns:1fr; grid-template-rows:22px 12px;
    place-items:center; align-content:center; gap:3px; padding:0 2px;
  }
  .tool-rail__item svg { width:20px; height:20px; }
  body[data-direction="fusion"] .tool-rail :is(.tool-rail__item,.tool-rail__tool) > span {
    opacity:1; transform:none; text-align:center;
    font-size:8px; letter-spacing:.02em; white-space:nowrap;
  }
  .tool-rail__item b { display:none; } /* 机位编号窄屏让位 */
  /* 当前场景：高亮黄底黑字（fusion 零圆角直角块） */
  body[data-direction="fusion"] .tool-rail .tool-rail__item.is-active {
    background:var(--yellow); color:#000;
  }
  body[data-direction="fusion"] .tool-rail .tool-rail__item.is-active > span,
  body[data-direction="fusion"] .tool-rail .tool-rail__item.is-active > svg { color:#000; }
  .tool-rail__item.is-active::before { display:none; } /* 左轨改整底色，去掉 3px 边条 */
  /* 系统工具：回到顶部 / 老版网站，仅图标 48px 可触 */
  .tool-rail__tools {
    flex:none; margin-top:0; display:grid; grid-auto-flow:column; gap:0; padding:0;
    border-left:1px solid var(--rail-muted);
  }
  body[data-direction="fusion"] .tool-rail .tool-rail__tool {
    width:48px; height:56px; grid-template-columns:48px; place-items:center;
  }
  body[data-direction="fusion"] .tool-rail .tool-rail__tool > span,
  body[data-direction="fusion"] .tool-rail .tool-rail__tool :is(kbd,small) { display:none; }
  .tool-rail__tool.is-enabled::before { display:none; }
  body[data-direction="fusion"] .tool-rail .tool-rail__cta,
  body[data-direction="fusion"] .tool-rail[data-state="expanded"] .tool-rail__cta {
    width:48px; height:56px; min-height:56px; margin:0;
    grid-template-columns:48px; place-items:center;
  }
  body[data-direction="fusion"] .tool-rail .tool-rail__cta > span { display:none; }
  /* 内容区去掉左侧留白，为底部导航条让位 */
  body[data-direction="fusion"] .site-main,
  body[data-direction="fusion"] .lab-main { margin-left:0; }
  .site-main { padding-bottom:0; }

  /* ---- 场景骨架：全宽面板 ---- */
  .scene { padding:72px 12px 84px; }
  .scene__panel {
    width:100%; max-width:100%;
    max-height:calc(100vh - 176px);
    padding:20px 14px;
  }
  .list-panel, .form-panel { width:100%; }
  .archive-bar { margin:-20px -14px 16px; padding:6px 10px 5px; font-size:7px; letter-spacing:.12em; }
  .panel-head { margin-bottom:14px; gap:8px; }
  .panel-head h2 { font-size:clamp(24px,7vw,32px); }

  /* ---- 主页：mega-title 阶梯缩放 + 统计表 ---- */
  .mega-title { font-size:clamp(32px,10.5vw,46px); margin-bottom:14px; }
  .home-sub { font-size:11px; margin-bottom:18px; }
  .spec-grid dt { font-size:7px; letter-spacing:.1em; }
  .spec-grid dd { font-size:13px; }
  .scroll-hint { bottom:66px; font-size:7px; letter-spacing:.18em; }

  /* ---- 笔记列表：编号/分类章让位，日期不溢出 ---- */
  .note-list a {
    grid-template-columns:1fr auto; gap:10px;
    min-height:44px; padding:10px 6px; align-items:center;
  }
  .note-list a::before { display:none; }
  .note-title { font-size:12px; }
  .note-cat { display:none; }
  .note-date { font-size:8px; }

  /* ---- 分组文档树：行高压到 44px 可触，缩进收紧 ---- */
  .tree-row {
    min-height:44px; gap:8px;
    padding:6px 8px 6px calc(8px + var(--depth, 0) * 14px);
    font-size:11px;
  }
  .tree-row .tree-name { min-width:0; }
  .tree-row .note-date { font-size:8px; }
  button.tree-row--folder { font-size:12px; }
  .tree-row--root { font-size:12px; }

  /* ---- 留言表单：输入框/按钮全宽可触 ---- */
  body[data-direction="fusion"] .field { padding:14px 12px 12px 52px; }
  body[data-direction="fusion"] .field::before { left:12px; top:22px; width:22px; height:22px; }
  .field input { min-height:44px; }
  .field textarea { min-height:110px; font-size:13px; }
  #guestbookForm { gap:16px; }
  #guestbookSubmit { min-height:48px; }

  /* ---- 页脚：抬到底部导航条之上，允许折行 ---- */
  .site-foot {
    bottom:56px; flex-wrap:wrap; gap:6px 18px;
    padding:10px 12px; font-size:7px; letter-spacing:.1em; text-align:center;
  }

  /* ---- toast 让位底部导航条 ---- */
  .toast { bottom:66px; }
}

/* ---------- 次级断点 480px：再收一档 ---------- */
@media (max-width: 480px) {
  .mega-title { font-size:clamp(28px,10vw,38px); }
  .archive-bar span:last-child { display:none; } /* 右侧技术参数让位 */
  .scene { padding:68px 10px 80px; }
  .scene__panel { padding:18px 12px; }
  .archive-bar { margin:-18px -12px 14px; }
  .spec-grid > div { padding:8px 0; }
  .tree-row .note-date { font-size:7px; }
}
