/* Modern, minimalist styling */
:root {
    /* Light theme variables */
    --bg-color: #ffffff;
    --text-color: #333333;
    --link-color: #0066cc;
    --link-hover-color: #003366;
    --code-bg: #f5f5f5;
    --border-color: #dddddd;
    --nav-bg: #f8f9fa;
    --nav-text: #333333;
    --primary-color: #2c3e50;
    --background-color: var(--bg-color);
    --code-background: var(--code-bg);
    --nav-background: var(--nav-bg);
    --card-background: #fff;
    --card-shadow: rgba(0,0,0,0.05);
    --hover-bg: #f0f0f0;
}

[data-theme="dark"] {
    /* Dark theme variables */
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --link-color: #66b3ff;
    --link-hover-color: #99ccff;
    --code-bg: #2d2d2d;
    --border-color: #404040;
    --nav-bg: #2d2d2d;
    --nav-text: #e0e0e0;
    --primary-color: #61afef;
    --background-color: var(--bg-color);
    --code-background: var(--code-bg);
    --nav-background: var(--nav-bg);
    --card-background: #2c313a;
    --card-shadow: rgba(0,0,0,0.2);
    --hover-bg: #333;
}

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

/* Navigation */
.main-nav {
    background-color: var(--nav-background);
    padding: 1rem 0;
    box-shadow: 0 2px 4px var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 20;
}

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

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: var(--nav-text);
    text-decoration: none;
    margin-right: 1rem;
}

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

/* Dark mode toggle button */
.dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    width: 40px;
    height: 40px;
}

.dark-mode-toggle:hover {
    background-color: var(--hover-bg);
}

.theme-icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* Content container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    line-height: 1.2;
    margin-top: 0;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.25rem;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
}

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

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

.reading-progress {
    position: sticky;
    top: calc(72px + 0.75rem);
    z-index: 15;
    width: 100%;
    height: 0.4rem;
    margin: 0 0 1.5rem;
    background: color-mix(in srgb, var(--primary-color) 18%, transparent);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--border-color) 70%, transparent);
}

.reading-progress__bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--link-color));
    border-radius: inherit;
    transition: width 120ms ease-out;
}

.post-content h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
    line-height: 1.2;
}

.post-content h2 {
    font-size: 2rem;
    margin: 2rem 0 1rem;
}

.post-content h3 {
    font-size: 1.75rem;
    margin: 1.75rem 0 1rem;
}

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

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

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

.post-content blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 1.5rem 0;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    opacity: 0.9;
}

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

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

.post-meta {
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* Code blocks */
pre {
    background-color: var(--code-background);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
    z-index: 0;
}

code {
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background-color: var(--code-background);
    border-radius: 3px;
}

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

/* Mermaid diagrams */
.mermaid {
    background-color: var(--background-color);
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

/* Apply transitions */
.main-nav,
.container,
pre,
.mermaid,
.dark-mode-toggle {
    transition: background-color 0.3s ease;
}

/* Posts list */
.post-preview {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--card-shadow);
    transition: transform 0.2s ease;
}

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

.post-preview:hover {
    transform: translateY(-2px);
}

.post-preview h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-preview .post-excerpt {
    color: var(--text-color);
    margin: 1rem 0;
}

.read-more {
    display: inline-block;
    color: var(--link-color);
    font-weight: 500;
}

.read-more:hover {
    color: var(--link-hover-color);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

th,
td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}

th {
    background-color: var(--code-background);
    font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }

    .reading-progress {
        top: calc(72px + 0.5rem);
    }
}
