/* ============================================================
   site.css · 天元小站全站公共组件（纸墨方案 v2 · 2026-08-24 D1）
   ------------------------------------------------------------
   依赖 tokens.css（必须在其后引入）
   职责：一行式头部 / 页脚 / 首页搜索与分类页签 / 工具卡片 /
        搜索建议 / 最近使用 / 广告位（虚线降权）/ 工具箱页签
   约定：颜色一律走令牌引用，暗色由 tokens.css 媒体查询自动接管；
        无渐变、无发光、圆角只用 4/8/16 三档
   ============================================================ */

/* ===== 基础 ===== */
html {
    overflow-y: scroll;        /* 保留滚动条占位，避免切页左右跳动 */
    scrollbar-gutter: stable;
}

/* 统一盒模型（部分页面带 bootstrap 已是 border-box，全站显式声明，
   避免同一组件在有/无 bootstrap 的页面上宽度与起点位置不一致） */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;               /* 无 bootstrap 页面兜底（bootstrap normalize 会清零，这里对齐） */
    background: var(--bg);
    color: var(--text-1);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
}

h1, h2, h3 {
    font-weight: 600;
    line-height: 1.4;
}

.home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 64px;
}

/* ===== 顶部导航（普通页：品牌 + 右侧链接） ===== */
.top-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.top-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 60px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-1);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-brand:hover {
    color: var(--text-1);
}

.nav-logo-svg {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.nav-logo-svg .logo-outer {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
}

.nav-logo-svg .logo-inner {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2;
    opacity: .5;
}

.nav-logo-svg .logo-dot,
.nav-logo-svg .logo-t {
    fill: var(--primary);
}

.nav-logo-svg .logo-cross {
    stroke: var(--primary);
    stroke-width: 2;
    opacity: .35;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-2);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--text-1);
    font-weight: 600;
}

/* ===== 首页一行式头部（品牌 + 居中搜索 + 右侧导航） ===== */
.top-nav-inner--search {
    gap: 20px;
}

.hd-search {
    flex: 1;
    max-width: 520px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 8px 14px;
    color: var(--text-2);
}

.hd-search:focus-within {
    border-color: var(--primary);
}

.hd-search .p {
    font-family: var(--mono);
    color: var(--primary);
    font-weight: 600;
}

.hd-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: var(--sans);
    color: var(--text-1);
    background: transparent;
}

.hd-search input::placeholder {
    color: var(--text-3);
}

.hd-count {
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
}

/* 搜索建议下拉 */
.search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: -1px;
    right: -1px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-1);
    z-index: 100;
    overflow: hidden;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-2);
    font-size: 14px;
}

.suggestion-item i {
    color: var(--text-3);
    font-size: 13px;
    width: 16px;
    text-align: center;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--bg);
    color: var(--text-1);
}

.suggestion-item:hover i,
.suggestion-item.active i {
    color: var(--primary);
}

/* ===== 副线说明 ===== */
.sub {
    padding: 18px 0 0;
    font-size: 13px;
    color: var(--text-2);
}

.sub b {
    color: var(--text-1);
    font-weight: 600;
}

.sub .dot {
    margin: 0 8px;
    color: var(--border-strong);
}

/* ===== 分类页签（下划线式） ===== */
.category-nav {
    margin-top: 6px;
}

.nav-track {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;    /* 行高小数差会触发幽灵纵向滚动条，裁掉 */
    scrollbar-width: none; /* 窄屏横滚不显示滚动条，触屏滑动即可 */
}

.nav-track::-webkit-scrollbar {
    display: none;
}

.nav-item {
    padding: 10px 2px;
    font-size: 14px;
    color: var(--text-2);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-1);
}

.nav-item.active {
    color: var(--text-1);
    font-weight: 600;
    border-bottom-color: var(--primary);
}

/* ===== 工具卡片网格（整卡可点） ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    padding: 22px 0 40px;
}

.tool-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 16px 16px 12px;
    color: var(--text-1);
    text-decoration: none;
    transition: border-color .12s;
}

.tool-card:hover {
    border-color: var(--primary);
    color: var(--text-1);
}

.c-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.c-top > i {
    font-size: 20px;
    color: var(--text-2);
}

.tool-card:hover .c-top > i {
    color: var(--primary);
}

/* NEW 微标：无底色文字，仅警示色 */
.tag-new {
    font-size: 11px;
    color: var(--danger);
    letter-spacing: .5px;
    font-weight: 600;
}

/* 热门微标（工具箱页）：同样无底色 */
.hot-badge {
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: .5px;
    font-weight: 600;
}

.tool-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    margin: 0 0 4px;
}

.tool-desc {
    font-size: 13px;
    color: var(--text-2);
    min-height: 40px;
    margin: 0;
    overflow: hidden;
}

.use {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 8px;
}

.use b {
    color: var(--text-2);
    font-weight: 500;
}

/* 卡片显隐（分类筛选/搜索联动） */
.tool-card.hidden {
    display: none;
}

