/* ========================================
   Reset & Base Styles
   ======================================== */

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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0e0;
    --bg-color: #fff;
    --bg-light: #f8f9fa;
    --code-bg: #f5f5f5;
    --link-color: #3498db;
    --link-hover: #2980b9;
    --max-width: 800px;
    --spacing: 1.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
}

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

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

/* ========================================
   Header & Navigation
   ======================================== */

.site-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 3rem;
}

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: white;
}

.site-title a:hover {
    color: #ecf0f1;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-menu a {
    color: white;
    font-weight: 500;
}

.nav-menu a:hover {
    color: #ecf0f1;
}

/* ========================================
   Main Content
   ======================================== */

.site-main {
    min-height: calc(100vh - 300px);
    margin-bottom: 3rem;
}

/* ========================================
   Posts List
   ======================================== */

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

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

.post-preview:last-child {
    border-bottom: none;
}

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

.post-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.post-title a {
    color: var(--text-color);
}

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

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

.post-meta time {
    margin-right: 1rem;
}

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

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

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-light);
    border-radius: 3px;
    font-size: 0.85rem;
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

.tag:hover {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

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

.no-posts {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-light);
}

/* ========================================
   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-info {
    color: var(--text-light);
    font-size: 0.9rem;
}

.pagination-prev,
.pagination-next {
    padding: 0.5rem 1rem;
    background-color: var(--bg-light);
    border-radius: 3px;
    font-weight: 500;
}

.pagination-prev:hover,
.pagination-next:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* ========================================
   Post Detail
   ======================================== */

.post {
    max-width: 100%;
}

.post .post-title {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

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

.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Typography in post content */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--primary-color);
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.75rem; }
.post-content h3 { font-size: 1.5rem; }
.post-content h4 { font-size: 1.25rem; }
.post-content h5 { font-size: 1.1rem; }
.post-content h6 { font-size: 1rem; }

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

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

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

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

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

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

/* ========================================
   Code Highlighting
   ======================================== */

.post-content code {
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.9em;
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: #e74c3c;
}

.post-content pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
    color: var(--text-color);
    font-size: 0.9rem;
}

/* Syntax highlighting colors */
.post-content .highlight {
    background-color: var(--code-bg);
}

.post-content .highlight .k { color: #0000ff; } /* Keyword */
.post-content .highlight .s { color: #a31515; } /* String */
.post-content .highlight .c { color: #008000; } /* Comment */
.post-content .highlight .n { color: #000000; } /* Name */
.post-content .highlight .o { color: #000000; } /* Operator */

/* ========================================
   Post Navigation
   ======================================== */

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

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.post-nav-item {
    display: flex;
    flex-direction: column;
}

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

.post-nav-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.post-nav-title {
    font-weight: 600;
    color: var(--link-color);
}

.post-nav-item:hover .post-nav-title {
    color: var(--link-hover);
}

/* ========================================
   Footer
   ======================================== */

.site-footer {
    background-color: var(--bg-light);
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.site-footer a {
    color: var(--text-light);
    text-decoration: underline;
}

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

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .site-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .post .post-title {
        font-size: 1.75rem;
    }
    
    .post-title {
        font-size: 1.5rem;
    }
    
    .post-nav {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .post-nav-next {
        text-align: left;
    }
    
    .pagination {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .site-header {
        padding: 1rem 0;
        margin-bottom: 2rem;
    }
    
    .post .post-title {
        font-size: 1.5rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
}

/* ========================================
   Archive Page
   ======================================== */

.archive-page {
    max-width: 100%;
}

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

.page-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.page-description {
    color: var(--text-light);
    font-size: 1rem;
}

.archive-content {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.archive-year {
    border-left: 3px solid var(--secondary-color);
    padding-left: 1.5rem;
}

.year-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.archive-month {
    margin-bottom: 2rem;
}

.month-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.archive-posts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.archive-post-item {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}

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

.archive-post-item .post-date {
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    font-family: "Consolas", "Monaco", monospace;
    min-width: 3rem;
}

.archive-post-item .post-link {
    flex-grow: 1;
    color: var(--text-color);
    font-weight: 500;
}

.archive-post-item .post-link:hover {
    color: var(--link-color);
}

.post-tags-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag-small {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background-color: var(--bg-light);
    border-radius: 2px;
    font-size: 0.75rem;
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

.tag-small:hover {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Archive page responsive */
@media (max-width: 768px) {
    .archive-year {
        padding-left: 1rem;
    }
    
    .year-title {
        font-size: 1.5rem;
    }
    
    .month-title {
        font-size: 1.1rem;
    }
    
    .archive-post-item {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .archive-post-item .post-date {
        min-width: auto;
    }
}

/* ========================================
   Tags Page
   ======================================== */

.tags-page {
    max-width: 100%;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 2rem;
    background-color: var(--bg-light);
    border-radius: 8px;
}

.tag-cloud-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag-cloud-item:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tag-cloud-item .tag-name {
    font-size: 1rem;
}

.tag-cloud-item .tag-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    background-color: var(--bg-light);
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-light);
}

.tag-cloud-item:hover .tag-count {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Tag size based on count */
.tag-cloud-item[data-count="1"],
.tag-cloud-item[data-count="2"] {
    font-size: 0.9rem;
}

.tag-cloud-item[data-count="3"],
.tag-cloud-item[data-count="4"],
.tag-cloud-item[data-count="5"] {
    font-size: 1rem;
}

.tag-cloud-item[data-count^="6"],
.tag-cloud-item[data-count^="7"],
.tag-cloud-item[data-count^="8"],
.tag-cloud-item[data-count^="9"] {
    font-size: 1.1rem;
}

.tags-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.tag-section {
    padding: 1.5rem;
    background-color: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.tag-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.tag-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.tag-title a {
    color: var(--primary-color);
}

.tag-title a:hover {
    color: var(--secondary-color);
}

.tag-count-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.tag-posts-preview {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tag-post-item {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem;
    background-color: white;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.tag-post-item:hover {
    background-color: var(--bg-light);
}

.tag-post-item .post-date {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-light);
    font-family: "Consolas", "Monaco", monospace;
    min-width: 6rem;
}

.tag-post-item .post-link {
    flex-grow: 1;
    color: var(--text-color);
    font-weight: 500;
}

.tag-post-item .post-link:hover {
    color: var(--link-color);
}

.tag-post-more {
    padding: 0.5rem;
    text-align: center;
}

.tag-post-more a {
    color: var(--secondary-color);
    font-weight: 600;
}

.tag-post-more a:hover {
    color: var(--link-hover);
}

/* Tags page responsive */
@media (max-width: 768px) {
    .tags-cloud {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .tag-cloud-item {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .tag-section {
        padding: 1rem;
    }
    
    .tag-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .tag-title {
        font-size: 1.25rem;
    }
    
    .tag-post-item {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .tag-post-item .post-date {
        min-width: auto;
        font-size: 0.8rem;
    }
}
