/* style_legal.css — shared by privacy.html and terms.html.
   A deliberately plain reading surface: one measured column, hairline rules,
   no cards, no gradients, no shadows. Monochrome by design — the only visual
   hierarchy is typographic, which is also what makes it print cleanly.
   Fonts (Roboto / Rubik / IBM Plex Mono) are already pulled in by master.css. */

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

:root {
    --lg-paper:  #fbfbf9;
    --lg-ink:    #15171a;
    --lg-muted:  #70747c;
    --lg-rule:   #e3e3de;
    --lg-rule-2: #cfcfc8;
    --lg-mark:   #f4f4f0;   /* quiet fill for inline code */
    --lg-measure: 68ch;
}

/* master.css sets `overflow-x: hidden` on html+body. That computes overflow-y to
   `auto`, which makes the document itself a scroll container — and a
   `position: sticky` element then sticks to THAT box instead of the viewport,
   so the contents rail scrolls away with the page. `clip` guards against
   horizontal overflow the same way without creating a scroll container, which
   is what lets the rail stay pinned. Both are declared so browsers without
   `clip` (iPad Safari < 16) keep the old guard and merely lose the pinning. */
html, body {
    overflow-x: hidden;
    overflow-x: clip;
}

/* Anchor jumps from the contents rail glide instead of teleporting, matching
   the homepage. The reduced-motion block at the end of this file opts out. */
html {
    scroll-behavior: smooth;
}

body {
    background: var(--lg-paper);
    color: var(--lg-ink);
    font-family: 'Roboto', sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ── Shell ──────────────────────────────────────────────────────────────── */

.lg-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(40px, 5vw, 76px) clamp(20px, 5vw, 40px) clamp(72px, 8vw, 128px);
}

/* Masthead sits full width above the two columns. */
.lg-masthead {
    padding-bottom: clamp(28px, 3vw, 40px);
    border-bottom: 1px solid var(--lg-rule-2);
    margin-bottom: clamp(32px, 4vw, 56px);
}

.lg-title {
    font-family: 'Rubik', sans-serif;
    font-weight: 600;
    font-size: clamp(34px, 4.4vw, 48px);
    line-height: 1.1;
    letter-spacing: -.022em;
    margin: 0;
}

.lg-standfirst {
    max-width: 62ch;
    margin: 16px 0 0;
    font-size: clamp(16px, 1.4vw, 18px);
    line-height: 1.6;
    color: #3c4046;
}

/* Dates + sibling-document link, one quiet mono line. */
.lg-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 18px;
    margin-top: 26px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12.5px;
    color: var(--lg-muted);
}

.lg-meta strong { font-weight: 600; color: var(--lg-ink); }

.lg-meta-sep { color: var(--lg-rule-2); }

.lg-meta a {
    color: var(--lg-ink);
    text-decoration: underline;
    text-underline-offset: .2em;
    text-decoration-thickness: 1px;
}
.lg-meta a:hover { text-decoration-thickness: 2px; }

/* ── Two-column body ────────────────────────────────────────────────────── */

.lg-shell {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
    gap: clamp(40px, 5vw, 72px);
    align-items: start;
}

/* ── Table of contents ──────────────────────────────────────────────────── */

.lg-toc {
    position: sticky;
    top: 28px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.lg-toc-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--lg-muted);
    margin: 0 0 14px;
}

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

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

.lg-toc a {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 8px;
    padding: 6px 0 6px 12px;
    /* The 2px bar is always present but transparent, so the active state
       does not shift the text sideways. */
    border-left: 2px solid transparent;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--lg-muted);
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease;
}

/* The label is wrapped in a <span> so that a nested <sup> (e.g. "A³") stays
   part of the label instead of becoming a third grid item and wrapping onto
   its own row under the number. */
.lg-toc a > span {
    min-width: 0;
}

.lg-toc a::before {
    content: counter(toc);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    padding-top: 1px;
    color: var(--lg-rule-2);
    transition: color .15s ease;
}

.lg-toc a:hover { color: var(--lg-ink); }

.lg-toc a.is-active {
    color: var(--lg-ink);
    font-weight: 500;
    border-left-color: var(--lg-ink);
}
.lg-toc a.is-active::before { color: var(--lg-muted); }

/* Mobile: the same list inside a <details>. Hidden on desktop. */
.lg-toc-mobile { display: none; }

/* ── Document ───────────────────────────────────────────────────────────── */

.lg-doc {
    max-width: var(--lg-measure);
    font-size: 16.5px;
    line-height: 1.72;
}

/* Breathing room above a section when an anchor jump lands on it. */
.lg-doc > section { scroll-margin-top: 32px; }

.lg-doc > section + section {
    margin-top: clamp(40px, 4.5vw, 60px);
    padding-top: clamp(36px, 4vw, 52px);
    border-top: 1px solid var(--lg-rule);
}

/* Heading carries its number in the margin on wide screens, inline below. */
.lg-doc h2 {
    position: relative;
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
    font-size: clamp(20px, 2vw, 23px);
    line-height: 1.3;
    letter-spacing: -.012em;
    margin: 0 0 18px;
}

.lg-doc h2 .lg-num {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--lg-muted);
}

@media (min-width: 1240px) {
    .lg-doc h2 .lg-num {
        position: absolute;
        left: -46px;
        top: .42em;
    }
}

.lg-doc h3 {
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
    font-size: 16.5px;
    margin: 28px 0 10px;
}

