/* ==========================================================================
   legal.css — оформление страниц с юридическими документами
   Подключается один раз (шаблон сайта) или инлайнится в страницу CMS.
   Все селекторы ограничены областью .legal-page, поэтому файл не конфликтует
   с вёрсткой сайта.
   ========================================================================== */

.legal-page {
    --legal-accent: #1a1a1a;
    --legal-text: #262626;
    --legal-muted: #6b6b6b;
    --legal-border: #e2e2e2;
    --legal-bg-soft: #f7f7f7;
    --legal-radius: 10px;

    box-sizing: border-box;
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 0 48px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--legal-text);
    -webkit-text-size-adjust: 100%;
}

.legal-page *,
.legal-page *::before,
.legal-page *::after {
    box-sizing: border-box;
}

/* --- Заголовки ----------------------------------------------------------- */

.legal-page h1,
.legal-page .legal-title {
    margin: 0 0 24px;
    font-size: 30px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--legal-accent);
    letter-spacing: -0.01em;
}

.legal-page h2 {
    margin: 40px 0 16px;
    font-size: 21px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--legal-accent);
    scroll-margin-top: 90px;
}

.legal-page h3 {
    margin: 28px 0 12px;
    font-size: 17px;
    line-height: 1.4;
    font-weight: 600;
    color: var(--legal-accent);
}

/* --- Текст --------------------------------------------------------------- */

.legal-page p {
    margin: 0 0 14px;
}

.legal-page .legal-item {
    margin: 0 0 12px;
    padding-left: 2px;
}

.legal-page ul.legal-list,
.legal-page ol.legal-list {
    margin: 0 0 16px;
    padding-left: 24px;
}

.legal-page .legal-list li {
    margin: 0 0 8px;
}

.legal-page a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(0, 0, 0, .3);
    text-underline-offset: 2px;
}

.legal-page a:hover {
    text-decoration-color: currentColor;
}

.legal-page strong,
.legal-page b {
    font-weight: 600;
}

/* --- Содержание ---------------------------------------------------------- */

.legal-page .legal-toc {
    margin: 0 0 36px;
    padding: 18px 20px;
    border: 1px solid var(--legal-border);
    border-radius: var(--legal-radius);
    background: var(--legal-bg-soft);
}

.legal-page .legal-toc__title {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--legal-muted);
}

.legal-page .legal-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: toc;
}

.legal-page .legal-toc__list li {
    margin: 0;
    border-top: 1px solid var(--legal-border);
}

.legal-page .legal-toc__list li:first-child {
    border-top: 0;
}

.legal-page .legal-toc__list a {
    display: flex;
    gap: 10px;
    padding: 8px 2px;
    font-size: 15px;
    text-decoration: none;
}

.legal-page .legal-toc__list a:hover {
    text-decoration: underline;
}

.legal-page .legal-toc__num {
    flex: 0 0 auto;
    min-width: 26px;
    color: var(--legal-muted);
    font-variant-numeric: tabular-nums;
}

/* --- Таблицы ------------------------------------------------------------- */

.legal-page .legal-table-wrap {
    margin: 0 0 22px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--legal-border);
    border-radius: var(--legal-radius);
}

.legal-page .legal-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.5;
}

.legal-page .legal-table th,
.legal-page .legal-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border: 1px solid var(--legal-border);
}

.legal-page .legal-table thead th {
    background: var(--legal-bg-soft);
    font-weight: 600;
    color: var(--legal-accent);
    white-space: nowrap;
}

.legal-page .legal-table tbody th[scope="row"] {
    font-weight: 600;
    background: #fbfbfb;
}

.legal-page .legal-table__group th {
    background: #efefef;
    font-weight: 600;
    text-align: left;
    color: var(--legal-accent);
}

/* --- Служебный блок под документом -------------------------------------- */

.legal-page .legal-meta {
    margin: 32px 0 0;
    padding: 14px 16px;
    font-size: 14px;
    color: var(--legal-muted);
    border-left: 3px solid var(--legal-border);
}

/* --- Адаптив ------------------------------------------------------------- */

@media (max-width: 640px) {
    .legal-page {
        font-size: 15px;
    }

    .legal-page h1,
    .legal-page .legal-title {
        font-size: 24px;
    }

    .legal-page h2 {
        font-size: 18px;
        margin-top: 32px;
    }

    .legal-page .legal-toc {
        padding: 14px 14px;
    }
}

/* --- Каркас автономной страницы (для статических копий) ------------------ */

.legal-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    color: #262626;
}

.legal-shell__head,
.legal-shell__foot {
    padding: 18px 24px;
    border-bottom: 1px solid #e2e2e2;
}

.legal-shell__foot {
    margin-top: auto;
    border-bottom: 0;
    border-top: 1px solid #e2e2e2;
    font-size: 14px;
    color: #6b6b6b;
}

.legal-shell__head-inner,
.legal-shell__foot-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    align-items: center;
}

.legal-shell__brand {
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.legal-shell__nav {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 14px;
}

.legal-shell__nav a {
    color: #6b6b6b;
    text-decoration: none;
}

.legal-shell__nav a:hover {
    text-decoration: underline;
}

.legal-shell__main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 948px;
    margin: 0 auto;
    padding: 32px 24px 56px;
}

/* --- Чекбокс согласия в формах ------------------------------------------- */

.legal-consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 14px 0 18px;
    font-size: 13px;
    line-height: 1.5;
    color: #595959;
    text-align: left;
    cursor: pointer;
}

.legal-consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: #1a1a1a;
    cursor: pointer;
}

.legal-consent a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-consent--error {
    color: #c02626;
}

.legal-consent--error input[type="checkbox"] {
    outline: 2px solid #c02626;
    outline-offset: 1px;
}

.legal-consent__warning,
.legal-consent__error {
    display: block;
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: #c02626;
}

.legal-consent__warning:empty {
    display: none;
}

@media print {
    .legal-page {
        max-width: none;
        font-size: 11pt;
    }

    .legal-page .legal-toc {
        display: none;
    }

    .legal-page .legal-table {
        min-width: 0;
        font-size: 9pt;
    }
}
