/* ============================================================
// Think Card - 轻量级内容与电商管理系统
// 
// 官网：https://www.thinkdiy.cn
// 
// © 2026 ThinkDIY · All Rights Reserved.
============================================================ */

/* ============================================
   全局重置 & 基础
   --------------------------------------------
   ⚠️ 变量命名空间约定（重要，勿混用）
   本文件（前台）与 css/admin.css（后台）各自定义了一套 :root 变量，
   且**取值不同**（例：--color-bg #F5F5F5 vs #f5f6fa；
   --color-primary #1a1a1a vs #2e6bef；--radius 10px vs 12px）。
   两套变量**互斥，禁止在同一页面共载** —— 一旦同页引入，
   后加载者会整体覆盖前者，导致前后台串色、圆角错乱。
   前台主题色由 inc/head.php 内联覆盖 + css/theme.css 兜底；
   后台主题色由 css/admin.css 自带 :root 提供。
   ============================================ */
/* 【P2】把 margin/padding 重置与 box-sizing 分离：
   box-sizing 用 inherit 继承，允许局部通过覆盖单个元素的 box-sizing 而不被通配符抢回；
   同时 * 通配符在高频重绘时会遍历整棵 DOM，性能敏感场景可改为具体选择器。
   这里保留通配符（重置语义清晰），但把 box-sizing 改为继承式兜底。 */
* {
    margin: 0;
    padding: 0;
}
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --color-bg: #F5F5F5;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-secondary: #6b7280;
    --color-border: #e5e7eb;
    --color-primary: #1a1a1a;
    --color-primary-hover: #333333;
    --color-accent: #e74c3c;      /* ✅ 新增：强调色（价格 / 置顶角标） */
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-success: #16a34a;
    --color-success-hover: #15803d;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    padding: 20px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
}

/* ============================================
   顶部两栏布局（轮播 + 最新卡片列表）
============================================ */
#topBanner {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto 20px;
    background: transparent;
    padding: 0;
    display: none;
}

.banner-wrapper {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.banner-left {
    flex: 3;
    height: 300px;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: #f5f6f8;
}

.banner-right {
    flex: 1;
    height: 300px;
    max-height: 300px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    padding: 12px 14px;
    overflow-y: auto;
}

.banner-right h4 {
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}

.banner-right .card-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
}
.banner-right .card-item:hover {
    background: #f9fafb;
}
.banner-right .card-item:last-child {
    border-bottom: none;
}
.banner-right .card-item .badge-mini {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.banner-right .card-item .title {
    font-size: 15px;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    color: var(--color-text);
}

.banner-right .card-item .action-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-left: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.banner-right .empty-tip {
    color: var(--color-text-secondary);
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

/* ===== 轮播滑动轨道 ===== */
.banner-left .banner-track-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.banner-left .banner-track {
    display: flex;
    height: 100%;
    transition: transform 0.4s ease;
    /* 【P2】will-change 常驻会长期占用一个合成层（显存/内存），改为仅在触摸设备上启用；
       桌面端轮播切换频率低，靠浏览器自动提升即可。 */
}
@media (hover: none) and (pointer: coarse) {
    .banner-left .banner-track { will-change: transform; }
}

.banner-left .banner-slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-left .banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

.banner-left .banner-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}
.banner-left .banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.3s;
}
.banner-left .banner-dot.active {
    background: #333;
}

/* ============================================
   前台头部
============================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 20px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 0;
    min-width: 0;
}

.header-left .logo-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.header-left .logo-icon img {
    display: block;
    max-width: 100%;
    height: auto;
}

.header-titles {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#siteTitleDisplay {
    text-align: left;
}
#siteSubtitleDisplay {
    font-size: 14px;
    font-weight: 300;
    color: var(--color-text-secondary);
    margin: 2px 0 0 0;
    letter-spacing: 0.5px;
    text-align: left;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1 1 0;
    min-width: 0;
}

/* ===== 中部导航：以页面中线为轴，新增栏目自动向两侧延伸 ===== */
.header-nav-center {
    flex: 0 0 auto;
    max-width: 60%;
}
.header-nav-center ul {
    justify-content: center;
}

.header-right .stats {
    color: var(--color-text-secondary);
    font-size: 13px;
}

.header-right .stats strong {
    color: var(--color-text);
    font-weight: 500;
}

/* ===== 导航菜单 ===== */
.nav-menu ul {
    display: flex;
    list-style: none;
    gap: 6px;
    flex-wrap: wrap;
}
.nav-menu ul li a {
    display: block;
    padding: 4px 12px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    border-radius: 16px;
    transition: 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.nav-menu ul li a:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}
