/* ==========================================================================
   顶部导航条 · 全站共用组件 (2026-11-17)
   --------------------------------------------------------------------------
   背景：导航条原来只长在首页（index.html 的内联 <style> / <script>），
   用户要求「让顶部的导航栏显示在所有页面」，于是抽成两份静态文件：
     · /static/site-nav.css —— 导航条外观
     · /static/site-nav.js  —— 导航数据（/api/nav）、下拉、世界时钟、收藏/分享/刷新
   页面只需带 <div id="navBar"></div>（没有也会自动补一个）并引入 <script>，
   其余全由这里负责 —— 以后改导航只改这两个文件，不会再出现两套版本。

   样式来源：index.html 内联块原样搬出（数值未改），另外在文件末尾补了
   「非首页的顶栏外观」一段：首页的顶栏由 site-theme.css 末尾 ROUND 24 段
   提供（只挂 .site-home），其余页面在这里挂同一组数值，保证换页不换脸。
   ========================================================================== */

/* ===== 顶部导航条（2026-11-11 定稿，2026-11-16 精简） ================
   原设计把「恐慌指数」长进导航里：底边 2px 情绪标尺 + 右端数值徽章。
   11-14 数值徽章搬到「A股主要指数」标题栏右端，11-16 情绪标尺连同白色
   游标也一起搬到标题栏背景栏（见 .ix-head 内的 .ix-thermo / #navMark），
   导航条只留纯导航：深色玻璃底 + 胶囊导航项 + 右侧工具组。
   标尺色序与主表盘一致：#2fd9a4/#0ea5c4/#4a86d8/#f97b39/#f43f5e。 */
#navBar {
    /* 【2026-11-17】加世界时钟后，1024 这类宽度放不下「导航 + 时钟 + 三按钮」，
       原来靠压缩子项硬塞，会把「首页」压成竖排两行；改成允许换行，
       工具组整体落到第二行（见 .nv-acts 的 flex:0 0 auto）。 */
    position: relative; z-index: 30; display: flex; align-items: center; gap: 4px;
    flex-wrap: wrap;
    padding: 5px 10px 9px 8px; margin: -10px 0 18px;
    border: 1px solid rgba(148,163,184,.15);
    border-radius: 12px;
    background:
        radial-gradient(300px 110px at 0% 50%, rgba(249,115,22,.18), transparent 70%),
        radial-gradient(360px 140px at 100% 130%, rgba(56,189,248,.10), transparent 72%),
        linear-gradient(180deg, rgba(32,44,64,.94), rgba(19,27,42,.92));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08),
                0 16px 32px -28px #000;
    /* 【2026-11-17】原来是 hidden，为了裁掉背景渐变溢出的那一像素；
       但导航现在有「分类 → 下拉子导航」，hidden 会把下拉面板整块切掉。
       背景与圆角由 border-radius 自己裁，改成 visible 即可。 */
    overflow: visible;
}
/* 情绪标尺（彩色渐变 + 白色游标）已搬到 .ix-head 标题栏背景栏，
   见下方 .ix-thermo / #navMark；导航条不再自带伪元素色带。 */
#navBar a {
    position: relative; z-index: 1;
    display: inline-flex; align-items: center; white-space: nowrap;
    padding: 6px 14px; border-radius: 8px;
    font-size: 13.5px; font-weight: 600; letter-spacing: .4px;
    color: var(--t3); text-decoration: none;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
