/* Enhanced Blog Styles - Twisthand Design System Compliant */

/* Using design system variables from site.css - DO NOT REDEFINE */
/* Available variables:
   --navy: #0f1f33;
   --blue: #2563eb;
   --gold: #d69e2e;
   --green: #38a169;
   --text: #2a3245;
   --text-light: #4a5568;
   --bg: #ffffff;
   --bg-subtle: #f7fafc;
*/

/* Blog-specific custom properties only */
:root {
    --border: rgba(15, 31, 51, 0.08);
    --shadow-sm: 0 2px 4px rgba(15, 31, 51, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 31, 51, 0.1);
    --shadow-lg: 0 10px 25px rgba(15, 31, 51, 0.15);
}

/* Blog Hero Section */
.blog-hero {
    text-align: center;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.blog-hero h1 {
    margin-bottom: 1rem;
    font-size: 3.5rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: var(--navy);
}

.blog-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Search Bar */
.blog-search {
    max-width: 500px;
    margin: 2rem auto 0;
    position: relative;
    display: flex;
    box-shadow: var(--shadow-md);
    border-radius: 50px;
    overflow: hidden;
    background: var(--bg);
}

.blog-search input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    outline: none;
}

.blog-search button {
    padding: 0 1.5rem;
    background: var(--blue);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.blog-search button:hover {
    background: var(--navy);
}

/* Category Filters */
.blog-filters {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.filter-btn.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

/* Featured Post Section */
.featured-post-section {
    margin: 3rem 0;
}

.section-title {
    font-size: 1.25rem;
    color: var(--navy);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.featured-post {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s;
}

.featured-post:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.featured-post-image {
    position: relative;
    background: var(--bg-subtle);
    min-height: 250px;
}

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

.featured-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--blue);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.featured-post-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-post-meta {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.featured-post h2 {
    font-size: 1.75rem;
    margin: 0.5rem 0;
    line-height: 1.3;
}

.featured-post h2 a {
    color: var(--navy);
    text-decoration: none;
}

.featured-post h2 a:hover {
    color: var(--blue);
}

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

/* Main Layout */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 3rem;
    margin: 3rem 0;
}

.blog-main {
    min-width: 0;
}

/* Recently Viewed */
.recently-viewed {
    background: var(--bg-subtle);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.recently-viewed h3 {
    font-size: 1rem;
    color: var(--navy);
    margin-bottom: 1rem;
}

.recent-posts-mini {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
}

.recent-post-mini {
    min-width: 200px;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* Enhanced Blog Card */
.blog-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

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

.blog-card-image {
    width: 100%;
    height: 200px;
    background: var(--bg-subtle);
    position: relative;
    overflow: hidden;
}

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

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

.blog-card-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(30, 64, 175, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.blog-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-subtle);
}

.blog-card h2 {
    font-size: 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    margin: 0.5rem 0;
    line-height: 1.4;
}

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

.blog-card h2 a:hover {
    color: var(--blue);
}

.blog-card-excerpt {
    color: var(--text);
    line-height: 1.6;
    margin: 0.75rem 0;
    flex: 1;
}

.blog-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

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

.view-count {
    font-size: 0.875rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Skeleton Loaders */
.skeleton-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.skeleton {
    animation: skeleton-loading 1.5s infinite;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

.skeleton-image {
    height: 200px;
}

.skeleton-text {
    height: 14px;
    margin: 1.5rem 1.5rem 0.75rem;
    width: 30%;
}

.skeleton-title {
    height: 24px;
    margin: 0.75rem 1.5rem;
    width: 80%;
}

.skeleton-excerpt {
    height: 14px;
    margin: 0.75rem 1.5rem;
    width: 90%;
}

.skeleton-meta {
    height: 14px;
    margin: 1rem 1.5rem 1.5rem;
    width: 40%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

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

.sidebar-widget h3 {
    font-size: 1.125rem;
    color: var(--navy);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Archive Widget */
.archive-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    font-size: 1.125rem;
    color: var(--navy);
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.archive-toggle .chevron {
    transition: transform 0.3s;
}

.archive-toggle[aria-expanded="false"] .chevron {
    transform: rotate(-90deg);
}

.archive-content {
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.archive-content.collapsed {
    display: none;
}

.archive-year {
    margin-bottom: 1rem;
}

.archive-year-title {
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.archive-months {
    padding-left: 1rem;
}

.archive-month {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.archive-month:hover {
    color: var(--blue);
}

.archive-count {
    background: var(--bg-subtle);
    padding: 0 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Popular Posts Widget */
.popular-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.popular-post {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.popular-post:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.popular-post-image {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    background: var(--bg-subtle);
    flex-shrink: 0;
}

.popular-post-content {
    flex: 1;
}

.popular-post-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.popular-post-title a {
    color: var(--navy);
    text-decoration: none;
}

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

.popular-post-views {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Newsletter Widget */
.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.newsletter-form input {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}

.newsletter-form .cta-button {
    padding: 0.75rem;
    font-size: 0.875rem;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.newsletter-form .cta-button:hover {
    background: var(--navy);
}

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

.tag-btn {
    padding: 0.375rem 0.75rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8125rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
}

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

/* Load More Button */
.load-more-container {
    text-align: center;
    margin: 3rem 0;
}

.load-more-btn {
    padding: 1rem 2rem;
    background: var(--bg);
    border: 2px solid var(--blue);
    border-radius: 30px;
    color: var(--blue);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-subtle);
    border-radius: 12px;
}

.no-results h3 {
    color: var(--navy);
    margin-bottom: 0.5rem;
}

/* Reading Progress Bar (for individual posts) */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(30, 64, 175, 0.1);
    z-index: 1000;
}

.reading-progress-bar {
    height: 100%;
    background: var(--blue);
    width: 0;
    transition: width 0.1s;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
    
    .blog-sidebar {
        position: static;
        order: -1;
    }
    
    .featured-post {
        grid-template-columns: 1fr;
    }
    
    .featured-post-image {
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .blog-hero h1 {
        font-size: 2rem;
    }
    
    .blog-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 1rem;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .featured-post-content {
        padding: 1.5rem;
    }
    
    .featured-post h2 {
        font-size: 1.5rem;
    }
}

/* Animations */
.whisper {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s, transform 0.5s;
}

.whisper.visible {
    opacity: 1;
    transform: translateY(0);
}

.whisper-delay-1 {
    transition-delay: 0.1s;
}

.whisper-delay-2 {
    transition-delay: 0.2s;
}

.whisper-delay-3 {
    transition-delay: 0.3s;
}