/* ============================================================
   MagCard — 自然清新风 Typecho 主题（米绿 + 墨绿，全无衬线）
   ============================================================ */
:root {
    --bg: #f3f6ec;
    --card: #ffffff;
    --ink: #26301f;
    --muted: #7d8772;
    --accent: #3a6b35;
    --accent-dark: #2a4f26;
    --line: #dfe5d0;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(45, 60, 35, .06);
    --shadow-hover: 0 8px 24px rgba(45, 60, 35, .12);
    --serif: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --sans: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.75;
    color: var(--ink);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }

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

/* ---------------- 顶栏 ---------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(246, 244, 239, .88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.site-header .container {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 60px;
}
.site-name {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .5px;
    white-space: nowrap;
}
.site-name a:hover { color: var(--ink); }
.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: .92rem;
    color: var(--muted);
    white-space: nowrap;
}
.main-nav a:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.main-nav a.current { color: var(--accent); font-weight: 600; }
.header-search { position: relative; }
.header-search input {
    width: 150px;
    padding: 7px 12px;
    font-size: .88rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
    outline: none;
    transition: width .25s;
}
.header-search input:focus { width: 200px; border-color: var(--accent); }

/* ---------------- 首页头条 ---------------- */
.hero-card {
    position: relative;
    display: block;
    margin-top: 28px;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 340px;
    background: #2a2a2a;
    box-shadow: var(--shadow-hover);
}
.hero-card .cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s;
}
.hero-card:hover .cover { transform: scale(1.03); }
.hero-card .hero-noimg {
    position: absolute;
    inset: 0;
}
.hero-card .hero-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 340px;
    padding: 32px;
    color: #fff;
    background: linear-gradient(to top, rgba(15, 12, 8, .82) 0%, rgba(15, 12, 8, .35) 55%, rgba(15, 12, 8, .05) 100%);
}
.hero-kicker {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: .8rem;
    letter-spacing: 2px;
    opacity: .9;
}
.hero-kicker .cat { color: #cfe8c8; }
.hero-card h2 {
    font-family: var(--serif);
    font-size: 1.9rem;
    line-height: 1.35;
    margin: 10px 0;
    max-width: 720px;
}
.hero-card:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.hero-meta { font-size: .85rem; opacity: .85; }

/* ---------------- 卡片网格 ---------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
    margin: 28px 0;
}
.post-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .25s, box-shadow .25s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #eee;
}
.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s;
}
.post-card:hover .card-cover img { transform: scale(1.05); }
.cover-ph { position: absolute; inset: 0; }
.g1 { background: linear-gradient(135deg, #a8c5a0, #3a6b35); }
.g2 { background: linear-gradient(135deg, #9cb8a8, #2f5546); }
.g3 { background: linear-gradient(135deg, #c5d1a3, #6b7f3a); }
.g4 { background: linear-gradient(135deg, #a3c4bd, #3f6b5c); }
.card-body { padding: 18px 20px 16px; flex: 1; display: flex; flex-direction: column; }
.card-cat {
    font-size: .75rem;
    letter-spacing: 1.5px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
}
.card-title {
    font-family: var(--serif);
    font-size: 1.18rem;
    line-height: 1.45;
    margin-bottom: 10px;
}
.card-title a:hover { color: var(--accent); }
.card-excerpt {
    font-size: .92rem;
    color: var(--muted);
    line-height: 1.7;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
    font-size: .8rem;
    color: var(--muted);
}

/* ---------------- 文章页 ---------------- */
.page-wrap { max-width: 760px; margin: 0 auto; }
.entry {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 44px 48px;
    margin: 28px 0;
    box-shadow: var(--shadow);
}
.entry-head { margin-bottom: 28px; }
.entry-cat {
    font-size: .8rem;
    letter-spacing: 2px;
    color: var(--accent);
    font-weight: 600;
}
.entry-title {
    font-family: var(--serif);
    font-size: 2rem;
    line-height: 1.4;
    margin: 10px 0 14px;
}
.entry-meta { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 14px; }
.entry-meta a { color: var(--muted); }
.entry-meta a:hover { color: var(--accent); }
.entry-content { font-size: 1rem; }
.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5 {
    font-family: var(--serif);
    margin: 1.8em 0 .7em;
    line-height: 1.4;
}
.entry-content h2 { font-size: 1.4rem; border-left: 4px solid var(--accent); padding-left: 12px; }
.entry-content h3 { font-size: 1.2rem; }
.entry-content p { margin: 1em 0; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 12px 20px;
    border-left: 4px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    border-radius: 0 6px 6px 0;
}
.entry-content img { border-radius: 6px; }
.entry-content pre {
    background: #2b2926;
    color: #e8e4dc;
    padding: 18px 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: .88rem;
    line-height: 1.6;
}
.entry-content code {
    font-family: var(--mono);
    font-size: .9em;
    background: rgba(179, 64, 42, .08);
    color: var(--accent-dark);
    padding: 2px 6px;
    border-radius: 4px;
}
.entry-content pre code { background: none; color: inherit; padding: 0; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .92rem; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.entry-content th { background: var(--bg); }
.entry-content ul, .entry-content ol { padding-left: 1.6em; margin: 1em 0; }
.entry-content ul li { list-style: disc; }
.entry-content ol li { list-style: decimal; }
.entry-content a { color: var(--accent); border-bottom: 1px solid rgba(179, 64, 42, .3); }
.entry-tags { margin-top: 30px; padding-top: 18px; border-top: 1px dashed var(--line); font-size: .85rem; }
.entry-tags a {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 3px 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--muted);
    font-size: .8rem;
}
.entry-tags a:hover { color: var(--accent); border-color: var(--accent); }

/* 上一篇/下一篇 */
.post-near {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    font-size: .9rem;
}
.post-near a {
    flex: 1;
    padding: 14px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
}
.post-near a:hover { color: var(--accent); box-shadow: var(--shadow); }
.post-near .near-next { text-align: right; }

/* ---------------- 归档时间线 ---------------- */
.page-title {
    font-family: var(--serif);
    font-size: 1.7rem;
    margin: 32px 0 8px;
}
.page-sub { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }
.timeline { position: relative; padding-left: 26px; margin: 24px 0; }
.timeline::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--line);
}
.timeline-month {
    position: relative;
    font-family: var(--serif);
    font-weight: 700;
    margin: 22px 0 10px;
    font-size: 1.05rem;
}
.timeline-month::before {
    content: "";
    position: absolute;
    left: -27px;
    top: .55em;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 2px var(--accent);
}
.timeline li { padding: 5px 0; border: none; }
.timeline-item {
    display: flex;
    gap: 16px;
    align-items: baseline;
    padding: 6px 0;
}
.timeline-item time { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 40px; }
.tag-cloud a {
    padding: 4px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    font-size: .85rem;
    color: var(--muted);
}
.tag-cloud a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------- 评论 ---------------- */
.comments { margin-bottom: 40px; }
.comments-title {
    font-family: var(--serif);
    font-size: 1.25rem;
    margin: 30px 0 18px;
}
.comment-list { }
.comment-list ol.children { margin-left: 46px; }
.comment-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}
.comment-avatar img { border-radius: 50%; width: 42px; height: 42px; }
.comment-body { flex: 1; min-width: 0; }
.comment-author { font-weight: 600; font-size: .92rem; }
.comment-author .author-url { color: var(--accent); font-weight: 400; font-size: .82rem; margin-left: 8px; }
.comment-date { font-size: .78rem; color: var(--muted); margin-left: 10px; font-weight: 400; }
.comment-text { font-size: .94rem; margin: 6px 0 8px; word-break: break-word; }
.comment-reply {
    font-size: .8rem;
    color: var(--muted);
}
.comment-reply:hover { color: var(--accent); }
.respond {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 28px;
    margin-top: 24px;
}
.respond h3 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 16px; }
.respond .form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.respond input[type="text"], .respond input[type="email"], .respond input[type="url"] {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .92rem;
    background: var(--bg);
    outline: none;
}
.respond input:focus, .respond textarea:focus { border-color: var(--accent); }
.respond textarea {
    width: 100%;
    margin-top: 12px;
    padding: 12px 14px;
    min-height: 130px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .94rem;
    font-family: inherit;
    background: var(--bg);
    outline: none;
    resize: vertical;
}
.respond button {
    margin-top: 14px;
    padding: 10px 28px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    transition: background .2s;
}
.respond button:hover { background: var(--accent-dark); }
.respond .logged-in { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.cancel-comment-reply { font-size: .85rem; margin-bottom: 8px; }
.cancel-comment-reply a { color: var(--accent); }

/* ---------------- 归档/搜索列表头 ---------------- */
.archive-head {
    margin: 32px 0 6px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.search-box {
    display: flex;
    margin: 20px 0 8px;
    max-width: 460px;
}
.search-box input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: var(--card);
    outline: none;
    font-size: .94rem;
}
.search-box button {
    padding: 10px 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 0 8px 8px 0;
}

/* ---------------- 分页 ---------------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 36px 0;
    font-size: .9rem;
}
.pagination a, .pagination .current {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
}
.pagination a:hover { color: var(--accent); border-color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------------- 页脚 ---------------- */
.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 30px;
    padding: 26px 0 34px;
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
}
.site-footer a { color: var(--muted); border-bottom: 1px dotted var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--muted);
}
.empty-state .big { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 10px; color: var(--ink); }

/* 返回顶部 */
.backtop {
    position: fixed;
    right: 24px;
    bottom: 32px;
    z-index: 99;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    color: var(--accent);
    font-size: 1.1rem;
    box-shadow: var(--shadow-hover);
    transition: opacity .2s;
}
.backtop:hover { background: var(--accent); color: #fff; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 720px) {
    .site-header .container { gap: 12px; }
    .site-name { font-size: 1.15rem; }
    .header-search { margin-left: auto; }
    .header-search input { width: 96px; }
    .main-nav { order: 3; width: 100%; }
    .site-header .container { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
    .hero-card, .hero-card .hero-overlay { min-height: 260px; }
    .hero-card h2 { font-size: 1.4rem; }
    .entry { padding: 26px 20px; }
    .entry-title { font-size: 1.5rem; }
    .card-grid { grid-template-columns: 1fr; }
    .comment-list ol.children { margin-left: 24px; }
}
