/* ============================================================
   揽星阁 · 全站统一头部
   首页与所有内页共用；分类分组条（.wp-catbar）仍由 home.css 负责
   ============================================================ */

/* 抽屉由一个 fixed 铺满视口的包裹层裁剪，收起时不会产生横向滚动条
   （不要给 html/body 设 overflow-x: clip/hidden —— 会让整页无法上下滚动） */

.wp-header {
    --hd-h: 64px;
    --hd-line: rgba(255, 255, 255, .08);
    --hd-line-strong: rgba(255, 255, 255, .13);
    --hd-text: #eef1f7;
    --hd-dim: #98a0b0;
    --hd-accent: #7c5cff;
    --hd-accent-2: #36d1ff;

    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(10, 12, 17, .74);
    border-bottom: 1px solid var(--hd-line);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    transition: background .25s ease, box-shadow .25s ease, border-color .25s ease;
}

/* 滚动后收紧 + 加深，避免长期占屏 */
.wp-header.is-scrolled {
    --hd-h: 56px;
    background: rgba(8, 10, 14, .95);
    border-bottom-color: var(--hd-line-strong);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .42);
}

.wp-header a { text-decoration: none; }
.wp-header button { font-family: inherit; }

.wp-header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--hd-h);
    max-width: 1640px;
    margin: 0 auto;
    padding: 0 24px;
    transition: height .25s ease, padding .25s ease;
}

/* ---------- 品牌 ---------- */
.wp-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    border-radius: 10px;
}
.wp-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(124, 92, 255, .38);
    transition: transform .22s ease;
}
.wp-brand:hover .wp-brand-logo { transform: translateY(-1px) rotate(-3deg); }

.wp-brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.1;
}
.wp-brand-name {
    /* 「揽星阁」：衬线字形 + 上白下蓝渐变，对齐参考图 LOGO 气质 */
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Source Han Serif SC", serif;
    background: linear-gradient(180deg, #ffffff 0%, #d8e8ff 48%, #7db4ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}
.wp-brand-tag {
    font-size: 9px;
    letter-spacing: 1.6px;
    font-weight: 600;
    color: rgba(255, 255, 255, .32);
    white-space: nowrap;
}

/* ---------- 主导航 ---------- */
.wp-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    margin-left: 6px;
}
.wp-nav a {
    position: relative;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 13.5px;
    color: var(--hd-dim);
    white-space: nowrap;
    transition: color .18s ease, background .18s ease;
}
.wp-nav a::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 3px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--hd-accent), var(--hd-accent-2));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .22s cubic-bezier(.2, .7, .2, 1);
}
.wp-nav a:hover { color: #fff; background: rgba(255, 255, 255, .055); }
.wp-nav a:hover::after { transform: scaleX(1); }
.wp-nav a.is-active {
    color: #fff;
    background: rgba(124, 92, 255, .16);
}
.wp-nav a.is-active::after { transform: scaleX(1); }

/* ---------- 搜索（首页为页内筛选 label，内页为站内搜索 form） ---------- */
.wp-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    width: min(340px, 30vw);
    height: 38px;
    margin-left: auto;
    padding: 0 10px 0 12px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--hd-line);
    color: rgba(255, 255, 255, .42);
    min-width: 0;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.wp-search:focus-within {
    border-color: rgba(124, 92, 255, .6);
    background: rgba(124, 92, 255, .1);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .13);
}
.wp-search > i {
    flex: none;
    font-size: 17px;
}
.wp-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--hd-text);
    font-size: 13.5px;
    padding: 0;
}
.wp-search input::placeholder { color: rgba(255, 255, 255, .34); }

.wp-search-clear {
    display: none;
    flex: none;
    width: 22px;
    height: 22px;
    display: none;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .6);
    font-size: 15px;
    cursor: pointer;
}
.wp-search-clear:hover { background: rgba(255, 255, 255, .16); color: #fff; }

.wp-search-kbd {
    flex: none;
    font-family: inherit;
    font-size: 10.5px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 5px;
    color: rgba(255, 255, 255, .38);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--hd-line);
}
.wp-search input:focus ~ .wp-search-kbd { display: none; }

