/* База знаний (/knowledgebase/).
   Вёрстка перенесена из приложения (pages/knowledgebase/*, components/knowledgebase/*),
   чтобы раздел выглядел одинаково на лендинге и внутри системы. Значения — те же,
   что в собранном CSS приложения, только без scoped-атрибутов Vue. */

/* Глобального .container на лендинге нет — каждый раздел задаёт свой.
   Берём те же значения, что у блога, чтобы края совпадали с остальным сайтом. */
.kb-section { padding: 8px 0 64px; }
.kb-section .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Шапка раздела ── */
.kb-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 0;
    margin-bottom: 16px;
}
.kb-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 13px;
}
.kb-crumb-link { color: #6b7280; text-decoration: none; }
.kb-crumb-link:hover { text-decoration: underline; }
.kb-crumb--active { color: #111827; font-weight: 700; }
.kb-h1 {
    font-size: 44px;
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: 0;
    color: #0f172a;
    margin: 0;
}
.kb-subtitle { color: #6b7280; font-size: 16px; margin-top: 6px; }

/* ── Поиск ── */
.kb-search { display: flex; align-items: center; gap: 10px; margin: 12px 0 24px; }
.kb-search__input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    border: 1px solid #d9dde5;
    border-radius: 12px;
    font-size: 16px;
    color: #0f172a;
    background: #fff;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.kb-search__input:focus { border-color: #0027F3; box-shadow: 0 0 0 3px rgba(0, 39, 243, .12); }
.kb-search__btn {
    height: 48px;
    padding: 0 26px;
    border: 0;
    border-radius: 12px;
    background: #0027F3;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.kb-search__btn:hover { background: #0020c9; }

/* ── Облако хештегов (свёрнуто через <details>, работает без JS) ── */
.kb-tagcloud { margin-bottom: 28px; }
.kb-tagcloud__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.kb-tagcloud__toggle::-webkit-details-marker { display: none; }
.kb-tagcloud__toggle::after {
    content: '';
    width: 8px; height: 8px;
    border-right: 2px solid #6b7280;
    border-bottom: 2px solid #6b7280;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .18s ease;
}
.kb-tagcloud[open] .kb-tagcloud__toggle::after { transform: rotate(-135deg) translate(-2px, -2px); }
.kb-tagcloud__toggle:hover { border-color: #c7d2fe; }
.kb-tagcloud__total {
    font-size: 12px; font-weight: 700; color: #0027F3;
    background: #eef2ff; border-radius: 999px; padding: 2px 8px;
}
.kb-tagcloud__list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kb-tagcloud__item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 999px;
    border: 1px solid transparent; background: #eef2ff; color: #4338ca;
    font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.kb-tagcloud__item:hover { background: #e0e7ff; border-color: #c7d2fe; color: #3730a3; }
.kb-tagcloud__item--active { background: #0027F3; color: #fff; }
.kb-tagcloud__count { font-size: 12px; opacity: .75; }

/* ── Раскладка: сайдбар + контент ── */
.kb-layout { display: grid; grid-template-columns: 280px 1fr; gap: 40px; }
.kb-main { min-width: 0; }

/* Сайдбар — <details> без JS: на широком экране раскрыт принудительно (правило
   ниже), на узком свёрнут, чтобы список категорий не отжимал статьи вниз. */
.kb-side { background: #fff; padding: 18px 0; position: sticky; top: 24px; align-self: start; }
.kb-side__title {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-weight: 600; color: #111827; font-size: 22px; margin-bottom: 14px;
    list-style: none; cursor: pointer;
}
.kb-side__title::-webkit-details-marker { display: none; }
.kb-side__title::after {
    content: '';
    width: 9px; height: 9px;
    border-right: 2px solid #6b7280; border-bottom: 2px solid #6b7280;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .18s ease;
}
.kb-side[open] .kb-side__title::after { transform: rotate(-135deg) translate(-2px, -2px); }
/* display НЕ задаём в базовом правиле: оно перебило бы браузерное скрытие
   содержимого закрытого <details>, и сайдбар не сворачивался бы нигде. */
.kb-side__list { flex-direction: column; gap: 1px; }
.kb-side[open] > .kb-side__list { display: flex; }
.kb-side__item {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px;
    color: #0f172a; font-size: 16px; line-height: 1.25; text-decoration: none;
}
.kb-side__item:hover { background: #f3f4f6; }
.kb-side__item.active { background: #eef2ff; color: #4338ca; font-weight: 600; }
.kb-side__count { font-size: 14px; font-weight: 600; color: #0027F3; min-width: 28px; text-align: right; }
.kb-side__item.active .kb-side__count { color: #4338ca; }

.kb-main-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; margin-bottom: 14px;
}
.kb-main-head__left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.kb-h3 { font-size: 36px; font-weight: 600; line-height: 1.1; margin: 0; color: #0f172a; }
.kb-main-meta { color: #6b7280; font-size: 14px; white-space: nowrap; }
.kb-main-meta__reset { color: #0027F3; text-decoration: none; }
.kb-main-meta__reset:hover { text-decoration: underline; }

/* ── Карточки ── */
.kb-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.kb-card {
    display: block;
    border-radius: 18px; overflow: hidden;
    border: 1px solid #eef0f3; background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}
.kb-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(15, 23, 42, .1); }
.kb-card__hero {
    height: 150px; padding: 14px;
    display: flex; align-items: flex-start;
    background-size: cover; background-position: center;
}
.kb-card__hero--no-cover { flex-direction: column; justify-content: center; padding: 18px 20px; position: relative; }
.kb-card__hero--no-cover .kb-card__hero-label { position: absolute; top: 14px; left: 14px; }
.kb-card__hero-label {
    color: rgba(255, 255, 255, .82); font-weight: 600; font-size: 12px;
    letter-spacing: .3px; text-transform: uppercase;
}
.kb-card__hero-title {
    color: #fff; font-weight: 700; font-size: 18px; line-height: 1.25; text-align: center;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.kb-card__body { padding: 16px 16px 18px; background: #fff; }
.kb-card__meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.kb-card__badge {
    display: inline-flex; gap: 8px; align-items: center;
    font-size: 14px; color: #0f172a; background: #f1f5f9;
    padding: 6px 12px; border-radius: 999px; font-weight: 600;
}
.kb-card__badge-ico { font-size: 12px; }
.kb-card__tag {
    display: inline-flex; align-items: center;
    font-size: 14px; color: #4338ca; background: #eef2ff;
    padding: 6px 12px; border-radius: 999px; font-weight: 600; text-decoration: none;
}
a.kb-card__tag:hover { background: #e0e7ff; }
.kb-card__title { font-weight: 600; color: #0f172a; font-size: 22px; line-height: 1.15; margin-bottom: 8px; }
.kb-card__excerpt { color: #475569; font-size: 15px; line-height: 1.6; max-height: 70px; overflow: hidden; }
.kb-card__tags { margin-top: 12px; }
.kb-card__more { margin-top: 12px; font-weight: 600; color: #0027F3; }

/* Пять градиентов обложки — вариант выбирается по хешу «категория:слаг»,
   тем же, что в приложении, поэтому у статьи там и тут одна обложка. */
.kb-card__hero.v1 { background-image: linear-gradient(135deg, #3b5ee8 0%, #9b7de8 45%, #d97fb3 100%); }
.kb-card__hero.v2 { background-image: linear-gradient(135deg, #5b6abf 0%, #4a6fd4 55%, #5cb88a 120%); }
.kb-card__hero.v3 { background-image: linear-gradient(135deg, #47b0d6 0%, #4a6fd4 55%, #b07dd4 120%); }
.kb-card__hero.v4 { background-image: linear-gradient(135deg, #e09050 0%, #d47fa0 55%, #4a6fd4 120%); }
.kb-card__hero.v5 { background-image: linear-gradient(135deg, #48a06a 0%, #47b0d6 55%, #4a6fd4 120%); }

.kb-empty { color: #6b7280; padding: 14px 0; }

/* ── Хештеги ── */
.kb-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.kb-tags__item {
    display: inline-flex; align-items: center;
    font-size: 14px; font-weight: 600; line-height: 1;
    color: #4338ca; background: #eef2ff; border: 1px solid transparent;
    padding: 7px 12px; border-radius: 999px; text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
a.kb-tags__item:hover { background: #e0e7ff; border-color: #c7d2fe; color: #3730a3; }
.kb-tags--sm .kb-tags__item { font-size: 13px; padding: 5px 10px; }

/* ── Статья ── */
.kb-article { min-width: 0; }
.kb-article__cover {
    display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover;
    border: 1px solid #eef0f3; border-radius: 12px; margin: 0 0 18px;
}
.kb-article__title { font-size: 40px; font-weight: 600; line-height: 1.1; color: #0f172a; margin: 0 0 14px; }
.kb-article__meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.kb-article__tags { margin: 0 0 24px; }
.kb-article__body { color: #1f2937; font-size: 17px; line-height: 1.7; }
.kb-article__body img { max-width: 100%; height: auto; border-radius: 10px; }
.kb-article__body h2 { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 32px 0 12px; color: #0f172a; }
.kb-article__body h3 { font-size: 22px; font-weight: 600; line-height: 1.25; margin: 26px 0 10px; color: #0f172a; }
.kb-article__body p { margin: 0 0 14px; }
.kb-article__body ul, .kb-article__body ol { margin: 0 0 14px; padding-left: 22px; }
.kb-article__body li { margin-bottom: 6px; }
.kb-article__body a { color: #0027F3; text-decoration: underline; text-underline-offset: 3px; }
.kb-article__body table { width: 100%; border-collapse: collapse; margin: 0 0 16px; display: block; overflow-x: auto; }
.kb-article__body td, .kb-article__body th { border: 1px solid #e5e7eb; padding: 8px 12px; }
.kb-article__video { position: relative; padding-top: 56.25%; margin: 28px 0 0; }
.kb-article__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 12px; }

/* ── «Вам также может быть интересно» ── */
.kb-related { margin-top: 56px; padding-top: 36px; border-top: 1px solid #e8eaf0; }
.kb-related__title { font-size: 24px; font-weight: 600; color: #0f172a; margin: 0 0 20px; }
.kb-related__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.kb-related__card {
    display: flex; flex-direction: column; gap: 8px;
    padding: 18px; border: 1px solid #eef0f3; border-radius: 14px; background: #fff;
    text-decoration: none;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.kb-related__card:hover {
    border-color: rgba(0, 39, 243, .35);
    box-shadow: 0 8px 24px rgba(0, 39, 243, .08);
    transform: translateY(-3px);
}
.kb-related__cat { color: #4338ca; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.kb-related__name { color: #0f172a; font-size: 16px; font-weight: 600; line-height: 1.35; }
.kb-related__excerpt { color: #6b7280; font-size: 14px; line-height: 1.55; }

/* ── Адаптив: те же точки, что в приложении ── */
/* Широкий экран: сворачивать нечего — заголовок ведёт себя как заголовок,
   а не как кнопка. pointer-events отключаем, чтобы случайный клик не схлопнул
   список (скрипт снимает `open` только на узком экране). */
@media (min-width: 1025px) {
    .kb-side__title { cursor: default; pointer-events: none; }
    .kb-side__title::after { display: none; }
}

@media (max-width: 1200px) {
    .kb-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kb-related__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .kb-layout { grid-template-columns: 1fr; gap: 24px; }
    /* Сайдбар на узком экране уезжает НАВЕРХ, а не прячется: на лендинге нет
       модального меню категорий, которое в приложении открывает кнопка. */
    .kb-side { position: static; padding: 0 0 8px; }
    .kb-side__title {
        margin-bottom: 0; padding: 12px 14px; font-size: 18px;
        border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
    }
    .kb-side[open] .kb-side__title { margin-bottom: 10px; }
    .kb-h1 { font-size: 34px; }
    .kb-h3 { font-size: 28px; }
    .kb-article__title { font-size: 32px; }
}
@media (max-width: 640px) {
    .kb-h1 { font-size: 28px; }
    .kb-h3 { font-size: 22px; }
    .kb-article__title { font-size: 26px; }
    .kb-cards, .kb-related__grid { grid-template-columns: 1fr; }
    .kb-search { flex-wrap: wrap; }
    .kb-search__input { flex: 1 1 100%; }
    .kb-search__btn { width: 100%; }
    .kb-main-head { flex-direction: column; align-items: flex-start; gap: 4px; }
    .kb-main-meta { white-space: normal; }
}
