:root {
    /* Editorial Color Palette */
    --bg-body: #FFFCF8;
    /* Warm, paper-like off-white */
    --bg-surface: #FFFFFF;
    --text-primary: #121212;
    /* Almost black, softer than #000 */
    --text-secondary: #5A5A5A;
    --accent: #C19A6B;
    /* Muted Gold/Sand for subtle highlights */
    --border-light: #EAEAEA;

    /* Spacing System */
    --container-width: 1100px;
    /* Wider container for grid */
    --content-width: 680px;
    /* Optimal reading width */
    --header-height: 100px;

    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;
}

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

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

img {
    max-width: 100%;
    display: block;
    height: auto;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.6;
}

/* Layout Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 30px;
}

.hidden {
    display: none !important;
}

.section-title {
    font-family: var(--font-display);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 50px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* Header - Minimalist & Centered */
.site-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    background-color: rgba(255, 252, 248, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.header-inner {
    width: 100%;
    max-width: var(--container-width);
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    cursor: pointer;
}

nav ul {
    display: flex;
    gap: 40px;
    list-style: none;
}

.nav-link {
    font-family: var(--font-body);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 400;
    color: var(--text-secondary);
    position: relative;
}

.nav-link.active {
    color: var(--text-primary);
    font-weight: 700;
}

.subscribe-btn {
    background-color: #1E3A8A;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 25px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.subscribe-btn:hover {
    background-color: #1E40AF;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.4);
}

/* Hero Section */
.hero-section {
    background-color: var(--bg-body);
    padding: 50px 30px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 30px;
    font-weight: 500;
}

.hero-description {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* Featured Post */
.featured-post-container {
    background: var(--bg-surface);
    margin: 0 auto 80px;
    max-width: 1000px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    /* Prevent layout shift */
    min-height: 400px;
}

.featured-post {
    display: grid;
    grid-template-columns: 500px 1fr;
    gap: 0;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    will-change: box-shadow;
}

.featured-post:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12);
}

.featured-post-image {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Prevent layout shift */
    min-height: 400px;
    background: #f5f5f5;
}

.featured-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    /* Prevent layout shift */
    aspect-ratio: 5/4;
    will-change: transform;
}

.featured-post:hover .featured-post-image img {
    transform: scale(1.05);
}

.featured-post-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 60px;
    justify-content: center;
}

.featured-post-meta {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    font-weight: 500;
}

.featured-post-title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    line-height: 1.2;
    font-weight: 400;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.featured-post-excerpt {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.featured-read-more {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.featured-read-more::after {
    content: '→';
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.featured-post:hover .featured-read-more {
    color: var(--accent);
}

.featured-post:hover .featured-read-more::after {
    transform: translateX(4px);
}

/* Post Grid - Recent Posts */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    padding-bottom: 80px;
}

.post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    will-change: transform;
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.post-card-image {
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: #f5f5f5;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    /* Prevent layout shift */
    aspect-ratio: 4/3;
    will-change: transform;
}

.post-card:hover .post-card-image img {
    transform: scale(1.1);
}

.post-card-content {
    padding: 30px;
}

.post-card-meta {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 12px;
}

.post-card-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1.3;
    font-weight: 400;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.post-card-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Home Grid Layout - OLD (keeping for backwards compatibility) */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 50px;
    padding-top: 60px;
    padding-bottom: 80px;
    max-width: 1000px;
    margin: 0 auto;
}

.post-item {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    cursor: pointer;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.post-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.post-list-image {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.post-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-item:hover .post-list-image img {
    transform: scale(1.05);
}

.post-content-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 40px 40px 40px 0;
    justify-content: center;
}

.post-meta {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    font-weight: 500;
}

.post-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    line-height: 1.2;
    font-weight: 400;
    margin-bottom: 12px;
}

.post-excerpt {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.read-more::after {
    content: '→';
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.post-item:hover .read-more {
    color: var(--accent);
}

.post-item:hover .read-more::after {
    transform: translateX(4px);
}

/* Post Viewer - Cinematic */
.post-viewer {
    width: 100%;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.post-hero-container {
    width: 100vw;
    height: 40vh;
    margin-left: calc(-50vw + 50%);
    position: relative;
    margin-bottom: 0;
    overflow: hidden;
}

.post-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Parallax handled by JS or simple fixed attachment if preferred, sticking to JS for smoothness */
}

.post-content-wrapper {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px 100px;
    position: relative;
    z-index: 10;
}

/* Markdown Content Styling */
#markdown-content {
    font-family: var(--font-display);
    /* Using serif for body text for elegance */
    font-size: 1.25rem;
    color: var(--text-primary);
}

#markdown-content h1 {
    font-family: var(--font-display);
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 0.5em;
    margin-top: 0;
    text-align: center;
    padding: 20px 20px;
}

#markdown-content h2 {
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 3em;
    margin-bottom: 1em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#markdown-content p {
    font-family: 'Georgia', serif;
    /* Fallback to a classic serif for reading */
    line-height: 1.8;
    margin-bottom: 2em;
    font-size: 1.2rem;
}

