/* ═══════════════════════════════════════════════════════════
   PRIMELINK – รายละเอียดบทความ (Article Detail) – PAGE CSS
   knowledge-detail.css
═══════════════════════════════════════════════════════════ */

/* ── BREADCRUMB ── */
.kb-breadcrumb {
    padding: 88px 0 0;
    background: #fff;
}

.kb-breadcrumb-inner {
    padding: 14px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.kb-breadcrumb-inner a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.kb-breadcrumb-inner a:hover {
    color: var(--gold-dark);
}

.kb-breadcrumb-inner i {
    font-size: 0.7rem;
}

/* ── ARTICLE HEADER ── */
.kb-article-head {
    background: #fff;
    padding: 28px 0 32px;
    border-bottom: 1px solid var(--border);
}

.kb-article-head-inner {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}

@media (max-width: 991px) {
    .kb-article-head-inner {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.kb-article-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 16px;
}

.kb-article-title {
    font-family: 'Prompt', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 800;
    color: var(--dark);
    line-height: 1.3;
    margin-bottom: 14px;
}

.kb-article-subtitle {
    font-size: 1.02rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 20px;
    max-width: 680px;
}

.kb-article-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.kb-author-mini {
    display: flex;
    align-items: center;
    gap: 9px;
}

.kb-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--gold-pale);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gold);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.kb-author-avatar img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
}

.kb-author-info {
    line-height: 1.2;
}

.kb-author-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
}

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

.kb-meta-divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
}

/* Article actions (side) */
.kb-article-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 991px) {
    .kb-article-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.kb-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-family: 'IBM Plex Sans Thai', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.kb-action-btn:hover {
    border-color: var(--gold);
    color: var(--gold-dark);
}

.kb-action-btn i {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.kb-action-btn:hover i {
    color: var(--gold-dark);
}

.kb-action-btn--save {
    background: var(--gold-pale);
    border-color: rgba(215, 166, 92, 0.25);
    color: var(--gold-dark);
}

/* ── HERO IMAGE ── */
.kb-article-hero {
    position: relative;
    aspect-ratio: 16/7;
    overflow: hidden;
    background: var(--bg-light);
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .kb-article-hero {
        aspect-ratio: 4/3;
    }
}

.kb-article-hero img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
}

.kb-article-hero-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.75);
}

.kb-article-hero1 {
    background: #f8f8f8 !important;
}

/* ═══════════════════════════════════════════════════════════
   ARTICLE LAYOUT
═══════════════════════════════════════════════════════════ */
.kb-article-main {
    padding: 0 0 64px;
    background: #f8f8f8;
}

.kb-article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    align-items: start;
    padding-top: 36px;
}

@media (max-width: 991px) {
    .kb-article-layout {
        grid-template-columns: 1fr;
    }
}

/* ── TABLE OF CONTENTS ── */
.kb-toc {
    background: var(--gold-pale);
    border: 1px solid rgba(215, 166, 92, 0.2);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    margin-bottom: 28px;
}

.kb-toc-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    cursor: pointer;
}

.kb-toc-title i {
    color: var(--gold-dark);
}

.kb-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kb-toc-list a {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 0;
    transition: var(--transition);
    border-radius: 4px;
}

.kb-toc-list a::before {
    content: '';
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--border);
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--transition);
}

.kb-toc-list a:hover,
.kb-toc-list a.active {
    color: var(--gold-dark);
}

.kb-toc-list a:hover::before,
.kb-toc-list a.active::before {
    background: var(--gold);
}

.kb-toc-sub {
    padding-left: 18px;
}

/* ── ARTICLE BODY ── */
.kb-article-body {
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.kb-article-content {
    padding: 36px 40px;
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text);
    font-family: 'IBM Plex Sans Thai', sans-serif !important;
}

.kb-article-content,
.kb-article-content * {
    font-family: 'IBM Plex Sans Thai', sans-serif !important;
}

@media (max-width: 767px) {
    .kb-article-content {
        padding: 24px 20px;
    }
}

.kb-article-content h2 {
    font-family: 'Prompt', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
    margin: 36px 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold-pale);
    position: relative;
}

.kb-article-content h2::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--gold);
}

.kb-article-content h3 {
    font-family: 'Prompt', sans-serif;
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--dark);
    margin: 26px 0 10px;
}

.kb-article-content p {
    margin-bottom: 18px;
}

.kb-article-content a {
    color: var(--gold-dark);
    text-decoration: underline;
    text-decoration-color: rgba(215, 166, 92, 0.35);
}

.kb-article-content a:hover {
    text-decoration-color: var(--gold);
}

.kb-article-content ul,
.kb-article-content ol {
    padding-left: 22px;
    margin-bottom: 18px;
}

.kb-article-content li {
    margin-bottom: 8px;
}