/* ✅ 修改：使用主题主色 */
.nav-menu ul li a.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ===== 简约放大镜搜索按钮（替代原搜索输入框） ===== */
.search-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: #8a8f99;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease, background 0.2s ease;
}
.search-icon-btn:hover {
    color: #1a1a1a;
    background: #f3f4f6;
}

/* ===== 头部登录 / 注册按钮（与全站风格统一） ===== */
.btn-header {
    display: inline-block;
    padding: 6px 18px;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 18px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.2s;
}
/* 已登录：用户名按钮（描边胶囊） */
.btn-header-user {
    color: #333;
    background: #ffffff;
    border: 1px solid #e2e4e8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.btn-header-user:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* ============================================
   瀑布流（4列）
============================================ */
.waterfall {
    column-count: 4;
    column-gap: 20px;
    padding: 4px 0 8px;
}

/* 空状态提示横跨瀑布流所有列，避免被当作单个卡片挤进第一列导致错位 */
.waterfall .empty-state {
    column-span: all;
}

/* ============================================================
   正文内嵌卡片（文章/排行/商品编辑器「插入卡片」生成）
   1 个卡片水平居中；2 个卡片并列（窄屏自动换行）
   ============================================================ */
.article-card-embed {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 20px auto;
    max-width: 100%;
}
.article-card-embed .embed-card {
    width: 240px;
    max-width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}
.article-card-embed .embed-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.article-card-embed .embed-card-thumb { display: block; line-height: 0; }
.article-card-embed .embed-card-thumb img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
}
.article-card-embed .embed-card-name {
    display: block;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.article-card-embed .embed-card-sub {
    display: block;
    padding: 0 12px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #e63946;
    text-align: center;
}
@media (max-width: 640px) {
    .article-card-embed { gap: 12px; }
    .article-card-embed .embed-card { width: calc(50% - 6px); }
    .article-card-embed .embed-card-thumb img { height: 100px; }
}

@media (max-width: 1024px) {
    /* 移动端瀑布流改为真实双列 flex（由 JS 按高度均衡分发），
       彻底规避多列布局滚动重绘闪烁 / 分片盒子空白 bug。
       仅在 JS 添加 .wf-flex 后生效，无 JS 时回退为桌面多列布局 */
    .waterfall.wf-flex {
        display: flex;
        align-items: flex-start;
        gap: 14px;
        column-count: auto;
        column-gap: 14px; /* 勿置 0：flex 下 column-gap 即列间距 */
    }
    .waterfall .wf-col {
        flex: 1 1 0;
        min-width: 0;
    }
    .waterfall .wf-col .card {
        margin-bottom: 14px;
    }
}

.card {
    break-inside: avoid;
    margin-bottom: 20px;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card img {
    width: 100%;
    display: block;
    background: #f5f6f8;
    height: auto;
}

.card-body {
    padding: 12px 14px 14px;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
    color: var(--color-text);
    word-break: break-word;
    overflow-wrap: break-word;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.card-actions .btn {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    color: #fff;
    text-decoration: none;
    min-height: 36px;
    line-height: 1.4;
}

.card-actions .btn:hover {
    opacity: 0.85;
    transform: scale(0.98);
}

/* ============================================
   角标样式
============================================ */
.badge {
    position: absolute;
    top: 14px;
    left: 0;
    padding: 6px 16px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 0 6px 6px 0;
    z-index: 2;
    text-transform: uppercase;
}

/* ✅ 修改：使用主题强调色 */
.badge.top-badge {
    background: var(--color-accent);
    z-index: 3;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.badge.custom-badge {
    z-index: 2;
}

.card .badge.top-badge + .badge.custom-badge {
    top: 58px;
}

.card .badge.custom-badge:first-child {
    top: 14px;
}

/* ============================================
   空状态
============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

.empty-state .icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-weight: 400;
    font-size: 17px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 13px;
}

/* ============================================
   分页器
============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 24px 0 8px;
    margin-top: 8px;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.pagination .btn-page {
    min-width: 34px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
}

.pagination .btn-page:hover:not(.disabled):not(.active) {
    background: #f1f3f5;
    border-color: #c8cdd2;
}

/* ✅ 修改：使用主题主色 */
.pagination .btn-page.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.pagination .btn-page.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination .btn-page .arrow {
    font-size: 15px;
    line-height: 1;
}

.pagination .page-info {
    font-size: 13px;
    color: var(--color-text-secondary);
    padding: 0 10px;
    white-space: nowrap;
}

/* ============================================
   全部卡片列表页
============================================ */
.card-list-all {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 0;
}
.card-list-all .list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: box-shadow var(--transition);
}
.card-list-all .list-item:hover {
    box-shadow: var(--shadow-md);
}
.card-list-all .list-item .info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}
.card-list-all .list-item .info .title {
    font-weight: 500;
    font-size: 16px;
    color: var(--color-text);
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}
.card-list-all .list-item .info .title a {
    color: inherit;
    text-decoration: none;
}
.card-list-all .list-item .info .title a:hover {
    text-decoration: underline;
}
.card-list-all .list-item .info .article-date {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}
.card-list-all .list-item .info .date-meta {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}
.card-list-all .list-item .actions {
    flex-shrink: 0;
    margin-left: 12px;
}
.card-list-all .list-item .actions .btn {
    padding: 6px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #fff;
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
}
.card-list-all .list-item .actions .btn:hover {
    opacity: 0.85;
    transform: scale(0.97);
}

/* 分类标签（内联） */
.cat-link-inline {
    display: inline-block;
    padding: 2px 14px;
    background: #f0f0f0;
    border-radius: 16px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    transition: 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.cat-link-inline:hover {
    background: #e0e0e0;
}

/* 分类导航 */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 24px;
    padding: 0 4px;
}
.category-nav .cat-link {
    display: inline-block;
    padding: 6px 16px;
    background: #f0f0f0;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
}
.category-nav .cat-link:hover {
    background: #e0e0e0;
}
/* ✅ 修改：使用主题主色 */
.category-nav .cat-link.active {
    background: var(--color-primary);
    color: #fff;
}

/* ============================================
   响应式（手机端重点优化）
============================================ */
@media (max-width: 768px) {
    #topBanner {
        padding: 0 !important;
        margin: 0 auto 10px !important;
    }
    .banner-wrapper {
        display: block !important;
        width: 100% !important;
    }
    .banner-left {
        display: block !important;
        width: 100% !important;
        aspect-ratio: 16 / 9 !important;
        border-radius: var(--radius) !important;
        overflow: hidden !important;
        margin-bottom: 10px !important;
        background: #f5f6f8 !important;
        flex: none !important;
        height: auto !important;
        min-height: 0 !important;
    }
    .banner-left .banner-slide {
        width: 100% !important;
        height: 100% !important;
    }
    .banner-left .banner-slide img {
        width: 100% !important;
        height: 100% !important;
        object-fit: fill !important;
        display: block !important;
    }
    .banner-right {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-height: 250px !important;
        overflow-y: auto !important;
        flex: none !important;
    }
}

/* ===== 移动端头部（≤740px）：Logo 在上，标题在下，居中 ===== */
@media (max-width: 740px) {
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 0 12px;
    }

    .header-left {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2px;
    }
    .header-left .logo-icon {
        order: 0;
    }
    .header-left .header-titles {
        order: 1;
        align-items: center;
    }
    .header-left .header-titles #siteTitleDisplay,
    .header-left .header-titles #siteSubtitleDisplay {
        text-align: center !important;
    }

    .header-right {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        width: 100%;
        overflow: visible;
    }

    .header-nav-center {
        width: 100%;
        max-width: 100%;
        text-align: center;
        order: 1;
    }
    .nav-menu ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 6px;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .nav-menu ul li {
        flex-shrink: 0;
    }
    .nav-menu ul li a {
        font-size: 16px;
        padding: 2px 10px;
        white-space: nowrap;
    }

    .header-right {
        order: 2;
        flex-direction: row;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 10px;
    }
    .search-icon-btn {
        width: 32px;
        height: 32px;
    }
    .btn-header {
        padding: 5px 16px;
        font-size: 14px;
    }

    body {
        overflow-y: auto !important;
        height: auto !important;
    }
    .container {
        min-height: 100vh;
        height: auto;
        overflow: visible;
    }

    .header-right .stats {
        display: none;
    }
}

