:root {
    color-scheme: light dark;
    --paper: #f7f3ee;
    --paper-raised: #fffdf9;
    --ink: #211b1c;
    --ink-soft: #706669;
    --line: rgba(81, 48, 53, 0.15);
    --red: #b52332;
    --red-deep: #781c27;
    --red-wash: rgba(181, 35, 50, 0.08);
    --gold: #a77a3e;
    --shadow: 0 24px 70px rgba(87, 42, 47, 0.09);
    --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
    --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --gh-font-heading: var(--serif);
    --gh-font-body: var(--sans);
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #171316;
        --paper-raised: #211a1e;
        --ink: #f2e9e5;
        --ink-soft: #b9aaac;
        --line: rgba(242, 217, 220, 0.13);
        --red: #ef5c69;
        --red-deep: #ff818c;
        --red-wash: rgba(239, 92, 105, 0.1);
        --gold: #d5a968;
        --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    }
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--gh-font-body, var(--sans));
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .35;
    background-image: linear-gradient(rgba(120, 70, 70, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 70, 70, .02) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(to bottom, black, transparent 80%);
}

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

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 8px 12px;
    background: var(--ink);
    color: var(--paper);
    transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.site-shell { min-height: 100vh; }
.home-template .site-shell { display: grid; grid-template-columns: minmax(310px, 38vw) 1fr; }

.profile-panel {
    position: relative;
    min-height: 100vh;
    padding: clamp(40px, 7vw, 92px) clamp(28px, 5vw, 76px);
    border-right: 1px solid var(--line);
    background: linear-gradient(145deg, var(--red-wash), transparent 58%);
}

.profile-panel::after {
    content: "";
    position: absolute;
    top: 0;
    right: 36px;
    width: 18px;
    height: 90px;
    border-inline: 5px solid var(--red);
    clip-path: polygon(0 0, 100% 0, 100% 64%, 50% 100%, 0 64%);
    opacity: .65;
}

.profile-panel__inner { position: sticky; top: 56px; max-width: 430px; margin-left: auto; }
.profile-mark { display: inline-grid; width: 104px; height: 104px; place-items: center; margin-bottom: 34px; border: 1px solid var(--line); border-radius: 50%; box-shadow: var(--shadow); overflow: hidden; background: var(--paper-raised); }
.profile-mark img { width: 100%; height: 100%; object-fit: cover; }
.profile-mark__fallback { display: grid; width: 74px; height: 74px; place-items: center; border: 1px solid var(--red); border-radius: 50%; color: var(--red); font-family: var(--gh-font-heading, var(--serif)); font-size: 22px; letter-spacing: .08em; }
.profile-mark__fallback::before, .profile-mark__fallback::after { content: ""; position: absolute; width: 102px; height: 1px; background: var(--red); opacity: .5; transform: rotate(45deg); }
.profile-mark__fallback::after { transform: rotate(-45deg); }

.eyebrow { margin: 0 0 10px; color: var(--red); font-size: 11px; font-weight: 700; letter-spacing: .18em; }
.profile-copy h1 { margin: 0; font-family: var(--gh-font-heading, var(--serif)); font-size: clamp(54px, 6.3vw, 92px); font-weight: 500; line-height: .95; letter-spacing: -.06em; }
.author { margin: 18px 0 4px; color: var(--ink); font-weight: 600; letter-spacing: .09em; }
.slogan { margin: 4px 0 16px; color: var(--red-deep); font-family: var(--gh-font-heading, var(--serif)); font-size: 18px; letter-spacing: .16em; }
.description { max-width: 38ch; margin: 0; color: var(--ink-soft); font-size: 14px; }

.primary-nav { display: flex; gap: 28px; margin: 38px 0 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.primary-nav a, .search-button { position: relative; border: 0; padding: 0; background: none; cursor: pointer; font-size: 14px; }
.primary-nav .is-current::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 2px; background: var(--red); }
.search-button:hover, .search-button:focus-visible, .primary-nav a:hover { color: var(--red); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a, .article-tags a { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); font-size: 12px; transition: border-color .2s, color .2s, background .2s; }
.tag-cloud a:hover, .article-tags a:hover { border-color: var(--red); background: var(--red-wash); color: var(--red-deep); }
.tag-cloud small { margin-left: 3px; opacity: .65; }
.system-theme-note { margin-top: 26px; color: var(--ink-soft); font-size: 11px; }

