:root {
    --soil: #43301c;
    --soil-soft: #6b4423;
    --wood: #a9713c;
    --wood-light: #caa26a;
    --paper: #fbf1d8;
    --paper-muted: #f3e3c3;
    --straw: #e7d6ab;
    --leaf: #5c8a3a;
    --sun: #e7a63c;
    --danger: #b94b2e;
    --shadow: rgba(75, 46, 23, .28);
    --font-display: "ZCOOL KuaiLe", "Kaiti SC", "STKaiti", "KaiTi", sans-serif;
    --font-body: "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --shell: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100dvh;
    color: var(--soil);
    background-color: var(--paper-muted);
    background-image: radial-gradient(circle at 1px 1px, rgba(107, 68, 35, .07) 1px, transparent 0);
    background-size: 16px 16px;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #fff; box-shadow: 0 0 0 6px var(--leaf); }
.pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }
.content-shell { width: min(calc(100% - 32px), var(--shell)); margin-inline: auto; }

.skip-link {
    position: fixed; left: 16px; top: -100px; z-index: 100;
    padding: 10px 14px; color: var(--paper); background: var(--soil);
}
.skip-link:focus { top: 12px; }

.wood-panel {
    position: relative;
    background: var(--paper);
    border: 3px solid var(--soil-soft);
    border-radius: 6px;
    box-shadow: inset 0 0 0 3px var(--wood-light), 0 5px 0 var(--shadow);
}

