/*
Theme Name: Ruanjian Resource Hub
Theme URI: https://ruanjian.cc
Author: 启微软件园
Author URI: https://ruanjian.cc
Description: 启微软件园专属主题 —— 企业SaaS软件、自研AI Skill、Agent智能体、各类系统源码一站式资源平台。所有资源仅提供外部下载链接，源码不存储本站服务器。包含资源详情页结构化字段（技术适配、部署说明、下载地址、预览地址）。
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ruanjian-resource
Tags: resources, saas, agent, source-code, one-column, custom-colors
*/

/* ============ 基础 ============ */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --accent: #7c3aed;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --shadow: 0 2px 12px rgba(30, 41, 59, .06);
    --shadow-lg: 0 8px 30px rgba(30, 41, 59, .12);
    --success: #059669;
    --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* ============ 顶部导航 ============ */
.site-header {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; height: 64px;
}
.site-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.site-brand .logo-mark {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: var(--gradient); display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 18px;
}
.site-brand .site-title { font-size: 18px; font-weight: 800; color: var(--text); white-space: nowrap; }
.site-brand .site-title span { color: var(--primary); }

.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.main-nav li a {
    display: block; padding: 8px 14px; border-radius: 8px;
    color: var(--text-muted); font-size: 15px; font-weight: 500;
}
.main-nav li a:hover { color: var(--primary); background: var(--primary-light); }
.main-nav li.current-menu-item > a,
.main-nav li.current-cat > a { color: var(--primary); background: var(--primary-light); font-weight: 600; }

.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 18px; color: var(--text); }

/* ============ 按钮 ============ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: 10px; font-size: 15px; font-weight: 600;
    border: none; cursor: pointer; transition: all .2s; line-height: 1.4;
}
.btn-primary { background: var(--gradient); color: #fff !important; box-shadow: 0 4px 14px rgba(79, 70, 229, .35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79, 70, 229, .45); }
.btn-outline { background: #fff; color: var(--primary) !important; border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-download { background: var(--success); color: #fff !important; box-shadow: 0 4px 14px rgba(5, 150, 105, .3); }
.btn-download:hover { background: #047857; transform: translateY(-1px); }
.btn-preview { background: #fff; color: var(--primary) !important; border: 1.5px solid var(--primary); }
.btn-preview:hover { background: var(--primary-light); }
.btn-sm { padding: 8px 16px; font-size: 14px; }

/* ============ Hero（主页） ============ */
.hero {
    background: var(--gradient);
    background-image: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
    color: #fff; padding: 72px 0 64px; text-align: center;
    position: relative; overflow: hidden;
}
.hero::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(600px 300px at 20% 20%, rgba(255,255,255,.14), transparent 60%),
                radial-gradient(500px 260px at 80% 70%, rgba(255,255,255,.12), transparent 60%);
}
.hero .container { position: relative; }
.hero h1 { font-size: clamp(28px, 4.5vw, 44px); font-weight: 800; margin: 0 0 14px; line-height: 1.25; }
.hero .tagline { font-size: clamp(15px, 2vw, 18px); opacity: .94; max-width: 720px; margin: 0 auto 10px; }
.hero .badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }
.hero .badge {
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
    padding: 6px 14px; border-radius: 999px; font-size: 13px; backdrop-filter: blur(4px);
}
.hero-search { max-width: 560px; margin: 28px auto 0; display: flex; gap: 0; }
.hero-search .search-field {
    flex: 1; padding: 14px 18px; border: none; border-radius: 12px 0 0 12px;
    font-size: 15px; outline: none; color: var(--text);
}
.hero-search .search-submit {
    padding: 0 24px; border: none; border-radius: 0 12px 12px 0; cursor: pointer;
    background: #1e1b4b; color: #fff; font-size: 15px; font-weight: 600;
}

/* ============ 分类卡片 ============ */
.section { padding: 52px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 10px; }
.section-head h2 { margin: 0; font-size: 24px; font-weight: 800; }
.section-head .section-more { font-size: 14px; color: var(--text-muted); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.cat-card {
    background: var(--card); border-radius: var(--radius); padding: 24px 20px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    transition: all .25s; display: block; color: var(--text) !important;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.cat-card .cat-icon {
    width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 24px; background: var(--primary-light); margin-bottom: 14px;
}
.cat-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.cat-card p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.cat-card .cat-count { display: inline-block; margin-top: 12px; font-size: 12px; color: var(--primary); background: var(--primary-light); padding: 3px 10px; border-radius: 999px; font-weight: 600; }

/* ============ 资源卡片 ============ */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; }
.resource-card {
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    display: flex; flex-direction: column; transition: all .25s;
}
.resource-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.resource-card .thumb { height: 170px; background: var(--gradient); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 44px; }
.resource-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.resource-card .thumb .cat-badge {
    position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,.95);
    color: var(--primary); font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.resource-card .card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.resource-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; line-height: 1.4; }
.resource-card h3 a { color: var(--text); }
.resource-card h3 a:hover { color: var(--primary); }
.resource-card .card-excerpt { font-size: 14px; color: var(--text-muted); flex: 1; margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.resource-card .card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.resource-card .card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 12px; }