.feed-panel { min-width: 0; padding: clamp(42px, 7vw, 94px) clamp(24px, 6vw, 90px) 30px; }
.feed-header { display: flex; align-items: end; justify-content: space-between; max-width: 850px; margin-bottom: 28px; }
.feed-header h2 { margin: 0; font-family: var(--gh-font-heading, var(--serif)); font-size: 28px; font-weight: 500; }
.shide { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: radial-gradient(circle, var(--red) 0 3px, transparent 4px 11px, var(--red) 12px 13px, transparent 14px); opacity: .55; }

.post-feed { max-width: 850px; }
.post-card { border-top: 1px solid var(--line); }
.post-card:last-child { border-bottom: 1px solid var(--line); }
.post-card__link { display: grid; grid-template-columns: 1fr auto; gap: 28px; padding: 28px 8px 28px 0; transition: padding .25s, background .25s; }
.post-card__link:hover { padding-left: 14px; background: linear-gradient(90deg, var(--red-wash), transparent 75%); }
.post-meta { display: flex; flex-wrap: wrap; gap: 9px 16px; color: var(--ink-soft); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.post-meta span + span::before { content: "·"; margin-right: 16px; color: var(--red); }
.post-card h2, .post-card h3 { margin: 8px 0 8px; font-family: var(--gh-font-heading, var(--serif)); font-size: clamp(22px, 2.2vw, 30px); font-weight: 600; line-height: 1.35; letter-spacing: -.02em; }
.post-card p { max-width: 55ch; margin: 0; color: var(--ink-soft); font-size: 14px; }
.read-more { display: inline-block; margin-top: 14px; color: var(--red-deep); font-size: 12px; font-weight: 600; }
.post-card__image { width: 190px; height: 132px; margin: 0; overflow: hidden; border-radius: 2px 18px 2px 2px; }
.post-card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.post-card__link:hover .post-card__image img { transform: scale(1.035); }

.empty-state { padding: 80px 20px; border-block: 1px solid var(--line); text-align: center; }
.empty-state span { color: var(--red); font-size: 34px; }
.empty-state h3 { margin-bottom: 4px; font-family: var(--gh-font-heading, var(--serif)); font-size: 25px; }
.empty-state p { margin-top: 0; color: var(--ink-soft); }
.pagination { display: flex; justify-content: space-between; max-width: 850px; padding: 26px 0; color: var(--ink-soft); font-size: 12px; }
.pagination a:hover { color: var(--red); }
.site-footer { display: flex; justify-content: space-between; max-width: 850px; margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 10px; letter-spacing: .08em; }

.article-topbar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 26px 0; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--red-deep); font-family: var(--gh-font-heading, var(--serif)); font-size: 20px; font-weight: 600; }
.article-shell, .archive-shell { width: min(1100px, calc(100% - 40px)); margin: 0 auto; padding: clamp(58px, 8vw, 110px) 0; }
.article-header { width: min(780px, 100%); margin: 0 auto 48px; text-align: center; }
.article-tag { color: var(--red); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.article-header h1 { margin: 14px 0 20px; font-family: var(--gh-font-heading, var(--serif)); font-size: clamp(38px, 6vw, 68px); font-weight: 600; line-height: 1.18; letter-spacing: -.045em; }
.article-deck { margin: 0 auto 20px; color: var(--ink-soft); font-family: var(--gh-font-heading, var(--serif)); font-size: 19px; }
.article-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; color: var(--ink-soft); font-size: 12px; }
.article-hero { margin: 0 0 clamp(50px, 7vw, 84px); }
.article-hero img { width: 100%; max-height: 680px; object-fit: cover; border-radius: 3px 28px 3px 3px; box-shadow: var(--shadow); }
.article-hero figcaption { margin-top: 9px; color: var(--ink-soft); font-size: 11px; text-align: center; }