/* ===== 手机端列表项 ===== */
@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .pagination {
        gap: 4px;
        padding: 16px 0 8px;
    }
    .pagination .btn-page {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        padding: 0 8px;
        margin: 1px;
    }

    .card-body {
        padding: 10px 12px 12px;
    }
    .card-title {
        font-size: 14px;
    }
    .card-actions .btn {
        font-size: 12px;
        padding: 6px 8px;
        min-height: 32px;
    }
    .badge {
        font-size: 11px;
        padding: 4px 12px;
        top: 10px;
    }
    .card .badge.top-badge + .badge.custom-badge {
        top: 44px;
    }
    .waterfall {
        column-count: 2;
        column-gap: 14px;
    }

    .card-list-all .list-item {
        flex-wrap: wrap !important;
        padding: 10px 14px;
        gap: 6px;
    }

    .page-articles .card-list-all .list-item .actions,
    .page-downloads .card-list-all .list-item .actions {
        display: none !important;
    }

    .card-list-all .list-item .info {
        display: block !important;
        flex: unset !important;
        min-width: 0 !important;
        width: 100% !important;
        line-height: 1.6 !important;
    }

    .card-list-all .list-item .info .cat-link-inline {
        display: inline-block !important;
        vertical-align: middle !important;
        font-size: 12px !important;
        padding: 0 10px !important;
        margin-right: 6px !important;
        white-space: nowrap !important;
        flex-shrink: unset !important;
        background: #f0f0f0;
        border-radius: 16px;
        color: #333;
        text-decoration: none;
    }

    .card-list-all .list-item .info .title {
        display: inline !important;
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
        flex: unset !important;
        min-width: unset !important;
        width: auto !important;
    }
    .card-list-all .list-item .info .title a {
        display: inline !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    .card-list-all .list-item .info .article-date,
    .card-list-all .list-item .info .date-meta {
        display: none !important;
    }

    .page-ranking .card-list-all .list-item .actions,
    .page-all .card-list-all .list-item .actions {
        display: flex !important;
        flex-shrink: 0 !important;
        margin-left: 0 !important;
        text-align: right !important;
    }
    .page-ranking .card-list-all .list-item .actions .btn,
    .page-all .card-list-all .list-item .actions .btn {
        font-size: 12px !important;
        padding: 4px 12px !important;
        white-space: nowrap !important;
    }
}

