/*
 * The legal pages (terms, privacy, dpa, subprocessors): a long-form reading column
 * with a sticky contents list on wide screens. Shared look: site.css.
 */

/* ---------------------------------------------------------------- layout */
.legal { padding-block: 56px 96px; }
/* Wide: contents on the left, spanning the head and the document. Narrow: head, contents, document. */
.legal-grid {
  display: grid; grid-template-columns: 232px minmax(0, 70ch); column-gap: 72px; justify-content: center; align-items: start;
}
.legal-grid > .doc-head { grid-column: 2; grid-row: 1; }
.legal-grid > .toc { grid-column: 1; grid-row: 1 / span 2; }
.legal-grid > .doc { grid-column: 2; grid-row: 2; }
@media (max-width: 1080px) {
  .legal-grid { grid-template-columns: minmax(0, 70ch); }
  .legal-grid > .doc-head, .legal-grid > .toc, .legal-grid > .doc { grid-column: 1; grid-row: auto; }
  .legal-grid > .toc { margin-bottom: 36px; }
}

.doc-head { margin-bottom: 40px; }
.doc-head h1 { font-size: clamp(36px, 5.4vw, 56px); line-height: 1.04; letter-spacing: -0.04em; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 16px; font: 13px/1.5 var(--mono); color: var(--text-2); }
.doc-meta b { font-weight: 500; color: var(--text); }
.doc-intro { margin-top: 22px; font-size: 18px; color: var(--text-2); }
.doc-intro + .doc-intro { margin-top: 12px; }

/* ---------------------------------------------------------------- contents */
.toc { position: sticky; top: 92px; max-height: calc(100vh - 116px); overflow-y: auto; padding-right: 4px; font-size: 14px; }
.toc h2 { font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: grid; grid-template-columns: 2.2em 1fr; padding: 5px 8px; border-radius: 6px; color: var(--text-2); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--text); background: var(--surface-2); }
.toc a span { font: 12.5px/1.6 var(--mono); color: var(--text-2); }
@media (max-width: 1080px) {
  .toc a { padding-block: 3px; }
  .toc { position: static; max-height: none; overflow: visible; padding: 18px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
}

/* ---------------------------------------------------------------- the document */
.doc section { padding-top: 28px; margin-top: 28px; border-top: 1px solid var(--line); }
.doc section:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.doc h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 800; display: flex; gap: 12px; align-items: baseline; margin-bottom: 14px; }
.doc h2 .n { font: 500 15px/1 var(--mono); color: var(--accent-ink); min-width: 1.6em; }
.doc h3 { font-size: 18px; margin: 24px 0 8px; }
.doc :is(p, li, dd) { font-size: 16px; line-height: 1.7; }
.doc :is(p + p, p + ul, ul + p, p + ol, ol + p, .clause + .clause, .clause + p, p + .clause) { margin-top: 12px; }
.doc a, .doc-head a { color: var(--text); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.doc a:hover, .doc-head a:hover { text-decoration-color: var(--accent); }
.doc strong { font-weight: 700; }
.doc code { font: 0.88em var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; }

/* A numbered clause: the number hangs in the margin of the column. */
.clause { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); column-gap: 6px; }
.clause > .n { font: 500 13px/1.7 var(--mono); padding-top: 2px; color: var(--text-2); }
.clause > div > p + p, .clause > div > p + ul, .clause > div > ul + p { margin-top: 10px; }
@media (max-width: 520px) { .clause { grid-template-columns: 2.9em minmax(0, 1fr); column-gap: 4px; } .clause > .n { font-size: 12px; } }

.doc ul, .doc ol.alpha { margin: 8px 0 0; padding-left: 22px; }
.doc ol.alpha { list-style: lower-alpha; }
.doc li + li { margin-top: 6px; }
.doc li::marker { color: var(--text-2); }

/* Definitions. */
.defs { margin: 0; display: grid; gap: 14px; }
.defs div { display: grid; gap: 2px; }
.defs dt { font-weight: 700; }
.defs dd { margin: 0; color: var(--text); }

/* "The short version" and similar asides. */
.summary { margin: 28px 0 0; padding: 20px 22px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.summary h2 { font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin: 0 0 10px; }
.summary ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.summary li { font-size: 15.5px; line-height: 1.6; }

.note { margin-top: 16px; padding: 14px 16px; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 15px; color: var(--text-2); }
.note strong { color: var(--text); }

/* ---------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14.5px; line-height: 1.55; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.table th, .table td { text-align: left; vertical-align: top; padding: 12px 14px; border-top: 1px solid var(--line); }
.table thead th { border-top: 0; font: 500 11.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); }
.table tbody th { font-weight: 700; }
.table td ul { margin: 0; padding-left: 18px; }
.table td li { font-size: 14.5px; line-height: 1.55; }
.table td li + li { margin-top: 4px; }
/* Narrow screens: each row becomes a card, each cell labelled from its column. */
@media (max-width: 720px) {
  .table, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tbody tr { border-top: 1px solid var(--line-strong); padding: 6px 0; }
  .table tbody tr:first-child { border-top: 0; }
  .table tbody th, .table td { border-top: 0; padding: 6px 14px; }
  .table td[data-label]::before { content: attr(data-label); display: block; font: 500 11px/1.6 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
}

.doc .back-top { margin-top: 48px; font: 13px var(--mono); }
.doc .back-top a { color: var(--text-2); }

@media print {
  .topbar, .toc, footer, .back-top { display: none; }
  .legal-grid { display: block; }
  body { background: #fff; color: #000; }
}

/* The company behind a subprocessor, under its name. */
.table .org { display: block; margin-top: 2px; font-weight: 400; font-size: 13px; color: var(--text-2); }
@media (max-width: 520px) {
  .legal { padding-block: 32px 72px; }
  .doc-intro { font-size: 17px; }
}

/* A table too wide for the column (subprocessors): one card per row at every width. */
.table.cards, .table.cards tbody, .table.cards tr, .table.cards th, .table.cards td { display: block; width: auto; }
.table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.table.cards tbody tr { border-top: 1px solid var(--line-strong); padding: 10px 0 12px; }
.table.cards tbody tr:first-child { border-top: 0; }
.table.cards tbody th, .table.cards td { border-top: 0; padding: 6px 18px; }
.table.cards tbody th { font-size: 17px; padding-top: 10px; }
.table.cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font: 500 11px/1.6 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
@media (min-width: 721px) {
  .table.cards tbody tr { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 0.8fr); column-gap: 4px; }
  .table.cards tbody th { grid-column: 1 / -1; }
}
