/* Blog Article Styles - Modern Technical Blog */

/* ============================================
   READING PROGRESS BAR
   ============================================ */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--terminal-green), var(--tech-cyan));
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* ============================================
   ARTICLE LAYOUT
   ============================================ */
.article-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

@media (min-width: 1200px) {
    .article-container {
        grid-template-columns: 220px 1fr;
        max-width: 1100px;
    }
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */
.toc-sidebar {
    display: none;
}

@media (min-width: 1200px) {
    .toc-sidebar {
        display: block;
        position: sticky;
        top: 100px;
        height: fit-content;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        padding-right: 1rem;
    }
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-link {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.375rem 0;
    padding-left: 0.75rem;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.toc-link:hover {
    color: var(--text-primary);
    border-left-color: var(--border-tech);
}

.toc-link.active {
    color: var(--terminal-green);
    border-left-color: var(--terminal-green);
}

/* Mobile TOC */
.toc-mobile {
    display: block;
    margin-bottom: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 8px;
    overflow: hidden;
}

@media (min-width: 1200px) {
    .toc-mobile {
        display: none;
    }
}

.toc-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    background: var(--bg-card);
    border: none;
    width: 100%;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.toc-mobile-header:hover {
    background: var(--bg-card-hover);
}

.toc-mobile-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--bg-darker);
}

.toc-mobile-content.open {
    max-height: 500px;
}

.toc-mobile-content .toc-list {
    padding: 0.5rem 1.25rem 1rem;
}

/* ============================================
   ARTICLE HEADER
   ============================================ */
.article-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-tech);
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.article-category {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--callout-tip-bg);
    color: var(--terminal-green);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .article-title {
        font-size: 3rem;
    }
}

.article-excerpt {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 2rem;
}

/* Author Card */
.author-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--terminal-green), var(--tech-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--bg-dark);
}

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

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

.author-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   ARTICLE CONTENT
   ============================================ */
.article-content {
    font-size: 1.0625rem;
    line-height: 1.85;
    color: var(--text-primary);
}

.article-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    scroll-margin-top: 100px;
}

.article-content h3 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    scroll-margin-top: 100px;
}

.article-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

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

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

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

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   CALLOUT BOXES
   ============================================ */
.callout {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.callout-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.5rem;
}

.callout-content {
    font-size: 0.95rem;
    line-height: 1.65;
}

.callout-content p:last-child {
    margin-bottom: 0;
}

/* Note */
.callout-note {
    background: var(--callout-note-bg);
    border-left-color: var(--callout-note-border);
}

.callout-note .callout-title {
    color: var(--callout-note-border);
}

/* Tip */
.callout-tip {
    background: var(--callout-tip-bg);
    border-left-color: var(--callout-tip-border);
}

.callout-tip .callout-title {
    color: var(--callout-tip-border);
}

/* Warning */
.callout-warning {
    background: var(--callout-warning-bg);
    border-left-color: var(--callout-warning-border);
}

.callout-warning .callout-title {
    color: var(--callout-warning-border);
}

/* Caution / Danger */
.callout-caution {
    background: var(--callout-caution-bg);
    border-left-color: var(--callout-caution-border);
}

.callout-caution .callout-title {
    color: var(--callout-caution-border);
}

/* ============================================
   CODE BLOCKS
   ============================================ */
.article-content code {
    background: var(--bg-code);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.875em;
    color: var(--tech-cyan);
    border: 1px solid var(--border-subtle);
}

.article-content pre {
    background: var(--bg-code);
    border: 1px solid var(--border-tech);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
}

.article-content pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--border-subtle);
    border-bottom: 1px solid var(--border-tech);
    border-radius: 8px 8px 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   FIGURES & IMAGES
   ============================================ */
.article-content figure {
    margin: 2rem 0;
}

.article-content figure img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-tech);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-content figure img:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.article-content figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    font-style: italic;
}

