/**
 * Blog Styles
 *
 * Styles for blog list and single post templates.
 * Optimized for content discovery and reading experience.
 */

/* ============================================
   BLOG LIST PAGE
   ============================================ */

.blog-container {
    max-width: var(--content-max-width, 1200px);
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
}

.blog-header {
    margin-bottom: var(--space-12);
    padding: var(--space-8) 0;
    text-align: center;
}

.blog-header h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
}

.blog-description {
    font-size: var(--text-lg);
    color: var(--color-text-primary-muted);
    max-width: 600px;
    margin: 0 auto;
}

.blog-count {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

/* Blog Section Titles */
.blog-section-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-border);
}

/* Featured Posts Section */
.blog-featured {
    margin-bottom: var(--space-12);
}

.blog-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-6);
}

@media (max-width: 640px) {
    .blog-featured-grid {
        grid-template-columns: 1fr;
    }
}

/* Blog Post List */
.blog-posts {
    margin-bottom: var(--space-12);
}

.blog-post-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Blog Post Cards */
.blog-post-card,
.blog-featured-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--elevation-card);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.blog-post-card:hover,
.blog-featured-card:hover {
    box-shadow: var(--elevation-high);
    transform: translateY(-2px);
}

/* Horizontal layout for list items */
.blog-post-card {
    flex-direction: row;
}

@media (max-width: 768px) {
    .blog-post-card {
        flex-direction: column;
    }
}

/* Blog Card Image */
.blog-card-image {
    position: relative;
    overflow: hidden;
    background: var(--color-bg-secondary);
}

.blog-featured-card .blog-card-image {
    aspect-ratio: 16 / 9;
}

.blog-post-card .blog-card-image {
    flex: 0 0 280px;
    min-height: 200px;
}

@media (max-width: 768px) {
    .blog-post-card .blog-card-image {
        flex: none;
        aspect-ratio: 16 / 9;
    }
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-post-card:hover .blog-card-image img,
.blog-featured-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-image a {
    display: block;
    height: 100%;
}

/* Blog Card Content */
.blog-card-content {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex: 1;
}

.blog-card-title {
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.blog-card-title a {
    color: var(--color-text-primary);
    text-decoration: none;
}

.blog-card-title a:hover {
    color: var(--color-primary);
}

.blog-card-excerpt {
    font-size: var(--text-base);
    color: var(--color-text-primary-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Blog Card Metadata */
.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
    margin-top: auto;
}

.blog-author {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
    color: var(--color-text-primary);
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.reading-time {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Blog Tags */
.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.blog-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary-muted);
    text-decoration: none;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    transition: all 0.2s ease;
}

.blog-tag:hover {
    background: var(--color-primary);
    color: white;
}

/* Read More Link */
.blog-read-more {
    display: inline-block;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--text-sm);
}

.blog-read-more:hover {
    text-decoration: underline;
}

/* Empty State */
.blog-empty {
    text-align: center;
    padding: var(--space-12);
    color: var(--color-text-primary-muted);
}

/* ============================================
   BLOG SINGLE POST PAGE
   ============================================ */

.blog-post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
}

.blog-post-layout.blog-with-toc {
    grid-template-columns: minmax(0, 1fr) 260px;
    max-width: 1200px;
}

@media (max-width: 1024px) {
    .blog-post-layout.blog-with-toc {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        display: none;
    }
}

/* Blog Post Header */
.blog-post-header {
    margin-bottom: var(--space-8);
}

.blog-post-image {
    margin: 0 0 var(--space-8) 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.blog-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-post-header h1 {
    margin-bottom: var(--space-4);
}

.blog-post-header .lead {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    padding-bottom: var(--space-6);
    margin-bottom: 0;
    border-bottom: 1px solid var(--color-border);
}

/* Blog Post Metadata */
.blog-post-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    margin: var(--space-6) 0;
}

.blog-post-author {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.blog-post-author .author-avatar {
    width: 48px;
    height: 48px;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-title {
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.blog-post-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.blog-post-details > * {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Blog Post Tags */
.blog-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* Blog Post Content */
.blog-post-content {
    margin: var(--space-8) 0;
}

/* Blog Post Footer */
.blog-post-footer {
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 2px solid var(--color-border);
}

.blog-updated {
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

/* Author Bio */
.author-bio {
    padding: var(--space-6);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    margin: var(--space-8) 0;
}

.author-bio-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.author-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.author-bio h3 {
    margin: 0;
    font-size: var(--text-lg);
}

.author-bio-text {
    line-height: 1.6;
    margin: 0;
}

.author-links {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.author-links a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: var(--text-sm);
}

.author-links a:hover {
    text-decoration: underline;
}

/* Social Sharing */
.blog-social-share {
    margin: var(--space-8) 0;
}

.blog-social-share h4 {
    font-size: var(--text-base);
    margin-bottom: var(--space-3);
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.share-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.share-button:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
}

.share-button svg {
    flex-shrink: 0;
}

/* Blog Sidebar */
.blog-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Newsletter CTA */
.newsletter-cta {
    padding: var(--space-6);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.newsletter-cta h3 {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--text-lg);
}

.newsletter-cta p {
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.newsletter-form input {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.newsletter-form button {
    padding: 0.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
}

.newsletter-form button:hover {
    background: var(--color-primary-hover);
}

/* Comments Section */
.comments-section {
    margin-top: var(--space-12);
    padding: var(--space-8) 0;
    background: var(--color-bg-secondary);
}

.comments-section h2 {
    text-align: center;
    margin-bottom: var(--space-8);
}

.comments-placeholder {
    text-align: center;
    color: var(--color-text-primary-muted);
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .blog-post-header,
    .blog-post-footer {
        padding: var(--space-4) 0;
    }

    .blog-post-header .lead {
        font-size: var(--text-base);
        padding-bottom: var(--space-4);
    }

    .blog-card-content {
        padding: var(--space-4);
    }
}
