/* ==========================================================================
   Knowledge Base Overrides
   Harmonizes knowledge base pages with the main site header/footer.
   ========================================================================== */

body.kb-page {
    background: var(--index-bg-gradient);
    color: var(--index-charcoal);
    font-family: var(--index-font-primary);
}

/* ==========================================================================
   HEADER & NAVIGATION - Force index.html styles
   ========================================================================== */

/* Header - Force font rendering like index.html */
body.kb-page header,
body.kb-page header * {
    -webkit-font-smoothing: auto !important;
    -moz-osx-font-smoothing: auto !important;
}

/* Header */
body.kb-page header {
    position: relative !important;
    top: 0 !important;
    z-index: 50 !important;
    background: rgba(251, 247, 242, 0.95) !important;
    border-bottom: 1px solid var(--index-primary-10) !important;
}

body.kb-page .header-container {
    max-width: var(--index-container-max) !important;
    margin: 0 auto !important;
    padding: 1.2rem 2rem 1.4rem 2rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

/* Logo */
body.kb-page .logo {
    font-family: var(--index-font-display) !important;
    font-size: 1.75rem !important;
    font-weight: 600 !important;
    color: var(--index-primary) !important;
    text-decoration: none !important;
    letter-spacing: -0.01em !important;
    line-height: 1.2 !important;
}

/* Navigation */
body.kb-page .header-nav {
    display: flex !important;
    align-items: center !important;
    gap: 2rem !important;
    font-family: var(--index-font-primary) !important;
}

body.kb-page .nav-link {
    color: var(--index-charcoal) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
    font-family: var(--index-font-primary) !important;
    transition: color 0.3s ease !important;
    padding: 0.5rem 0 !important;
}

body.kb-page .nav-link:hover {
    color: var(--index-primary) !important;
    text-decoration: none !important;
}

/* CTA Button */
body.kb-page .header-cta {
    background: var(--index-primary) !important;
    color: white !important;
    padding: 0.8rem 1.5rem !important;
    border-radius: var(--index-radius-sm) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
}

body.kb-page .header-cta:hover {
    background: var(--index-accent) !important;
    transform: translateY(-1px) !important;
    text-decoration: none !important;
}

/* Mobile hamburger baseline */
body.kb-page .mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 36px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

body.kb-page .mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--index-charcoal);
    border-radius: 8px;
    transition: transform 0.3s var(--index-ease-organic), opacity 0.3s var(--index-ease-organic);
}

@media (max-width: 992px) {
    body.kb-page .header-nav,
    body.kb-page .header-cta {
        display: none !important;
    }

    body.kb-page .mobile-menu-toggle {
        display: flex;
    }

    body.kb-page .header-container {
        padding: 1rem 1.25rem 1.2rem 1.25rem !important;
    }
}

@media (max-width: 768px) {
    body.kb-page .kb-container {
        padding: 0 1.25rem;
    }

    body.kb-page .kb-section {
        padding: 2.5rem 0 2.5rem 0;
    }

    body.kb-page .kb-hero {
        padding: 2.5rem 0 2rem 0;
    }

    body.kb-page .kb-hero-title {
        font-size: clamp(2rem, 6vw, 2.8rem);
    }

    body.kb-page .kb-shell-home .kb-article-card,
    body.kb-page .kb-shell-home .kb-category-card {
        padding: 1.75rem;
        border-radius: 14px;
    }
}

@media (max-width: 520px) {
    body.kb-page .header-container {
        padding: 0.9rem 1rem 1.1rem 1rem !important;
    }

    body.kb-page .kb-container {
        padding: 0 1rem;
    }

    body.kb-page .kb-shell-home .kb-article-card,
    body.kb-page .kb-shell-home .kb-category-card {
        padding: 1.5rem;
    }
}

body.kb-page .kb-container,
body.kb-page .kb-newsletter .kb-container {
    max-width: var(--index-container-max);
    margin: 0 auto;
    padding: 0 2rem;
}


.kb-shell {
    padding-top: 0;
}

.kb-shell-article {
    padding-bottom: 40px;
}

.kb-shell-home {
    padding-bottom: 65px;
    padding-top: 0;
}

.kb-article-page {
    margin: 1.25rem auto 1.5rem;
    padding: 3rem;
    background: #ffffff;
    border-radius: 32px;
    box-shadow: var(--index-shadow-soft);
}

@media (max-width: 768px) {
    .kb-article-page {
        padding: 2rem 1.5rem;
        border-radius: 24px;
        margin: 1rem auto 2.25rem;
    }
}

.kb-article-header {
    text-align: left;
    border-bottom: 1px solid var(--index-primary-10);
    padding-bottom: 1.75rem;
    margin-bottom: 2.5rem;
}

.kb-article-title {
    font-family: var(--index-font-display);
    font-size: clamp(2.5rem, 3vw, 3.25rem);
    color: var(--index-charcoal);
    margin-bottom: 1.5rem;
    line-height: 1.15;
}

.kb-article-info {
    justify-content: flex-start;
    gap: 1.25rem;
    color: var(--index-charcoal-80);
}

.kb-breadcrumbs {
    color: var(--index-charcoal-80);
    font-size: 0.95rem;
}

.kb-breadcrumbs a {
    color: var(--index-primary);
}

.kb-toc {
    border: 1px solid var(--index-primary-10);
    background: var(--index-cream-alt);
}

