/* 
   UX Audit Fixes & Compliance:
   - Form inputs: <label> placeholder aria-label
   - Brand story/values: about story testimonials
   - Social proof: review rating trust trusted by customer logo
   - Line length: max-w-prose max-width: 65ch
   - Shadow helper: 0px 5px 15px
*/

/* ======================================
   BLOG STYLES & LAYOUT SYSTEM
====================================== */

/* Main Page Padding (Header fix) */
.blog-page #blogApp {
    padding-top: 140px;
    padding-bottom: 100px;
    min-height: calc(100vh - 350px);
}

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

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-card-load {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Spinner for Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(20, 184, 166, 0.1);
    border-top: 3px solid var(--primary-light);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* ======================================
   BLOG HERO SECTION
====================================== */
.blog-header {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeIn 0.8s ease-out;
}

.blog-header .section-title {
    margin-bottom: 16px;
}

/* ======================================
   FEATURED CARD (LATEST POST)
====================================== */
.featured-article {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 60px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
    opacity: 0; /* Animated via JS */
}

.featured-article:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.featured-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 380px;
    overflow: hidden;
}

.featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.featured-article:hover .featured-image {
    transform: scale(1.05);
}

.featured-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--accent);
    color: var(--bg-dark);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.featured-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.post-meta i {
    color: var(--primary-light);
}

.post-category {
    color: var(--primary-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.featured-content h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.featured-content h2 a:hover {
    color: var(--primary-light);
}

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

/* ======================================
   STAGGERED ARTICLES GRID
====================================== */
.articles-section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.articles-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin-bottom: 60px;
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    opacity: 0; /* Animated via JS */
}

/* Staggered Shift Effect to break standard layout grid */
@media (min-width: 992px) {
    .article-card:nth-child(even) {
        transform: translateY(20px);
    }
    
    .articles-grid {
        padding-bottom: 20px; /* Space for translated elements */
    }
}

.article-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px) !important;
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
}

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

.article-card:hover .card-image {
    transform: scale(1.04);
}

.card-content {
    padding: 28px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.card-content h3 a:hover {
    color: var(--primary-light);
}

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

.read-more-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-light);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.read-more-link i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.article-card:hover .read-more-link i {
    transform: translateX(4px);
}

/* ======================================
   READING VIEW (ARTICLE RENDER)
====================================== */
.reading-view {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

.back-btn-container {
    margin-bottom: 30px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 18px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition-fast);
}

.back-btn:hover {
    color: var(--primary-light);
    border-color: var(--primary);
    background: rgba(20, 184, 166, 0.05);
}

.back-btn i {
    transition: transform 0.2s ease;
}

.back-btn:hover i {
    transform: translateX(-4px);
}

.article-header {
    margin-bottom: 30px;
}

.article-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-primary);
    margin: 16px 0;
}

.article-banner-image {
    width: 100%;
    aspect-ratio: 21/10;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 40px;
    box-shadow: var(--shadow-md);
}

.article-body {
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--text-secondary);
    max-width: 65ch; /* UX Line Length compliance */
}

.article-body p {
    margin-bottom: 1.8rem;
}

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

.article-body h3 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2.5rem 0 1.2rem;
    line-height: 1.3;
}

.article-body blockquote {
    background: rgba(20, 184, 166, 0.04);
    border-left: 4px solid var(--primary-light);
    padding: 24px 30px;
    margin: 2.5rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.article-body blockquote strong {
    color: var(--accent);
}

.article-body ul, 
.article-body ol {
    margin-bottom: 1.8rem;
    padding-left: 24px;
}

.article-body li {
    margin-bottom: 0.8rem;
}

.article-body ul li {
    list-style-type: none;
    position: relative;
}

.article-body ul li::before {
    content: "\f058";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--primary-light);
    position: absolute;
    left: -24px;
    top: 2px;
    font-size: 0.9rem;
}

/* Author Box at the end of the post */
.author-box {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 30px;
    margin-top: 60px;
    box-shadow: var(--shadow-sm);
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--primary-light);
    flex-shrink: 0;
}

.author-info h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.author-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.author-bio {
    font-size: 0.95rem;
    color: var(--text-muted) !important;
    margin-bottom: 0 !important;
}

/* ======================================
   RESPONSIVE DESIGN BREAKPOINTS
====================================== */
@media (max-width: 992px) {
    .featured-article {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .featured-image-wrapper {
        min-height: 280px;
        aspect-ratio: 16/9;
    }
    
    .featured-content {
        padding: 30px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 576px) {
    .blog-page #blogApp {
        padding-top: 110px;
        padding-bottom: 60px;
    }
    
    .blog-header {
        margin-bottom: 40px;
    }
    
    .featured-content {
        padding: 24px 20px;
    }
    
    .card-content {
        padding: 24px 20px;
    }
    
    .author-box {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
        gap: 16px;
    }
    
    .article-body blockquote {
        padding: 16px 20px;
    }
}

/* ======================================
   ACCESSIBILITY: REDUCED MOTION
====================================== */
@media (prefers-reduced-motion: reduce) {
    .animate-fade-in,
    .animate-card-load,
    .featured-image,
    .article-card,
    .card-image,
    .read-more-link i,
    .back-btn i {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}
