/**
 * Blog Styles - House Fluent Inspections
 * Mobile-first responsive design
 */

/* ============================================
   BASE STYLES (320px+)
   ============================================ */

.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Blog Hero Section */
.blog-hero {
    background: linear-gradient(135deg, var(--midnight-blue) 0%, #0d2d4d 100%);
    color: white;
    padding: 140px 20px 40px; /* Extra top padding to account for fixed header */
    text-align: center;
    margin-bottom: 40px;
}

.blog-hero h1 {
    font-family: 'Domine', serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    line-height: 1.2;
    color: white;
}

.blog-hero p {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 32px 0;
    color: white;
    opacity: 1;
}

/* Hero Filters (inside blue hero section) */
.hero-filters {
    margin-top: 32px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    padding: 10px 16px;
    border: 2px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.category-btn:hover {
    border-color: var(--medium-sea-green);
    color: var(--medium-sea-green);
}

.category-btn.active {
    background: var(--medium-sea-green);
    border-color: var(--medium-sea-green);
    color: white;
    font-weight: 600;
}

.search-box {
    position: relative;
}

.search-input {
    font-family: 'Montserrat', sans-serif;
    width: 100%;
    padding: 12px 16px 12px 44px;
    font-size: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    transition: border-color 0.2s ease;
    min-height: 48px;
}

.search-input:focus {
    outline: none;
    border-color: var(--medium-sea-green);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

/* Article Card */
.article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

.article-card:active {
    transform: translateY(-2px);
}

.article-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio for mobile */
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    overflow: hidden;
}

.article-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.813rem;
    color: #6c757d;
}

.article-category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(55, 180, 74, 0.1);
    color: var(--medium-sea-green);
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.article-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-title {
    font-family: 'Domine', serif;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--midnight-blue);
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.article-excerpt {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.938rem;
    color: #495057;
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex: 1;
}

.article-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.article-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    color: #495057;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--midnight-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.article-read-time {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 40px 20px;
    display: none;
}

.loading-indicator.active {
    display: block;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--medium-sea-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.938rem;
    color: #6c757d;
    margin-top: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 16px;
}

.empty-state-title {
    font-family: 'Domine', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--midnight-blue);
    margin: 0 0 8px 0;
}

.empty-state-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    color: #6c757d;
    margin: 0;
}

/* ============================================
   ARTICLE PAGE STYLES
   ============================================ */

.article-hero {
    position: relative;
    width: 100%;
    height: 42.86vw; /* 21:9 aspect ratio */
    min-height: 350px; /* Minimum for mobile */
    background: linear-gradient(135deg, var(--midnight-blue) 0%, #0d2d4d 100%);
    overflow: hidden;
}

.article-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

.article-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.article-hero-content {
    color: white;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.article-hero-category {
    display: inline-block;
    padding: 6px 14px;
    background: var(--medium-sea-green);
    border-radius: 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.813rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    color: white;
}

.article-hero-title {
    font-family: 'Domine', serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    line-height: 1.2;
    color: white;
}

.article-hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    color: white;
    opacity: 1;
}

/* Article Content */
.article-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.article-body {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #212529;
}

.article-body h2 {
    font-family: 'Domine', serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--midnight-blue);
    margin: 40px 0 16px 0;
    line-height: 1.3;
}

.article-body h3 {
    font-family: 'Domine', serif;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--midnight-blue);
    margin: 32px 0 12px 0;
    line-height: 1.3;
}

.article-body p {
    margin: 0 0 20px 0;
}

.article-body ul,
.article-body ol {
    margin: 0 0 20px 0;
    padding-left: 24px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body a {
    color: var(--medium-sea-green);
    text-decoration: underline;
}

.article-body a:hover {
    color: #2a8f3a;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 24px 0;
}

.article-body blockquote {
    border-left: 4px solid var(--medium-sea-green);
    padding: 16px 20px;
    margin: 24px 0;
    background: #f8f9fa;
    font-style: italic;
}

/* Share Buttons */
.article-share {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    margin: 40px 0;
}

.share-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.938rem;
    font-weight: 600;
    color: var(--midnight-blue);
}

.share-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.share-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn:active {
    transform: scale(0.95);
}

.share-btn.facebook {
    background: #1877f2;
}

.share-btn.twitter {
    background: #1da1f2;
}

.share-btn.linkedin {
    background: #0a66c2;
}

/* Author Bio */
.author-bio {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin: 40px 0;
}

.author-bio-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.author-bio-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--midnight-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Domine', serif;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.author-bio-info h3 {
    font-family: 'Domine', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--midnight-blue);
    margin: 0 0 4px 0;
}

.author-bio-info p {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}

