/* =========================================================
   GridPro - Typecho 卡片网格主题 v4
   7claw 风格 Nav + 极简卡片
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f6f9;
    --text: #333333;
    --text-light: #888888;
    --text-muted: #aaaaaa;
    --border: #f0f0f0;
    --accent: #f1404b;
    --accent-hover: #d63841;
    --accent-light: #fff5f5;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --max-width: 1280px;
}

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg); color: var(--text);
    line-height: 1.6; min-height: 100vh;
    display: flex; flex-direction: column;
}

a { text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* =========================================================
   Header — 7claw 风格
   ========================================================= */
#site-header {
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: sticky; top: 0; z-index: 100;
}

.header-inner {
    display: flex; align-items: center; height: 60px; gap: 0;
}

.site-logo {
    flex-shrink: 0; display: flex; align-items: center; margin-right: 30px;
}
.site-logo img { height: 40px; width: auto; }
.site-title { font-size: 1.25rem; font-weight: 700; color: var(--text); }

/* Nav — 纯文字链接 */
#main-nav { flex: 1; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-list { list-style: none; display: flex; align-items: center; height: 60px; }
.nav-list li { flex-shrink: 0; }
.nav-list li a {
    display: flex; align-items: center; height: 60px;
    padding: 0 18px; font-size: 0.95rem; color: var(--text);
    white-space: nowrap; transition: color 0.2s; position: relative;
}
.nav-list li a:hover { color: var(--accent); }
.nav-list li.current a { color: var(--accent); font-weight: 600; }
.nav-list li.current a::after {
    content: ''; position: absolute; bottom: 0; left: 50%;
    transform: translateX(-50%); width: 24px; height: 3px;
    background: var(--accent); border-radius: 2px;
}

/* 右侧图标 */
.header-actions {
    flex-shrink: 0; display: flex; align-items: center;
    gap: 12px; margin-left: 20px;
}
.header-search-icon, .mobile-nav-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    color: var(--text); transition: background 0.2s, color 0.2s;
}
.header-search-icon:hover, .mobile-nav-toggle:hover { background: #f5f5f5; color: var(--accent); }
.mobile-nav-toggle { display: none; }

/* 搜索弹窗 */
.search-modal { display: none; position: fixed; inset: 0; z-index: 999; align-items: center; justify-content: center; }
.search-modal.open { display: flex; }
.search-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.search-modal-box {
    position: relative; background: #fff; border-radius: 12px; padding: 30px;
    width: 100%; max-width: 560px; z-index: 1; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.search-modal-box h3 { font-size: 1.1rem; margin-bottom: 20px; }
.search-modal-box form { display: flex; gap: 10px; }
.search-modal-box input {
    flex: 1; padding: 12px 16px; border: 1px solid #ddd;
    border-radius: 6px; font-size: 0.95rem; outline: none;
}
.search-modal-box input:focus { border-color: var(--accent); }
.search-modal-box button[type="submit"] {
    padding: 12px 28px; background: var(--accent); color: #fff;
    border: none; border-radius: 6px; font-size: 0.95rem; cursor: pointer;
}
.search-modal-box button[type="submit"]:hover { background: var(--accent-hover); }
.search-modal-close {
    position: absolute; top: 14px; right: 18px;
    background: none; border: none; font-size: 1.6rem;
    cursor: pointer; color: var(--text-light); line-height: 1;
}

/* 移动端导航面板 */
.mobile-nav-panel { display: none; position: fixed; inset: 0; z-index: 999; }
.mobile-nav-panel.open { display: block; }
.mobile-nav-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.mobile-nav-body {
    position: absolute; top: 0; right: 0; width: 280px;
    height: 100%; background: #fff; z-index: 1; overflow-y: auto;
}
.mobile-nav-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.mobile-nav-head button { background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--text-light); }
.mobile-nav-list { list-style: none; padding: 12px 0; }
.mobile-nav-list li a { display: block; padding: 12px 24px; font-size: 1rem; color: var(--text); }
.mobile-nav-list li a:hover { background: #f5f5f5; }

/* =========================================================
   Main
   ========================================================= */
#site-main { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.archive-title {
    font-size: 1.25rem; margin-bottom: 20px; color: var(--text);
    padding-bottom: 12px; border-bottom: 2px solid var(--accent); display: inline-block;
}

/* 子分类筛选条 */
.subcat-bar { margin-bottom: 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.subcat-list { list-style: none; display: flex; gap: 10px; padding-bottom: 4px; flex-wrap: wrap; }
.subcat-list li a {
    display: block; padding: 7px 20px; border-radius: 20px; font-size: 0.875rem;
    background: #fff; color: var(--text); border: 1px solid var(--border);
    white-space: nowrap; transition: all 0.25s;
}
.subcat-list li a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.subcat-list li.active a { background: var(--accent); color: #fff; border-color: var(--accent); }

/* =========================================================
   文章卡片 — 极简：封面 + 标题 + 浏览量(左) / 分类(右)
   ========================================================= */
.post-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 3), 1fr);
    gap: 16px;
}

.post-card {
    background: #fff; border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.25s, box-shadow 0.25s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,0.12); }
.post-card-link { display: block; color: inherit; }

/* 封面 */
.post-card-cover { overflow: hidden; position: relative; background: #f0f1f3; }
.cover-ratio-16-9 { aspect-ratio: 16/9; }
.cover-ratio-4-3  { aspect-ratio: 4/3; }
.cover-ratio-3-2  { aspect-ratio: 3/2; }
.cover-ratio-1-1  { aspect-ratio: 1/1; }
.cover-ratio-3-4  { aspect-ratio: 3/4; }
.cover-ratio-2-3  { aspect-ratio: 2/3; }
.post-card-cover img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.35s;
}
.post-card:hover .post-card-cover img { transform: scale(1.05); }

.cover-placeholder {
    width: 100%; height: 100%; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #e8eaed 0%, #d5d8dc 100%);
}

/* 标题 */
.post-card-title {
    font-size: 1rem; font-weight: 600; line-height: 1.45;
    padding: 12px 14px 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; color: var(--text);
}

/* 底部：浏览量(左) / 分类(右) */
.post-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px 12px; gap: 8px;
}

