/* /knowledge-base/ — hub + article pages */

html.page-knowledge-base-hub,
body.page-knowledge-base-hub {
    overflow-x: clip;
}

.kb-main {
    background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 12rem, #fff 24rem);
}

/* ——— Hub (index): full-width card grid ——— */
.page-knowledge-base-hub .kb-section {
    scroll-margin-top: 5rem;
}

.kb-hub-page {
    position: relative;
}

.kb-content--hub {
    max-width: 100%;
}

.kb-hub-category-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--npi-doc-accent-border-light);
}

.kb-hub-category-title:first-of-type {
    margin-top: 1.5rem;
}

.kb-hub-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 576px) {
    .kb-hub-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .kb-hub-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

.kb-hub-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.kb-hub-card:hover {
    border-color: var(--npi-doc-accent-border);
    box-shadow: 0 12px 36px rgba(37, 99, 235, 0.14);
    transform: translateY(-3px);
    color: inherit;
}

.kb-hub-card:focus-visible {
    outline: 2px solid var(--npi-doc-accent);
    outline-offset: 3px;
}

.kb-hub-card__media {
    position: relative;
    aspect-ratio: 1280 / 714;
    background: linear-gradient(145deg, var(--npi-doc-accent-soft) 0%, #e2e8f0 100%);
    overflow: hidden;
}

.kb-hub-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kb-hub-card__placeholder {
    width: 100%;
    height: 100%;
    min-height: 8rem;
    background: linear-gradient(135deg, var(--npi-doc-accent) 0%, var(--npi-doc-accent-hover) 50%, #1e3a8a 100%);
    opacity: 0.85;
}

.kb-hub-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1rem 1.15rem 1.15rem;
    gap: 0.35rem;
}

.kb-hub-card__title {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.kb-hub-card:hover .kb-hub-card__title {
    color: var(--npi-doc-accent-hover);
}

.kb-hub-card__excerpt {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.55;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kb-hub-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--npi-doc-accent);
}

.kb-hub-card__cta svg {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
}

.kb-hub-card:hover .kb-hub-card__cta svg {
    transform: translateX(3px);
}

.kb-content article {
    min-width: 0;
}

.kb-section {
    scroll-margin-top: 1.25rem;
    padding-bottom: 2.5rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.kb-section--last {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.kb-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--npi-doc-accent);
    display: inline-block;
    width: 100%;
    box-shadow: 0 1px 0 #e2e8f0;
}

.kb-lead {
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

/* Single article: compact page header (no full-width hero band) */
.page-knowledge-base-article .kb-article-layout.kb-main {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 10rem, #fff 22rem);
}

.kb-article-pagehead {
    padding-bottom: 1.35rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.kb-article-pagehead__crumbs {
    margin-bottom: 0.7rem;
    max-width: 100%;
}

/* Home / Knowledge Base / article title — title ellipsize on narrow widths */
.kb-breadcrumb-trail {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
    max-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8125rem;
    line-height: 1.35;
    overflow: hidden;
}

@media (min-width: 576px) {
    .kb-breadcrumb-trail {
        font-size: 0.875rem;
    }
}

.kb-breadcrumb-trail__item {
    display: block;
    min-width: 0;
}

.kb-breadcrumb-trail__item--root {
    flex: 0 0 auto;
}

.kb-breadcrumb-trail__item--root a,
.kb-breadcrumb-trail__item--hub a {
    color: var(--npi-doc-accent);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.kb-breadcrumb-trail__item--root a:hover,
.kb-breadcrumb-trail__item--hub a:hover {
    text-decoration: underline;
}

.kb-breadcrumb-trail__item--hub {
    flex: 0 0 auto;
}

.kb-breadcrumb-trail__sep {
    flex: 0 0 auto;
    color: #cbd5e1;
    user-select: none;
    pointer-events: none;
}

.kb-breadcrumb-trail__sep span {
    display: inline-block;
}

/* Current article title: uses remaining space, ellipsizes */
.kb-breadcrumb-trail__item--current {
    flex: 1 1 0%;
    min-width: 0;
    color: #0f172a;
    font-weight: 600;
}

.kb-breadcrumb-trail__ellip {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Very narrow: allow Knowledge Base link to shrink visually via smaller label (optional future) */
@media (max-width: 380px) {
    .kb-breadcrumb-trail__item--hub a {
        max-width: 7.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: bottom;
    }
}

.kb-article-pagehead__title {
    font-size: clamp(1.6rem, 4.2vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
    margin: 0 0 0.65rem 0;
    line-height: 1.2;
}

.kb-article-pagehead__dek {
    font-size: 1.0625rem;
    line-height: 1.55;
    color: #475569;
    margin: 0;
    max-width: 52rem;
}

/* Mobile TOC: collapsible list (replaces chip row on small screens) */
.kb-mobile-toc {
    margin-bottom: 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.kb-mobile-toc__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.kb-mobile-toc__summary::-webkit-details-marker {
    display: none;
}

.kb-mobile-toc__summary-text {
    flex: 1;
    min-width: 0;
}

.kb-mobile-toc__summary-meta {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kb-mobile-toc__summary::after {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.15rem;
}

.kb-mobile-toc[open] .kb-mobile-toc__summary::after {
    transform: rotate(-135deg);
    margin-top: 0.2rem;
}

.kb-mobile-toc__summary:focus {
    outline: none;
}

.kb-mobile-toc__summary:focus-visible {
    outline: 2px solid var(--npi-doc-accent);
    outline-offset: 2px;
}

.kb-mobile-toc__panel {
    padding: 0 0.5rem 0.85rem;
    border-top: 1px solid #f1f5f9;
}

.kb-mobile-toc__list {
    margin: 0;
    padding: 0.35rem 0 0;
}

.kb-mobile-toc__list li {
    margin: 0;
}

.kb-mobile-toc__list a {
    display: block;
    padding: 0.55rem 0.65rem;
    font-size: 0.875rem;
    line-height: 1.4;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    border-radius: 0.4rem;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.kb-mobile-toc__list a:hover {
    background: #f8fafc;
    color: var(--npi-doc-accent-ink);
    border-left-color: var(--npi-doc-accent-border);
}

.kb-mobile-toc__list a.is-active {
    background: var(--npi-doc-accent-soft);
    color: var(--npi-doc-accent-ink-deep);
    border-left-color: var(--npi-doc-accent-bar);
}

.kb-mobile-toc__list a.is-active:hover {
    background: var(--npi-doc-accent-soft-2);
    color: var(--npi-doc-accent-ink-deep);
}

.kb-article-sheet {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.5rem 1.35rem 1.75rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

@media (min-width: 768px) {
    .kb-article-sheet {
        padding: 2rem 2.25rem 2.25rem;
    }
}

.kb-article-figure {
    margin: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.kb-article-figure__img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.kb-article-body .kb-article-figure--inline {
    margin-top: 0.25rem;
    margin-bottom: 1.25rem;
}

.kb-article-body .kb-article-figure__caption {
    display: block;
    padding: 0.65rem 0.85rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.kb-article-body h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    scroll-margin-top: 5.5rem;
}

.kb-article-body h2:first-child {
    margin-top: 0;
}

.kb-article-body h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 1.35rem;
    margin-bottom: 0.5rem;
}

.kb-article-body p {
    color: #334155;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.kb-article-body p:last-child {
    margin-bottom: 0;
}

.kb-article-body ul,
.kb-article-body ol {
    color: #334155;
    line-height: 1.65;
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

.kb-article-body li + li {
    margin-top: 0.35rem;
}

.kb-article-body a {
    font-weight: 600;
}

/* Semantic comparison tables (KB refresh: Type 1 vs Type 2, etc.) */
.kb-article-body .kb-article-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #334155;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.kb-article-body .kb-article-table thead {
    background: #f1f5f9;
}

.kb-article-body .kb-article-table th,
.kb-article-body .kb-article-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e2e8f0;
}

.kb-article-body .kb-article-table tbody tr:last-child th,
.kb-article-body .kb-article-table tbody tr:last-child td {
    border-bottom: none;
}

.kb-article-body .kb-article-table th[scope='col'] {
    font-weight: 700;
    color: #0f172a;
}

.kb-article-body .kb-article-table th[scope='row'] {
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}

@media (max-width: 42rem) {
    .kb-article-body .kb-article-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