.wp-search-submit {
    flex: none;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: rgba(124, 92, 255, .3);
    color: #ded7ff;
    font-size: 16px;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}
.wp-search-submit:hover { background: rgba(124, 92, 255, .58); color: #fff; }

/* ---------- 右侧动作 ---------- */
.wp-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.wp-act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--hd-line-strong);
    background: rgba(255, 255, 255, .045);
    color: #b9c0cd;
    font-size: 12.5px;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}
.wp-act i { font-size: 16px; color: #9b88ff; }
.wp-act:hover {
    color: #fff;
    border-color: rgba(124, 92, 255, .5);
    background: rgba(124, 92, 255, .16);
    transform: translateY(-1px);
}
.wp-act-fav i { color: #ffce5c; }
.wp-act-fav:hover { border-color: rgba(255, 206, 92, .45); background: rgba(255, 206, 92, .14); }
.wp-act-fav.is-active {
    color: #fff;
    border-color: rgba(255, 206, 92, .55);
    background: rgba(255, 206, 92, .18);
}

/* ---------- 移动端菜单按钮 ---------- */
.wp-menu-btn {
    display: none;
    flex: none;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--hd-line-strong);
    background: rgba(255, 255, 255, .045);
    color: var(--hd-text);
    font-size: 20px;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}
.wp-menu-btn:hover { background: rgba(124, 92, 255, .18); border-color: rgba(124, 92, 255, .5); }

/* ---------- 抽屉（移动端导航） ----------
   包裹层铺满视口并裁剪溢出，抽屉收起时停在视口外也不会撑出横向滚动条 */
.wp-drawer-wrap {
    position: fixed;
    inset: 0;
    z-index: 90;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}
.wp-drawer-wrap.is-open { visibility: visible; pointer-events: auto; }

.wp-drawer-mask {
    position: absolute;
    inset: 0;
    background: rgba(4, 6, 10, .62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .22s ease;
}
.wp-drawer-wrap.is-open .wp-drawer-mask { opacity: 1; }

.wp-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(84vw, 330px);
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 16px 16px 28px;
    background: #0b0e14;
    border-left: 1px solid var(--hd-line-strong);
    box-shadow: -18px 0 48px rgba(0, 0, 0, .55);
    transform: translateX(102%);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    overflow-y: auto;
}
.wp-drawer-wrap.is-open .wp-drawer { transform: none; }

.wp-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.wp-drawer-head .wp-brand-name { font-size: 16px; }
.wp-drawer-close {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid var(--hd-line);
    background: transparent;
    color: var(--hd-dim);
    font-size: 18px;
    cursor: pointer;
}
.wp-drawer-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.wp-drawer h4 {
    margin: 14px 0 5px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 1.6px;
    color: rgba(255, 255, 255, .3);
}
.wp-drawer > a,
.wp-drawer-act {
    padding: 11px 12px;
    border-radius: 9px;
    color: #d5d9e2;
    font-size: 14px;
    text-decoration: none;
    text-align: left;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.wp-drawer > a:hover,
.wp-drawer-act:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.wp-drawer > a.is-active { background: rgba(124, 92, 255, .18); color: #fff; }
.wp-drawer-act { display: inline-flex; align-items: center; gap: 8px; }
.wp-drawer-act i { font-size: 16px; color: #9b88ff; }
.wp-drawer .wp-search {
    width: 100%;
    margin: 0 0 6px;
    background: rgba(255, 255, 255, .06);
}

body.wp-drawer-open { overflow: hidden; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .wp-search { width: min(280px, 34vw); }
}

@media (max-width: 900px) {
    .wp-nav { display: none; }
    .wp-menu-btn { display: grid; }
    .wp-search { width: min(320px, 46vw); }
}

@media (max-width: 720px) {
    .wp-header-inner { padding: 0 14px; gap: 10px; }
    .wp-brand-tag { display: none; }
    .wp-brand-name { font-size: 16px; }
    .wp-search { flex: 1 1 auto; width: auto; }
    .wp-search-kbd { display: none; }
    .wp-act span { display: none; }
    .wp-act { padding: 0 10px; }
}

@media (max-width: 560px) {
    /* 窄屏保留品牌名（去掉英文标签），腾出的空间给搜索框 */
    .wp-brand-name { font-size: 15px; }
    .wp-brand-logo { width: 30px; height: 30px; border-radius: 9px; }
    .wp-actions { display: none; }
    .wp-search { width: auto; height: 36px; }
    .wp-menu-btn { width: 36px; height: 36px; font-size: 19px; }
    .wp-header { --hd-h: 58px; }
    .wp-header.is-scrolled { --hd-h: 52px; }
}

@media (prefers-reduced-motion: reduce) {
    .wp-header, .wp-header-inner, .wp-drawer, .wp-drawer-mask,
    .wp-nav a::after, .wp-brand-logo { transition: none; }
}
/* ============================================================
   全部分类面板（header.js 动态构建，全站可用）
   ============================================================ */
.wp-catpanel-mask {
    position: fixed;
    inset: 0;
    z-index: 92;
    background: rgba(4, 6, 10, .58);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.wp-catpanel-mask.is-open { opacity: 1; pointer-events: auto; }

.wp-catpanel {
    position: fixed;
    top: 76px;
    left: 50%;
    z-index: 93;
    width: min(960px, 94vw);
    max-height: min(72vh, 660px);
    display: none;
    flex-direction: column;
    transform: translateX(-50%) translateY(-8px);
    background: #0b0e14;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .6);
    overflow: hidden;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
}
.wp-catpanel.is-open { display: flex; opacity: 1; transform: translateX(-50%) translateY(0); }

.wp-catpanel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .02);
}
.wp-catpanel-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .4);
    transition: border-color .18s ease, background .18s ease;
}
.wp-catpanel-search:focus-within {
    border-color: rgba(124, 92, 255, .6);
    background: rgba(124, 92, 255, .1);
}
.wp-catpanel-search i { font-size: 17px; }
.wp-catpanel-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: #eef1f7;
    font-size: 13.5px;
}
.wp-catpanel-search input::placeholder { color: rgba(255, 255, 255, .34); }
.wp-catpanel-count {
    flex: none;
    font-size: 11.5px;
    color: rgba(255, 255, 255, .38);
    padding-right: 2px;
    white-space: nowrap;
}
.wp-catpanel-close {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: transparent;
    color: #98a0b0;
    font-size: 19px;
    cursor: pointer;
}
.wp-catpanel-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.wp-catpanel-body {
    padding: 6px 16px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.wp-catpanel-group { margin-top: 14px; }
.wp-catpanel-group h5 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 9px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.4px;
    color: rgba(255, 255, 255, .34);
}
.wp-catpanel-group h5 span {
    font-size: 10.5px;
    letter-spacing: 0;
    color: rgba(255, 255, 255, .24);
}
.wp-catpanel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px;
}
.wp-catpanel-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .07);
    background: rgba(255, 255, 255, .03);
    color: #d5d9e2;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
    transition: .16s ease;
}
.wp-catpanel-item i { font-size: 15px; color: #8f7bff; flex: none; }
.wp-catpanel-item span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wp-catpanel-item:hover,
.wp-catpanel-item:focus-visible {
    border-color: rgba(124, 92, 255, .5);
    background: rgba(124, 92, 255, .16);
    color: #fff;
    outline: none;
}
.wp-catpanel-item.is-current {
    border-color: rgba(124, 92, 255, .65);
    background: rgba(124, 92, 255, .22);
    color: #fff;
}
.wp-catpanel-item.is-current i { color: #cfc2ff; }
.wp-catpanel-empty {
    display: none;
    padding: 26px 4px;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, .38);
}
.wp-catpanel-empty.is-show { display: block; }
.wp-catpanel-foot {
    padding: 10px 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: 11.5px;
    color: rgba(255, 255, 255, .3);
}

body.wp-catpanel-open { overflow: hidden; }

/* 分类条横向滚动控制（首页 .wp-catbar 内，由 header.js 注入） */
.wp-cats-nav {
    flex: none;
    display: flex;
    gap: 4px;
    align-items: center;
}
.wp-cats-nav button {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .05);
    color: #98a0b0;
    font-size: 15px;
    cursor: pointer;
    transition: .16s ease;
}
.wp-cats-nav button:hover:not(:disabled) {
    color: #fff;
    border-color: rgba(124, 92, 255, .5);
    background: rgba(124, 92, 255, .18);
}
.wp-cats-nav button:disabled { opacity: .3; cursor: default; }
.wp-cats-nav[hidden] { display: none; }