#navBar a:hover { color: var(--t1); background: rgba(148,163,184,.10); }
#navBar a:focus-visible { outline: 2px solid rgba(249,115,22,.55); outline-offset: 1px; }
/* 第一项 = 当前站点页签：橙色玻璃胶囊 + 内描边 + 一点外发光 */
#navBar a.on {
    color: #ffd6b0;
    background: linear-gradient(180deg, rgba(249,115,22,.34), rgba(249,115,22,.12));
    box-shadow: inset 0 0 0 1px rgba(255,166,90,.50),
                inset 0 1px 0 rgba(255,220,190,.20),
                0 8px 18px -12px rgba(249,115,22,.9);
}
#navBar a.on::before {
    content: ''; width: 5px; height: 5px; border-radius: 50%;
    margin-right: 8px; background: #fdba74;
    box-shadow: 0 0 9px rgba(253,186,116,.95);
}
/* ===== 分类导航（2026-11-17）============================
   后台把某一条设成分类（带子导航）后，前台这一条变成「文字 + 小三角」的按钮，
   点开（桌面悬停）向下展开一列子导航。外观跟普通胶囊完全同源，
   只多一个三角和右侧一点留白，不另起一套配色。 */
#navBar .nv-g { position: relative; display: inline-flex; z-index: 2; flex: 0 0 auto; }
#navBar .nv-gb {
    position: relative; z-index: 1;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px 6px 14px; border: 0; border-radius: 8px;
    background: none; cursor: pointer;
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    letter-spacing: .4px; line-height: 1;
    color: var(--t3); white-space: nowrap;
    transition: color .18s ease, background .18s ease;
}
#navBar .nv-gb:hover,
#navBar .nv-g[data-open="1"] .nv-gb { color: var(--t1); background: rgba(148,163,184,.10); }
#navBar .nv-gb:focus-visible { outline: 2px solid rgba(249,115,22,.55); outline-offset: 1px; }
/* 分类被选中时跟普通胶囊同一个观感（site-theme 里 .site-home #navBar a.on 的那套）：
   /cb 点亮的就是「全球央行」这个分类，不能比首页的「首页」亮一档，否则换页像换了套主题。 */
#navBar .nv-gb.on {
    color: var(--brand-soft);
    background: rgba(245, 154, 69, .1);
    box-shadow: inset 0 0 0 1px rgba(245, 154, 69, .25);
}
#navBar .nv-gb.on::before {
    content: ''; width: 5px; height: 5px; border-radius: 50%;
    background: var(--brand); box-shadow: none;
}
.nv-caret {
    width: 0; height: 0; flex: 0 0 auto; margin-top: 1px;
    border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
    border-top: 4.5px solid currentColor; opacity: .65;
    transition: transform .18s ease, opacity .18s ease;
}
#navBar .nv-g[data-open="1"] .nv-caret { transform: rotate(180deg); opacity: 1; }
/* 下拉面板：深色玻璃 + 一道细边，跟导航条同一个材质语言 */
#navBar .nv-menu {
    position: absolute; left: 0; top: calc(100% + 6px); z-index: 40;
    min-width: 176px; max-width: 268px; padding: 6px;
    border: 1px solid rgba(148,163,184,.20); border-radius: 11px;
    background: linear-gradient(180deg, #1e2a3d, #111927);
    box-shadow: 0 22px 44px -24px #000,
                0 0 0 1px rgba(255,255,255,.03) inset;
    display: none;
    transform-origin: top center;
}
#navBar .nv-g[data-open="1"] .nv-menu { display: block; animation: nvmIn .16s ease both; }
/* 关着的时候用 display:none，而不是只把透明度压到 0 —— 这个面板是绝对定位、
   宽度 176~268px，挂在「关于本站」这种靠右的分类上时右边界会顶出视口
   （390 宽实测把 scrollWidth 撑到 402），页面就多出一条横向滚动。
   展开动画改用 @keyframes，不再依赖 transition，观感不变。 */
@keyframes nvmIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: none; }
}
/* 面板顶上一枚小三角，指着触发它的分类 —— 不然面板像凭空浮着。
   水平位置由 JS 按触发按钮的中心写入 --tip，翻转右对齐时用同一值 */
