/* Graticule: the reading layout for the privacy policy and the terms of use.
   Loaded after site.css, and uses only its colour and type tokens, so light and dark both follow the system.
   No script is needed for anything here: the contents list, the anchors and the tables all work without one.

   The pieces, as the pages use them:
     .doc-head          the page head: eyebrow, h1.title, .doc-updated and .doc-summary
     .doc-layout        the contents list and the text: one column, two from 1000px wide
     nav.toc > ol       the contents list (a card above the text on narrow screens, a sticky column on wide ones)
     article.doc        the text itself: h2 and h3 with ids, p, ul, ol, dl.pairs, .table-wrap, .note, .blank
     a.anchor           the quiet "#" beside a heading
*/

/* ---------- the page around the text ---------- */

/* No script runs on these pages, so the header's rule is drawn always (on the front page site.js adds it). */
.doc-page .header::after { opacity: 1; }

/* On phones site.css hides the header links and keeps the status pill. Here the links matter more. */
@media (max-width: 560px) {
  .doc-page .nav { gap: 16px; }
  .doc-page .nav .nav-link { display: inline-flex; }
  .doc-page .nav-status { display: none; }
}
/* The brand already leads home, so the narrowest screens drop the separate Home link to keep one line. */
@media (max-width: 380px) {
  .doc-page .nav { gap: 14px; }
  .doc-page .nav .nav-home { display: none; }
}

.doc-wrap { padding-block: clamp(36px, 7svh, 80px) clamp(64px, 12svh, 128px); }

.doc-head { display: grid; gap: 14px; max-width: 44em; margin-bottom: clamp(32px, 6svh, 64px); }
.doc-head .title { margin-top: 2px; }
.doc-updated { font: 500 15px/22px var(--text); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.doc-summary { margin-top: 6px; }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: start; }

/* ---------- contents ---------- */

.toc { background: var(--surface); border-radius: 32px; padding: 24px 24px 20px; }
.toc-title { font: 600 15px/22px var(--text); color: var(--ink); margin-bottom: 8px; }
.toc ol { counter-reset: toc; display: grid; gap: 0; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex; gap: 12px; align-items: baseline;
  padding-block: 9px; min-height: 44px; box-sizing: border-box;
  font: 500 15px/22px var(--text); color: var(--ink-2);
  text-wrap: pretty;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  flex: none; min-width: 2ch;
  font-variant-numeric: tabular-nums; color: var(--ink-2); opacity: .75;
}
.toc a:hover { color: var(--ink); }

@media screen and (min-width: 1000px) {
  .doc-layout { grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: clamp(48px, 6vw, 112px); }
  .toc {
    position: sticky; top: calc(var(--header) + 32px);
    max-height: calc(100svh - var(--header) - 64px); overflow-y: auto; overscroll-behavior: contain;
    background: none; border-radius: 0; padding: 0 0 0 20px;
    border-left: 1px solid var(--border);
  }
  .toc a { min-height: 0; padding-block: 7px; }
}

/* ---------- the text ---------- */

.doc { max-width: 39em; font: 400 17px/28px var(--text); color: var(--ink); min-width: 0; }
.doc > * + * { margin-top: 18px; }
.doc p, .doc li, .doc dd { text-wrap: pretty; overflow-wrap: break-word; }

.doc h2 {
  font: 400 30px/1.15 var(--display); letter-spacing: -.02em; text-wrap: balance;
  margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--border);
}
.doc > h2:first-child { margin-top: 0; }
.doc h3 { font: 600 18px/26px var(--text); margin-top: 36px; }
.doc h2 + *, .doc h3 + * { margin-top: 14px; }
.doc h2 + h3 { margin-top: 24px; }
.doc h2, .doc h3 { scroll-margin-top: calc(var(--header) + 24px); }

