@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

:root {
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --bg: #FAF9F6;
    --text: #1c1c28;
    --muted: #8a8a96;
    --accent: #b5432a;
    --rule: #e5e4e0;
    --highlight: rgba(28, 28, 40, 0.04);
    --max-w: 640px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141418;
        --text: #e5e4e0;
        --muted: #6a6a78;
        --accent: #e07058;
        --rule: #2a2a32;
        --highlight: rgba(229, 228, 224, 0.06);
    }
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

/* Layout */
.site-wrapper {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 140px 24px 100px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    margin-bottom: 64px;
}

.site-title {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--text);
    display: block;
    margin-bottom: 12px;
}

.site-title:hover {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.site-bio {
    font-size: 19px;
    color: var(--muted);
    line-height: 1.5;
    max-width: 480px;
    margin-bottom: 32px;
}

/* Navigation */
.site-nav ul {
    list-style: none;
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.site-nav li {
    list-style: none;
}

.site-nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    position: relative;
    transition: opacity 0.2s ease;
}

.site-nav a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--text);
    transition: width 0.3s ease;
}

.site-nav a:hover::after {
    width: 100%;
}

/* Divider */
hr.divider {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 48px 0;
}

/* Sections */
.section {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.section-title {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text);
}

.section-link {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.section-link:hover {
    color: var(--text);
}

/* Post items (landing page) */
.post-item {
    padding: 6px 0;
    line-height: 1.5;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.post-item-link {
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease;
}

.post-item-link:hover {
    border-bottom-color: var(--text);
}

.post-item .item-desc {
    color: var(--muted);
    font-size: 17px;
}

.post-item .badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    vertical-align: super;
    line-height: 1;
}

.post-item .item-tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-left: auto;
}

/* Footer */
.site-footer {
    margin-top: auto;
    padding-top: 64px;
    font-size: 13px;
    color: var(--muted);
}

/* ─── Post / Page ──────────────────────── */
.post-full {
    max-width: var(--max-w);
}

.post-header {
    margin-bottom: 48px;
}

.post-title {
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.post-meta {
    font-size: 14px;
    color: var(--muted);
}

.post-meta a {
    color: var(--muted);
    text-decoration: none;
}

.post-meta a:hover {
    color: var(--text);
}

.post-content {
    font-size: 18px;
    line-height: 1.75;
}

.post-content p {
    margin-bottom: 1.5em;
}

.post-content h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 400;
    margin: 2em 0 0.8em;
    line-height: 1.3;
}

.post-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 1.8em 0 0.6em;
    line-height: 1.4;
}

.post-content a {
    color: var(--text);
    text-decoration-color: var(--muted);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

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

.post-content ul, .post-content ol {
    margin: 0 0 1.5em 1.4em;
}

.post-content li {
    margin-bottom: 0.4em;
}

.post-content blockquote {
    border-left: 2px solid var(--rule);
    padding-left: 20px;
    margin: 1.5em 0;
    color: var(--muted);
    font-style: italic;
}

.post-content pre {
    background: var(--highlight);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 14px;
    line-height: 1.6;
}

.post-content code {
    background: var(--highlight);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.post-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

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

.post-content figure {
    margin: 2em 0;
}

.post-content figcaption {
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    margin-top: 8px;
}

.post-content .kg-image-card img,
.post-content .kg-gallery-image img {
    max-width: 100%;
    height: auto;
}

.post-content .kg-width-wide {
    margin-left: -80px;
    margin-right: -80px;
    max-width: calc(100% + 160px);
}

.post-content .kg-width-full {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    max-width: 100vw;
}

/* Back link */
.back-link {
    display: inline-block;
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 48px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text);
}

/* Tag page */
.tag-header {
    margin-bottom: 32px;
}

.tag-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.tag-description {
    font-size: 16px;
    color: var(--muted);
    margin-top: 8px;
}

/* Error */
.error-page {
    text-align: center;
    padding: 80px 0;
}

.error-code {
    font-family: var(--font-display);
    font-size: 72px;
    font-weight: 400;
    margin-bottom: 12px;
    color: var(--muted);
}

.error-message {
    font-size: 18px;
    color: var(--muted);
    margin-bottom: 32px;
}

.error-link {
    color: var(--text);
    font-size: 15px;
}

/* ─── Responsive ───────────────────────── */
@media (max-width: 680px) {
    .site-wrapper {
        padding: 80px 20px 60px;
    }
    .site-title {
        font-size: 36px;
    }
    .site-bio {
        font-size: 17px;
    }
    .site-nav ul {
        gap: 20px;
    }
    .post-title {
        font-size: 32px;
    }
    .post-content .kg-width-wide {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
}
