/* The document pages (D1, ruling R106): the privacy policy, the terms, the cookie notice and the
   deletion page. They keep the site's fonts, colours, header, footer and dark mode (site.css) and
   add the formal layout: a title block, a contents list, numbered sections and a print view.
   Every colour comes from the site's tokens, so both themes follow without extra rules. */

.doc { padding-top: clamp(32px, 5vw, 64px); padding-bottom: 24px; }

/* Title block: a heavy rule above, the name, then the date as the document states it. */
.doc-title { border-top: 4px solid var(--ink); padding-top: 20px; }
.doc-title h1 { max-width: 24ch; font: 800 clamp(34px, 4.4vw, 56px)/1.05 var(--font-display); letter-spacing: -0.03em; overflow-wrap: break-word; }
.doc-meta { margin: 16px 0 0; color: var(--ink-2); font-size: 16px; }
p.doc-meta em { font-style: normal; } /* the privacy policy's date line reads like the others' label and value row */
dl.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 40px; }
.doc-meta div { display: flex; gap: 10px; align-items: baseline; }
.doc-meta dt { color: var(--ink-2); }
.doc-meta dd { margin: 0; font-weight: 600; color: var(--ink); }
.doc-jump { margin: 16px 0 0; }
.doc-jump a { font-weight: 600; }
.doc .rh-notice { max-width: 70ch; }

/* Contents beside the text on wide screens, above it on narrow ones. */
.doc-layout { margin-top: 40px; display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 32px clamp(40px, 6vw, 96px); align-items: start; }
.doc-toc { position: sticky; top: 92px; max-height: calc(100vh - 116px); overflow-y: auto; padding: 4px 0 4px 20px; border-left: 2px solid var(--line); font-size: 15px; line-height: 1.35; }
.doc-toc-h { font: 700 17px/1.2 var(--font-display); letter-spacing: -0.01em; }
.doc-toc ol { margin: 12px 0 0; padding-left: 1.7em; }
.doc-toc li { padding-left: 2px; }
.doc-toc li::marker { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.doc-toc a { display: block; padding: 4px 0; text-decoration: none; }
.doc-toc a:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-toc { position: static; max-height: none; overflow: visible; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--well); }
}

/* The text: about 70 characters to the line, sections numbered by the stylesheet. */
.doc-body { max-width: 70ch; min-width: 0; counter-reset: sec; font-size: 17.5px; line-height: 1.7; overflow-wrap: break-word; }
.doc-body h2 { counter-increment: sec; margin: 52px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font: 800 clamp(22px, 2.2vw, 28px)/1.2 var(--font-display); letter-spacing: -0.02em; }
.doc-body h2 { padding-left: 2.1em; text-indent: -2.1em; } /* a wrapped heading lines up after its number */
.doc-body h2::before { content: counter(sec) "."; display: inline-block; min-width: 2.1em; text-indent: 0; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.doc-body > :first-child, .doc-body > section:first-child > h2 { margin-top: 0; }
.doc-body p, .doc-body ul, .doc-body ol { margin: 14px 0 0; }
.doc-body ul, .doc-body ol { padding-left: 1.3em; }
.doc-body li + li { margin-top: 8px; }
.doc-body h2 + * { margin-top: 14px; }
.doc-body .doc-lede { margin-top: 0; font-size: 19px; line-height: 1.6; }
.doc-body .doc-label { margin-top: 22px; }
.doc-body code { padding: 1px 4px; border-radius: 4px; background: var(--well-2); font: 0.88em/1 ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; }

/* Tables (the privacy policy's legal bases): the frame scrolls sideways on a phone and can be focused. */
.doc-table { margin-top: 18px; overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.doc-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.doc-table th, .doc-table td { padding: 10px 14px 10px 0; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line); }
.doc-table th { font-weight: 700; }
.doc-table tbody tr:last-child td { border-bottom: 0; }
/* On a phone the table fits the column and its cells wrap, so no column is out of sight. */
@media (max-width: 600px) {
  .doc-table table { min-width: 0; font-size: 14px; }
  .doc-table th, .doc-table td { padding-right: 8px; overflow-wrap: break-word; }
}

/* The deletion page keeps its form: a framed block in the last section. */
.doc-body .req-form { flex: none; max-width: none; margin-top: 18px; }

@media print {
  @page { margin: 18mm 16mm; }
  :root:root:root { --bg: #fff; --ink: #000; --ink-2: #000; --ink-3: #333; --well: #fff; --well-2: #eee; --card: #fff; --line: #888; color-scheme: light; }
  html, body { background: #fff; color: #000; }
  body { font-size: 11pt; line-height: 1.5; }
  .skip-link, .topbar, .foot, #theme-toggle, .doc-jump, .doc-screen-only { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .doc { padding: 0; }
  .doc-title { border-top: 3pt solid #000; padding-top: 8pt; max-width: none; }
  .doc-title::before { content: "Rehumanize"; display: block; margin-bottom: 4pt; font: 800 13pt/1 var(--font-display); }
  .doc-title h1 { font-size: 24pt; }
  .doc-layout { display: block; margin-top: 14pt; }
  .doc-toc { position: static; max-height: none; overflow: visible; padding: 8pt 12pt; border: 1px solid #888; border-radius: 0; background: #fff; break-inside: avoid; font-size: 10pt; }
  .doc-toc a { padding: 1pt 0; }
  .doc-body { max-width: none; margin-top: 16pt; font-size: 11pt; line-height: 1.5; }
  .doc-body h2 { margin-top: 18pt; padding-top: 8pt; font-size: 14pt; border-top: 1px solid #888; break-after: avoid; }
  .doc-body h2 + * { break-before: avoid; }
  p, li { orphans: 3; widows: 3; }
  li, tr, .rh-notice { break-inside: avoid; }
  .doc-table { overflow: visible; }
  .doc-table table { min-width: 0; }
  .doc-body .doc-lede { font-size: 12pt; }
  .rh-notice { border: 1px solid #000; border-left-width: 5px; border-radius: 0; background: #fff; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; overflow-wrap: anywhere; }
  a[href^="/"]::after { content: " (rehumanize-api.onrender.com" attr(href) ")"; font-size: 9pt; overflow-wrap: anywhere; }
  a[href$=".html"]:not([href^="/"], [href^="http"])::after { content: " (rehumanize-api.onrender.com/" attr(href) ")"; font-size: 9pt; overflow-wrap: anywhere; }
  .doc-toc a::after { content: none !important; }
}
