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

/* CSS Variables for theming */
:root {
    --primary-bg: #fafafa;
    --secondary-bg: #ffffff;
    --accent-bg: #f5f5f5;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e1e1e1;
    --hover-bg: #f8f8f8;
    --accent-color: #2563eb;
    --navbar-bg: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] {
    --primary-bg: #111111;
    --secondary-bg: #1a1a1a;
    --accent-bg: #222222;
    --text-primary: #e5e5e5;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --border-color: #333333;
    --hover-bg: #2a2a2a;
    --accent-color: #60a5fa;
    --navbar-bg: rgba(26, 26, 26, 0.95);
}

/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Body styling */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar styling */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--navbar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Navbar brand */
.navbar-brand {
    display: flex;
    align-items: center;
    justify-self: start;
}

/* Domain name styling */
.domain-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.3s ease;
    text-decoration: none;
}

.domain-name:hover {
    color: var(--accent-color);
}

/* Navbar navigation */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 30px;
    justify-self: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.3s ease;
    position: relative;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s ease;
    justify-self: end;
}

/* .theme-toggle:hover {
    background-color: var(--hover-bg);
} */

/* Sun icon */
.sun-icon {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    transition: fill 0.3s ease, transform 0.2s ease;
}

.sun-icon:hover {
    transform: scale(2.0);
}

/* Main content */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 75px);
    background-color: var(--primary-bg);
    transition: background-color 0.3s ease;
}

/* Hero section */
.hero-section {
    text-align: center;
    padding: 60px 0;
    margin: 0 20px 0 20px;
}

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

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* Content wrapper */
.content-wrapper {
    padding: 60px 0;
    max-width: 1200px;
    margin: 0 auto;
}

/* Blog posts */
.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* No posts message */
.no-posts-message {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 60px 32px;
    text-align: center;
}

.no-posts-message p {
    color: var(--text-secondary);
    font-size: 16px;
    font-style: italic;
}

/* Post card */
.post-card {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

/* Post meta */
.post-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: center;
}

.post-date {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.post-category {
    background-color: var(--accent-bg);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Post title */
.post-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.post-card:hover .post-title {
    color: var(--accent-color);
}

/* Post excerpt */
.post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.7;
    font-size: 15px;
}

/* Read more link */
.read-more {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.read-more:hover {
    color: var(--text-primary);
    transform: translateX(4px);
}

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

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

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.sidebar-section {
    padding: 24px;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.sidebar-text {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
}

/* Category list */
.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.category-link:hover {
    background-color: var(--accent-bg);
    color: var(--accent-color);
    transform: translateX(4px);
}

/* Recent posts */
.recent-posts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-post-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    transition: color 0.3s ease;
    display: block;
    padding: 4px 0;
}

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

/* Blog post viewer */
.post-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-viewer.active {
    display: flex;
    opacity: 1;
}

.post-viewer-content {
    background-color: var(--secondary-bg);
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.post-viewer.active .post-viewer-content {
    transform: scale(1);
}

.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.close-button:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.post-content {
    padding: 40px;
}

.post-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.post-header .post-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.post-header .post-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.post-body {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 16px;
}

/* Markdown content styling */
.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.3;
}

.post-body h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5em;
}

.post-body h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}

.post-body h3 {
    font-size: 1.5rem;
}

.post-body h4 {
    font-size: 1.25rem;
}

.post-body h5 {
    font-size: 1.125rem;
}

.post-body h6 {
    font-size: 1rem;
}

.post-body p {
    margin-bottom: 1.5em;
    line-height: 1.8;
}

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

.post-body li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.post-body blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5em;
    margin: 2em 0;
    font-style: italic;
    color: var(--text-secondary);
    background-color: var(--accent-bg);
    padding: 1.5em;
    border-radius: 0 8px 8px 0;
}

.post-body code {
    background-color: var(--accent-bg);
    color: var(--accent-color);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.post-body pre {
    background-color: var(--accent-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5em;
    overflow-x: auto;
    margin: 2em 0;
}

.post-body pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.post-body a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.post-body a:hover {
    border-bottom-color: var(--accent-color);
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2em 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.post-body th,
.post-body td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.post-body th {
    background-color: var(--accent-bg);
    font-weight: 600;
    color: var(--text-primary);
}

.post-body tr:hover {
    background-color: var(--hover-bg);
}

.post-body hr {
    border: none;
    height: 1px;
    background-color: var(--border-color);
    margin: 3em 0;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }
    
    .navbar-nav {
        display: none;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 40px 0;
    }
    
    .post-card {
        padding: 24px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .domain-name {
        font-size: 18px;
    }
    
    /* Blog post viewer mobile styles */
    .post-viewer {
        padding: 10px;
    }
    
    .post-viewer-content {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .post-content {
        padding: 20px;
    }
    
    .post-header .post-title {
        font-size: 1.75rem;
    }
    
    .post-body {
        font-size: 15px;
    }
    
    .post-body h1 {
        font-size: 1.5rem;
    }
    
    .post-body h2 {
        font-size: 1.25rem;
    }
    
    .post-body h3 {
        font-size: 1.125rem;
    }
    
    .post-body pre {
        padding: 1em;
        font-size: 13px;
    }
    
    .post-body table {
        font-size: 14px;
    }
    
    .post-body th,
    .post-body td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 40px 0;
        margin: 20px 16px 0 16px;
        border-radius: 12px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .post-card {
        padding: 20px;
    }
    
    .post-title {
        font-size: 1.25rem;
    }
}
