/* ==========================================================================
   Global Variables & Base Setup
   ========================================================================== */
:root {
    --bg-color: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --accent-color: #2563eb;
    --border-color: #e5e7eb;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-stack);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Navigation & Footer
   ========================================================================== */
.site-nav {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 0;
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-color);
}

.nav-links a {
    margin-left: 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text-color);
}

.site-footer {
    margin-top: auto;
    padding: 2.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Landing / About Me Page
   ========================================================================== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    width: 100%;
}

.centered-page {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

.about-card {
    text-align: center;
    max-width: 600px;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    margin-bottom: 1.5rem;
}

.about-name {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.about-bio {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.btn-primary {
    display: inline-block;
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    text-decoration: none;
}

/* ==========================================================================
   Blog Posts List Feed
   ========================================================================== */
.page-header {
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
}

.page-header p {
    color: var(--text-muted);
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.post-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2.5rem;
}

.post-item-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.post-item-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.post-item-title a {
    color: var(--text-color);
}

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

.post-item-excerpt {
    color: var(--text-muted);
}

/* ==========================================================================
   Centered Post View with Native .kg-width-wide & .kg-width-full Support
   ========================================================================== */

/* 1. Article Wrapper (Full Width) */
.post-single {
    width: 100%;
    margin: 3rem 0;
    box-sizing: border-box;
}

/* 2. Post Header (Centered to 720px) */
.post-header {
    max-width: 720px;
    margin: 0 auto 2.5rem auto;
    padding: 0 1.5rem;
    text-align: center;
}

/* 3. Grid Container on Content */
.post-content {
    display: grid;
    /* [Full Edge] | [Wide Breakout ~140px] | [Main Text 720px] | [Wide Breakout ~140px] | [Full Edge] */
    grid-template-columns: 
        [full-start] minmax(1.5rem, 1fr) 
        [wide-start] minmax(0, 140px) 
        [main-start] minmax(0, 720px) [main-end] 
        minmax(0, 140px) [wide-end] 
        minmax(1.5rem, 1fr) [full-end];
    width: 100%;
    font-size: 1.125rem;
    line-height: 1.7;
}

/* 4. DEFAULT: Text, P, H1-H6, Blockquotes sit in the centered 720px column */
.post-content > * {
    grid-column: main;
    min-width: 0; /* CRITICAL: Keeps long code lines from expanding grid width */
}

/* 5. WIDE CARDS: Expands up to ~1000px */
.post-content .kg-width-wide {
    grid-column: wide;
    width: 100%;
}

/* 6. FULL-BLEED CARDS: Expands to 100% of the screen width */
.post-content .kg-width-full {
    grid-column: full;
    width: 100%;
}

.post-content .kg-width-full img {
    border-radius: 0 !important;
}

/* 7. Image Scaling Overrides (Fixes inline Ghost width="1080") */
.post-content figure,
.post-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 1.5rem auto;
    border-radius: 8px;
}

/* 8. Code Block Containment */
.post-content pre {
    grid-column: main;
    max-width: 100%;
    overflow-x: auto;
    background-color: #1d1f21 !important;
    padding: 1.25rem;
    border-radius: 8px;
    margin: 2rem 0;
    box-sizing: border-box;
}

.post-content pre code {
    white-space: pre;
    word-break: normal;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.95rem;
    color: #e6edf3;
}

/* 9. Mobile Responsiveness */
@media (max-width: 768px) {
    .post-content {
        grid-template-columns: 
            [full-start wide-start main-start] 
            minmax(0, 100%) 
            [main-end wide-end full-end];
        padding: 0 1rem;
    }
}