/* === Geist Fonts (Vercel) === */
@font-face {
    font-family: 'Geist Sans';
    src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Geist Sans';
    src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Geist Mono';
    src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-mono/GeistMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f6f4f0;
    --text: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #a8a29e;
    --accent: #9a3412;
    --accent-warm: #c2410c;
    --accent-light: #fed7aa;
    --teal: #0f766e;
    --border: #d6d3d1;
    --border-light: #e7e5e4;
    --code-bg: #1c1917;
    --code-text: #e7e5e4;
    --code-line-num: #6b6560;
    --inline-code-bg: #e7e5e4;
    --prose-width: 42rem;
    --fleuron-color: #c2410c;
}

html { font-size: 17px; }

body {
    font-family: 'Literata', 'Georgia', serif;
    font-optical-sizing: auto;
    color: var(--text);
    background: var(--bg);
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* === Top Accent Bar === */
.top-bar {
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-warm) 40%, var(--teal) 100%);
}

/* === Header === */
.site-header {
    max-width: var(--prose-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 1.25rem;
}
.site-header nav {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.site-name {
    font-family: 'Literata', serif;
    font-size: 1.3rem;
    font-weight: 700;
    font-style: italic;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.site-name sup {
    font-size: 0.5em;
    font-style: normal;
    font-weight: 400;
    vertical-align: super;
    margin-left: 0.05em;
}
.site-nav {
    display: flex;
    gap: 1.5rem;
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.8rem;
}
.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.site-nav a:hover { color: var(--accent); }

.header-rule {
    max-width: var(--prose-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}
.header-rule hr {
    border: none;
    height: 1px;
    background: var(--border);
}

/* === Main Content === */
main {
    max-width: var(--prose-width);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* === Fleurons === */
.fleuron {
    text-align: center;
    margin: 2.75rem 0;
    color: var(--fleuron-color);
    font-size: 1.35rem;
    opacity: 0.55;
    user-select: none;
}
.fleuron-section {
    text-align: center;
    margin: 2.25rem 0;
    color: var(--fleuron-color);
    font-size: 1rem;
    opacity: 0.5;
    user-select: none;
}
.fleuron-end {
    text-align: center;
    margin: 3rem 0 2.5rem;
    color: var(--fleuron-color);
    font-size: 1rem;
    opacity: 0.5;
    letter-spacing: 0.6em;
    user-select: none;
}

/* Read-more arrow */
.read-more {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.35em;
    transition: transform 0.15s;
}
.read-more:hover { transform: translateX(3px); }
.read-more svg {
    display: block;
    width: 0.85em;
    height: 0.85em;
}

/* === Post List === */
.post-entry { margin-bottom: 0; }
.post-entry time {
    display: inline-block;
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--teal);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
.post-entry h2 {
    font-family: 'Literata', serif;
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: -0.015em;
    margin-bottom: 0.5rem;
}
.post-entry h2 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s;
}
.post-entry h2 a:hover { color: var(--accent); }
.post-entry .excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
}
.post-entry .meta {
    margin-top: 0.6rem;
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === Post Image (optional, left margin) === */
.post-entry,
article {
    position: relative;
}
.post-image {
    position: absolute;
    left: -250px;
    top: 0;
    width: 225px;
    height: 225px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-light);
}
.excerpt .post-image,
.post-content .post-image {
    top: 0;
}

/* === Single Post === */
.post-header time {
    display: inline-block;
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--teal);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}
.post-header h1 {
    font-family: 'Literata', serif;
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.025em;
    margin-bottom: 2rem;
}

/* === Post Content === */
.post-content { line-height: 1.8; }
.post-content p { margin-bottom: 1.35rem; }
.post-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}
.post-content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}
.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-light);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    transition: text-decoration-color 0.2s;
}
.post-content a:hover { text-decoration-color: var(--accent); }
.post-content strong { font-weight: 600; }
.post-content ul, .post-content ol {
    padding-left: 1.4rem;
    margin-bottom: 1.35rem;
}
.post-content li { margin-bottom: 0.3rem; }
.post-content li::marker { color: var(--accent-warm); }
.post-content blockquote {
    margin: 1.75rem 0;
    padding: 1rem 0 1rem 1.25rem;
    border-left: 3px solid var(--teal);
    color: var(--text-secondary);
    font-style: italic;
    background: linear-gradient(90deg, rgba(15,118,110,0.04) 0%, transparent 60%);
}

