/*
================================================================================
BLOG V2 - PROFESSIONAL BLOG DESIGN
================================================================================
Inspired by: ClickUp, HubSpot, Medium, Substack
Features:
- Reading progress bar
- Featured hero post
- Sticky category navigation
- Grid/List view toggle
- Sticky sidebar with widgets
- Dark mode support
- Sticky newsletter footer
- Author bio cards
================================================================================
*/

/* CSS Variables for theming */
:root {
    /* Light theme (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --text-primary: #1a1a2e;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --accent-color: #c41e3a;
    --accent-hover: #9a1830;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;
    --border-color: #2d3748;
    --accent-color: #e63946;
    --accent-hover: #c41e3a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

/* Base styles */
.blog-v2-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), #d4af37);
    z-index: 10000;
    width: 0%;
    transition: width 0.1s ease;
}

/* Header */
.blog-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.blog-header .main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.nav-center {
    flex: 1;
    text-align: center;
}

.nav-blog-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
}

/* Category Navigation */
.category-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 70px;
    z-index: 99;
    padding: 0.75rem 0;
}

.category-list {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-list::-webkit-scrollbar {
    display: none;
}

.category-link {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.category-link:hover,
.category-link.active {
    background: var(--accent-color);
    color: white;
}

/* Hero Featured Post */
.hero-featured {
    padding: 3rem 0;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.featured-post {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
    align-items: center;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.featured-image {
    position: relative;
    height: 100%;
    min-height: 400px;
}

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

.featured-badge {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: var(--accent-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.featured-content {
    padding: 2.5rem;
}

.post-meta-top {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.post-category {
    color: var(--accent-color);
    font-weight: 600;
}

.post-date {
    color: var(--text-muted);
}

.featured-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

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

.featured-title a:hover {
    color: var(--accent-color);
}

.featured-excerpt {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

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

.author-name {
    font-weight: 600;
    color: var(--text-primary);
}

.read-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Blog Layout */
.blog-container {
    padding: 3rem 0;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
}

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

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
}

.view-options {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn:hover,
.view-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.posts-grid.list-view {
    grid-template-columns: 1fr;
}

.posts-grid.list-view .post-card {
    display: grid;
    grid-template-columns: 240px 1fr;
}

.post-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.post-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-card-image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

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

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

.post-card-content {
    padding: 1.5rem;
}

.post-card-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.post-card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.post-card-excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.read-more {
    color: var(--accent-color);
    font-weight: 600;
}

/* Load More */
.load-more-wrapper {
    text-align: center;
    margin-top: 3rem;
}

.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1rem 2rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load-more:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Sidebar */
.blog-sidebar {
    position: sticky;
    top: 140px;
    height: fit-content;
}

.sidebar-widget {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.sidebar-widget h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* About Widget */
.about-widget p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.btn-secondary {
    display: inline-block;
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
}

.btn-secondary:hover {
    text-decoration: underline;
}

/* Popular Posts */
.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-list li {
    margin-bottom: 0.75rem;
}

.popular-list a {
    display: flex;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-primary);
    align-items: flex-start;
}

.popular-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--border-color);
    line-height: 1;
    min-width: 30px;
}

.popular-title {
    font-size: 0.95rem;
    line-height: 1.4;
}

.popular-list a:hover .popular-title {
    color: var(--accent-color);
}

/* Tags Widget */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

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

/* Newsletter Widget */
.newsletter-widget p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.sidebar-newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-newsletter-form input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* Sticky Newsletter Footer */
.sticky-newsletter {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    z-index: 98;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.sticky-newsletter.visible {
    transform: translateY(0);
}

.sticky-newsletter.hidden {
    display: none;
}

.sticky-newsletter-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.sticky-text {
    display: flex;
    flex-direction: column;
}

.sticky-text strong {
    color: var(--text-primary);
}

.sticky-text span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sticky-form {
    display: flex;
    gap: 0.75rem;
}

.sticky-form input {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    min-width: 250px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sticky-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.sticky-close:hover {
    color: var(--text-primary);
}

/* Footer */
.blog-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1.5rem;
    margin-bottom: 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-icon {
    font-size: 2rem;
}

.footer-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
}

.footer-tagline {
    color: var(--text-secondary);
}

.footer-links h4 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .featured-post {
        grid-template-columns: 1fr;
    }
    
    .featured-image {
        min-height: 250px;
    }
    
    .featured-title {
        font-size: 1.75rem;
    }
    
    .sticky-newsletter-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .sticky-form {
        width: 100%;
    }
    
    .sticky-form input {
        flex: 1;
        min-width: 0;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeInUp 0.5s ease forwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }
.post-card:nth-child(6) { animation-delay: 0.6s; }
