/* Paper & Ink Theme */
:root {
    --bg-color: #faf9f7; /* Warm cream */
    --text-color: #1a1a1a; /* Charcoal */
    --accent-color: #c41e3a; /* Crimson */
    --secondary-text: #555;
    --border-color: #e5e5e5;
    --content-width: 760px;
    --font-body: "Source Serif 4", "Georgia", serif;
    --font-heading: "Cormorant Garamond", "Georgia", serif;
    --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* 中文字体：正文仿宋，标题宋体 */
    --font-body-zh: "STFangsong", "FangSong", "仿宋", serif;
    --font-heading-zh: "Songti SC", "STSong", "SimSun", "宋体", serif;
}

body {
    font-family: var(--font-body);
    font-size: 19px;
    line-height: 1.85;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* 中文页面全局字体覆盖 — 楷体为主，宋体为辅 */
html[lang^="zh"] body {
    font-family: var(--font-body-zh);
}

html[lang^="zh"] h1 {
    font-family: var(--font-heading-zh);
}

html[lang^="zh"] h2,
html[lang^="zh"] h3 {
    font-family: var(--font-heading-zh);
}

html[lang^="zh"] p,
html[lang^="zh"] li,
html[lang^="zh"] a,
html[lang^="zh"] blockquote,
html[lang^="zh"] figcaption {
    font-family: var(--font-body-zh);
}

.cursor-glow,
.ripple-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
}

.cursor-glow {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cursor-glow::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(calc(var(--glow-x, 50vw) - 50%), calc(var(--glow-y, 50vh) - 50%));
    background: #1a1214;
    box-shadow: 0 0 0 4px rgba(196, 30, 58, 0.1);
}

.cursor-glow.is-visible {
    opacity: 1;
}

body.has-cursor-glow,
body.has-cursor-glow * {
    cursor: none !important;
}

.click-ripple {
    position: absolute;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    margin-top: -9px;
    border-radius: 50%;
    border: 1px solid rgba(112, 118, 128, 0.2);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(112, 118, 128, 0.12) 45%, rgba(112, 118, 128, 0) 72%);
    transform: scale(0.2);
    opacity: 0;
    animation: clickRipple 0.78s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity;
}

@keyframes clickRipple {
    0% {
        transform: scale(0.2);
        opacity: 0.72;
    }

    70% {
        opacity: 0.16;
    }

    100% {
        transform: scale(12);
        opacity: 0;
    }
}

h1 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-top: 2.2em;
    margin-bottom: 0.8em;
    color: var(--text-color);
    font-size: 2.8rem;
    line-height: 1.2;
}

h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 2.2em;
    margin-bottom: 0.8em;
    color: var(--text-color);
}

h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.4em;
}

h3 {
    font-size: 1.35rem;
}

p {
    text-align: justify;
    margin-bottom: 1.6em;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

a {
    color: var(--accent-color);
    text-decoration: underline;
    text-decoration-color: rgba(196, 30, 58, 0.28);
    text-underline-offset: 2px;
    transition: color 200ms ease, text-decoration-color 200ms ease;
}

a:hover {
    color: #a31930;
    text-decoration-color: rgba(163, 25, 48, 0.6);
}

.wrapper {
    max-width: var(--content-width);
    margin-right: auto;
    margin-left: auto;
    padding-right: 30px;
    padding-left: 30px;
}

/* Pull Quotes */
blockquote {
    border-left: 4px solid var(--accent-color);
    margin: 2.5em 0;
    padding: 0.5em 0 0.5em 1.8em;
    font-family: "Dancing Script", cursive;
    font-style: normal;
    font-size: 1.35em;
    color: #444;
    background: rgba(196, 30, 58, 0.03);
}

/* Elegant Horizontal Rules */
hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
    margin: 3em 0;
}

/* Figures & Captions */
figure {
    margin: 3em 0;
    text-align: center;
}

figure img, .page-content img, p img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

figcaption {
    font-size: 0.9em;
    color: #777;
    text-align: center;
    margin-top: 1em;
    font-family: var(--font-heading);
    font-weight: 400;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(250, 249, 247, 0.85);
    padding: 24px 0;
    margin-bottom: 50px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.site-header .wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.01em;
    text-decoration: none;
    font-family: var(--font-heading);
}

.site-nav {
    display: flex;
    gap: 28px;
}

.site-nav a {
    color: var(--secondary-text);
    font-weight: 500;
    font-size: 0.95rem;
    font-family: var(--font-heading);
    transition: color 0.2s;
}

.site-nav a.active {
    color: var(--text-color);
    font-weight: 700;
}

