/* ==================================================
   LEGAL: the /legal index and the four documents
   (terms, privacy, acceptable use, SLA).
   Prefix .lg-. Ground comes from index.css / lander.css.
   News posts do not load this file.
================================================== */
.lg {
    position: relative;
    display: block;
    padding: clamp(118px, 16vh, 150px) 2rem clamp(4.5rem, 10vh, 7rem);
}

/* Graph-paper wash behind the top of the page only: these pages are
   long, so the full-height .hero-checker would run all the way down. */
.lg-glow {
    position: absolute;
    inset: 0 0 auto 0;
    height: 560px;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 0%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 0%, transparent 100%);
}

.lg-glow::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(45% 60% at 50% 0%, rgba(169, 73, 243, 0.14), transparent 70%);
}

.lg-inner {
    position: relative;
    z-index: 1;
    max-width: 1080px;
    margin: 0 auto;
}

/* ── Doc switcher ──
   A real <nav>, so index.css's header `nav { display: grid }` rule
   needs overriding here. */
.lg-docs {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
    width: auto;
    padding: 0;
    margin: 0 0 clamp(2.5rem, 6vh, 3.75rem);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    overflow-x: auto;
    scrollbar-width: none;
}

.lg-docs::-webkit-scrollbar { display: none; }

.lg-docs a {
    position: relative;
    flex: none;
    padding: 0.8rem 0.95rem;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.58);
    text-decoration: none;
    border-radius: 8px 8px 0 0;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.lg-docs a:first-child { padding-left: 0; }

.lg-docs a:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.04);
}

.lg-docs a[aria-current="page"] {
    color: #fff;
    font-weight: 600;
}

.lg-docs a:first-child[aria-current="page"]::after { left: 0; }

.lg-docs a[aria-current="page"]::after {
    content: '';
    position: absolute;
    left: 0.95rem;
    right: 0.95rem;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--primary-light);
}

/* ── Shared type ── */
.lg-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 1rem;
}

/* line-height stays above 1.15: tighter crops descenders at this weight. */
.lg-title {
    font-size: clamp(2.1rem, 4.4vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.16;
    color: #fff;
    margin: 0;
    text-wrap: balance;
}

/* ── Document layout ──
   .lg-head is a <div>, not a <header>: index.css fixes every <header>
   to the top of the viewport for the site nav. */
.lg-grid {
    display: grid;
    grid-template-columns: 232px minmax(0, 70ch);
    grid-template-areas:
        "side head"
        "side body";
    column-gap: clamp(2.5rem, 6vw, 5rem);
    align-items: start;
}

.lg-head { grid-area: head; min-width: 0; }
.lg-side { grid-area: side; }
.lg-body { grid-area: body; min-width: 0; }

.lg-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-top: 1.1rem;
}

.lg-updated {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.lg-updated time { color: rgba(255, 255, 255, 0.86); }
.lg-dot { margin: 0 0.6rem; color: rgba(255, 255, 255, 0.3); }

.lg-print {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.85rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.lg-print i { font-size: 0.78rem; }

.lg-print:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.34);
    background-color: rgba(255, 255, 255, 0.05);
}

/* ── Box up top ── */
.lg-summary {
    margin-top: 1.75rem;
    padding: 1.25rem 1.4rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
}

.lg-summary-lead {
    margin: 0 0 1.1rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.86);
}

.lg-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 2rem;
    margin: 0;
}

.lg-facts dt {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.3rem;
}

.lg-facts dd {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #fff;
    overflow-wrap: anywhere;
}

.lg-facts-sub {
    display: block;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
}

