/* ==========================================================================
   KNOWLEDGE DETAIL PAGE STYLES
   ========================================================================== */

.knowledge-detail-page *,
.knowledge-detail-page *::before,
.knowledge-detail-page *::after {
    box-sizing: border-box;
}

.knowledge-detail-page {
    background: #ffffff;
    font-family: var(--font-family, 'Inter', sans-serif);
    color: #333;
    padding-bottom: 0px;
    overflow-x: hidden;
}

.knowledge-detail-page .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 30px;
    width: 100%;
}

/* Breadcrumbs */
.kd-breadcrumb {
    padding: 30px 0 20px;
    font-size: 0.85rem;
    color: #6b7280;
}

.kd-breadcrumb a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.kd-breadcrumb a:hover { color: #cdae77; }
.kd-breadcrumb span { color: #171c3e; font-weight: 500; }

/* Layout: 2 columns (content + TOC) */
.kd-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 60px;
    padding: 20px 0 60px;
    align-items: start;
}

/* Main Content */
.kd-content {
    min-width: 0;
}

.kd-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #171c3e;
    margin: 0 auto 40px auto;
    line-height: 1.3;
    padding-bottom: 20px;
    text-align: center;
    position: relative;
    width: 100%;
}

/* Centered gold line beneath the title */
.kd-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;      /* Adjust this to make the line longer/shorter */
    height: 3px;
    background: #cdae77;
    border-radius: 2px;
}

/* Rich Body Content */
.kd-body {
    font-size: 1rem;
    color: #333;
    line-height: 1.8;
}

.kd-body p {
    margin: 0 0 20px 0;
    color: #4b5563;
}

.kd-body h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #171c3e;
    margin: 50px 0 20px 0;
    line-height: 1.3;
    scroll-margin-top: 100px; /* Offset for sticky header */
}

.kd-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #171c3e;
    margin: 30px 0 15px 0;
}

.kd-body strong { color: #171c3e; font-weight: 700; }

.kd-body a {
    color: #cdae77;
    text-decoration: underline;
}

.kd-body ul,
.kd-body ol {
    padding-left: 25px;
    margin: 0 0 20px 0;
    color: #4b5563;
}

.kd-body li {
    margin-bottom: 10px;
    line-height: 1.7;
}

.kd-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Two-image media row */
.article-media-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

/* Single full-width media image */
.article-media-full {
    margin: 30px 0;
}

.article-media-full img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

.article-media-row img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 6px;
}

/* Two-image grid with captions */
.article-media-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.article-media-grid figure {
    margin: 0;
    text-align: center;
}

.article-media-grid figure img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.article-media-grid figcaption {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
}

/* TOC Sidebar */
.kd-toc {
    position: sticky;
    top: 120px;
    border-left: 3px solid #cdae77;
    padding-left: 20px;
}

.kd-toc-title {
    font-size: 1rem;
    font-weight: 700;
    color: #171c3e;
    margin: 0 0 20px 0;
    letter-spacing: 0.5px;
}

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

.kd-toc-list a {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: color 0.2s;
    display: block;
}

.kd-toc-list a:hover {
    color: #cdae77;
    font-weight: 500;
}

/* ==========================================================================
   Related Products Section (Full Width)
   ========================================================================== */
.kd-related-section {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: #0d102f;
    color: #ffffff;
    padding: 80px 0;
    overflow: hidden;
}

.kd-related-section .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 30px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.kd-related-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.kd-related-header h2 {
    font-size: 2rem;
    color: #ffffff;
    margin: 0;
    font-weight: 700;
}

.kd-nav {
    display: flex;
    gap: 10px;
}

.kd-nav button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.kd-nav button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #cdae77;
    color: #cdae77;
}

.kd-related-swiper { width: 100%; padding-bottom: 20px; }

.kd-product {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
    height: auto;
}

.kd-product:hover { transform: translateY(-5px); }

.kd-product-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f9f9f9;
}

.kd-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kd-product-info {
    padding: 25px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    justify-content: space-between;
}

.kd-product-info h4 {
    font-size: 1rem;
    color: #171c3e;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.btn-kd-related {
    display: inline-block;
    padding: 10px 30px;
    border: 1px solid #cdae77;
    color: #cdae77;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    align-self: center;
}

.btn-kd-related:hover {
    background: #cdae77;
    color: #ffffff;
}

/* Progress Bar Pagination - Override Swiper Defaults */
.kd-progress-fill.swiper-pagination-progressbar {
    position: relative !important;
    margin: 40px auto 0 !important;
    width: 60% !important;
    max-width: 600px !important;
    height: 2px !important;
    background: #ffffff !important;
    overflow: hidden;
    left: auto !important;
    top: auto !important;
    transform: none !important;
}

.kd-progress-fill .swiper-pagination-progressbar-fill {
    background: #cdae77 !important;
}

/* Mobile */
@media (max-width: 768px) {
    .kd-progress-fill.swiper-pagination-progressbar {
        width: 80% !important;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 992px) {
    .kd-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* TOC becomes a slide-in side menu on mobile */
    .kd-toc {
        position: fixed;
        top: 0;
        right: -320px;
        width: 300px;
        height: 100vh;
        background: #ffffff;
        border-left: 4px solid #cdae77;
        padding: 40px 25px;
        z-index: 999;
        overflow-y: auto;
        transition: right 0.3s ease;
        box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    }
}

@media (max-width: 768px) {
    .kd-title {
        font-size: 1.8rem;
    }

    .kd-body h2 { font-size: 1.5rem; margin-top: 35px; }
    .kd-body h3 { font-size: 1.15rem; }

    .article-media-row,
    .article-media-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .article-media-row img,
    .article-media-grid figure img {
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .kd-related-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    .kd-nav { align-self: flex-end; }
    .kd-progress-bar { width: 80%; }
}