.site-header {
    position: sticky; top: 0; z-index: 20;
    color: var(--paper); background: rgba(169, 113, 60, .97);
    border-bottom: 3px solid var(--soil-soft);
    backdrop-filter: blur(8px);
}
.header-inner {
    width: min(calc(100% - 32px), var(--shell)); min-height: 66px; margin: 0 auto;
    display: flex; align-items: center; gap: 18px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand-mark, .section-icon, .panel-icon {
    display: grid; place-items: center; color: var(--paper); background: var(--leaf);
    border: 3px solid var(--soil-soft); border-radius: 6px;
}
.brand-mark { width: 40px; height: 40px; box-shadow: 0 3px 0 var(--soil-soft); font-family: var(--font-display); font-weight: 900; }
.brand-name, .site-nav a, h1, h2, h3, .footer-title, .pixel-button, .category-badge {
    font-family: var(--font-display); font-weight: 900;
}
.brand-name { font-size: 22px; letter-spacing: .02em; text-shadow: 2px 2px 0 rgba(82, 48, 22, .45); }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav a { padding: 7px 12px; border-radius: 5px; white-space: nowrap; transition: color .18s ease, background .18s ease, transform .18s ease; }
.site-nav a:hover, .site-nav a.is-active { color: var(--soil); background: var(--sun); box-shadow: 0 3px 0 var(--soil-soft); transform: translateY(-1px); }
.header-actions { display: flex; gap: 9px; }
.icon-button {
    width: 38px; height: 38px; display: grid; place-items: center;
    color: var(--soil); background: var(--paper); border: 3px solid var(--soil-soft); border-radius: 5px;
    box-shadow: 0 3px 0 var(--soil-soft); cursor: pointer; font-size: 22px; font-weight: 900;
    transition: transform .1s ease, box-shadow .1s ease;
}
.icon-button--accent { background: var(--sun); }
.icon-button:active { transform: translateY(3px); box-shadow: none; }
.search-drawer {
    width: min(calc(100% - 32px), 700px); margin: 0 auto; padding: 0 0 14px;
}
.search-drawer label { display: block; margin-bottom: 5px; font-weight: 700; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-row input, .comments-area input, .comments-area textarea {
    width: 100%; color: var(--soil); background: var(--paper); border: 3px solid var(--soil-soft); border-radius: 5px; padding: 10px 12px;
}

.hero { overflow: hidden; }
.hero-image-wrap { position: relative; height: 320px; }
.hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center 52%; }
.hero-fade { position: absolute; inset: auto 0 0; height: 110px; background: linear-gradient(to top, var(--paper-muted), transparent); }
.hero-content { position: relative; margin-top: -58px; }
.hero-panel { padding: 24px 30px 28px; }
.eyebrow { margin: 0 0 3px; color: var(--leaf); font-weight: 800; }
.hero-panel h1 { margin: 0; font-size: clamp(30px, 4vw, 42px); line-height: 1.2; letter-spacing: -.03em; text-wrap: balance; }
.hero-panel > p:last-child { max-width: 720px; margin: 13px 0 0; color: #735633; text-wrap: pretty; }

.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) 302px; gap: 32px; padding-block: 40px 70px; align-items: start; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-icon { width: 34px; height: 34px; flex: 0 0 auto; }
.section-heading h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.section-heading p { margin: 4px 0 0; color: #7a5a34; font-size: 14px; }
.post-list { display: grid; gap: 24px; }
.post-card { display: grid; grid-template-columns: 228px minmax(0, 1fr); overflow: hidden; transition: transform .22s ease, box-shadow .22s ease; }
.post-card:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 3px var(--wood-light), 0 8px 0 var(--shadow); }
.post-cover { position: relative; display: block; min-height: 220px; overflow: hidden; border-right: 3px solid var(--soil-soft); background: var(--straw); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s steps(5, end); }
.post-card:hover .post-cover img { transform: scale(1.045); }
.category-badge {
    position: absolute; left: 10px; top: 10px; max-width: calc(100% - 20px);
    padding: 3px 9px; color: var(--soil); background: var(--sun); border: 3px solid var(--soil-soft); border-radius: 5px;
    font-size: 13px; line-height: 1.35;
}
.post-card-body { min-width: 0; display: flex; flex-direction: column; padding: 20px 22px; }
.post-card h2 { margin: 0; font-size: 21px; line-height: 1.35; text-wrap: balance; }
.post-card h2 a { transition: color .18s ease; }
.post-card h2 a:hover { color: var(--leaf); }
.post-excerpt { margin: 9px 0 16px; color: #735633; line-height: 1.72; text-wrap: pretty; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: auto; color: #7a5a34; font-size: 13px; font-variant-numeric: tabular-nums; }
.post-meta > a:hover { color: var(--leaf); }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.post-tags a, .article-tags a {
    display: inline-flex; padding: 2px 8px; color: #6f522f; background: var(--straw); border: 1px solid #987044; border-radius: 5px;
}
.post-tags a:hover, .article-tags a:hover { color: var(--paper); background: var(--leaf); }

.sidebar { display: grid; gap: 24px; }
.author-card { overflow: hidden; }
.author-main { display: flex; align-items: center; gap: 14px; padding: 20px; background: #dbc19a; border-bottom: 3px solid var(--soil-soft); }
.avatar { width: 64px; height: 64px; object-fit: cover; border: 3px solid var(--soil-soft); border-radius: 5px; background: var(--paper); }
.author-main h2 { margin: 0; font-size: 20px; }
.author-main p { margin: 2px 0 0; color: #735633; font-size: 14px; }
.site-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; }
.site-stats div { display: flex; flex-direction: column-reverse; align-items: center; padding: 11px 5px; }
.site-stats div + div { border-left: 1px solid #aa8257; }
.site-stats dt { color: #735633; font-size: 12px; }
.site-stats dd { margin: 0; color: var(--leaf); font-family: var(--font-display); font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.side-panel { padding: 18px 20px 21px; }
.side-panel h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 19px; }
.panel-icon { width: 28px; height: 28px; background: var(--wood); font-size: 14px; }
.category-list, .archive-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.category-list a, .archive-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 11px; border-radius: 5px; transition: color .18s ease, background .18s ease, transform .18s ease; }
.category-list a { background: rgba(231, 214, 171, .6); border: 1px solid #a87848; }
.category-list a:hover { color: var(--paper); background: var(--leaf); transform: translateX(2px); }
.archive-list a:hover { color: var(--leaf); transform: translateX(2px); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a { padding: 4px 9px; background: var(--paper); border: 3px solid var(--soil-soft); border-radius: 5px; box-shadow: 0 2px 0 var(--soil-soft); font-size: 13px; transition: color .15s ease, background .15s ease, transform .15s ease; }
.tag-cloud a:hover { color: var(--paper); background: var(--leaf); transform: translateY(-2px); }

.pagination { margin-top: 30px; }
.pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin: 0; padding: 0; list-style: none; }
.pagination a, .pagination span {
    min-width: 40px; min-height: 40px; display: grid; place-items: center; padding: 7px 12px;
    background: var(--paper); border: 3px solid var(--soil-soft); border-radius: 5px; box-shadow: 0 3px 0 var(--soil-soft);
    font-family: var(--font-display); font-weight: 900;
}
.pagination .current a, .pagination .current span, .pagination a:hover { background: var(--sun); }

.detail-layout { padding-top: 46px; }
.article-detail { overflow: hidden; }
.article-header { padding: 28px 32px 24px; text-align: center; }
.article-category { margin: 0 0 8px; color: var(--leaf); font-weight: 800; }
.article-header h1 { margin: 0; font-size: clamp(30px, 4.5vw, 44px); line-height: 1.22; text-wrap: balance; }
.article-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 14px; color: #7a5a34; font-size: 14px; }
.article-cover { width: 100%; max-height: 480px; object-fit: cover; border-block: 3px solid var(--soil-soft); }
.article-content { padding: 30px 34px 38px; font-size: 17px; }
.article-content > :first-child { margin-top: 0; }
.article-content > :last-child { margin-bottom: 0; }
.article-content h2, .article-content h3 { margin: 1.8em 0 .7em; line-height: 1.35; }
.article-content h2 { font-size: 27px; }
.article-content h3 { font-size: 22px; }
.article-content p, .article-content li { text-wrap: pretty; }
.article-content a { color: #3f7028; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.article-content img { height: auto; margin: 24px auto; border: 3px solid var(--soil-soft); border-radius: 5px; }
.article-content blockquote { margin: 24px 0; padding: 13px 18px; background: var(--straw); border-left: 5px solid var(--leaf); }
.article-content pre { overflow-x: auto; padding: 16px; color: #f8ecd2; background: #342719; border: 3px solid var(--soil-soft); border-radius: 5px; }
.article-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.article-content table { width: 100%; border-collapse: collapse; }
.article-content th, .article-content td { padding: 9px; border: 1px solid #9a7148; }
.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 18px 30px; background: #ead9b5; border-top: 3px solid var(--soil-soft); }
.post-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; padding: 17px 20px; }
.post-navigation div { min-width: 0; }
.post-navigation div:last-child { text-align: right; }
.post-navigation span { display: block; color: #7a5a34; font-size: 12px; }
.post-navigation a { font-weight: 700; }
.post-navigation a:hover { color: var(--leaf); }

.comments-area { margin-top: 24px; padding: 25px 28px 30px; }
.comments-area > h2, .respond h3 { margin: 0 0 18px; font-size: 24px; }
.comments-empty { color: #7a5a34; }
.comment-list, .comment-list ol { margin: 0; padding: 0; list-style: none; }
.comment-list > li { padding: 16px 0; border-top: 1px solid #b68d61; }
.comment-list > li:first-child { border-top: 0; }
.comment-list .comment-children { margin: 12px 0 0 28px; padding-left: 14px; border-left: 3px solid var(--wood-light); }
.comment-author { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.comment-author img { border: 2px solid var(--soil-soft); border-radius: 4px; }
.comment-meta { margin-top: 4px; color: #80613c; font-size: 12px; }
.comment-content { margin: 9px 0; }
.comment-reply a { color: var(--leaf); font-weight: 700; }
.respond { margin-top: 28px; padding-top: 22px; border-top: 3px solid var(--wood-light); }
.respond label > span, #comment-form > label { display: block; margin-bottom: 5px; font-weight: 700; }
.comment-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.pixel-button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 20px;
    color: var(--soil); background: var(--paper); border: 3px solid var(--soil-soft); border-radius: 5px; box-shadow: 0 4px 0 var(--soil-soft);
    cursor: pointer; transition: background .16s ease, transform .1s ease, box-shadow .1s ease;
}
.pixel-button:hover { background: var(--sun); }
.pixel-button:active { transform: translateY(4px); box-shadow: none; }

.empty-state, .not-found { padding: 45px 30px; text-align: center; }
.empty-state > span { font-size: 46px; }
.empty-state h2, .not-found h1 { margin: 8px 0; font-size: 28px; }
.empty-state p, .not-found p { margin: 0 0 20px; color: #735633; }
.not-found-wrap { padding-block: 100px; }
.not-found-code { display: block; color: var(--leaf); font-family: var(--font-display); font-size: clamp(70px, 15vw, 130px); font-weight: 900; line-height: 1; text-shadow: 5px 5px 0 var(--straw); }

.site-footer { margin-top: 30px; color: #f6e8cb; background: #a66e38; border-top: 3px solid var(--soil-soft); }
.footer-inner { padding-block: 34px 38px; text-align: center; }
.footer-title { margin: 0; font-size: 20px; text-shadow: 2px 2px 0 rgba(74, 43, 20, .45); }
.footer-inner > p:nth-child(2) { margin: 9px auto; max-width: 620px; color: rgba(255, 247, 227, .82); }
.footer-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px 13px; margin: 0; color: rgba(255, 247, 227, .72); font-size: 13px; }
.footer-meta a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 900px) {
    .main-layout { grid-template-columns: minmax(0, 1fr) 275px; gap: 22px; }
    .post-card { grid-template-columns: 190px minmax(0, 1fr); }
    .post-card-body { padding: 18px; }
    .post-tags { width: 100%; margin-left: 0; }
}

@media (max-width: 760px) {
    .content-shell { width: min(calc(100% - 28px), var(--shell)); }
    .header-inner { width: min(calc(100% - 28px), var(--shell)); min-height: 64px; flex-wrap: wrap; gap: 10px; padding-block: 10px 8px; }
    .brand { margin-right: auto; }
    .brand-name { font-size: 20px; }
    .site-nav { order: 3; width: calc(100% + 28px); margin: 0 -14px -8px; padding: 8px 14px 10px; overflow-x: auto; border-top: 2px solid rgba(107, 68, 35, .55); }
    .site-nav a { padding: 5px 10px; }
    .search-drawer { width: calc(100% - 28px); }
    .hero-image-wrap { height: 225px; }
    .hero-content { margin-top: -39px; }
    .hero-panel { padding: 22px 22px 24px; }
    .hero-panel h1 { font-size: 29px; }
    .main-layout { display: block; padding-block: 38px 56px; }
    .sidebar { margin-top: 38px; }
    .post-card { display: block; }
    .post-cover { min-height: 0; height: auto; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 3px solid var(--soil-soft); }
    .post-card-body { padding: 20px; }
    .post-card h2 { font-size: 21px; }
    .article-header { padding: 25px 21px 21px; }
    .article-content { padding: 24px 21px 30px; font-size: 16px; }
    .article-tags { padding: 16px 20px; }
    .post-navigation { grid-template-columns: 1fr; }
    .post-navigation div:last-child { text-align: left; }
    .comments-area { padding: 22px 19px 26px; }
    .comment-fields { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .header-actions { gap: 7px; }
    .icon-button { width: 36px; height: 36px; }
    .brand-mark { width: 38px; height: 38px; }
    .brand-name { font-size: 18px; }
    .hero-image-wrap { height: 205px; }
    .hero-panel { padding-inline: 19px; }
    .hero-panel h1 { font-size: 27px; }
    .section-heading h1 { font-size: 25px; }
    .post-meta { gap: 8px 11px; }
    .post-tags { margin-top: 3px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