#navBar .nv-menu::before {
    content: ''; position: absolute; left: var(--tip, 19px); top: -5.5px;
    width: 9px; height: 9px; transform: rotate(45deg);
    background: #1e2a3d; pointer-events: none;
    border-left: 1px solid rgba(148,163,184,.20);
    border-top: 1px solid rgba(148,163,184,.20);
}
#navBar .nv-g.flip .nv-menu::before { left: auto; right: var(--tip, 19px); }
/* 面板里的链接要压掉 #navBar a 的胶囊内距：这里是「列表项」不是胶囊 */
#navBar .nv-menu a {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 11px; border-radius: 8px;
    font-size: 13px; font-weight: 550; letter-spacing: .2px;
    color: var(--t3); white-space: nowrap; text-decoration: none;
    transition: color .14s ease, background .14s ease;
}
/* 子项之间一条两端渐隐的虚线：不抢视线，但把「一条一条」分开 */
#navBar .nv-menu a + a::after {
    content: ''; position: absolute; left: 11px; right: 11px; top: 0; height: 0;
    border-top: 1px dashed rgba(148,163,184,.20);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
}
#navBar .nv-menu a + a.nv-menu-all::after { content: none; }
#navBar .nv-menu a:hover { color: var(--t1); background: rgba(148,163,184,.12); }
#navBar .nv-menu a:focus-visible { outline: 2px solid rgba(249,115,22,.55); outline-offset: -2px; }
#navBar .nv-menu .nv-x { font-style: normal; font-size: 10px; color: var(--t5); opacity: .8; }
/* 分类本身填了链接时，菜单底部补一条「查看全部」 */
#navBar .nv-menu .nv-menu-all {
    margin-top: 5px; padding-top: 9px; border-radius: 0 0 8px 8px;
    border-top: 1px solid rgba(148,163,184,.14); color: var(--t4);
}
/* 靠近视口右缘时由 JS 打上 .flip，改成右对齐 */
#navBar .nv-g.flip .nv-menu { left: auto; right: 0; }
/* ② 右端工具组：收藏 / 分享 / 刷新（2026-11-14）
   恐慌指数数值徽章搬到「A股主要指数」标题栏右端后，导航条这块空出来的位置
   改成三个常驻小工具。都是「就地执行一个动作」，所以用 <button> 不用 <a>：
   不给浏览器加历史记录，右键也不会出现「在新标签页打开」。
   图标跟着文字用 currentColor 描边，hover 时一起变亮，不另起一套配色。 */
.nv-acts {
    position: relative; z-index: 1;
    margin-left: auto; display: inline-flex; align-items: center; gap: 0;
    flex: 0 0 auto;
}
.nv-act {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 10px; border: 0; border-radius: 8px;
    background: none; color: var(--t4); cursor: pointer;
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    letter-spacing: .02em; line-height: 1; white-space: nowrap;
    transition: color .18s ease, background .18s ease;
}
.nv-act svg {
    width: 15.5px; height: 15.5px; flex: 0 0 auto;
    fill: none; stroke: var(--brand, #f59a45); stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}
.nv-act:hover { color: var(--t1); background: rgba(148,163,184,.10); }
.nv-act:focus-visible { outline: 2px solid rgba(249,115,22,.55); outline-offset: 1px; }
/* 刷新进行中：图标原地转，做出「确实在拉数据」的反馈 */
.nv-act.busy svg { animation: nvspin .9s linear infinite; }
@keyframes nvspin { to { transform: rotate(360deg); } }

/* ③ 世界时钟（2026-11-17）
   导航右侧、收藏之前：悉尼 / 东京 / 伦敦 / 纽约 四个金融中心的当地时间。
   它只做「读时间」一件事，所以不做按钮态、不参与导航选中，也不另起一套配色：
   城市名走 t4、时间走 t2，hover 才提亮一档，跟旁边的收藏/分享/刷新同一个重量。
   时间用 tabular-nums 等宽数字，秒针走的时候数字不会左右抖。 */
.nv-clock {
    display: inline-flex; align-items: center; gap: 5px;
    flex: 0 0 auto; margin-right: 8px;
}
.nv-clock .clk {
    display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
    padding: 4px 7px; border-radius: 7px; line-height: 1;
    white-space: nowrap; cursor: default;
    transition: background .18s ease;
}
.nv-clock .clk:hover { background: rgba(148,163,184,.09); }
.nv-clock .fl {
    width: 19px; height: 12.5px; flex: 0 0 auto; display: block;
    border-radius: 2.5px; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,.10), 0 1px 2px rgba(0,0,0,.45);
}
.nv-clock .fl svg { display: block; width: 100%; height: 100%; }
.nv-clock .cn {
    font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: var(--t4);
}
.nv-clock .ct {
    font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--t2);
    font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
    min-width: 37px; text-align: right;
    transition: color .18s ease;
}
.nv-clock .clk:hover .ct { color: var(--t1); }

