/* Terms of Service and Privacy Policy (terms.html, privacy.html), after design-refs/legal.png:
   on the left a thin line listing the document's sections (the one you're reading black, with a black
   segment on the line; static/legal.js); on the right the document: the large title, a thin rule, the date
   and intro in italics, numbered section headings and grey body text.
   From 1024px, side by side and the list stays in view while you read; below 1024px only the document shows. */

.legal {
    --legal-muted: #575757;
    --legal-faint: #8a8a8a;
    --legal-line: #e5e5e5;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 2rem var(--gutter) 5rem;
    font-family: "Geist", sans-serif;
    color: #0a0a0a;
    letter-spacing: 0;
}

@media (min-width: 768px) {
    .legal {
        padding-top: 2.5rem;
        padding-bottom: 7rem;
    }
}

/* From 1024px the section list starts exactly under the header's "Solutions" and the document ends exactly
   where the header's Log in button ends (--legal-end, measured by static/legal.js; the CSS fallback is the
   Get Started width plus the gap between the buttons). The body text keeps a readable line length. */
@media (min-width: 1024px) {
    .legal {
        grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr);
        column-gap: clamp(3rem, 7vw, 8rem);
        align-items: start;
        padding-left: calc(var(--gutter) + var(--logo-width) + var(--header-gap) + var(--nav-offset));
        padding-right: var(--legal-end, calc(var(--gutter) + 7.0625rem + var(--header-gap)));
    }

    .legal__body > * {
        max-width: 52rem;
    }

    /* The list starts level with the line under the page title (--legal-rule-top: the title's height,
       measured by static/legal.js; the CSS fallback works it out from the title's size) */
    .legal__nav {
        position: sticky;
        top: calc(var(--header-height) + 2.5rem);
        margin-top: var(--legal-rule-top, calc(clamp(2.25rem, 1.2rem + 3.6vw, 4rem) * 1.05 + clamp(1.5rem, 1rem + 1.5vw, 2.5rem)));
    }
}

/* ---------- Left: this page's sections ---------- */
.legal__nav {
    display: none;
}

@media (min-width: 1024px) {
    .legal__nav {
        display: block;
    }
}

/* Headings stop below the sticky header when jumped to */
.legal__body h2 {
    scroll-margin-top: calc(var(--header-height) + 2rem);
}
.legal__nav-list {
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    border-left: 1px solid var(--legal-line);
}

.legal__nav-list a {
    position: relative;
    display: block;
    padding: 0.875rem 0 0.875rem 1.0625rem;  /* about 48px rows: airy, as in the reference, and tap-sized */
    font-size: 0.875rem; /* 14px */
    line-height: 1.35;
    color: var(--legal-faint);
    text-decoration: none;
    transition: color 0.2s ease;
}

/* The section you're reading: black text and a black segment over the line */
.legal__nav-list a[aria-current] {
    color: #0a0a0a;
}

.legal__nav-list a[aria-current]::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -1px;
    width: 2px;
    background: #0a0a0a;
}

@media (hover: hover) and (pointer: fine) {
    .legal__nav-list a:hover {
        color: #0a0a0a;
    }
}

.legal__nav-list a:focus-visible {
    outline: 2px solid #0a0a0a;
    outline-offset: 2px;
}

@media (hover: none) {
    .legal__nav-list a:active {
        opacity: 0.6;
    }
}

/* A small line under the list: "Read our" and the other legal page, with only the page's name underlined */
.legal__nav-other {
    display: flex;
    align-items: center;
    gap: 0.25em;
    margin: 1rem 0 0;
    font-size: 0.8125rem; /* 13px */
    color: var(--legal-faint);
}

.legal__nav-other a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem; /* 44px tap target */
    color: #0a0a0a;
    text-decoration: underline;
    text-decoration-color: #c4c4c4;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .legal__nav-other a:hover {
        text-decoration-color: #0a0a0a;
    }
}

.legal__nav-other a:focus-visible {
    outline: 2px solid #0a0a0a;
    outline-offset: 2px;
}

/* ---------- Right: the document ---------- */
.legal__title {
    margin: 0;
    padding-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
    border-bottom: 1px solid var(--legal-line);
    font-size: clamp(2.25rem, 1.2rem + 3.6vw, 4rem); /* 36px on phones to 64px on desktop */
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.legal__body {
    padding-top: clamp(2rem, 1.5rem + 2vw, 3.5rem);
    font-size: 1rem; /* 16px */
    line-height: 1.8;
    color: var(--legal-muted);
    overflow-wrap: anywhere;
}

.legal__updated,
.legal__intro {
    font-style: italic;
}

.legal__updated {
    margin: 0 0 1.5rem;
}

.legal__intro {
    margin: 0 0 1.25rem;
}

.legal__body h2 {
    margin: clamp(2.5rem, 2rem + 1.5vw, 3.5rem) 0 1rem;
    font-size: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem); /* 20px on phones, 24px on desktop */
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: #0a0a0a;
    text-wrap: balance;
}

.legal__body p {
    margin: 0 0 1.25rem;
}

.legal__body ul {
    margin: 0 0 1.25rem;
    padding-left: 1.25rem;
    list-style: disc;
}

.legal__body li {
    margin-bottom: 0.375rem;
}

.legal__body strong {
    font-weight: 500;
    color: #0a0a0a;
}

.legal__body a {
    color: #0a0a0a;
    text-decoration: underline;
    text-decoration-color: #c4c4c4;
    text-underline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
    .legal__body a:hover {
        text-decoration-color: #0a0a0a;
    }
}

@media (prefers-reduced-motion: reduce) {
    .legal__nav-list a {
        transition: none;
    }
}

/* A section link glides to its heading, unless reduced motion is on */
@media (prefers-reduced-motion: no-preference) {
    html:has(.legal) {
        scroll-behavior: smooth;
    }
}
