/* Legal pages (Terms, Privacy Policy, API Terms). Scoped to .legal-page. */

html {
    scroll-behavior: smooth;
}

.legal-page {
    --accent: #6A0DAD;
    --accent-light: #cdb3e6;
    --panel: #26262C;
    --panel-2: #202026;
    --line: #3a3a42;
    --muted: #b0b0b0;
    --sticky-top: 70px;

    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px 72px;
    color: #fff;
    text-align: left;
}

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

.legal-page :focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
}

/* ---------- header ---------- */
.legal-head {
    padding: 26px 0 26px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 34px;
}

.legal-eyebrow {
    margin: 0 0 8px;
    font-size: .8rem;
    font-weight: bold;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent-light);
}

.legal-head h1 {
    margin: 0 0 14px;
    font-size: 2.3rem;
    line-height: 1.15;
    text-align: left;
}

.legal-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 22px;
    padding: 6px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #dcdce2;
    font-size: .9rem;
}

.legal-date svg {
    width: 16px;
    height: 16px;
    flex: none;
    color: var(--accent-light);
}

/* switcher between the three documents */
.legal-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legal-switch a {
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: #e4e4e8;
    font-size: .93rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}

.legal-switch a:hover {
    background: rgba(106, 13, 173, .22);
    border-color: var(--accent);
}

.legal-switch a[aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.legal-note {
    margin: 0 0 24px;
    padding: 12px 16px;
    background: rgba(242, 184, 75, .09);
    border: 1px solid rgba(242, 184, 75, .3);
    border-left: 3px solid #f2b84b;
    border-radius: 10px;
    color: #f0d9a4;
    font-size: .95rem;
}

/* ---------- layout ---------- */
.legal-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 52px;
    align-items: start;
}

/* ---------- table of contents ---------- */
.legal-toc {
    position: sticky;
    top: calc(var(--sticky-top) + 18px);
    max-height: calc(100vh - var(--sticky-top) - 36px);
    overflow-y: auto;
    padding-right: 4px;
}

.legal-toc-title {
    margin: 0 0 10px;
    font-size: .72rem;
    font-weight: bold;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legal-toc .toc-list {
    border-left: 1px solid var(--line);
}

.toc-list a {
    display: flex;
    gap: 8px;
    margin-left: -1px;
    padding: 6px 10px;
    border-left: 2px solid transparent;
    color: #cfcfd6;
    font-size: .88rem;
    line-height: 1.35;
    text-decoration: none;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.toc-num {
    flex: none;
    min-width: 1.6em;
    color: #8f8f99;
    font-variant-numeric: tabular-nums;
}

.toc-list a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .04);
}

.toc-list a[aria-current="true"] {
    color: #fff;
    font-weight: 600;
    border-left-color: var(--accent-light);
    background: rgba(106, 13, 173, .16);
}

.toc-list a[aria-current="true"] .toc-num {
    color: var(--accent-light);
}

