/* ==========================================================================
   青草窝 · 桌面端样式（public/css/style.css）
   只在 pc/ 下的页面引用；手机端请用 mobile.css
   ========================================================================== */

/* 设计取向：现代、简洁、留白克制、以文字为主角 */

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

:root {
    --bg:          #fbfcfb;
    --surface:     #ffffff;
    --surface-2:   #f6f8f6;
    --text:        #1b211c;
    --text-2:      #59645c;
    --text-3:      #8d9a90;
    --line:        #e7ebe8;
    --line-2:      #d8dfda;
    --accent:      #16a34a;
    --accent-ink:  #12803c;
    --accent-soft: #eef8f2;
    --shadow-sm:   0 1px 2px rgba(20, 34, 24, .04);
    --shadow:      0 1px 2px rgba(20, 34, 24, .04), 0 10px 26px -18px rgba(20, 34, 24, .28);
    --r:           12px;
    --r-sm:        8px;

    --wrap:        740px;
    --wrap-wide:   980px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
    --bg:          #0f1210;
    --surface:     #161a16;
    --surface-2:   #1c211c;
    --text:        #e9eee9;
    --text-2:      #a8b3aa;
    --text-3:      #7d887e;
    --line:        #232a23;
    --line-2:      #323a31;
    --accent:      #3ddc78;
    --accent-ink:  #63e294;
    --accent-soft: #152a1c;
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, .5);
    --shadow:      0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px -18px rgba(0, 0, 0, .9);
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 20px;
}
.wrap-wide { max-width: var(--wrap-wide); }

/* ---------- 顶栏 ---------- */
.site-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.site-head .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    height: 54px;
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
    flex: none;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}
.brand-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand-text b {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
}
.brand-text i {
    font-style: normal;
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav { display: flex; align-items: center; gap: 2px; flex: none; }
.nav a {
    padding: 5px 9px;
    border-radius: 7px;
    font-size: 13.5px;
    color: var(--text-2);
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }

.theme-btn {
    margin-left: 4px;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-2);
    font-size: 13px;
    transition: border-color .15s, color .15s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- 首页头部 ---------- */
.hero { padding: 34px 0 22px; }
.hero h1 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.2px;
    line-height: 1.3;
}
.hero p {
    margin: 0;
    color: var(--text-2);
    font-size: 14px;
}
.hero .stat {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.hero .stat span {
    font-size: 12px;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 10px;
}

/* ---------- 搜索 ---------- */
.searchbar { margin: 0 0 16px; position: relative; }
.searchbar input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 13px;
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.searchbar input::placeholder { color: var(--text-3); }
.searchbar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.searchbar .hint {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-3);
    pointer-events: none;
}

/* ---------- 文章列表 ---------- */
.list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }

.card {
    display: block;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.card:hover {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.card h2 {
    margin: 0 0 6px;
    font-size: 17.5px;
    font-weight: 700;
    line-height: 1.42;
    letter-spacing: -.1px;
}
.card:hover h2 { color: var(--accent-ink); }
.card .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 10px;
    margin-bottom: 8px;
    font-size: 12.5px;
    color: var(--text-3);
}
.card .meta .cat {
    color: var(--accent-ink);
    background: var(--accent-soft);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11.5px;
}
.card .excerpt {
    margin: 0;
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.72;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card .more {
    display: inline-block;
    margin-top: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-ink);
}
.empty {
    padding: 40px 0;
    text-align: center;
    color: var(--text-3);
    font-size: 14px;
}

/* ---------- 文章页 ---------- */
.article { padding: 30px 0 10px; }
.article-head { margin-bottom: 22px; }
.article-head h1 {
    margin: 0 0 10px;
    font-size: 27px;
    font-weight: 800;
    line-height: 1.34;
    letter-spacing: -.3px;
}
.article-head .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 10px;
    color: var(--text-3);
    font-size: 13px;
}
.article-head .meta .cat {
    color: var(--accent-ink);
    background: var(--accent-soft);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 12px;
}

