/* Knowledge Base — index page
   Scoped under .kb-page. Tokens from sparkify.css (:root). */

.kb-page {
    background: #fff;
}

.kb-container {
    width: 100%;
    margin: 0 auto;
    padding: 4.5rem 1.5rem 5rem;
}
@media (min-width: 576px)  { .kb-container { max-width: 540px;  } }
@media (min-width: 768px)  { .kb-container { max-width: 720px;  } }
@media (min-width: 992px)  { .kb-container { max-width: 960px;  } }
@media (min-width: 1200px) { .kb-container { max-width: 1140px; } }
@media (min-width: 1400px) { .kb-container { max-width: 1320px; } }

/* --- Header --- */
.kb-header {
    margin-bottom: 2.5rem;
    text-align: center;
}
.kb-eyebrow {
    font-weight: 600;
    font-size: .85rem;
    line-height: 1.4;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent-muted);
    margin: 0 0 .5rem;
}
.kb-title {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4rem);
    line-height: 1.1;
    color: var(--primary);
    margin: 0;
}

/* --- Search --- */
.kb-search-wrap {
    margin: 2rem 0 2.5rem;
    display: flex;
    justify-content: center;
}
.kb-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    max-width: 720px;
    padding: .5rem .75rem;
    background: var(--neutral-100);
    border-radius: 62px;
    transition: box-shadow .2s ease;
}
.kb-search:focus-within {
    box-shadow: 0 0 0 3px rgba(10, 26, 47, .1);
}
.kb-search-icon {
    flex-shrink: 0;
    color: var(--neutral-500);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .4rem;
}
.kb-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 1rem;
    color: var(--neutral-600);
    padding: .4rem .25rem;
}
.kb-search input::placeholder {
    color: var(--neutral-500);
}
.kb-search-clear {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: var(--neutral-500);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.kb-search-clear:hover {
    background: rgba(10, 26, 47, .08);
    color: var(--primary);
}
.kb-search.has-query .kb-search-clear {
    opacity: 1;
}

/* --- Categories --- */
.kb-category + .kb-category {
    margin-top: 3rem;
}
.kb-category-title {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--primary);
    margin: 0 0 1.25rem;
}

/* --- Grid --- */
.kb-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

/* --- Card --- */
.kb-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.75rem;
    border-radius: 16px;
    border: 2px solid var(--neutral-200);
    background: #fff;
    color: var(--neutral-600);
    text-decoration: none;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.kb-card:hover {
    border-color: var(--primary-200);
    box-shadow: 0 12px 32px rgba(10, 26, 47, .08);
    transform: translateY(-2px);
    color: var(--neutral-600);
    text-decoration: none;
}
.kb-card:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}
.kb-card-badge {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--neutral-100);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.kb-card-badge .kb-icon {
    width: 28px;
    height: 28px;
}
.kb-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.kb-card-title {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.2;
    letter-spacing: -.01em;
    color: var(--primary);
}
.kb-card-summary {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--neutral-500);
}

/* --- Empty state --- */
.kb-empty {
    padding: 2rem 0;
    color: var(--neutral-500);
}
.kb-no-results {
    padding: 2rem 0;
    text-align: center;
    color: var(--neutral-500);
}