#markdown-content blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 30px;
    margin: 3em 0;
    font-style: italic;
    font-size: 1.4rem;
    color: var(--text-secondary);
}

#markdown-content img {
    width: 100%;
    border-radius: 2px;
    margin: 3em 0;
}

#markdown-content a {
    color: #1E3A8A !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    transition: opacity 0.3s ease;
    pointer-events: auto !important;
}

#markdown-content a:hover {
    opacity: 0.7;
    color: #1E40AF !important;
}

#markdown-content ul,
#markdown-content ol {
    padding-left: 40px;
    margin-bottom: 2em;
}

#markdown-content li {
    margin-bottom: 0.5em;
}

#markdown-content strong {
    font-weight: 700;
}

/* Books Section */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 60px;
    padding-top: 40px;
    padding-bottom: 80px;
}

.book-card {
    text-align: center;
}

.book-cover-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    background: #F0F0F0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: #CCC;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.book-card h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.book-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--text-primary);
    color: white;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: background 0.3s;
}

.btn:hover {
    background: var(--accent);
}

/* About Section */
#about-section {
    padding-top: 80px;
    padding-bottom: 80px;
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.about-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 50px;
    font-weight: 400;
    letter-spacing: -0.02em;
}

.about-content {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 60px;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

.author-photo-wrapper {
    position: relative;
    width: 240px;
    height: 240px;
}

.author-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    /* Prevent layout shift */
    aspect-ratio: 1/1;
}

.author-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

.author-bio {
    text-align: left;
}

.bio-intro {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 400;
    line-height: 1.6;
}

.author-bio p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 18px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .featured-post {
        grid-template-columns: 400px 1fr;
    }

    .featured-post-content {
        padding: 40px;
    }
}

@media (max-width: 768px) {
    .site-header {
        height: auto;
        padding: 20px 0;
    }

    .header-inner {
        flex-direction: column;
        gap: 20px;
    }

    nav ul {
        gap: 20px;
    }

    .subscribe-btn {
        padding: 10px 24px;
        font-size: 0.7rem;
    }

    .hero-section {
        padding: 60px 20px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-description {
        font-size: 1rem;
        padding: 0 10px;
    }

    .featured-post {
        grid-template-columns: 1fr;
    }

    .featured-post-image {
        height: 300px;
    }

    .featured-post-content {
        padding: 40px 30px;
    }

    .featured-post-title {
        font-size: 2rem;
    }

    .post-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .post-hero-container {
        height: 50vh;
    }

    .post-content-wrapper {
        padding: 0 15px 60px;
    }

    #markdown-content h1 {
        font-size: 2rem;
        padding: 20px 10px;
    }

    #markdown-content h2 {
        font-size: 1.3rem;
        margin-top: 2em;
    }

    #markdown-content p {
        font-size: 1rem;
        line-height: 1.7;
    }

    #markdown-content blockquote {
        font-size: 1.1rem;
        padding-left: 20px;
        margin: 2em 0;
    }

    #markdown-content ul,
    #markdown-content ol {
        padding-left: 25px;
    }

    .container {
        padding: 0 20px;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }
}