/* Modern Blog Page Styles - App-like Design */

/* CSS Custom Properties for consistent theming */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    margin-top: 40px;
    margin-bottom: 60px;
}

/* Featured Post Section */
.blog-featured-post {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 60px 0;
    margin-bottom: 20px;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.featured-post__content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.featured-post__image {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.featured-post__image:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.featured-post__img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    transition: var(--transition);
}

.featured-post__no-image {
    display: block;
    width: 100%;
    height: 400px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
}

.featured-post__placeholder {
    text-align: center;
}

.featured-post__text {
    padding: 20px 0;
}

.featured-post__meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.featured-post__date {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.featured-post__category {
    background: var(--accent-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.featured-post__title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.featured-post__title a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.featured-post__title a:hover {
    color: var(--primary-color);
}

.featured-post__excerpt {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.featured-post__footer {
    margin-top: 30px;
}

/* Posts Grid */
.posts-grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

/* Post Cards */
.post-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.post-card__image {
    position: relative;
    overflow: hidden;
    height: 220px;
}

.post-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .post-card__img {
    transform: scale(1.05);
}

.post-card__no-image {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
}

.post-card__placeholder {
    text-align: center;
}

.post-card__content {
    padding: 24px;
}

.post-card__meta {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 13px;
}

.post-card__date {
    color: var(--text-muted);
    font-weight: 500;
}

.post-card__category {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.post-card__title a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.post-card__title a:hover {
    color: var(--primary-color);
}

.post-card__excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 14px;
}

.post-card__footer {
    display: flex;
    justify-content: flex-end;
}

.post-card__read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.post-card__read-more:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.post-card__read-more::after {
    content: '→';
    transition: var(--transition);
}

.post-card__read-more:hover::after {
    transform: translateX(3px);
}

/* When the read-more link uses the global pill CTA classes, apply the same
   gradient, pill radius and shadow so it visually matches site CTAs. */
.post-card__read-more.btn-cta {
    background: linear-gradient(90deg, #3B82F6, #2563EB);
    color: #fff;
    padding: 10px 22px;
    border: none;
    border-radius: 9999px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.post-card__read-more.btn-cta:hover {
    transform: translateY(-2px) scale(1.03);
    background: linear-gradient(90deg, #2563EB, #3B82F6);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
    color: #fff;
}

.post-card__read-more.btn-cta::after {
    content: '→';
    transition: var(--transition);
    margin-left: 6px;
}

/* Ensure any .btn-cta used in the blog area keeps the pill appearance
   even if generic .btn rules are present later. This targets both
   read-more variants and the featured post CTA. */
.btn.btn-cta,
.btn-cta {
    border-radius: 9999px !important;
    background: linear-gradient(90deg, #3B82F6, #2563EB) !important;
    color: #fff !important;
    padding: 12px 28px !important;
    border: none !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.featured-post__footer .btn.btn-cta {
    min-width: 220px;
}

/* Load More Button */
#load-more-posts {
    align-self: center;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

#load-more-posts.loading {
    pointer-events: none;
    opacity: 0.7;
}

#load-more-posts.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sidebar */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar-widget {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent-color);
}

/* Recent Posts Widget */
.recent-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-post-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.recent-post-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.recent-post-link {
    display: flex;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.recent-post-link:hover {
    color: var(--primary-color);
}

.recent-post-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.recent-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-post-content {
    flex: 1;
    min-width: 0;
}

.recent-post-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Standard property for newer browsers / linters */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-post-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* Categories Widget */
.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    margin-bottom: 8px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: var(--transition);
    font-size: 14px;
}

.category-link:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.category-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Tags Widget */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-link {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.tag-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn--primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn--primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .blog-sidebar {
        order: -1;
    }
    
    .featured-post__content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .featured-post__title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .blog-featured-post {
        padding: 40px 0;
        margin: 0 -16px 20px;
        border-radius: 0;
    }
    
    .featured-post__title {
        font-size: 1.75rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .post-card__content {
        padding: 20px;
    }
    
    .sidebar-widget {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .featured-post__title {
        font-size: 1.5rem;
    }
    
    .featured-post__excerpt {
        font-size: 1rem;
    }
    
    .post-card__content {
        padding: 16px;
    }
    
    .post-card__title {
        font-size: 1.1rem;
    }
    
    .sidebar-widget {
        padding: 16px;
    }
}

/* Loading States and Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.post-card:focus-within,
.btn:focus,
.tag-link:focus,
.category-link:focus,
.recent-post-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
        --bg-secondary: #ffffff;
    }
}

