@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.7.0/style.css');

:root {
    --bg: #fafaf8;
    --bg-alt: #f5f3ee;
    --text: #2a2a2a;
    --text-secondary: #555;
    --text-muted: #999;
    --border: #e8e5e0;
    --accent: #8b6914;
    --accent-hover: #6d5210;
    --card-bg: #fff;
    --code-bg: #f5f3ee;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="dark"] {
    --bg: #181816;
    --bg-alt: #222220;
    --text: #dddad2;
    --text-secondary: #aaa;
    --text-muted: #777;
    --border: #333330;
    --accent: #c9a84c;
    --accent-hover: #ddb955;
    --card-bg: #1f1f1d;
    --code-bg: #2a2a28;
    --shadow: 0 1px 3px rgba(0,0,0,0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "LXGW WenKai", "Noto Serif SC", "Source Han Serif SC", serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navigation ────────────────────────────────────────── */

.navbar {
    position: sticky;
    top: 0;
    background: rgba(250,250,248,0.92);
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .navbar {
    background: rgba(24,24,22,0.92);
}

.nav-brand {
    font-size: 1.05rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.88rem;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.nav-links .sep {
    color: var(--border);
    user-select: none;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.15rem;
    padding: 0.15rem 0;
    line-height: 1;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
}

/* ── Main ──────────────────────────────────────────────── */

main {
    flex: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* ── Hero ──────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 1.7rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* ── Post cards ────────────────────────────────────────── */

.post-list { list-style: none; }

.post-card {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.post-card:last-child { border-bottom: none; }

.post-card .meta {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.3rem;
}

.category-badge {
    display: inline-block;
    padding: 0.08rem 0.45rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.category-badge:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tag-badge {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.tag-badge:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.post-card .tags {
    margin-top: 0.4rem;
}

.post-card .date {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.post-card h2 {
    font-size: 1.15rem;
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.post-card h2 a {
    text-decoration: none;
    color: var(--text);
    transition: color 0.2s;
}

.post-card h2 a:hover { color: var(--accent); }

.post-card .excerpt {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ── Page header ───────────────────────────────────────── */

.page-header {
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 400;
}

.page-header .count {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.3rem;
}

/* ── Post page ─────────────────────────────────────────── */

.post-header {
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.post-header h1 {
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.4;
    margin: 0.5rem 0;
}

.post-header .post-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.lang-switch {
    display: inline-block;
    margin-top: 0.8rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    transition: all 0.2s;
}

.lang-switch:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Post content ──────────────────────────────────────── */

.post-content { line-height: 1.9; }

.post-content p {
    margin-bottom: 1.2rem;
    text-indent: 2em;
    text-align: justify;
}

.post-content h2 {
    font-size: 1.25rem;
    font-weight: 400;
    margin: 2rem 0 1rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.post-content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.5rem 0 0.8rem;
}

.post-content blockquote {
    margin: 1.5rem 0;
    padding: 0.8rem 1.2rem;
    border-left: 3px solid var(--accent);
    background: var(--bg-alt);
    border-radius: 0 4px 4px 0;
}

.post-content blockquote p {
    text-indent: 0;
    margin-bottom: 0.5rem;
}

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

.post-content pre {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--code-bg);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

.post-content code {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
}

.post-content pre code {
    background: none;
    padding: 0;
    font-size: 1em;
}

.post-content ul, .post-content ol {
    margin: 1rem 0 1rem 2em;
}

.post-content li { margin-bottom: 0.3rem; }

.post-content hr {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s;
}

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

/* ── Post navigation ───────────────────────────────────── */

.post-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.post-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.88rem;
    max-width: 45%;
    transition: color 0.2s;
}

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

/* ── Footer ────────────────────────────────────────────── */

footer {
    text-align: center;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.8;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
}

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

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 0.8rem;
    }

    .nav-links.open { display: flex; }
    .menu-toggle { display: block; }
    .nav-links .sep { display: none; }

    main { padding: 1.5rem 1rem; }
    .hero { padding: 2rem 0 1.5rem; }
    .hero h1 { font-size: 1.4rem; }
    .post-header h1 { font-size: 1.3rem; }
}

/* ── Password gate ─────────────────────────────────────── */

.password-gate {
    text-align: center;
    padding: 3rem 0;
}

.password-gate .lock-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.password-gate p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
}

.password-gate form {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.password-gate input[type="password"] {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-alt);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    width: 220px;
    outline: none;
    transition: border-color 0.2s;
}

.password-gate input[type="password"]:focus {
    border-color: var(--accent);
}

.password-gate button {
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.password-gate button:hover {
    background: var(--accent-hover);
}

.password-gate .error {
    color: #c0392b;
    font-size: 0.85rem;
    margin-top: 0.8rem;
}

[data-theme="dark"] .password-gate .error { color: #e74c3c; }

/* ── Copy protection ───────────────────────────────────── */

.no-copy {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
