/* 站点统一导航栏样式（仅作用于 .header / .footer 相关类，不污染页面自身布局）
 * 由 /js/navigation-loader.js 自动注入，供所有页面（含自包含单文件页）复用。
 * 不要在此写入 * / body / .container 等全局选择器，避免与工具页自有样式冲突。
 */
/* ============================================================
   导航/页脚容器宽度（2026-10-28 补入本文件）
   ------------------------------------------------------------
   为什么放在这里：navigation-loader.js 里也有一份同样的注入，
   但那文件是 /js/navigation-loader.js?v=固定版本号 → 浏览器会长期缓存，
   老缓存里没有这段规则，展厅页（自包含页、不引 style.css）就仍是满宽，
   「嵩叙综合服务平台」与「首页」之间空出一大段。
   本文件是通过 ?t=Date.now() 加载的 → 每次都是新地址，永不吃缓存，
   规则放这里对所有浏览器立即生效。
   只作用于 #header-placeholder / #footer-placeholder 内部的 .container，
   不碰页面正文里的同名类，对任何页面都安全。
   ============================================================ */
#header-placeholder .container {
    width: 100% !important;
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}
#footer-placeholder .container {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

.header {
    background-color: #0F52BA;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 导航内部元素的浏览器默认边距归零（2026-09-20 修复）
 * 全站多数页面都引了 /css/style.css（内含 * { margin:0; padding:0 } 全局 reset），
 * 顶栏自然紧凑 —— 标准高度 73px。但部分工具页是自包含单文件、未引主样式，
 * 浏览器默认的 h1{margin:21px} 与 ul{padding-left:40px} 会把顶栏撑到 113px，
 * 导航也会右侧多缩进 40px，与全站观感不一致。
 * 这里做「作用域限定在 .header 之内」的局部归零：不使用 * / body / .container
 * 这类全局选择器，因此不会影响任何页面的正文布局。
 * 注意：button 不列入（.header button 的优先级会盖掉 .manual-btn 自己的 padding）。 */
.header h1,
.header p,
.header ul,
.header li {
    margin: 0;
    padding: 0;
}
.header ul { list-style: none; }

.header .container {
    display: flex;
    justify-content: center;
    align-items: center;
    /* 【2026-10-10 修复】桌面端顶部导航「始终保持一排」：不再折行，放不下时菜单区横向滑动 */
    flex-wrap: nowrap;
    /* 左右各 16px：logo(278)+导航(804)+手册(90)+间距 ≈1232px，
       原先 30px 内边距导致可用宽仅 1220px，宽屏下也会被迫换行 */
    padding: 9px 16px;
    gap: 15px;
}

.logo {
    cursor: pointer;
    /* 16px：logo+导航+手册合计约 1216px，须小于容器内宽（1280-2×16=1248），
       否则宽屏下也会被 flex-wrap 折成两行 */
    margin-right: 16px;
}

.logo h1 {
    font-size: 1.7rem;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.logo p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
    margin-top: 4px;
}

.nav {
    display: flex;
    justify-content: center;
    /* 【2026-10-28 修复】菜单总宽超出可视区时，center 居中会把首项顶到容器左边界之外，
     * 那一段又滚不回去，于是「首页」两个字被裁得只剩一个「页」字。
     * safe center 的语义：装得下就居中（与原来一致），装不下自动退回左对齐并允许横向滑动，
     * 保证任何宽度下菜单文字都不会被裁掉。旧浏览器不认这个值会丢弃该条声明，仍用 center。 */
    justify-content: safe center;
    /* 【2026-10-10 再修复】桌面宽屏(>1280px)也必须「始终一排」：
       此前 no-wrap + 横向滑动只写在 @media(max-width:1280px) 里，宽屏不触发，
       导致 11 个菜单项把 .nav ul 撑超宽后按默认 flex-wrap:wrap 折成两排。
       这里把伸缩+横向滑动提到默认规则，所有宽度统一为一排。 */
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav ul {
    display: flex;
    list-style: none;
    /* 16px：为宽屏单行留出余量（见 .logo 注释） */
    gap: 16px;
    /* 关键：永不折行；内容超宽时由 .nav 横向滑动，而不是换行成两排 */
    flex-shrink: 0;
    flex-wrap: nowrap;
    margin: 0 auto;
    min-width: max-content;
}

.nav ul li a {
    color: white;
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 500;
    padding: 6px 0;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
    white-space: nowrap;
}

.nav ul li a:hover { border-bottom-color: white; }

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 顶部安装入口已废弃（2026-09-14 起）：全站仅首页与工具箱首页以右下角「分享到桌面」提供。
 * 此处用 !important 永久隐藏，兜底防止任何页面残留该节点时再次显示、挤占导航空间。 */
.pwa-install { display: none !important; }   /* 顶部安装入口已废弃：永久不显示 */

.install-btn {
    background-color: #FF6B00;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.install-btn:hover { background-color: #E55A00; }

/* 中窄屏（≤1280px，2026-10-08 按用户要求重做）：
 * 桌面端顶部导航「始终一排显示」，不再折成 logo 一行 + 菜单一行。
 * 放不下时 logo/注册按钮固定，菜单区内部横向滑动（隐藏滚动条，带渐隐提示）。 */
@media (max-width: 1280px) {
    .header .container {
        flex-wrap: nowrap;
        padding: 9px 12px;
        gap: 12px;
    }
    .logo { margin-right: 0; }
    .logo h1 { font-size: 1.3rem; }
    .nav {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav ul {
        flex-direction: row;
        flex-wrap: nowrap;
        margin: 0 auto;
        gap: 0;
        padding: 0;
        min-width: max-content;
    }
    .nav ul li { flex-shrink: 0; }
    .nav ul li a {
        display: block;
        padding: 8px 9px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    /* 菜单被裁时提示「可横向滑动」的渐隐遮罩（navigation-loader.js 动态加类） */
    .nav.more-right {
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
    }
    .nav.more-left {
        -webkit-mask-image: linear-gradient(to right, transparent, #000 26px);
        mask-image: linear-gradient(to right, transparent, #000 26px);
    }
    .nav.more-left.more-right {
        -webkit-mask-image: linear-gradient(to right, transparent, #000 26px, #000 calc(100% - 26px), transparent);
        mask-image: linear-gradient(to right, transparent, #000 26px, #000 calc(100% - 26px), transparent);
    }
}

/* 移动端：导航栏横向滚动，始终可见 */
@media (max-width: 800px) {
    .header .container {
        flex-direction: row;
        text-align: left;
        padding: 10px 15px;
        position: relative;
        flex-wrap: wrap;
    }
    .mobile-menu-btn { display: none; }
    .nav {
        display: block;
        width: 100%;
        order: 3;
        margin-top: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav ul {
        flex-direction: row;
        flex-wrap: nowrap;
        margin-top: 0;
        gap: 0;
        padding: 0;
        min-width: max-content;
    }
    .nav ul li { flex-shrink: 0; }
    .nav ul li a {
        display: block;
        padding: 8px 12px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    /* 移动端也不再显示已废弃的顶部安装入口 */
    .pwa-install { display: none !important; }
    .install-btn {
        background-color: #FF6B00;
        color: white;
        border: none;
        padding: 6px 12px;
        border-radius: 15px;
        font-size: 0.8rem;
        cursor: pointer;
        white-space: nowrap;
    }
    .install-btn:hover { background-color: #E55A00; }
}