/* ── On this page ── */
.lg-side {
    position: sticky;
    top: 104px;
    max-height: calc(100vh - 128px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.lg-toc > summary {
    list-style: none;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.9rem;
    cursor: default;
}

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

/* <nav> again: undo the header's grid rule. */
.lg-toc nav {
    display: block;
    width: auto;
    padding: 0;
}

.lg-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.lg-toc a {
    display: flex;
    gap: 0.6rem;
    margin-left: -1px;
    padding: 0.36rem 0 0.36rem 0.9rem;
    border-left: 2px solid transparent;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.58);
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.lg-toc-num {
    flex: none;
    min-width: 1.15rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.36);
    transition: color 0.2s ease;
}

.lg-toc a:hover { color: #fff; }

.lg-toc a[aria-current] {
    color: #fff;
    border-left-color: var(--primary-light);
}

.lg-toc a[aria-current] .lg-toc-num { color: var(--primary-light); }

/* ── Document body ── */
.lg-body {
    margin-top: 0.5rem;
    font-size: 1rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.74);
}

.lg-body h2 {
    position: relative;
    margin: 3rem 0 1rem;
    padding-top: 2.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.35;
    color: #fff;
}

.lg-num {
    margin-right: 0.3rem;
    font-variant-numeric: tabular-nums;
    color: var(--primary-light);
}

.lg-body h3 {
    margin: 2rem 0 0.6rem;
    font-size: 1.04rem;
    font-weight: 600;
    line-height: 1.45;
    color: #fff;
}

.lg-body h2 + h3 { margin-top: 1.25rem; }

.lg-body p { margin: 0 0 1.1rem; }

.lg-body strong {
    font-weight: 600;
    color: #fff;
}

.lg-body a:not(.lg-anchor),
.lg-facts a {
    color: var(--primary-light);
    text-decoration: underline;
    text-decoration-color: rgba(186, 114, 241, 0.45);
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.lg-body a:not(.lg-anchor):hover,
.lg-facts a:hover {
    color: #fff;
    text-decoration-color: #fff;
}

.lg-anchor {
    margin-left: 0.5rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.lg-anchor:hover { color: var(--primary-light); }

@media (hover: hover) {
    .lg-anchor { opacity: 0; }

    .lg-body h2:hover .lg-anchor,
    .lg-body h3:hover .lg-anchor,
    .lg-anchor:focus-visible { opacity: 1; }
}

.lg-body ul,
.lg-body ol {
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.lg-body li {
    position: relative;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.lg-body ul > li::before {
    content: '';
    position: absolute;
    left: 0.25rem;
    top: 0.78em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-light);
}

.lg-body ol { counter-reset: lg-ol; }
.lg-body ol > li { counter-increment: lg-ol; padding-left: 1.9rem; }

.lg-body ol > li::before {
    content: counter(lg-ol) '.';
    position: absolute;
    left: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--primary-light);
}

.lg-body hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lg-body code {
    padding: 0.1em 0.4em;
    font-size: 0.88em;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
}

/* Tables come out of md_to_html wrapped in .help-table-wrap. */
.lg-body .help-table-wrap {
    overflow-x: auto;
    margin: 0.5rem 0 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.lg-body table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    font-size: 0.9rem;
    line-height: 1.6;
}

.lg-body th,
.lg-body td {
    padding: 0.75rem 1rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lg-body th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.03);
}

.lg-body tbody tr:last-child td { border-bottom: 0; }

.lg-top {
    margin: 3.5rem 0 0 !important;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.88rem;
}

.lg-body .lg-top a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
}

.lg-body .lg-top a:hover { color: #fff; }
.lg-top i { margin-right: 0.4rem; font-size: 0.75rem; }

/* ── Index (/legal) ── */
.lg-index {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: clamp(2.5rem, 7vw, 6rem);
    align-items: start;
}

.lg-lede {
    font-size: 1.08rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.68);
    max-width: 26rem;
    margin: 1.25rem 0 0;
}

.lg-aside {
    font-size: 0.9rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.55);
    max-width: 24rem;
    margin: 2.25rem 0 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lg-aside a {
    color: var(--primary-light);
    text-decoration: none;
    border-bottom: 1px solid rgba(186, 114, 241, 0.45);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.lg-aside a:hover {
    color: #fff;
    border-bottom-color: #fff;
}

.lg-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.lg-list > li { border-bottom: 1px solid rgba(255, 255, 255, 0.12); }

.lg-row {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr) 1rem;
    column-gap: 1.25rem;
    align-items: start;
    padding: 1.5rem 1rem;
    margin: 0 -1rem;
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.lg-row:hover { background-color: rgba(255, 255, 255, 0.035); }

.lg-row-icon {
    font-size: 1.05rem;
    line-height: 1.75rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.42);
    transition: color 0.2s ease;
}

.lg-row:hover .lg-row-icon,
.lg-row:focus-visible .lg-row-icon { color: var(--primary-light); }

.lg-row-body { display: block; min-width: 0; }

.lg-row-name {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.75rem;
    color: #fff;
}

.lg-row-desc {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.93rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.6);
    max-width: 32rem;
}

.lg-row-meta {
    display: block;
    margin-top: 0.7rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.45);
}

.lg-row-arrow {
    font-size: 0.8rem;
    line-height: 1.75rem;
    color: rgba(255, 255, 255, 0.28);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.lg-row:hover .lg-row-arrow,
.lg-row:focus-visible .lg-row-arrow {
    color: #fff;
    transform: translateX(4px);
}

/* ── Focus ── */
.lg a:focus-visible,
.lg-print:focus-visible,
.lg-toc > summary:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 3px;
    border-radius: 4px;
}

