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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    overflow-x: clip;
    background: var(--bg);
    color: var(--text);
    font-family: 'Manrope', sans-serif;
}

.legal {
    max-width: 780px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 64px) 24px 96px;
}

/* ===== Шапка ===== */

.legal__header {
    margin-bottom: 48px;
}

.legal__label {
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.legal__title {
    margin: 0 0 16px;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(40px, 5.5vw, 60px);
    font-weight: 600;
    line-height: 1.1;
}

.legal__date {
    margin: 0;
    color: #9ca3af;
    font-size: 15px;
}

.legal__empty {
    padding: 40px 24px;
    border: 1px dashed #2f3542;
    border-radius: 18px;
    color: #b4b9c4;
    text-align: center;
}

/* ===== Оглавление ===== */

.legal__toc {
    margin-bottom: 56px;
    padding: 28px 32px;
    background: #181b22;
    border: 1px solid #2a2f3a;
    border-radius: 18px;
    scroll-margin-top: calc(var(--nav-height) + 16px);
}

.legal__toc-title {
    margin: 0 0 16px;
    color: #b4b9c4;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.legal__toc ol {
    margin: 0;
    padding-left: 1.4em;
    color: var(--accent);
}

.legal__toc li {
    margin-bottom: 10px;
    padding-left: 4px;
}

.legal__toc li:last-child {
    margin-bottom: 0;
}

.legal__toc a {
    color: #d1d5db;
    font-size: 16px;
    line-height: 1.5;
    text-decoration: none;
    transition: color 0.2s ease;
}

.legal__toc a:hover {
    color: var(--accent);
}

/* ===== Разделы ===== */

.legal__section {
    padding: 32px 0;
    border-top: 1px solid #2a2f3a;
    scroll-margin-top: calc(var(--nav-height) + 16px);
}

.legal__section-title {
    display: flex;
    gap: 12px;
    margin: 0 0 18px;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
}

.legal__section-number {
    flex-shrink: 0;
    color: var(--accent);
}

.legal__section-text {
    color: #d1d5db;
    font-size: 17px;
    line-height: 1.8;
    white-space: pre-line;
    overflow-wrap: break-word;
}

.legal__up {
    display: inline-block;
    margin-top: 32px;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.legal a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ===== Мобильный ===== */

@media (max-width: 600px) {
    .legal {
        padding: calc(var(--nav-height) + 40px) 16px 64px;
    }

    .legal__header {
        margin-bottom: 32px;
    }

    .legal__toc {
        margin-bottom: 40px;
        padding: 22px 20px;
    }

    .legal__section {
        padding: 26px 0;
    }

    .legal__section-title {
        font-size: 19px;
    }

    .legal__section-text {
        font-size: 16px;
    }
}