/* --- CTA --- */
.kb-cta {
    margin-top: 4rem;
    padding: 2rem;
    border-radius: 8px;
    background: linear-gradient(150deg, var(--primary) 29%, #205295 113%);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.kb-cta-body {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.kb-cta-inapp {
    flex: 1 1 380px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
}
.kb-cta-inapp-badge {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kb-cta-inapp-badge svg { width: 22px; height: 22px; }
.kb-cta-inapp-text {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    line-height: 1.4;
}
.kb-cta-inapp-eyebrow {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 600;
    font-size: .8rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent, #A8E6CF);
    opacity: .9;
}
.kb-cta-inapp-path {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    letter-spacing: -.01em;
}
.kb-cta-inapp-hint {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    font-size: .9rem;
    color: rgba(255, 255, 255, .75);
    line-height: 1.5;
    margin-top: .15rem;
}
.kb-cta-alternatives {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .85rem;
    padding: 0 .25rem;
}
.kb-cta-alt-label {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 600;
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
}
.kb-cta-head {
    flex: 0 0 auto;
    min-width: 220px;
}
.kb-cta-title {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.75rem;
    line-height: 1.2;
    letter-spacing: -.015em;
    color: #fff;
    margin: 0;
}
.kb-cta-subtitle {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.125rem;
    line-height: 1.6;
    opacity: .7;
    color: #fff;
    margin: 0;
}
.kb-cta-contacts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.kb-cta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #fff;
    text-decoration: none;
}
.kb-cta-item:hover {
    color: #fff;
    text-decoration: none;
}
.kb-cta-item:hover .kb-cta-badge {
    background: rgba(255, 255, 255, .3);
}
.kb-cta-badge {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background .15s ease;
}
.kb-cta-badge svg {
    width: 22px;
    height: 22px;
}
.kb-cta-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.kb-cta-value {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.125rem;
    letter-spacing: -.015em;
    color: #fff;
}
.kb-cta-label {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: .875rem;
    opacity: .7;
    color: #fff;
}
/* ========== Article page ========== */

.kb-article-page .kb-container {
    padding-top: 3rem;
    padding-bottom: 0;
}

/* Article content column */
.kb-article {
    margin: 2.5rem auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Breadcrumb */
.kb-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    margin-bottom: 1.5rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    font-size: .875rem;
    line-height: 1.5;
    color: var(--neutral-500);
    text-align: center;
}
.kb-breadcrumb-item {
    color: var(--neutral-500);
    text-decoration: none;
}
.kb-breadcrumb-item:hover {
    color: var(--primary);
    text-decoration: none;
}
.kb-breadcrumb-sep {
    color: var(--accent-muted);
    user-select: none;
}
.kb-breadcrumb-current {
    color: var(--primary);
    font-weight: 600;
    cursor: default;
    /* Keep long titles from overflowing small screens */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fallback notice */
.kb-fallback-notice {
    width: 100%;
    max-width: 680px;
    padding: .75rem 1rem;
    border-radius: 8px;
    background: var(--primary-50);
    color: var(--primary);
    font-size: .9375rem;
    line-height: 1.5;
    margin: 0;
}

/* Title + summary */
.kb-article-title {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    line-height: 1.2;
    color: var(--primary);
    text-align: center;
    max-width: 1170px;
    margin: 0;
}

/* HeadingPermalinkExtension inserts an empty anchor inside each h2/h3/h4 to
   carry the heading's id. We render the anchor invisibly (empty symbol +
   zero footprint) so heading layout is unchanged. The scroll-margin-top
   adds breathing room beyond the global scroll-padding-top so the heading
   text is comfortably visible below the navbar after an in-page anchor jump
   (without it the heading lands flush against the navbar edge or partially
   hidden). */
.kb-heading-anchor {
    display: inline-block;
    width: 0;
    overflow: hidden;
    scroll-margin-top: 60px;
}
.kb-article-summary {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--neutral-600);
    text-align: center;
    max-width: 700px;
    margin: 0;
}

/* Body (Markdown-rendered HTML) */
.kb-body {
    width: 100%;
    max-width: 700px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--neutral-600);
}
.kb-body > :first-child {
    margin-top: 0;
}
.kb-body > :last-child {
    margin-bottom: 0;
}
.kb-body h1 {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: 2rem;
    line-height: 1.2;
    color: var(--primary);
    margin: 2.5rem 0 1rem;
}
.kb-body h2 {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.75rem;
    line-height: 1.2;
    letter-spacing: -.03em;
    color: var(--primary);
    margin: 2rem 0 1rem;
}
.kb-body h3 {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.375rem;
    line-height: 1.3;
    letter-spacing: -.02em;
    color: var(--primary);
    margin: 1.75rem 0 .75rem;
}
.kb-body p {
    font-weight: 500;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--neutral-600);
    margin: 0 0 1.25rem;
}
.kb-body a {
    color: var(--success-600);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.kb-body a:hover {
    color: var(--success-700);
}
.kb-body strong {
    color: var(--primary);
    font-weight: 700;
}
.kb-body ul,
.kb-body ol {
    padding-left: 1.5rem;
    margin: 0 0 1.25rem;
}
.kb-body li {
    font-weight: 500;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--neutral-600);
    margin-bottom: .25rem;
}
.kb-body li::marker {
    color: var(--neutral-500);
}
.kb-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.5rem;
    font-size: 1rem;
    border: 1px solid var(--neutral-200);
    border-radius: 8px;
    overflow: hidden;
}
.kb-body th,
.kb-body td {
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--neutral-200);
    line-height: 1.5;
    vertical-align: top;
}
.kb-body th {
    background: var(--neutral-100);
    color: var(--primary);
    font-weight: 600;
}
.kb-body tr:last-child td {
    border-bottom: 0;
}
.kb-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9em;
    background: var(--neutral-100);
    padding: .1em .35em;
    border-radius: 4px;
    color: var(--primary);
}
.kb-body pre {
    background: var(--neutral-100);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 0 0 1.5rem;
}
.kb-body pre code {
    background: transparent;
    padding: 0;
    font-size: .95rem;
    line-height: 1.6;
}
.kb-body blockquote {
    border-left: 3px solid var(--primary-200);
    margin: 1.25rem 0;
    padding: .25rem 1rem;
    color: var(--neutral-500);
    font-style: italic;
}
.kb-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 1rem 0;
}
.kb-body hr {
    border: 0;
    border-top: 1px solid var(--neutral-200);
    margin: 2rem 0;
}