/* ============================================
   TABLES
   ============================================ */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.article-content thead {
    background: var(--bg-card);
}

.article-content th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--terminal-green);
    border-bottom: 2px solid var(--border-tech);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-content td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.article-content tbody tr:hover {
    background: var(--bg-card-hover);
}

/* ============================================
   ARTICLE FOOTER
   ============================================ */
.article-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-tech);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.article-tag {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.2s ease;
}

.article-tag:hover {
    background: var(--bg-card-hover);
    color: var(--terminal-green);
    border-color: var(--terminal-green);
}

/* Share Section */
.share-section {
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.share-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-tech);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.share-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ============================================
   RELATED ARTICLES
   ============================================ */
.related-articles {
    margin-top: 3rem;
}

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

.related-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.related-card {
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.related-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

.related-card-category {
    font-size: 0.7rem;
    color: var(--terminal-green);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.related-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.related-card-title a {
    color: inherit;
    text-decoration: none;
}

.related-card-title a:hover {
    color: var(--terminal-green);
}

/* ============================================
   FILTER BUTTONS (Blog listing)
   ============================================ */
.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.filter-btn.active {
    background: var(--terminal-green);
    color: var(--bg-dark);
    border-color: var(--terminal-green);
    font-weight: 500;
}

/* ============================================
   BLOG CARDS (Listing page)
   ============================================ */
.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.blog-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.blog-card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-tech);
    transition: transform 0.4s ease;
}

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

.blog-card-content {
    padding: 1.5rem;
}

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

.blog-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.blog-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-card-title a:hover {
    color: var(--terminal-green);
}

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

/* Featured Post */
.featured-post {
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 3rem;
}

.featured-post-inner {
    display: grid;
    gap: 2rem;
}

@media (min-width: 768px) {
    .featured-post-inner {
        grid-template-columns: 1fr 1fr;
    }
}

.featured-post-image {
    height: 300px;
    background: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

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

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

.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: var(--callout-tip-bg);
    color: var(--terminal-green);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    width: fit-content;
}

.featured-post-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.featured-post-excerpt {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

/* ============================================
   FEATURED GRID (Top 3 Articles)
   ============================================ */
.featured-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .featured-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

.featured-card {
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.featured-card:hover {
    border-color: var(--terminal-green);
    transform: translateY(-2px);
}

.featured-card-image {
    display: block;
    height: 140px;
    overflow: hidden;
}

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

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

.featured-card-content {
    padding: 1rem;
}

.featured-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.featured-card-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--terminal-green);
    letter-spacing: 0.03em;
}

.featured-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.featured-card-date::before {
    content: "•";
    margin-right: 0.5rem;
    color: var(--border-tech);
}

.featured-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.featured-card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.featured-card-title a:hover {
    color: var(--terminal-green);
}

.featured-card-excerpt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Main featured card (first one) - slightly larger */
@media (min-width: 768px) {
    .featured-card-main .featured-card-image {
        height: 160px;
    }
}

/* ============================================
   UNIFIED BLOG GRID (Main Display)
   ============================================ */
.blog-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.blog-grid-card {
    background: var(--bg-card);
    border: 1px solid var(--border-tech);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}

.blog-grid-card:hover {
    border-color: var(--terminal-green);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.blog-grid-card-image {
    display: block;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--bg-darker);
}

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

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

.blog-grid-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.blog-grid-card-placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

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

.blog-grid-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.blog-grid-card-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--terminal-green);
    letter-spacing: 0.03em;
}

.blog-grid-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.blog-grid-card-date::before {
    content: "•";
    margin-right: 0.5rem;
    color: var(--border-tech);
}

.blog-grid-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.75rem 0;
}

.blog-grid-card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-grid-card-title a:hover {
    color: var(--terminal-green);
}

.blog-grid-card-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.blog-grid-card-readtime {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.blog-grid-card-readtime svg {
    width: 14px;
    height: 14px;
}