/* lianyanshe 门户统一顶栏 · 注入到各主题子页首屏顶部
   与 lianyanshe.css 共享设计变量，保持全站视觉一致。 */

[data-portal-host]{
  /* 如 lianyanshe.css 已加载则使用共享变量，否则用回退值 */
  --pb-bg:var(--bg-secondary,#ede5d3);
  --pb-bg2:var(--bg-primary,#f5efe1);
  --pb-fg:var(--text-primary,#2a2419);
  --pb-fg-dim:var(--text-secondary,#5e4f37);
  --pb-mute:var(--text-muted,#8a7958);
  --pb-accent:var(--accent,#b8763a);
  --pb-accent-2:var(--accent-2,#8b5a2b);
  --pb-border:var(--border,#d6c9aa);
  --pb-shadow:var(--shadow-sm,0 1px 3px rgba(139,90,43,0.08));
  --pb-serif:var(--serif,"Noto Serif SC","Source Han Serif SC","Songti SC","STSong",Georgia,serif);
  --pb-sans:var(--sans,-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei","Segoe UI",sans-serif);

  position:fixed; top:0; left:0; right:0; height:56px;
  z-index:10001;
  display:flex; align-items:center; gap:10px;
  padding:0 clamp(16px,4vw,40px);
  background:var(--pb-bg);
  border-bottom:1px solid var(--pb-border);
  box-shadow:var(--pb-shadow);
  font-family:var(--pb-sans); font-size:13px; color:var(--pb-fg-dim);
  line-height:1.4; text-rendering:optimizeLegibility;
  -webkit-font-smoothing:antialiased;
  box-sizing:border-box;
}

[data-portal-host] a{color:inherit;text-decoration:none}

.pb-home{
  display:flex;align-items:center;gap:9px;
  color:var(--pb-fg);font-family:var(--pb-serif);font-weight:700;
  font-size:16px;letter-spacing:.3px;
}

/* 透明底 logo（宽幅品牌图） */
.pb-logo{
  display:inline-flex;align-items:center;justify-content:center;
  max-width:min(42vw,200px);
}
.pb-logo img{
  height:32px;width:auto;max-width:100%;display:block;
  object-fit:contain;border-radius:6px;
}
/* 夜间 logo 自带黑底，与顶栏深色融合 */
html[data-theme="dark"] .pb-logo img{
  box-shadow:0 0 0 1px rgba(212,168,87,0.12);
}

.pb-sep{color:var(--pb-mute);opacity:.7;font-weight:400;}
.pb-name{
  display:inline-flex;align-items:center;gap:7px;color:var(--pb-fg-dim);font-weight:500;
  max-width:46vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.pb-chip{
  width:8px;height:8px;border-radius:50%;background:var(--pb-chip,var(--pb-accent));
  box-shadow:0 0 0 3px color-mix(in srgb,var(--pb-chip,var(--pb-accent)) 18%,transparent);
  flex-shrink:0;
}
.pb-spacer{flex:1 1 auto;min-width:8px}
.pb-back{
  color:var(--pb-accent-2);font-weight:500;font-size:12px;
  border:1px solid var(--pb-border);background:var(--pb-bg2);
  padding:5px 11px;border-radius:8px;cursor:pointer;white-space:nowrap;
  transition:background .2s ease,color .2s ease,border-color .2s ease;
}
.pb-back:hover{background:var(--pb-accent);color:#fff;border-color:var(--pb-accent);}

/* 门户内嵌主题切换 */
.pb-theme{
  display:inline-flex;align-items:center;justify-content:center;
  width:32px;height:32px;border-radius:50%;flex-shrink:0;
  border:1px solid var(--pb-border);background:var(--pb-bg2);
  color:var(--pb-accent-2);cursor:pointer;padding:0;
  transition:background .2s ease,border-color .2s ease,transform .2s ease;
}
.pb-theme:hover{border-color:var(--pb-accent);transform:rotate(12deg)}
.pb-theme svg{width:15px;height:15px;display:block}
html[data-theme="light"] .pb-theme .ls-ico-moon,
html:not([data-theme]) .pb-theme .ls-ico-moon{display:none}
html[data-theme="dark"] .pb-theme .ls-ico-sun{display:none}

@media (max-width:560px){
  [data-portal-host]{gap:8px;padding:0 14px;}
  .pb-home{font-size:15px}
  .pb-sep,.pb-spacer{display:none}
  .pb-back{margin-left:auto}
  .pb-name{max-width:40vw}
}

/* —— 安全下推 —— 主题原 fixed 顶栏 / 侧边栏 / 进度条让出 56px —— */
body{padding-top:56px !important;}
body > nav,
body > .topnav,
body > .navbar,
body > header.fixed,
body > header.sticky,
body > [data-topnav],
body > #topnav,
body > aside,
body > .sidebar,
body > [data-sidebar],
body > .fixed{ top:56px !important; }
body > [class*="sticky"]{ top:56px !important; }
/* 嵌套在 .app 等容器内的固定侧边栏也下推 */
.app .sidebar,
.app aside,
[data-app] .sidebar,
[data-app] aside{ top:56px !important; }
body > .progress-bar,
.app .read-progress,
.read-progress{ top:56px !important; }
body > .menu-toggle,
.app .menu-toggle,
.menu-toggle{ top:72px !important; }
