/* ========================================
   Minimal Light Theme — myblog
   ======================================== */

:root {
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --fg: #333333;
    --fg-dim: #868e96;
    --fg-bright: #111111;
    --accent: #228be6;
    --accent-hover: #1971c2;
    --border: #dee2e6;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Consolas', 'Courier New', 'Source Code Pro', monospace;
    --line-height: 1.8;
    --max-width: 960px;
}

/* ---- reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- base ---- */
html {
    scroll-behavior: smooth;
}
body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 16px;
    line-height: var(--line-height);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

strong { color: var(--fg-bright); }

/* ---- header ---- */
.site-header {
    border-bottom: 2px solid var(--border);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
}
.site-title a {
    color: var(--fg-bright);
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 1.5rem;
}
.site-nav a {
    color: var(--fg-dim);
    font-size: 0.95rem;
}
.site-nav a:hover {
    color: var(--fg-bright);
    text-decoration: none;
}

/* ---- main ---- */
.site-main {
    min-height: 60vh;
}

/* ---- index page: two-column layout ---- */
.index-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.index-main {
    flex: 1;
    min-width: 0;
}
.index-sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
}

/* ---- sidebar cards ---- */
.sidebar-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.2rem;
}
.sidebar-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-card li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}
.sidebar-card .count {
    color: var(--fg-dim);
    font-size: 0.8rem;
    margin-left: 0.3rem;
}
.sidebar-card .count::before {
    content: '(';
}
.sidebar-card .count::after {
    content: ')';
}

.sidebar-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.sidebar-tags a {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.15rem 0.5rem;
    font-size: 0.82rem;
    color: var(--fg-dim);
}
.sidebar-tags a:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* ---- post list ---- */
.post-item {
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 0;
}

.post-item .post-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.post-item .post-title a {
    color: var(--fg-bright);
    text-decoration: none;
}
.post-item .post-title a:hover {
    color: var(--accent);
}

.post-meta {
    font-size: 0.82rem;
    color: var(--fg-dim);
    margin-bottom: 0.5rem;
}
.post-meta a {
    color: var(--fg-dim);
}
.post-meta a:hover {
    color: var(--accent);
}
.meta-item { margin-right: 0.6rem; }

.post-excerpt {
    color: var(--fg);
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

.read-more {
    color: var(--accent);
    font-size: 0.85rem;
}

/* ---- post detail ---- */
.post-detail {
    margin-bottom: 2rem;
}
.post-detail > .post-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--fg-bright);
    margin-bottom: 0.5rem;
}

.post-content {
    margin-top: 1.5rem;
}
.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
    color: var(--fg-bright);
    margin: 1.8rem 0 0.6rem;
    font-weight: 600;
    line-height: 1.4;
}

.post-content p {
    margin: 0.8rem 0;
}

.post-content ul, .post-content ol {
    margin: 0.6rem 0;
    padding-left: 2rem;
}
.post-content li { margin: 0.3rem 0; }

.post-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 0.8rem 0;
    padding: 0.3rem 1rem;
    color: var(--fg-dim);
    background: var(--bg-alt);
}

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

.post-content a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---- code blocks ---- */
.post-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-alt);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    color: #d63384;
}