/* Inline code */
.post-content code {
    font-family: 'Geist Mono', 'SF Mono', monospace;
    font-size: 0.88em;
    background: var(--inline-code-bg);
    padding: 0.12em 0.4em;
    border-radius: 4px;
    color: var(--accent);
}

/* === Code Blocks === */
.code-block {
    background: var(--code-bg);
    border-left: 3px solid var(--accent-warm);
    border-radius: 6px 0 0 6px;
    margin: 1.75rem 0;
    margin-right: calc(-1.5rem - (100vw - var(--prose-width)) / 2);
    overflow: hidden;
}
.code-block-header {
    display: flex;
    justify-content: flex-end;
    padding: 0.6rem 1.25rem 0;
}
.copy-btn {
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #a8a29e;
    background: transparent;
    border: 1px solid #52504e;
    border-radius: 4px;
    padding: 0.25rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
}
.copy-btn:hover {
    color: #e7e5e4;
    border-color: #78716c;
    background: rgba(255,255,255,0.05);
}
.copy-btn.copied {
    color: var(--teal);
    border-color: var(--teal);
}
.code-block pre {
    margin: 0;
    padding: 0.4rem 1.25rem 1rem 0.85rem;
    overflow-x: auto;
    line-height: 1.45;
}
.code-block code {
    font-family: 'Geist Mono', 'SF Mono', monospace;
    font-size: 0.82rem;
    color: var(--code-text);
    background: none;
    padding: 0;
    border-radius: 0;
}
.code-block table { border-collapse: collapse; }
.code-block .line-num {
    width: 2.5em;
    text-align: right;
    padding-right: 1em;
    color: var(--code-line-num);
    font-size: 0.78rem;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    pointer-events: none;
    vertical-align: top;
    white-space: nowrap;
}
.code-block .line-content {
    white-space: pre;
    vertical-align: top;
}

/* === Search === */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}
.search-form input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    font-family: 'Literata', serif;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
.search-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(154,52,18,0.08);
}
.search-form button {
    padding: 0.6rem 1.25rem;
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.search-form button:hover { background: var(--accent-warm); }

/* === Comments === */
.legacy-comments { padding-top: 0; }
.legacy-comments h2 {
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.comment { margin-bottom: 1.75rem; font-size: 0.92rem; }
.comment-meta {
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.comment-meta a { color: var(--teal); text-decoration: none; }
.comment-meta a:hover { text-decoration: underline; }
.giscus-comments { margin-top: 2rem; }

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: space-between;
    padding-top: 1.5rem;
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.82rem;
}
.pagination a { color: var(--accent); text-decoration: none; }
.pagination a:hover { color: var(--accent-warm); }

/* === Footer === */
.site-footer {
    max-width: var(--prose-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    border-top: 1px solid var(--border-light);
    font-family: 'Geist Sans', -apple-system, sans-serif;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.7;
}
.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.site-footer a:hover { color: var(--accent); }
.site-footer .bio { margin-bottom: 0.4rem; }
.site-footer .legal {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* === Responsive === */
@media (max-width: 768px) {
    html { font-size: 16px; }
    .site-name { font-size: 1.1rem; }
    .post-header h1 { font-size: 1.6rem; }
    .code-block { margin-right: -1.5rem; }
    .post-image {
        position: static;
        display: block;
        width: 225px;
        height: 225px;
        margin: 0 0 1rem 0;
    }
    .site-footer { padding: 1.5rem 1rem 2rem; }
}