.post-card-views {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.78rem; color: var(--text-muted);
}
.post-card-views svg { flex-shrink: 0; }

.post-card-cat {
    font-size: 0.78rem; color: var(--accent);
    text-align: right;
}
.post-card-cat a { color: var(--accent); }
.post-card-cat a:hover { text-decoration: underline; }

/* =========================================================
   分页
   ========================================================= */
.pagination { margin-top: 40px; text-align: center; }
.pagination ol { list-style: none; display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pagination li a, .pagination li span {
    display: block; min-width: 38px; height: 38px; line-height: 38px;
    padding: 0 12px; border-radius: 6px; font-size: 0.9rem;
    background: #fff; color: var(--text);
    border: 1px solid var(--border); transition: all 0.2s;
}
.pagination li a:hover { border-color: var(--accent); color: var(--accent); }
.pagination li span.current { background: var(--accent); color: #fff; border-color: var(--accent); }

.no-content { text-align: center; padding: 60px 20px; color: var(--text-light); font-size: 1.1rem; }
.no-content a { margin-top: 16px; display: inline-block; padding: 10px 24px; background: var(--accent); color: #fff; border-radius: 6px; }

/* =========================================================
   文章详情页
   ========================================================= */
.post-single, .page-single { max-width: 860px; margin: 0 auto; }
.post-detail {
    background: #fff; border-radius: var(--radius);
    padding: 32px 40px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.post-detail-header { margin-bottom: 28px; }
.post-detail-title { font-size: 1.8rem; font-weight: 700; line-height: 1.4; margin-bottom: 14px; }
.post-detail-meta { font-size: 0.875rem; color: var(--text-light); display: flex; gap: 18px; flex-wrap: wrap; }
.post-detail-content { font-size: 1.05rem; line-height: 1.9; }
.post-detail-content p { margin-bottom: 1.2em; }
.post-detail-content img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.post-detail-content h2 { font-size: 1.4rem; margin: 1.8em 0 0.8em; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.post-detail-content h3 { font-size: 1.2rem; margin: 1.5em 0 0.6em; }
.post-detail-content blockquote {
    border-left: 4px solid var(--accent); padding: 10px 20px; margin: 1.2em 0;
    background: var(--accent-light); border-radius: 0 6px 6px 0; color: #666;
}
.post-detail-content pre {
    background: #2b2d42; color: #e0e0e0; padding: 18px 22px;
    border-radius: var(--radius); overflow-x: auto; font-size: 0.9rem; line-height: 1.6;
}
.post-detail-content code { background: var(--accent-light); color: var(--accent); padding: 2px 7px; border-radius: 4px; font-size: 0.9em; }
.post-detail-content pre code { background: none; color: #e0e0e0; padding: 0; }
.post-detail-tags { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.post-detail-tags a {
    display: inline-block; padding: 5px 16px; margin: 0 8px 8px 0;
    background: #f5f5f5; border-radius: 20px; font-size: 0.85rem; color: var(--text-light); transition: all 0.2s;
}
.post-detail-tags a:hover { background: var(--accent); color: #fff; }

/* 评论区 */
.comments-area { margin-top: 32px; background: #fff; border-radius: var(--radius); padding: 28px 34px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.comment-list { list-style: none; }
.comment-item { padding: 18px 0; border-bottom: 1px solid var(--border); }
.comment-author { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-author img { border-radius: 50%; width: 40px; height: 40px; }
.comment-author cite { font-style: normal; font-weight: 600; font-size: 0.95rem; }
.comment-content { font-size: 0.95rem; margin-bottom: 6px; line-height: 1.7; }
.comment-meta { font-size: 0.8rem; color: var(--text-light); display: flex; gap: 14px; }
.comment-children { list-style: none; margin-left: 44px; }
.comment-children .comment-item { border-bottom: none; padding: 12px 0; }
.comment-form { margin-top: 28px; }
.comment-form h3 { margin-bottom: 18px; font-size: 1.1rem; }
.comment-form label { display: block; margin-bottom: 4px; font-size: 0.9rem; font-weight: 500; }
.comment-form input, .comment-form textarea {
    width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px;
    font-size: 0.95rem; margin-bottom: 14px; outline: none; font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(241,64,75,0.1); }
.comment-form button { padding: 10px 32px; background: var(--accent); color: #fff; border: none; border-radius: 6px; font-size: 0.95rem; cursor: pointer; }
.comment-form button:hover { background: var(--accent-hover); }

/* Footer */
#site-footer { background: #2b2d42; padding: 24px 0; margin-top: auto; }
.footer-inner { text-align: center; }
.copyright { font-size: 0.85rem; color: rgba(255,255,255,0.6); }
.copyright a { color: rgba(255,255,255,0.85); }
.copyright a:hover { color: #fff; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
    #main-nav { display: none; }
    .mobile-nav-toggle { display: flex; }
    .header-inner { height: 56px; }
    .post-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .post-detail { padding: 20px 24px; }
}

@media (max-width: 420px) {
    .post-grid { grid-template-columns: 1fr; }
    .post-detail-title { font-size: 1.3rem; }
}
