/* 
===========================================
REUSABLE BLOG ARTICLE CSS 
Save this as: assets/css/blog-article.css
===========================================
*/

/* Your exact main.css theme variables */
:root {
    --blue: #2563eb;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --border: var(--gray-200);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    line-height: 1.58;
    color: var(--text-primary);
    background: var(--white);
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigation */
.article-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-home {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.nav-home:hover {
    color: var(--blue);
}

/* Article Container - Better width utilization */
.article-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 3rem 4rem;
}

/* Article Header */
.article-header {
    margin-bottom: 3rem;
}

.article-meta-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.article-category {
    background: var(--blue);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-date {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.article-title {
    font-family: var(--font-sans);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.article-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 2rem;
    font-weight: 400;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

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

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

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

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

.author-title {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.article-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Article Content - Medium-style typography */
.article-content {
    margin-bottom: 4rem;
}

.article-content p {
    margin: 1.5rem 0;
    line-height: 1.58;
    color: var(--text-primary);
}

.article-content h2 {
    font-family: var(--font-sans);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin: 2.5rem 0 1rem;
}

.article-content h3 {
    font-family: var(--font-sans);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.015em;
    margin: 2rem 0 1rem;
}

.article-content ol,
.article-content ul {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.article-content li {
    margin: 0.5rem 0;
    line-height: 1.58;
}

.execution-order {
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.execution-order li {
    font-weight: 500;
    color: var(--text-primary);
    padding: 0.25rem 0;
}

.problem-statement {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-left: 4px solid var(--blue);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

.article-content code {
    background: var(--gray-100);
    color: var(--blue);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9em;
}

.code-block {
    background: var(--gray-900);
    color: var(--gray-100);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-block code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Enhanced Images */
.article-image {
    margin: 2.5rem 0;
    text-align: center;
}

.article-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.article-image figcaption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    font-style: italic;
    text-align: center;
}

.article-content a {
    color: var(--blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.article-content a:hover {
    border-bottom-color: var(--blue);
}

/* Author Bio */
.author-bio {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 2rem;
    margin: 3rem 0;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

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

.author-bio-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.author-bio-content p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Enhanced Related Articles */
.related-articles {
    margin: 4rem 0;
    padding: 2rem 0;
    border-top: 1px solid var(--gray-200);
}

.related-header {
    text-align: center;
    margin-bottom: 2rem;
}

.related-articles h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.related-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.related-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.related-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--blue);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.related-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--blue);
}

.related-card:hover::before {
    transform: scaleX(1);
}

.related-card:hover .related-arrow {
    transform: translateX(3px);
}

.related-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.related-category {
    background: var(--blue);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.related-category.performance {
    background: #dc2626;
}

.related-category.fundamentals {
    background: #059669;
}

.related-time {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-weight: 500;
}

.related-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.related-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.related-views {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 500;
}

.related-arrow {
    color: var(--blue);
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.related-cta {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--white);
    color: var(--blue);
    border: 2px solid var(--blue);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.view-all-btn:hover {
    background: var(--blue);
    color: white;
    transform: translateY(-1px);
}

.view-all-btn .btn-icon {
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-container {
        padding: 1rem 2rem;
    }
    
    .article-container {
        padding: 5rem 2rem 3rem;
    }
    
    .related-articles {
        padding: 1.5rem 0;
    }
    
    .related-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }
    
    .article-container {
        padding: 5rem 1rem 3rem;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .article-stats {
        align-self: stretch;
        justify-content: space-between;
    }
    
    .author-bio {
        flex-direction: column;
        text-align: center;
    }
    
    .related-articles {
        padding: 1.5rem 0;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .related-articles h2 {
        font-size: 1.25rem;
    }
    
    .related-header p {
        font-size: 0.9rem;
    }
    
    body {
        font-size: 16px;
    }
    
    .article-title {
        font-size: 1.75rem;
    }
    
    .article-subtitle {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .article-container {
        padding: 4rem 1rem 2rem;
    }
    
    .article-meta-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .code-block {
        padding: 1rem;
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .article-nav,
    .related-articles {
        display: none;
    }
    
    .article-container {
        padding: 1rem 0;
        max-width: none;
    }
    
    .article-image img {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}