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

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

:root {
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --link-color: #0066cc;
    --link-hover: #0052a3;
    --border-color: #e5e5e5;
    --bg-subtle: #fafafa;
    --bg-primary: white;
    --max-width: 680px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #e8e8e8;
        --text-secondary: #999;
        --link-color: #4da3ff;
        --link-hover: #70b5ff;
        --border-color: #333;
        --bg-subtle: #1a1a1a;
        --bg-primary: #0d0d0d;
    }
    
    /* Smooth transitions for SVG icons */
    svg {
        transition: color 0.3s ease;
    }
    
    /* Better code block appearance in dark mode */
    .post-content pre {
        background: #1a1a1a;
        border: 1px solid var(--border-color);
    }
    
    .post-content code {
        background: #1a1a1a;
        color: #e8e8e8;
    }
    
    .post-content pre code {
        background: transparent;
    }
}

/* Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
    margin-bottom: 1.25rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Layout */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    padding: 4rem 2rem 3rem 2rem;
    border-right: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.main-container {
    flex: 1;
    margin-left: 280px;
    padding: 0 2rem;
    max-width: calc(var(--max-width) + 4rem);
    width: 100%;
}

/* Sidebar Navigation */
.sidebar .site-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
}

.sidebar .site-title:hover {
    text-decoration: none;
    opacity: 0.8;
}

.sidebar .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar .nav-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-decoration: none;
}

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

/* Main Content */
.site-content {
    padding: 2rem 0;
    min-height: calc(100vh - 100px);
}

/* Homepage Specific */
.hero {
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.sidebar .social-links {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.sidebar .social-links a {
    color: var(--text-secondary);
    transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar .social-links a:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
    text-decoration: none;
}

.sidebar .social-links svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Posts List */
.posts-section {
    margin-bottom: 3rem;
}

.posts-section:first-child {
    margin-top: 0;
}

.section-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.posts-list {
    list-style: none;
}

.post-item {
    margin-bottom: 1rem;
}

.post-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    min-width: 100px;
    flex-shrink: 0;
}

.post-title {
    display: block;
}

.post-title a {
    color: var(--text-primary);
    font-weight: 500;
}

.post-title a:hover {
    color: var(--link-color);
    text-decoration: none;
}

/* Single Post */
.post-header {
    margin-bottom: 2rem;
}

.post-header h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.post-content {
    margin-bottom: 3rem;
}

.post-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
    display: block;
}

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

.post-content code {
    background: var(--bg-subtle);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Courier New', Courier, monospace;
    word-break: break-word;
}

.post-content pre {
    background: var(--bg-subtle);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1.5rem 0;
    max-width: 100%;
}

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

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

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

/* Author Bio Section */
.author {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.author .profile {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author article {
    flex: 1;
}

.author h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.author p {
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.site-footer a {
    color: var(--text-secondary);
}

.site-footer a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* Page */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    margin-top: 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.pagination a {
    color: var(--text-secondary);
}

.pagination a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.page-number {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Mobile Header (hidden on desktop) */
.mobile-header {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    /* Switch to mobile layout */
    .layout-wrapper {
        flex-direction: column;
    }
    
    /* Hide desktop sidebar */
    .sidebar {
        display: none;
    }
    
    /* Show mobile header */
    .mobile-header {
        display: block;
        padding: 1.5rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }
    
    .mobile-header .site-title {
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--text-primary);
        text-decoration: none;
    }
    
    .mobile-about-link {
        color: var(--text-secondary);
        font-size: 0.95rem;
        text-decoration: none;
    }
    
    .mobile-about-link:hover {
        color: var(--text-primary);
    }
    
    .mobile-tagline {
        font-size: 0.9rem;
        color: var(--text-secondary);
        line-height: 1.4;
        margin: 0 0 1rem 0;
    }
    
    .mobile-social-links {
        display: flex;
        gap: 1rem;
    }
    
    .mobile-social-links a {
        color: var(--text-secondary);
        transition: color 0.2s ease;
    }
    
    .mobile-social-links a:hover {
        color: var(--text-primary);
        text-decoration: none;
    }
    
    .mobile-social-links svg {
        display: block;
        width: 20px;
        height: 20px;
    }
    
    /* Reset main container margins for mobile */
    .main-container {
        margin-left: 0;
        padding: 0 1.5rem;
        max-width: 100%;
    }
    
    .site-content {
        padding: 1rem 0;
        min-height: auto;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .nav-links {
        gap: 1.5rem;
    }
    
    .author {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .author .profile {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .site-header {
        padding: 1.5rem 0;
        margin-bottom: 2rem;
    }
    
    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
    }
}