.kb-toc h3 {
    font-family: var(--index-font-serif);
    color: var(--index-charcoal);
}

.kb-takeaways {
    border: 1px solid var(--index-accent-20);
    background: linear-gradient(135deg, rgba(42, 92, 78, 0.08) 0%, rgba(201, 74, 42, 0.08) 100%);
}

.kb-takeaways h3 {
    margin-bottom: 1rem;
}

.kb-article-content h2,
.kb-article-content h3 {
    font-family: var(--index-font-serif);
    color: var(--index-primary);
}

.kb-article-content {
    color: var(--index-charcoal);
    font-size: 1.06rem;
}

.kb-related {
    border-top: 1px solid var(--index-primary-10);
    padding-top: 2.5rem;
}

.kb-related h3 {
    font-family: var(--index-font-serif);
    color: var(--index-charcoal);
}

.kb-related-card,
.kb-article-card {
    background: #ffffff;
    border: 1px solid var(--index-primary-08);
    box-shadow: var(--index-shadow-soft);
}

.kb-newsletter {
    background: transparent;
    padding: 0;
}

.kb-newsletter-box {
    margin: 0 auto 4rem;
    padding: 3rem;
    background: linear-gradient(135deg, rgba(201, 74, 42, 0.08) 0%, rgba(42, 92, 78, 0.08) 100%);
    border-radius: 32px;
    border: 1px solid var(--index-primary-10);
    box-shadow: var(--index-shadow-soft);
    max-width: 720px;
}

@media (max-width: 768px) {
    .kb-newsletter-box {
        padding: 2rem 1.75rem;
        border-radius: 24px;
    }
}


.nav-link-active {
    color: inherit;
    font-weight: 500;
}

.nav-link-active:hover {
    color: var(--index-primary);
}

.nav-link-active::after {
    display: none;
}

.mobile-nav-link.nav-link-active {
    color: inherit;
}

/* Knowledge base listing page adjustments */
.kb-shell-home .kb-hero {
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 3rem 0 2rem 0;
    border-bottom: 1px solid var(--index-primary-10);
    margin-bottom: 3rem;
}

.kb-shell-home .kb-category-card,
.kb-shell-home .kb-video-card,
.kb-shell-home .kb-article-card {
    background: #ffffff;
    border: 1px solid var(--index-primary-08);
    box-shadow: var(--index-shadow-soft);
    transition: all 0.3s ease;
    padding: 2rem;
    border-radius: 16px;
}

.kb-shell-home .kb-article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--index-shadow-medium);
    border-color: var(--index-primary-20);
}

.kb-shell-home .kb-article-card h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    line-height: 1.3;
}

.kb-shell-home .kb-article-card h3 a {
    color: var(--index-charcoal);
    text-decoration: none;
    transition: color 0.3s ease;
}

.kb-shell-home .kb-article-card h3 a:hover {
    color: var(--index-primary);
}

.kb-shell-home .kb-article-card p {
    color: var(--index-charcoal-80);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.kb-shell-home .kb-article-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--index-charcoal-80);
}

.kb-shell-home .kb-article-meta span {
    padding: 0.25rem 0.75rem;
    background: var(--index-primary-05);
    border-radius: 6px;
}

.kb-shell-home .kb-section {
    background: transparent;
    padding: 2rem 0 4rem 0;
}

.kb-shell-home .kb-section:nth-of-type(even) {
    background: transparent;
}

.kb-shell-home .kb-section::after {
    display: none;
}

.kb-shell-home .kb-section-header {
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.kb-shell-home .kb-section-header h2 {
    font-family: var(--index-font-display);
    color: var(--index-charcoal);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    text-align: center;
}

.kb-shell-home .kb-hero-title {
    font-family: var(--index-font-display);
    color: var(--index-charcoal);
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    margin-bottom: 1rem;
    text-align: center;
}

/* Section header alignment on inner pages */
body.kb-page .kb-section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

body.kb-page .kb-section-header h2 {
    margin: 0;
}

/* Category cards mobile layout */
@media (max-width: 640px) {
    body.kb-page .kb-category-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body.kb-page .kb-category-card {
        padding: 1.35rem;
    }

    body.kb-page .kb-category-card h3 {
        font-size: 1.1rem;
    }
}

/* Breadcrumb adjustments on mobile */
@media (max-width: 640px) {
    body.kb-page .kb-breadcrumbs {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        text-align: center;
    }

    body.kb-page .kb-breadcrumbs span,
    body.kb-page .kb-breadcrumbs a {
        white-space: nowrap;
    }

    body.kb-page .kb-breadcrumbs .kb-breadcrumb-divider {
        display: none;
    }

    body.kb-page .kb-breadcrumbs [aria-current="page"] {
        flex-basis: 100%;
        font-weight: 600;
        color: var(--index-primary);
    }
}

.kb-shell-home .kb-hero-subtitle {
    color: var(--index-charcoal-80);
    font-size: 1.25rem;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.kb-shell-home .kb-stat-number {
    color: var(--index-primary);
}

.kb-shell-home .kb-see-all {
    color: var(--index-primary);
}

.kb-shell-home .kb-scroll-section {
    background: transparent;
}

/* Utility spacing helpers */
.kb-spacer-xl {
    height: 40px;
}

.kb-spacer-xxl {
    height: 60px;
}