/* 抽屉内分类快捷区 */
.wp-drawer-cats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 2px 0 4px;
}
.wp-drawer-cats a {
    padding: 9px 8px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .035);
    color: #d5d9e2;
    font-size: 12.5px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wp-drawer-cats a:hover { background: rgba(124, 92, 255, .18); border-color: rgba(124, 92, 255, .45); color: #fff; }
.wp-drawer-cats a.is-current { background: rgba(124, 92, 255, .24); border-color: rgba(124, 92, 255, .6); color: #fff; }

@media (max-width: 720px) {
    .wp-catpanel { top: 64px; max-height: 78vh; border-radius: 14px; }
    .wp-catpanel-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
    .wp-catpanel-item { padding: 8px 9px; font-size: 12.5px; }
    .wp-catpanel-count { display: none; }
    .wp-drawer-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 分类条滚动按钮在窄屏隐藏（触屏直接滑动） */
@media (max-width: 900px) {
    .wp-cats-nav { display: none; }
}

/* 分类 chips 的键盘焦点 */
body.wp-home .wp-cat:focus-visible {
    outline: 2px solid rgba(124, 92, 255, .75);
    outline-offset: 2px;
}


/* ============================================================
   分类条：分组 + 组内 chips（v6 起全站共用，原 home.css 首页作用域迁出）
   ============================================================ */
.wp-catbar {
    max-width: var(--shell, 1560px);
    margin: 0 auto;
    padding: 0 24px 11px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.wp-catgroups {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--line);
}
.wp-catgroup {
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font-size: 12.5px;
    padding: 6px 12px;
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
    transition: .16s ease;
    font-family: inherit;
}
.wp-catgroup:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.wp-catgroup.is-active {
    color: #fff;
    background: linear-gradient(120deg, var(--accent, #7c5cff), rgba(54, 209, 255, .85));
    box-shadow: 0 4px 14px rgba(124, 92, 255, .3);
}
.wp-cats {
    flex: 1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px;
    margin: 0;
    max-width: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 26px), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 26px), transparent);
}
.wp-cats::-webkit-scrollbar { height: 0; }
.wp-cat {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    cursor: pointer;
    flex: 0 0 auto;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid transparent;
    color: var(--text-dim);
    font-size: 12.5px;
    transition: .16s ease;
    text-decoration: none;
}
.wp-cat:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border-color: var(--line-strong, rgba(255, 255, 255, .13));
    transform: translateY(-1px);
}
.wp-cat.is-active {
    color: #fff;
    background: rgba(124, 92, 255, .22);
    border-color: rgba(124, 92, 255, .55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.wp-cat-ico {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    object-fit: cover;
    flex: none;
}
.wp-cat-bxi { font-size: 15px; opacity: .8; }
.wp-cat.is-active .wp-cat-bxi { opacity: 1; color: #cfc2ff; }
.wp-cat.is-hidden { display: none; }
@media (max-width: 980px) {
    .wp-catbar { flex-direction: column; align-items: stretch; gap: 9px; }
    .wp-catgroups { overflow-x: auto; }
}
@media (max-width: 760px) {
    .wp-catbar { padding: 0 16px 10px; }
}