/* --- Blog Pages --- */

.blog-container {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.blog-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.blog-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* Blog grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    position: relative;
}
.blog-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue-500), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.blog-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}
.blog-card:hover::before {
    opacity: 1;
}

.blog-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.blog-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-body h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.blog-card-body p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

/* Blog meta */
.blog-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.blog-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.blog-meta svg {
    width: 16px; height: 16px;
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--blue-400);
    text-decoration: none;
    transition: all var(--transition);
}
.tag:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue-400);
}

.tags-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Blog post (single) */
.blog-post {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.blog-post h1 {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.2;
}

.blog-post-content {
    margin-top: 32px;
}

.blog-post-content h2 {
    font-size: 24px;
    margin-top: 40px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.blog-post-content h3 {
    font-size: 20px;
    margin-top: 32px;
    margin-bottom: 12px;
}

.blog-post-content p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.blog-post-content ul,
.blog-post-content ol {
    margin: 16px 0;
    padding-left: 24px;
}
.blog-post-content li {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.blog-post-content blockquote {
    margin: 24px 0;
    padding: 16px 24px;
    border-left: 3px solid var(--blue-500);
    background: rgba(59, 130, 246, 0.05);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.blog-post-content pre {
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
}
.blog-post-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--text-secondary);
}

.blog-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 24px 0;
}

.blog-post-content a {
    color: var(--blue-400);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.blog-post-content a:hover {
    color: var(--blue-500);
}

/* Search & Filter section */
.blog-search-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin-bottom: 32px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.search-form.has-tags {
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    transition: border-color 0.2s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-search {
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    transition: all 0.2s;
}
.btn-search:hover {
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.btn-clear {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-xs);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}
.btn-clear:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.tag-filter-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}
.tag-filter a {
    padding: 5px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}
.tag-filter a:hover,
.tag-filter a.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--blue-400);
}

.search-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: var(--radius-xs);
    margin-bottom: 16px;
    font-size: 13px;
}

/* No results */
.no-results {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 60px 24px;
    text-align: center;
}
.no-results h2 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 8px;
}
.no-results p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}
.pagination a,
.pagination span {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.pagination a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}
.pagination .current {
    background: var(--blue-600);
    color: #fff;
    border-color: var(--blue-600);
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    color: var(--blue-400);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}
.back-link:hover {
    color: var(--blue-500);
}

/* Blog post navigation bottom */
.blog-nav-bottom {
    margin-top: 36px;
}

/* Blog post code blocks */
.blog-post-content code {
    background: var(--bg-body);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.88em;
    color: var(--text-primary);
}

/* Blog post horizontal rule */
.blog-post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 30px 0;
}

/* Blog post strong text */
.blog-post-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Blog 404 error page */
.blog-error {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 60px 24px;
    text-align: center;
    margin-top: 40px;
}
.blog-error h1 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 12px;
}
.blog-error p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

/* Action button (shared) */
.btn-action {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
}
.btn-action:hover {
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

/* Read more link */
.read-more {
    display: inline-block;
    color: var(--blue-400);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s;
}
.read-more:hover {
    color: var(--blue-500);
}

@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
    .blog-post h1 {
        font-size: 28px;
    }
    .blog-post-content h2 {
        font-size: 20px;
    }
    .search-form {
        flex-direction: column;
    }
    .search-input {
        min-width: 100%;
    }
    .blog-container {
        padding: 20px 16px 40px;
    }
    .blog-post {
        padding: 20px 16px 40px;
    }
}