/* 轻提示：收藏/分享/刷新的结果就地回一句，不弹窗、不占版面 */
#fgToast {
    position: fixed; left: 50%; bottom: 26px; z-index: 9998;
    max-width: calc(100vw - 32px);
    padding: 9px 16px; border-radius: 9px;
    border: 1px solid rgba(154,174,201,.20);
    background: rgba(17,25,35,.97);
    box-shadow: 0 16px 36px -20px #000;
    color: var(--t2); font-size: 12.5px; line-height: 1.5;
    text-align: center; letter-spacing: .02em;
    opacity: 0; transform: translate(-50%, 10px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
#fgToast.on { opacity: 1; transform: translate(-50%, 0); }

/* 收藏引导气泡（coach mark）
   用户想要「点一下就直接弹出浏览器右上角的收藏框」—— 这个做不到，已实测确认：
     window.external.AddFavorite          → undefined（IE 独有，Chrome/Edge 已移除）
     document.execCommand('AddToBookmarks') → 返回 false（无效命令）
     window.open('chrome://bookmarks/')     → 返回 null（被拦截）
     派发合成 Ctrl+D 事件                 → isTrusted=false，浏览器 UI 不响应
     window 上任何 bookmark 命名空间        → 不存在
   这是浏览器的安全边界（否则任何网站都能偷偷给你塞书签），网页拿不到书签权限，
   chrome.bookmarks 只对插件开放。所以退一步做成「最接近的一步式」：点击瞬间先把网址
   复制好写进剪贴板，气泡浮在按钮正上方、箭头朝下点住按钮（箭头朝上指浏览器地址栏的 ☆），
   用户只要按 Ctrl+D 回车就完成收藏。 */
#navFavTip {
    position: fixed; z-index: 9999; pointer-events: none;
    padding: 10px 13px 11px; border-radius: 11px;
    border: 1px solid rgba(154,174,201,.22);
    background: rgba(17,25,35,.98);
    box-shadow: 0 18px 40px -22px #000;
    color: var(--t2); font-size: 12.5px; line-height: 1.6;
    white-space: nowrap; text-align: left;
    opacity: 0; transform: translate(-50%, 4px);
    transition: opacity .18s ease, transform .18s ease;
}
#navFavTip.on { opacity: 1; transform: translate(-50%, 0); }
#navFavTip::after {
    content: ''; position: absolute; left: 50%; bottom: -5px;
    width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg);
    background: rgba(17,25,35,.98);
    border-right: 1px solid rgba(154,174,201,.22);
    border-bottom: 1px solid rgba(154,174,201,.22);
}
#navFavTip kbd {
    display: inline-block; margin: 0 1px; padding: 0 5px; border-radius: 4px;
    border: 1px solid rgba(154,174,201,.28); border-bottom-width: 2px;
    background: rgba(255,255,255,.06);
    font-family: inherit; font-size: 11.5px; font-weight: 700; color: var(--t1);
}
#navFavTip em { font-style: normal; color: var(--t5); font-size: 11.5px; }
/* 快捷键那一行：把 Ctrl / D 画成键帽，视线落点明确 */
#navFavTip .fvt-key { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; }
#navFavTip .fvt-key kbd {
    min-width: 26px; padding: 2px 7px; text-align: center;
    font-size: 12px; color: var(--t1);
    background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
}
#navFavTip .fvt-key span { color: var(--t5); font-size: 11.5px; }
#navFavTip .fvt-txt { color: var(--t2); }
#navFavTip .fvt-txt b { color: var(--t1); font-weight: 700; }
#navFavTip .fvt-sub { margin-top: 3px; font-size: 11.5px; color: var(--t5); }
#navFavTip .fvt-ok { font-style: normal; color: #34d399; font-weight: 700; }
#navFavTip .fvt-warn { font-style: normal; color: #f59e0b; font-weight: 700; }
#navFavTip .fvt-hint { margin-top: 4px; padding-top: 4px; font-size: 11.5px; color: var(--t5); }

