/* legal.css — Terms of Service, Privacy Policy, and similar document
 * pages. Reading-first typography: serif body, sans-serif headings,
 * generous line-height, narrow column for comfortable scanning.
 * Theme-variable colours throughout. Print-clean.
 */

.legal-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 32px 96px;
    font-family: var(--font-serif);
    color: var(--text-primary);
    line-height: 1.72;
}

@media (max-width: 600px) {
    .legal-page {
        padding: 32px 20px 64px;
    }
}

/* ── Header ─────────────────────────────────────────────────────────── */

.legal-page__header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.legal-page__title {
    font-family: var(--font-serif);
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0;
}

.legal-page__meta {
    margin: 12px 0 0;
    font-family: var(--font-sans);
    font-size: 0.82em;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.legal-page__meta .legal-page__meta-sep {
    margin: 0 0.6em;
    opacity: 0.5;
}

/* ── In-page table of contents ──────────────────────────────────────── */

.legal-page__toc {
    margin: 24px 0 40px;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.88em;
}

.legal-page__toc-label {
    display: block;
    font-size: 0.75em;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.legal-page__toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
    counter-reset: legal-toc;
}

@media (max-width: 600px) {
    .legal-page__toc-list {
        grid-template-columns: 1fr;
    }
}

.legal-page__toc-list li {
    counter-increment: legal-toc;
    line-height: 1.5;
}

.legal-page__toc-list a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5em;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.legal-page__toc-list a::before {
    content: counter(legal-toc, decimal-leading-zero) " ";
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.85em;
    flex-shrink: 0;
}

.legal-page__toc-list a:hover {
    color: var(--accent);
}

/* ── Sections ───────────────────────────────────────────────────────── */

.legal-page__sections {
    counter-reset: legal-section;
}

.legal-page__section {
    padding-top: 32px;
    margin-top: 32px;
    border-top: 1px solid var(--border-subtle);
    counter-increment: legal-section;
    scroll-margin-top: 24px;
}

.legal-page__section:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.legal-page__section-heading {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin: 0 0 12px;
    letter-spacing: -0.005em;
}

.legal-page__section-heading::before {
    content: counter(legal-section, decimal-leading-zero);
    font-family: var(--font-sans);
    font-size: 0.7em;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.legal-page__section-heading-link {
    color: inherit;
    text-decoration: none;
}

.legal-page__section-body {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.legal-page__section-body p {
    margin: 0 0 0.9em;
}

.legal-page__section-body p:last-child {
    margin-bottom: 0;
}

.legal-page__section-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    transition: border-color var(--transition);
}

.legal-page__section-body a:hover {
    border-bottom-color: var(--accent);
}

.legal-page__section-body code {
    font-family: var(--font-mono, monospace);
    font-size: 0.9em;
    padding: 1px 5px;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-radius: 3px;
}

/* ── Footer / contact line ──────────────────────────────────────────── */

.legal-page__footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-family: var(--font-sans);
    font-size: 0.85em;
    color: var(--text-muted);
}

.legal-page__footer p {
    margin: 0 0 0.4em;
}

.legal-page__footer a {
    color: var(--accent);
    text-decoration: none;
}

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

/* ── Print ──────────────────────────────────────────────────────────── */

@media print {
    .legal-page {
        max-width: 100%;
        padding: 0;
        color: #000;
    }
    .legal-page__toc { display: none; }
    .legal-page__section {
        break-inside: avoid;
        border-top-color: #ccc;
    }
    .legal-page__section-heading::before {
        color: #555;
    }
}