.lg-doc p { margin: 0 0 15px; }
.lg-doc p:last-child { margin-bottom: 0; }

.lg-doc a {
    color: var(--lg-ink);
    text-decoration: underline;
    text-underline-offset: .18em;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--lg-rule-2);
    transition: text-decoration-color .15s ease;
}
.lg-doc a:hover { text-decoration-color: var(--lg-ink); }

.lg-doc ol {
    margin: 0 0 15px;
    padding-left: 1.15em;
}

.lg-doc li { margin-bottom: 7px; }
.lg-doc li:last-child { margin-bottom: 0; }

/* Unordered lists use a short rule instead of a bullet dot. */
.lg-doc ul {
    margin: 0 0 15px;
    padding-left: 0;
    list-style: none;
}

.lg-doc ul > li {
    position: relative;
    padding-left: 1.15em;
}

.lg-doc ul > li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .72em;
    width: 5px;
    height: 1px;
    background: var(--lg-rule-2);
}

.lg-doc strong { font-weight: 600; }

.lg-doc code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .88em;
    background: var(--lg-mark);
    padding: .1em .38em;
    border-radius: 2px;
}

/* Callout: a rule on the left, no box. */
.lg-note {
    margin: 22px 0;
    padding: 2px 0 2px 18px;
    border-left: 2px solid var(--lg-ink);
    font-size: 15.5px;
    line-height: 1.65;
}

.lg-note p { margin-bottom: 10px; }
.lg-note p:last-child { margin-bottom: 0; }

/* ── Tables ─────────────────────────────────────────────────────────────── */

/* The wrapper scrolls, never the page. */
.lg-table-wrap {
    margin: 22px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lg-doc table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 14.5px;
    line-height: 1.55;
}

.lg-doc thead th {
    text-align: left;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--lg-muted);
    padding: 0 14px 9px 0;
    border-bottom: 1px solid var(--lg-rule-2);
    white-space: nowrap;
}

.lg-doc tbody td,
.lg-doc tbody th {
    padding: 11px 14px 11px 0;
    border-bottom: 1px solid var(--lg-rule);
    vertical-align: top;
}

/* First cell of a row reads as its label. */
.lg-doc tbody th {
    text-align: left;
    font-weight: 500;
}

.lg-doc tbody tr:last-child td,
.lg-doc tbody tr:last-child th { border-bottom: 1px solid var(--lg-rule-2); }

.lg-doc th:last-child, .lg-doc td:last-child { padding-right: 0; }

/* ── Footer note ────────────────────────────────────────────────────────── */

.lg-endnote {
    max-width: var(--lg-measure);
    margin: clamp(48px, 6vw, 72px) 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--lg-rule-2);
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--lg-muted);
}

.lg-endnote a { color: var(--lg-muted); text-underline-offset: .18em; }
.lg-endnote a:hover { color: var(--lg-ink); }

/* ── Narrow ─────────────────────────────────────────────────────────────── */

@media (max-width: 999px) {
    .lg-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }

    .lg-toc { display: none; }

    .lg-toc-mobile {
        display: block;
        margin-bottom: 36px;
        border-top: 1px solid var(--lg-rule);
        border-bottom: 1px solid var(--lg-rule);
    }

    .lg-toc-mobile > summary {
        list-style: none;
        cursor: pointer;
        padding: 14px 0;
        font-family: 'IBM Plex Mono', monospace;
        font-size: 11.5px;
        font-weight: 500;
        letter-spacing: .14em;
        text-transform: uppercase;
        color: var(--lg-muted);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

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

    .lg-toc-mobile > summary::after {
        content: "+";
        font-size: 15px;
        line-height: 1;
    }

    .lg-toc-mobile[open] > summary::after { content: "\2212"; }

    .lg-toc-mobile ol {
        list-style: none;
        margin: 0;
        padding: 0 0 14px;
        counter-reset: toc;
    }

    .lg-toc-mobile li { counter-increment: toc; margin-bottom: 0; }

    .lg-toc-mobile a {
        display: grid;
        grid-template-columns: 22px 1fr;
        gap: 8px;
        padding: 7px 0;
        font-size: 14.5px;
        color: var(--lg-ink);
        text-decoration: none;
    }

    .lg-toc-mobile a::before {
        content: counter(toc);
        font-family: 'IBM Plex Mono', monospace;
        font-size: 11.5px;
        color: var(--lg-muted);
    }

    .lg-doc { font-size: 16px; }
}

@media (max-width: 560px) {
    .lg-doc table { min-width: 420px; }
}

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

@media print {
    #navbar-placeholder,
    #footer,
    #page-loading-overlay,
    .lg-toc,
    .lg-toc-mobile { display: none !important; }

    body { background: #fff; }

    .lg-page { max-width: none; padding: 0; }
    .lg-shell { display: block; }
    .lg-doc { max-width: none; font-size: 10.5pt; line-height: 1.5; }

    .lg-doc > section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .lg-doc > section + section { border-top: 1px solid #ccc; }

    .lg-doc h2 { font-size: 12.5pt; }
    .lg-doc h2 .lg-num { position: static; }

    .lg-doc a { color: #000; text-decoration: none; }

    .lg-table-wrap { overflow: visible; }
    .lg-doc table { min-width: 0; font-size: 9pt; }
}

@media (prefers-reduced-motion: reduce) {
    .lg-toc a { transition: none; }
    html { scroll-behavior: auto !important; }
}