/* ==========================================================================
   非首页的顶栏外观 (2026-11-17)
   --------------------------------------------------------------------------
   首页那条通栏顶栏的数值住在 site-theme.css 末尾的 ROUND 24 段，且只挂
   .site-home。这里把同一组数值挂到其余页面（/cb、/notices、/notice/*、
   /privacy、/terms、/method）的 body 类上：
     · 同样贴屏幕左右边缘、去圆角、只留一条两端渐隐的底线；
     · 内距左右 24px（≤768 收 16px），内容与各页 .wrap 的左缘对齐；
     · 工具组与导航项之间那条渐隐竖线一并补齐。
   首页不受影响 —— 那边由 site-theme.css 的 !important 版本接管，数值相同。
   ========================================================================== */

body.site-page > #navBar,
body.site-notice > #navBar,
body.site-notices > #navBar {
    position: relative;
    z-index: 60;
    margin: 0;
    padding: 9px 24px;
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(20, 29, 42, .97), rgba(13, 20, 31, .93));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05),
                0 14px 30px -28px rgba(0, 0, 0, .95);
    backdrop-filter: blur(16px) saturate(112%);
    -webkit-backdrop-filter: blur(16px) saturate(112%);
    /* 行高压成首页那档：各页 body 的 line-height 不一样（法务页 1.85、cb 1.6、
       首页 1.5），导航项没写 line-height 时会各算各的，条高于是差 2~3px，
       换页时顶栏会轻微抖一下。这里钉死，全站同高。 */
    line-height: 1.5;
}

body.site-page > #navBar::after,
body.site-notice > #navBar::after,
body.site-notices > #navBar::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    pointer-events: none;
    background: linear-gradient(90deg,
        rgba(148, 163, 184, .05) 0%,
        rgba(148, 163, 184, .20) 20%,
        rgba(154, 174, 201, .34) 50%,
        rgba(148, 163, 184, .20) 80%,
        rgba(148, 163, 184, .05) 100%);
}

body.site-page > #navBar .nv-acts::before,
body.site-notice > #navBar .nv-acts::before,
body.site-notices > #navBar .nv-acts::before {
    content: '';
    flex: 0 0 auto;
    width: 1px;
    height: 20px;
    margin: 0 9px 0 6px;
    background: linear-gradient(180deg, transparent, rgba(148, 163, 184, .26), transparent);
}

/* 导航项与首页同档：13px / t4 / 7×14 内距；选中态用同一份淡橙（不发光）。
   注意用子选择器 > a：下拉面板里的 .nv-menu a 是「列表项」，不能跟着变胶囊。 */