.gh-content { width: min(720px, 100%); margin: 0 auto; font-family: var(--gh-font-body, var(--serif)); font-size: clamp(17px, 1.5vw, 19px); line-height: 1.95; }
.gh-content > * { margin-top: 0; margin-bottom: 1.65em; }
.gh-content h2, .gh-content h3 { margin-top: 2.2em; line-height: 1.4; }
.gh-content h2 { font-size: 1.65em; }
.gh-content h3 { font-size: 1.3em; }
.gh-content a { color: var(--red-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gh-content blockquote { margin-inline: 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--red); color: var(--ink-soft); }
.gh-content code { padding: .15em .35em; border-radius: 4px; background: var(--red-wash); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.gh-content pre { max-width: 100%; overflow-x: auto; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-raised); line-height: 1.65; }
.gh-content pre code { padding: 0; background: none; }
.gh-content img { height: auto; margin-inline: auto; border-radius: 4px; }
.gh-content .kg-width-wide { width: min(1000px, 100vw - 40px); margin-left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-full { width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.gh-content iframe { max-width: 100%; }
.gh-content .kg-gallery-container { display: flex; flex-direction: column; gap: 8px; }
.gh-content .kg-gallery-row { display: flex; gap: 8px; }
.gh-content .kg-gallery-image { flex: 1 1 0; margin: 0; }
.gh-content .kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }
.gh-content .kg-bookmark-card { width: 100%; }
.gh-content .kg-bookmark-container { display: flex; min-height: 148px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-raised); text-decoration: none; }
.gh-content .kg-bookmark-content { display: flex; flex: 1; flex-direction: column; justify-content: center; min-width: 0; padding: 20px; }
.gh-content .kg-bookmark-title { color: var(--ink); font-family: var(--gh-font-body, var(--sans)); font-size: 15px; font-weight: 700; line-height: 1.4; }
.gh-content .kg-bookmark-description { display: -webkit-box; overflow: hidden; margin-top: 6px; color: var(--ink-soft); font-family: var(--gh-font-body, var(--sans)); font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.gh-content .kg-bookmark-metadata { display: flex; align-items: center; gap: 7px; margin-top: 14px; color: var(--ink-soft); font-family: var(--gh-font-body, var(--sans)); font-size: 11px; }
.gh-content .kg-bookmark-icon { width: 18px; height: 18px; margin: 0; }
.gh-content .kg-bookmark-author::after { content: "·"; margin-left: 7px; }
.gh-content .kg-bookmark-publisher { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-content .kg-bookmark-thumbnail { position: relative; flex: 0 0 34%; min-width: 150px; }
.gh-content .kg-bookmark-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.article-footer { width: min(720px, 100%); margin: 72px auto 0; padding-top: 24px; border-top: 1px solid var(--line); }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.back-home { display: inline-block; margin-top: 32px; color: var(--red-deep); font-size: 13px; }

.archive-shell { width: min(850px, calc(100% - 40px)); }
.archive-header { margin-bottom: 52px; }
.archive-header h1 { margin: 0; font-family: var(--gh-font-heading, var(--serif)); font-size: clamp(44px, 7vw, 74px); line-height: 1.2; }
.archive-header > p:last-child { color: var(--ink-soft); }

:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

@media (max-width: 900px) {
    .home-template .site-shell { display: block; }
    .profile-panel { min-height: auto; padding: 42px 24px 34px; border-right: 0; border-bottom: 1px solid var(--line); }
    .profile-panel__inner { position: static; max-width: 680px; margin: 0 auto; }
    .profile-panel::after { right: 24px; height: 64px; }
    .profile-mark { width: 78px; height: 78px; margin-bottom: 24px; }
    .profile-mark__fallback { width: 54px; height: 54px; font-size: 16px; }
    .profile-mark__fallback::before, .profile-mark__fallback::after { width: 76px; }
    .profile-copy h1 { font-size: clamp(54px, 15vw, 80px); }
    .primary-nav { margin: 28px 0 20px; }
    .system-theme-note { display: none; }
    .feed-panel { padding: 48px 24px 24px; }
    .feed-header, .post-feed, .pagination, .site-footer { max-width: 680px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 620px) {
    .profile-panel { padding-top: max(34px, env(safe-area-inset-top)); }
    .eyebrow { font-size: 9px; }
    .slogan { font-size: 16px; letter-spacing: .1em; }
    .description { max-width: 29ch; line-height: 1.8; }
    .tag-cloud { max-height: 74px; overflow: hidden; }
    .post-card__link { display: flex; flex-direction: column-reverse; gap: 18px; padding: 24px 0; }
    .post-card__link:hover { padding-left: 0; background: none; }
    .post-card__image { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 2px 16px 2px 2px; }
    .post-meta { gap: 6px 10px; }
    .post-meta span + span::before { margin-right: 10px; }
    .site-footer { flex-direction: column; gap: 5px; }
    .article-topbar { width: calc(100% - 32px); padding-top: max(20px, env(safe-area-inset-top)); }
    .article-shell { width: calc(100% - 32px); padding-top: 56px; }
    .article-header { text-align: left; }
    .article-header h1 { font-size: 38px; }
    .article-meta { justify-content: flex-start; }
    .article-hero { width: 100vw; margin-left: calc(50% - 50vw); }
    .article-hero img { border-radius: 0; }
    .gh-content { font-size: 17px; line-height: 1.9; }
    .gh-content .kg-gallery-row { flex-direction: column; }
    .gh-content .kg-bookmark-thumbnail { display: none; }
    .pagination { gap: 10px; }
    .page-number { display: none; }
}

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