/* Plain — a quiet, text-first theme for simple-blog
   Left: author rail. Right: page content. No images required. */

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

:root {
    --paper: #ffffff;
    --paper-deep: #f5f7f6;
    --ink: #171c19;
    --ink-soft: #3e4743;
    --muted: #6e7873;
    --rule: #e9ecea;
    --rule-strong: #d7ded9;
    --accent: #37725f;
    --accent-soft: rgba(55, 114, 95, 0.08);
    --code-bg: #f7f9f8;
    --code-ink: #35403b;
    --code-rule: #e5eae7;

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
        Georgia, "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong",
        "SimSun", serif;
    --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei",
        -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "SF Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo,
        Consolas, monospace;

    --sidebar-width: 300px;
    --measure: 660px;
}

* {
    margin: 0;
    padding: 0;
}

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

body {
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font: 400 1rem/1.75 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    /* 收紧行首标点、按需补中西文间距，细节更干净 */
    text-spacing-trim: space-first;
    text-autospace: normal;
}

::selection {
    background: var(--accent-soft);
    color: var(--ink);
}

a {
    color: inherit;
    text-decoration: none;
}

img,
video {
    max-width: 100%;
    height: auto;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ---------- chrome ---------- */

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 20;
    padding: 8px 14px;
    color: var(--paper);
    background: var(--ink);
    font-size: 0.75rem;
    transform: translateY(-200%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.progress {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10;
    height: 2px;
    pointer-events: none;
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width 0.1s linear;
}

/* ---------- layout ---------- */

.shell {
    position: relative;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    width: 100%;
    max-width: 1280px;
    min-height: 100vh;
    margin: 0 auto;
}

/* 贯穿整页的栏线，避免侧栏随视口滚动时断线 */
.shell::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--sidebar-width);
    width: 1px;
    background: var(--rule);
    pointer-events: none;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 40px;
    height: 100vh;
    padding: 72px 40px 40px 48px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sidebar-head {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.content {
    display: flex;
    justify-content: center;
    padding: 88px clamp(28px, 6vw, 96px) 128px;
}

.content-inner {
    width: 100%;
    max-width: var(--measure);
}

/* ---------- identity ---------- */

.identity {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.brand-name {
    text-wrap: balance;
    font-family: var(--serif);
    font-size: 1.625rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.015em;
}

.brand-name .arrow {
    display: inline-block;
    margin-left: 6px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 400;
    vertical-align: 0.45em;
    transition: transform 0.2s ease, color 0.2s ease;
}

.brand:hover .arrow {
    color: var(--accent);
    transform: translate(1px, -1px);
}

.author-bio {
    max-width: 22em;
    color: var(--ink-soft);
    font-size: 0.8125rem;
    line-height: 1.95;
}

/* ---------- navigation ---------- */

.nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--ink-soft);
    font-size: 0.875rem;
    letter-spacing: 0.03em;
    transition: color 0.2s ease;
}

.nav a::after {
    content: "→";
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.6875rem;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav a:hover {
    color: var(--ink);
}

.nav a:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.nav a[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
}

.nav a[aria-current="page"]::after {
    content: "";
    width: 14px;
    height: 1px;
    background: var(--accent);
    opacity: 1;
    transform: none;
}

/* ---------- sidebar footer ---------- */

.sidebar-foot {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65625rem;
    line-height: 2.1;
    letter-spacing: 0.06em;
}

.sidebar-foot p + p {
    margin-top: 1px;
}

/* ---------- shared page head ---------- */

.page-head {
    padding-bottom: 32px;
    border-bottom: 1px solid var(--rule-strong);
}

.eyebrow {
    color: var(--accent);
    font-family: var(--serif);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 1px;
    margin-right: 10px;
    background: currentColor;
    vertical-align: 0.35em;
    opacity: 0.65;
}

.page-title {
    margin-top: 14px;
    text-wrap: balance;
    font-family: var(--serif);
    font-size: 2.125rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.page-note {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.8125rem;
}

.empty {
    margin-top: 40px;
    color: var(--muted);
    font-size: 0.875rem;
}

/* ---------- index feed ---------- */

.entry {
    padding: 38px 0;
    border-top: 1px solid var(--rule);
}

.feed > .entry:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
}

.meta-sep {
    color: var(--rule-strong);
}

.entry-title {
    text-wrap: balance;
    font-family: var(--serif);
    font-size: 1.4375rem;
    font-weight: 600;
    line-height: 1.48;
    letter-spacing: 0.015em;
}

.entry-title a {
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-position: 0 1.36em;
    background-size: 0 1px;
    transition: background-size 0.35s ease;
}

.entry-title a:hover {
    background-size: 100% 1px;
}

.entry-excerpt {
    margin-top: 14px;
    text-wrap: pretty;
    color: var(--ink-soft);
    font-size: 0.9375rem;
    line-height: 1.95;
}

/* ---------- article ---------- */

.article-head {
    padding-bottom: 36px;
    border-bottom: 1px solid var(--rule-strong);
}

.article-title {
    margin-top: 16px;
    text-wrap: balance;
    font-family: var(--serif);
    font-size: clamp(2rem, 1.65rem + 1.6vw, 2.5rem);
    font-weight: 600;
    line-height: 1.34;
    letter-spacing: 0.02em;
}

.article-head .eyebrow + .article-title {
    margin-top: 14px;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 22px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
}

.article-cover {
    margin: 40px 0 0;
}

.article-cover img {
    display: block;
    width: 100%;
}

.prose {
    margin-top: 48px;
    text-wrap: pretty;
    overflow-wrap: break-word;
    color: var(--ink-soft);
    font-size: 1.0625rem;
    line-height: 1.9;
    letter-spacing: 0.012em;
}

.prose > :first-child {
    margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose table,
.prose figure,
.prose blockquote {
    margin-bottom: 1.75em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    text-wrap: balance;
    margin: 2.3em 0 1em;
    color: var(--ink);
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.prose h1 {
    font-size: 1.875rem;
}

.prose h2 {
    font-size: 1.5rem;
}

.prose h3 {
    font-size: 1.1875rem;
}

.prose h4 {
    font-size: 1.0625rem;
}

.prose h5,
.prose h6 {
    font-size: 1rem;
}

.prose strong,
.prose b {
    color: var(--ink);
    font-weight: 600;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(55, 114, 95, 0.35);
    text-underline-offset: 4px;
    transition: text-decoration-color 0.2s ease;
}

.prose a:hover {
    text-decoration-color: var(--accent);
}

.prose ul,
.prose ol {
    padding-left: 1.5em;
}

.prose li {
    margin: 0.4em 0;
}

.prose li::marker {
    color: var(--rule-strong);
}

.prose blockquote {
    padding: 2px 0 2px 24px;
    border-left: 1px solid var(--accent);
    color: var(--ink-soft);
    font-family: var(--serif);
    font-size: 1.0625rem;
    line-height: 1.9;
}

.prose blockquote p:last-child {
    margin-bottom: 0;
}

.prose hr {
    margin: 3em 0;
    border: 0;
    border-top: 1px solid var(--rule);
}

.prose img,
.prose video {
    display: block;
    margin: 2em auto;
}

.prose figure {
    margin: 2em 0;
}

.prose figcaption {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.78125rem;
    line-height: 1.7;
    text-align: center;
}

.prose code {
    padding: 0.16em 0.4em;
    border-radius: 3px;
    background: var(--paper-deep);
    color: #2f6654;
    font-family: var(--mono);
    font-size: 0.84em;
}

.prose pre {
    margin: 2em 0;
    padding: 22px 24px;
    overflow-x: auto;
    border: 1px solid var(--code-rule);
    border-radius: 4px;
    background: var(--code-bg);
    color: var(--code-ink);
    font-size: 0.84375rem;
    line-height: 1.8;
    tab-size: 4;
    font-variant-ligatures: none;
}

.prose pre code {
    padding: 0;
    background: none;
    color: inherit;
    font-size: inherit;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    line-height: 1.7;
}

.prose th,
.prose td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--rule);
    text-align: left;
    vertical-align: top;
}

.prose th {
    color: var(--ink);
    font-weight: 600;
    border-bottom: 1px solid var(--rule-strong);
}

.prose .hljs .name {
    color: inherit;
}

/* ---------- article footer ---------- */

.article-foot {
    margin-top: 64px;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 4px;
    margin-bottom: 28px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
}

.article-tags::before {
    content: "标签";
    margin-right: 8px;
    color: var(--muted);
    letter-spacing: 0.12em;
}

.tag {
    color: var(--ink-soft);
}

.tag + .tag::before {
    content: "/";
    margin-right: 4px;
    color: var(--rule-strong);
}

.article-end {
    margin-bottom: 26px;
    color: var(--muted);
    font-family: var(--serif);
    font-size: 0.8125rem;
    letter-spacing: 0.5em;
    text-align: center;
    opacity: 0.5;
}

.article-permalink,
.article-cc {
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.9;
    word-break: break-all;
}

.article-permalink a {
    color: var(--ink-soft);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 3px;
}

.article-permalink a:hover {
    color: var(--accent);
}

.article-copy {
    margin-top: 16px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65625rem;
    letter-spacing: 0.06em;
}

.to-top {
    margin-top: 24px;
    font-size: 0.75rem;
}

.to-top a {
    color: var(--ink-soft);
    font-family: var(--mono);
    letter-spacing: 0.08em;
}

.to-top a:hover {
    color: var(--accent);
}

/* ---------- archive ---------- */

.archive-year {
    padding-top: 40px;
}

.archive-year-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.archive-count {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
}

.archive-list {
    margin-top: 12px;
    list-style: none;
}

.archive-list li + li {
    margin-top: 2px;
}

.archive-list a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    color: var(--ink-soft);
    font-size: 0.9375rem;
    line-height: 1.8;
    transition: color 0.2s ease;
}

.archive-list a:hover {
    color: var(--ink);
}

.archive-title {
    flex: 0 1 auto;
    min-width: 0;
}

.archive-leader {
    flex: 1 1 24px;
    align-self: center;
    margin-top: 7px;
    border-bottom: 1px dotted var(--rule-strong);
    opacity: 0.65;
}

.archive-list time {
    flex: none;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65625rem;
    letter-spacing: 0.06em;
}

/* ---------- whispers ---------- */

.whisper {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 22px;
    padding: 32px 0;
    border-top: 1px solid var(--rule);
}

.whisper-list .whisper:first-child {
    margin-top: 8px;
    border-top: 0;
}

.whisper time {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 5px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65625rem;
    letter-spacing: 0.06em;
}

.whisper time span {
    color: var(--rule-strong);
    font-size: 0.625rem;
}

.whisper-body {
    text-wrap: pretty;
    color: var(--ink-soft);
    font-size: 0.96875rem;
    line-height: 1.95;
    letter-spacing: 0.01em;
    white-space: pre-line;
}

.whisper-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- pagination ---------- */

.pagination {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.pagination a {
    color: var(--ink-soft);
    transition: color 0.2s ease;
}

.pagination a:hover {
    color: var(--accent);
}

/* ---------- comments ---------- */

#external-comment {
    margin-top: 64px;
}

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
    .shell {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
    }

    .shell::before {
        display: none;
    }

    /* 拆开侧栏：名字与导航留在页首，页脚排到正文之后 */
    .sidebar {
        display: contents;
    }

    .sidebar-head {
        padding: 44px 24px 0;
    }

    .author-bio {
        max-width: 34em;
    }

    .nav {
        margin-top: 28px;
        padding: 0 24px 28px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0 26px;
        border-bottom: 1px solid var(--rule);
    }

    .nav a {
        padding: 3px 0;
    }

    .nav a::after {
        display: none;
    }

    .content {
        padding: 52px 24px 72px;
    }

    .sidebar-foot {
        order: 1;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 20px;
        margin-top: auto;
        padding: 24px 24px 40px;
        border-top: 1px solid var(--rule);
        font-size: 0.625rem;
    }
}

@media (max-width: 560px) {
    .sidebar-head {
        padding: 32px 20px 0;
    }

    .nav {
        margin-top: 22px;
        padding: 0 20px 24px;
    }

    .brand-name {
        font-size: 1.3125rem;
    }

    .content {
        padding: 36px 20px 56px;
    }

    .sidebar-foot {
        padding: 20px 20px 32px;
    }

    .entry {
        padding: 30px 0;
    }

    .entry-title {
        text-wrap: pretty;
        font-size: 1.3125rem;
        line-height: 1.5;
    }

    .entry-excerpt {
        font-size: 0.9375rem;
        line-height: 1.9;
    }

    .article-title {
        font-size: 1.75rem;
    }

    .prose {
        margin-top: 36px;
        font-size: 1rem;
        line-height: 1.95;
    }

    .whisper {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 26px 0;
    }

    .whisper time {
        flex-direction: row;
        gap: 10px;
        padding-top: 0;
    }

    .page-title {
        font-size: 1.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
