/* ===========================================================
   站点头部组件（.header = 顶部条 .header__top + 主导航 .header__nav）
   -----------------------------------------------------------
   结构：resources/views/pc/partials/header.php（类名与本节一一对应）
   行为：assets/js/site-nav.js（搜索预算/选中态）、header-user-menu.js（用户卡）、
         city-selector.js（城市面板）
   规范：docs/specs/header-nav-v7-20261124.md（间距曲线/绘制模型/坑表）
   命名：块 .header + 元素 .header__*；子组件 .nav-dropdown / .user-menu / .header-search。
         ⛔ 不再新增裸类名（旧 .idc / .util / .uico / .utx / .um-* 已于 2026-11-24 统一）
   加载：modern.css → site-shell.css → site-header.css（base 在前，组件在后）
   =========================================================== */

/* ---------- 1. 主题令牌 ---------- */
/* 首页滚动进度：0=顶部毛玻璃态，1=完全变为内页态
   由 /assets/js/site-home.js 写入 <html> 的行内 style，经继承到达本文件全部选择器。
   此处给默认 0 兜底：即便脚本未执行（JS 报错/被拦截），也只是停在毛玻璃态，
   不会因变量未定义导致整条规则失效（RGBA 中未解析的 var() 会让声明无效）。 */
:root {
    --home-scroll: 0;
}

/* 顶部条：黑底白字（theme-inner 恒定态 = theme-home 滚动到底态） */
.header__top {
    --t-bg: #101014;
    --t-fg-weak: rgba(255, 255, 255, .88);
    --t-hover: #ffffff;
    /* 顶部条按钮底：与搜索框（--nav-field-bg）在液态玻璃态下的透明观感对齐（白 .20），
       悬停加深到 .32。
       ⛔ 刻意**不**随 --home-scroll 插值到 1.0（搜索框会，因为滚动后导航条底变白）：
          顶部条底色恒为深色 #101014，若按钮底也变白就是白底白字（与 --nav-solid 同类的坑）。 */
    --t-chip-bg: rgba(250, 250, 250, .20);
    --t-chip-bg-hover: rgba(250, 250, 250, .32);
    --t-chip-fg: #ffffff;
}

/* 导航条：白底黑字（内页恒定态 = 首页滚动后态） */
.header__nav {
    --nav-bg: #ffffff;
    --nav-border: #eeeeee;
    --nav-fg: #1f2329;
    --nav-hover: rgba(66, 61, 255, .72);   /* 半透明品牌色：与选中态实色 --nav-active 区分 */
    --nav-active: #423dff;
    --nav-field-bg: #fafafa;
    --nav-panel-bg: #ffffff;
    --nav-panel-shadow: 0 8px 24px rgba(15, 23, 42, .14);
    --nav-panel-radius: 8px;
    --nav-dropdown-gap: 14px;
    /* 实心主色块专用（搜索按钮底色）。
       ⛔ 不能借用 --nav-hover：首页液态玻璃下 --nav-hover 是浅色半透明（文字/悬停色），
          用它做按钮底会变成白底白图标，放大镜完全不可见。
       本令牌恒定，不参与 --home-scroll 插值（与旧 Vue 组件的主色按钮语义一致）。 */
    --nav-solid: #423dff;
}

/* 首页（body.theme-home）：随滚动由「轻薄毛玻璃」连续过渡到「内页恒定态」
   —— backdrop-filter 让 banner 视频/图片从 header 下方模糊透出（用户裁决取轻薄档）。
      ⚠️ 两条只剩下背景色差异：模糊（18px）与阴影都统一挂在 .header 一层，
         否则会在两条交界处产生清晰度突变与暗边接缝 —— 详见 .header 处的注释。
      逐项数值推导见文件头注释第二段。 */

/* 顶部条：p=0 与 .header__nav 完全同色（一整块玻璃）→ p=1 纯黑 #101014
   模糊与阴影已在 .header 一层统一处理，此处只负责背景色。 */
body.theme-home .header__top {
    background-color: rgba(16, 16, 20, calc(.20 + .80 * var(--home-scroll, 0)));
    /* 文字：暗底的 .86 白 → 纯黑底的纯白，保证全程可读 */
    --t-fg-weak: rgba(255, 255, 255, calc(.86 + .14 * var(--home-scroll, 0)));
}

/* 主导航：p=0 与 .header__top 完全同色（一整块玻璃）；随滚动白色 overlay 渐显，
   底色同步淡出 —— p=1 即纯白 #ffffff
   （用「底色 + background-image 白层」而非单色插值，避免中途经过浑浊的灰色） */
body.theme-home .header__nav {
    background-color: rgba(16, 16, 20, calc(.20 * (1 - var(--home-scroll, 0))));
    background-image: linear-gradient(
        rgba(255, 255, 255, var(--home-scroll, 0)),
        rgba(255, 255, 255, var(--home-scroll, 0))
    );

    /* 底边线：p=0 完全透明（毛玻璃中间不留线），随滚动渐显为 #eeeeee */
    --nav-border: rgba(238, 238, 238, var(--home-scroll, 0));
    /* 主文字：#ffffff → #1f2329（逐通道：255→31 / 255→35 / 255→41） */
    --nav-fg: rgb(
        calc(255 - 224 * var(--home-scroll, 0)),
        calc(255 - 220 * var(--home-scroll, 0)),
        calc(255 - 214 * var(--home-scroll, 0))
    );
    /* 悬停：半透明（p=0 半透明白 → p=1 半透明品牌色），与选中态实色区分；
       同时解决 p=0 时 hover 与默认同为纯白、悬停零反馈的问题。
       ⚠️ 三个系数 = 255 - 目标通道值（189/194/0），改主色时**必须同步重算**，
          否则 p=1（滚动到底）会插值到旧色，首页滚动后菜单颜色与内页不一致。 */
    --nav-hover: rgba(
        calc(255 - 189 * var(--home-scroll, 0)),
        calc(255 - 194 * var(--home-scroll, 0)),
        calc(255 - 0 * var(--home-scroll, 0)),
        .72
    );
    /* 选中态：实色（p=0 纯白 → p=1 品牌色）。
       ⛔ 不要写成 var(--nav-hover)——那会让首页选中态也是半透明，与悬停无法区分 */
    --nav-active: rgb(
        calc(255 - 189 * var(--home-scroll, 0)),
        calc(255 - 194 * var(--home-scroll, 0)),
        calc(255 - 0 * var(--home-scroll, 0))
    );
    --nav-field-bg: rgba(250, 250, 250, calc(.20 + .80 * var(--home-scroll, 0)));
    /* ⛔ 故意不覆盖 --nav-solid：
       实心主色块（搜索按钮）在两端都保持品牌蓝，否则 p=0 时白底白图标不可见。
       液态玻璃下按钮与白色描边同色，靠按钮自身的深蓝底 + 白图标建立对比。 */
}
/* ---------- 2. 容器 ---------- */
.header__top > .container,
.header__nav > .container {
    /* 2026-10-27 自适应：定宽 → 流式（与 .container 系统一致，窄视口跟随收缩）；
       上限改引用 --container-max（超宽屏随全站容器一同放宽，主流屏仍 1250） */
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
}

