/* Article Reading Interface Stylesheet */

/* Reading Progress Bar */
.reading-progress-container {
    position: fixed;
    top: 80px; /* height of header */
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 999;
}

.reading-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
    transition: width 0.1s ease-out;
}

/* Page Layout */
.article-layout {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 3.5rem;
    padding: 3rem 1.5rem 6rem 1.5rem;
}

.article-main {
    min-width: 0; /* Prevents overflow inside flex grids */
}

/* Article Header and Metas */
.article-header-meta {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1.5rem;
}

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs a {
    color: var(--text-muted);
}

.breadcrumbs a:hover {
    color: var(--accent-cyan);
}

.article-detail-title {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.article-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* TL;DR Summary box */
.article-summary-box {
    background: rgba(0, 229, 255, 0.03);
    border-left: 3px solid var(--accent-cyan);
    padding: 1.25rem 1.5rem;
    border-radius: 0 4px 4px 0;
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
}

.article-summary-box strong {
    color: var(--accent-cyan);
}

/* Main Post Prose */
.article-content-body {
    font-size: 1.1rem;
    line-height: 1.75;
    color: #cbd5e1;
}

.article-content-body h3 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.article-content-body h4 {
    font-size: 1.35rem;
    margin: 2rem 0 1rem 0;
}

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

.article-content-body ul, 
.article-content-body ol {
    margin: 0 0 1.5rem 1.5rem;
}

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

/* Code Syntax Styling */
.article-content-body pre {
    background: #020306;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content-body code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-cyan);
}

.article-content-body pre code {
    color: #f8f8f2;
}

/* Helper Info and Warning boxes */
.info-box, .warning-box {
    padding: 1.25rem 1.5rem;
    border-radius: 4px;
    margin: 2rem 0;
}

.info-box {
    background: rgba(0, 229, 255, 0.03);
}
.border-left-cyan { border-left: 3px solid var(--accent-cyan); }

.warning-box {
    background: rgba(255, 0, 60, 0.03);
}
.border-left-red { border-left: 3px solid var(--accent-red); }

.info-box h5, .warning-box h5 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.info-box h5 { color: var(--accent-cyan); }
.warning-box h5 { color: var(--accent-red); }

/* Custom Stack Table formatting */
.stack-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
    background: rgba(2, 3, 6, 0.3);
    border: 1px solid var(--border-light);
}

.stack-table th, .stack-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border: 1px solid var(--border-light);
}

.stack-table th {
    background: #0a0e17;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

/* Interactive Quiz Block styling */
.quiz-card {
    margin-top: 4rem;
    border-color: rgba(0, 245, 118, 0.15);
    background: rgba(4, 5, 8, 0.6);
}

.quiz-header {
    margin-bottom: 1.5rem;
}

.quiz-title {
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.quiz-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.quiz-question {
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.75rem 1rem;
    border-radius: 4px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.quiz-option-btn {
    text-align: left;
    background: rgba(2, 3, 6, 0.4);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-fast);
}

.quiz-option-btn:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.02);
}

.option-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    transition: var(--transition-fast);
}

.quiz-option-btn:hover .option-marker {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.quiz-option-btn.selected {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.05);
}

.quiz-option-btn.selected .option-marker {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: var(--text-dark);
}

.quiz-option-btn.correct-reveal {
    border-color: var(--accent-green);
    background: rgba(0, 245, 118, 0.05);
}

.quiz-option-btn.correct-reveal .option-marker {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--text-dark);
}

.quiz-option-btn.incorrect-reveal {
    border-color: var(--accent-red);
    background: rgba(255, 0, 60, 0.05);
}

.quiz-option-btn.incorrect-reveal .option-marker {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: #ffffff;
}

/* Feedback alert */
.quiz-feedback {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.quiz-feedback.correct-feedback {
    background: rgba(0, 245, 118, 0.05);
    border: 1px solid var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 245, 118, 0.1);
}

.quiz-feedback.incorrect-feedback {
    background: rgba(255, 0, 60, 0.05);
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 10px rgba(255, 0, 60, 0.1);
}

.feedback-icon {
    font-size: 1.5rem;
}

.correct-feedback .feedback-icon { color: var(--accent-green); }
.incorrect-feedback .feedback-icon { color: var(--accent-red); }

.feedback-message h4 {
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
}

.correct-feedback h4 { color: var(--accent-green); }
.incorrect-feedback h4 { color: var(--accent-red); }

.feedback-message p {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.quiz-footer {
    display: flex;
    justify-content: flex-end;
}

/* Sticky Sidebar elements */
.article-sidebar {
    position: relative;
}

.sidebar-wrapper {
    position: sticky;
    top: 104px; /* header height + padding */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-widget h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
}

/* Bookmark Widget */
.bookmark-widget .bookmark-action-btn {
    width: 100%;
}

.bookmark-widget .bookmark-action-btn.bookmarked {
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
}

/* TOC Widget styling */
.toc-navigation ul {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toc-navigation li {
    font-size: 0.85rem;
    line-height: 1.4;
}

.toc-navigation li.toc-h3 {
    font-weight: 500;
}

.toc-navigation li.toc-h4 {
    padding-left: 1rem;
    font-size: 0.8rem;
}

.toc-link {
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.toc-link:hover,
.toc-link.active {
    color: var(--accent-cyan);
    padding-left: 2px;
}

/* Reference Widget */
.reference-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.825rem;
    margin-bottom: 0.5rem;
}

.reference-item:last-child {
    margin-bottom: 0;
}

.reference-item .label {
    color: var(--text-muted);
}

.reference-item .val {
    color: #ffffff;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .reading-progress-container {
        top: 80px;
    }
    .article-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
        padding-top: 2rem;
    }
    .article-detail-title {
        font-size: 2.25rem;
    }
    .article-sidebar {
        order: -1; /* Sidebar goes above main content on small devices for bookmark option */
    }
    .sidebar-wrapper {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sidebar-widget {
        flex: 1 1 280px;
    }
    .toc-widget {
        display: none; /* Hide TOC on mobile since layout isn't dual */
    }
}

@media (max-width: 576px) {
    .reading-progress-container {
        top: 80px;
    }
    .article-detail-title {
        font-size: 1.85rem;
    }
    .article-meta-row {
        gap: 1rem;
        font-size: 0.8rem;
    }
    .sidebar-wrapper {
        flex-direction: column;
    }
    .sidebar-widget {
        flex: 1 1 auto;
    }
}

/* Comment Form styling */
.comment-form textarea:focus {
    border-color: var(--accent-cyan) !important;
    box-shadow: var(--glow-cyan) !important;
    background: rgba(0, 229, 255, 0.02) !important;
}
