/* The knowledge base (modules/kb, doc/kb.md) — on the theme's tokens, so it reads as the theme's own. */
.kb-wrap { width: min(100% - 2 * var(--s-5, 1.25rem), var(--w-container, 72rem)); margin: 0 auto; padding-block: var(--s-6, 2rem) var(--s-8, 3rem); }
.kb-muted { color: var(--c-text-muted); }

/* Home: a search hero, then the sections as cards */
.kb-hero { display: grid; justify-items: center; gap: var(--s-3, 0.75rem); margin-bottom: var(--s-8, 3rem); padding: var(--s-8, 3rem) var(--s-5, 1.25rem); border-radius: var(--r-lg, 0.75rem); background: var(--c-accent-soft, #eef2ff); text-align: center; }
.kb-hero__title { margin: 0; font-family: var(--font-display); font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem); line-height: 1.15; color: var(--c-text-strong); }
.kb-hero__lead { margin: 0; max-width: 40rem; color: var(--c-text-muted); font-size: var(--t-lg, 1.125rem); }
.kb-hero .kb-search { width: min(100%, 36rem); margin-top: var(--s-2, 0.5rem); }
.kb-search { display: flex; gap: var(--s-2, 0.5rem); }
.kb-search__input { flex: 1; min-width: 0; height: 3rem; padding: 0 1rem; border: 1px solid var(--c-border); border-radius: var(--r-md, 0.5rem); background: var(--c-surface, #fff); color: var(--c-text); font: inherit; }
.kb-search__btn { flex: none; }
.kb-audience { margin-bottom: var(--s-8, 3rem); }
.kb-audience__title { margin: 0 0 var(--s-4, 1rem); font-size: clamp(1.4rem, 1.1rem + 1vw, 1.85rem); color: var(--c-text-strong); }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: var(--s-5, 1.25rem); }
.kb-card { display: flex; flex-direction: column; gap: var(--s-2, 0.5rem); padding: var(--s-5, 1.25rem); border-radius: var(--r-lg, 0.75rem); background: var(--c-surface, #fff); box-shadow: 0 0 0 1px var(--c-border); }
.kb-card__title { display: flex; align-items: center; gap: 0.6rem; margin: 0; font-size: 1.15rem; line-height: 1.3; }
.kb-card__title a { color: var(--c-text-strong); text-decoration: none; }
.kb-card__title a:hover { color: var(--c-link); }
.kb-card__icon { display: inline-grid; flex: none; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: var(--r-md, 0.5rem); background: var(--c-accent-soft, #eef2ff); color: var(--c-accent); }
.kb-card__icon .cms-icon { width: 1.15rem; height: 1.15rem; }
.kb-card__text { margin: 0; color: var(--c-text-muted); font-size: var(--t-sm, 0.9rem); }
.kb-card__list { display: grid; gap: 0.35rem; margin: var(--s-2, 0.5rem) 0 0; padding: 0; list-style: none; font-size: var(--t-sm, 0.95rem); }
.kb-card__list a { color: var(--c-text); text-decoration: none; }
.kb-card__list a:hover { color: var(--c-link); text-decoration: underline; }
.kb-card__more { margin-top: auto; padding-top: var(--s-2, 0.5rem); font-size: var(--t-sm, 0.875rem); font-weight: 600; }

/* Lists of articles (section, search) */
.kb-list { display: grid; gap: var(--s-2, 0.5rem); margin: 0; padding: 0; list-style: none; counter-reset: kb; }
.kb-list__link { display: grid; gap: 0.2rem; padding: var(--s-3, 0.75rem) var(--s-4, 1rem); border-radius: var(--r-md, 0.5rem); box-shadow: 0 0 0 1px var(--c-border); color: var(--c-text-strong); text-decoration: none; }
.kb-list__link:hover { box-shadow: 0 0 0 1px var(--c-accent); }
.kb-list__link span { color: var(--c-text-muted); font-size: var(--t-sm, 0.9rem); }
.kb-found__count { color: var(--c-text-muted); }

/* Section and article pages: the section's nav at the side */
.kb-layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: var(--s-8, 3rem); align-items: start; }
.kb-side { position: sticky; top: var(--s-5, 1.25rem); display: grid; gap: var(--s-4, 1rem); }
.kb-side .kb-search__input { height: 2.5rem; }
.kb-side .kb-search__btn { display: none; }
.kb-side__title { margin: 0 0 var(--s-2, 0.5rem); font-size: var(--t-xs, 0.8rem); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-text-faint, #888); }
.kb-side__title a { color: inherit; text-decoration: none; }
.kb-side__nav ul, .kb-side__nav ol { display: grid; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }
.kb-side__nav a { display: block; padding: 0.35rem 0.6rem; border-radius: var(--r-sm, 0.375rem); color: var(--c-text-muted); font-size: var(--t-sm, 0.9rem); line-height: 1.35; text-decoration: none; }
.kb-side__nav a:hover { background: var(--c-surface-sunk, #f3f4f6); color: var(--c-text); }
.kb-side__nav a[aria-current="page"] { background: var(--c-accent-soft, #eef2ff); color: var(--c-accent); font-weight: 600; }
.kb-main { min-width: 0; max-width: 48rem; }
.kb-crumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--s-3, 0.75rem); color: var(--c-text-faint, #888); font-size: var(--t-sm, 0.875rem); }
.kb-crumbs a { color: var(--c-text-muted); }
.kb-title { margin: 0 0 var(--s-3, 0.75rem); font-family: var(--font-display); font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); line-height: 1.15; color: var(--c-text-strong); }
.kb-lead { margin: 0 0 var(--s-5, 1.25rem); color: var(--c-text-muted); font-size: var(--t-lg, 1.15rem); }
.kb-toc { margin: 0 0 var(--s-6, 2rem); padding: var(--s-4, 1rem) var(--s-5, 1.25rem); border-left: 3px solid var(--c-accent); border-radius: 0 var(--r-md, 0.5rem) var(--r-md, 0.5rem) 0; background: var(--c-surface-sunk, #f6f7f9); }
.kb-toc__title { margin: 0 0 var(--s-2, 0.5rem); font-weight: 700; color: var(--c-text-strong); }
.kb-toc ol { display: grid; gap: 0.25rem; margin: 0; padding-left: 1.2rem; }
.kb-toc__item--h3 { margin-left: 1rem; list-style: circle; font-size: var(--t-sm, 0.9rem); }

/* The text */
.kb-body { font-size: var(--t-base, 1rem); line-height: 1.7; }
.kb-body.cms-prose h2, .kb-body h2 { margin: 2.25rem 0 0.75rem; font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.65rem); line-height: 1.25; scroll-margin-top: 5rem; }
.kb-body.cms-prose h3, .kb-body h3 { margin: 1.75rem 0 0.5rem; font-size: 1.2rem; line-height: 1.3; scroll-margin-top: 5rem; }
.kb-body img { max-width: 100%; height: auto; }
.kb-figure { margin: var(--s-5, 1.25rem) 0; }
.kb-figure img { display: block; border-radius: var(--r-md, 0.5rem); box-shadow: 0 0 0 1px var(--c-border), 0 8px 24px rgba(0, 0, 0, 0.06); }
.kb-figure figcaption { margin-top: var(--s-2, 0.5rem); color: var(--c-text-muted); font-size: var(--t-sm, 0.875rem); text-align: center; }
.kb-body code { padding: 0.1em 0.35em; border-radius: 0.3em; background: var(--c-surface-sunk, #f3f4f6); font-size: 0.9em; }
.kb-body pre { overflow-x: auto; padding: var(--s-4, 1rem); border-radius: var(--r-md, 0.5rem); background: #1e2330; color: #e6e9f0; font-size: 0.875rem; line-height: 1.55; }
.kb-body pre code { padding: 0; background: none; color: inherit; }
.kb-table { overflow-x: auto; margin: var(--s-4, 1rem) 0; }
.kb-table table { width: 100%; border-collapse: collapse; font-size: var(--t-sm, 0.92rem); }
.kb-table th, .kb-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
.kb-table th { background: var(--c-surface-sunk, #f6f7f9); font-weight: 600; }
.kb-note { margin: var(--s-4, 1rem) 0; padding: var(--s-3, 0.75rem) var(--s-4, 1rem); border-left: 4px solid #3b82f6; border-radius: 0 var(--r-md, 0.5rem) var(--r-md, 0.5rem) 0; background: #eff6ff; }
.kb-note--tip { border-color: #16a34a; background: #f0fdf4; }
.kb-note--warning { border-color: #d97706; background: #fffbeb; }
.kb-note p { margin: 0.25rem 0; }

/* «Была ли статья полезна?», pager, related */
.kb-feedback { margin: var(--s-8, 3rem) 0 var(--s-5, 1.25rem); padding: var(--s-5, 1.25rem); border-radius: var(--r-lg, 0.75rem); background: var(--c-surface-sunk, #f6f7f9); text-align: center; }
.kb-feedback__q { margin: 0 0 var(--s-3, 0.75rem); font-weight: 600; color: var(--c-text-strong); }
.kb-feedback__buttons { display: flex; justify-content: center; gap: var(--s-2, 0.5rem); }
.kb-feedback__more { display: grid; gap: var(--s-2, 0.5rem); max-width: 30rem; margin: var(--s-4, 1rem) auto 0; text-align: left; }
.kb-feedback__more textarea { padding: 0.6rem; border: 1px solid var(--c-border); border-radius: var(--r-md, 0.5rem); font: inherit; }
.kb-feedback__thanks { margin: 0; font-weight: 600; color: var(--c-text-strong); }
.kb-pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4, 1rem); margin: var(--s-5, 1.25rem) 0; }
.kb-pager a { display: grid; gap: 0.2rem; padding: var(--s-3, 0.75rem) var(--s-4, 1rem); border-radius: var(--r-md, 0.5rem); box-shadow: 0 0 0 1px var(--c-border); color: var(--c-text-strong); text-decoration: none; }
.kb-pager a:hover { box-shadow: 0 0 0 1px var(--c-accent); }
.kb-pager span { color: var(--c-text-faint, #888); font-size: var(--t-xs, 0.8rem); }
.kb-pager__next { text-align: right; }
.kb-related h2 { font-size: var(--t-lg, 1.125rem); }

@media (max-width: 860px) {
    .kb-layout { grid-template-columns: 1fr; gap: var(--s-5, 1.25rem); }
    .kb-side { position: static; }
    .kb-side__nav { display: none; }
    .kb-pager { grid-template-columns: 1fr; }
    .kb-hero { padding: var(--s-6, 2rem) var(--s-4, 1rem); }
}