.lg-row:focus-visible { border-radius: 14px; }
.lg-docs a:focus-visible { outline-offset: -2px; }

/* ── Responsive ── */
@media (max-width: 960px) {
    .lg-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "head"
            "side"
            "body";
        max-width: 70ch;
        margin: 0 auto;
    }

    .lg-side {
        position: static;
        max-height: none;
        overflow: visible;
        padding: 0;
        margin-top: 1.25rem;
    }

    .lg-toc {
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.035);
    }

    .lg-toc > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0;
        padding: 1rem 1.25rem;
        color: rgba(255, 255, 255, 0.72);
        cursor: pointer;
    }

    .lg-toc > summary::after {
        content: '';
        width: 7px;
        height: 7px;
        margin-right: 0.2rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: translateY(-2px) rotate(45deg);
        transition: transform 0.2s ease;
    }

    .lg-toc[open] > summary::after { transform: translateY(2px) rotate(-135deg); }

    .lg-toc nav { padding: 0 1.25rem 1rem; }
    .lg-toc a { padding-top: 0.5rem; padding-bottom: 0.5rem; font-size: 0.92rem; }

    .lg-index {
        grid-template-columns: minmax(0, 1fr);
        gap: 2.5rem;
        max-width: 640px;
    }

    .lg-lede,
    .lg-aside { max-width: none; }
}

@media (max-width: 560px) {
    .lg { padding: 104px 1.25rem 4rem; }

    .lg-docs {
        margin-left: -1.25rem;
        margin-right: -1.25rem;
        padding: 0 1.25rem;
        margin-bottom: 2rem;
    }

    .lg-docs a { padding: 0.75rem 0.7rem; font-size: 0.86rem; }
    .lg-docs a[aria-current="page"]::after { left: 0.7rem; right: 0.7rem; }
    .lg-docs a:first-child[aria-current="page"]::after { left: 0; }

    .lg-facts { grid-template-columns: minmax(0, 1fr); }
    .lg-summary { padding: 1.1rem 1.15rem; }

    .lg-body { font-size: 0.97rem; line-height: 1.75; }
    .lg-body h2 { font-size: 1.22rem; margin-top: 2.5rem; padding-top: 1.9rem; }

    .lg-row {
        column-gap: 1rem;
        padding: 1.3rem 0.75rem;
        margin: 0 -0.75rem;
    }

    .lg-row-name { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .lg *,
    .lg *::after {
        transition: none !important;
    }

    html:has(.lg) { scroll-behavior: auto; }
}

/* ── Print: black on white, document only ── */
@media print {
    :root { color-scheme: light; }

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

    body::before,
    body::after,
    body > *:not(main),
    .lg-glow,
    .lg-docs,
    .lg-side,
    .lg-print,
    .lg-anchor,
    .lg-top {
        display: none !important;
    }

    .lg { padding: 0; }
    .lg-inner { max-width: none; }

    .lg-grid {
        display: block;
        max-width: none;
    }

    .lg-label,
    .lg-updated,
    .lg-updated time,
    .lg-facts dt,
    .lg-facts-sub { color: #444 !important; }

    .lg-title,
    .lg-summary-lead,
    .lg-facts dd,
    .lg-body,
    .lg-body h2,
    .lg-body h3,
    .lg-body strong,
    .lg-num,
    .lg-body ol > li::before { color: #000 !important; }

    .lg-title { font-size: 22pt; }
    .lg-body { font-size: 10.5pt; line-height: 1.55; }
    .lg-body h2 { font-size: 13pt; margin-top: 18pt; padding-top: 12pt; border-top-color: #bbb; }
    .lg-body h3 { font-size: 11pt; }

    .lg-body h2,
    .lg-body h3 { break-after: avoid; }

    .lg-body li,
    .lg-body tr,
    .lg-summary { break-inside: avoid; }

    .lg-summary,
    .lg-body .help-table-wrap {
        background: none;
        border-color: #bbb;
    }

    .lg-summary-lead,
    .lg-body th,
    .lg-body td { border-color: #bbb; }

    .lg-body th { background: none; color: #000; }
    .lg-body ul > li::before { background: #000; }

    .lg-body a:not(.lg-anchor),
    .lg-facts a {
        color: #000 !important;
        text-decoration: underline;
    }

    .lg-body a[href^="http"]::after {
        content: ' (' attr(href) ')';
        font-size: 0.9em;
        word-break: break-all;
    }
}