/* ===== 超小屏（≤420px） ===== */
@media (max-width: 420px) {
    .card-list-all .list-item {
        padding: 8px 12px;
    }
    .card-list-all .list-item .info .cat-link-inline {
        font-size: 11px !important;
        padding: 0 8px !important;
        margin-right: 4px !important;
    }
    .card-list-all .list-item .info .title {
        font-size: 13px !important;
    }
}

/* ============================================
   页脚
============================================ */
.footer {
    text-align: center;
    padding: 20px 0 10px;
    margin-top: 30px;
    border-top: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-text-secondary);
}
.footer a {
    color: var(--color-text-secondary);
    text-decoration: none;
}
.footer a:hover {
    color: var(--color-text);
}

/* ===== 浮动搜索层 ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}
.search-overlay.active {
    display: flex;
}
.search-overlay .search-modal {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideUp 0.3s ease;
}
.search-overlay .search-modal .close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    color: #8a8f99;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}
.search-overlay .search-modal .close-btn:hover {
    color: #1a1a1a;
}
.search-overlay .search-modal .modal-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
    color: #1a1a1a;
}
.search-overlay .search-modal .input-row {
    display: flex;
    align-items: center;
    border: 1px solid #e2e4e8;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.25s;
    background: #fafbfc;
}
.search-overlay .search-modal .input-row:focus-within {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.06);
}
.search-overlay .search-modal .input-row input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 10px 0;
    color: #1a1a1a;
    min-width: 0;
}
.search-overlay .search-modal .input-row input::placeholder {
    /* 【P2】原 #b0b4bc 与白底对比度约 1.9:1，低于 WCAG AA 的 4.5:1；改为 #6b7280（≈4.6:1） */
    color: #6b7280;
    font-weight: 300;
}
.search-overlay .search-modal .input-row button {
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
.search-overlay .search-modal .input-row button:hover {
    background: #333;
}
.search-overlay .search-modal .input-row button:active {
    transform: scale(0.97);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .search-overlay .search-modal {
        padding: 16px 18px;
        width: 92%;
    }
    .search-overlay .search-modal .input-row {
        padding-left: 14px;
    }
    .search-overlay .search-modal .input-row input {
        font-size: 15px;
        padding: 8px 0;
    }
    .search-overlay .search-modal .input-row button {
        font-size: 13px;
        padding: 6px 16px;
    }
}

/* ============================================
   面包屑导航
============================================ */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 16px;
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-secondary);
    min-height: 20px;
}

.breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.breadcrumb .sep {
    color: #c0c4cc;
    user-select: none;
    flex-shrink: 0;
}

.breadcrumb .current {
    color: var(--color-text);
    font-weight: 500;
    word-break: break-word;
}

@media (max-width: 640px) {
    .breadcrumb {
        font-size: 12px;
        margin-bottom: 12px;
        padding: 2px 0;
        gap: 4px;
    }
}