.kb-article-content blockquote {
    border-left: 4px solid var(--gold);
    background: var(--gold-pale);
    padding: 16px 20px;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-muted);
}

.kb-article-content img {
    width: 100%;
    border-radius: var(--radius-xs);
    margin: 20px 0;
}

.kb-article-content .img-caption {
    display: block;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: -12px;
    margin-bottom: 20px;
}

/* Key Highlights box */
.kb-highlight-box {
    background: linear-gradient(135deg, #fffdf5, var(--gold-pale));
    border: 1px solid rgba(215, 166, 92, 0.25);
    border-radius: var(--radius-xs);
    padding: 20px 22px;
    margin: 24px 0;
}

.kb-highlight-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold-dark);
    margin-bottom: 12px;
}

.kb-highlight-box ul {
    margin: 0;
    padding-left: 18px;
}

.kb-highlight-box li {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 6px;
}

/* Data Table */
.kb-data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.88rem;
    border-radius: var(--radius-xs);
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--border);
}

.kb-data-table th {
    background: var(--dark);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
}

.kb-data-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

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

.kb-data-table tr:nth-child(even) td {
    background: var(--bg-light);
}

.kb-data-table tr:hover td {
    background: var(--gold-pale);
}

/* ── ARTICLE FOOTER ── */
.kb-article-footer {
    padding: 22px 40px;
    border-top: 1px solid var(--border);
}

@media (max-width: 767px) {
    .kb-article-footer {
        padding: 18px 20px;
    }
}

.kb-article-footer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
}

.kb-article-footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.kb-share-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-share-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.kb-share-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: var(--transition);
    color: #fff;
}

.kb-share-btn--fb {
    background: #1877f2;
}

.kb-share-btn--line {
    background: #06c755;
}

.kb-share-btn--tw {
    background: #1da1f2;
}

.kb-share-btn--copy {
    background: var(--bg-light);
    color: var(--text-muted);
}

.kb-share-btn:hover {
    opacity: 0.85;
    transform: scale(1.08);
}

/* ── AUTHOR BOX ── */
.kb-author-box {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin: 28px 0;
}

@media (max-width: 575px) {
    .kb-author-box {
        flex-direction: column;
    }
}

.kb-author-box-avatar {
    width: 64px !important;
    height: 64px !important;
    border-radius: 50% !important;
    -o-object-fit: cover !important;
       object-fit: cover !important;
    border: 3px solid var(--gold-pale) !important;
    flex-shrink: 0 !important;
}

.kb-author-box-name {
    font-family: 'Prompt', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 2px;
}

.kb-author-box-role {
    font-size: 0.75rem;
    color: var(--gold-dark);
    font-weight: 600;
    margin-bottom: 8px;
}

.kb-author-box-bio {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ─── SIDEBAR ARTICLE DETAIL ─── */
.kb-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Sticky TOC Sidebar */
.kb-toc-sidebar {
    /* position: sticky; */
    /* top: 88px; */
}

/* Inline sponsor */
.kb-inline-sponsor {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-decoration: none;
    display: block;
    transition: var(--transition);
}

.kb-inline-sponsor:hover {
    box-shadow: var(--shadow-sm);
}

.kb-inline-sponsor-img {
    width: 100%;
    height: 120px;
    -o-object-fit: cover;
       object-fit: cover;
    background: linear-gradient(135deg, var(--dark-2), var(--dark-3));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 2rem;
}

.kb-inline-sponsor-body {
    padding: 14px 16px;
    background: #fff;
}

.kb-inline-sponsor-tag {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-light);
    background: var(--bg-light);
    border-radius: 4px;
    padding: 2px 6px;
    margin-bottom: 6px;
    display: inline-block;
}

.kb-inline-sponsor-title {
    font-family: 'Prompt', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
    line-height: 1.35;
}

.kb-inline-sponsor-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── RELATED ARTICLES ── */
.kb-related {
    background: #f8f8f8;
    padding: 48px 0;
    border-top: 1px solid var(--border);
}

.kb-related-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.kb-related-title {
    font-family: 'Prompt', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.kb-related-title i {
    color: var(--gold-dark);
}

.kb-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

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

@media (max-width: 480px) {
    .kb-related-grid {
        grid-template-columns: 1fr;
    }
}

/* ── PROGRESS BAR ── */
.kb-read-progress {
    position: fixed;
    top: 68px;
    left: 0;
    height: 3px;
    background: linear-gradient(to right, var(--gold), var(--gold-dark));
    z-index: 91;
    width: 0%;
    transition: width 0.1s linear;
}

/* ── BACK TO TOP (article page) ── */
.kb-back-top {
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--dark);
    color: #fff;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 50;
}

.kb-back-top.show {
    opacity: 1;
    pointer-events: auto;
}

.kb-back-top:hover {
    background: var(--gold-dark);
}

