/*
 * 导航中心（Go Nav 模式）样式
 * 结构：顶部 sticky 搜索栏 + 桌面左侧分类锚点 + 按分类分块的卡片网格
 * 颜色全部取自 css/theme.css 的 --ui-* / --brand-* Token，随主题切换。
 */
body[data-ui-page="nav"] {
    background: var(--tech-bg, #f4f7fb);
    color: var(--ui-text, #101c2e);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body[data-ui-page="nav"] * { box-sizing: border-box; }

/* ---------- 品牌 logo（三棱镜 SVG） ---------- */
.nc-brand .nc-brand-mark {
    width: 30px; height: 30px; flex: none; display: grid; place-items: center;
    border-radius: 9px; background: var(--brand-gradient);
}
.nc-brand .nc-brand-mark svg {
    color: #fff; width: 100%; height: 100%; }
.nc-brand .nc-brand-mark img {
    display: block; width: 100%; height: 100%; object-fit: cover; }
.nc-brand span { font-size: 15px; font-weight: 700; color: var(--ui-text); white-space: nowrap; }

/* ---------- 通用 SVG 图标 ---------- */
.nc-icon { fill: currentColor; color: inherit; display: inline-block; }
.nc-icon-menu { color: var(--ui-text); }
.nc-icon-close { color: var(--ui-text-muted); }
.nc-icon-close:hover { color: var(--brand-accent); }
.nc-icon-home { color: var(--ui-text-muted); }
.nc-icon-home:hover { color: var(--brand-accent); }
.nc-icon-top { color: var(--brand-deep); }
.nc-icon-top:hover { color: var(--brand-accent); }

/* ---------- 顶部工具条 ---------- */
.nc-header {
    position: sticky; top: 0; z-index: 60;
    display: grid; grid-template-columns: 190px minmax(0, 1fr) 110px;
    align-items: center; gap: 16px;
    height: 64px; padding: 0 22px;
    background: var(--ui-surface, #fff);
    border-bottom: 1px solid var(--ui-border, #e4e9f0);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}
.nc-brand { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; }
.nc-brand .nc-brand-mark {
    width: 30px; height: 30px; flex: none; display: grid; place-items: center;
    border-radius: 9px; background: var(--brand-gradient); color: #fff;
    font-size: 15px; font-weight: 700;
}
.nc-brand span { font-size: 15px; font-weight: 700; color: var(--ui-text); white-space: nowrap; }
.nc-search { position: relative; width: 100%; max-width: 580px; justify-self: center; }
.nc-search > svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ui-text-subtle); pointer-events: none; }
.nc-search input {
    width: 100%; height: 40px; padding: 0 40px;
    border: 1px solid var(--ui-border-strong, #cfd8e3); border-radius: 999px;
    background: var(--ui-surface-soft, #f7f9fc);
    color: var(--ui-text); font-size: 14px; outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.nc-search input::placeholder { color: var(--ui-text-subtle); }
.nc-search input::-webkit-search-cancel-button,
.nc-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.nc-search input:focus {
    border-color: var(--brand-accent); background: var(--ui-surface);
    box-shadow: 0 0 0 3px var(--ui-focus-soft, rgba(14, 116, 144, .14));
}
.nc-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 26px; height: 26px; display: none; place-items: center;
    border: none; border-radius: 50%; background: transparent;
    color: var(--ui-text-muted); font-size: 17px; line-height: 1; cursor: pointer;
}
.nc-clear.show { display: grid; }
.nc-clear:hover { background: var(--ui-surface-raised, #eef2f7); }
.nc-home-link {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 10px; font-size: 13px; font-weight: 600; text-decoration: none;
    color: var(--ui-text-muted); white-space: nowrap; border-radius: 6px;
}
.nc-home-link:hover {
    border-color: var(--brand-accent); color: var(--brand-accent);
    background: var(--ui-surface-raised); text-decoration: none;
}

/* ---------- 顶部右侧动作区（含后台管理入口） ---------- */
.nc-actions {
    display: flex; align-items: center; gap: 10px; justify-self: end;
}
.na-admin-link {
    font-size: 13px; font-weight: 600; color: var(--ui-text-muted);
    padding: 6px 12px; border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm); background: var(--ui-surface);
    white-space: nowrap;
}
.na-admin-link:hover {
    border-color: var(--brand-accent); color: var(--brand-accent);
    background: var(--ui-surface-raised);
}
.nc-menu-btn {
    display: none; width: 40px; height: 40px; place-items: center;
    border: 1px solid var(--ui-border); border-radius: 10px;
    background: var(--ui-surface); color: var(--ui-text); cursor: pointer;
}

/* ---------- 布局：侧栏 + 主内容 ---------- */
.nc-layout {
    display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px;
    max-width: 1440px; margin: 0 auto; padding: 24px 22px 72px;
}
.nc-sidebar {
    position: sticky; top: 88px; align-self: start;
    max-height: calc(100vh - 110px); overflow-y: auto;
    padding: 10px; border: 1px solid var(--ui-border);
    border-radius: 14px; background: var(--ui-surface);
}
.nc-side-title {
    padding: 6px 10px 10px; font-size: 12px; font-weight: 700;
    letter-spacing: .12em; color: var(--ui-text-subtle);
}
.nc-cat-link {
    display: flex; align-items: center; gap: 9px; min-height: 40px;
    padding: 6px 10px; border-radius: 9px; text-decoration: none;
    color: var(--ui-text-muted); font-size: 13px; font-weight: 600;
    transition: background-color .18s ease, color .18s ease;
}
.nc-cat-link:hover { background: var(--ui-surface-soft, #f4f7fb); color: var(--brand-deep); }
.nc-cat-link.active {
    background: var(--ui-focus-soft, #e6f3f7); color: var(--brand-deep);
    box-shadow: inset 3px 0 0 var(--brand-accent);
}
.nc-cat-link .nc-emoji { font-size: 15px; line-height: 1; }
.nc-cat-link .nc-num {
    margin-left: auto; min-width: 22px; padding: 1px 6px; text-align: center;
    border-radius: 999px; background: var(--ui-surface-raised, #eef2f7);
    color: var(--ui-text-subtle); font-size: 12px; font-weight: 700;
}
.nc-cat-link.active .nc-num { background: var(--ui-surface); color: var(--brand-deep); }

.nc-main { min-width: 0; }
.nc-resultbar {
    display: none; align-items: center; gap: 8px; margin-bottom: 16px;
    font-size: 13px; color: var(--ui-text-muted);
}
.nc-resultbar.show { display: flex; }
.nc-resultbar strong { color: var(--brand-deep); }

/* ---------- 分类区块 ---------- */
.nc-section { scroll-margin-top: 82px; margin-bottom: 26px; }
.nc-section[hidden] { display: none; }
.nc-section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.nc-section-head .nc-sec-emoji { font-size: 19px; line-height: 1; }
.nc-section-head h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ui-text); }
.nc-section-head p { margin: 0; font-size: 12px; color: var(--ui-text-subtle); }
.nc-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.nc-tag {
    padding: 5px 13px; border: 1px solid transparent; border-radius: 999px;
    background: var(--ui-surface-raised, #eef2f7); color: var(--ui-text-muted);
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}
.nc-tag:hover { color: var(--brand-deep); }
.nc-tag.active { background: var(--brand-deep); color: #fff; }
.nc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.nc-card {
    display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 68px;
    padding: 10px 12px; border: 1px solid var(--ui-border); border-radius: 12px;
    background: var(--ui-surface); text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.nc-card:hover {
    border-color: var(--brand-accent); transform: translateY(-2px);
    box-shadow: 0 8px 20px -10px rgba(14, 116, 144, .45);
}
.nc-card:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
.nc-card[hidden] { display: none; }
.nc-card-icon {
    flex: none; width: 36px; height: 36px; display: grid; place-items: center;
    border-radius: 50%; background: var(--ui-focus-soft, #e6f3f7);
    color: var(--brand-deep);
}
.nc-card-icon svg {
    width: 20px; height: 20px; stroke: currentColor; fill: none; }
.nc-card-text { min-width: 0; flex: 1; }
.nc-card-text strong {
    display: block; font-size: 14px; font-weight: 650; color: var(--ui-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nc-card-text small {
    display: -webkit-box; margin-top: 2px; font-size: 12px; color: var(--ui-text-subtle);
    overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.nc-empty {
    display: none; padding: 44px 16px; text-align: center;
    border: 1px dashed var(--ui-border-strong); border-radius: 14px;
    background: var(--ui-surface); color: var(--ui-text-muted); font-size: 14px;
}
.nc-empty.show { display: block; }
.nc-empty strong { display: block; margin-bottom: 6px; color: var(--ui-text); font-size: 16px; }

/* ---------- 悬浮回顶 ---------- */
.nc-top {
    position: fixed; right: 24px; bottom: 24px; z-index: 55;
    width: 42px; height: 42px; display: none; place-items: center;
    border: 1px solid var(--ui-border); border-radius: 50%;
    background: var(--ui-surface); color: var(--brand-deep); font-size: 18px;
    box-shadow: var(--ui-shadow-overlay, 0 6px 18px rgba(16, 24, 40, .16)); cursor: pointer;
}
.nc-top.show { display: grid; }
.nc-top:hover { background: var(--ui-focus-soft); }

/* ---------- 卡片预览（iframe 就地查看） ---------- */
.nc-viewer-wrap {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #fff;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.nc-viewer-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 210;
    width: 36px;
    height: 36px;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    background: var(--ui-surface);
    color: var(--ui-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.nc-viewer-close:hover {
    background: var(--ui-surface-raised, #eef2f7);
}
.nc-viewer {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
}

/* ---------- 手机分类抽屉 ---------- */
.nc-backdrop { display: none; position: fixed; inset: 0; z-index: 70; background: var(--ui-scrim, rgba(9, 20, 35, .45)); }
.nc-backdrop.open { display: block; }
.nc-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 71;
    width: min(280px, 84vw); padding: 18px 14px;
    background: var(--ui-surface); box-shadow: var(--ui-shadow-overlay);
    transform: translateX(-100%); visibility: hidden; overflow-y: auto;
    transition: transform .24s ease;
}
.nc-drawer.open { transform: translateX(0); visibility: visible; }
.nc-drawer-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 14px; font-weight: 700; }
.nc-drawer-close { width: 32px; height: 32px; border: 1px solid var(--ui-border); border-radius: 50%; background: transparent; color: var(--ui-text-muted); cursor: pointer; }
.nc-drawer .nc-cat-link { min-height: 44px; }

/* ---------- 响应式 ---------- */
@media (max-width: 899px) {
    .nc-header { grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 10px; height: 58px; padding: 0 12px; }
    .nc-brand { display: none; }
    .nc-menu-btn { display: grid; }
    .nc-home-link { font-size: 0; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
    .nc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 16px 12px 72px; }
    .nc-sidebar { display: none; }
    .nc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .nc-section { scroll-margin-top: 70px; margin-bottom: 22px; }
    .nc-section-head h2 { font-size: 16px; }
    .nc-section-head p { flex: 1 1 100%; }
    .nc-top { right: 14px; bottom: 16px; }
}
@media (max-width: 400px) {
    .nc-grid { gap: 8px; }
    .nc-card { padding: 8px; gap: 8px; min-height: 62px; }
    .nc-card-icon { width: 32px; height: 32px; font-size: 13px; }
    .nc-card-text strong { font-size: 13px; }
    .nc-card-text small { font-size: 11px; }
    .nc-search input { padding-left: 36px; font-size: 13px; }
    .nc-search > svg { left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .nc-card, .nc-drawer, .nc-cat-link, .nc-search input { transition: none !important; }
    .nc-card:hover { transform: none; }
}
