/* Self-hosted fonts for better performance */
@font-face {
    font-family: 'Source Serif 4';
    src: url('../fonts/source-serif-4/source-serif-4-v14-latin_latin-ext-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Source Serif 4';
    src: url('../fonts/source-serif-4/source-serif-4-v14-latin_latin-ext-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/jetbrains-mono/jetbrains-mono-v24-latin-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Typography Variables - Easy to customize */
:root {
    --font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --code-font-family: 'JetBrains Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    --font-size-base: 17px;
    --font-size-large: 19px;
    --line-height-base: 1.75;
    --line-height-heading: 1.35;

    /* Spacing - Easy to adjust */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Layout */
    --content-width: 760px;
    --container-padding: 2rem;

    /* Colors */
    --bg-color: #FAFAF7;
    --text-color: #1A1A1A;
    --text-light: #6B7280;
    --text-lighter: #999;
    --border-color: #ddd;
    --border-light: #eee;
    --code-bg: #f5f5f5;
    --code-border: #e5e5e5;
    --link-color: #2563EB;
}

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

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

/* Base Typography */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--text-color);
    background: var(--bg-color);
    font-variant-numeric: lining-nums;
}

/* Override bold text to be semi-bold */
strong, b {
    font-weight: 600;
}

/* Layout */
.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    width: 100%;
    box-sizing: border-box;
}