.post-content pre {
    background: #f6f8fa;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}
.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ---- codehilite (pygments) — light theme ---- */
.codehilite {
    background: #f6f8fa;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}
.codehilite pre { border: none; padding: 0; margin: 0; background: none; }
.codehilite code { background: none; padding: 0; color: inherit; }

/* Comment */
.codehilite .c, .codehilite .cm, .codehilite .c1, .codehilite .cs { color: #6a737d; font-style: italic; }
.codehilite .cp { color: #6a737d; }

/* Keyword */
.codehilite .k, .codehilite .kc, .codehilite .kd, .codehilite .kn, .codehilite .kr { color: #d73a49; font-weight: 600; }
.codehilite .kp { color: #d73a49; }
.codehilite .kt { color: #d73a49; }

/* Name */
.codehilite .n  { color: #24292e; }
.codehilite .na { color: #6f42c1; }
.codehilite .nb { color: #005cc5; }
.codehilite .nc { color: #6f42c1; font-weight: 600; }
.codehilite .nd { color: #6f42c1; }
.codehilite .ne { color: #6f42c1; }
.codehilite .nf { color: #6f42c1; }
.codehilite .ni { color: #24292e; }
.codehilite .nl { color: #24292e; }
.codehilite .nn { color: #24292e; }
.codehilite .no { color: #005cc5; }
.codehilite .nt { color: #22863a; }
.codehilite .nv { color: #24292e; }
.codehilite .nx { color: #24292e; }
.codehilite .vc, .codehilite .vg, .codehilite .vi { color: #e36209; }

/* Literal */
.codehilite .l, .codehilite .m, .codehilite .mb, .codehilite .mf,
.codehilite .mh, .codehilite .mi, .codehilite .mo, .codehilite .il { color: #005cc5; }
.codehilite .s, .codehilite .sb, .codehilite .sc, .codehilite .sd,
.codehilite .s2, .codehilite .sh, .codehilite .sx, .codehilite .s1 { color: #032f62; }
.codehilite .se, .codehilite .si, .codehilite .ss { color: #032f62; }

/* Operator */
.codehilite .o, .codehilite .ow { color: #d73a49; }

/* Punctuation */
.codehilite .p { color: #24292e; }

/* Error */
.codehilite .err { color: #cb2431; background: #ffeef0; }

/* Whitespace */
.codehilite .w { color: #d1d5da; }

/* Generic */
.codehilite .gh { color: #005cc5; font-weight: 600; }
.codehilite .gp { color: #6a737d; }
.codehilite .gs { font-weight: 600; }
.codehilite .gu { color: #6a737d; }

/* Highlight */
.codehilite .hll { background-color: #fffbdd; }

/* ---- tables ---- */
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}
.post-content th, .post-content td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.8rem;
    text-align: left;
    font-size: 0.95rem;
}
.post-content th {
    background: var(--bg-alt);
    font-weight: 600;
}

/* ---- pagination ---- */
.pagination {
    margin: 2rem 0;
    font-size: 0.9rem;
    color: var(--fg-dim);
}
.pagination a {
    margin-right: 0.5rem;
    color: var(--accent);
}
.pagination .current {
    color: var(--fg-bright);
    font-weight: 600;
}

/* ---- page title ---- */
.page-title {
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* ---- tag cloud ---- */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}
.tag-item {
    font-size: 0.95rem;
}

/* ---- term list ---- */
.term-list {
    list-style: none;
}
.term-list li {
    padding: 0.4rem 0;
    font-size: 1.05rem;
}

.count {
    color: var(--fg-dim);
    font-size: 0.85rem;
}

/* ---- empty state ---- */
.empty-state {
    padding: 2rem 0;
    color: var(--fg-dim);
}

/* ---- back link ---- */
.back-link {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--fg-dim);
    font-size: 0.9rem;
}

/* ---- footer ---- */
.site-footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border);
    color: var(--fg-dim);
    font-size: 0.85rem;
}

/* ---- post layout (detail page with TOC sidebar) ---- */
.post-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.post-main {
    flex: 1;
    min-width: 0;
}

/* ---- TOC sidebar ---- */
.post-toc {
    width: 180px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 0 1rem 0 0;
    border-right: 1px solid var(--border);
    font-size: 0.85rem;
}

.toc-title {
    font-weight: 600;
    color: var(--fg-dim);
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.post-toc li {
    margin: 0.2rem 0;
}
.post-toc li li {
    padding-left: 1rem;
    border-left: 1px solid var(--border);
    margin-left: 0.3rem;
}
.post-toc a {
    color: var(--fg-dim);
    text-decoration: none;
    display: block;
    padding: 0.1rem 0;
}
.post-toc a:hover {
    color: var(--accent);
}

.post-toc::-webkit-scrollbar { width: 4px; }
.post-toc::-webkit-scrollbar-thumb { background: var(--border); }
.post-toc::-webkit-scrollbar-track { background: transparent; }

/* ---- responsive ---- */
@media (max-width: 900px) {
    .post-toc {
        display: none;
    }
    .index-sidebar {
        display: none;
    }
}

@media (max-width: 600px) {
    body { padding: 1rem; font-size: 15px; }
    .site-header { flex-direction: column; gap: 0.5rem; }
    .site-nav { flex-wrap: wrap; gap: 0.8rem; }
    .index-layout { flex-direction: column; }
}