/* ============ 标签 ============ */
.tag { display: inline-block; background: var(--primary-light); color: var(--primary); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.tag:hover { background: var(--primary); color: #fff; }

/* ============ 单篇内容页（两栏布局） ============ */
.detail-wrap { display: grid; grid-template-columns: 3fr 1fr; gap: 36px; align-items: start; }
.main-box { background: var(--card); border-radius: 14px; padding: clamp(24px, 4vw, 36px); box-shadow: var(--shadow); border: 1px solid var(--border); }
.side-box { background: var(--card); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); position: sticky; top: 84px; }

.detail-title { font-size: clamp(22px, 3vw, 28px); margin: 0 0 14px; font-weight: 800; line-height: 1.35; }

.tag-group { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.tag-free { background: #E8F3FF; color: #165DFF; padding: 4px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.tag-pay { background: #FFF2E8; color: #F57D17; padding: 4px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.tag-type { background: #f0f0f0; color: #444; padding: 4px 12px; border-radius: 6px; font-size: 13px; text-decoration: none; }
.tag-type:hover { background: var(--primary-light); color: var(--primary); }

.sub-title { font-size: 18px; font-weight: 700; margin: 30px 0 14px; padding-bottom: 8px; border-bottom: 1px solid #eee; }
.text-desc { line-height: 1.9; color: #444; font-size: 15px; word-break: break-word; }
.text-desc p { margin: 0 0 12px; }

.info-list { margin: 20px 0; padding: 0; line-height: 2.1; }
.info-list li { list-style: none; font-size: 15px; color: #444; border-bottom: 1px dashed #f0f0f0; }
.info-list li:last-child { border-bottom: none; }
.info-list li strong { color: var(--primary); width: 130px; display: inline-block; font-weight: 600; }

.download-btn { display: block; width: 100%; text-align: center; padding: 14px; background: var(--primary); color: #fff; border-radius: 8px; text-decoration: none !important; font-size: 16px; font-weight: 600; margin-bottom: 14px; box-shadow: 0 4px 12px rgba(79, 70, 229, .3); }
.download-btn:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); }
.preview-btn { display: block; width: 100%; text-align: center; padding: 12px; background: #fff; color: var(--primary); border: 1.5px solid var(--primary); border-radius: 8px; text-decoration: none !important; font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.preview-btn:hover { background: var(--primary-light); }
.tip-text { font-size: 13px; color: #999; line-height: 1.8; margin: 12px 0 0; }

/* ============ 单篇内容页（旧版，兼容归档空状态等） ============ */
.page-wrap { padding: 36px 0 60px; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 8px; opacity: .5; }

.resource-detail {
    background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow); padding: clamp(22px, 4vw, 40px); margin-bottom: 24px;
}
.resource-detail h1.entry-title { margin: 0 0 12px; font-size: clamp(22px, 3vw, 30px); font-weight: 800; line-height: 1.35; }
.resource-detail .entry-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.resource-detail .entry-meta .cat-badge { background: var(--primary); color: #fff; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.resource-detail .entry-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 22px 0; }
.info-panel { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.info-panel h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.info-panel h3 .ic { font-size: 17px; }
.info-panel p { margin: 0; font-size: 14px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.info-panel ul { margin: 0; padding-left: 18px; font-size: 14px; }
.info-panel li { margin-bottom: 4px; }

.deploy-box { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 18px 20px; margin: 22px 0; font-size: 13.5px; }
.deploy-box h3 { margin: 0 0 10px; color: #93c5fd; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.deploy-box pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.7; color: #e2e8f0; }

.action-bar { display: flex; flex-wrap: wrap; gap: 14px; margin: 26px 0 4px; }
.entry-content { font-size: 15.5px; }
.entry-content h2, .entry-content h3 { margin-top: 28px; }
.entry-content ul, .entry-content ol { padding-left: 22px; }

.notice {
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
    padding: 14px 18px; font-size: 13.5px; color: #92400e; margin-top: 22px;
    display: flex; gap: 10px; align-items: flex-start;
}

.single-note { font-size: 13px; color: var(--text-muted); }

/* ============ 归档/列表 ============ */
.archive-head { background: var(--gradient); color: #fff; padding: 44px 0 40px; text-align: center; }
.archive-head h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; }
.archive-head p { margin: 0; opacity: .92; font-size: 15px; }
.archive-head .desc { max-width: 680px; margin: 10px auto 0; opacity: .85; font-size: 14px; }

/* ============ 分页 ============ */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 40px 0 10px; }
.pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px;
    padding: 0 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--border);
    color: var(--text); font-weight: 600; font-size: 14px;
}
.pagination .page-numbers.current { background: var(--gradient); color: #fff; border-color: transparent; }
.pagination .page-numbers:hover:not(.current) { border-color: var(--primary); color: var(--primary); }

/* ============ 页脚 ============ */
.site-footer { background: #0f172a; color: #94a3b8; padding: 44px 0 0; margin-top: 60px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; padding-bottom: 32px; }
.footer-grid h4 { color: #e2e8f0; font-size: 15px; margin: 0 0 14px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: #94a3b8; }
.footer-grid a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1e293b; padding: 18px 0; font-size: 13px; color: #64748b; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ============ 其他 ============ */
.entry-content a { text-decoration: underline; text-underline-offset: 3px; }
.screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; word-wrap: normal !important; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
    .footer-grid { grid-template-columns: 1fr; gap: 22px; }
    .info-grid { grid-template-columns: 1fr; }
    .resource-grid { grid-template-columns: 1fr; }
    .detail-wrap { grid-template-columns: 1fr; gap: 20px; }
    .side-box { position: static; }
}
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .main-nav {
        display: none; position: absolute; top: 64px; left: 0; right: 0;
        background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
        padding: 12px 20px 18px;
    }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
    .main-nav li a { padding: 11px 14px; }
    .hero { padding: 52px 0 46px; }
    .section { padding: 38px 0; }
}