/* Header */
.site-header {
    padding: var(--spacing-xl) 0 var(--spacing-lg) 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.site-title {
    font-size: 2rem;
    font-weight: normal;
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.site-title a {
    color: var(--text-color);
    text-decoration: none;
}

.site-subtitle {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
    margin-top: -1.6rem;
    font-style: italic;
    text-align: center;
}

.site-nav {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
}

.site-nav a {
    color: var(--text-light);
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0;
    cursor: pointer;
    font-size: 1.2rem;
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    opacity: 0.7;
}

.theme-toggle.dark {
    opacity: 0.3;
}

/* Main Content */
.main-content {
    min-height: 60vh;
}

/* Homepage Intro */
.intro {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.intro a {
    color: var(--text-color);
    text-decoration: underline;
}

.intro a:hover {
    color: #000000;
}

/* Featured Posts */
.featured-posts {
    margin-bottom: var(--spacing-xl);
}

.featured-posts h2 {
    font-size: 1.4rem;
    font-weight: normal;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.featured-box {
    border: 2px solid var(--text-color);
    border-radius: 4px;
    padding: var(--spacing-md);
    background: #F2F3EE;
}

.featured-list {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0;
}

.featured-item {
    margin-bottom: var(--spacing-sm);
}

.featured-item:last-child {
    margin-bottom: 0;
}

.featured-item a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
}

.featured-item a:hover {
    text-decoration: underline;
}

.featured-item .post-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.featured-item .post-meta .post-category {
    font-size: 0.85rem;
}

/* All Posts */
.all-posts {
    margin-bottom: var(--spacing-xl);
}

.all-posts h2 {
    font-size: 1.4rem;
    font-weight: normal;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.all-posts .post-list {
    list-style: disc;
    padding-left: 1.5rem;
}

.all-posts .post-item {
    margin-bottom: var(--spacing-sm);
}

.all-posts .post-item a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
}

.all-posts .post-item a:hover {
    text-decoration: underline;
}

.all-posts .post-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.all-posts .post-meta .post-category {
    font-size: 0.85rem;
}

/* Content Sections */
.content-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.content-section:last-child {
    border-bottom: none;
}

.content-section h2 {
    font-size: 1.4rem;
    font-weight: normal;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

/* Post Meta - Universal */
.post-header .post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: var(--spacing-xs);
    font-size: 0.85rem;
    color: var(--text-light);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--spacing-xs);
    font-size: 0.85rem;
    color: var(--text-light);
}

.post-author {
    font-weight: 600;
    color: var(--text-color);
}

.post-read-time {
    font-style: italic;
}

.post-banner {
    margin-top: 1.5rem;
    margin-bottom: 0;
}

.post-banner img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

.post-date {
    color: var(--text-light);
    white-space: nowrap;
    font-size: 0.85rem;
}

.post-category {
    font-size: 0.85rem;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    text-decoration: none;
}

.post-category:hover {
    color: var(--text-light);
}

.post-category::before {
    content: "";
    margin: 0;
}

/* Post Lists */
.post-list {
    margin-bottom: var(--spacing-md);
}

.post-item {
    margin-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.post-item h2,
.post-item h3 {
    font-size: 1.1rem;
    font-weight: normal;
    line-height: var(--line-height-heading);
    margin-bottom: var(--spacing-xs);
}

.post-item h2 a,
.post-item h3 a {
    color: #333;
    text-decoration: none;
}

.post-item h2 a:hover,
.post-item h3 a:hover {
    text-decoration: underline;
}

.post-summary {
    color: #666;
    font-size: 0.95rem;
    line-height: var(--line-height-base);
}

.section-link {
    font-size: 0.9rem;
}

.section-link a {
    color: #666;
    text-decoration: none;
}

.section-link a:hover {
    text-decoration: underline;
}

/* Individual Posts */
.post {
    margin-bottom: var(--spacing-xl);
}

.post-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid #eee;
    text-align: center;
}

.post-title {
    font-size: 2.2rem;
    font-weight: normal;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    text-align: center;
}

.post-subtitle {
    font-size: 1.2rem;
    font-weight: normal;
    line-height: 1.4;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 1rem;
    font-style: italic;
}

.post-meta {
    font-size: 0.85rem;
    color: #666;
}

/* Post Content */
.post-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    max-width: 75ch;
    margin: 0 auto;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.post-content *,
.post-content *::before,
.post-content *::after {
    max-width: 100%;
    box-sizing: border-box;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    font-weight: 600;
    line-height: 1.3;
    margin: 2rem 0 1rem 0;
    color: #222;
}

.post-content h1 {
    font-size: 1.75rem;
}

.post-content h2 {
    font-size: 1.5rem;
}

.post-content h3 {
    font-size: 1.25rem;
}

.post-content h4 {
    font-size: 1.1rem;
}

.post-content p {
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.post-content ul,
.post-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content li p {
    margin-bottom: 0.5rem;
}

.post-content li:last-child {
    margin-bottom: 0;
}

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

.post-content a:hover {
    color: #000000;
}

.post-content del,
.post-content s {
    text-decoration: line-through;
    opacity: 0.7;
}

.post-content mark {
    background: #ffeb3b;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

.post-content blockquote {
    background: #F2F3EE;
    border-left: 4px solid #D1D5C9;
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    color: #2A2A2A;
    font-style: italic;
}

.post-content code {
    font-family: "Source Code Pro", "Fira Code", "JetBrains Mono", monospace;
    background-color: #e8e8e8;
    color: #000;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-size: 0.95em;
    border: none;
}

.post-content .highlight {
    background: #0B0F14;
    color: #EDEDED;
    padding: 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #1F2933;
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

.post-content .highlight code {
    background: none;
    padding: 0;
    border: none;
    font-size: inherit;
    color: #EDEDED;
}

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

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

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
    line-height: 1.6;
    border: 1px solid var(--border-color);
}

.post-content th {
    text-align: left;
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    background: #F2F3EE;
}

.post-content td {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    vertical-align: top;
}

.post-content tr {
    background: transparent;
}

.post-content thead {
    border-bottom: 2px solid var(--border-color);
}

.post-content iframe {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Video Container for Responsive YouTube Embeds */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 1.5rem 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Post Footer */
.post-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid #eee;
    font-size: 0.9rem;
    color: #666;
}

.post-tags a {
    color: #666;
    text-decoration: none;
}

.post-tags a:hover {
    text-decoration: underline;
}

/* Post Navigation */
.post-nav {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.post-nav a {
    color: #666;
    text-decoration: none;
}

.post-nav a:hover {
    text-decoration: underline;
}

.post-nav-next {
    text-align: right;
}

/* Category Pages */
.category-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid #eee;
}

.category-header h1 {
    font-size: 1.6rem;
    font-weight: normal;
    margin-bottom: var(--spacing-xs);
}

.category-header p {
    color: #666;
    font-size: 0.9rem;
}

/* Pages */
.page-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid #eee;
}

.page-title {
    font-size: 1.6rem;
    font-weight: normal;
}

.page-content {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
}

.page-content h1,
.page-content h2,
.page-content h3 {
    font-weight: normal;
    line-height: var(--line-height-heading);
    margin: var(--spacing-lg) 0 var(--spacing-md) 0;
}

.page-content p {
    margin-bottom: var(--spacing-md);
}

.page-content ul,
.page-content ol {
    margin: var(--spacing-md) 0;
    padding-left: var(--spacing-lg);
}

.page-content a {
    color: #333;
    text-decoration: underline;
}

/* Footer */
.site-footer {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md) 0;
    border-top: 1px solid #ddd;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.site-footer a {
    color: #666;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.site-footer p {
    margin-bottom: var(--spacing-xs);
}

/* Archives */
.archives {
    margin-top: var(--spacing-lg);
}

.archive-year {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid #eee;
}

.archive-year:last-child {
    border-bottom: none;
}

.archive-year h2 {
    font-size: 1.4rem;
    font-weight: normal;
    margin-bottom: var(--spacing-md);
    color: #333;
}

/* Table of Contents */
.toc {
    background: var(--bg-color);
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin: 2rem 0;
    padding: 0;
    max-width: 100%;
}

.toc-toggle {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: var(--font-size-base);
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.toc-toggle:hover {
    background: #e9ecef;
}

.toc-toggle::before {
    content: '▶';
    font-size: 0.8rem;
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
}

.toc-toggle.collapsed::before {
    transform: rotate(90deg);
}

.toc-content {
    padding: 0 1.5rem 1rem 1.5rem;
    display: none;
}

.toc-content.hidden {
    display: none;
}

.toc ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0;
}

.toc ul ul {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toc a:hover {
    text-decoration: underline;
    color: #000;
}
.newsletter-signup {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
    border: 2px solid var(--border-light);
    padding: 1.5rem;
    border-radius: 8px;
    background: var(--bg-color);
}

.newsletter-signup h3 {
    margin: 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.newsletter-signup details {
    margin: 1rem 0;
    text-align: left;
}

.newsletter-signup summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

.newsletter-signup details p {
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.newsletter-signup iframe {
    max-width: 100%;
    width: 100%;
    border-radius: 10px;
    min-height: 320px;
    overflow: visible;
}

@media (max-width: 768px) {
    .newsletter-signup {
        padding: 0.5rem;
        margin: 1.5rem 0;
        overflow: visible;
    }
    
    .newsletter-signup iframe {
        width: 100%;
        max-width: 100%;
        min-height: 280px;
        border-radius: 6px;
        overflow: visible;
    }
}

/* Callout divs */
.post-content div[data-node-type="callout"] {
    background: #F2F3EE;
    border-left: 4px solid #D1D5C9;
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: 4px;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox img {
    max-width: 70%;
    max-height: 70%;
    object-fit: contain;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --container-padding: 1rem;
        --spacing-xl: 2rem;
        --spacing-lg: 1.5rem;
    }

    .site-header {
        padding: var(--spacing-lg) 0;
    }

    .site-title {
        font-size: 1.6rem;
    }

    .site-nav a {
        display: block;
        margin: var(--spacing-xs) 0;
    }

    .post-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .post-content {
        font-size: 1rem;
        padding: 0 1rem;
        max-width: 100%;
    }

    .post-content h1 {
        font-size: 1.5rem;
        margin: 1.5rem 0 0.75rem 0;
    }

    .post-content h2 {
        font-size: 1.3rem;
        margin: 1.5rem 0 0.75rem 0;
    }

    .post-content h3 {
        font-size: 1.15rem;
        margin: 1.25rem 0 0.5rem 0;
    }

    .post-content h4 {
        font-size: 1.05rem;
        margin: 1rem 0 0.5rem 0;
    }

    .post-content p {
        margin-bottom: 1rem;
    }

    .post-content ul,
    .post-content ol {
        padding-left: 1.25rem;
        margin: 1rem 0;
    }

    .post-content pre {
        background: #0B0F14;
        color: #EDEDED;
        padding: 0.75rem;
        border-radius: 6px;
        overflow-x: auto;
        margin: 1rem 0;
        border: 1px solid #1F2933;
        font-size: 0.85rem;
        line-height: 1.4;
        max-width: 100%;
        box-sizing: border-box;
    }

    .post-content blockquote {
        padding: 0.75rem 1rem;
        margin: 1rem 0;
    }

    .post-nav {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .post-nav-next {
        text-align: left;
    }
}