/* Numbered step block (used by tutorial-style articles) */
.kb-step {
    width: 100%;
    margin: 2rem 0;
}
.kb-step + .kb-step {
    margin-top: 2.5rem;
}
.kb-body .kb-step h3 {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0 0 1rem;
}
.kb-body .kb-step-num {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--success-600);
    color: #fff;
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}
.kb-body .kb-step-image {
    display: block;
    width: 100%;
    max-width: 350px;
    margin: 1rem 0 1.25rem;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
}
.kb-body .kb-step-image img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 24px;
}
/* Inner shadow sits in a sibling overlay so it paints over the image content
   (a real `box-shadow: inset` on <img> is hidden behind the image bitmap). */
.kb-body .kb-step-image::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 24px;
    pointer-events: none;
    box-shadow:
        inset 0 0 0 1px rgba(10, 26, 47, 0.06),
        inset 0 1px 3px rgba(10, 26, 47, 0.10);
}

/* Share */
.kb-share {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.kb-share-label {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    font-size: 1.125rem;
    line-height: 1.4;
    letter-spacing: -.015em;
    color: var(--primary);
    margin: 0;
}
.kb-share-row {
    display: flex;
    gap: 1rem;
}
.kb-share-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8f8f8;
    border: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
    text-decoration: none;
    position: relative;
}
.kb-share-badge:hover {
    background: var(--neutral-200);
    color: var(--primary);
    text-decoration: none;
    transform: translateY(-1px);
}
.kb-share-badge.copied {
    background: var(--success-600);
    color: #fff;
}
.kb-share-badge.copied::after {
    content: 'Copied';
    position: absolute;
    top: -1.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .75rem;
    font-weight: 500;
    padding: .25rem .5rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
}

/* Last-updated meta */
.kb-article-meta {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .875rem;
    color: var(--neutral-500);
    margin: .5rem 0 0;
}

/* Article page CTA has its own spacing (shared container wraps it) */
.kb-article-page .kb-cta {
    margin-top: 2.5rem;
    margin-bottom: 3rem;
}

/* --- Responsive --- */
@media (max-width: 767.98px) {
    .kb-container {
        padding: 3rem 1.25rem 3.5rem;
    }
    .kb-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .kb-card {
        padding: 1.25rem;
    }
    .kb-cta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    .kb-cta-contacts {
        gap: 1rem;
    }
    .kb-cta-body {
        flex-direction: column;
    }
    .kb-cta-head {
        min-width: 0;
    }
    .kb-article {
        gap: 1.5rem;
        margin-top: 1.5rem;
    }
    .kb-article-title {
        font-size: clamp(1.5rem, 5vw, 1.875rem);
    }
    .kb-article-summary {
        font-size: 1.0625rem;
    }
    .kb-body h2 {
        font-size: 1.375rem;
        margin-top: 1.5rem;
    }
    .kb-body h3 {
        font-size: 1.1875rem;
    }
    .kb-body p,
    .kb-body li {
        font-size: 1rem;
        line-height: 1.7;
    }
    .kb-breadcrumb-current {
        /* Wrap on tiny screens rather than truncate */
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}