/* The "#" beside a heading: shown on hover and on keyboard focus, and always (faintly) on touch screens. */
.doc .anchor {
  display: inline-block; margin-left: .3em; padding-inline: .15em;
  font-family: var(--text); font-weight: 500; color: var(--ink-2);
  text-decoration: none; opacity: 0;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus-visible { opacity: 1; }
.doc .anchor:hover { color: var(--accent-ink); }
@media (hover: none) { .doc .anchor { opacity: .55; } }

.doc strong { font-weight: 600; }
.doc .muted, .doc small { color: var(--ink-2); }
.doc small { font-size: 15px; line-height: 24px; }

/* Links in the text: a quiet underline that turns to the text colour on hover. */
.doc a:not(.anchor) {
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  text-decoration-color: var(--border-dashed);
  overflow-wrap: anywhere;
}
.doc a:not(.anchor):hover { text-decoration-color: currentColor; }

/* Lists: a small sun dot for bullets, plain numbers for steps. */
.doc ul, .doc ol { display: grid; gap: 10px; }
.doc ul > li { position: relative; padding-left: 24px; }
.doc ul > li::before { content: ""; position: absolute; left: 3px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--sun); }
.doc ol { counter-reset: step; }
.doc ol > li { position: relative; padding-left: 32px; counter-increment: step; }
.doc ol > li::before { content: counter(step) "."; position: absolute; left: 0; top: 0; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.doc li > ul, .doc li > ol { margin-top: 10px; }

/* What and why: a term, then its explanation. */
.doc .pairs { display: grid; gap: 0; }
.doc .pairs dt { font-weight: 600; padding-top: 14px; border-top: 1px solid var(--border); }
.doc .pairs dd { color: var(--ink-2); padding: 2px 0 14px; }
.doc .pairs dt:first-child { border-top: 0; padding-top: 0; }

/* In plain words: a short summary set apart from the full text. */
.note { background: var(--surface); border-radius: 20px; padding: 18px 20px; }
.note > * + * { margin-top: 8px; }
.note-label { font: 600 14px/20px var(--text); color: var(--ink-2); }
.doc .note { margin-top: 24px; }

/* An unfilled blank: impossible to miss on screen or on paper. */
.blank {
  padding: 1px 6px; border-radius: 6px;
  outline: 1.5px dashed var(--accent-ink); outline-offset: -1.5px;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 500;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------- tables ---------- */

.table-wrap { margin-top: 24px; }
.doc-table { width: 100%; border-collapse: collapse; font: 400 15px/22px var(--text); }
.doc-table caption { caption-side: top; text-align: left; font: 600 15px/22px var(--text); color: var(--ink); padding-bottom: 10px; }
.doc-table th, .doc-table td { text-align: left; vertical-align: top; padding: 12px 16px 12px 0; overflow-wrap: break-word; }
.doc-table th:last-child, .doc-table td:last-child { padding-right: 0; }
.doc-table th { font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--border-dashed); font-size: 14px; }
.doc-table td { border-bottom: 1px solid var(--border); }
.doc-table td:first-child { font-weight: 600; }
/* A short bold name for the row, then what it covers in ordinary weight. */
.doc-table .cell-detail { display: block; margin-top: 4px; font-weight: 400; }

/* Below 720px each row becomes a card, and each cell says which column it belongs to. */
@media screen and (max-width: 719.98px) {
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; width: 100%; }
  .doc-table caption { display: block; }
  .doc-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .doc-table tr { background: var(--surface); border-radius: 20px; padding: 14px 18px; }
  .doc-table tr + tr { margin-top: 10px; }
  .doc-table td { border: 0; padding: 6px 0; }
  .doc-table td[data-label]::before {
    content: attr(data-label); display: block;
    font: 600 13px/18px var(--text); color: var(--ink-2); margin-bottom: 2px;
  }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .doc .anchor { transition: opacity .25s ease; }
}

/* ---------- print ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  :root { --canvas: #fff; --surface: #fff; --ink: #000; --ink-2: #333; --border: #bbb; --border-dashed: #999; }
  html, body { background: #fff !important; color: #000 !important; }
  body { font: 400 11pt/1.45 var(--text); }
  .skip, .header, .footer, .doc .anchor { display: none !important; }

  .doc-wrap { padding: 0; max-width: none; }
  .doc-head { margin-bottom: 8mm; max-width: none; }
  .doc-head .title { font-size: 26pt; }
  .doc-summary { font-size: 12pt; color: #333; max-width: none; }

  /* The contents as a plain list at the top. */
  .doc-layout { display: block; }
  .toc { position: static; max-height: none; overflow: visible; background: none; border: 0; border-radius: 0; padding: 0; margin-bottom: 8mm; }
  .toc a { min-height: 0; padding-block: 1pt; font-size: 10.5pt; color: #000; }

  .doc { max-width: none; font: 400 11pt/1.45 var(--text); color: #000; }
  .doc > * + * { margin-top: 7pt; }
  .doc h2 { font-size: 17pt; margin-top: 14pt; padding-top: 10pt; border-top: 0.5pt solid #999; }
  .doc h3 { font-size: 12pt; margin-top: 10pt; }
  .doc h2, .doc h3 { break-after: avoid; page-break-after: avoid; }
  .doc p { orphans: 3; widows: 3; }
  /* Backgrounds do not print, so the bullet dot is drawn with a border instead. */
  .doc ul > li::before { background: none; width: 0; height: 0; border: 2.5pt solid #000; top: .55em; }
  .doc a:not(.anchor) { color: #000; text-decoration-color: #999; }
  .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9.5pt; color: #333; overflow-wrap: anywhere; }

  /* Tables are real tables again. */
  .doc-table { display: table; font-size: 10pt; line-height: 1.35; }
  .doc-table thead { display: table-header-group; position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
  .doc-table tbody { display: table-row-group; }
  .doc-table tr { display: table-row; background: none; border-radius: 0; padding: 0; }
  .doc-table th, .doc-table td { display: table-cell; padding: 5pt 8pt 5pt 0; border-bottom: 0.5pt solid #999; }
  .doc-table td[data-label]::before { content: none; }
  .doc-table tr, .note { break-inside: avoid; page-break-inside: avoid; }

  .note { border: 0.75pt solid #999; border-radius: 6pt; padding: 8pt 10pt; }
  .blank { background: none; color: #000; outline: 1pt dashed #000; outline-offset: -1pt; }
}
