/*
 * HelpSpot theme.
 * Идея: сайт как домашний справочник с цветными закладками-рубриками.
 * Цвет рубрики задаётся через data-cat и используется только для меток,
 * текст всегда остаётся тёмным (контраст).
 */

:root {
    --ink: #22313a;
    --ink-soft: #5a6b73;
    --paper: #ffffff;
    --mist: #eef2f0;
    --rule: #d8e0dc;
    --brand: #9c2e5f;
    --cat: var(--brand);

    --font-ui: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-read: "Literata", Georgia, "Times New Roman", serif;

    --wrap: 1200px;
    --gutter: 16px;
    --aside: 300px;
    --radius: 6px;
}

@media (min-width: 768px) {
    :root { --gutter: 24px; }
}

[data-cat="health"] { --cat: #2a8c7a; }
[data-cat="food"] { --cat: #d07a1f; }
[data-cat="lifestyle"] { --cat: #6b5cb5; }
[data-cat="sport"] { --cat: #2f6db5; }
[data-cat="beauty"] { --cat: #b0478a; }
[data-cat="house"] { --cat: #4f8a2e; }
[data-cat="children"] { --cat: #e0a21b; }
[data-cat="relationships"] { --cat: #c23b4e; }

/* ---------- База ---------- */

body.hs {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.hs a { color: inherit; text-decoration: none; }
.hs a:hover { color: var(--brand); }
.hs :focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.hs img { max-width: 100%; height: auto; }

.hs-wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.hs-skip {
    position: absolute;
    left: -9999px;
}
.hs-skip:focus {
    left: var(--gutter);
    top: 8px;
    z-index: 100;
    background: var(--paper);
    padding: 8px 12px;
}

/* ---------- Шапка ---------- */

.hs-header { background: var(--mist); }

.hs-header__top {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-top: 20px;
    padding-bottom: 16px;
}

.hs-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: -0.02em;
    line-height: 1;
}
.hs-logo:hover { color: var(--ink); }

/* Знак: четыре закладки-рубрики */
.hs-logo__mark {
    display: inline-grid;
    grid-template-columns: repeat(4, 5px);
    gap: 3px;
    align-items: end;
    height: 24px;
}
.hs-logo__mark i { display: block; border-radius: 1px 1px 0 0; }
.hs-logo__mark i:nth-child(1) { height: 14px; background: #2a8c7a; }
.hs-logo__mark i:nth-child(2) { height: 22px; background: #d07a1f; }
.hs-logo__mark i:nth-child(3) { height: 18px; background: #b0478a; }
.hs-logo__mark i:nth-child(4) { height: 12px; background: #2f6db5; }

.hs-tagline {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.hs-admin {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 0.875rem;
    color: var(--ink-soft);
}

@media (max-width: 767.98px) {
    .hs-tagline { display: none; }
}

/* Закладки рубрик */
.hs-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-top: 4px;
}
.hs-tabs::-webkit-scrollbar { display: none; }

.hs-tab {
    flex: 0 0 auto;
    position: relative;
    padding: 12px 16px 11px;
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.45);
}
.hs-tab::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--cat);
}
.hs .hs-tab:hover { color: var(--ink); background: var(--paper); }
.hs-tab[aria-current="page"] { background: var(--paper); }
.hs-tab[aria-current="page"]::before { height: 6px; }

/* ---------- Рекламные места ---------- */

.hs-ad {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.hs-ad__label {
    align-self: stretch;
    margin-bottom: 4px;
    font-size: 0.7rem;
    color: var(--ink-soft);
    text-align: center;
}

.hs-ad--header,
.hs-ad--footer { max-width: 100%; min-height: 100px; }
@media (min-width: 768px) {
    .hs-ad--header,
    .hs-ad--footer { min-height: 90px; }
}
.hs-ad--sidebar { width: 300px; max-width: 100%; min-height: 250px; }
.hs-ad--sidebar-sticky { width: 300px; max-width: 100%; min-height: 600px; }

.hs-adrow { padding: 24px 0; }
.hs-adrow--footer { padding: 40px 0; border-top: 1px solid var(--rule); }

/* Заглушка видна только локально (APP_ENV=local), в проде пустое место схлопывается */
.hs-ad--placeholder {
    border: 2px dashed var(--rule);
    border-radius: var(--radius);
    background: repeating-linear-gradient(-45deg, transparent 0 10px, var(--mist) 10px 20px);
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-align: center;
}
.hs-ad--placeholder.hs-ad--header,
.hs-ad--placeholder.hs-ad--footer { width: 320px; height: 100px; }
@media (min-width: 768px) {
    .hs-ad--placeholder.hs-ad--header,
    .hs-ad--placeholder.hs-ad--footer { width: 728px; height: 90px; }
}
.hs-ad--placeholder.hs-ad--sidebar { height: 250px; }
.hs-ad--placeholder.hs-ad--sidebar-sticky { height: 600px; }

/* ---------- Сетка страницы ---------- */

.hs-main { padding-bottom: 48px; }

.hs-layout {
    display: grid;
    gap: 40px;
}
@media (min-width: 992px) {
    .hs-layout {
        grid-template-columns: minmax(0, 1fr) var(--aside);
        gap: 48px;
    }
}

.hs-aside {
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.hs-aside__sticky {
    position: sticky;
    top: 24px;
}
@media (max-width: 991.98px) {
    .hs-aside { align-items: center; }
    .hs-aside > * { width: 100%; max-width: 480px; }
    /* 300×600 на телефоне слишком тяжёлый — только на десктопе */
    .hs-aside__sticky { display: none; }
}

/* ---------- Метки рубрик и даты ---------- */

.hs-cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
}
.hs-cat::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--cat);
}

.hs-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin-bottom: 8px;
}
.hs-date {
    font-size: 0.8rem;
    color: var(--ink-soft);
}

/* ---------- Главный материал ---------- */

.hs-lead {
    display: grid;
    gap: 24px;
    padding: 32px 0 40px;
}
@media (min-width: 992px) {
    .hs-lead {
        grid-template-columns: 7fr 5fr;
        gap: 40px;
        align-items: center;
    }
}
.hs-lead__img {
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--mist);
}
.hs-lead__img img { width: 100%; height: 100%; object-fit: cover; }
.hs-lead__title {
    margin: 4px 0 16px;
    font-size: clamp(1.75rem, 3.2vw, 2.6rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
.hs-lead__intro {
    margin: 0;
    font-family: var(--font-read);
    font-size: 1.125rem;
    line-height: 1.65;
    color: var(--ink-soft);
}
.hs-lead__intro p { margin: 0; }

/* ---------- Заголовки разделов ---------- */

.hs-section + .hs-section { margin-top: 56px; }

.hs-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-top: 14px;
    border-top: 4px solid var(--cat);
}
.hs-section__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.hs-section__more {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-soft);
    white-space: nowrap;
}

/* ---------- Карточки ---------- */

.hs-grid {
    display: grid;
    gap: 32px 24px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.hs-card { display: flex; flex-direction: column; }
.hs-card__img {
    display: block;
    aspect-ratio: 5 / 3;
    margin-bottom: 12px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--mist);
}
.hs-card__img img { width: 100%; height: 100%; object-fit: cover; }
.hs-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    text-wrap: pretty;
}

/* Строка списка: картинка слева, текст справа */
.hs-row {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 16px;
    padding: 24px 0;
    border-bottom: 1px solid var(--rule);
}
.hs-row:first-child { padding-top: 0; }
@media (min-width: 768px) {
    .hs-row { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
}
.hs-row__img {
    display: block;
    aspect-ratio: 5 / 3;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--mist);
}
.hs-row__img img { width: 100%; height: 100%; object-fit: cover; }

/* Нет картинки — плашка в цвет рубрики, чтобы сетка не ломалась */
.hs-card__img--empty,
.hs-row__img--empty { background: color-mix(in srgb, var(--cat) 16%, var(--mist)); }
.hs-row__title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.3;
}
.hs-row__intro {
    margin: 0;
    font-family: var(--font-read);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink-soft);
}
@media (max-width: 767.98px) {
    .hs-row__intro { display: none; }
    .hs-row__title { font-size: 1.05rem; }
}

/* Короткий список в сайдбаре */
.hs-list__title {
    margin: 0 0 8px;
    padding-top: 12px;
    border-top: 4px solid var(--cat);
    font-size: 1.1rem;
    font-weight: 700;
}
.hs-list ul { margin: 0; padding: 0; list-style: none; }
.hs-mini {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
}
.hs-mini--noimg { grid-template-columns: minmax(0, 1fr); }
.hs-mini__img {
    display: block;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    background: var(--mist);
}
.hs-mini__img img { width: 100%; height: 100%; object-fit: cover; }
.hs-mini__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
}

/* ---------- Страница рубрики / тега ---------- */

.hs-pagehead {
    padding: 32px 0 24px;
}
.hs-pagehead__title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.hs-pagehead__title::before {
    content: "";
    flex: 0 0 auto;
    width: 14px;
    height: 0.9em;
    border-radius: 3px;
    background: var(--cat);
}

/* ---------- Статья ---------- */

.hs-article { padding-top: 16px; }
.hs-article__title {
    margin: 4px 0 20px;
    font-size: clamp(1.9rem, 4vw, 2.9rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    text-wrap: balance;
    max-width: 22em;
}
.hs-article__intro {
    margin-bottom: 28px;
    font-family: var(--font-read);
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--ink-soft);
    max-width: 38em;
}
.hs-article__intro p { margin: 0; }
.hs-article__img {
    margin: 0 0 32px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--mist);
}
.hs-article__img img { display: block; width: 100%; }

.hs-prose {
    max-width: 38em;
    font-family: var(--font-read);
    font-size: 1.125rem;
    line-height: 1.75;
}
.hs-prose p,
.hs-prose ul,
.hs-prose ol,
.hs-prose blockquote,
.hs-prose table { margin: 0 0 1.25em; }
.hs-prose h2,
.hs-prose h3,
.hs-prose h4 {
    margin: 1.8em 0 0.6em;
    font-family: var(--font-ui);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.hs-prose h2 { font-size: 1.5rem; }
.hs-prose h3 { font-size: 1.25rem; }
.hs-prose h4 { font-size: 1.1rem; }
.hs-prose ul,
.hs-prose ol { padding-left: 1.4em; }
.hs-prose li { margin-bottom: 0.4em; }
.hs-prose li::marker { color: var(--cat); }
.hs-prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.hs-prose blockquote {
    padding: 4px 0 4px 20px;
    border-left: 4px solid var(--cat);
    font-style: italic;
    color: var(--ink-soft);
}
.hs-prose img { border-radius: var(--radius); }
.hs-prose table { width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: 0.95rem; }
.hs-prose th,
.hs-prose td { padding: 8px 10px; border-bottom: 1px solid var(--rule); text-align: left; }
.hs-prose iframe,
.hs-article__video iframe { max-width: 100%; }
.hs-article__video { margin-bottom: 32px; }
.hs-article__video iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; }

.hs-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 32px 0 0;
    padding: 24px 0 0;
    border-top: 1px solid var(--rule);
    list-style: none;
}
.hs-tags a {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--mist);
    font-size: 0.875rem;
}