/* ============================================================
   文章底部「附件下载」卡片（外链 / 文件仓库）
   ============================================================ */
.attach-block {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}
.attach-block-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 14px;
}
.attach-block-title::before {
    content: '';
    width: 4px;
    height: 17px;
    border-radius: 2px;
    background: var(--color-primary);
}
.attach-list { display: flex; flex-direction: column; gap: 10px; }

.attach-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.22s ease, transform 0.22s ease;
}
.attach-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.attach-ico {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 10px;
    background: var(--color-bg);
}
.attach-body { flex: 1; min-width: 0; }
.attach-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--color-text);
    overflow-wrap: anywhere;
    word-break: break-word;
}
.attach-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}
.attach-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    white-space: nowrap;
}
.attach-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}
.attach-btn:hover { background: var(--color-primary-hover); color: #fff; }

/* 外链（网盘）附件卡片 */
.attach-card-link {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}
.attach-link-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.attach-link-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}
.attach-text {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-family: inherit;
}

@media (max-width: 640px) {
    .attach-block { margin-top: 28px; padding-top: 20px; }
    .attach-block-title { font-size: 16px; margin-bottom: 12px; }
    .attach-card { flex-wrap: wrap; padding: 12px; gap: 12px; }
    .attach-ico { width: 38px; height: 38px; font-size: 18px; }
    .attach-name { font-size: 14px; }
    .attach-card .attach-btn { width: 100%; padding: 9px 14px; }
    .attach-card-link .attach-btn { width: auto; padding: 7px 14px; font-size: 12px; }
    .attach-text { font-size: 13px; }
}

/* ============================================================
   顶栏登录按钮（小号，靠右）
   ============================================================ */
.btn-header-small {
    padding: 4px 13px;
    font-size: 12.5px;
    line-height: 1.5;
    border-radius: 15px;
    color: #333;
    background: #ffffff;
    border: 1px solid #e2e4e8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.btn-header-small:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ============================================================
   移动端 APP 样式：底部工具栏（桌面隐藏，≤768px 显示）
   项由后台「手机页面 → 底部工具栏」配置，存于 settings.mobileNav
   ============================================================ */
.m-tabbar {
    display: none;
}
@media (max-width: 768px) {
    .m-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 990;
        background: rgba(255, 255, 255, 0.96);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        backdrop-filter: saturate(180%) blur(16px);
        border-top: 1px solid var(--color-border);
        padding: 5px 4px calc(5px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
    }
    .m-tabbar a {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 3px 0 2px;
        text-decoration: none;
        color: #8a8f99;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease;
    }
    .m-tabbar a .m-ico {
        width: 24px;
        height: 24px;
        font-size: 21px;
        line-height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-style: normal;
    }
    .m-tabbar a .m-ico img {
        width: 22px;
        height: 22px;
        object-fit: contain;
        border-radius: 4px;
    }
    .m-tabbar a .m-txt {
        font-size: 10.5px;
        line-height: 1.3;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .m-tabbar a.active {
        color: var(--color-primary);
        font-weight: 600;
    }
    .m-tabbar a.active .m-ico {
        transform: translateY(-1px) scale(1.08);
    }
    /* 给底部工具栏让位，防止内容被遮挡 */
    body {
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .footer {
        padding-bottom: 12px;
    }
}

/* ============================================================
   【P2 可访问性】键盘焦点可见性
   ------------------------------------------------------------
   背景：全站此前仅个别控件（admin.css 的 switch）有 :focus-visible 样式，
         键盘用户 Tab 到按钮/链接/输入框时几乎看不到焦点位置（不可访问）。
   做法：集中补一层 :focus-visible 描边，仅在键盘导航时生效（鼠标点击不出现）。
        使用 outline + outline-offset，不改变布局、不触发重排。
   ============================================================ */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 4px;
}
/* 深色实心按钮上 currentColor 为白色，描边需要对比度更高的浅色环 */
.btn-primary:focus-visible,
.btn-danger:focus-visible,
.m-tabbar a:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(26, 26, 26, 0.18);
}

/* ============================================================
   【P2】全屏高度兜底
   ------------------------------------------------------------
   iOS Safari / 移动端浏览器地址栏会占用视口，100vh 会导致内容被裁切。
   这里在支持 dvh 的浏览器上用 dvh 覆盖，不支持则保持 100vh（渐进增强）。
   ============================================================ */
@supports (height: 100dvh) {
    body { min-height: 100dvh; }
}
@media (max-width: 640px) {
    body { min-height: 100vh; }
    @supports (height: 100dvh) {
        body { min-height: 100dvh; }
    }
}