.author-bio-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.938rem;
    line-height: 1.6;
    color: #495057;
    margin: 0;
}

.author-bio-text:empty {
    display: none;
}

/* Related Articles */
.related-articles {
    padding: 60px 20px;
    background: #f8f9fa;
}

.related-articles-title {
    font-family: 'Domine', serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--midnight-blue);
    text-align: center;
    margin: 0 0 32px 0;
}

.related-articles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Back Button */
.back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.938rem;
    color: var(--medium-sea-green);
    text-decoration: none;
    margin-bottom: 24px;
    transition: gap 0.2s ease;
}

.back-to-blog:hover {
    gap: 12px;
}

/* ============================================
   TABLET (768px+)
   ============================================ */

@media (min-width: 768px) {
    .blog-hero {
        padding: 150px 40px 50px; /* Extra top padding for fixed header */
    }

    .blog-hero h1 {
        font-size: 2.5rem;
    }

    .blog-hero p {
        font-size: 1.125rem;
    }

    .hero-filters {
        margin-top: 40px;
    }

    .filter-group {
        margin-bottom: 24px;
    }

    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }

    .article-image-wrapper {
        padding-bottom: 56.25%; /* Keep 16:9 for tablet */
    }

    .article-title {
        font-size: 1.5rem;
    }

    .article-hero {
        height: 42.86vw; /* 21:9 aspect ratio */
        min-height: 400px;
    }

    .article-hero-overlay {
        padding: 40px;
    }

    .article-hero-title {
        font-size: 2.5rem;
    }

    .article-hero-meta {
        font-size: 1rem;
    }

    .article-main {
        padding: 60px 40px;
    }

    .article-body {
        font-size: 1.063rem;
    }

    .article-body h2 {
        font-size: 2rem;
    }

    .article-body h3 {
        font-size: 1.5rem;
    }

    .related-articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   DESKTOP (1024px+)
   ============================================ */

@media (min-width: 1024px) {
    .blog-hero {
        padding: 160px 40px 60px; /* Extra top padding for fixed header */
    }

    .blog-hero h1 {
        font-size: 3rem;
    }

    .blog-hero p {
        font-size: 1.25rem;
    }

    .hero-filters {
        display: flex;
        align-items: flex-end;
        gap: 32px;
        margin-top: 48px;
    }

    .filter-group {
        margin-bottom: 0;
    }

    .filter-group.search {
        flex: 1;
    }

    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }

    .article-image-wrapper {
        padding-bottom: 42.857%; /* 21:9 aspect ratio for desktop */
    }

    .article-hero {
        height: 42.86vw; /* 21:9 aspect ratio */
        min-height: 450px;
        max-height: 800px; /* Cap at reasonable size for large screens */
    }

    .article-hero-title {
        font-size: 3rem;
    }

    .article-share {
        justify-content: center;
    }

    .related-articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   PREVIEW MODAL
   ============================================ */

.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.preview-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

.preview-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 28px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.preview-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.preview-modal-body {
    padding: 0;
}

.preview-modal-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.preview-modal-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 0 24px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.813rem;
    color: #6c757d;
}

.preview-modal-category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(55, 180, 74, 0.1);
    color: var(--medium-sea-green);
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-modal-date {
    display: flex;
    align-items: center;
}

.preview-modal-title {
    font-family: 'Domine', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--midnight-blue);
    margin: 16px 24px;
    line-height: 1.3;
}

.preview-modal-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.938rem;
    line-height: 1.7;
    color: #495057;
    padding: 0 24px;
    margin-bottom: 20px;
}

.preview-modal-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-top: 1px solid #e9ecef;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
}

.preview-modal-author {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #495057;
}

.preview-modal-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--midnight-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.preview-modal-read-time {
    color: #6c757d;
}

.preview-modal-actions {
    padding: 0 24px 24px 24px;
    display: flex;
    justify-content: center;
}

.preview-modal-actions .btn {
    width: 100%;
    max-width: 300px;
}

/* Preview Button on Cards */
.article-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.btn-preview {
    flex: 1;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    padding: 10px 16px;
    border: 2px solid var(--medium-sea-green);
    background: white;
    color: var(--medium-sea-green);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-preview:hover {
    background: var(--medium-sea-green);
    color: white;
}

/* ============================================
   LARGE DESKTOP (1200px+)
   ============================================ */

@media (min-width: 1200px) {
    .blog-container {
        padding: 0 40px;
    }

    .article-title {
        font-size: 1.625rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .blog-hero,
    .blog-filters,
    .article-share,
    .related-articles,
    .back-to-blog {
        display: none;
    }

    .article-body {
        font-size: 12pt;
        line-height: 1.6;
    }

    .article-body a {
        color: #000;
        text-decoration: underline;
    }
}