body.site-page > #navBar > a,
body.site-notice > #navBar > a,
body.site-notices > #navBar > a {
    padding: 7px 14px;
    border-radius: 7px;
    color: var(--t4);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
}
body.site-page > #navBar > a:hover,
body.site-notice > #navBar > a:hover,
body.site-notices > #navBar > a:hover {
    color: var(--t1);
    background: rgba(255, 255, 255, .045);
}
body.site-page > #navBar > a.on,
body.site-notice > #navBar > a.on,
body.site-notices > #navBar > a.on {
    color: var(--brand-soft);
    background: rgba(245, 154, 69, .1);
    box-shadow: inset 0 0 0 1px rgba(245, 154, 69, .25);
}
body.site-page > #navBar > a.on::before,
body.site-notice > #navBar > a.on::before,
body.site-notices > #navBar > a.on::before {
    background: var(--brand);
    box-shadow: none;
}

@media (max-width: 768px) {
    body.site-page > #navBar,
    body.site-notice > #navBar,
    body.site-notices > #navBar {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ===== 窄屏（≤640）：导航自身的收缩规则 =====
   原先写在首页内联样式里，只有一处例外：内距与圆角交给上面那条通栏规则管，
   这里不再重复写，免得把「贴边通栏」又变回圆角卡片。 */
@media (max-width: 640px) {
    #navBar { gap: 5px; flex-wrap: wrap; row-gap: 5px; }
    #navBar .nv-gb { font-size: 13px; padding: 5px 10px 5px 11px; gap: 5px; }
    #navBar .nv-menu { min-width: 150px; max-width: min(72vw, 260px); }
    #navBar .nv-menu a { font-size: 12.5px; padding: 8px 10px; }
    .nv-act { padding: 6px 7px; gap: 5px; font-size: 12.5px; }
    .nv-act svg { width: 13.5px; height: 13.5px; }
    /* 世界时钟：四城横排会把这行撑爆，改成工具组独占一行 ——
       第一行四等分放时钟，第二行三个按钮靠右。竖线在手机上多余，去掉。 */
    #navBar .nv-acts { width: 100%; margin-left: 0; flex-wrap: wrap; row-gap: 3px;
                       padding-top: 5px; border-top: 1px solid rgba(148,163,184,.12); }
    body > #navBar .nv-acts::before { display: none !important; }
    #navBar .nv-clock { width: 100%; justify-content: space-between; margin: 0 0 2px; gap: 0; }
    .nv-clock .clk { padding: 3px 4px; gap: 5px; }
    .nv-clock .fl { width: 16px; height: 10.5px; border-radius: 2px; }
    .nv-clock .cn { font-size: 11.5px; letter-spacing: .02em; }
    .nv-clock .ct { font-size: 12px; min-width: 34px; }
    #navBar .nv-acts .nv-act:first-of-type { margin-left: auto; }
}

/* ===== 极窄屏（≤420）：把五项塞回一行 =====
   2026-11-18 导航加了「数据」分类后，390 宽的机器上「关于本站」被挤到单独一行，
   导航条从 111px 长到 139px —— 顶上多占的这 28px 等于整屏的 1/14。
   这里只收内距与字号，不改字号层级：五个项目回到一行，条高回到 111。 */
@media (max-width: 420px) {
    #navBar { gap: 4px; }
    /* 必须带 body.site-* 前缀：上面「通栏导航」那组规则用的是
       body.site-page > #navBar > a（0,2,2），只写 #navBar a（0,1,1）压不住它。 */
    body.site-page > #navBar > a,
    body.site-notice > #navBar > a,
    body.site-notices > #navBar > a {
        padding: 7px 8px; font-size: 12.5px; letter-spacing: 0;
    }
    #navBar .nv-gb { font-size: 12.5px; padding: 5px 7px 5px 9px; gap: 4px; }
    #navBar .nv-caret { width: 8px; }
    /* 时钟：360 宽的机器上「旗帜 + 城市名 + 时间」四组放不进一行，
       最后一组会溢出到屏幕外（被 overflow-x:hidden 裁掉，看上去像少了个城市）。
       这里藏掉城市名只留旗帜与时间，四组刚好铺满；城市名仍在 title 里。 */
    #navBar .nv-clock .cn { display: none; }
    #navBar .nv-clock .clk { padding: 3px 2px; }
}
