/* ==========================================================================
   4G Spaces — Editorial Theme
   A refined, typography-first design for a Chinese intellectual blog.
   ========================================================================== */

/* ---------- Reset & Base ---------- */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN",
                 "STSong", "Songti SC", Georgia, "Times New Roman",
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
    font-size: 1.0625rem;
    line-height: 1.9;
    color: #2c2c2c;
    background-color: #faf9f7;
    padding-top: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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

::selection {
    background: #c8dbb4;
    color: #1a1a1a;
}

/* ---------- Typography ---------- */
a {
    color: #456;
    text-decoration: none;
    transition: color 0.25s ease, border-color 0.25s ease;
    border-bottom: 1px solid transparent;
}

a:hover, a:focus {
    color: #1a1a1a;
    text-decoration: none;
    border-bottom-color: #999;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Noto Serif SC", "Source Han Serif SC", "STSong", "Songti SC",
                 Georgia, serif;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1.5rem;
}

blockquote {
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid #c8c8c0;
    background: rgba(0,0,0,0.015);
    color: #555;
    font-style: italic;
}

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

hr {
    border: 0;
    height: 0;
    border-top: 1px solid #ddd;
    margin: 3rem auto;
    max-width: 100px;
}

ul, ol {
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.4rem;
}

/* ---------- Layout ---------- */
.container {
    max-width: 1060px;
}

.container-left {
    margin: 0 auto;
}

/* ---------- Header ---------- */
.modern-header {
    background-color: #faf9f7;
    border-bottom: none;
    border-top: 3px solid #1a1a1a;
    margin-bottom: 0;
    padding: 2rem 0 1.5rem;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 0;
    padding-bottom: 0;
}

.header-brand {
    color: #1a1a1a;
    font-family: "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
    font-weight: 900;
    font-size: 1.75rem;
    letter-spacing: 0.04em;
    border-bottom: none;
}

.header-brand:hover {
    color: #1a1a1a;
    text-decoration: none;
    border-bottom: none;
    opacity: 0.7;
}

/* Compact nav in header */
.header-nav {
    display: flex;
    gap: 1.75rem;
}

.header-nav a {
    color: #777;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: none;
    transition: color 0.2s ease;
}

.header-nav a:hover {
    color: #1a1a1a;
    border-bottom: none;
}

/* ---------- Main Content Area ---------- */
.main-content {
    padding-top: 1rem;
}

/* ---------- Sidebar ---------- */
.sidebar-column {
    border-left: 1px solid #e8e6e1;
    padding-top: 0.25rem;
}

.sidebar {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0 0 1.5rem 2rem;
    margin-bottom: 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 0.875rem;
    line-height: 1.75;
    color: #666;
}