/* 顶部条容器：三段式 flex（左城市 / 中菜单居中 / 右按钮） */
.header__top > .container {
    display: flex;
    align-items: center;
    height: 46px;
}

/* 主导航容器：同样三段式 flex（左 logo / 中菜单居中 / 右搜索框）。
   ⛔ 原为纯 float 结构（容器靠 ::after clearfix 包含），菜单只能左对齐堆叠；
      现改 flex 后菜单才能像 .header__topbar 那样在剩余空间内居中。
      float 的清除由 flex 自身完成，故移除 clearfix。 */
.header__nav > .container {
    display: flex;
    align-items: center;
    height: 74px;
}

/* 菜单包裹层：占据 logo 与搜索框之间的全部空间。
   「居中」口径（2026-10-29 用户澄清）：菜单组距左侧 logo 与右侧搜索框的距离相等，
   即居中于剩余空间，不追求与容器中线重合。实现 = 首末项 auto 边距（见下方规则）：
   未溢出时两端剩余空间均分（左右等距）；溢出时 auto 归零 → 左对齐可完整横滑（不裁两端）。
   ⛔ 不要用 padding-left 补偿把菜单推到容器中线 —— 那会让左右间距不相等（用户明确否决）。 */
.header__menu {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    /* v6：间距唯一真源；留白 = 间距 + 8（见 .header__nav 令牌注释） */
    gap: var(--nav-gap);
    gap: round(var(--nav-gap), 1px);
    padding-inline: calc(var(--nav-gap) + 8px);
    padding-inline: calc(round(var(--nav-gap), 1px) + 8px);
    min-width: 0;
    height: 74px;
    /* ⛔ 不加 transition：间距只随窗口变化，过渡会让 resize 时菜单「追着跑」 */
}

/* ---------- 2.5 头部容器（唯一 fixed/sticky 定位上下文，z-index 收敛到这一层） ---------- */
.header {
    position: relative;
    z-index: 1000;
}
body.theme-home .header {
    position: fixed;      /* 首页：脱离文档流悬浮于 banner 之上，滚动渐变 */
    top: 0;
    left: 0;
    right: 0;
    /* 毛玻璃与阴影统一收敛在这一层（不可下沉到 .header__top / .header__nav）：
       1) backdrop-filter 是逐元素独立对自身 border-box 采样的 —— 若两条各设各的
          半径，会在 y=46px 交界处出现清晰度突变的横向接缝；
       2) box-shadow 若设在 .header__nav，其向上的溢出会绘制覆盖到 .header__top
          下沿，在交界处叠出暗边（两条都是 static，nav 在 DOM 中靠后故绘制在上）。
       提到 .header 后：整条 120px 一次采样、阴影只在整条底部，视觉是一整块玻璃。 */
    backdrop-filter: blur(calc(18px * (1 - var(--home-scroll, 0)))) saturate(1.08);
    -webkit-backdrop-filter: blur(calc(18px * (1 - var(--home-scroll, 0)))) saturate(1.08);
    box-shadow: 0 2px 16px rgba(15, 23, 42, calc(.10 + .10 * var(--home-scroll, 0)));
}
body.theme-inner .header {
    position: sticky;     /* 内页：吸顶，文档流占位，顶部广告条自然滚走后固定 */
    top: 0;
}

/* ---------- 3. 顶部条 (.header__top) ---------- */
/* 无 border-bottom：原 `1px solid var(--t-border)` 恒为 transparent（全站无场景覆盖），
   却在 content-box 下把外高从 46 撑到 47（导航条 y=47，城市浮层 top:46 反被压 1px）。
   2026-11-14 删除后外高回到 46，与注释/设计值一致。⛔ 不要为「分割线」把它加回来：
   顶条深色与导航白色交界本身已是强对比；真需要分割线应加在 .header__nav 顶部。 */
.header__top {
    /* v7：与主导航同一套规则 —— 项间距唯一真源，侧留白 = 间距 + 8。
       间距随视口连续插值，恒在 [20px, 40px]；锚点 1020→40、880→20。
       顶条在 900 的物理上限只有约 24px（再大就裁字），所以它的曲线比主导航陡。 */
    --top-gap: clamp(20px, calc(14.286vw - 105.714px), 40px);

    height: 46px;
    background: var(--t-bg);
}

/* ---------- 3.1 左：城市（京东 hover-title 范式） ---------- */
.header__top .header__city {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 46px;
    cursor: pointer;
    font-size: 13px;
    color: var(--t-fg-weak);
    white-space: nowrap;
}

    .header__top .header__city:hover {
        color: var(--t-hover);
    }

    .header__top .header__city .header__city-name {
        color: inherit;
    }

    .header__top .header__city .header__city-tip {
        margin-left: 4px;
        color: var(--t-fg-weak);
        opacity: .7;
    }

    /* 已选定城市：城市名改用强调色，[切换] 隐藏（切换动作由点击整块触发） */
    .header__top .header__city.is-active .header__city-name {
        color: var(--t-hover);
        font-weight: 700;
    }

    .header__top .header__city.is-active .header__city-tip {
        display: none;
    }

/* ---------- 3.2 中：顶部细条菜单 + 电话（2026-11-23 重写：等距 40px） ----------
   口径变更：从「每项 margin:0 16px（相邻 32px）+ 首末 auto 居中」改为
   「父级 gap:40px + justify-content:center」——
   · 间距唯一真源 = 父级 gap，所有菜单项（含电话）之间的视觉间隔恒等 40px；
   · 单项不再持有水平 margin → .header__phone 与 .header__toplink 的 margin 口径自然一致（均 0）；
   · 居中由 justify-content 承担，无需首末 auto 边距（旧方案在电话隐藏的窄屏会左宽右窄）。
   ⛔ 不要再给 .header__toplink / .header__phone 加水平 margin 或父级改回 margin 方案——会破坏等距。 */
