/* =========================================================================
   BILOOU — long-form pages: documentation, terms, privacy

   Loaded on top of style.css, which already holds the tokens, the buttons and
   the reset. Nothing here restyles a landing-page component; it is only the
   things a page made mostly of sentences needs and the landing page does not.

   The reading column is capped in `ch` rather than pixels, so it holds roughly
   the same number of characters per line whatever the reader's font size is.
   That is the measurement that matters for reading; a pixel width only tracks
   it while nobody has touched their browser's text size.
   ========================================================================= */

.doc-main {
    padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem);
}

.doc {
    width: min(100% - 2.5rem, 74ch);
    margin-inline: auto;
}

/* Head ------------------------------------------------------------------- */
.doc__head {
    padding-bottom: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
    border-bottom: var(--border);
}

.doc__title {
    font-size: clamp(2.1rem, 7vw, 3.4rem);
    margin-bottom: 0.9rem;
}

.doc__lede {
    font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
    line-height: 1.55;
    font-weight: 600;
}

.doc__stamp {
    display: inline-block;
    margin-top: 1.25rem;
    padding: 0.3rem 0.7rem;
    background: var(--paper-2);
    border: var(--border);
    box-shadow: var(--sh-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Contents --------------------------------------------------------------- */
.doc__toc {
    padding: 1.15rem 1.35rem;
    margin-bottom: clamp(2rem, 5vw, 3rem);
    background: var(--paper-2);
    border: var(--border);
    box-shadow: var(--sh);
}

.doc__toc-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.doc__toc ol {
    margin: 0;
    padding-left: 1.35rem;
    display: grid;
    gap: 0.4rem;
    font-size: 0.9375rem;
}

.doc__toc a {
    border-bottom: 2px solid var(--yellow);
    font-weight: 600;
}
.doc__toc a:hover, .doc__toc a:focus-visible { background: var(--yellow); }

/* Prose ------------------------------------------------------------------ */
.doc__body > * + * { margin-top: 1.1rem; }

.doc__body h2 {
    /* scroll-margin, not scroll-padding: these are the anchor targets, and a
       sticky bar sits over the top of the page. Without it a jump from the
       contents list lands with the heading underneath the bar. */
    scroll-margin-top: 6rem;
    margin-top: clamp(2.5rem, 6vw, 3.5rem);
    padding-top: 1.5rem;
    border-top: var(--border);
    font-size: clamp(1.4rem, 3.5vw, 1.9rem);
}

.doc__body h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.doc__body h3 {
    margin-top: 2rem;
    font-size: clamp(1.0625rem, 2vw, 1.2rem);
    letter-spacing: 0;
}

.doc__body p { line-height: 1.7; }

.doc__body ul,
.doc__body ol {
    padding-left: 1.4rem;
    display: grid;
    gap: 0.55rem;
    line-height: 1.65;
}

.doc__body li > ul,
.doc__body li > ol { margin-top: 0.55rem; }

.doc__body a {
    font-weight: 700;
    border-bottom: 3px solid var(--pink);
}
.doc__body a:hover, .doc__body a:focus-visible { background: var(--pink); }

.doc__body code {
    padding: 0.1em 0.35em;
    background: var(--paper-2);
    border: 2px solid var(--ink);
    font-family: var(--font-mono);
    font-size: 0.85em;

    /* break-word, not break-all: a long URL in a sentence may be split rather
       than pushing the page sideways, but an ordinary word is left whole. */
    overflow-wrap: break-word;
}

.doc__body dl { display: grid; gap: 0.85rem; }
.doc__body dt { font-weight: 800; }
.doc__body dd { margin: 0.2rem 0 0; padding-left: 1rem; border-left: 3px solid var(--yellow); }

/* Callout ---------------------------------------------------------------- */
.doc-note {
    padding: 1.1rem 1.25rem;
    background: var(--yellow);
    border: var(--border);
    box-shadow: var(--sh);
}
.doc-note--plain { background: var(--paper-2); }
.doc-note--loud  { background: var(--cyan); }
.doc-note p + p { margin-top: 0.65rem; }
.doc-note__title {
    display: block;
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

/* Tables ----------------------------------------------------------------- */
/* Wide content scrolls inside its own box rather than pushing the page
   sideways — a body that scrolls horizontally on a phone is a broken page. */
.doc-table-wrap {
    overflow-x: auto;
    border: var(--border);
    box-shadow: var(--sh);
    background: var(--paper);
}

.doc-table {
    width: 100%;
    min-width: 30rem;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.doc-table th,
.doc-table td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 2px solid var(--ink);
}

.doc-table thead th {
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* A row header is a label — a scope name, a cookie name — and a label broken
   across two lines stops being one. `profile` was rendering as "profil" over
   "e", because auto table layout will squeeze a column until its contents are
   allowed to break, and the prose rule above allows it. The table already
   scrolls inside its own box, so refusing to break here costs nothing. */
.doc-table tbody th { white-space: nowrap; }
.doc-table tbody th code { white-space: nowrap; }

.doc-table tbody tr:last-child th,
.doc-table tbody tr:last-child td { border-bottom: none; }

/* Foot ------------------------------------------------------------------- */
.doc__foot {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    padding-top: 1.5rem;
    border-top: var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.doc__foot-links { display: flex; flex-wrap: wrap; gap: 0.6rem; }
