/* ==========================================================================
   PK SoftTech — Knowledge Hub Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reading Progress Bar (Sits directly under compact sticky navbar)
   -------------------------------------------------------------------------- */
.reading-progress-track {
    position: fixed;
    left: 0;
    right: 0;
    top: 56px;
    height: 3px;
    z-index: 45;
    background: transparent;
    pointer-events: none;
}

@media (min-width: 640px) {
    .reading-progress-track {
        top: 64px;
    }
}

.reading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0284c7, #06b6d4, #10b981);
    transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   2. Category Filter Pills
   -------------------------------------------------------------------------- */
.cat-pill {
    background-color: var(--bg-subtle);
    color: var(--text-body);
    border: 1px solid var(--border-subtle);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cat-pill:hover {
    border-color: var(--color-primary-bright);
    color: var(--text-heading);
}

.cat-pill[aria-pressed="true"] {
    background-color: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

/* --------------------------------------------------------------------------
   3. Article Prose Typography (Thai & Technical Content)
   -------------------------------------------------------------------------- */
.article-prose {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text-body);
}

.article-section-heading {
    scroll-margin-top: 96px;
    color: var(--text-heading);
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1.4;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

@media (min-width: 640px) {
    .article-section-heading {
        font-size: 1.5rem;
    }
}

.article-list {
    padding-left: 1.25rem;
    space-y: 0.5rem;
}

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

/* --------------------------------------------------------------------------
   4. Callout Boxes (WCAG AA Contrast in Light & Dark Modes)
   -------------------------------------------------------------------------- */
.article-callout {
    border-radius: 14px;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-subtle);
    border-left-width: 4px;
}

.article-callout.callout-tip {
    background-color: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.28);
    border-left-color: #059669;
}

.article-callout.callout-info {
    background-color: rgba(2, 132, 199, 0.08);
    border-color: rgba(2, 132, 199, 0.28);
    border-left-color: #0284c7;
}

.article-callout.callout-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
    border-left-color: #d97706;
}

/* --------------------------------------------------------------------------
   5. Responsive Comparison Tables
   -------------------------------------------------------------------------- */
.article-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-card);
}

.article-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.article-table th {
    background-color: var(--bg-subtle);
    color: var(--text-heading);
    font-weight: 700;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.article-table td {
    padding: 0.75rem 1rem;
    color: var(--text-body);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.article-table tr:last-child td {
    border-bottom: none;
}

/* --------------------------------------------------------------------------
   6. Code Block Card & Copy Button
   -------------------------------------------------------------------------- */
.article-code-card {
    background: #0a0f1d;
    border: 1px solid #1e293b;
    border-radius: 14px;
    overflow: hidden;
}

.article-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
}

.article-code-pre {
    margin: 0;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.84rem;
    line-height: 1.65;
    color: #e2e8f0;
}

.copy-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.copy-code-btn:hover {
    background: #334155;
    color: #ffffff;
}

.copy-code-btn.is-copied {
    background-color: #059669;
    color: #ffffff;
    border-color: #10b981;
}

/* --------------------------------------------------------------------------
   7. Sticky Table of Contents (TOC)
   -------------------------------------------------------------------------- */
.toc-link {
    display: block;
    padding: 6px 12px;
    border-left: 2px solid var(--border-subtle);
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-muted);
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

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

.toc-link.is-active {
    border-left-color: var(--color-primary-bright);
    color: var(--color-primary-hex);
    font-weight: 600;
    background-color: rgba(var(--color-primary-rgb), 0.08);
    border-radius: 0 8px 8px 0;
}

/* --------------------------------------------------------------------------
   8. Reduced Motion Support
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .reading-progress-bar {
        transition: none;
    }
}