.header__top .header__topbar {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--top-gap);
    gap: round(var(--top-gap), 1px);   /* 取整：变量里不出现 22.857143；不支持 round() 则沿用上一行 */
    /* 侧留白 = 项间距 + 8：左「全国/切换」与右「消息」永远不会贴住中段菜单 */
    padding-inline: calc(var(--top-gap) + 8px);
    padding-inline: calc(round(var(--top-gap), 1px) + 8px);
    height: 46px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

    .header__top .header__toplink {
        flex: 0 0 auto;
        height: 19px;
        line-height: 19px;
        font-size: 13px;
        color: var(--t-fg-weak);
        transition: color .18s ease;
    }

        .header__top .header__toplink:hover {
            color: var(--t-hover);
        }

    /* 客服电话：图标 15px 起始于元素左缘（padding-left 为图标区），
       与前一菜单的视觉间隔即 gap 18px，与其他菜单项严格等距。 */
    .header__top .header__phone {
        flex: 0 0 auto;
        height: 19px;
        line-height: 19px;
        padding-left: 19px;
        text-align: left;
        color: var(--t-fg-weak);
        font-size: 13px;
        white-space: nowrap;
        /* 顶部条恒为深色底（黑/毛玻璃白纱），电话图标统一用白色版。
           🔴 相对 URL 以本文件（assets/css/）为基准：../images = assets/images；
              曾误写 ../assets/images → 解析成 assets/assets/images（404，图标消失）。 */
        background: url(../images/icons/phone-white.png) left center no-repeat;
        background-size: 15px;
    }

/* ---------- 3.3 右：操作按钮（未登录）/ 单头像用户菜单（已登录） ---------- */
.header__top .header__account {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 46px;
}

/* 工具簇（2026-11-23 竖排终版）：消息 / 收藏 / 历史，游客与登录同显。
   icon 在上、文字在下（36px 等宽三联、icon 18px、文字 12px/行高14、icon-文字 gap 2px、簇内 gap 8px）；
   间距口径：组内视觉 ≈26px（静默 9×2 + 8）、组间（身份位 margin 26px）≈35px —— 分组差 9px，
   三项成组、胶囊/头像独立（⛔ 组间不得小于组内，否则分组倒挂）。
   颜色与 .header__toplink 同源：var(--t-fg-weak) / hover var(--t-hover) ——
   首页滚动渐亮（--t-fg-weak 覆盖）对工具簇同步生效，⛔ 不要硬编码 .88。 */