.site-nav a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 60px 0;
    margin-top: 80px;
    background-color: #faf9f7;
    font-family: var(--font-heading);
}

.site-footer p {
    color: #ccc;
    font-size: 0.9rem;
    text-align: center !important;
    margin: 0 auto !important;
    width: 100% !important;
    display: block !important;
}

@media (hover: none), (pointer: coarse) {
    .cursor-glow {
        display: none;
    }

    .click-ripple {
        animation-duration: 0.9s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cursor-glow,
    .ripple-layer {
        display: none;
    }
}

/* Drop Cap */
.page-content > .wrapper > p:first-of-type::first-letter {
    font-size: 4.5em;
    float: left;
    line-height: 0.8;
    margin-top: 0.1em;
    margin-right: 0.1em;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--accent-color);
}

@media screen and (max-width: 768px) {
    .post-content > p:first-of-type::first-letter,
    .page-content > .wrapper > p:first-of-type::first-letter,
    .page-content p:first-of-type::first-letter {
        font-size: 2.5rem !important;
        line-height: 1 !important;
        margin-right: 0.15rem !important;
        padding-top: 0.2rem !important;
    }
}

/* 404 Page */
.page-404 {
    min-height: calc(100vh - 260px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0 80px;
}

.page-404-panel {
    position: relative;
    width: min(100%, 920px);
    padding: 56px 56px 52px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 243, 239, 0.94));
    border: 1px solid rgba(204, 196, 188, 0.9);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(31, 24, 20, 0.08);
    overflow: hidden;
}

.page-404-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent 22%),
        repeating-linear-gradient(0deg, rgba(70, 62, 56, 0.018) 0, rgba(70, 62, 56, 0.018) 1px, transparent 1px, transparent 34px),
        repeating-linear-gradient(90deg, rgba(70, 62, 56, 0.018) 0, rgba(70, 62, 56, 0.018) 1px, transparent 1px, transparent 42px);
    pointer-events: none;
}

.page-404-copy {
    position: relative;
    z-index: 2;
    max-width: 620px;
}

.page-404 .error-kicker {
    margin: 0 0 18px;
    color: var(--accent-color);
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-align: left;
    font-family: var(--font-display);
}

.page-404 .error-code {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: clamp(5.2rem, 12vw, 8rem);
    font-weight: 700;
    line-height: 0.92;
    color: rgba(196, 30, 58, 0.16);
    letter-spacing: -0.06em;
}

.page-404 h1 {
    margin: 0 0 18px;
    font-family: var(--font-heading);
    font-size: clamp(2.4rem, 5.8vw, 4.2rem);
    line-height: 0.98;
    letter-spacing: -0.03em;
}

.page-404 .error-subtitle {
    margin: 0 0 16px;
    color: #6a625d;
    font-size: 1.2rem;
    text-align: left;
}

.page-404 .error-body {
    max-width: 560px;
    margin: 0;
    color: var(--secondary-text);
    font-size: 1.02rem;
    text-align: left;
}

.page-404 .error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 34px;
}

.page-404 .back-home,
.page-404 .back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid rgba(196, 30, 58, 0.16);
    text-decoration: none;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.page-404 .back-home {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 10px 24px rgba(196, 30, 58, 0.16);
}

.page-404 .back-link {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.72);
}

.page-404 .back-home:hover,
.page-404 .back-link:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.page-404 .back-home:hover {
    background: #ab1932;
    border-color: #ab1932;
    color: #fff;
}

.page-404 .back-link:hover {
    color: var(--accent-color);
    border-color: rgba(196, 30, 58, 0.34);
    box-shadow: 0 8px 20px rgba(31, 24, 20, 0.07);
}

@media (max-width: 768px) {
    .page-404 {
        min-height: calc(100vh - 200px);
        padding: 12px 0 48px;
    }

    .page-404-panel {
        padding: 36px 24px 30px;
        border-radius: 22px;
    }

    .page-404 .error-subtitle,
    .page-404 .error-body {
        text-align: left;
    }

    .page-404 .error-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .page-404 .back-home,
    .page-404 .back-link {
        width: 100%;
    }
}

/* 中文博客页字体：正文仿宋，标题宋体 */
html[lang^="zh"] body {
    font-family: "STFangsong", "FangSong", "仿宋", serif;
}

html[lang^="zh"] h1,
html[lang^="zh"] h2,
html[lang^="zh"] h3,
html[lang^="zh"] h4 {
    font-family: "Songti SC", "STSong", "SimSun", "宋体", serif;
    font-weight: 400;
}