/* the collapsible version used on narrow screens */
.toc-mobile {
    display: none;
    margin: 0 0 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.toc-mobile summary {
    padding: 13px 16px;
    font-weight: bold;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toc-mobile summary::-webkit-details-marker {
    display: none;
}

.toc-mobile summary::after {
    content: "";
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--accent-light);
    border-bottom: 2px solid var(--accent-light);
    transform: rotate(45deg);
    transition: transform .2s ease;
}

.toc-mobile[open] summary::after {
    transform: rotate(-135deg);
}

.toc-mobile .toc-list {
    max-height: 55vh;
    overflow-y: auto;
    padding: 0 6px 10px;
    border-top: 1px solid var(--line);
}

.toc-mobile .toc-list a {
    padding: 10px;
    border-left: 0;
    border-radius: 8px;
}

/* ---------- the document ---------- */
.legal-body {
    min-width: 0;
    max-width: 760px;
    font-size: 1.02rem;
    line-height: 1.75;
    color: #dcdce2;
}

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

.legal-body h2 {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 1.9em 0 .65em;
    padding-top: 1.4em;
    border-top: 1px solid var(--line);
    font-size: 1.35rem;
    line-height: 1.3;
    color: #fff;
    text-align: left;
    scroll-margin-top: calc(var(--sticky-top) + 18px);
}

.legal-body h2:first-child,
.legal-body>p:first-child+h2 {
    margin-top: 0;
}

.legal-body>h2:first-child {
    padding-top: 0;
    border-top: 0;
}

.sec-num {
    flex: none;
    min-width: 2.1em;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(106, 13, 173, .3);
    border: 1px solid rgba(205, 179, 230, .35);
    color: var(--accent-light);
    font-size: .8em;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.sec-title {
    min-width: 0;
}

.sec-anchor {
    margin-left: 4px;
    color: var(--accent-light);
    font-size: .8em;
    text-decoration: none;
    opacity: 0;
    transition: opacity .15s ease;
}

.legal-body h2:hover .sec-anchor,
.sec-anchor:focus-visible {
    opacity: .8;
}

.legal-body h3 {
    margin: 1.8em 0 .5em;
    font-size: 1.05rem;
    color: var(--accent-light);
    text-align: left;
}

.legal-body ul {
    list-style: none;
    margin: 0 0 1.2em;
    padding: 0;
}

.legal-body li {
    position: relative;
    margin: .55em 0;
    padding-left: 1.5em;
}

.legal-body li::before {
    content: "";
    position: absolute;
    left: .35em;
    top: .72em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-light);
    opacity: .85;
}

.legal-body strong {
    color: #fff;
}

.legal-body a {
    color: var(--accent-light);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.legal-body a:hover {
    color: #fff;
}

.legal-body code {
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', monospace;
    font-size: .88em;
    background: rgba(255, 255, 255, .08);
    color: #ead9fa;
    padding: 1px 6px;
    border-radius: 4px;
    overflow-wrap: anywhere;
}

.legal-body {
    overflow-wrap: break-word;
}

/* ---------- narrow screens ---------- */
@media (max-width: 960px) {
    .legal-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-toc {
        display: none;
    }

    .toc-mobile {
        display: block;
    }

    .legal-body h2 {
        scroll-margin-top: calc(var(--sticky-top) + 12px);
    }
}

@media (max-width: 600px) {
    .legal-page {
        padding: 12px 16px 56px;
    }

    .legal-head {
        padding-top: 16px;
        margin-bottom: 24px;
    }

    .legal-head h1 {
        font-size: 1.7rem;
    }

    .legal-body {
        font-size: 1rem;
        line-height: 1.7;
    }

    .legal-body h2 {
        font-size: 1.2rem;
        gap: 10px;
    }

    .sec-anchor {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .legal-switch a,
    .toc-list a,
    .toc-mobile summary::after {
        transition: none;
    }
}

/* ---------- print: a plain, readable document ---------- */
@media print {

    html,
    body {
        background: #fff !important;
    }

    .navbar,
    .language-switcher,
    footer,
    .footer,
    .legal-toc,
    .toc-mobile,
    .legal-switch,
    .sec-anchor,
    #announcementBar {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
    }

    .legal-page {
        max-width: none;
        padding: 0;
        color: #000;
    }

    .legal-layout {
        display: block;
    }

    .legal-head h1,
    .legal-body h2,
    .legal-body strong {
        color: #000;
    }

    .legal-eyebrow,
    .legal-body h3,
    .legal-body a {
        color: #333;
    }

    .legal-date {
        background: none;
        color: #000;
        border-color: #999;
    }

    .legal-body,
    .legal-body p,
    .legal-body li {
        color: #000;
    }

    .legal-body li::before {
        background: #000;
    }

    .sec-num {
        background: none;
        color: #000;
        border-color: #999;
    }

    .legal-body h2 {
        border-top-color: #bbb;
        break-after: avoid;
    }
}