.header__top .header__tools {
    display: flex;
    align-items: center;
    height: 46px;
    gap: 8px;
}

    .header__top .header__tools .header__tool {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        width: 36px;
        height: 46px;
        color: var(--t-fg-weak);
        text-decoration: none;
        transition: color .18s ease;
    }

        .header__top .header__tools .header__tool:hover {
            color: var(--t-hover);
        }

        .header__top .header__tools .header__tool .header__tool-icon {
            position: relative;
            display: inline-flex;
        }

        .header__top .header__tools .header__tool svg {
            width: 18px;
            height: 18px;
            fill: none;
            stroke: currentColor;
            stroke-width: 1.6;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .header__top .header__tools .header__tool .header__tool-label {
            font-size: 12px;
            line-height: 14px;
            letter-spacing: .02em;
        }

        /* 未读红点：挂图标右上，只提示有无、不显数字（数字在消息页/面板） */
        .header__top .header__tools .header__tool .header__tool-icon .header__tool-dot {
            position: absolute;
            top: -5px;
            right: -6px;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #D50032;
            font-style: normal;
        }

/* 游客身份位：「登录/注册」胶囊（26px，芯片同款配色，同槽位对齐登录头像）。
   字号 13px = 顶条改版前旧芯片（btn-login）字号；line-height 26px 显式撑满胶囊
   消除全局行高继承差异；align-self:center 纵深防御——即使 .header__account 的
   align-items 被误改，胶囊仍自我垂直居中（几何实测中心 = 顶条中心 = 23px）。
   margin-left 17px：组间视觉间距 = 静默 9 + 17 = 26px，与簇内图标间距（26px）相等。 */
.header__top .header__login {
    display: flex;
    align-items: center;
    align-self: center;
    height: 26px;
    margin-left: 17px;
    padding: 0 12px;
    border-radius: 13px;
    background-color: var(--t-chip-bg);
    color: var(--t-chip-fg);
    font-size: 13px;
    line-height: 26px;
    letter-spacing: .02em;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .18s ease;
}

    .header__top .header__login:hover {
        background-color: var(--t-chip-bg-hover);
    }

/* 已登录：只有一枚头像（2026-11-14 引入；2026-11-23 双头像贴边卡重构）
   ------------------------------------------------------------
   头像 24×24 贴右、垂直居中，**原位不动**——旧「放大 2.0833 倍滑到面板中线」
   的共享元素动画已废弃。原因：顶条加入工具簇后，头像落点（面板中线 = 距容器
   右缘 170px）会正压「消息」图标，且滑移斜穿整个图标簇；面板改为右贴容器、
   卡内自带头像名片行（.user-menu__idcard），几何零冲突（分析记录见 2026-11-23 日志）。

   🔴 开合状态只由 JS 的 .is-open 驱动，⛔ 不要改回 :hover。
   原因（2026-11-14 实测）：:hover 会形成正反馈循环；状态交给
   /assets/js/header-user-menu.js（trigger 悬停打开、离开 180ms 宽限关闭）。 */
.header__top .user-menu {
    --um-avatar: 24px;
    /* 2026-11-23：340 → 300。主流内容型 popover 宽度 280–320（GitHub hovercard ≈296、
       规范建议上限 320），340 偏宽导致头部与菜单留白过多。 */
    --um-panel-w: 300px;
    position: relative;
    flex: 0 0 var(--um-avatar);
    width: var(--um-avatar);
    height: 46px;
    margin-left: 17px;   /* 组间视觉 26px = 簇内图标间距（与 .header__login 同口径） */
}

    .header__top .user-menu__trigger {
        position: absolute;
        inset: 0;
        display: block;
        /* UA 默认 button 有 2px 边框/内边距：不清零会让 absolute 子元素
           按 padding box 定位，头像整体右下各偏 2px（实测 1311 vs 1313）。 */
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        appearance: none;
        -webkit-appearance: none;
        border-radius: 50%;
    }

        .header__top .user-menu__trigger:focus-visible {
            outline: 2px solid #fff;
            outline-offset: 2px;
        }

    .header__top .user-menu__avatar {
        position: absolute;
        right: 0;
        top: 11px;
        z-index: 2;
        width: var(--um-avatar);
        height: var(--um-avatar);
        border-radius: 50%;
        overflow: hidden;
        display: grid;
        place-items: center;
        background: linear-gradient(135deg, #6b66ff, #423dff);
        box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55);
    }

        .header__top .user-menu__avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .header__top .user-menu__initial {
            font-size: 11px;
            font-weight: 600;
            line-height: 1;
            color: #fff;
            user-select: none;
        }

        /* 身份未水合前：不显示占位字母，用呼吸点表示加载——
           否则 1Mbps 下会先看到一个「U」，容易被当成昵称首字。 */
        .header__top .user-menu__avatar.is-loading .user-menu__initial {
            visibility: hidden;
        }

        .header__top .user-menu__avatar.is-loading::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            width: 6px;
            height: 6px;
            margin: -3px 0 0 -3px;
            border-radius: 50%;
            background: rgba(255, 255, 255, .55);
            animation: um-avatar-pulse 1.4s ease-in-out infinite;
        }

        @keyframes um-avatar-pulse {
            0%, 100% { opacity: .35; transform: scale(.85); }
            50%      { opacity: 1;   transform: scale(1); }
        }

        @media (prefers-reduced-motion: reduce) {
            .header__top .user-menu__avatar.is-loading::after {
                animation: none;
                opacity: .7;
            }
        }

    /* 2026-11-23：旧 .is-open 头像 transform（滑移 + 放大）已随双头像贴边卡方案删除，
       头像原位静止；面板开合动画只作用于卡片本体。 */

    /* 卡片：绝对浮层，不参与文档流 */
    .header__top .user-menu__panel {
        position: absolute;
        top: 46px;
        right: 0;
        z-index: 1;
        width: var(--um-panel-w);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 16px 0 8px;
        background: #fff;
        /* 2026-11-23 方案 A 重设计：无箭头悬浮卡（GitHub / Material 3 范式）。
           归属感靠「11px 间隙（头像下缘 35 → 面板顶 46）+ 右缘对齐头像」传达，
           ⛔ 不再用 ::before 菱形——它与圆角必然露缝且动画不同步（旧 .16s vs .18/.28s）。
           border 0.5px + box-sizing：全局没有 border-box reset，不写会让面板宽变 341。 */
        box-sizing: border-box;
        border: 0.5px solid rgba(16, 24, 40, .10);
        border-radius: 14px;
        box-shadow: 0 18px 44px -18px rgba(15, 23, 42, .30), 0 2px 8px rgba(15, 23, 42, .05);
        transform-origin: 88% 0;   /* 以头像为中心缩放，落点贴合锚点 */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px) scale(.98);
        /* 单一动画：收起/展开共用同一时长与缓动，结构上不可能再异步 */
        transition: opacity .2s ease, transform .2s cubic-bezier(.2, .8, .2, 1),
                    visibility 0s linear .2s;
    }

        .header__top .user-menu__panel::-webkit-scrollbar {
            width: 0;
        }

        .header__top .user-menu.is-open .user-menu__panel {
            opacity: 1;
            visibility: visible;
            transform: translateY(0) scale(1);
            transition: opacity .2s ease, transform .2s cubic-bezier(.2, .8, .2, 1),
                        visibility 0s;
        }

    /* 2026-11-23 方案 A：指向箭头已整体移除（::before 菱形 与 ::before 的 .is-open 规则）。
       删除原因：① 12px 方块落在圆角弧区必然露缝；② 独立 .16s opacity 与面板动画不同步；
       ③ 面板 overflow-y:auto 会裁伪元素，只能挂父级，永远无法同层。⛔ 不要加回。 */

    /* 卡片头：双头像名片行（2026-11-23）——卡内 46px 头像 + 昵称 + 实名徽章 + ID */
    .header__top .user-menu__idcard {
        display: flex;
        align-items: center;
        gap: 12px;
        margin: 0 18px;
        padding-bottom: 13px;
        border-bottom: 1px solid rgba(16, 24, 40, .07);
    }

        .header__top .user-menu__idcard-avatar {
            position: relative;
            flex: 0 0 auto;
            width: 46px;
            height: 46px;
            border-radius: 50%;
            overflow: hidden;
            display: grid;
            place-items: center;
            background: linear-gradient(135deg, #6b66ff, #423dff);
            box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .8), 0 4px 12px -4px rgba(66, 61, 255, .5);
        }

            .header__top .user-menu__idcard-avatar img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
            }

            .header__top .user-menu__idcard-avatar .user-menu__initial {
                font-size: 18px;
            }

            .header__top .user-menu__idcard-avatar.is-loading::after {
                content: "";
                position: absolute;
                top: 50%;
                left: 50%;
                width: 7px;
                height: 7px;
                margin: -3.5px 0 0 -3.5px;
                border-radius: 50%;
                background: rgba(255, 255, 255, .55);
                animation: um-avatar-pulse 1.4s ease-in-out infinite;
            }

        .header__top .user-menu__idcard-who {
            min-width: 0;
        }

        .header__top .user-menu__idcard-name {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 16px;
            font-weight: 700;
            line-height: 1.25;
            color: #1f2329;
        }

            .header__top .user-menu__idcard-name b {
                max-width: 150px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

        .header__top .user-menu__idcard-meta {
            display: block;
            margin-top: 3px;
            font-size: 11px;
            color: #8a91a0;
        }

        .header__top .user-menu__verify {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            height: 19px;
            padding: 0 7px;
            border-radius: 5px;
            background: rgba(66, 61, 255, .08);
            color: #423dff;
            font-size: 11px;
            font-weight: 600;
        }

            .header__top .user-menu__verify--wait {
                background: #f3f4f7;
                color: #8a91a0;
                font-weight: 500;
            }

                .header__top .user-menu__verify--wait:hover {
                    background: #eceef3;
                    color: #4b5563;
                }

    /* 三列统计（足迹 / 收藏 / 购物袋） */
    .header__top .user-menu__stats {
        display: flex;
        margin: 16px 18px 0;
        padding: 12px 0;
        border-radius: 12px;
        background: #f7f8fb;
    }

        .header__top .user-menu__stats a {
            flex: 1;
            padding: 2px 0;
            text-align: center;
            border-radius: 10px;
            transition: background-color .16s ease;
        }

            .header__top .user-menu__stats a:hover {
                background: #f1f3f8;
            }

        .header__top .user-menu__stats b {
            display: block;
            font-size: 19px;
            font-weight: 650;
            line-height: 1.2;
            color: #1f2329;
            font-variant-numeric: tabular-nums;
        }

        .header__top .user-menu__stats span {
            display: block;
            margin-top: 3px;
            font-size: 11.5px;
            color: #8a91a0;
        }

    /* 未实名提示条（已实名时整条不渲染） */
    .header__top .user-menu__cta {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 12px 18px 2px;
        padding: 11px 12px;
        border-radius: 12px;
        background: linear-gradient(135deg, #eeeaff, #f8f3ff);
    }

        .header__top .user-menu__cta-text {
            flex: 1;
            min-width: 0;
            font-size: 12.5px;
            line-height: 1.5;
            color: #4b3fb5;
        }

            .header__top .user-menu__cta-text b {
                display: block;
                font-size: 12.5px;
                font-weight: 600;
            }

            .header__top .user-menu__cta-text span {
                display: block;
                margin-top: 1px;
                font-size: 11px;
                color: #8b83c4;
            }

        .header__top .user-menu__cta-btn {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            height: 27px;
            padding: 0 12px;
            border-radius: 14px;
            background: #fff;
            color: #423dff;
            font-size: 11.5px;
            font-weight: 600;
            box-shadow: 0 1px 4px rgba(66, 61, 255, .16);
            transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .16s ease;
        }

            .header__top .user-menu__cta-btn:hover {
                transform: translateY(-1px);
                box-shadow: 0 4px 10px rgba(66, 61, 255, .22);
            }

            .header__top .user-menu__cta-btn:active {
                transform: none;
            }

        .header__top .user-menu__cta[hidden] {
            display: none;
        }

    /* 菜单项 */
    .header__top .user-menu__list {
        padding: 8px 10px 0;
    }

    .header__top .user-menu__item {
        display: flex;
        align-items: center;
        gap: 11px;
        height: 44px;
        padding: 0 12px;
        border-radius: 10px;
        font-size: 14px;
        color: #4b5563;
        transition: background-color .16s ease, color .16s ease,
                    transform .16s cubic-bezier(.2, .8, .2, 1);
    }

        .header__top .user-menu__item svg {
            flex: 0 0 auto;
            width: 20px;
            height: 20px;
            color: #7f8798;
            transition: color .16s ease;
        }

        .header__top .user-menu__item-label {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .header__top .user-menu__item-chev {
            width: 14px;
            height: 14px;
            color: #c8ced9;
            transition: color .16s ease, transform .16s cubic-bezier(.2, .8, .2, 1);
        }

        .header__top .user-menu__item:hover {
            background: #f4f6fa;
            color: #1f2329;
            transform: translateX(2px);
        }

            .header__top .user-menu__item:hover svg {
                color: #423dff;
            }

            .header__top .user-menu__item:hover .user-menu__item-chev {
                color: #423dff;
                transform: translateX(2px);
            }

        .header__top .user-menu__item:active {
            background: #eceff6;
            transform: translateX(2px) scale(.995);
        }

        .header__top .user-menu__item:focus-visible {
            outline: 2px solid #423dff;
            outline-offset: -2px;
            background: #f4f6fa;
        }

    .header__top .user-menu__sep {
        height: 1px;
        margin: 7px 12px;
        background: #eef0f4;
    }

    /* 退出登录（危险项）：静息与普通菜单项同色（.user-menu__item #4b5563 / svg #7f8798，
       不再单独压浅）；仅 hover 转 #D50032 —— 5.42:1 达 AA（旧 #e5484d 仅 3.91 不达标）。 */
    .header__top .user-menu__item--danger .user-menu__item-chev {
        display: none;
    }

        .header__top .user-menu__item--danger:hover {
            background: #fdf0f2;
            color: #D50032;
        }

            .header__top .user-menu__item--danger:hover svg {
                color: #D50032;
            }

/* 两态：服务端在 .header__top 上输出 is-authed（缓存变体同源）；
   JS 只在会话失效/命中时做自愈，不负责首次判定。
   （旧 .is-authed .guest-actions 隐藏规则已随芯片撤除清理——类不存在，规则悬空。） */
.header__top:not(.is-authed) .user-menu {
    display: none;
}

/* 窄屏：卡片宽随视口收缩；头像位移量由 --um-panel-w 推导，圆心仍与卡片对齐 */
@media (max-width: 900px) {
    .header__top .user-menu {
        --um-panel-w: min(300px, calc(100vw - 24px));
    }
}

/* ---------- 4. 主导航 (.header__nav) ---------- */
.header__nav {
    /* v6 设计令牌（2026-11-24）：只有「项间距」一个可变量，侧留白由它派生。
       gutter = gap + 8 → 「留白 ≥ 间距」是结构性保证，不靠人工调参。
       ⛔ 不要给菜单项写 margin（会形成双轨间距）；⛔ 不要引入任何组件级 zoom。 */
    /* 间距随视口连续插值，恒在 [20px, 40px]；锚点 1200→40、900→20。
       ⛔ 不再按断点写死 32/24/16 —— 那会让 1000 与 1024 出现「谁常开」的翻转。 */
    --nav-gap: clamp(20px, calc(6.667vw - 40px), 40px);
    --header-search-max: 240px;   /* 搜索框整体宽度上限（输入区 = 此值 - 38 按钮） */
    --header-search-icon: 38px;   /* = 高度：收起态是一个正方形按钮 */

    height: 74px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
}

/* logo（从顶栏移入主导航首位）
   两张图在 .header__logo 内绝对定位叠放，才能做透明度交叉淡入；
   容器宽度按素材比例 800×300 @ 36px 高换算得 96px，固定宽度以免滚动过程中
   后续导航项横向位移。更换 logo 素材时若宽高比不同，同步调整此宽度即可。
   flex 容器内改用 align-items 垂直居中，不再用 margin-top 硬算。
   右侧不留 margin：.header__menu 以 flex:1 撑满剩余空间并自身居中，
   logo 与菜单、菜单与搜索框的间距统一由 flex 分配。 */
.header__nav .header__logo {
    position: relative;
    flex: 0 0 auto;
    width: 96px;
    height: 36px;
}

    .header__nav .header__logo img {
        position: absolute;
        left: 0;
        top: 0;
        height: 36px;
        width: auto;
    }

/* 首页：随滚动进度交叉淡入（白字款 → 深色款） */
body.theme-home .header__logo-img--light { opacity: calc(1 - var(--home-scroll, 0)); }
body.theme-home .header__logo-img--dark { opacity: var(--home-scroll, 0); }

/* 内页：恒显示深色款 */
body.theme-inner .header__logo-img--light { opacity: 0; }
body.theme-inner .header__logo-img--dark { opacity: 1; }

.header__nav > .container {
    position: relative; /* mega 浮层的定位上下文 */
}

.header__nav .nav-link {
    position: relative;
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 16px;
    line-height: 74px;   /* = .header__nav 高度，文字在盒内垂直居中 */
    color: var(--nav-fg);
    transition: color .18s ease;
}

/* 触屏热区外扩（2026-11-01 header 审计；视觉零变化）：
   点击盒原样 = 文字盒。v6 去 zoom 后 620 档菜单高仍 74、字号 14（「首页」约 28px 宽），
   垂直已足额，水平略小于 44 —— 外扩 ±10 / ±8 后触屏更稳。
   ⛔ 载体必须用 ::before：.trigger::after 已是下拉三角箭头（float+border 三角，
      hover 旋转），首版误用 ::after 与箭头声明合并 → 箭头被 absolute 拉伸错位
      （2026-11-01 用户实测发现）。::before 两侧均无占用。
   ⛔ 视觉字号别靠放大补偿：字号档位见 §8，抬字号会挤压菜单导致换行。 */
.header__nav .nav-link::before,
.header__nav .nav-dropdown > .trigger::before {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: -8px;
    right: -8px;
}
.header__nav .nav-dropdown > .trigger { position: relative; }   /* ::before 定位上下文 */
/* 注：此处原有一个多余的孤立 `}`（2026-11-23 清理）——CSS 解析器容错忽略，
   但它让后续规则看起来像处于嵌套块内，误导维护，已删。 */

    /* hover 与选中态同为强调色。
       ⛔ 底部指示条（.nav-link.is-active::after，2px 主色横条）已按产品要求移除，
          选中态仅靠颜色 + 字重表达。两者视觉必须保持可区分，
          故 hover 只变色、选中态额外加 font-weight:700。 */
    .header__nav .nav-link:hover {
        color: var(--nav-hover);
    }


/* 首/末项 auto 边距 = 自适应居中（2026-10-29 修「部分屏幕尺寸不居中」）：
   未溢出 → 两端剩余空间均分，菜单居中于 logo 与搜索框之间；
   溢出（窄屏横滑）→ auto 归零，内容从左侧开始，左右两端都能滑到。
   ⛔ 不要改回 justify-content: center —— 溢出时会裁掉两端且无法滑到最左；
   ⛔ 也不要靠末项 margin-right:0 收尾 —— 那会造成尾部缺口，整组右偏。 */
.header__menu > .nav-link:first-child,
.header__menu > .nav-dropdown:first-child {
    margin-left: auto;
}
.header__menu > .nav-link:last-child,
.header__menu > .nav-dropdown:last-child {
    margin-right: auto;
}

/* 选中态（无下划线版）：仅靠主色 + 字重。hover 只变色不加重，
   故两者仍可区分。若日后要恢复指示条，改回 ::after
   （bottom:14px 与 74px 盒、16px 文字上下对称）。 */
.header__nav .nav-link.is-active {
    color: var(--nav-active);
    font-weight: 700;
}

/* ---------- 5. 下拉菜单容器 ---------- */
.header__nav .nav-dropdown {
    flex: 0 0 auto;
    position: relative; /* 浮层定位上下文 */
}

.header__nav .nav-dropdown .trigger {
    display: block;
    height: 74px;
    line-height: 74px;
    font-weight: 700;
    font-size: 16px;
    color: var(--nav-fg);
    white-space: nowrap;
    cursor: pointer;
    transition: color .18s ease;
}

    .header__nav .nav-dropdown .trigger > span {
        float: left;
    }


/* 箭头：CSS 三角跟随 currentColor，主题切换无需换图 */
.header__nav .nav-dropdown .trigger::after {
    content: '';
    float: left;
    width: 0;
    height: 0;
    margin: 34.5px 0 0 6px; /* 垂直居中：三角高 5px，(74 - 5) / 2 = 34.5 —— 原 34 有 0.5px 偏差（2026-11-01 修正）；
                              ⛔ 盒高（74）或三角高（5）变更时须同步此值 */
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform .2s ease;
}

/* 下拉触发器：hover / 选中同色，选中额外加字重（与 .nav-link 口径一致） */
.header__nav .nav-dropdown:hover .trigger {
    color: var(--nav-hover);
}

.header__nav .nav-dropdown.is-active .trigger {
    color: var(--nav-active);
    font-weight: 700;
}

.header__nav .nav-dropdown:hover .trigger::after {
    transform: rotate(180deg);
}

/* 透明桥：保证鼠标从触发区移到浮层时不丢失 hover */
.header__nav .nav-dropdown::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: var(--nav-dropdown-gap);
}

/* ---------- 6. 下拉浮层 ---------- */
.header__nav .nav-dropdown .dropdown-simple {
    position: absolute;
    top: 100%;
    float: none;
    margin: var(--nav-dropdown-gap) 0 0 0;
    z-index: 20;
    background: var(--nav-panel-bg);
    box-shadow: var(--nav-panel-shadow);
    border-radius: var(--nav-panel-radius);
    text-align: left;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.header__nav .nav-dropdown:hover > .dropdown-simple {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* 简单下拉 */
.header__nav .nav-dropdown .dropdown-simple {
    left: -12px;
    width: 160px;
    padding: 10px 0;
}

    .header__nav .nav-dropdown .dropdown-simple > li {
        list-style: none;
    }

    .header__nav .nav-dropdown .dropdown-simple .arrow {
        position: absolute;
        top: -5px;
        left: 46px;
        width: 10px;
        height: 10px;
        background-color: var(--nav-panel-bg);
        border-top: 1px solid #eaeaea;
        border-left: 1px solid #eaeaea;
        transform: rotate(45deg);
        z-index: 2;
    }

    .header__nav .nav-dropdown .dropdown-simple .links {
        float: left;
        width: 100%;
        position: relative;
        z-index: 1;
    }

        .header__nav .nav-dropdown .dropdown-simple .links a {
            float: left;
            height: 38px;
            width: calc(100% - 24px);
            margin: 0 12px;
            line-height: 38px;
            padding: 0 8px;
            box-sizing: border-box;
            font-size: 14px;
            color: #1f2329;
            border-radius: 4px;
            transition: background-color .16s ease, color .16s ease;
        }

            /* 2026-11-24 C2：品牌蓝字 + 中性表面，与账户菜单 hover（#f4f6fa）同款。
               ⛔ 不要用 var(--nav-active)：首页玻璃态 p=0 时它插值到白色，
                  落在恒白的下拉面板上会变成白字白底。 */
            .header__nav .nav-dropdown .dropdown-simple .links a:hover {
                color: #423dff;
                background-color: #f4f6fa;
            }

/* ---------- 7. 搜索框 ----------
   v8.4 终态：整块 38 高、圆角 6，右侧 38×38 蓝色方块按钮（无描边、无分割线）；
   输入区底色与蓝块由容器的一层渐变绘制，子元素全透明直角。
   交互反馈只有两级：hover 同层微调色值，focus 内描边 1.5px + 蓝系 4px 发光。
   ⛔ 旧形态（1px 描边 / 42px 按钮 / 外框 hover 浅描边）与左侧类型下拉
      （.search-type / .type-dropdown）均已整体移除，不要再按旧稿恢复。 */
/* 搜索框的两种颜色都是**同一层渐变**里的色标（可过渡的自定义颜色）。
   ⛔ 不能用 background-color + background-image 两层：首页底色是 rgba(...,.2) 半透明，
   两层各自被圆角裁一次，半透明层会从蓝色的抗锯齿像素里透出来 → 蓝角内侧一条浅色弧
   （2026-11-24 用户放大截图确认）。合成一层后，圆角处只剩「蓝 → 页面」一次混合。 */
@property --searchbar-field {
    syntax: '<color>';
    inherits: false;
    initial-value: #fafafa;
}

@property --searchbar-blue {
    syntax: '<color>';
    inherits: false;
    initial-value: #423dff;
}

.header__nav .header-search {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    box-sizing: border-box;
    width: var(--header-search-w, var(--header-search-max));   /* JS 写；无 JS 时取上限，宽屏可用 */
    height: 38px;
    margin: 0;               /* flex 容器 align-items:center 负责垂直居中，不再需要 margin-top */
    border: 0;
    border-radius: 6px;
    /* v8.2 绘制模型：整块搜索框（输入区底色 + 右侧蓝色块）只由这一层渐变绘制，
       子元素一律透明、直角。圆角只被裁切/抗锯齿一次，任何层都不可能透出来。 */
    --searchbar-btn-w: 38px;      /* = 高度：展开态蓝块也是正方形，展开/收起只改左边输入区 */
    --searchbar-field: var(--nav-field-bg);
    --searchbar-blue: var(--nav-solid);
    --searchbar-blue-hover: #3a34e6;   /* 局部 hover 蓝：只降 10% 明度（深海军蓝反差过大，故不共用全局令牌） */
    background: transparent;
    background-image: linear-gradient(to right,
        var(--searchbar-field) 0 calc(100% - var(--searchbar-btn-w)),
        var(--searchbar-blue) calc(100% - var(--searchbar-btn-w)) 100%);
    transition: width .22s cubic-bezier(.2, .7, .3, 1),
                box-shadow .18s ease,
                --searchbar-field .18s ease,
                --searchbar-blue .18s ease;
}

    /* 悬停：整块底色深一档 + 蓝块微深。两者都是同一次绘制里的颜色变化，
       ⛔ 不用 box-shadow 描边（环形阴影会从蓝色边缘的半透明像素透出来，形成浅色发丝线）。 */
    .header__nav .header-search[data-state="open"]:hover {
        --searchbar-field: color-mix(in srgb, var(--nav-field-bg), #000 4%);
        --searchbar-blue: var(--searchbar-blue-hover);
    }

    /* 聚焦（v8.4 方案二）：内描边 + 外发光。
       内描边与蓝块同色 → 压在蓝角上看不见；走到输入区上是清晰一条边。
       外发光必须是蓝色系：混合在蓝边上只会更深，不会像浅灰描边那样勾出亮线。 */
    .header__nav .header-search[data-state="open"]:focus-within {
        --searchbar-field: var(--nav-panel-bg);
        box-shadow:
            inset 0 0 0 1.5px var(--nav-solid),
            0 0 0 4px rgba(20, 80, 210, .10);
    }

    .header__nav .header-search input {
        flex: 1;
        min-width: 0;     /* 允许在 flex 容器里收缩，否则长输入会把按钮挤出 */
        height: 100%;
        padding: 0 14px;
        border: 0;
        outline: none;
        background: transparent;
        font-size: 14px;
        color: var(--nav-fg);
        caret-color: var(--nav-solid);   /* 光标用品牌色，不再跟随文字色 */
        transition: color .18s ease;
    }

    /* 聚焦时输入框底色被强制为纯白（--nav-panel-bg），而 --nav-fg 在液态玻璃下是白色，
       会造成白底白字。此处显式钉死为深色，与纯白底形成对比。 */
    .header__nav .header-search[data-state="open"]:focus-within input { color: #1f2329; }

        .header__nav .header-search input::placeholder { color: #9aa0a6; }

        /* 白底上占位文字提一档对比，否则发虚 */
        .header__nav .header-search[data-state="open"]:focus-within input::placeholder { color: #6b7280; }

    .header__nav .header-search__submit {
        flex-shrink: 0;
        display: flex;
        align-items: center;      /* 放大镜在 38px 高的按钮内垂直居中 */
        justify-content: center;  /* 水平居中 */
        width: var(--searchbar-btn-w);
        height: 100%;
        border: 0;
        border-radius: 0;         /* ⛔ 颜色与圆角都在容器那一层渐变上，这里必须直角+透明 */
        cursor: pointer;
        background: transparent;
        outline: none;            /* 点位不画 UA 焦点环：它会在蓝角上叠出第二条弧 */
        color: #fff;
        -webkit-tap-highlight-color: transparent;
    }

        /* SVG 默认 inline 布局会留出基线下方空隙导致视觉偏上，置为 block 后由 flex 精确居中 */
        .header__nav .header-search__submit svg {
            display: block;
            transition: transform .18s ease;
        }

        /* 悬停时图标轻微放大，点击意图更明确（transform 不影响布局，无跳动） */
        .header__nav .header-search__submit:hover svg { transform: scale(1.12); }

/* ---------- 8. 头部响应式（v6，2026-11-24：彻底删除 zoom） ----------
   与全站其他模块同一原则：不缩放整块，只换字号 / 容器内距。
   · 间距不在本段：--nav-gap / --top-gap 由两条 clamp 随视口连续插值，恒在 [20,40]。
   · 字号三档：≥1101 16px / 900–1100 15px / ≤899 14px。
   · 容器内距：≤1340 40px，≤1259 24px。
   · 留白由 padding-inline: calc(gap + 8px) 派生，恒 ≥ 项间距。
   ⛔ 不再有任何组件级 zoom；⛔ 不再给菜单项写 margin（间距唯一真源 = gap）。 */
@media (max-width: 1340px) {
    .header__top > .container,
    .header__nav > .container {
        width: 100%;
        max-width: none;
        padding-left: 40px;
        padding-right: 40px;
    }
}
@media (max-width: 1259px) {
    .header__top > .container,
    .header__nav > .container {
        padding-left: 24px;
        padding-right: 24px;
    }
}
/* 字号档保留（16 / 15 / 14）；间距已改由 clamp 连续插值 —— ⛔ 这里不再写 --nav-gap / --top-gap。
   用 1100（而非 1099.98）：现在没有配对的 min-width:1100，取整即可覆盖 1099.5 这类小数视口，
   ⛔ 不要再引入 .98 这种补缝写法 —— 只有存在成对断点时才有必要。 */
@media (max-width: 1100px) {
    .header__nav .nav-link,
    .header__nav .nav-dropdown .trigger { font-size: 15px; }
}
@media (max-width: 899px) {
    .header__nav .nav-link,
    .header__nav .nav-dropdown .trigger { font-size: 14px; }
    /* 顶条：电话在 900 以下让位（城市与中段菜单保留） */
    .header__top .header__phone { display: none; }
}
/* 菜单在 ≤751 开始超宽：横滑保入口（隐藏滚动条 + 右端渐隐） */
@media (max-width: 751px) {
    .header__menu {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-mask-image: linear-gradient(90deg, #000 85%, rgba(0, 0, 0, .2));
                mask-image: linear-gradient(90deg, #000 85%, rgba(0, 0, 0, .2));
    }
    .header__menu::-webkit-scrollbar { display: none; }
    /* 滚动内容尾部留出与侧留白等宽的占位：滑到最右时末项也不贴搜索框 */
    .header__menu::after {
        content: '';
        flex: 0 0 calc(var(--nav-gap) + 8px);
    }
}
@media (max-width: 700px) {
    /* 折叠屏最小宽度档：顶条中段菜单整体隐藏（入口在主导航已有） */
    .header__top .header__topbar { display: none; }
}
/* ---------- 9. 搜索组件：收起 / 直链（v7，2026-11-24） ----------
   状态：data-state="idle|open" + data-mode="inline|link"。
   宽度：--header-search-w（JS 算出后写整数 CSS px）。
   间距：--nav-gap 由本文件 clamp 曲线决定，JS 只读不写（⛔ 不要再让 JS 覆盖）。
   留白：由菜单 padding-inline: calc(var(--nav-gap) + 8px) 派生，恒 ≥ 项间距，⛔ 不参与挤压。
   · inline + open → 输入区展开（宽度=预算值），菜单间距不变、整体左移
   · inline + idle → 38 方形按钮，点击展开并聚焦
   · link          → 38 方形按钮，整块是 <a href="/search">（桌面连 160 都放不下 / 手机 ≤767）
   ⛔ 没有「展开时菜单让位」：菜单始终可见可点。 */
.header__nav .header-search__link {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #fff;
    /* 蓝色来自容器背景渐变；这里保持透明+直角，弧仍然只由容器绘制一次 */
    background: transparent;
    border-radius: 0;
    text-decoration: none;
}

.header__nav .header-search__link svg { display: block; }

/* 收起 / 直链：容器只裹住按钮，输入框不占位；此时不要任何外描边。
   ⚠️ 只清 background-color（底色），⛔ 不能用 background 简写 —— 那会连蓝色渐变一起清掉。 */
.header__nav .header-search[data-state="idle"],
.header__nav .header-search[data-mode="link"] {
    background-color: transparent;
    box-shadow: none;
}

.header__nav .header-search[data-state="idle"] input,
.header__nav .header-search[data-mode="link"] input,
.header__nav .header-search[data-mode="link"] .header-search__submit { display: none; }

/* 图标按钮热区外扩 14px：38×38 视觉盒，热区约 66×66，触屏更稳（视觉零变化） */
.header__nav .header-search__submit { position: relative; }
.header__nav .header-search__submit::after { content: ''; position: absolute; inset: -14px; }

/* 直链档：整块可点 */
.header__nav .header-search[data-mode="link"] .header-search__link { display: flex; }

/* 手机 ≤767：不展开（虚拟键盘 + 窄框是反模式），纯 CSS 直链，⛔ 不依赖 JS */
@media (max-width: 767px) {
    .header__nav .header-search { width: var(--header-search-icon); }
    .header__nav .header-search input,
    .header__nav .header-search .header-search__submit { display: none; }
    .header__nav .header-search .header-search__link { display: flex; }
}

/* 无 JS 兜底：窄屏（含平板）先收起成直链，避免整宽输入区撑破导航 */
@media (max-width: 1194px) {
    .header__nav:not([data-header-search-ready]) .header-search { width: var(--header-search-icon); }
    .header__nav:not([data-header-search-ready]) .header-search input,
    .header__nav:not([data-header-search-ready]) .header-search .header-search__submit { display: none; }
    .header__nav:not([data-header-search-ready]) .header-search .header-search__link { display: flex; }
}

/* 首测前不播过渡：避免首屏 240 → 38 的闪动 */
.header__nav:not([data-header-search-ready]) .header-search { transition: none; }

@media (prefers-reduced-motion: reduce) {
    .header__nav .header-search { transition: none; }
}