.sidebar h1 {
    color: #999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.75rem;
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.sidebar a {
    color: #555;
    border-bottom: none;
}

.sidebar a:hover {
    color: #1a1a1a;
    border-bottom: none;
}

/* Bio section in sidebar */
.sidebar-bio {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e8e6e1;
    line-height: 1.8;
    padding-left: 2rem;
}

.sidebar-bio a {
    color: #456;
    border-bottom: 1px dotted #aaa;
}

.sidebar-bio a:hover {
    color: #1a1a1a;
    border-bottom-color: #666;
}

/* Author name in bio */
.sidebar-author-name {
    font-family: "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    display: block;
    margin-bottom: 0.75rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    margin-top: 1.5rem;
    border-top: 1px solid #e8e6e1;
    padding-top: 1.25rem;
    padding-left: 2rem;
}

.sidebar-nav a {
    display: inline-block;
    margin-right: 1.25rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-weight: 500;
    color: #888;
    margin-bottom: 0;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: none;
}

.sidebar-nav a:hover {
    color: #1a1a1a;
    text-decoration: none;
    border-bottom: none;
}

/* Social icons */
.social-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.social-links a {
    color: #aaa;
    border-bottom: none;
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: #1a1a1a;
    border-bottom: none;
}

/* ---------- Article / Post Styling ---------- */
.article {
    margin-bottom: 1rem;
}

.post h1 {
    font-size: 1.75rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.35;
    color: #1a1a1a;
}

.post h1 a {
    color: #1a1a1a;
    border-bottom: none;
}

.post h1 a:hover {
    color: #456;
    text-decoration: none;
    border-bottom: none;
}

.post .date {
    color: #999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    margin-bottom: 2rem;
    display: block;
    letter-spacing: 0.02em;
}

.post .author {
    display: none;
}

.post img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 2rem 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.post-content {
    font-size: 1.0625rem;
}

.post-content h2 {
    margin-top: 3rem;
}

.post-content h3 {
    margin-top: 2.5rem;
}

/* Divider between posts on index */
.post-divider {
    border: 0;
    height: 0;
    border-top: 1px solid #e8e6e1;
    margin: 2.5rem 0;
}

/* ---------- Pagination ---------- */
.pagination {
    margin: 3rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-size: 0.875rem;
}

.pagination .btn,
.pagination .btn-default {
    background: transparent;
    border: 1px solid #ccc;
    color: #555;
    border-radius: 3px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination .btn:hover,
.pagination .btn-default:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.pagination .page_number {
    color: #999;
    font-size: 0.8rem;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 3rem 0;
    margin-top: 4rem;
    border-top: 1px solid #e8e6e1;
    color: #bbb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.footer a {
    color: #999;
    border-bottom: none;
}

.footer a:hover {
    color: #555;
    border-bottom: none;
}

/* ---------- Code blocks ---------- */
pre, code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    background-color: #f5f4f0;
    border: 1px solid #e8e6e1;
    border-radius: 3px;
    color: #333;
    font-size: 0.85em;
}

code {
    padding: 0.15em 0.4em;
}

pre {
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    line-height: 1.6;
}

pre code {
    padding: 0;
    border: none;
    background: none;
}

/* ---------- Series Navigation ---------- */
.series-nav {
    margin: 3rem 0 2rem;
    padding: 1.25rem 1.5rem;
    background: rgba(0,0,0,0.02);
    border: 1px solid #e8e6e1;
    border-radius: 4px;
}

.series-header {
    margin-bottom: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
}

.series-label {
    color: #999;
    margin-right: 0.25rem;
}

.series-header strong {
    color: #1a1a1a;
}

.series-list {
    margin: 0;
    padding-left: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

.series-list li {
    margin-bottom: 0.15rem;
    color: #666;
}

.series-list a {
    color: #456;
    border-bottom: none;
}

.series-list a:hover {
    color: #1a1a1a;
}

.series-current {
    font-weight: 600;
    color: #1a1a1a;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .modern-header {
        padding: 1.5rem 0 1rem;
    }
    .header-brand {
        font-size: 1.5rem;
    }
    .post h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 767px) {
    body {
        font-size: 1rem;
        line-height: 1.85;
    }
    .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    .modern-header {
        padding: 1.25rem 0 0.75rem;
    }
    .post h1 {
        font-size: 1.375rem;
    }
    .post .date {
        margin-bottom: 1.5rem;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
}

/* ---------- Dark Mode (auto) ---------- */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1e;
        color: #c8c5be;
    }

    ::selection {
        background: #3d5a28;
        color: #e0e0e0;
    }

    a {
        color: #8aabcc;
    }

    a:hover, a:focus {
        color: #d0d0d0;
        border-bottom-color: #555;
    }

    h1, h2, h3, h4, h5, h6 {
        color: #e8e6e1;
    }

    blockquote {
        border-left-color: #444;
        background: rgba(255,255,255,0.03);
        color: #999;
    }

    hr {
        border-top-color: #333;
    }

    /* Header */
    .modern-header {
        background-color: #1a1a1e;
        border-top-color: #e8e6e1;
    }

    .header-brand {
        color: #e8e6e1;
    }

    .header-brand:hover {
        color: #e8e6e1;
    }

    .header-nav a {
        color: #777;
    }

    .header-nav a:hover {
        color: #d0d0d0;
    }

    /* Sidebar */
    .sidebar-column {
        border-left-color: #2e2e32;
    }

    .sidebar {
        color: #888;
    }

    .sidebar h1 {
        color: #666;
    }

    .sidebar a {
        color: #888;
    }

    .sidebar a:hover {
        color: #d0d0d0;
    }

    .sidebar-bio {
        border-bottom-color: #2e2e32;
    }

    .sidebar-bio a {
        color: #8aabcc;
        border-bottom-color: #555;
    }

    .sidebar-bio a:hover {
        color: #d0d0d0;
        border-bottom-color: #888;
    }

    .sidebar-author-name {
        color: #e8e6e1;
    }

    .sidebar-nav {
        border-top-color: #2e2e32;
    }

    .sidebar-nav a {
        color: #666;
    }

    .sidebar-nav a:hover {
        color: #d0d0d0;
    }

    .social-links a {
        color: #666;
    }

    .social-links a:hover {
        color: #d0d0d0;
    }

    /* Posts */
    .post h1 {
        color: #e8e6e1;
    }

    .post h1 a {
        color: #e8e6e1;
    }

    .post h1 a:hover {
        color: #8aabcc;
    }

    .post .date {
        color: #666;
    }

    .post img {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
        opacity: 0.92;
    }

    /* Pagination */
    .pagination .btn,
    .pagination .btn-default {
        border-color: #444;
        color: #999;
    }

    .pagination .btn:hover,
    .pagination .btn-default:hover {
        background: #e8e6e1;
        border-color: #e8e6e1;
        color: #1a1a1e;
    }

    .pagination .page_number {
        color: #555;
    }

    /* Footer */
    .footer {
        border-top-color: #2e2e32;
        color: #555;
    }

    .footer a {
        color: #666;
    }

    .footer a:hover {
        color: #999;
    }

    /* Series nav */
    .series-nav {
        background: rgba(255,255,255,0.03);
        border-color: #2e2e32;
    }

    .series-header strong {
        color: #e8e6e1;
    }

    .series-list li {
        color: #888;
    }

    .series-list a {
        color: #8aabcc;
    }

    .series-list a:hover {
        color: #d0d0d0;
    }

    .series-current {
        color: #e8e6e1;
    }

    /* Bootstrap .well override */
    .well {
        background-color: #222226;
        border-color: #2e2e32;
        color: #c8c5be;
    }

    /* Code */
    pre, code {
        background-color: #222226;
        border-color: #2e2e32;
        color: #c8c5be;
    }

    /* Syntax highlighting overrides for dark mode */
    .highlight { background: #222226; }
    .highlight .hll { background-color: #333338; }
    .highlight .c,
    .highlight .cm,
    .highlight .c1,
    .highlight .cs { color: #6a6a6a; }
    .highlight .err { color: #f07070; background-color: #3a2020; }
    .highlight .k,
    .highlight .kc,
    .highlight .kd,
    .highlight .kn,
    .highlight .kr { color: #7dbd7d; }
    .highlight .kp { color: #7da0d0; }
    .highlight .kt { color: #9090d0; }
    .highlight .o { color: #c8c5be; }
    .highlight .cp { color: #8aabcc; }
    .highlight .gd { color: #e07070; }
    .highlight .gi { color: #70c070; }
    .highlight .gh { color: #8aabcc; }
    .highlight .gu { color: #b080d0; }
    .highlight .go { color: #6a6a6a; }
    .highlight .gp { color: #d0a060; }
    .highlight .gt { color: #6090d0; }
    .highlight .m,
    .highlight .mf,
    .highlight .mh,
    .highlight .mi,
    .highlight .mo { color: #b080d0; }
    .highlight .s,
    .highlight .sb,
    .highlight .sc,
    .highlight .sd,
    .highlight .s2,
    .highlight .se,
    .highlight .sh,
    .highlight .si,
    .highlight .sx,
    .highlight .s1,
    .highlight .ss,
    .highlight .sr { color: #d0a070; background-color: transparent; }
    .highlight .na { color: #8aabcc; }
    .highlight .nb { color: #8aabcc; }
    .highlight .nc { color: #7dbd7d; }
    .highlight .no { color: #d07070; }
    .highlight .nd { color: #d0a060; }
    .highlight .ni { color: #c8c5be; }
    .highlight .ne { color: #e07070; }
    .highlight .nf { color: #d07070; }
    .highlight .nn { color: #c8c5be; }
    .highlight .nt { color: #7dbd7d; }
    .highlight .nv,
    .highlight .vc,
    .highlight .vg,
    .highlight .vi { color: #d08070; }
    .highlight .ow { color: #7dbd7d; }
    .highlight .w { color: #444; }
}

/* ---------- Print ---------- */
@media print {
    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }
    .sidebar, .modern-header, .footer, .pagination {
        display: none;
    }
    a { color: #000; border-bottom: none; }
    .container { max-width: 100%; }
}
