/* ==========================================================================
   LEGAL PAGE STYLES
   Sidebar navigation, content typography, section counters.
   ========================================================================== */

.legal {
    padding-top: calc(var(--m-nav-height) + 64px);
    padding-bottom: 120px;
}

.legal-layout {
    max-width: var(--m-container);
    width: calc(100% - 2 * var(--m-margin));
    margin: 0 auto;
    padding: 0 var(--m-gutter);
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 80px;
    align-items: start;
}

/* --- Sidebar --- */

.legal-sidebar {
    position: sticky;
    top: calc(var(--m-nav-height) + 40px);
}

.legal-sidebar-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--m-text-light);
    margin-bottom: 16px;
}

.legal-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.legal-sidebar-link {
    display: block;
    padding: 6px 0 6px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--m-text);
    border-left: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    line-height: 1.5;
}

.legal-sidebar-link:hover {
    color: var(--m-navy);
}

.legal-sidebar-link.active {
    color: var(--m-navy);
    font-weight: 600;
    border-left-color: var(--m-blue);
}

.legal-sidebar-children {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-left: 16px;
}

.legal-sidebar-child {
    display: block;
    padding: 4px 0 4px 16px;
    font-size: 13px;
    font-weight: 450;
    color: var(--m-text-light);
    transition: color 0.15s ease;
    line-height: 1.6;
}

.legal-sidebar-child:hover {
    color: var(--m-navy);
}

/* --- Content area --- */

.legal-content {
    max-width: 720px;
    min-width: 0;
}

.legal-content h1 {
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 700;
    color: var(--m-navy);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 32px;
}

.legal-meta {
    font-size: 14px;
    font-weight: 600;
    color: var(--m-text);
    margin-bottom: 40px;
}

.legal-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--m-navy);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-top: 56px;
    margin-bottom: 20px;
}

.legal-content h3 {
    font-size: 18px;
    font-weight: 650;
    color: var(--m-navy);
    line-height: 1.3;
    margin-top: 40px;
    margin-bottom: 12px;
}

.legal-content p {
    font-size: 15px;
    color: var(--m-text);
    line-height: 1.75;
    margin-bottom: 16px;
}

.legal-content ul,
.legal-content ol {
    font-size: 15px;
    color: var(--m-text);
    line-height: 1.75;
    margin-bottom: 16px;
    padding-left: 24px;
}

.legal-content li {
    margin-bottom: 6px;
}

/* Top-level section list — numbers rendered via CSS counter on h2 */
.legal-content > ol {
    list-style: none;
    padding-left: 0;
    counter-reset: legal-section;
}

.legal-content > ol > li {
    counter-increment: legal-section;
}

.legal-content > ol > li > h2::before {
    content: counter(legal-section) ". ";
}

/* Nested lists inside sections keep their own numbering */
.legal-content > ol > li > ol {
    padding-left: 24px;
}

.legal-content a {
    color: var(--m-blue);
    text-decoration: underline;
    text-decoration-color: rgba(81, 138, 200, 0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.15s ease;
}

.legal-content a:hover {
    text-decoration-color: var(--m-blue);
}

.legal-content strong {
    font-weight: 600;
    color: var(--m-navy);
}

.legal-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 14px;
}

.legal-content th {
    text-align: left;
    font-weight: 600;
    color: var(--m-navy);
    padding: 10px 16px;
    border-bottom: 2px solid var(--m-border);
}

.legal-content td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--m-border);
    color: var(--m-text);
    vertical-align: top;
}

.legal-content blockquote {
    border-left: 3px solid var(--m-border);
    padding-left: 20px;
    margin: 24px 0;
    color: var(--m-text-light);
    font-style: italic;
}

.legal-content hr {
    border: none;
    border-top: 1px solid var(--m-border);
    margin: 48px 0;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .legal-layout {
        gap: 48px;
    }
}

@media (max-width: 768px) {
    .legal {
        padding-top: calc(var(--m-nav-height) + 40px);
        padding-bottom: 80px;
    }

    .legal-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .legal-sidebar {
        position: static;
        border-bottom: 1px solid var(--m-border);
        padding-bottom: 24px;
    }
}

@media (max-width: 480px) {
    .legal-content h1 {
        margin-bottom: 24px;
    }

    .legal-content h2 {
        margin-top: 40px;
    }
}
