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

:root {
    --color-background: #f9f7f4;
    --color-text: #1a1a1a;
    --color-text-secondary: #666666;
    --color-border: #e5e5e5;
    --color-accent: #000000;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --max-width: 1200px;
    --spacing-unit: 1rem;
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessibility - Skip Link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--color-accent);
    color: var(--color-background);
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    z-index: 100;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    position: fixed;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    overflow: visible;
}

/* Focus Styles for Keyboard Navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 2rem 0;
    background-color: var(--color-background);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

.site-nav {
    display: flex;
    gap: 2rem;
}

.site-nav a {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.site-nav a:hover {
    color: var(--color-accent);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
}

.burger-icon {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 0.5rem;
    z-index: 101;
}

.burger-icon span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-accent);
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Burger animation when checked */
.menu-toggle:checked ~ .burger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle:checked ~ .burger-icon span:nth-child(2) {
    opacity: 0;
}

.menu-toggle:checked ~ .burger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding: 4rem 0;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 3rem;
    margin-top: 2rem;
}

/* Post Card */
.post-card {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 2rem;
}

.post-card:hover h2 a {
    color: var(--color-text-secondary);
}

.post-meta {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.post-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.post-card h2 a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s;
}

.post-summary {
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #f5f5f5;
    color: var(--color-text);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Back Link */
.back-link {
    display: inline-block;
    max-width: 750px;
    margin: 0 auto 1.5rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s;
}

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

/* Single Post */
.post {
    max-width: 750px;
    margin: 0 auto;
}

.post-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.post-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.post-header .post-meta {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.post-header .post-tags {
    margin-top: 1.5rem;
}

/* Post Content */
.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--color-text);
}

.post-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.02em;
}

.post-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    letter-spacing: -0.02em;
}

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

.post-content a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.post-content a:hover {
    text-decoration-thickness: 2px;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

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

.post-content code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: "SF Mono", Monaco, Consolas, monospace;
}

.post-content pre {
    background-color: #f5f5f5;
    padding: 1.5rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
}

.post-content blockquote {
    border-left: 3px solid var(--color-border);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--color-text-secondary);
}

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

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

.site-footer p {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    .header-content {
        flex-wrap: wrap;
        position: relative;
    }

    .burger-icon {
        display: flex;
    }

    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--color-background);
        flex-direction: column;
        gap: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    }

    .site-nav a {
        padding: 1rem 2rem;
        border-bottom: 1px solid var(--color-border);
    }

    .site-nav a:last-child {
        border-bottom: none;
    }

    .menu-toggle:checked ~ .site-nav {
        max-height: 500px;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .post-header h1 {
        font-size: 2rem;
    }

    .post-content {
        font-size: 1rem;
    }

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

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