.post-body { color: var(--text); font-size: 15.5px; line-height: 1.82; }
.post-body > *:first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.05em; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
    margin: 1.6em 0 .6em;
    font-weight: 700;
    line-height: 1.42;
    letter-spacing: -.1px;
}
.post-body h2 {
    font-size: 19px;
    padding-left: 11px;
    border-left: 3px solid var(--accent);
}
.post-body h3 { font-size: 16.5px; }
.post-body h4 { font-size: 15.5px; color: var(--text-2); }
.post-body a {
    color: var(--accent-ink);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    text-underline-offset: 3px;
}
.post-body a:hover { text-decoration-color: var(--accent); }
.post-body ul, .post-body ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.post-body li { margin: .3em 0; }
.post-body img {
    display: block;
    margin: 1.1em auto;
    /* 抵消编辑器写进正文的 width/height:100% 内联样式 */
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 460px;
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-sm);
}
.post-body h1 img, .post-body h2 img, .post-body h3 img { margin: 0 auto .35em; }
.post-body blockquote {
    margin: 1.1em 0;
    padding: 10px 15px;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--text-2);
}
.post-body blockquote > *:last-child { margin-bottom: 0; }
.post-body code {
    font-family: var(--mono);
    font-size: .88em;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 5px;
}
.post-body pre {
    margin: 1.1em 0;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow-x: auto;
}
.post-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.65;
}
.post-body hr {
    margin: 1.8em 0;
    border: 0;
    border-top: 1px solid var(--line);
}
.post-body table {
    width: 100%;
    margin: 1.1em 0;
    border-collapse: collapse;
    font-size: 14px;
}
.post-body th, .post-body td {
    padding: 8px 11px;
    border: 1px solid var(--line);
    text-align: left;
}
.post-body th { background: var(--surface-2); font-weight: 600; }

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 26px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.post-tags a {
    font-size: 12.5px;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 11px;
    transition: border-color .15s, color .15s;
}
.post-tags a:hover { border-color: var(--accent); color: var(--accent-ink); }

.pager {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 22px 0 0;
}
.pager a {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: 13.5px;
    color: var(--text-2);
    transition: border-color .15s, color .15s;
}
.pager a:hover { border-color: var(--accent); color: var(--accent-ink); }
.pager a span { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.pager a.next { text-align: right; }
.pager a b { font-weight: 600; color: var(--text); }
.pager a:hover b { color: var(--accent-ink); }

/* ---------- 归档 / 标签 ---------- */
.page-title {
    margin: 34px 0 6px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.2px;
}
.page-sub { margin: 0 0 20px; color: var(--text-2); font-size: 13.5px; }

.year { margin: 22px 0 6px; font-size: 13px; font-weight: 700; color: var(--text-3); letter-spacing: .6px; }
.year-list { list-style: none; margin: 0 0 4px; padding: 0; }
.year-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 14.5px;
}
.year-list li:last-child { border-bottom: 0; }
.year-list time { flex: none; color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.year-list a { min-width: 0; }
.year-list a:hover { color: var(--accent-ink); }

.tag-group { margin-bottom: 22px; }
.tag-group h3 {
    margin: 0 0 10px;
    font-size: 13.5px;
    color: var(--text-3);
    font-weight: 700;
    letter-spacing: .4px;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-2);
    transition: border-color .15s, color .15s, background .15s;
}
.chips a:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.chips a em { font-style: normal; font-size: 11.5px; color: var(--text-3); }

/* ---------- 关于页 ---------- */
.about-card {
    padding: 22px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}

/* ---------- 页脚 ---------- */
.site-foot {
    margin-top: 40px;
    padding: 20px 0 30px;
    border-top: 1px solid var(--line);
}
.site-foot p { margin: 0; font-size: 12.5px; color: var(--text-3); text-align: center; }
.site-foot a:hover { color: var(--accent-ink); }

/* ---------- 回到顶部 ---------- */
.to-top {
    position: fixed;
    right: 18px; bottom: 18px;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--text-2);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, color .15s, border-color .15s;
}
.to-top.on { opacity: 1; pointer-events: auto; }
.to-top:hover { color: var(--accent-ink); border-color: var(--accent); }
