/* Blog Page Styles */

/* Header */
.blog-header {
    padding: 80px 0 60px;
    text-align: center;
    background: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.15), transparent 50%);
}

.blog-header h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.blog-header p {
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Featured Post */
.featured-section {
    margin-bottom: 80px;
}

.featured-card {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.featured-image {
    height: 100%;
    min-height: 400px;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-card);
}

.featured-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.post-meta {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
}

.date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.featured-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.featured-content h2 a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}

.featured-content h2 a:hover {
    color: var(--primary);
}

.summary {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.featured-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author span {
    font-weight: 500;
    color: var(--text-main);
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    background: var(--primary);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: background 0.2s;
}

.read-more-btn:hover {
    background: var(--primary-hover);
    color: white;
    text-decoration: none;
}

/* Article Page Styles */
.article-container {
    padding-top: 40px;
}

.hero-image-wrapper {
    margin-bottom: 60px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.hero-image-wrapper img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.article-layout {
    max-width: 800px;
}

.article-body {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #e2e8f0;
    margin-bottom: 80px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.article-body h2 {
    font-size: 1.8rem;
    margin-top: 48px;
    margin-bottom: 24px;
    color: var(--text-main);
}

.article-body h3 {
    font-size: 1.4rem;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--text-main);
}

.article-body p {
    margin-bottom: 24px;
}

.article-body ul,
.article-body ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.article-body ul {
    list-style-type: disc;
}

.article-body ol {
    list-style-type: decimal;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #fca5a5;
    font-size: 0.9em;
}

.article-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 24px;
    margin: 32px 0;
    color: var(--text-muted);
    font-style: italic;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05), transparent);
    padding: 16px 24px;
    border-radius: 0 8px 8px 0;
}

/* Share Section */
.share-section {
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
    margin-top: 80px;
}

.share-section h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.share-buttons {
    display: flex;
    gap: 16px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.share-btn.linkedin {
    background: #0077b5;
    color: white;
}

.share-btn.twitter {
    background: #1da1f2;
    color: white;
}

.share-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Related Section */
.related-section {
    background: #0f1218;
    padding: 80px 0;
    border-top: 1px solid var(--border-color);
}

.related-section h2 {
    margin-bottom: 30px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.related-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.related-card:hover {
    border-color: var(--primary);
}

.related-image {
    width: 100px;
    height: 70px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.related-info h4 a:hover {
    color: var(--primary);
}

.related-info .meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Blog Feed Controls --- */
.blog-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.blog-controls h2 {
    font-size: 1.5rem;
    margin: 0;
}

.blog-search-wrapper {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
}

.search-input:focus {
    border-color: var(--primary);
    outline: none;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* --- Blog Grid --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 80px;
}

/* --- Blog Card --- */
.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.blog-card-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: var(--bg-body);
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-header {
    margin-bottom: 12px;
}

.blog-card .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.blog-card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    line-height: 1.4;
    font-weight: 700;
}

.blog-card h3 a {
    color: var(--text-main);
    transition: color 0.2s;
    text-decoration: none;
}

.blog-card h3 a:hover {
    color: var(--primary);
}

.blog-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 0.85rem;
}

.author-name {
    font-weight: 600;
    color: var(--text-main);
}

.post-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* --- Article Header --- */
.article-hero {
    padding: 60px 0 80px;
    text-align: center;
}

.article-hero .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.back-link {
    align-self: center;
    margin-bottom: 40px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.article-header {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    margin-bottom: 60px;
}

.article-meta-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.article-header h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 30px;
}

.article-author-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    color: var(--text-muted);
    font-size: 1rem;
}

.hero-image-wrapper {
    margin-top: 40px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .blog-header h1 {
        font-size: 2.5rem;
    }

    .featured-card {
        grid-template-columns: 1fr;
    }

    .featured-image {
        min-height: 250px;
        order: -1;
    }

    .featured-content {
        padding: 24px;
    }

    .blog-controls {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .blog-search-wrapper {
        width: 100%;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    .article-header h1 {
        font-size: 2rem;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Markdown Elements Styling --- */

/* Tables - Force responsive by default */
/* Tables - Responsive Wrapper */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    /* Remove display: block to let table behave like a table inside the wrapper */
}

.article-body th {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.article-body td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.article-body tr:last-child td {
    border-bottom: none;
}

/* Code Blocks & Copy Button */
.code-wrapper {
    position: relative;
    margin-bottom: 24px;
    background: #1e1e1e;
    /* Darker than card */
    border-radius: 6px;
    border: 1px solid var(--border-color);
    width: 100%;
    /* Ensure wrapper doesn't overflow */
    max-width: 100%;
}

.article-body pre {
    padding: 16px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #d4d4d4;
    margin: 0;
    white-space: pre;
    /* Keep code formatting but allow scroll */
    max-width: 100%;
}

.article-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    display: inline-block;
    /* Helps with some overflow edge cases */
    min-width: 100%;
    /* Ensures code background covers fill width when scrolling */
}

/* ... existing copy button styles ... */
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    z-index: 10;
    /* Ensure button is above code */
}

.code-wrapper:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--primary);
    color: white;
}

/* Images, Videos, Iframes */
.article-body img,
.article-body video,
.article-body iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 24px 0;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: block;
    /* Removes bottom extra space */
}

/* Typography refinements */
.article-body strong {
    color: var(--text-main);
    font-weight: 600;
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 40px 0;
}

/* --- CSS Visuals (Replacing Images) --- */
.visual-box {
    width: 100%;
    margin: 30px 0;
    border-radius: 8px;
    overflow: hidden;
    color: white;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    position: relative;
    background: #0f172a;
    /* Fallback */
}

/* Variant: Terminal (for CLI tools) */
.visual-box.terminal {
    background: #1e293b;
    font-family: 'Consolas', monospace;
    padding: 0;
}

.terminal-header {
    background: #334155;
    padding: 10px 15px;
    display: flex;
    gap: 8px;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red {
    background: #ef4444;
}

.terminal-dot.yellow {
    background: #f59e0b;
}

.terminal-dot.green {
    background: #10b981;
}

.terminal-body {
    padding: 20px;
    color: #e2e8f0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.terminal-prompt {
    color: #f472b6;
    margin-right: 8px;
}

.terminal-cmd {
    color: #fff;
}

.terminal-output {
    color: #94a3b8;
    display: block;
}

.terminal-success {
    color: #34d399;
    font-weight: bold;
}

/* Variant: Feature Card (for standard tools) */
.visual-box.feature-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.feature-brand {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feature-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    flex-grow: 1;
    max-width: 500px;
}

@media (max-width: 600px) {
    .feature-stats {
        grid-template-columns: 1fr;
    }

    .visual-box.feature-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

/* Variant: Blueprint (technicals) */
.visual-box.blueprint {
    background-color: #0f172a;
    background-image: linear-gradient(#1e293b 1px, transparent 1px), linear-gradient(90deg, #1e293b 1px, transparent 1px);
    background-size: 20px 20px;
    padding: 30px;
}

.blueprint-content {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid #3b82f6;
    padding: 20px;
    border-radius: 4px;
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.blueprint-content::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px dashed #3b82f6;
    z-index: -1;
}

.blueprint-title {
    color: #3b82f6;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
    font-size: 0.9rem;
}

.blueprint-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.blueprint-list li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #e2e8f0;
    border-bottom: 1px dotted #334155;
    padding-bottom: 4px;
}