/* ===================================
   Legal pages (privacy policy, terms)
   Light prose column with a sticky table of contents, sitting under the
   dark compact hero. Loaded only by the pages that need it.
   =================================== */

:root {
    --legal-ink: #0b2430;
    --legal-muted: #52656d;
    --legal-line: rgba(21, 64, 80, .14);
}

/* styles.css and home.css set overflow-x: hidden on html/body, which makes the
   page a scroll container and stops the table of contents from sticking. clip
   does the same job — no sideways scrolling — without that side effect. The
   .home-page selector is there to outrank home.css; only the pages that load
   this file are affected. */
html, body, body.home-page { overflow-x: clip; }

.legal {
    position: relative;
    padding: clamp(3rem, 5vw, 4.5rem) clamp(25px, 6vw, 120px) clamp(4rem, 7vw, 7rem);
    background: var(--service-bg);
}

.legal .container { max-width: 1400px; }

.legal-grid {
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    gap: clamp(2.5rem, 6vw, 6rem);
    align-items: start;
}

/* ---- Table of contents ---- */

.legal-toc { position: sticky; top: 7rem; }

.legal-toc-label {
    margin: 0 0 1.1rem;
    color: var(--legal-muted);
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
}

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

.legal-toc li { counter-increment: legal-toc; }

.legal-toc a {
    display: grid;
    grid-template-columns: 1.6rem 1fr;
    padding: .42rem 0;
    color: var(--legal-muted);
    font-size: .82rem;
    line-height: 1.45;
    text-decoration: none;
    transition: color .2s ease;
}

.legal-toc a::before {
    content: counter(legal-toc);
    color: rgba(21, 64, 80, .42);
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: .72rem;
}

.legal-toc a:hover { color: var(--legal-ink); }
.legal-toc a:hover::before { color: var(--color-gold, #dfa144); }

/* ---- Prose ---- */

.legal-body {
    max-width: 72ch;
    color: var(--legal-muted);
    counter-reset: legal-section;
}

.legal-body > p:first-child {
    padding-bottom: 1.6rem;
    margin-bottom: 2.4rem;
    border-bottom: 1px solid var(--legal-line);
    color: var(--legal-ink);
    font-size: 1.05rem;
    line-height: 1.7;
}

.legal-body h2 {
    counter-increment: legal-section;
    margin: 2.8rem 0 1rem;
    color: var(--legal-ink);
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    letter-spacing: -.02em;
    line-height: 1.25;
    scroll-margin-top: 7rem;
}

.legal-body h2::before {
    content: counter(legal-section) ". ";
    color: rgba(21, 64, 80, .4);
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: .8em;
    font-weight: 500;
}

.legal-body h2:first-of-type { margin-top: 0; }

.legal-body h3 {
    margin: 1.8rem 0 .7rem;
    color: var(--legal-ink);
    font-size: 1rem;
    letter-spacing: -.01em;
}

.legal-body p { margin: 0 0 1.05rem; font-size: .95rem; line-height: 1.8; }

.legal-body ul { margin: 0 0 1.05rem; padding-left: 1.1rem; }

.legal-body li {
    margin-bottom: .55rem;
    font-size: .95rem;
    line-height: 1.75;
}

.legal-body li::marker { color: rgba(21, 64, 80, .45); }

.legal-body strong { color: var(--legal-ink); font-weight: 650; }

.legal-body a {
    color: var(--legal-ink);
    text-decoration: underline;
    text-decoration-color: rgba(21, 64, 80, .35);
    text-underline-offset: .18em;
    transition: text-decoration-color .2s ease;
}

.legal-body a:hover { text-decoration-color: var(--color-gold, #dfa144); }

/* ---- Cookie list ---- */

.legal-cookies {
    margin: 0 0 1.4rem;
    border-top: 1px solid var(--legal-line);
}

.legal-cookies > div {
    display: grid;
    grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
    gap: .4rem 1.6rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--legal-line);
}

.legal-cookies dt {
    color: var(--legal-ink);
    font-family: var(--mono, 'DM Mono', monospace);
    font-size: .8rem;
    font-weight: 500;
    word-break: break-word;
}

.legal-cookies dd { margin: 0; font-size: .88rem; line-height: 1.65; }

/* ---- Footnote ---- */

.legal-updated {
    margin-top: 2.8rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--legal-line);
    font-size: .82rem;
}

@media (max-width: 900px) {
    .legal-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .legal-toc {
        position: static;
        padding-bottom: 1.8rem;
        border-bottom: 1px solid var(--legal-line);
    }
    .legal-toc ol { columns: 2; column-gap: 2rem; }
    .legal-body { max-width: none; }
}

@media (max-width: 560px) {
    .legal-toc ol { columns: 1; }
    .legal-cookies > div { grid-template-columns: 1fr; }
}