/* ---------- Пагинация (разметка Bootstrap) ---------- */

.hs-pager { margin-top: 40px; }
.hs .pagination { flex-wrap: wrap; gap: 4px; }
.hs .page-link {
    border: 0;
    border-radius: var(--radius) !important;
    color: var(--ink);
    background: var(--mist);
    font-weight: 500;
}
.hs .page-link:hover { background: var(--rule); color: var(--ink); }
.hs .page-item.active .page-link { background: var(--ink); color: var(--paper); }
.hs .page-item.disabled .page-link { background: transparent; color: var(--rule); }

/* ---------- Подвал ---------- */

.hs-footer {
    background: var(--ink);
    color: #d3dde1;
    padding: 48px 0 24px;
    font-size: 0.95rem;
}
.hs-footer a:hover { color: var(--paper); }
.hs-footer__grid {
    display: grid;
    gap: 32px;
}
@media (min-width: 768px) {
    .hs-footer__grid { grid-template-columns: 4fr 3fr 5fr; gap: 48px; }
}
.hs-footer .hs-logo { color: var(--paper); margin-bottom: 16px; }
.hs-footer__about { margin: 0; max-width: 34em; line-height: 1.6; }
.hs-footer__title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--paper);
}
.hs-footer ul { margin: 0; padding: 0; list-style: none; }
.hs-footer li { margin-bottom: 8px; }
.hs-footer .hs-cat { color: inherit; font-size: 0.95rem; font-weight: 400; }
.hs-footer__cats { columns: 2; column-gap: 24px; }
.hs-footer__legal {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.85rem;
    color: #97a8b0;
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Пустое рекламное место в проде — убираем и отступы вокруг */
.hs-adrow:not(:has(.hs-ad)) { display: none; }