.tool-card.fade-in {
    animation: siteFadeIn .25s ease;
}

@keyframes siteFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 最近使用（页内横条，不悬浮遮挡内容） ===== */
.recent-section {
    margin-top: 14px;
}

.recent-divider {
    margin-bottom: 8px;
}

.recent-divider span {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    color: var(--text-2);
    text-decoration: none;
    font-size: 12px;
    white-space: nowrap;
    transition: border-color .12s, color .12s;
}

.recent-item:hover {
    border-color: var(--primary);
    color: var(--text-1);
}

.recent-item i {
    color: var(--text-3);
    font-size: 12px;
}

.recent-time {
    font-size: 11px;
    color: var(--text-3);
}

/* ===== 广告位（虚线降权 + 角标） ===== */
.ad-sidebar {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ad-slot {
    position: relative;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-m);
    background: transparent;
    overflow: hidden;
}

.ad-slot::before {
    content: '广告';
    display: block;
    text-align: center;
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 2px;
    padding: 3px 0;
    border-bottom: 1px dashed var(--border);
}

.ad-slot img {
    display: block;
    width: 100%;
    height: auto;
}

.ad-slot-sidebar {
    width: 160px;
}

.ad-slot-bottom {
    width: 100%;
    max-width: 728px;
    margin: 32px auto 0;
}

/* 工具页右侧广告（ad fragment） */
.tool-ad-sidebar {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-ad-sidebar-item {
    position: relative;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-m);
    overflow: hidden;
    width: 160px;
}

.tool-ad-sidebar-item::before {
    content: '广告';
    display: block;
    text-align: center;
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 2px;
    padding: 3px 0;
    border-bottom: 1px dashed var(--border);
}

.tool-ad-sidebar-item img {
    display: block;
    width: 100%;
    height: auto;
}

/* ===== 页脚（静态、居中、单层信息） ===== */
.site-footer-full {
    border-top: 1px solid var(--border);
    padding: 20px 0 28px;
    text-align: center;
    font-size: 12px;
    color: var(--text-3);
    background: var(--bg);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.footer-links a {
    color: var(--text-2);
    text-decoration: none;
    font-size: 12px;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-sep {
    margin: 0 8px;
    color: var(--border-strong);
}

.footer-bottom p {
    margin: 3px 0;
    font-size: 12px;
    color: var(--text-3);
}

.footer-copyright {
    color: var(--text-3);
}

.footer-contact a {
    color: var(--text-2);
    text-decoration: none;
}

.footer-contact a:hover {
    color: var(--primary);
}

/* 公安备案警徽图标 */
.police-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 2px;
    vertical-align: middle;
    background: url("../../img/jh.png") no-repeat center center;
    background-size: contain;
}

/* ===== 工具箱页 ===== */
.page-title {
    padding: 26px 0 4px;
}

.page-title h1 {
    font-size: 20px;
    margin: 0 0 2px;
}

.page-title p {
    font-size: 13px;
    color: var(--text-2);
    margin: 0;
}

.toolbox-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.toolbox-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-m);
    cursor: pointer;
    font-size: 13px;
    transition: border-color .12s, color .12s;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-2);
    text-decoration: none;
}

.toolbox-tab:hover {
    border-color: var(--primary);
    color: var(--text-1);
    text-decoration: none;
}

.toolbox-tab.active {
    border-color: var(--primary);
    color: var(--primary);
}

.toolbox-tab i {
    font-size: 13px;
}

.toolbox-tab .tab-count {
    font-size: 12px;
    color: var(--text-3);
}

.toolbox-tab.active .tab-count {
    color: var(--primary);
}

.toolbox-panel {
    display: none;
}

.toolbox-panel.active {
    display: block;
}

.toolbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    margin-bottom: 40px;
}

/* ===== 内页页头（about/教程列表沿用 hero-* 类名，纸墨化：纯排版、无渐变无口号间距） ===== */
.hero-banner {
    text-align: center;
    padding: 32px 0 16px;
}

.hero-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-1);
    margin: 0 0 4px;
    letter-spacing: 0;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.hero-subtitle {
    color: var(--text-2);
    font-size: 14px;
    letter-spacing: 0;
    margin: 0;
}

.hero-divider {
    width: 48px;
    height: 1px;
    background: var(--border-strong);
    margin: 14px auto 0;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .top-nav-inner {
        padding: 0 16px;
        flex-wrap: wrap;
        padding-bottom: 10px;
    }

    .top-nav-inner--search {
        flex-wrap: wrap;
    }

    .hd-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        margin: 0;
    }

    .nav-links {
        gap: 14px;
    }

    .home-container {
        padding: 0 16px 48px;
    }

    .nav-track {
        gap: 18px;
    }

    .tools-grid,
    .toolbox-grid {
        grid-template-columns: 1fr;
    }

    .tool-desc {
        min-height: 0;
    }

    .ad-sidebar,
    .tool-ad-sidebar {
        display: none !important;
    }

    .ad-slot-bottom {
        margin-top: 20px;
    }
}
